Greasy Fork

Greasy Fork is available in English.

NUIST/NWAFU实验室安全测试

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

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

// ==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();
        }
    }
})();