OMCの分野別レートに色を付けるスクリプト
当前为
// ==UserScript==
// @name Bunyabetu Rate Colorizer
// @namespace https://greasyfork.org/
// @version 1.4.1.4
// @description OMCの分野別レートに色を付けるスクリプト
// @author noppi
// @match https://onlinemathcontest.com/users/*
// @grant none
// @license MIT
// ==/UserScript==
(function() {
'use strict';
const colorRules = [
{ min: 3600, color: '#ffd700', fontSize: '1.5em' },
{ min: 3200, color: '#c0c0c0', fontSize: '1.5em' },
{ min: 2800, color: '#ff0000', fontSize: '1em' },
{ min: 2400, color: '#ff8000', fontSize: '1em' },
{ min: 2000, color: '#c0c000', fontSize: '1em' },
{ min: 1600, color: '#0000ff', fontSize: '1em' },
{ min: 1200, color: '#00c0c0', fontSize: '1em' },
{ min: 0, color: '#000000', fontSize: '1em' }
];
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.fontFamily = 'Arial';
cell.style.fontSize = rule.fontSize;
if (rule.background) {
cell.style.backgroundColor = rule.background;
cell.style.padding = '2px 5px';
cell.style.borderRadius = '5px';
}
}
}
});
})();