Reddit auto reloader

Reloads reddit automatically after 10 seconds on errors

Click here to install Browse More Scripts
// ==UserScript==
// @name         Reddit auto reloader
// @namespace    c429a56a2657df6103b69632d3c110d15e4582ee
// @version      1.1
// @description  Reloads reddit automatically after 10 seconds on errors
// @author       /u/AyrA_ch
// @match        https://*.reddit.com/*
// @match        http://*.reddit.com/*
// @match        https://*.reddit.com/
// @match        http://*.reddit.com/
// @match        https://reddit.com/*
// @match        http://reddit.com/*
// @match        https://reddit.com/
// @match        http://reddit.com/
// @grant        none
// ==/UserScript==

var dt = (new Date()).toLocaleTimeString();
if (document.title == "Ow! -- reddit.com") {
	window.setTimeout(location.reload.bind(location), 10000);
	document.querySelector("h3").textContent = "Reloading in 10 Seconds... (Last attempt " + dt + ")";
}
if (document.title == "reddit broke!") {
	window.setTimeout(location.reload.bind(location), 10000);
	var e = document.querySelector("p > a");
	if (e) {
		e = e.parentNode;
	}
	if (e) {
		var c = document.createElement("h3");
		c.textContent = "Reloading in 10 seconds... (Last attempt " + dt + ")";
		e.appendChild(c);
	}
}

/*
LICENSE:
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
The full license text can be found here: http://creativecommons.org/licenses/by-nc-sa/4.0/
The link has an easy to understand version of the license and the full license text.

DISCLAIMER:
THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
THE POSSIBILITY OF SUCH DAMAGE.
*/

Copyright © 2018 by Kevin Gut 📧 | More services | Generated for 3.135.202.224