Greasy Fork is available in English.

OneClickToEvaluate

2020/9/25 下午9:27:08

// ==UserScript==
// @name:zh-CN  一键评教脚本
// @name        OneClickToEvaluate
// @namespace   Violentmonkey Scripts
// @match       http://jwxt.buaa.edu.cn:7001/ieas2.1/welcome*
// @grant       GM_registerMenuCommand
// @version     2.0
// @author      jason
// @description 2020/9/25 下午9:27:08
// ==/UserScript==

function sleep(time) {
    return new Promise((resolve) => setTimeout(resolve, time));
}

let IfClicked = false;

function Start() {
    if (IfClicked) {
        return;
    }
    IfClicked = true;

    $('body').append(`<iframe id="hiddenframe" name="hiddenframe" style="display:none"></iframe>`);
    window.alert = window.confirm = function () { return true };

    let $frame = $('#iframename');
    let frame = $frame[0].contentWindow;
    frame.location.href = '/ieas2.1/xspj/Fxpj_fy';

    $frame.load(async () => {
        frame.$('#queryform').attr('target', 'hiddenframe');

        let $hidden = $('#hiddenframe');
        let hidden = $hidden[0].contentWindow;

        $hidden.load(() => {
            let $input = hidden.$("input[name^=tabmapzb]");
            for (const i of [1, 5, 10, 15, 20, 25]) {
                $input[i].click();
            }
            hidden.$('#sftj').val('1');
            hidden.tj();
        });

        let $teachers = hidden.$('span.yellow>a');
        for (let i = 0; i < $teachers.length; i++) {
            $teachers[i].click();
            await sleep(200);
        }
        await sleep(1000);
        console.log('评教成功...');
        frame.location.reload();
    });
}

GM_registerMenuCommand('开始评教', Start);