AtCoderLabelChanger

提出結果をまとめるスクリプト.ついでに色も変えます.

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         AtCoderLabelChanger
// @version      1.2
// @description  提出結果をまとめるスクリプト.ついでに色も変えます.
// @author       y-oksaku
// @namespace    https://github.com/y-oksaku/AtCoderLabelChanger
// @match        https://atcoder.jp/contests/*/submissions/*
// @grant        none
// @license      CC0-1.0
// ==/UserScript==

(function(callback) {
    var script = document.createElement("script");
    script.setAttribute("src", "//code.jquery.com/jquery-3.3.1.min.js");
    script.addEventListener('load', function() {
        var script = document.createElement("script");
        script.textContent = "(" + callback.toString() + ")(jQuery.noConflict(true));";
        document.body.appendChild(script);
    }, false);
    document.body.appendChild(script);
})(function ($) {
    let ac = 0;
    let wa = 0;
    let tle = 0;
    let other = 0;

    $('table > tbody > tr > td:not(#judge-status, .waiting-judge) > span.label').each(function () {
        const result = $(this).text();

        switch (result) {
            case 'AC':
                $(this).removeClass('label-success');
                $(this).addClass('label-success');
                ac++;
                break;
            case 'WA':
                $(this).removeClass('label-warning');
                $(this).addClass('label-danger');
                wa++;
                break;
            case 'TLE':
                tle++;
                break;
            default:
                other++;
                break;
        }
    });

    let html = '';
    if(ac > 0) html += `<span class="label label-success">AC</span> ${ac}&emsp;`;
    if(wa > 0) html += `<span class="label label-danger">WA</span> ${wa}&emsp;`;
    if(tle > 0) html += `<span class="label label-warning">TLE</span> ${tle}&emsp;`;
    if(other > 0) html += `<span class="label label-warning">other</span> ${other}&emsp;`;

    if(html != '') $('#judge-status').html(html);
});