prettify tweaks

This commit is contained in:
ccd0 2014-06-27 21:45:26 -07:00
parent 227d6a2049
commit 20006af4fe
2 changed files with 7 additions and 1 deletions

View File

@ -15,10 +15,14 @@ class Post
el.removeAttribute 'rel'
for el in $$ 'img[src]', root2
el.src = el.src.replace /^(\w+:\/\/)[0-2](\.t\.4cdn\.org\/)/, '$10$2'
Fourchan.code.call nodes: comment: $ '.postMessage', root2
for el in $$ 'pre[style=""]', root2
el.removeAttribute 'style'
textNodes = $.X './/text()', root2
i = 0
while node = textNodes.snapshotItem i++
node.data = node.data.replace /\s+/g, ' '
$.rm node if node.data is ''
@normalizedOriginal = root2
<% } %>

View File

@ -34,7 +34,9 @@ Fourchan =
cb: @math
code: ->
return if @isClone
apply = (e) -> pre.innerHTML = e.detail
apply = (e) ->
pre.innerHTML = e.detail
$.addClass pre, 'prettyprinted'
$.on window, 'prettyprint:cb', apply
for pre in $$ '.prettyprint:not(.prettyprinted)', @nodes.comment
$.event 'prettyprint', pre.innerHTML, window