// ==UserScript== // @name NUIST/NWAFU/GDOU/QFNU实验室安全测试 // @namespace myetyet // @version 1.4 // @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 // @match http://210.38.136.71:8090/redir.php?catalog_id=6&cmd=dati // @match http://aqjy.qfnu.edu.cn/redir.php?catalog_id=6&cmd=dati // @require https://greasyfork.org/scripts/391129-nuist-examsafety-question-bank/code/NUIST%20examsafety%20Question%20Bank.js?version=744868 // @run-at document-end // @grant none // @downloadURL 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(); } } })();