AtCoder Error Colorizer

AtCoder においてジャッジシステムが返す 非AC 状態のうち WA 以外の 6 つの状態 [TLE, RE, CE, MLE, OLE, IE] の背景色を変更します。

Bu betiği kurabilmeniz için Tampermonkey, Greasemonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Userscripts gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

You will need to install an extension such as Tampermonkey to install this script.

Bu komut dosyasını yüklemek için bir kullanıcı komut dosyası yöneticisi uzantısı yüklemeniz gerekecek.

(Zaten bir kullanıcı komut dosyası yöneticim var, kurmama izin verin!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Zateb bir user-style yöneticim var, yükleyeyim!)

// ==UserScript==
// @name         AtCoder Error Colorizer
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  AtCoder においてジャッジシステムが返す 非AC 状態のうち WA 以外の 6 つの状態 [TLE, RE, CE, MLE, OLE, IE] の背景色を変更します。
// @author       iiko11
// @grant        GM_addStyle
// @match        https://atcoder.jp/contests/*/submissions*
// @license MIT
// ==/UserScript==



//自分好みの色にする方法
// 1. 【https://www.colordic.org/】にアクセスしてお気に入りの色を選んでください
// 2. GM_addStyle('.label-XXXX { background-color: YYYY; }') の YYYY 部分を選んだ色に書き換えてください。

GM_addStyle('.label-TLE { background-color: hotpink; }');
GM_addStyle('.label-RE { background-color: darkviolet; }');
GM_addStyle('.label-CE { background-color: dodgerblue; }');
GM_addStyle('.label-MLE { background-color: maroon; }');
GM_addStyle('.label-OLE { background-color: salmon; }');
GM_addStyle('.label-IE { background-color: darkslategray; }');

function colorizeError(){
    const tips=document.getElementsByClassName('label');
    for(let e of tips){
        if(e.innerText.match(/TLE/)){
            e.classList.remove('label-warning');
            e.classList.add('label-TLE');
        }
        else if(e.innerText.match(/RE/)){
            e.classList.remove('label-warning');
            e.classList.add('label-RE');
        }
        else if(e.innerText.match(/CE/)){
            e.classList.remove('label-warning');
            e.classList.add('label-CE');
        }
        else if(e.innerText.match(/MLE/)){
            e.classList.remove('label-warning');
            e.classList.add('label-MLE');
        }
        else if(e.innerText.match(/OLE/)){
            e.classList.remove('label-warning');
            e.classList.add('label-OLE');
        }
        else if(e.innerText.match(/IE/)){
            e.classList.remove('label-warning');
            e.classList.add('label-IE');
        }
    }
}
(function() {
    'use strict';
 
    const target = document.getElementsByTagName('tbody')[0];
    const observer = new MutationObserver(function (mutations) {
        for(let i in mutations){
            colorizeError();
        }
    });
 
    colorizeError();
 
    observer.observe(target, {
        characterData: true,
        childList: true,
        subtree: true
    });
})();