AtCoder Submission Notes

Add notes to AtCoder submissions

Version vom 21.02.2025. Aktuellste Version

  1. // ==UserScript==
  2. // @name AtCoder Submission Notes
  3. // @namespace https://greatest.deepsurf.us/users/your-username
  4. // @version 1.0
  5. // @description Add notes to AtCoder submissions
  6. // @author zerozero-0-0
  7. // @match https://atcoder.jp/contests/*/submissions/me
  8. // @grant none
  9. // ==/UserScript==
  10.  
  11. (function () {
  12. "use strict";
  13.  
  14. // メモを保存・取得するためのキー生成関数
  15. function getNoteKey(submissionId) {
  16. return `atcoder_note_${submissionId}`;
  17. }
  18.  
  19. // 各提出にメモ欄を追加
  20. document.querySelectorAll("tbody tr").forEach((row) => {
  21. const link = row.querySelector('a[href*="/submissions/"]');
  22. if (!link) return;
  23.  
  24. const submissionId = link.href.split("/").pop();
  25. const noteKey = getNoteKey(submissionId);
  26.  
  27. // メモ欄の作成
  28. const td = document.createElement("td");
  29. const textarea = document.createElement("textarea");
  30. textarea.style.width = "100%";
  31. textarea.style.height = "50px";
  32. textarea.value = localStorage.getItem(noteKey) || "";
  33.  
  34. // 保存ボタン
  35. const saveButton = document.createElement("button");
  36. saveButton.textContent = "💾";
  37. saveButton.style.marginLeft = "5px";
  38. saveButton.onclick = () => {
  39. localStorage.setItem(noteKey, textarea.value);
  40. };
  41.  
  42. td.appendChild(textarea);
  43. td.appendChild(saveButton);
  44. row.appendChild(td);
  45. });
  46. })();