AtCoder Submission Notes

Add notes to AtCoder submissions

2025-03-03 기준 버전입니다. 최신 버전을 확인하세요.

이 스크립트를 설치하려면 Tampermonkey, Greasemonkey 또는 Violentmonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey 또는 Violentmonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey 또는 Violentmonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey 또는 Userscripts와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 유저 스크립트 관리자 확장 프로그램이 필요합니다.

(이미 유저 스크립트 관리자가 설치되어 있습니다. 설치를 진행합니다!)

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

(이미 유저 스타일 관리자가 설치되어 있습니다. 설치를 진행합니다!)

// ==UserScript==
// @name         AtCoder Submission Notes
// @namespace    https://greasyfork.org/users/your-username
// @version      1.5.1
// @description  Add notes to AtCoder submissions
// @author       zerozero-0-0
// @match        https://atcoder.jp/contests/*/submissions/me
// @grant        none
// @license MIT
// ==/UserScript==

(function () {
  "use strict";

  const contestIdMatch = location.pathname.match(/contests\/([^/]+)/);
  const contestId = contestIdMatch ? contestIdMatch[1] : "unknown_contest";

  function getNoteKey(rowIndex) {
    return `atcoder_note_${contestId}_row_${rowIndex}`;
  }

  const table = document.querySelector("table");
  if (!table) return;

  const headerRow = table.querySelector("thead tr");
  if (headerRow && !headerRow.querySelector(".note-header")) {
    const noteHeader = document.createElement("th");
    noteHeader.textContent = "Note";
    noteHeader.className = "note-header";
    headerRow.appendChild(noteHeader);
  }

  document.querySelectorAll("tbody tr").forEach((row, rowIndex) => {
    const noteKey = getNoteKey(rowIndex);

    const td = document.createElement("td");
    td.style.minWidth = "200px";

    const textarea = document.createElement("textarea");
    textarea.style.width = "100%";
    textarea.style.height = "50px";
    textarea.value = localStorage.getItem(noteKey) || "";

    textarea.addEventListener("input", (event) => {
      localStorage.setItem(noteKey, event.target.value);
    });

    td.appendChild(textarea);
    row.appendChild(td);
  });
})();