diff --git a/4chan_x.user.js b/4chan_x.user.js index ff8f74507..3419b9f5a 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -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, { diff --git a/script.coffee b/script.coffee index 3e7e135c0..45ba65eb2 100644 --- a/script.coffee +++ b/script.coffee @@ -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,