No magic

Disable magic on CF

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         No magic
// @namespace    http://tampermonkey.net/
// @version      1.5
// @description  Disable magic on CF
// @author       ouuan
// @match        *://codeforces.com/*
// @match        *://codeforc.es/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    var handlesElements = document.getElementsByClassName('rated-user');

    var handles = '';
    var handleElements = [];

    for (var i = 0; i < handlesElements.length; ++i) {
        var handleElement = handlesElements[i];
        var handle = handleElement.innerText;
        if (i > 0) handles += ';';
        handles += handle;
        handleElements.push(handleElement);
    }

    var xmlHttp = new XMLHttpRequest();

    xmlHttp.onreadystatechange = function() {
        if (xmlHttp.readyState == 4 && xmlHttp.status == 200) {
            var response = xmlHttp.response.result;
            for (var i = 0; i < response.length; ++i) {
                var user = response[i];
                var color = 'rated-user user-';
                var lgm = false;
                if (!user.hasOwnProperty('rank')) color += 'black';
                else if (user.rank == 'newbie') color += 'gray';
                else if (user.rank == 'pupil') color += 'green';
                else if (user.rank == 'specialist') color += 'cyan';
                else if (user.rank == 'expert') color += 'blue';
                else if (user.rank == 'candidate master') color += 'violet';
                else if (user.rank == 'master' || user.rank == 'international master') color += 'orange';
                else color += 'red';
                if (user.rank == 'legendary grandmaster') lgm = true;
                var u = handleElements[i];
                u.className = color;
                if (lgm) u.innerHTML = '<span class="legendary-user-first-letter">' + user.handle[0] + '</span>' + user.handle.substring(1);
                else u.innerHTML = user.handle;
            }
        } else {
            console.log(xmlHttp.response);
        }
    }

    xmlHttp.responseType = 'json';
    xmlHttp.open('GET', 'https://codeforces.com/api/user.info?handles=' + handles, true);
    xmlHttp.send(null);
})();