AtCoder Submission Notes

Add notes to AtCoder submissions

ของเมื่อวันที่ 03-03-2025 ดู เวอร์ชันล่าสุด

  1. // ==UserScript==
  2. // @name AtCoder Submission Notes
  3. // @namespace https://greatest.deepsurf.us/users/your-username
  4. // @version 2.0.2
  5. // @description Add notes to AtCoder submissions
  6. // @author zerozero-0-0// ==UserScript==
  7. // @name AtCoder Submission Notes
  8. // @namespace https://greatest.deepsurf.us/users/your-username
  9. // @description Add notes to AtCoder submissions
  10. // @author zerozero-0-0
  11. // @match https://atcoder.jp/contests/*/submissions/me
  12. // @match https://atcoder.jp/contests/*/submissions/me?page=*
  13. // @grant none
  14. // @license MIT
  15. // ==/UserScript==
  16. (function () {
  17. "use strict";
  18. const contestIdMatch = location.pathname.match(/contests\/([^/]+)/);
  19. const contestId = contestIdMatch ? contestIdMatch[1] : "unknown_contest";
  20. const table = document.querySelector("table");
  21. if (!table) return;
  22. const headerRow = table.querySelector("thead tr");
  23. if (headerRow && !headerRow.querySelector(".note-header")) {
  24. const noteHeader = document.createElement("th");
  25. noteHeader.textContent = "Note";
  26. noteHeader.className = "note-header";
  27. headerRow.appendChild(noteHeader);
  28. }
  29. const rows = Array.from(document.querySelectorAll("tbody tr"));
  30. const n = rows.length;
  31. rows.forEach((row, i) => {
  32. const submissionLink = row.querySelector("a[href*='/submissions/']");
  33. const submissionId = submissionLink ? submissionLink.href.match(/submissions\/(\d+)/)[1] : `unknown_${i}`;
  34. const noteKey = `atcoder_note_${contestId}_row_${submissionId}`;
  35. const td = document.createElement("td");
  36. td.style.minWidth = "200px";
  37. const textarea = document.createElement("textarea");
  38. textarea.style.width = "100%";
  39. textarea.style.height = "50px";
  40. textarea.value = localStorage.getItem(noteKey) || "";
  41. textarea.addEventListener("input", (event) => {
  42. localStorage.setItem(noteKey, event.target.value);
  43. });
  44. td.appendChild(textarea);
  45. row.appendChild(td);
  46. });
  47. })();
  48. // @match https://atcoder.jp/contests/*/submissions/me
  49. // @match https://atcoder.jp/contests/*/submissions/me?page=*
  50. // @grant none
  51. // @license MIT
  52. // ==/UserScript==
  53. (function () {
  54. "use strict";
  55. const contestIdMatch = location.pathname.match(/contests\/([^/]+)/);
  56. const contestId = contestIdMatch ? contestIdMatch[1] : "unknown_contest";
  57. const table = document.querySelector("table");
  58. if (!table) return;
  59. const headerRow = table.querySelector("thead tr");
  60. if (headerRow && !headerRow.querySelector(".note-header")) {
  61. const noteHeader = document.createElement("th");
  62. noteHeader.textContent = "Note";
  63. noteHeader.className = "note-header";
  64. headerRow.appendChild(noteHeader);
  65. }
  66. const rows = Array.from(document.querySelectorAll("tbody tr"));
  67. const n = rows.length;
  68. rows.forEach((row, i) => {
  69. const submissionLink = row.querySelector("a[href*='/submissions/']");
  70. const submissionId = submissionLink ? submissionLink.href.match(/submissions\/(\d+)/)[1] : "unknown_${i}";
  71. const noteKey = `atcoder_note_${contestId}_row_${submissionId}`;
  72. const td = document.createElement("td");
  73. td.style.minWidth = "200px";
  74. const textarea = document.createElement("textarea");
  75. textarea.style.width = "100%";
  76. textarea.style.height = "50px";
  77. textarea.value = localStorage.getItem(noteKey) || "";
  78. textarea.addEventListener("input", (event) => {
  79. localStorage.setItem(noteKey, event.target.value);
  80. });
  81. td.appendChild(textarea);
  82. row.appendChild(td);
  83. });
  84. })();