AtCoder Custom Default Submissions

AtCoderのすべての提出の絞り込み、並び替え設定のデフォルトを設定します。本スクリプトのデフォルトは言語C++, 結果AC, コード長の昇順に並び替えです。

Stan na 14-12-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         AtCoder Custom Default Submissions
// @namespace    https://github.com/ktny
// @version      1.3
// @description  AtCoderのすべての提出の絞り込み、並び替え設定のデフォルトを設定します。本スクリプトのデフォルトは言語C++, 結果AC, コード長の昇順に並び替えです。
// @author       ktnyori
// @license      MIT
// @include      https://atcoder.jp/contests/*
// ==/UserScript==
(function () {
    'use strict';
    /**********************************************
     * langsの中から自分が使用する言語に変更してください
    ***********************************************/
    const lang = 'C++';
    const langs = {
        'C++': 3003,
        'C#': 3006,
        'C': 3002,
        'Python3': 3023,
        'PyPy3': 3510,
        'Ruby': 3024,
        'Java': 3016,
        'JavaScript': 3017,
        'TypeScript': 3521,
        'PHP': 3524,
        'Haskell': 3014,
        'Go': 3013,
        'Scala': 3025,
        'Perl': 3020,
        'Swift': 3503,
        'Rust': 3504,
        'Kotlin': 3523
    };

    // 問題ページにいるときは問題番号での絞り込みも追加
    const taskPage = location.href.match(/tasks\/(.+?)$/);
    let task = '';
    if (taskPage && taskPage[1]) {
        task = taskPage[1];
    }

    const params = {
        'f.Task': task,
        'f.Language': langs[lang],
        // AC, WA, TLE, MLE, RE, CE, QLE, OLE, IE, WJ, WR, Judging
        'f.Status': 'AC',
        // source_length, time_consumption, memory_consumption, score
        'orderBy': 'source_length',
    };

    const esc = encodeURIComponent;
    const querystring = Object.keys(params).map(k => esc(k) + '=' + esc(params[k])).join('&');
    const links = document.querySelectorAll('#contest-nav-tabs a');
    for (let i = 0; i < links.length; i++) {
        const href = links[i].getAttribute('href');
        if (href && href.endsWith('submissions')) {
            links[i].setAttribute('href', `${href}?${querystring}`);
        }
    }
})();