Hide standings codeforces

Improved dark mode for Codeforces

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey, το Greasemonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Userscripts για να εγκαταστήσετε αυτόν τον κώδικα.

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

Θα χρειαστεί να εγκαταστήσετε μια επέκταση διαχείρισης κώδικα χρήστη για να εγκαταστήσετε αυτόν τον κώδικα.

(Έχω ήδη έναν διαχειριστή κώδικα χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

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.

(Έχω ήδη έναν διαχειριστή στυλ χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

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