Bunyabetu Rate Colorizer

OMCの分野別レートに色を付けるスクリプト 都合により回転は消えました

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         Bunyabetu Rate Colorizer
// @namespace    https://greasyfork.org/
// @version      2.1
// @description  OMCの分野別レートに色を付けるスクリプト 都合により回転は消えました
// @author       noppi
// @match        https://onlinemathcontest.com/users/*
// @grant        none
// @license      MIT
// ==/UserScript==

(function() {
    'use strict';

    const style = document.createElement('style');
    style.textContent = `
        @keyframes rotate {
            0% {
                transform: rotate(0deg);
            }
            100% {
                transform: rotate(360deg);
            }
        }
    `;
    document.head.appendChild(style);

    const colorRules = [
        { min: 3600,  color: 'transparent', fontSize: '1em', fontWeight: '700', background: 'linear-gradient(to bottom, rgb(255, 150, 0), rgb(255, 220, 70), rgb(255, 150, 0))', WebkitBackgroundClip: 'text' },  // 金
        { min: 3200,  color: 'transparent', fontSize: '1em', fontWeight: '700', background: 'linear-gradient(to bottom, rgb(110, 110, 110), rgb(200, 200, 200), rgb(110, 110, 110))', 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: 800,  color: '#008000', fontSize: '1em', fontWeight: '400' },
        { min: 400,  color: '#804000', fontSize: '1em', fontWeight: '400' },
        { min: 1,  color: '#808080', 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;
                }
            }
        }
    });
})();