Fix file preParsing for /f/. Close #445

This commit is contained in:
Nicolas Stepien 2012-06-14 22:04:35 +02:00
parent 7f1c8fbb4b
commit 07ada39342
2 changed files with 10 additions and 14 deletions

View File

@ -4302,7 +4302,7 @@
}
},
preParse: function(node) {
var el, fileInfo, img, post, rootClass;
var el, img, post, rootClass;
rootClass = node.className;
el = $('.post', node);
post = {
@ -4319,12 +4319,9 @@
fileInfo: false,
img: false
};
if (fileInfo = $('.fileInfo', el)) {
img = fileInfo.nextElementSibling.firstElementChild;
if (img.alt !== 'File deleted.') {
post.fileInfo = fileInfo;
post.img = img;
}
if (img = $('img[data-md5]', el)) {
post.fileInfo = img.parentNode.previousElementSibling;
post.img = img;
}
Main.prettify(post.blockquote);
return post;

View File

@ -1487,7 +1487,6 @@ QR =
# save selected reply's data
for name in ['name', 'email', 'sub', 'com']
# The input event replaces keyup, change and paste events.
# XXX Does Opera support the `input` event?
$.on $("[name=#{name}]", QR.el), 'input', ->
QR.selected[@name] = @value
# Disable auto-posting if you're typing in the first reply
@ -2148,7 +2147,7 @@ Sauce =
@links = []
for link in Conf['sauces'].split '\n'
continue if link[0] is '#'
# .trim() is there to fix Opera reading two different line breaks.
# XXX .trim() is there to fix Opera reading two different line breaks.
@links.push @createSauceLink link.trim()
return unless @links.length
Main.callbacks.push @node
@ -3292,11 +3291,11 @@ Main =
backlinks: el.getElementsByClassName 'backlink'
fileInfo: false
img: false
if fileInfo = $ '.fileInfo', el
img = fileInfo.nextElementSibling.firstElementChild
if img.alt isnt 'File deleted.'
post.fileInfo = fileInfo
post.img = img
if img = $ 'img[data-md5]', el
# Make sure to not add deleted images,
# those do not have a data-md5 attribute.
post.fileInfo = img.parentNode.previousElementSibling
post.img = img
Main.prettify post.blockquote
post
node: (nodes, notify) ->