跳到正文

科技·工程

NKOJ修改提交记录背景

ljy05约 7 分钟
原文
文章信息与版本

文章信息

发布
2025年3月28日
收录
2025年12月12日
更新
2026年11月5日
篇幅
约 7 分钟

版本

  1. v1当前
JavaScript
// ==UserScript==
// @name         NKOJ提交记录显示优化
// @namespace    http://tampermonkey.net/
// @version      0.2
// @description  修改提交记录背景
// @author       ljy05 修改自 https://www.luogu.com.cn/article/xscqjzbk
// @match        *://oi.nks.edu.cn:19360/zh/Submission/Details*
// @run-at       document-end
// @license      MIT
// @downloadURL  https://github.com/chenyuxuan2009/luogu_submission_better/blob/main/luogu_submission_better.js
// @updateURL    https://github.com/chenyuxuan2009/luogu_submission_better/blob/main/luogu_submission_better.js
// ==/UserScript==

function main() {
    let AC = 'https://bgithub.xyz/chenyuxuan2009/luogu_submission_better/blob/main/AC.gif?raw=true'
    let WA = 'https://bgithub.xyz/chenyuxuan2009/luogu_submission_better/blob/main/WA.gif?raw=true'
    let TLE = 'https://bgithub.xyz/chenyuxuan2009/luogu_submission_better/blob/main/TLE.gif?raw=true'
    let MLE = 'https://bgithub.xyz/chenyuxuan2009/luogu_submission_better/blob/main/MLE.gif?raw=true'
    let RE = 'https://bgithub.xyz/chenyuxuan2009/luogu_submission_better/blob/main/RE.gif?raw=true'
    let OLE = 'https://bgithub.xyz/chenyuxuan2009/luogu_submission_better/blob/main/OLE.gif?raw=true'
    let UKE = 'https://bgithub.xyz/chenyuxuan2009/luogu_submission_better/blob/main/UKE.gif?raw=true'
    let Judging = 'https://bgithub.xyz/chenyuxuan2009/luogu_submission_better/blob/main/Judging.gif?raw=true'
    let tc = document.getElementsByClassName('dl-horizontal table-bg-ctrl submission')[0];
    let len = tc.childElementCount;
    for (let i = 0; i < len; i += 1) {
        try{
                var here=tc.children[i].children[0].children[0];
                var status=here.innerHTML.substring(0,2);
        }
        catch{
                continue;
        }
        here.parentElement.style = `display: flex;align-items: center;`;
        if (status === "AC") {
            here.style = `background: linear-gradient(rgba(82, 196, 26, 0.3), rgba(82, 196, 26, 0.3)), url('${AC}'); background-size: cover;height: 6em;width: 6em;`;
        } else if (status === "WA") {
            here.style = `background: linear-gradient(rgba(231, 76, 60, 0.3), rgba(231, 76, 60, 0.3)), url('${WA}'); background-size: cover;height: 6em;width: 6em;`;
        } else if (status === "TL") {
            here.style = `background: linear-gradient(rgba(5, 34, 66, 0.3), rgba(5, 34, 66, 0.3)), url('${TLE}'); background-size: cover;height: 6em;width: 6em;`;
        } else if (status === "ML") {
            here.style = `background: linear-gradient(rgba(5, 34, 66, 0.3), rgba(5, 34, 66, 0.3)), url('${MLE}'); background-size: cover;height: 6em;width: 6em;`;
        } else if (status === "RE") {
            here.style = `background: linear-gradient(rgba(157, 61, 207, 0.3), rgba(157, 61, 207, 0.3)), url('${RE}'); background-size: cover;height: 6em;width: 6em;`;
        } else if (status === "OL") {
            here.style = `background: linear-gradient(rgba(5, 34, 66, 0.3), rgba(5, 34, 66, 0.3)), url('${OLE}'); background-size: cover;height: 6em;width: 6em;`;
        } else if (status === "UK") {
            here.style = `background: linear-gradient(rgba(14, 29, 105, 0.3), rgba(14, 29, 105, 0.3)), url('${UKE}'); background-size: cover;height: 6em;width: 6em;`;
        }
    }
};
(function () {
    setTimeout(main,100);
    /*
    setInterval(function () {
        main();
    }, 100);*/
})();
原文