1
0
Fork 0
mirror of https://github.com/SinTan1729/random.git synced 2024-12-26 05:08:36 -06:00
random/manjaro-forum-auto-redirect.user.js
2021-04-20 00:24:49 +05:30

19 lines
No EOL
783 B
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// ==UserScript==
// @name Manjaro Forum auto-redirect to old site for missing pages
// @namespace Manjaro Linux Forum
// @match https://forum.manjaro.org/t/*
// @grant none
// @version 1.1
// @author SinTan
// @description 9/4/2020, 1:36:13 PM
// ==/UserScript==
not_found = document.getElementsByClassName("page-not-found")
if (not_found) {
error_msg = not_found[0].getElementsByClassName("title")[0].innerHTML
if (error_msg == "Oops! That page doesnt exist or is private.") {
redir_notif = document.createElement("h3")
redir_notif.innerHTML = "(Redirecting to old forum...)"
not_found[0].appendChild(redir_notif)
window.location.href = window.location.href.replace("://forum.", "://archived.forum.")
}
}