Reddit to New Reddit Redirect

Redirect all Reddit links to New Reddit

  1. // ==UserScript==
  2. // @name Reddit to New Reddit Redirect
  3. // @namespace http://tampermonkey.net/
  4. // @version 1.0.1
  5. // @description Redirect all Reddit links to New Reddit
  6. // @author dani7115
  7. // @match *://reddit.com/*
  8. // @match *://www.reddit.com/*
  9. // @run-at document-start
  10. // @grant none
  11. // @license MIT
  12. // ==/UserScript==
  13.  
  14. (function() {
  15. 'use strict';
  16.  
  17. var oldRedditDomainWithWWW = 'www.reddit.com';
  18. var oldRedditDomain = 'reddit.com';
  19. var newRedditDomain = 'new.reddit.com';
  20. var currentUrl = window.location.href;
  21. var newUrl;
  22.  
  23. if (currentUrl.includes(oldRedditDomainWithWWW)) {
  24. newUrl = currentUrl.replace(oldRedditDomainWithWWW, newRedditDomain);
  25. } else if (currentUrl.includes(oldRedditDomain)) {
  26. newUrl = currentUrl.replace(oldRedditDomain, newRedditDomain);
  27. }
  28.  
  29. if (newUrl) {
  30. window.location.replace(newUrl);
  31. }
  32. })();

QingJ © 2025

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