Background scr_run

4 button

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey, Greasemonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

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

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

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

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्क्रिप्ट व्यवस्थापक एक्स्टेंशन इंस्टॉल करावे लागेल.

(माझ्याकडे आधीच युझर स्क्रिप्ट व्यवस्थापक आहे, मला इंस्टॉल करू द्या!)

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

(माझ्याकडे आधीच युझर स्टाईल व्यवस्थापक आहे, मला इंस्टॉल करू द्या!)

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