AtCoder Standings Excluding Unrated User

AtCoderの順位表から参加登録していないユーザを隠すスクリプトです。

目前為 2023-08-02 提交的版本,檢視 最新版本

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

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

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         AtCoder Standings Excluding Unrated User
// @namespace    https://hals.one/
// @version      0.1
// @description  AtCoderの順位表から参加登録していないユーザを隠すスクリプトです。
// @author       HalsSC
// @match        https://atcoder.jp/contests/*/standings
// @exclude      https://atcoder.jp/contests/*/standings/json
// @license      MIT
// @grant        none
// ==/UserScript==

// 順位表の中で参加登録していないユーザの行を見つけ、hidden属性をtrueにする関数
function hidden_unrated(){
    setTimeout((function(){
    const unrated_users = document.querySelectorAll("span.user-unrated");
    console.log(unrated_users);
    unrated_users.forEach(function(user) {
        let element = user;
        while (element && element.tagName !== "TR") {
            element = element.parentElement;
        }
        if(element){
            element.hidden = true;
        }
    });
    }), 1000);
}

// 「お気に入りのみ表示」にclickアクションとしてhidden_unrated関数を登録する関数
function set_onclick(){
    setTimeout((function(){
        const button = document.getElementById("checkbox-fav-only");
        console.log(button);
        button.addEventListener("click", hidden_unrated);
    }),1000);
}

// メイン関数
(function(){
    hidden_unrated();
    set_onclick();
})();