您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Ändrar alla länkar till /music/<band> till /music/+noredirect/<band>, men undviker länkar som innehåller /+images/
当前为
// ==UserScript== // @name Last.fm: Always Use +noredirect (except images) // @namespace https://last.fm/ // @version 1.2 // @description Ändrar alla länkar till /music/<band> till /music/+noredirect/<band>, men undviker länkar som innehåller /+images/ // @author DiCK // @match https://*.last.fm/* // @grant none // ==/UserScript== (function() { 'use strict'; function fixLinks() { const links = document.querySelectorAll('a[href*="/music/"]'); links.forEach(link => { let href = link.getAttribute('href'); // Hoppa över om redan innehåller /+noredirect/ eller om den innehåller /+images/ if (href.includes('/+noredirect/') || href.includes('/+images/')) return; // Mönster: matchar både interna (/music/BandName) och externa (https://www.last.fm/music/BandName) const regex = /^(https?:\/\/(www\.)?last\.fm)?\/music\/([^\/?#]+)/; const match = href.match(regex); if (match) { const bandName = match[3]; // Bandnamnet const newHref = href.replace(`/music/${bandName}`, `/music/+noredirect/${bandName}`); link.setAttribute('href', newHref); } }); } // Runs immediately fixLinks(); // Runs despite changes in DOM (Including AJAX) const observer = new MutationObserver(fixLinks); observer.observe(document.body, { childList: true, subtree: true }); })();
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址