// ==UserScript== // @name 正方教务教学评价填写(改,方便用户) // @version 0.1 // @description 正方教务(默认唐职),自己学校可在代码@match 自行更改 // @author 原作者:JHPatchouli // @author 改:鹏 // @match *://*vpn.tsvtc.edu.cn/* // ==/UserScript== (function () { const sleep = (delay) => new Promise((resolve) => SetTimeout(resolve, delay)); let divObj = document.createElement('div'); // 生成按钮HTML divObj.innerHTML = ` `; // 给容器设置样式 divObj.style = ` position: fixed; z-index: 999; top: 10px; left: 50%; transform: translateX(-50%); margin: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; text-align: center; width: 100%; `; // 给页面添加按钮容器 document.body.appendChild(divObj); // 自定义按钮样式 const styles = ` .custom-btn { width: 120px; height: 45px; background-color: #4CAF50; color: white; border: none; border-radius: 8px; font-size: 14px; cursor: pointer; transition: background-color 0.3s, transform 0.2s; box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1); } .custom-btn:hover { background-color: #45a049; transform: translateY(-3px); } .custom-btn:active { background-color: #3e8e41; transform: translateY(1px); } .custom-btn:focus { outline: none; } .special-btn { background-color: #FF9800; } .special-btn:hover { background-color: #FB8C00; } .special-btn:active { background-color: #F57C00; } `; // 添加样式到页面头部 const styleTag = document.createElement('style'); styleTag.innerHTML = styles; document.head.appendChild(styleTag); // 按钮点击事件 btna.addEventListener('click', async function () { var doc = document.getElementsByClassName("radio-pjf"); var docle = doc.length; for (let i = 0; i < docle; i += 5) { const elemen = doc[i]; elemen.checked = "true"; } await sleep(4000); }); btnb.addEventListener('click', async function () { var doc = document.getElementsByClassName("radio-pjf"); var docle = doc.length; for (let i = 1; i < docle; i += 5) { const elemen = doc[i]; elemen.checked = "true"; } await sleep(4000); }); btnc.addEventListener('click', async function () { var doc = document.getElementsByClassName("radio-pjf"); var docle = doc.length; for (let i = 2; i < docle; i += 5) { const elemen = doc[i]; elemen.checked = "true"; } await sleep(4000); }); btnd.addEventListener('click', async function () { var doc = document.getElementsByClassName("radio-pjf"); var docle = doc.length; for (let i = 3; i < docle; i += 5) { const elemen = doc[i]; elemen.checked = "true"; } await sleep(4000); }); btne.addEventListener('click', async function () { var doc = document.getElementsByClassName("radio-pjf"); var docle = doc.length; for (let i = 4; i < docle; i += 5) { const elemen = doc[i]; elemen.checked = "true"; } await sleep(4000); }); btnf.addEventListener('click', async function () { var doc = document.getElementsByClassName("radio-pjf"); var docle = doc.length; for (let i = 0; i < docle; i += 5) { const elemen = doc[i]; elemen.checked = "true"; // 选择"很满意" } for (let i = 1; i < docle; i += 5) { const elemen = doc[i]; elemen.checked = "true"; // 选择第一个"满意" break; // 只选择第一个满意 } await sleep(4000); }); btnMemory.addEventListener('click', function () { var doc = document.getElementsByClassName("radio-pjf"); var docle = doc.length; var selectedValues = []; // 获取当前选中的评分 for (let i = 0; i < docle; i++) { selectedValues.push(doc[i].checked ? doc[i].value : null); } // 将选中的评分结果存储到 localStorage localStorage.setItem('savedRatings', JSON.stringify(selectedValues)); alert("评分已记忆!"); }); btnPaste.addEventListener('click', function () { var savedRatings = localStorage.getItem('savedRatings'); if (!savedRatings) { alert("没有记忆的评分!"); return; } var doc = document.getElementsByClassName("radio-pjf"); var docle = doc.length; var savedValues = JSON.parse(savedRatings); // 恢复之前保存的评分 for (let i = 0; i < docle; i++) { if (savedValues[i] && doc[i].value === savedValues[i]) { doc[i].checked = true; } } alert("评分已粘贴!"); }); btnScrollToBottom.addEventListener('click', function () { // 直接滚动到页面最底部 window.scrollTo(0, document.body.scrollHeight); }); // 页面加载时自动选择最大条目数 window.addEventListener('load', function () { // 查找