隱藏 Mojim 更多更詳盡歌詞

把 Mojim 的更多更詳盡歌詞及其所在行隱藏起來

// ==UserScript==
// @name         隱藏 Mojim 更多更詳盡歌詞
// @namespace    http://tampermonkey.net/
// @version      0.2
// @description  把 Mojim 的更多更詳盡歌詞及其所在行隱藏起來
// @author       abc0922001
// @match        https://mojim.com/*
// @grant        none
// @license      MIT
// ==/UserScript==

(function() {
    'use strict';

    // 選擇器直接定位到包含特定文本的<a>標籤
    let links = document.querySelectorAll("dd > a[href*='mojim.com']");

    links.forEach(link => {
        // 隱藏連結
        link.style.display = 'none';

        // 獲取與<a>標籤相關的dd元素
        let dd = link.parentNode;
        if (!dd) return;

        // 尋找並處理特定文本節點
        Array.from(dd.childNodes).forEach(node => {
            if (node.nodeType === Node.TEXT_NODE && node.textContent.includes('更多更詳盡歌詞 在')) {
                // 直接移除該文本節點
                dd.removeChild(node);

                // 尋找並隱藏隨後的<br>標籤
                let next = node.nextSibling;
                while (next && next.nodeName === 'BR') {
                    let following = next.nextSibling;
                    dd.removeChild(next);
                    next = following;
                }
            }
        });
    });
})();