Background scr_run

4 button

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

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

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         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));
    });
})();