Mobile Link Replacer

Replaces mobile links on web pages with their desktop counterpart.

当前为 2020-07-24 提交的版本,查看 最新版本

// ==UserScript==
// @name         Mobile Link Replacer
// @namespace    
// @version      0.4.0
// @description  Replaces mobile links on web pages with their desktop counterpart.
// @author       Spencer Ayers-Hale
// @license      GPL-3.0-or-later; http://www.gnu.org/licenses/gpl-3.0.txt
// @match        https://*/*
// @match        http://*/*
// @exclude      https://www.reddit.com/chat/minimize
// @exclude      https://www.craigslist.org/static/www/localStorage*
// @exclude      https://auth.discogs.com/*
// @exclude      https://www.youtube.com/embed/*
// @exclude      https://widget.pico.tools/*
// @exclude      https://m.stripe.network/*
// ==/UserScript==

(function() {
    'use strict';

    var num = document.getElementsByTagName("a").length; //number of links on page
    var cnt = 0; //current link number
    var newLink;

    while(cnt < num){
        const link = document.getElementsByTagName("a")[cnt].href; //get original link

        //find and replace
        //Wikipedia
        newLink = link.replaceAll(/m.wikipedia/gi, 'wikipedia');
        //Facebook
        newLink = newLink.replaceAll(/m.facebook/gi, 'facebook');
        //Twitter
        newLink = newLink.replaceAll(/mobile.twitter/gi, 'twitter');

        document.getElementsByTagName("a")[cnt].href=newLink; //write new link to page
        cnt++;
    }
})();

QingJ © 2025

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