维基百科移动域名自动跳转&自动选择大陆简体

用于维基百科移动域名自动跳转为pc域名并且自动选择大陆简体,选择大陆简体版本仅限于检测到出现多中文版本的时候才会启用

< Opinie na 维基百科移动域名自动跳转&自动选择大陆简体

Ocena: Dobry - skrypt działa

§
Napisano: 11-08-2022

日文搜索结果也存在类似问题。比如 maho堂

脚本更新之前,可以手动修改自定义:

// ==UserScript==
// @name         维基百科移动域名自动跳转
// @version      0.01
// @description  用于维基百科移动域名自动跳转为pc域名
// @namespace    https://greasyfork.org/en/users/30-opsomh
// @include      https://zh.m.wikipedia.org/*
// @include      https://ja.m.wikipedia.org/*
// @grant        none
// @inject-into  auto
// @run-at       document-start
// @license      暂无
// ==/UserScript==
var url;
function getStr(str) { //取中间字符
     var res = str.match(new RegExp(`https://zh.(.*?)wikipedia.org/(.*?)$`));
     if(res === -1){
         res = str.match(new RegExp(`https://ja.(.*?)wikipedia.org/(.*?)$`));
     }
     return res ? res : -1;
 }
url=getStr(window.location.href)[1];
console.log(url);
if(url=`m.`){
    window.stop();
    url=window.location.href.replace(url, '');
    console.log(url);
    location.assign(url);
}
§
Napisano: 28-07-2023

現在的話,該怎麽改寫呢?

Odpowiedz

Zaloguj się, by odpowiedzieć.