Bunyabetu Rate Colorizer

OMCの分野別レートに色を付けるスクリプト

目前為 2024-12-27 提交的版本,檢視 最新版本

// ==UserScript==
// @name         Bunyabetu Rate Colorizer
// @namespace    https://gf.qytechs.cn/
// @version      1.14.5.12.1
// @description  OMCの分野別レートに色を付けるスクリプト
// @author       noppi
// @match        https://onlinemathcontest.com/users/*
// @grant        none
// @license      MIT
// ==/UserScript==

(function() {
    'use strict';

    const colorRules = [
        { min: 3600,  color: 'transparent', fontSize: '1em', fontWeight: '700', background: 'linear-gradient(to bottom, rgb(255, 215, 0), white, rgb(255, 215, 0))', WebkitBackgroundClip: 'text' },  // 金
        { min: 3200,  color: 'transparent', fontSize: '1em', fontWeight: '700', background: 'linear-gradient(to bottom, rgb(192, 192, 192), white, rgb(192, 192, 192))', WebkitBackgroundClip: 'text' },  // 銀
        { min: 2800,  color: '#ff0000', fontSize: '1em', fontWeight: '400' },
        { min: 2400,  color: '#ff8000', fontSize: '1em', fontWeight: '400' },
        { min: 2000,  color: '#c0c000', fontSize: '1em', fontWeight: '400' },
        { min: 1600,  color: '#0000ff', fontSize: '1em', fontWeight: '400' },
        { min: 1200,  color: '#00c0c0', fontSize: '1em', fontWeight: '400' },
        { min: 0,     color: '#000000', fontSize: '1em', fontWeight: '400' }
    ];

    const rateCells = document.querySelectorAll("#rating-container table td");

    rateCells.forEach(cell => {
        const rate = parseInt(cell.textContent.trim(), 10);
        if (!isNaN(rate)) {
            const rule = colorRules.find(r => rate >= r.min);
            if (rule) {
                cell.style.color = rule.color;
                cell.style.fontSize = rule.fontSize;
                if (rule.fontWeight) {
                    cell.style.fontWeight = rule.fontWeight;
                }
                if (rule.background) {
                    cell.style.background = rule.background;
                    cell.style.WebkitBackgroundClip = rule.WebkitBackgroundClip;
                }
            }
        }
    });
})();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址