AtCoder Solve Declaration

問題文の隣にツイートするボタンを表示します。

Verze ze dne 18. 07. 2023. Zobrazit nejnovější verzi.

K instalaci tototo skriptu si budete muset nainstalovat rozšíření jako Tampermonkey, Greasemonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Userscripts.

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

K instalaci tohoto skriptu si budete muset nainstalovat manažer uživatelských skriptů.

(Už mám manažer uživatelských skriptů, nechte mě ho nainstalovat!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Už mám manažer uživatelských stylů, nechte mě ho nainstalovat!)

// ==UserScript==
// @name         AtCoder Solve Declaration
// @version      0.1
// @license      MIT 
// @description  問題文の隣にツイートするボタンを表示します。
// @author       Kyo_s_s
// @match        https://atcoder.jp/contests/*/tasks/*
// @exclude      https://atcoder.jp/contests/*/tasks/*/editorial
// @namespace https://greatest.deepsurf.us/users/1129958
// ==/UserScript==

(function() {
    'use strict';

    function createButton() {
        const button = document.createElement("button");
        button.innerHTML = "ときます宣言";
        button.classList.add("btn", "btn-default", "btn-sm");
        button.addEventListener("click", function() {
            const text = "ときます " + window.location.href + "\n#競プロ精進";
            const tweetUrl = "https://twitter.com/intent/tweet?text=" + encodeURIComponent(text);
            window.open(tweetUrl);
        });

        return button;
    }

    function insertButton() {
        const title = document.querySelector(".h2");
        if (title) {
            title.appendChild(createButton());
        }
    }

    window.addEventListener("load", insertButton);
})();