Fix pretty-printing on Chrome.
This commit is contained in:
parent
6460d5e0c1
commit
a223568937
@ -6,8 +6,9 @@ Fourchan =
|
||||
if board is 'g'
|
||||
$.globalEval """
|
||||
window.addEventListener('prettyprint', function(e) {
|
||||
var pre = e.detail;
|
||||
pre.innerHTML = prettyPrintOne(pre.innerHTML);
|
||||
window.dispatchEvent(new CustomEvent('prettyprint:cb', {
|
||||
detail: prettyPrintOne(e.detail)
|
||||
}));
|
||||
}, false);
|
||||
"""
|
||||
Post.callbacks.push
|
||||
@ -32,9 +33,11 @@ Fourchan =
|
||||
cb: @math
|
||||
code: ->
|
||||
return if @isClone
|
||||
for pre in $$ '.prettyprint:not(.prettyprinted)', @nodes.comment
|
||||
$.event 'prettyprint', pre, window
|
||||
$.addClass pre, 'prettyprinted'
|
||||
apply = (e) -> pre.innerHTML = e.detail
|
||||
$.on window, 'prettyprint:cb', apply
|
||||
for pre in $$ '.prettyprint', @nodes.comment
|
||||
$.event 'prettyprint', pre.innerHTML, window
|
||||
$.off window, 'prettyprint:cb', apply
|
||||
return
|
||||
math: ->
|
||||
return if @isClone or !$ '.math', @nodes.comment
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user