Reddit Old Auto

Auto link to old.reddit.com

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。

您需要先安装用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

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