Greasy Fork

Greasy Fork is available in English.

NUIST/NWAFU实验室安全测试

南京信息工程大学、西北农林科技大学实验室实验室安全网上考试答案自动填充

当前为 2019-11-02 提交的版本,查看 最新版本

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         NUIST/NWAFU实验室安全测试
// @namespace    myetyet
// @version      1.2
// @description  南京信息工程大学、西北农林科技大学实验室实验室安全网上考试答案自动填充
// @author       myetyet
// @match        http://examsafety.nuist.edu.cn/redir.php?catalog_id=6&cmd=dati
// @match        https://labsafe.nwafu.edu.cn/redir.php?catalog_id=6&cmd=dati
// @require      http://greasyfork.icu/scripts/391129-nuist-examsafety-question-bank/code/NUIST%20examsafety%20Question%20Bank.js?version=744868
// @run-at       document-end
// @grant        none
// ==/UserScript==

(function() {
    'use strict';
    var questions = document.getElementsByClassName("shiti");
    var tmp, question, index, answer;
    var notfounds = new Array();
    var notfound = 0;
    for (var i = 0; i < questions.length; ++i) {
        tmp = questions[i].children[0].textContent.split("\u3001");
        index = tmp.shift();
        question = tmp.join("\u3001").replace(/\s/g, "");
        answer = findAnswer(question);
        if (answer != "") {
            document.getElementById("ti_" + String(index) + "_" + answer).click();
        } else {
            notfounds[notfound++] = String(index);
            questions[i].children[0].setAttribute("style", "color:red");
        }
    }
    if (notfound > 0) {
        alert("\u6b64\u9875\u9762\u5171\u6709" + String(notfound) + "\u9053\u9898\u672a\u80fd\u81ea\u52a8\u586b\u5145\uff1a" + notfounds.join("\u3001"));
    } else {
        var next = document.getElementsByClassName("nav")[0].children[0];
        if (next && next.value == "\u4e0b\u4e00\u9875") {
            next.click();
        } else {
            document.getElementsByClassName("nav")[0].children[1].click();
        }
    }
})();