Reddit Redirector

A simple script that automatically redirects Reddit links to a more privacy-focused alternative.

目前为 2023-04-20 提交的版本。查看 最新版本

// ==UserScript==
// @name         Reddit Redirector
// @namespace    https://gf.qytechs.cn/
// @version      1.0
// @description  A simple script that automatically redirects Reddit links to a more privacy-focused alternative.
// @author       Takomine
// @license      MIT
// @icon         https://www.iconpacks.net/icons/2/free-reddit-logo-icon-2436-thumb.png
// @match        https://www.reddit.com/*
// @match        http://www.reddit.com/*
// @match        https://reddit.com/*
// @match        http://reddit.com/*
// @match        https://old.reddit.com/*
// @match        http://old.reddit.com/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    // Redirect Reddit links to Teddit
    function redirectRedditToTeddit() {
        var currentURL = window.location.href;
        var newURL = '';

        // Check if the URL has "old" prefix
        if (currentURL.startsWith('https://old.reddit.com')) {
            newURL = currentURL.replace('old.reddit.com', 'libreddit.freedit.eu');
        }
        // Check if the URL has "www" prefix
        else if (currentURL.startsWith('https://www.reddit.com')) {
            newURL = currentURL.replace('www.', '').replace('reddit.com', 'libreddit.freedit.eu');
        }
        // Check if the URL has no prefix
        else if (currentURL.startsWith('https://reddit.com')) {
            newURL = currentURL.replace('reddit.com', 'libreddit.freedit.eu');
        }

        // Redirect to the new URL
        if (newURL !== '') {
            window.location.href = newURL;
        }
    }

    // Call the redirect function
    redirectRedditToTeddit();

})();

QingJ © 2025

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