last.fm language redirect

Redirects to the page of the own language

目前為 2021-10-30 提交的版本,檢視 最新版本

// ==UserScript==
// @name         last.fm language redirect
// @version      0.1.1
// @description  Redirects to the page of the own language
// @author       CennoxX
// @contact      [email protected]
// @namespace    https://gf.qytechs.cn/users/21515
// @homepage     https://github.com/CennoxX/userscripts
// @supportURL   https://github.com/CennoxX/userscripts/issues/new?title=[Last.fm%20language%20redirect]%20
// @match        https://www.last.fm/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=last.fm
// @run-at       document-start
// @grant        none
// @license      MIT
// ==/UserScript==

(function() {
    'use strict';
    var userLang = navigator.language.split('-')[0];
    var availableLangs = /\b(de|es|fr|it|ja|pl|pt|ru|sv|tr|zh|en)\b/;
    if (availableLangs.test(userLang)){
        var pageLang = document.URL.split('/')[3];
        if (userLang!=pageLang)
        {
            window.location.replace("https://www.last.fm/" + userLang + document.URL.substr(availableLangs.test(pageLang)?22:19));
        }
    }
})();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址