电脑浏览器中打开 m. 手机版网站时自动切换回 www. 电脑版网页

澎湃新闻,喜马拉雅,界面新闻,网易新闻,重定向.

// ==UserScript==
// @name         电脑浏览器中打开 m. 手机版网站时自动切换回 www. 电脑版网页
// @namespace    https://greasyfork.org
// @version      1.0.0.7
// @match        *://m.*/*
// @grant        none
// @run-at       document-start
// @license      MIT
// @description 澎湃新闻,喜马拉雅,界面新闻,网易新闻,重定向.
// ==/UserScript==

(function() {
    'use strict';

    // Define a map of mobile to desktop hostnames
    const siteMap = {
        "m.thepaper.cn": "thepaper.cn",
        "m.huxiu.com": "huxiu.com",
        "m.jiemian.com": "jiemian.com",
        "m.ximalaya.com": "www.ximalaya.com",
        "m.dongqiudi.com":"www.dongqiudi.com",
        "m.163.com":"www.163.com",
        "m.stnn.cc":"www.stnn.cc",
        "m.douban.com":"www.douban.com",
        "m.gelonghui.com":"www.gelonghui.com",
        "m.jd.com":"www.jd.com",
        "m.18183.com":"www.18183.com"
    };

    // Check if the current hostname is in the siteMap and redirect if needed
    const desktopHostname = siteMap[location.hostname];
    if (desktopHostname) {
        location.replace(location.href.replace(location.hostname, desktopHostname));
    }
})();