Greasy Fork

来自缓存

Greasy Fork is available in English.

xtu评教

xtu教务系统自动评教

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name        xtu评教
// @namespace   http://tampermonkey.net/
// @match       http://jwxt.xtu.edu.cn/jsxsd/xspj/xspj_*
// @grant       none
// @version     1.1
// @author      D15h35
// @description xtu教务系统自动评教
// @require      https://ajax.aspnetcdn.com/ajax/jquery/jquery-3.5.1.min.js
// ==/UserScript==
var $ = window.jQuery;
window.confirm = function () { return true; }
window.alert = function () { return true; }

function closeWebPage() {
    if (navigator.userAgent.indexOf("MSIE") > 0) {//close IE
        if (navigator.userAgent.indexOf("MSIE 6.0") > 0) {
            window.opener = null;
            window.close();
        } else {
            window.open('', '_top');
            window.top.close();
        }
    }
    else if (navigator.userAgent.indexOf("Firefox") > 0) {//close firefox
        window.location.href = 'about:blank ';
    } else {//close chrome;It is effective when it is only one.
        window.opener = null;
        window.open('', '_self');
        window.close();
    }
}

if (location.pathname === "/jsxsd/xspj/xspj_list.do") {
    let pages = [];
    let appraise = $("a");
    let pageIndex = 0;

    if (appraise != null) {
        appraise.each(function (index, a) {
            if ($(a).text() === "评价") {
                pages.push($(a).attr('href').match(/'(\/[^\s]*)'/)[1]);
            }
        });
    }

    if (pages.length != 0) {
        let h = setInterval(() => {
            window.open(pages[pageIndex]);
            if (pageIndex == pages.length - 1) {
                clearInterval(h);
            }
            pageIndex++;
        }, 2000);
    }
} else if (location.pathname === "/jsxsd/xspj/xspj_edit.do") {
    let tj = $("#tj");
    if (tj != null) {
        let radioNum = $("input[id^='pj0601id'][id$='_1']");
        console.log(radioNum.length);
        for (let pageIndex = 1; pageIndex <= radioNum.length; pageIndex++) {
            $("#pj0601id_" + pageIndex + "_" + [1, 2][Math.floor(Math.random() * 2)]).attr("checked", true);
        }
        // tj.trigger("click");
        let f = new FormData(document.querySelector("#Form1"));
        f.set("issubmit", "1");
        let data = "";
        f.forEach((v, k) => data += `${k}=${v}&`);
        data = data.slice(0, -1);
        let xhr = new XMLHttpRequest();
        xhr.open(document.getElementById("Form1").method, document.getElementById("Form1").action);
        xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
        xhr.onload = (data) => console.log(data);
        xhr.send(data);
        setTimeout(function () { closeWebPage(); }, 2000);
    }
}