AtCoder Add Submissions Shortcuts

Add links to the AtCoder task page that open a list of submissions for the current task with custom filters applied.

Verze ze dne 07. 04. 2023. Zobrazit nejnovější verzi.

K instalaci tototo skriptu si budete muset nainstalovat rozšíření jako Tampermonkey, Greasemonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Userscripts.

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

K instalaci tohoto skriptu si budete muset nainstalovat manažer uživatelských skriptů.

(Už mám manažer uživatelských skriptů, nechte mě ho nainstalovat!)

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.

(Už mám manažer uživatelských stylů, nechte mě ho nainstalovat!)

  1. // ==UserScript==
  2. // @name AtCoder Add Submissions Shortcuts
  3. // @name:ja AtCoder Add Submissions Shortcuts
  4. // @namespace https://github.com/xe-o
  5. // @version 0.1
  6. // @description Add links to the AtCoder task page that open a list of submissions for the current task with custom filters applied.
  7. // @description:ja AtCoderの各問題ページのタブメニューに対して、任意のフィルター・並び順を適用した状態でその問題の提出一覧を開くリンクを追加します。
  8. // @author XERO
  9. // @license MIT
  10. // @match https://atcoder.jp/contests/*/tasks/*
  11. // @grant none
  12. // ==/UserScript==
  13.  
  14. {
  15. const buttonSettings = {
  16. fastest: {
  17. label: "Fastest",
  18. icon: "time",
  19. urlParams: "f.Status=AC&orderBy=time_consumption&f.LanguageName=Python3",
  20. },
  21. shortest: {
  22. label: "Shortest",
  23. icon: "flag",
  24. urlParams: "f.Status=AC&orderBy=source_length",
  25. }
  26. };
  27.  
  28. const buttons = Object.entries(buttonSettings).map(
  29. ([buttonName, { label, icon, urlParams }]) => {
  30. const taskName = window.location.pathname.split("/").pop();
  31. const buttonUrl = `https://atcoder.jp/contests/${
  32. window.location.pathname.split("/")[2]
  33. }/submissions?${urlParams}&f.Task=${taskName}`;
  34. return `<li><a href="${buttonUrl}"><span class="glyphicon glyphicon-${icon}" style="margin-right:4px;" aria-hidden="true"></span>${label}</a></li>`;
  35. }
  36. );
  37.  
  38. const pullRightListItem = document.querySelector("li.pull-right");
  39. buttons.forEach((buttonHtml) => {
  40. pullRightListItem.insertAdjacentHTML("beforebegin", buttonHtml);
  41. });
  42. }