Background scr_run

4 button

スクリプトをインストールするには、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         Background scr_run
// @namespace    http://tampermonkey.net/
// @version      1.1
// @description  4 button
// @author       umaimann
// @match        *://*/*
// @grant        none
// @license      MIT
// ==/UserScript==

(function() {
    'use strict';

    const items = [
        { name: '𝙈𝙊𝙉𝙏𝘼𝙂𝙀𝙈 𝙎𝙀𝙉𝙏𝘼𝙍 - (𝙎𝙪𝙥𝙚𝙧 𝙎𝙡𝙤𝙬𝙚𝙙)', url: 'https://update.greasyfork.org/scripts/574925/Background%20scr_4.user.js' },
        { name: '𝙃𝙀𝘼𝙑𝙀𝙉𝙇𝙔 𝙅𝙐𝙈𝙋𝙎𝙏𝙔𝙇𝙀 - (𝙎𝙪𝙥𝙚𝙧 𝙎𝙡𝙤𝙬𝙚𝙙)', url: 'https://update.greasyfork.org/scripts/574924/Background%20scr_3.user.js' },
        { name: '𝙈𝙤𝙣𝙩𝙖𝙜𝙚𝙢 𝙔𝙪𝙠𝙞 - (𝙎𝙡𝙤𝙬𝙚𝙙)', url: 'https://update.greasyfork.org/scripts/574922/Background%20scr_copy_2.user.js' },
        { name: '𝙈𝙀𝙉𝙃𝙀𝙍𝘼 𝙁𝙐𝙉𝙆', url: 'https://update.greasyfork.org/scripts/574789/Background%20scr_copy.user.js' }
    ];

    const buttons = [];

    items.forEach((item, i) => {
        fetch(item.url)
            .then(res => {
                if (!res.ok) throw new Error('取得失敗');
                return res.text();
            })
            .then(text => {
                const btn = document.createElement('button');
                btn.textContent = item.name;
                btn.style.position = 'fixed';
                btn.style.top = (10 + i * 50) + 'px';
                btn.style.left = '10px';
                btn.style.zIndex = 9999;
                btn.style.padding = '8px';
                btn.style.background = 'lime';
                btn.style.border = '2px solid black';
                btn.style.fontSize = '12px';

                document.body.appendChild(btn);
                buttons.push(btn);

                btn.onclick = () => {
                    try {
                        const ta = document.createElement('textarea');
                        ta.value = text;
                        document.body.appendChild(ta);
                        ta.select();
                        const success = document.execCommand('copy');
                        document.body.removeChild(ta);

                        if (success) {
                            buttons.forEach(b => b.remove());
                            alert(item.name + ' をコピーしました!');
                        } else {
                            alert('コピー失敗(手動コピーして)');
                        }
                    } catch (e) {
                        alert('エラー: ' + e);
                    }
                };
            })
            .catch(e => console.error(e));
    });
})();