您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Redirects Reddit links to teddit.net links automatically.
当前为
// ==UserScript== // @name Reddit to Teddit Redirect // @namespace https://kbin.social/u/LollerCorleone // @version 1.0 // @description Redirects Reddit links to teddit.net links automatically. // @author LollerCorleone // @license GNU GPLv3 // @match *://www.reddit.com/* // @match *://old.reddit.com/* // @grant none // @run-at document-start // ==/UserScript== (function() { 'use strict'; // Get the current URL var currentUrl = window.location.href; // Check if the URL matches the Reddit homepage if (currentUrl === 'https://www.reddit.com/' || currentUrl === 'https://old.reddit.com/') { // Redirect to the teddit.net homepage window.location.replace('https://teddit.net/'); return; // Stop further script execution } else if (currentUrl.match(/https?:\/\/(?:www|old)\.reddit\.com\/r\/\w+\//)) { // Construct the teddit.net subreddit URL var tedditUrl = currentUrl.replace(/https?:\/\/(?:www|old)\.reddit\.com/, 'https://teddit.net'); // Redirect to the teddit.net subreddit URL window.location.replace(tedditUrl); return; // Stop further script execution } else if (currentUrl.match(/https?:\/\/(?:www|old)\.reddit\.com\/r\/\w+\/comments\/\w+\//)) { // Construct the teddit.net post URL var tedditUrl = currentUrl.replace(/https?:\/\/(?:www|old)\.reddit\.com/, 'https://teddit.net'); // Redirect to the teddit.net post URL window.location.replace(tedditUrl); return; // Stop further script execution } })();