AtCoderAffiliationFinder

When you click the affiliation, go to the ranking page (everyone who has same affiliation appears only)

Stan na 26-09-2019. Zobacz najnowsza wersja.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Greasemonkey lub Violentmonkey.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana będzie instalacja rozszerzenia Tampermonkey lub Userscripts.

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

Aby zainstalować ten skrypt, musisz zainstalować rozszerzenie menedżera skryptów użytkownika.

(Mam już menedżera skryptów użytkownika, pozwól mi to zainstalować!)

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.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Musisz zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

(Mam już menedżera stylów użytkownika, pozwól mi to zainstalować!)

// ==UserScript==
// @name         AtCoderAffiliationFinder
// @namespace    https://twitter.com/_TTJR_
// @version      0.1
// @description  When you click the affiliation, go to the ranking page (everyone who has same affiliation appears only)
// @author       tsutaj
// @match        https://atcoder.jp/users/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    let linkHeader = 'https://atcoder.jp/ranking?f.Affiliation=';
    let trs = document.querySelectorAll('.dl-table tr');

    trs.forEach(function(tr) {
        if(tr.innerText.search('所属') !== -1 || tr.innerText.search('Affiliation') !== -1) {
            console.log(tr.childNodes[1]);
            const affiliation = tr.childNodes[1].innerText;
            const link = linkHeader + encodeURIComponent(affiliation);
            tr.childNodes[1].innerHTML = '<a href=' + link + '>' + affiliation + '</a>';
        }
    });
})();