// ==UserScript== // @name 天大评教助手 (自动差评,勿用) // @namespace http://tampermonkey.net/ // @version 1.0 // @description 自动选择所有题目为“第一个选项”(通常是不满意),并填充改进建议。 // @author SECRET // @match *://saa.tju.edu.cn/eams/* // @match *://saa.tju.edu.cn/* // @grant none // ==/UserScript== (function() { 'use strict'; // 批评性评语库 (比较委婉,防止被直接过滤) const COMMENTS = [ "授课重点不够突出,很难跟上节奏,希望改进。", "课堂互动较少,气氛较为沉闷,建议增加互动。", "教学内容照本宣科,缺乏深度,建议结合实际。", "教学进度安排不太合理,对学生关注度不够。", "板书潦草,讲解逻辑不够清晰,希望能调整教学方式。" ]; function runTask() { const radios = document.querySelectorAll('input[type="radio"]'); if (radios.length === 0) return; // 1. 自动选择第一个选项 (通常是差评) const groups = {}; radios.forEach(radio => { if (!groups[radio.name]) groups[radio.name] = []; groups[radio.name].push(radio); }); let count = 0; for (const name in groups) { const options = groups[name]; if (options.length > 0) { options[0].click(); // <--- 核心修改:点击第0个(第一个选项) count++; } } // 2. 填充批评性评语 const textareas = document.querySelectorAll('textarea'); textareas.forEach(area => { area.value = COMMENTS[Math.floor(Math.random() * COMMENTS.length)]; area.dispatchEvent(new Event('input')); area.dispatchEvent(new Event('change')); }); console.log(`已自动填写 ${count} 道题目 (差评)`); } function createButton() { // 清理旧按钮 (避免和好评版重叠,这里ID设为不一样) document.getElementById('tju-bad-rate-btn')?.remove(); if (document.querySelectorAll('input[type="radio"]').length === 0) return; const btn = document.createElement('div'); btn.id = 'tju-bad-rate-btn'; btn.innerHTML = '💀 一键差评'; btn.style.cssText = ` position: fixed; top: 28%; /* 位置稍微错开,防止和好评按钮重叠 */ right: 20px; z-index: 99999; background: #333333; /* 黑色背景,警示 */ color: #ff4d4f; /* 红色文字 */ padding: 10px 20px; border-radius: 6px; cursor: pointer; font-weight: bold; font-size: 14px; box-shadow: 0 2px 8px rgba(0,0,0,0.5); user-select: none; border: 1px solid #ff4d4f; `; btn.onclick = () => { // 增加一个确认弹窗,防止手滑 if(confirm("⚠️ 确定要给出全差评吗?\n这就等于给老师打0分,请谨慎操作!")) { runTask(); btn.innerHTML = '💀 已执行'; } }; document.body.appendChild(btn); } setTimeout(createButton, 1000); setTimeout(createButton, 2000); })();