Tweak [code] syntax highlighting, only execute it on inserted posts, not on page init.

This commit is contained in:
Nicolas Stepien 2012-05-28 15:00:56 +02:00
parent cf96ba2803
commit b426e6f8e3
2 changed files with 4 additions and 3 deletions

View File

@ -4070,7 +4070,6 @@
});
}
}
Main.hasCodeTags = !!$('script[src="//static.4chan.org/js/prettify/prettify.js"]');
board = $('.board');
nodes = [];
_ref1 = $$('.postContainer', board);
@ -4079,6 +4078,7 @@
nodes.push(Main.preParse(node));
}
Main.node(nodes, true);
Main.hasCodeTags = !!$('script[src="//static.4chan.org/js/prettify/prettify.js"]');
if (MutationObserver = window.WebKitMutationObserver || window.MozMutationObserver || window.OMutationObserver || window.MutationObserver) {
observer = new MutationObserver(Main.observer);
return observer.observe(board, {

View File

@ -3099,14 +3099,15 @@ Main =
if Conf['Index Navigation']
setTimeout -> Nav.init()
Main.hasCodeTags = !! $ 'script[src="//static.4chan.org/js/prettify/prettify.js"]'
board = $ '.board'
nodes = []
for node in $$ '.postContainer', board
nodes.push Main.preParse node
Main.node nodes, true
# Execute these scripts on inserted posts, not page init.
Main.hasCodeTags = !! $ 'script[src="//static.4chan.org/js/prettify/prettify.js"]'
if MutationObserver = window.WebKitMutationObserver or window.MozMutationObserver or window.OMutationObserver or window.MutationObserver
observer = new MutationObserver Main.observer
observer.observe board,