Reddit Old Auto

Auto link to old.reddit.com

Du musst eine Erweiterung wie Tampermonkey, Greasemonkey oder Violentmonkey installieren, um dieses Skript zu installieren.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

Sie müssten eine Skript Manager Erweiterung installieren damit sie dieses Skript installieren können

(Ich habe schon ein Skript Manager, Lass mich es installieren!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name        Reddit Old Auto
// @namespace   http://7tikukgkyytgk.com
// @description Auto link to old.reddit.com
// @include     https://*.reddit.com/*
// @include     https://reddit.com/*
// @include     http://reddit.com/*
// @include     http://*.reddit.com/*
// @version     1.2.1
// @grant       none
// @run-at      document-start
// ==/UserScript==

var a = document.getElementsByTagName("a");

for (var x=1; x<a.length; x++) {
  newhref = null;
    if (a[x].href.indexOf("www.reddit.com")!=-1) {
      var newhref = a[x].href.replace("www.reddit.com", "old.reddit.com")
      a[x].setAttribute("href", newhref);
    }
}

var f = document.getElementsByTagName("form");
for (var xx=1; xx<f.length; xx++) {
  newaction = null;
    if (f[xx].action.indexOf("www.reddit.com")!=-1) {
      var newaction = f[xx].action.replace("www.reddit.com", "old.reddit.com")
      f[xx].setAttribute("action", newaction);
    }
}

if (document.location.href.indexOf("www.reddit.com")!=-1) {
  document.location.href = document.location.href.replace("www.reddit.com", "old.reddit.com");
  
}