// ==UserScript==
// @name Bunyabetu Rate Colorizer
// @namespace https://gf.qytechs.cn/
// @version 1.14.5.9
// @description OMCの分野別レートに色を付けるスクリプト
// @author noppi
// @match https://onlinemathcontest.com/users/*
// @grant none
// @license MIT
// ==/UserScript==
(function() {
'use strict';
const colorRules = [
{ min: 3600, gradient: 'linear-gradient(to right, rgb(255, 215, 0), rgb(255, 180, 0))', fontSize: '1em', fontWeight: '700' },
{ min: 3200, gradient: 'linear-gradient(to right, rgb(192, 192, 192), rgb(169, 169, 169))', fontSize: '1em', fontWeight: '700' },
{ 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) {
if (rule.gradient) {
cell.style.backgroundClip = 'text';
cell.style.webkitBackgroundClip = 'text';
cell.style.color = 'transparent';
cell.style.backgroundImage = rule.gradient;
} else {
cell.style.color = rule.color;
}
cell.style.fontSize = rule.fontSize;
cell.style.fontWeight = rule.fontWeight;
}
}
});
})();