Tweak [code] syntax highlighting, only execute it on inserted posts, not on page init.
This commit is contained in:
parent
cf96ba2803
commit
b426e6f8e3
@ -4070,7 +4070,6 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Main.hasCodeTags = !!$('script[src="//static.4chan.org/js/prettify/prettify.js"]');
|
|
||||||
board = $('.board');
|
board = $('.board');
|
||||||
nodes = [];
|
nodes = [];
|
||||||
_ref1 = $$('.postContainer', board);
|
_ref1 = $$('.postContainer', board);
|
||||||
@ -4079,6 +4078,7 @@
|
|||||||
nodes.push(Main.preParse(node));
|
nodes.push(Main.preParse(node));
|
||||||
}
|
}
|
||||||
Main.node(nodes, true);
|
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) {
|
if (MutationObserver = window.WebKitMutationObserver || window.MozMutationObserver || window.OMutationObserver || window.MutationObserver) {
|
||||||
observer = new MutationObserver(Main.observer);
|
observer = new MutationObserver(Main.observer);
|
||||||
return observer.observe(board, {
|
return observer.observe(board, {
|
||||||
|
|||||||
@ -3099,14 +3099,15 @@ Main =
|
|||||||
if Conf['Index Navigation']
|
if Conf['Index Navigation']
|
||||||
setTimeout -> Nav.init()
|
setTimeout -> Nav.init()
|
||||||
|
|
||||||
Main.hasCodeTags = !! $ 'script[src="//static.4chan.org/js/prettify/prettify.js"]'
|
|
||||||
|
|
||||||
board = $ '.board'
|
board = $ '.board'
|
||||||
nodes = []
|
nodes = []
|
||||||
for node in $$ '.postContainer', board
|
for node in $$ '.postContainer', board
|
||||||
nodes.push Main.preParse node
|
nodes.push Main.preParse node
|
||||||
Main.node nodes, true
|
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
|
if MutationObserver = window.WebKitMutationObserver or window.MozMutationObserver or window.OMutationObserver or window.MutationObserver
|
||||||
observer = new MutationObserver Main.observer
|
observer = new MutationObserver Main.observer
|
||||||
observer.observe board,
|
observer.observe board,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user