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.

Bạn sẽ cần cài đặt một tiện ích mở rộng như Tampermonkey hoặc Violentmonkey để cài đặt kịch bản này.

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.

(Tôi đã có Trình quản lý tập lệnh người dùng, hãy cài đặt nó!)

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.

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

// ==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);
        }
    }
})();