// ==UserScript== // @name CSUFT 平时分查询 - 手动执行表格处理 // @namespace http://tampermonkey.net/ // @version 2025-07-12 // @description 点击分数查看平时分 // @author crdddd // @match http://jwgl.webvpn.csuft.edu.cn/jsxsd/kscj/cjcx_frm // @grant none // @license MIT // @downloadURL none // ==/UserScript== (function () { 'use strict'; // 创建按钮并插入到页面中 const button = document.createElement('button'); button.textContent = '点击分数查看平时分'; button.style.position = 'fixed'; button.style.top = '20px'; button.style.right = '20px'; button.style.zIndex = '9999'; button.style.padding = '10px 20px'; button.style.backgroundColor = '#4CAF50'; button.style.color = 'white'; button.style.border = 'none'; button.style.borderRadius = '5px'; button.style.cursor = 'pointer'; button.style.fontSize = '16px'; button.style.boxShadow = '0 2px 4px rgba(0,0,0,0.2)'; // 将按钮插入页面 document.body.appendChild(button); // 主处理函数 function processTable() { try { console.log("🔍 正在尝试获取 iframe 和表格..."); // 查找 iframe const iframe = document.getElementById("cjcx_list_frm"); if (!iframe || !iframe.contentDocument) { console.warn("⚠️ iframe 尚未加载完成"); return; } // 查找表格 const table = iframe.contentDocument.getElementById("dataList"); if (!table) { console.warn("⚠️ 未找到 id='dataList' 的表格"); return; } console.log("✅ 成功获取到表格", table); // 获取 tbody const tbody = table.querySelector("tbody"); if (!tbody) { console.warn("⚠️ 表格中未找到 tbody"); return; } // 获取所有行 const rows = tbody.querySelectorAll("tr"); if (rows.length === 0) { console.warn("⚠️ 表格中没有数据行"); return; } // 遍历每一行 rows.forEach(row => { const comments = getCommentsFromElement(row); if (comments.length < 1) { console.debug("🛈 当前行无注释内容"); return; } const Comment = comments[1] || "无注释"; const newTdHtml = `