// ==UserScript== // @name 南工大自动评教 // @namespace Violentmonkey Scripts // @match http*://*.edu.cn/*xspjgl/xspj_cxXspjIndex.html* // @grant none // @version 1.2 // @author PairZhu // @description 南京工业大学自动评教脚本,随机选择一个赞同,其余选择完全赞同 // @license GPL // @downloadURL none // ==/UserScript== const wait = ms => { return new Promise(resolve => { const rt = () => resolve() setTimeout(rt, ms) }) } const alldo = async () => { let k = 0; for (let j of document.querySelector("#tempGrid > tbody").children) { if (j.querySelector("td:nth-child(8)").innerText == "未评") { j.click(); await wait(1000); evaluation(); await wait(500); } } alert("完成"); } const evaluation = () => { let arr = document.querySelectorAll(".radio-pjf"); for (let i = 0; i < arr.length; i += 5) { arr[i].click(); } let num = Math.floor(Math.random() * arr.length / 5); arr[5 * num + 1].click(); document.querySelector(".form-control").value = "很好"; document.querySelector("#btn_xspj_tj").click(); document.querySelector("#btn_ok").click(); } const init = () => { tempe = document.createElement('button'); tempe.innerText = '全部评价'; tempe.type = 'button'; tempe.onclick = alldo; document.querySelector("#kc-head").appendChild(tempe); tempe = document.createElement('button'); tempe.innerText = '评价当前页'; tempe.type = 'button'; tempe.onclick = evaluation; document.querySelector("#kc-head").appendChild(tempe); } setTimeout(init, 100)