🎉 欢迎访问GreasyFork.Org 镜像站!本镜像站由公众号【爱吃馍】搭建,用于分享脚本。联系邮箱📮

Greasy fork 爱吃馍镜像

Greasy Fork is available in English.

My Own Apple Music Tweaks

Allow drag selection & adjust sidebar position so it doesn't hide the scroll bar, and more

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

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

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

🚀 安装遇到问题?关注公众号获取帮助

公众号二维码

扫码关注【爱吃馍】

回复【脚本】获取最新教程和防失联地址

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

🚀 安装遇到问题?关注公众号获取帮助

公众号二维码

扫码关注【爱吃馍】

回复【脚本】获取最新教程和防失联地址

// ==UserScript==
// @name         My Own Apple Music Tweaks
// @description  Allow drag selection & adjust sidebar position so it doesn't hide the scroll bar, and more
// @namespace    http://tampermonkey.net/
// @version      0.8
// @author       You
// @match        http*://music.apple.com/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=apple.com
// @grant        GM_addStyle
// @grant        GM_addElement
// @license MIT
// ==/UserScript==

(function() {
    'use strict';

    const l = (m) => {
        console.log("Apple Music Tweaks:", m);
    };
    const le = (m) => {
        console.error("Apple Music Tweaks:", m);
    };

    // Remove Ctrl+A shortcut
    const orig_window_addEventListener = unsafeWindow.addEventListener.bind(unsafeWindow);
    unsafeWindow.addEventListener = function(n, i, o) {
        try {
            if (i.toString().indexOf('.selectAll()') !== -1) {
                return;
            }
            return orig_window_addEventListener(n, i, o);
        } catch (e) {
            le(e);
            return orig_window_addEventListener(n, i, o);
        }
    };

    window.addEventListener('load', function() {
        const getSongListEInterval = setInterval(() => {
            (function() {
                const songListEList = document.querySelectorAll('div.songs-list');
                if (songListEList.length <= 0) {
                    return;
                }
                const songListE = songListEList[0];
                if (songListE['__draggable_already_injected__'] === '1') {
                    return;
                }
                songListE['__draggable_already_injected__'] = '1';
                Object.defineProperty(songListE, 'draggable', { set: function(value) { return; } })
                songListE.setAttribute('draggable', false)
                songListE.style.webkitUserDrag = 'auto'
                songListE.style.webkitUserSelect = 'auto'
                songListE.style.userSelect = 'auto'
                // window.sx = songListE;
                // l("songList got");
                setTimeout(() => {
                    songListE.setAttribute('draggable', false);
                }, 100);
                // clearInterval(getSongListEInterval);
            })();
        }, 100);

        const lyricsUnbold = setInterval(() => {
            (function() {
               try {
                   const lyricsRoot = document.querySelector("amp-lyrics")?.shadowRoot?.querySelector("amp-lyrics-display-static")?.shadowRoot;
                   if (lyricsRoot === null || lyricsRoot === undefined || lyricsRoot['__unbold_already_done__'] === '1') {
                       return;
                   }
                   lyricsRoot['__unbold_already_done__'] = '1';
                   const styleElement = document.createElement('style');
                   styleElement.type = 'text/css';
                   styleElement.innerHTML = '* {font-weight: 100 !important; font-size: 17px;}';
                   lyricsRoot.appendChild(styleElement);
                } catch (e) {
                    console.error(e);
                }
            })();
        }, 100);

        /* const lyricsUnboldTimeSynced = setInterval(() => {
            (function() {
               try {
                   const lyricsRoot2 = document.querySelector("amp-lyrics")?.shadowRoot?.querySelector("amp-lyrics-display-time-synced")?.shadowRoot;
                   if (lyricsRoot2 === null || lyricsRoot2 === undefined || lyricsRoot2['__unbold_already_done__'] === '1') {
                       return;
                   }
                   lyricsRoot2['__unbold_already_done__'] = '1';
                   const styleElement2 = document.createElement('style');
                   styleElement2.type = 'text/css';
                   // styleElement2.innerHTML = '* {font-weight: 800 !important; font-size: 18px;} button.line { margin-top: 20px !important; }';
                   styleElement2.innerHTML = '* {font-weight: 800 !important; font-size: 18px;} button.line { margin-top: 20px !important; }';
                   lyricsRoot2.appendChild(styleElement2);
                } catch (e) {
                    console.error(e);
                }
            })();
        }, 100); */

        setTimeout(() => {
            // Remove search suggestion
            Array.from(document.querySelectorAll("input.search-input__text-field")).forEach(e => {
                e.addEventListener('input', function(event) { event.stopImmediatePropagation(); }, true);
            });


        }, 3000);

        GM_addStyle(`a, blockquote, body, code, dd, div, dl, dt, embed, fieldset, footer, form, h1, h2, h3, h4, h5, h6, header, html, img, legend, li, ol, p, pre, section, table, td, th, ul {
    -webkit-user-drag: auto;
    -webkit-user-select: auto;
    -moz-user-select: auto;
    -ms-user-select: auto;
    user-select: auto;
}`);
        GM_addStyle(`html .side-panel[role=complementary] {
    right: 20px !important;
}`);

    }, false);
})();