4chan Enhanced

By VIPPER Last update Nov 2, 2011 — Installed 4,736 times.

There are 23 previous versions of this script.

// ==UserScript==
// @name          4chan Enhanced
// @namespace     http://www.4chan.org
// @description   4chan enhancements
// @include       http://*.4chan.org/*/res/*
// @include       http://*.4chan.org/*/imgboard.php?res=*
// @version       0.1.72
// ==/UserScript==

d = document;

/* redirects 404 pages to the archive */
if(d.title == "4chan - 404" || d.evaluate("//b[text() = 'Error: Thread specified does not exist.']", d, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue) {
    board = window.location.pathname.match(/[^/]+/);
    thread = window.location.href.match(/\d+(?=#|$)/);
    hash = window.location.hash;

    if(!thread) return;
    if(/^(?:a|m|tg|tv)$/.test(board))
        window.location.replace("http://archive.foolz.us/" + board + "/thread/" + thread + hash.replace("#", "#p"));
    if(/^(?:jp)$/.test(board))
        window.location.replace("http://fuuka.warosu.org/index.pl/" + board + "/thread/" + thread + hash.replace("#", "#p"));
    if(/^(?:diy|g|pol|sci)$/.test(board))
        window.location.replace("http://archive.installgentoo.net/cgi-board.pl/" + board + "/thread/" + thread + hash.replace("#", "#p"));
    if(/^(?:t|hr)$/.test(board))
        window.location.replace("http://no-info.no-ip.info/board.pl/" + board + "/thread/" + thread + hash.replace("#", "#p"));
    if(/^(?:3|adv|an|c|ck|co|fa|fit|int|k|mu|n|new|o|p|po|r9k|soc|sp|toy|trv|v|vp|x)$/.test(board)) // offline intermittently
        window.location.replace("http://archive.no-ip.org/" + board + "/thread/" + thread + hash.replace("#", "#p"));
    if(/^(?:e)$/.test(board)) // facelpalm.tiff
        window.location.replace("https://md401.homelinux.net/4chan/cgi-board.pl/" + board + "/thread/" + thread + hash.replace("#", "#p"));
}

if(!d.getElementById("navtop")) return;

/* Add sage/noko buttons */
newspan = d.createElement("span");
newspan.appendChild(d.createTextNode(" ["));

noko = d.createElement("a");
noko.textContent = "noko";
noko.setAttribute("onclick", "this.parentNode.previousSibling.previousSibling.value = 'noko'; this.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.submit();");
noko.setAttribute("style", "cursor: pointer;");

newspan.appendChild(noko);
newspan.appendChild(d.createTextNode("] ["));

sage = d.createElement("a");
sage.textContent = "sage";
sage.setAttribute("onclick", "this.parentNode.previousSibling.previousSibling.value = 'sage'; this.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.submit();");
sage.setAttribute("style", "cursor: pointer;");

newspan.appendChild(sage);
newspan.appendChild(d.createTextNode("]"));
d.getElementsByName("email")[0].parentNode.appendChild(newspan);