Submit Text on CSES

Submit on CSES with pasting

2025/11/27のページです。最新版はこちら

スクリプトをインストールするには、Tampermonkey, GreasemonkeyViolentmonkey のような拡張機能のインストールが必要です。

You will need to install an extension such as Tampermonkey to install this script.

スクリプトをインストールするには、TampermonkeyViolentmonkey のような拡張機能のインストールが必要です。

スクリプトをインストールするには、TampermonkeyUserscripts のような拡張機能のインストールが必要です。

このスクリプトをインストールするには、Tampermonkeyなどの拡張機能をインストールする必要があります。

このスクリプトをインストールするには、ユーザースクリプト管理ツールの拡張機能をインストールする必要があります。

(ユーザースクリプト管理ツールは設定済みなのでインストール!)

このスタイルをインストールするには、Stylusなどの拡張機能をインストールする必要があります。

このスタイルをインストールするには、Stylus などの拡張機能をインストールする必要があります。

このスタイルをインストールするには、Stylus tなどの拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

(ユーザースタイル管理ツールは設定済みなのでインストール!)

このスクリプトの質問や評価の投稿はこちら通報はこちらへお寄せください
// ==UserScript==
// @name         Submit Text on CSES
// @namespace    plantt
// @version      2025-11-27
// @description  Submit on CSES with pasting
// @author       You
// @match        https://cses.fi/problemset/submit/*
// @grant        none
// @license      GPL
// ==/UserScript==

let fileInput = document.querySelector("input[name=file]");
let lang = document.getElementById("lang");
let textarea = document.createElement("textarea");
fileInput.parentElement.parentElement.insertBefore(textarea, fileInput.parentElement.nextElementSibling);
if (localStorage.getItem("cses-lang")) {
    lang.value = localStorage.getItem("cses-lang");
    lang.dispatchEvent(new Event("change"));
}
lang.onchange = () => localStorage.setItem("cses-lang", lang.value);
textarea.oninput = () => {
    let datat = new DataTransfer;
    datat.items.add(new File([textarea.value], "source.txt"));
    fileInput.files = datat.files;
};