Greasy Fork is available in English.

AtCoder Submission Notes

Add notes to AtCoder submissions

As of 2025-03-03. See the latest version.

  1. // ==UserScript==
  2. // @name AtCoder Submission Notes
  3. // @namespace https://greatest.deepsurf.us/users/your-username
  4. // @version 1.3
  5. // @description Add notes to AtCoder submissions
  6. // @author zerozero-0-0
  7. // @match https://atcoder.jp/contests/*/submissions/me
  8. // @grant none
  9. // @license MIT
  10. // ==/UserScript==
  11.  
  12. (function () {
  13. "use strict";
  14.  
  15. function getNoteKey(submissionId) {
  16. return `atcoder_note_${submissionId}`;
  17. }
  18.  
  19. const table = document.querySelector("table");
  20. if (!table) return;
  21.  
  22. // ヘッダーに「Note」列を追加
  23. const headerRow = table.querySelector("thead tr");
  24. const noteHeader = document.createElement("th");
  25. noteHeader.textContent = "Note";
  26. headerRow.appendChild(noteHeader);
  27.  
  28. // 各提出行に独立したメモ欄を追加
  29. document.querySelectorAll("tbody tr").forEach((row) => {
  30. const link = row.querySelector('a[href*="/submissions/"]');
  31. if (!link) return;
  32.  
  33. const submissionId = link.href.split("/").pop();
  34. const noteKey = getNoteKey(submissionId);
  35.  
  36. const td = document.createElement("td");
  37. td.style.minWidth = "200px";
  38.  
  39. const textarea = document.createElement("textarea");
  40. textarea.style.width = "100%";
  41. textarea.style.height = "50px";
  42. textarea.value = localStorage.getItem(noteKey) || "";
  43.  
  44. textarea.addEventListener("change", () => {
  45. localStorage.setItem(noteKey, textarea.value);
  46. });
  47.  
  48. td.appendChild(textarea);
  49. row.appendChild(td);
  50. });
  51. })();