Reddit Old Auto

Auto link to old.reddit.com

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Greasemonkey lub Violentmonkey.

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

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana będzie instalacja rozszerzenia Tampermonkey lub Userscripts.

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

Aby zainstalować ten skrypt, musisz zainstalować rozszerzenie menedżera skryptów użytkownika.

(Mam już menedżera skryptów użytkownika, pozwól mi to zainstalować!)

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.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Musisz zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

(Mam już menedżera stylów użytkownika, pozwól mi to zainstalować!)

// ==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");
  
}