Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

4chan code syntax highlighting

Name: Anonymous 2008-06-12 7:12

tl;dr summary: everything inside [code]..[/code] tags is now showing Javascript syntax highlighting

Seeing odd colours in posts, I WTF'd for a while, until I found this buried in http://dis.4chan.org/script/global.js:

function loadSyntaxHighlighter() {
    var code = document.getElementsByTagName("code");

    if (code.length) {
        var head = document.getElementsByTagName("head")[0];
        for (var i=0; i < code.length; i++) {
            code[i].setAttribute("class", "prettyprint");
        }

        var prettify = document.createElement("script");
        prettify.src = "script/prettify.js";
        prettify.type = "text/javascript";
        head.appendChild(prettify);
    }
}


Basically if it finds any code tags on a page, it loads http://dis.4chan.org/script/prettify.js and applies it to them.

Name: Anonymous 2008-06-15 13:16

>>58
just breaking the syntax highlighter.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List