您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Redirect to your country location automatically
// ==UserScript== // @name Apple Music - Country redirection // @namespace https://puvox.software // @version 2024-09-08 // @description Redirect to your country location automatically // @author https://puvox.software // @license MIT // @match https://music.apple.com/*/* // @icon data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw== // @grant GM_registerMenuCommand // @grant GM_setValue // @grant GM_getValue // ==/UserScript== (function() { 'use strict'; const domain = 'music.apple.com'; function isTargetPage() { return location.href.match(domain + '(.*?)\/album'); } let redirectionPrefixOpt = "apple_redirection_prefix"; let redirectionPrefix = GM_getValue(redirectionPrefixOpt); GM_registerMenuCommand("Set redirection settings", () => { if (isTargetPage()) return; // opposite action - to avoid two times popup in special cases const value = prompt("Enter your location prefix (to disable auto-redirection, set empty)"); GM_setValue(redirectionPrefixOpt, value); }); if (!redirectionPrefix) return; if (!isTargetPage()) return; const url = location.href; const urlParts = url.split('/'); const lang = urlParts[3]; const newLocation = location.href.replace(`music.apple.com/${lang}/`, `music.apple.com/${redirectionPrefix}/`); //if (confirm('redirect to: ' + newLocation)) if (!location.href.match(`music.apple.com/${redirectionPrefix}/`)) { document.body.insertAdjacentHTML('afterbegin', '<div style="font-size:3em; color:red; background:white; position:relative; z-index:4444; text-align:center;">Redirecting (tampermonkey)</div>'); setTimeout(()=>{location.href = newLocation}, 500); } })();
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址