您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Redirect all reddit.com pages and links to old.reddit.com
// ==UserScript== // @name Reddit → Old Reddit Redirector // @version 1.0 // @description Redirect all reddit.com pages and links to old.reddit.com // @match *://*.reddit.com/* // @author Mane // @license CC0-1.0 // @run-at document-start // @grant none // @namespace https://gf.qytechs.cn/users/1491313 // ==/UserScript== (function() { 'use strict'; // Helper: if URL belongs to reddit.com (but not old.reddit.com), return rewritten URL function toOldReddit(url) { try { const u = new URL(url); const host = u.hostname.toLowerCase(); if ( (host === 'reddit.com' || host === 'www.reddit.com' || host === 'new.reddit.com' || (host.endsWith('.reddit.com') && !host.startsWith('old.'))) ) { u.hostname = 'old.reddit.com'; return u.href; } } catch (err) { return null; } return null; } // 1. Redirect current page on load const rewritten = toOldReddit(window.location.href); if (rewritten) { window.location.replace(rewritten); return; } // 2. Intercept all clicks on <a> tags pointing to reddit.com document.addEventListener('click', function(event) { const anchor = event.target.closest('a[href]'); if (!anchor) return; const newHref = toOldReddit(anchor.href); if (newHref) { event.preventDefault(); window.location.href = newHref; } }, true); })();
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址