Fix preParsing of inserted posts.

Ha ha, back to Tera.
This commit is contained in:
Nicolas Stepien 2012-04-30 14:55:43 +02:00
parent b72083552c
commit 7b20be3a91
2 changed files with 19 additions and 17 deletions

View File

@ -4072,7 +4072,7 @@
}
board = $('.board');
nodes = [];
_ref1 = $$('.post', board);
_ref1 = $$('.postContainer', board);
for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) {
node = _ref1[_j];
nodes.push(Main.preParse(node));
@ -4117,21 +4117,22 @@
}
},
preParse: function(node) {
var fileInfo, img, klass, post;
klass = node.className;
var el, fileInfo, img, klass, post;
el = $('.post', node);
klass = el.className;
post = {
root: node.parentNode,
el: node,
root: node,
el: el,
"class": klass,
id: node.id.slice(1),
id: el.id.slice(1),
threadId: g.THREAD_ID || $.x('ancestor::div[@class="thread"]', node).id.slice(1),
isInlined: /\binline\b/.test(klass),
quotes: node.getElementsByClassName('quotelink'),
backlinks: node.getElementsByClassName('backlink'),
quotes: el.getElementsByClassName('quotelink'),
backlinks: el.getElementsByClassName('backlink'),
fileInfo: false,
img: false
};
if (fileInfo = $('.fileInfo', node)) {
if (fileInfo = $('.fileInfo', el)) {
img = fileInfo.nextElementSibling.firstElementChild;
if (img.alt !== 'File deleted.') {
post.fileInfo = fileInfo;

View File

@ -3137,7 +3137,7 @@ Main =
board = $ '.board'
nodes = []
for node in $$ '.post', board
for node in $$ '.postContainer', board
nodes.push Main.preParse node
Main.node nodes, true
@ -3172,19 +3172,20 @@ Main =
window.location = "https://raw.github.com/mayhemydg/4chan-x/#{version}/4chan_x.user.js"
preParse: (node) ->
klass = node.className
el = $ '.post', node
klass = el.className
post =
root: node.parentNode
el: node
root: node
el: el
class: klass
id: node.id[1..]
id: el.id[1..]
threadId: g.THREAD_ID or $.x('ancestor::div[@class="thread"]', node).id[1..]
isInlined: /\binline\b/.test klass
quotes: node.getElementsByClassName 'quotelink'
backlinks: node.getElementsByClassName 'backlink'
quotes: el.getElementsByClassName 'quotelink'
backlinks: el.getElementsByClassName 'backlink'
fileInfo: false
img: false
if fileInfo = $ '.fileInfo', node
if fileInfo = $ '.fileInfo', el
img = fileInfo.nextElementSibling.firstElementChild
if img.alt isnt 'File deleted.'
post.fileInfo = fileInfo