// ==UserScript== // @name hjsf自动教评 // @namespace http://tampermonkey.net/ // @version 1.4 // @match http://jwgl.hjnu.edu.cn:82/* // @match https://webvpn.hjnu.edu.cn/* // @grant GM_addStyle // @description 一键勾选全部满分选项,自动随机填充好评文本,手动保存后自动顺序切换下一位老师,无需重复点击按钮 // @run-at document-end // @license MIT // @tag 汉江师范学院 // @tag 教务系统 // ==/UserScript== (function() { 'use strict'; GM_addStyle(` #allCheckBtn { position: fixed !important; top: 140px !important; right: 15px !important; z-index: 9999999 !important; padding: 10px 16px !important; background: #0052cc !important; color: #fff !important; border: none !important; border-radius: 6px !important; cursor: pointer !important; box-shadow: 0 2px 8px #0003 !important; pointer-events: auto !important; } `); let currentRowId = null; let switchLock = false; let needAutoFill = false; // 新增:自动填写锁,防止重复执行 let fillLock = false; let boxes = 0; function sleep(minMs, maxMs) { const t = Math.floor(Math.random() * (maxMs - minMs) + minMs); return new Promise(res => setTimeout(res, t)); } function getXPathAll(xpathStr) { const list = []; const res = document.evaluate(xpathStr, document, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null); for(let i=0; i { input.checked = true; input.dispatchEvent(new Event("change", {bubbles:true})); }); fillTextarea(); alert("请提交或保存") // 填写完成,清除自动填充标记 needAutoFill = false; fillLock = false; return true; } const saveObserver = new MutationObserver(async () => { const formBox = getXPathOne('/html/body/div[2]/div/div/div[4]/div[2]/div/div[3]/form'); if (!formBox && currentRowId && !switchLock) { await clickNextTeacherRow(); } if (formBox && needAutoFill && !fillLock) { await sleep(1500, 2500); await checkAllTableBox(); } }); saveObserver.observe(document.body, { childList: true, subtree: true }); function createBtn() { if(document.getElementById("allCheckBtn")) return; const btn = document.createElement("button"); btn.id = "allCheckBtn"; btn.textContent = "填写"; btn.onclick = checkAllTableBox; document.body.appendChild(btn); } window.addEventListener("DOMContentLoaded", createBtn); setTimeout(createBtn, 800); const observer = new MutationObserver(() => createBtn()); observer.observe(document.body, {childList:true, subtree:true}); })();