您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
高亮标注有课状态,以及仅看有课的筛选
// ==UserScript== // @name 选课标识辅助 // @namespace http://tampermonkey.net/ // @version 1.0.0 // @description 高亮标注有课状态,以及仅看有课的筛选 // @author Erix // @license MIT // @match https://elective.pku.edu.cn/elective2008/edu/pku/stu/elective/controller/courseQuery/getCurriculmByForm.do* // @match https://elective.pku.edu.cn/elective2008/edu/pku/stu/elective/controller/courseQuery/queryCurriculum.jsp* // @match https://elective.pku.edu.cn/elective2008/edu/pku/stu/elective/controller/courseQuery/engGridFilter.do* // @icon https://www.pku.edu.cn/pku_logo_red.png // @grant none // ==/UserScript== (function() { 'use strict'; const underLimitStyle = 'background-color: #abebc6; color: #145a32'; const reachLimitStyle = 'background-color: #f5b7b1; color: #7b241c'; const table = document.querySelector('table.datagrid'); const rows = table.querySelectorAll('tr.datagrid-all,tr.datagrid-even,tr.datagrid-odd'); let index = 10; rows.forEach(row => { const EngSign = row.children[2].textContent.trim(); if (EngSign === 'Y' || EngSign === 'A' || EngSign === 'B' || EngSign === 'C' || EngSign === 'C+' ){ index = 11; } const capacity = row.children[index].textContent.trim(); const match = capacity.match(/(\d+)\s*\/\s*(\d+)/); if (match) { const firstNumber = parseInt(match[1], 10); const secondNumber = parseInt(match[2], 10); //console.log(firstNumber, secondNumber); if (firstNumber > secondNumber){ row.children[index].style = underLimitStyle; } else{ row.children[index].style = reachLimitStyle; } } else { console.error("Invalid format:", capacity); } }); function courseFilter() { if(btn.textContent === '只看有课'){ btn.textContent = '查看全部'; rows.forEach(row => { const capacity = row.children[index].textContent.trim(); const match = capacity.match(/(\d+)\s*\/\s*(\d+)/); if (match) { const firstNumber = parseInt(match[1], 10); const secondNumber = parseInt(match[2], 10); //console.log(firstNumber, secondNumber); if (firstNumber <= secondNumber){ row.style.display = 'none'; } } else { console.error("Invalid format:", capacity); } }); }else{ btn.textContent = '只看有课'; rows.forEach(row => { row.style.display = ''; }); } } const btn = document.createElement('button'); btn.style.fontSize = '12px'; btn.textContent = '只看有课'; btn.onclick = courseFilter; const inputBox = document.querySelector('table.datagrid'); inputBox.parentNode.insertBefore(btn, inputBox); })();
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址