Hide standings codeforces

Improved dark mode for Codeforces

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         Hide standings codeforces
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  Improved dark mode for Codeforces
// @author       Der_Vlapos
// @match        https://codeforces.com/contest/*
// @match        http://codeforces.com/contest/*
// @grant        none
// @license MIT
// ==/UserScript==

(function() {
    'use strict';

    function isContestRunning() {
        const state = document.querySelector('.contest-state-phase');
        if (state && (state.textContent.includes('Соревнование идет') || state.textContent.includes('Contest is running'))) {
            return true;
        }
        return false;
    }

    function hideHowManySolved() {
        const rows = document.querySelectorAll('.problems tr');
        rows.forEach(row => {
            const tds = row.querySelectorAll('td:nth-child(4)');
            tds.forEach(td => {
                const links = td.querySelectorAll('a');
                links.forEach(link => {
                    link.style.display = 'none';
                });
            });
        });
    }

    function hideStandingsButton() {
        const lists = document.querySelectorAll('ul.second-level-menu-list');
        lists.forEach(list => {
            const items = list.querySelectorAll('li');
            items.forEach(item => {
                const link = item.querySelector('a');
                if (link && (link.textContent.includes('Standings') || link.textContent.includes('Положение'))) {
                    item.style.display = 'none';
                }
            });
        });
    }


    if (isContestRunning()) {
        hideHowManySolved();
        hideStandingsButton();
    }
})();