SptfyCpyforF

For personal use

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Greasemonkey lub Violentmonkey.

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

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana będzie instalacja rozszerzenia Tampermonkey lub Userscripts.

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

Aby zainstalować ten skrypt, musisz zainstalować rozszerzenie menedżera skryptów użytkownika.

(Mam już menedżera skryptów użytkownika, pozwól mi to zainstalować!)

Advertisement:

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.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Musisz zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

(Mam już menedżera stylów użytkownika, pozwól mi to zainstalować!)

Advertisement:

// ==UserScript==
// @name         SptfyCpyforF
// @namespace    https://greasyfork.org/ja/users/1582093-mxmoor
// @version      0.8
// @description  For personal use
// @author       SY
// @match        https://open.spotify.com/*
// @icon         data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
// @grant        none
// @license MIT
// ==/UserScript==

(function() {
    'use strict';

    window.setTimeout(initScript, 2000);

    function initScript(){
        // 1. 対象の要素を取得
        const targetElement = document.querySelector('.AYUEkKOEqksuTXmh');

        // 2. ボタン要素を作成
        if (targetElement) {

            // 2. ボタン要素を作成
            const newButton = document.createElement('button');
            newButton.textContent = '曲情報をコピー';
            newButton.className = 'my-custom-button'; // 任意のクラス名を追加

            // 3. 必要に応じてイベントリスナーを追加
            newButton.addEventListener('click', () => {
                if(document.getElementsByClassName('NNafsIKjQaOOVJsH')[0].innerText.slice(0, 1) == "曲"){
                    const parts = document.getElementsByClassName('NNafsIKjQaOOVJsH')[0].innerText.split("\n");
                    const tab = String.fromCharCode(9);
                    navigator.clipboard.writeText(parts[1] + tab + parts[2] + tab + parts[4] + tab + tab + parts[8]);
                    newButton.textContent = 'コピーしました';
                    setTimeout(() => {
                        newButton.textContent = '曲情報をコピー';
                    }, 2000);
                } else {
                    alert('曲情報がありません');
                }
            });

            // 4. 対象要素にボタンを追加
            targetElement.appendChild(newButton);
        } else {
            console.warn('指定されたクラスの要素が見つかりませんでした。');
        }
        console.log("All resources finished loading!");
    }
})();