您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
增强北理工乐学的功能
当前为
// ==UserScript== // @name 北理工乐学增强 // @namespace YinTianliang_i // @version 0.4.1 // @description 增强北理工乐学的功能 // @author Yin Tianliang // @include *//online.bit.edu.cn/* // @grant none // @require https://code.jquery.com/jquery-3.2.1.min.js // ==/UserScript== /*jshint esversion: 6 */ let divTemp = (color, text) => { return `<div style="color:${color}"><b>${text}</b></div>`; }; if (/course\/view.php\?id=\d+/.test(location.toString())) { problem_list = document.getElementsByClassName("activity programming modtype_programming"); for (let problem of problem_list) { let problem_id = problem.id.split("-")[1]; let dstDiv = problem.firstChild.firstChild.firstChild; // 有些题目没有没对齐不能忍 if (dstDiv.className == "mod-indent") { dstDiv.className += " mod-indent-1"; } // 待优化 if (!localStorage.AC || localStorage.AC.indexOf(problem_id) == -1) { $.post(`http://online.bit.edu.cn/moodle/mod/programming/result.php?id=${problem_id}`, null, res => { matches = res.match(/未能通过的有 *(\d)* *个/); if (matches) { if (matches[1] == "0") { if (!localStorage.AC) { localStorage.AC = problem_id; } else { localStorage.AC += "|" + problem_id; } dstDiv.innerHTML = divTemp('green', 'AC'); } else { dstDiv.innerHTML = divTemp('red', 'WA'); } } else if (/当前状态:程序编译失败。/.test(res)) { dstDiv.innerHTML = divTemp('orange', 'CE'); } else if (/当前状态:程序已提交,正等待编译。/.test(res)) { dstDiv.innerHTML = divTemp('gray', 'PE'); } }); } else { dstDiv.innerHTML = divTemp('green', 'AC'); } } // 增加 "自己的AC数" let table = document.getElementsByClassName('generaltable')[1].children[1]; let row = table.insertRow(0); row.insertCell(0).textContent = '0'; row.insertCell(1).textContent = 'Your'; row.insertCell(2).textContent = localStorage.AC.split('|').length; } // 隐藏 上传文件 if (/programming\/submit.php\?id=\d+/.test(location.toString())) document.getElementsByClassName('fitem fitem_ffilepicker')[0].style = 'display:none'