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