hide single problem tag on CF

hide single problem tag on Codeforces

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

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

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

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

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

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

(I already have a user script manager, let me install it!)

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.

ستحتاج إلى تثبيت إضافة مثل Stylus لتثبيت هذا النمط.

ستحتاج إلى تثبيت إضافة لإدارة أنماط المستخدم لتتمكن من تثبيت هذا النمط.

ستحتاج إلى تثبيت إضافة لإدارة أنماط المستخدم لتثبيت هذا النمط.

ستحتاج إلى تثبيت إضافة لإدارة أنماط المستخدم لتثبيت هذا النمط.

(لدي بالفعل مثبت أنماط للمستخدم، دعني أقم بتثبيته!)

// ==UserScript==
// @name         hide single problem tag on CF
// @namespace    http://tampermonkey.net/
// @version      1.0
// @description  hide single problem tag on Codeforces
// @author       ouuan
// @match        https://codeforces.com/*
// @match        https://codeforc.es/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    var cur = 0;
    var tags, btn, hint;

    function change() {
        if (cur ^= 1) {
            tags.style.display = 'block';
            hint.style.display = 'none';
            btn.innerText = '▲';
        } else {
            hint.style.display = 'block';
            tags.style.display = 'none';
            btn.innerText = '▼';
        }
    }

    var boxes = document.querySelectorAll('.roundbox.sidebox');

    for (var box of boxes) {
        if (box.innerText.match('Problem tags')) {
            tags = box.children[3];
            tags.style.display = 'none';
            hint = document.createElement('span');
            hint.innerText = 'Tags are hidden.';
            hint.style.padding = '0.5em';
            hint.style.display = 'block';
            box.appendChild(hint);
            btn = document.createElement('span');
            btn.style.cursor = 'pointer';
            btn.innerText = '▼';
            btn.onclick = change;
            box.children[2].appendChild(btn);
        }
    }
})();