AtCoderSubmitSearchSettings

add default settings for submit search

Fra 23.09.2019. Se den seneste versjonen.

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

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

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

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

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

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

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.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name         AtCoderSubmitSearchSettings
// @namespace    https://github.com/refine-P
// @version      1.0.0
// @description  add default settings for submit search
// @author       fine
// @license      MIT
// @include      https://atcoder.jp/contests/*/submissions
// ==/UserScript==

/*
    使うときは検索の設定を変更してください
    下にパラメータの一覧があるので参考にしてください
*/

// 検索の設定
var task = "";
var language = "C++14 (GCC 5.4.1)";
var status = "AC";
var user = "";


/*
    諸々のパラメータ一覧
*/

// 言語とクエリパラメータの対応関係
// (言語のアップデートでこのあたりが変更されるかも?、Twitter等で教えてもらえれば対応します)
var languageValues = {
    '': '',
    'C++14 (GCC 5.4.1)': '3003',
    'Bash (GNU bash v4.3.11)': '3001',
    'C (GCC 5.4.1)': '3002',
    'C (Clang 3.8.0)': '3004',
    'C++14 (Clang 3.8.0)': '3005',
    'C# (Mono 4.6.2.0)': '3006',
    'Clojure (1.8.0)': '3007',
    'Common Lisp (SBCL 1.1.14)': '3008',
    'D (DMD64 v2.070.1)': '3009',
    'D (LDC 0.17.0)': '3010',
    'D (GDC 4.9.4)': '3011',
    'Fortran (gfortran v4.8.4)': '3012',
    'Go (1.6)': '3013',
    'Haskell (GHC 7.10.3)': '3014',
    'Java7 (OpenJDK 1.7.0)': '3015',
    'Java8 (OpenJDK 1.8.0)': '3016',
    'JavaScript (node.js v5.12)': '3017',
    'OCaml (4.02.3)': '3018',
    'Pascal (FPC 2.6.2)': '3019',
    'Perl (v5.18.2)': '3020',
    'PHP (5.6.30)': '3021',
    'Python2 (2.7.6)': '3022',
    'Python3 (3.4.3)': '3023',
    'Ruby (2.3.3)': '3024',
    'Scala (2.11.7)': '3025',
    'Scheme (Gauche 0.9.3.3)': '3026',
    'Text (cat)': '3027',
    'Visual Basic (Mono 4.0.1)': '3028',
    'C++ (GCC 5.4.1)': '3029',
    'C++ (Clang 3.8.0)': '3030',
    'Objective-C (GCC 5.3.0)': '3501',
    'Objective-C (Clang3.8.0)': '3502',
    'Swift (swift-2.2-RELEASE)': '3503',
    'Rust (1.15.1)': '3504',
    'Sed (GNU sed 4.2.2)': '3505',
    'Awk (mawk 1.3.3)': '3506',
    'Brainfuck (bf 20041219)': '3507',
    'Standard ML (MLton 20100608)': '3508',
    'PyPy2 (5.6.0)': '3509',
    'PyPy3 (2.4.0)': '3510',
    'Crystal (0.20.5)': '3511',
    'F# (Mono 4.0)': '3512',
    'Unlambda (0.1.3)': '3513',
    'Lua (5.3.2)': '3514',
    'LuaJIT (2.0.4)': '3515',
    'MoonScript (0.5.0)': '3516',
    'Ceylon (1.2.1)': '3517',
    'Julia (0.5.0)': '3518',
    'Octave (4.0.2)': '3519',
    'Nim (0.13.0)': '3520',
    'TypeScript (2.1.6)': '3521',
    'Perl6 (rakudo-star 2016.01)': '3522',
    'Kotlin (1.0.0)': '3523',
    'PHP7 (7.0.15)': '3524',
    'COBOL - Fixed (OpenCOBOL 1.1.0)': '3525',
    'COBOL - Free (OpenCOBOL 1.1.0)': '3526'
};

// 結果のステータス一覧
var statusList = ['', 'AC', 'WA', 'TLE', 'MLE', 'RE', 'CE', 'QLE', 'OLE', 'IE', 'WJ', 'WR', 'Judging'];


/*
    提出の検索の設定を反映
*/
window.addEventListener('load', function(event) {
    // クエリパラメータが有効か確認
    var messages = [];
    if (!(language in languageValues)) {
        messages.push(`Language: ${language} doesn't exists!`);
    }
    if (statusList.indexOf(status) < 0) {
        messages.push(`Status: ${status} doesn't exists!`);
    }
    if (messages.length > 0) {
        alert(messages.join('\n'));
        return;
    }

    // クエリパラメータを追加
    var baseURL = location.href;
    var queryParameters = `?f.Task=${task}&f.Language=${languageValues[language]}&f.Status=${status}&f.User=${user}`;
    var newURL = baseURL + queryParameters;

    window.location.href = newURL;
}, false);