您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Make your life easier when comparing the results in JOJ!
// ==UserScript== // @name JOJ Simple Diff // @namespace http://tampermonkey.net/ // @version 0.2 // @description Make your life easier when comparing the results in JOJ! // @author BoYanZh // @match https://joj.sjtu.edu.cn/d/* // @grant none // ==/UserScript== (function() { 'use strict'; String.prototype.rstrip = function() { return String(this).replace(/\s+$/g, ''); }; var stdout = document.querySelector("#stdout > div.section__body > pre"); var answer = document.querySelector("#answer > div.section__body > pre"); var stdoutTexts = stdout.textContent.split("\n"); var answerTexts = answer.textContent.split("\n"); for(var index1 = 0, index2 = 0; index1 < stdoutTexts.length && index2 < answerTexts.length;){ if(answerTexts[index2].rstrip() !== stdoutTexts[index1].rstrip()){ stdout.innerHTML = stdout.textContent.replace(stdoutTexts[index1], '<span style="background:red;">' + stdoutTexts[index1] + '</span>'); --index1; } ++index1;++index2; } })();