您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
增加AC,WA标志
当前为
// ==UserScript== // @name 乐学增强 // @namespace YinTianliang_i // @version 0.1 // @description 增加AC,WA标志 // @author Yin Tianliang // @include *//online.bit.edu.cn/moodle/course/view.php* // @grant none // ==/UserScript== /*jshint esversion: 6 */ problem_list = document.getElementsByClassName("activity programming modtype_programming"); if (!localStorage.AC) { window.localStorage.AC = ""; } 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 (window.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") { window.localStorage.AC += "|" + problem_id; dstDiv.innerHTML = '<div style="color:green"><b>AC</b></div>'; } else { dstDiv.innerHTML = '<div style="color:red"><b>WA</b></div>'; } } }); } else { dstDiv.innerHTML = '<div style="color:green"><b>AC</b></div>'; } }