Edit OJ评测结果魔改器.user.js

This commit is contained in:
2024-06-02 07:47:05 +00:00
parent 581943afa2
commit 1f026a0930

View File

@ -1,7 +1,7 @@
// ==UserScript==
// @name OJ评测结果魔改器
// @namespace https://zymsite.ink/
// @version 1.0.1
// @version 1.0.2
// @description 胡乱修改评测结果显示页面
// @author happyZYM
// @match https://acm.sjtu.edu.cn/OnlineJudge/*
@ -12,7 +12,7 @@
'use strict';
function replaceTextContent(node, targetText, replacementText) {
if (node.nodeType === Node.TEXT_NODE) {
// 如果是文本节点,并且文本内容包含 `Accepted`,则替换成新的文本
// 如果是文本节点,并且文本内容包含 targetText,则替换成新的文本
node.nodeValue = node.nodeValue.replace(targetText, replacementText);
} else {
// 如果节点是元素节点,需要检查它的文本内容
@ -26,8 +26,6 @@
}
}
}
// 从网页的 body 元素开始,替换所有文本内容为 `Accepted` 的节点
replaceTextContent(document.body, 'Accepted', 'Answer Corrupt');
replaceTextContent(document.body, 'Wrong Answer', 'Wonderful Answer');
replaceTextContent(document.body, 'Time Limit Exceeded', 'Time Limit Enough');