Old Reddit button

Provides a button to go to the same page on old.reddit when accidentally ending up on new Reddit.

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         Old Reddit button
// @version      1.0
// @description  Provides a button to go to the same page on old.reddit when accidentally ending up on new Reddit.
// @author       Phoenix
// @include      https://*.reddit.com/*
// @exclude	     https://old.reddit.com/*
// @grant        none
// @license      MIT
// @namespace https://greasyfork.org/users/952476
// ==/UserScript==

(function() {
  'use strict';
  var node;
  node = document.createElement("DIV");
  node.style = `
  	    display: flex;
		justify-content: center;
		align-items: center;
		position: fixed;
		top: 9px;
		left: 135px;
		width: 160px;
		height: 30px;
		background-color: red;
		border-radius: 15px;
		z-index: 1000;
		cursor:pointer;
		color: #fff;
		font-weight: bold;`;
  node.textContent = "Switch to old.reddit";
  node.addEventListener("click", function() {location.href = location.href.replace('https://www.','https://old.').replace('https://new.','https://old.'); });
  document.body.appendChild(node);
})();