Greasy Fork 支持简体中文。

V2EX Redirect to www

Redirect all V2EX pages to www subdomain

// ==UserScript==
// @name         V2EX Redirect to www
// @namespace    http://tampermonkey.net/
// @version      0.2
// @description  Redirect all V2EX pages to www subdomain
// @author       Xiniah
// @match        *://*.v2ex.com/*
// @run-at       document-start
// @grant        none
// @license MIT
// ==/UserScript==

(function() {
    'use strict';
    const currentLocation = window.location;
    if (!currentLocation.hostname.startsWith('www.') && !currentLocation.hostname.startsWith('v2ex') && !currentLocation.hostname.startsWith('cdn')) {
        const wwwLocation = currentLocation.protocol + '//www.' + currentLocation.hostname.replace(/^.*?\./, '') + currentLocation.pathname + currentLocation.search + currentLocation.hash;
        window.location.replace(wwwLocation);
    }
})();