从m.thepaper.cn转到www.thepaper.cn

Redirect m.thepaper.cn URLs to www.thepaper.cn with correct format

// ==UserScript==
// @name         从m.thepaper.cn转到www.thepaper.cn
// @version      0.1
// @description  Redirect m.thepaper.cn URLs to www.thepaper.cn with correct format
// @author       bingqiang
// @match        https://m.thepaper.cn/*
// @grant        none
// @namespace https://gf.qytechs.cn/users/1346278
// ==/UserScript==

(function() {
    'use strict';

    // Redirect function
    function redirectUrl() {
        var currentUrl = window.location.href;

        // Check if the URL starts with m.thepaper.cn and contains numbers
        if (currentUrl.startsWith('https://m.thepaper.cn/')) {
            // Extract ID (digits) from the URL
            var regex = /(\d+)/;
            var match = currentUrl.match(regex);
            if (match && match[1]) {
                var id = match[1];
                var newUrl = 'https://www.thepaper.cn/newsDetail_forward_' + id;
                // Redirect to the new URL
                window.location.replace(newUrl);
            }
        }
    }

    // Check if the URL starts with m.thepaper.cn
    if (window.location.hostname === 'm.thepaper.cn') {
        redirectUrl();
    }
})();

QingJ © 2025

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