Codeforces Verdict Hidden Tool

The tool show codeforces submission status without which test case. For competitors practicing for the domjudge environment.

スクリプトをインストールするには、Tampermonkey, GreasemonkeyViolentmonkey のような拡張機能のインストールが必要です。

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

スクリプトをインストールするには、TampermonkeyViolentmonkey のような拡張機能のインストールが必要です。

スクリプトをインストールするには、TampermonkeyUserscripts のような拡張機能のインストールが必要です。

このスクリプトをインストールするには、Tampermonkeyなどの拡張機能をインストールする必要があります。

このスクリプトをインストールするには、ユーザースクリプト管理ツールの拡張機能をインストールする必要があります。

(ユーザースクリプト管理ツールは設定済みなのでインストール!)

このスタイルをインストールするには、Stylusなどの拡張機能をインストールする必要があります。

このスタイルをインストールするには、Stylus などの拡張機能をインストールする必要があります。

このスタイルをインストールするには、Stylus tなどの拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

(ユーザースタイル管理ツールは設定済みなのでインストール!)

このスクリプトの質問や評価の投稿はこちら通報はこちらへお寄せください
// ==UserScript==
// @name         Codeforces Verdict Hidden Tool
// @namespace    http://tampermonkey.net/
// @version      1.0.1
// @description  The tool show codeforces submission status without which test case. For competitors practicing for the domjudge environment.
// @license      MIT
// @author       jakao
// @match        https://codeforces.com/*
// @icon         https://i.imgur.com/ldVBpM1.jpeg
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    function removeOnTest() {
        console.log('?!?');
        let walker = document.createTreeWalker(document.body, NodeFilter.SHOW_TEXT, null, false), nextNode;
        let node;

        while (node = walker.nextNode()) {
            let textContent = node.nodeValue;
            let index = textContent.indexOf(' on test');

            if (index !== -1) {
                node.nodeValue = textContent.substring(0, index);
                nextNode = walker.nextNode();
                nextNode.nodeValue = "";
            }
            else{
                let pretestIndex = textContent.indexOf(' on pretest');
                if (pretestIndex !== -1) {
                    node.nodeValue = textContent.substring(0, pretestIndex);
                    nextNode = walker.nextNode();
                    nextNode.nodeValue = "";
                }
            }
        }
        console.log('???');
    }

    const observer = new MutationObserver((mutations) => {
        mutations.forEach((mutation) => {
            if (mutation.addedNodes.length) {
                removeOnTest();
            }
        });
    });
    console.log('!!!');

    const observerConfig = {
        childList: true,
        subtree: true,
        characterData: true
    };

    removeOnTest();

    observer.observe(document.body, observerConfig);
})();