// ==UserScript== // @name 测试 // @namespace http://tampermonkey.net/ // @version 1.2 // @description 万方教务网查看学分 // @compatible chrome // @include *://*.edu.cn/* // @license MIT // @require https://cdn.jsdelivr.net/npm/jquery@3.2.1/dist/jquery.min.js // @downloadURL none // ==/UserScript== (function () { 'use strict'; $(document).keydown(function (event) { if (event.keyCode == 8) { console.clear(); let xn=$("#xnm_chosen").find("span").text(); let xq=$("#xqm_chosen").find("span").text(); let $td_xf = $("td[aria-describedby='tabGrid_xf']"); let sum = 0; for (let i = 0; i < $td_xf.length; i++) { let xf = $td_xf.eq(i).attr("title"); sum += parseFloat(xf); } console.log("第" + xn+"学年 第"+xq+"学期"); console.log("总学分:" + sum); } }); })();