AtCoderCustomDefaultSubmissions

AtCoderのすべての提出をデフォルトで使用言語、ACで絞り込みコード長の昇順にする

Verzia zo dňa 14.12.2019. Pozri najnovšiu verziu.

  1. // ==UserScript==
  2. // @name AtCoderCustomDefaultSubmissions
  3. // @namespace https://github.com/ktny
  4. // @version 1.0
  5. // @description AtCoderのすべての提出をデフォルトで使用言語、ACで絞り込みコード長の昇順にする
  6. // @author ktnyori
  7. // @license MIT
  8. // @include https://atcoder.jp/contests/*
  9. // ==/UserScript==
  10. (function () {
  11. 'use strict';
  12. const lang = 'C++'; // langsの中からよく使用する言語に変更
  13. const langs = {
  14. 'C++': 3003,
  15. 'C#': 3006,
  16. 'C': 3002,
  17. 'Python3': 3023,
  18. 'PyPy3': 3510,
  19. 'Ruby': 3024,
  20. 'Java': 3016,
  21. 'JavaScript': 3017,
  22. 'TypeScript': 3521,
  23. 'PHP': 3524,
  24. 'Haskell': 3014,
  25. 'Go': 3013,
  26. 'Scala': 3025,
  27. 'Perl': 3020,
  28. 'Swift': 3503,
  29. 'Rust': 3504,
  30. 'Kotlin': 3523
  31. };
  32. const params = {
  33. 'f.Language': langs[lang],
  34. // AC, WA, TLE, MLE, RE, CE, QLE, OLE, IE, WJ, WR, Judging
  35. 'f.Status': 'AC',
  36. // source_length, time_consumption, memory_consumption, score
  37. 'orderBy': 'source_length',
  38. };
  39. const esc = encodeURIComponent;
  40. const querystring = Object.keys(params).map(k => esc(k) + '=' + esc(params[k])).join('&');
  41. const links = document.querySelectorAll('#contest-nav-tabs a');
  42. for (let i = 0; i < links.length; i++) {
  43. const href = links[i].getAttribute('href');
  44. if (href && href.endsWith('submissions')) {
  45. links[i].setAttribute('href', `${href}?${querystring}`);
  46. }
  47. }
  48. })();