AtCoder Submission Notes

Add notes to AtCoder submissions

Pada tanggal 03 Maret 2025. Lihat %(latest_version_link).

  1. // ==UserScript==
  2. // @name AtCoder Submission Notes
  3. // @namespace https://greatest.deepsurf.us/users/your-username
  4. // @version 2.0.1
  5. // @description Add notes to AtCoder submissions
  6. // @author zerozero-0-0
  7. // @match https://atcoder.jp/contests/*/submissions/me
  8. // @match https://atcoder.jp/contests/*/submissions/me?page=*
  9. // @grant none
  10. // @license MIT
  11. // ==/UserScript==
  12. (function () {
  13. "use strict";
  14. const contestIdMatch = location.pathname.match(/contests\/([^/]+)/);
  15. const contestId = contestIdMatch ? contestIdMatch[1] : "unknown_contest";
  16. const table = document.querySelector("table");
  17. if (!table) return;
  18. const headerRow = table.querySelector("thead tr");
  19. if (headerRow && !headerRow.querySelector(".note-header")) {
  20. const noteHeader = document.createElement("th");
  21. noteHeader.textContent = "Note";
  22. noteHeader.className = "note-header";
  23. headerRow.appendChild(noteHeader);
  24. }
  25. const rows = Array.from(document.querySelectorAll("tbody tr"));
  26. const n = rows.length;
  27. rows.forEach((row, i) => {
  28. const submissionLink = row.querySelector("a[href*='/submissions/']");
  29. const submissionId = submissionLink ? submissionLink.href.match(/submissions\/(\d+)/)[1] : "unknown_${i}";
  30. const noteKey = `atcoder_note_${contestId}_row_${submissionId}`;
  31. const td = document.createElement("td");
  32. td.style.minWidth = "200px";
  33. const textarea = document.createElement("textarea");
  34. textarea.style.width = "100%";
  35. textarea.style.height = "50px";
  36. textarea.value = localStorage.getItem(noteKey) || "";
  37. textarea.addEventListener("input", (event) => {
  38. localStorage.setItem(noteKey, event.target.value);
  39. });
  40. td.appendChild(textarea);
  41. row.appendChild(td);
  42. });
  43. })();