// ==UserScript== // @name 隱藏 Mojim 更多更詳盡歌詞 // @namespace http://tampermonkey.net/ // @version 0.1 // @description 把 Mojim 的更多更詳盡歌詞隱藏起來 // @author abc0922001 // @match https://mojim.com/* // @grant none // @license MIT // @downloadURL none // ==/UserScript== (function() { 'use strict'; // 使用更靈活的選擇器來定位 標籤 let linkSelector = "a[href*='mojim.com']"; // 假設所有 Mojim 的連結都包含 'mojim.com' let linkElements = document.querySelectorAll(linkSelector); linkElements.forEach(linkElement => { // 隱藏 標籤 linkElement.style.display = 'none'; // 隱藏特定的
標籤和文本 let ddElement = linkElement.closest('dd'); if (ddElement) { let textFound = false; ddElement.childNodes.forEach(node => { if (node.nodeType === Node.TEXT_NODE && node.textContent.includes('更多更詳盡歌詞 在')) { node.textContent = node.textContent.replace('更多更詳盡歌詞 在', ''); textFound = true; } else if (textFound && node.nodeName === 'BR') { node.style.display = 'none'; textFound = false; } }); } }); })();