Greasy Fork

Greasy Fork is available in English.

OneStepSCUPJ

try to take over the world!

当前为 2020-05-20 提交的版本,查看 最新版本

// ==UserScript==
// @name         OneStepSCUPJ
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  try to take over the world!
// @author       Justin Song
// @require      https://cdn.staticfile.org/jquery/3.5.1/jquery.min.js
// @match        http://zhjw.scu.edu.cn/student/teachingEvaluation/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';
    var pjtextList = [
        "老师讲课重点突出,授课条理清晰,认真负责,严谨,耐心,内容丰富,涉及内容十分广泛。课堂气氛很好,总是能够把授课内容和社会实际结合起来,授课内容通俗易懂。对于同学提出的建议能够认真的采纳。",
        "老师讲课十分投入,内容纲举目分,条理性很强,而且特别善于举例,让同学们理论联系实际,学习起来十分轻松,而且印象深刻,收到良好的效果。老师为人和蔼,课堂能与同学们互动,营造温馨的课堂气氛。",
        "老师上课时备课充分,语言流畅,思路清晰,课堂上有许多生动的案例分析,课堂互动时间也很多。不足之处是实验课程没有太多收获。"
    ]
    var pendingList = [];

    function mainPJ(){
        var info = document.createElement('div');
        var text = document.createElement('p')
        text.textContent = "等待10s后开始评教"
        info.appendChild(text);
        info.className = "pjtips";
        info.style.cssText = "position: fixed;top: 20px;right: 30px;height: 50px;width: 200px;text-align: center;z-index: 10000;background-color: white;border-radius: 10px;display: flex;justify-content: center;align-items: center;box-shadow: 0px 0px 12px 2px rgba(0,0,0,.1);transition:opacity 0.3s ease;opacity:0;"
        document.body.appendChild(info);
        setTimeout(()=>{
            $(info).css('opacity',1);
        },0)
        setTimeout(()=>{
            $(info).fadeOut(function(){
                document.body.removeChild(info);
                const nodeList = document.querySelectorAll("input.ace")
                nodeList.forEach((el,idx)=>{
                    if(idx%5===0){
                        el.click();
                    }
                })
                const textArea = document.querySelector('.form-control')
                textArea.value = pjtextList[Math.floor(Math.random()*pjtextList.length)];
                document.querySelector('#buttonSubmit').click();
            });
        },10000)
    }

    function initInIndex(){
        pendingList = [...document.querySelectorAll('#jxpgtbody button')].filter((el)=>el.innerText!=="查看");
        localStorage.setItem('pendingList',JSON.stringify(pendingList));
        if(pendingList.length>0){
            const curProc = pendingList.shift();
            curProc.click();
        }else {
            delete localStorage.pendingList;
            alert("Done");
            return;
        }
    }

    window.onload = function(){
        if(location.href==="http://zhjw.scu.edu.cn/student/teachingEvaluation/evaluation/index"){
            //index页
            this.console.log('回到首页');
            initInIndex();
        }else if(location.href==="http://zhjw.scu.edu.cn/student/teachingEvaluation/teachingEvaluation/evaluationPage"){
            let plist = localStorage.getItem('pendingList');
            if(plist){
                mainPJ();
            }else {
                alert("需要先回到首页进行初始化")
                location.href = "http://zhjw.scu.edu.cn/student/teachingEvaluation/evaluation/index";
            }
        }
    }
})();