AtCoder Submission Notes

Add notes to AtCoder submissions

Versione datata 21/02/2025. Vedi la nuova versione l'ultima versione.

Dovrai installare un'estensione come Tampermonkey, Greasemonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Userscripts per installare questo script.

Dovrai installare un'estensione come ad esempio Tampermonkey per installare questo script.

Dovrai installare un gestore di script utente per installare questo script.

(Ho già un gestore di script utente, lasciamelo installare!)

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

(Ho già un gestore di stile utente, lasciamelo installare!)

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

(function () {
  "use strict";

  // メモを保存・取得するためのキー生成関数
  function getNoteKey(submissionId) {
    return `atcoder_note_${submissionId}`;
  }

  // 各提出にメモ欄を追加
  document.querySelectorAll("tbody tr").forEach((row) => {
    const link = row.querySelector('a[href*="/submissions/"]');
    if (!link) return;

    const submissionId = link.href.split("/").pop();
    const noteKey = getNoteKey(submissionId);

    // メモ欄の作成
    const td = document.createElement("td");
    const textarea = document.createElement("textarea");
    textarea.style.width = "100%";
    textarea.style.height = "50px";
    textarea.value = localStorage.getItem(noteKey) || "";

    // 保存ボタン
    const saveButton = document.createElement("button");
    saveButton.textContent = "💾";
    saveButton.style.marginLeft = "5px";
    saveButton.onclick = () => {
      localStorage.setItem(noteKey, textarea.value);
    };

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