From 38623937be9cd62d57259f0632dde7575a83193f Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Fri, 15 Jun 2012 21:58:50 +0200 Subject: [PATCH] Various fixes. --- 4chan_x.user.js | 24 +++++++++++------------- script.coffee | 17 ++++++++--------- 2 files changed, 19 insertions(+), 22 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index 8abbc11ca..0f94807e1 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -2809,7 +2809,7 @@ node: function(post) { var img, link, nodes, _i, _len, _ref; img = post.img; - if (post.isInlined && !post.isCrosspost || !img) { + if (post.isInlined && !post.isCrosspost || post.isArchived || !img) { return; } img = img.parentNode; @@ -3099,7 +3099,7 @@ } }, parseArchivedPost: function(req, board, postID, root, cb) { - var bq, br, capcode, data, email, file, filesize, isOP, name, nameBlock, pc, pi, piM, span, subject, threadID, trip; + var bq, br, capcode, data, email, file, filesize, isOP, name, nameBlock, pc, pi, piM, span, subject, threadID, timestamp, trip; data = JSON.parse(req.response); $.addClass(root, 'archivedPost'); if (data.error) { @@ -3108,7 +3108,7 @@ } threadID = data.thread_num; isOP = postID === threadID; - name = data.name, trip = data.trip; + name = data.name, trip = data.trip, timestamp = data.timestamp; subject = data.title; piM = $.el('div', { id: "pim" + postID, @@ -3144,7 +3144,7 @@ pi = $.el('div', { id: "pi" + postID, className: 'postInfo desktop', - innerHTML: " data.fourchan_date No." + postID + "" + (isOP ? '   ' : '') + " " + innerHTML: " data.fourchan_date No." + postID + "" + (isOP ? '   ' : '') + " " }); $('.subject', pi).textContent = subject; nameBlock = $('.nameBlock', pi); @@ -3221,7 +3221,7 @@ pc = $.el('div', { id: "pc" + postID, className: "postContainer " + (isOP ? 'op' : 'reply') + "Container", - innerHTML: "
" + innerHTML: "
" }); $.add(pc.firstChild, [piM, pi, bq]); if (data.media_filename) { @@ -3490,19 +3490,17 @@ UI.hover(e); $.add(d.body, qp); Get.post(board, threadID, postID, qp, function() { - var bq, fileInfo, img, post; + var bq, img, post; bq = $('blockquote', qp); Main.prettify(bq); post = { el: qp, - blockquote: bq + blockquote: bq, + isArchived: /\barchivedPost\b/.test(qp.className) }; - if (fileInfo = $('.fileInfo', qp)) { - img = fileInfo.nextElementSibling.firstElementChild; - if (img.alt !== 'File deleted.') { - post.fileInfo = fileInfo; - post.img = img; - } + if (img = $('img[data-md5]', qp)) { + post.fileInfo = img.parentNode.previousElementSibling; + post.img = img; } if (Conf['Reveal Spoilers']) { RevealSpoilers.node(post); diff --git a/script.coffee b/script.coffee index 4c408581c..7b9632577 100644 --- a/script.coffee +++ b/script.coffee @@ -2193,7 +2193,7 @@ Sauce = node: (post) -> {img} = post - return if post.isInlined and not post.isCrosspost or not img + return if post.isInlined and not post.isCrosspost or post.isArchived or not img img = img.parentNode nodes = [] for link in Sauce.links @@ -2385,7 +2385,7 @@ Get = threadID = data.thread_num isOP = postID is threadID - {name, trip} = data + {name, trip, timestamp} = data subject = data.title # post info (mobile) @@ -2424,7 +2424,7 @@ Get = pi = $.el 'div', id: "pi#{postID}" className: 'postInfo desktop' - innerHTML: " data.fourchan_date No.#{postID}#{if isOP then '   ' else ''} " + innerHTML: " data.fourchan_date No.#{postID}#{if isOP then '   ' else ''} " # subject $('.subject', pi).textContent = subject nameBlock = $ '.nameBlock', pi @@ -2504,7 +2504,7 @@ Get = pc = $.el 'div', id: "pc#{postID}" className: "postContainer #{if isOP then 'op' else 'reply'}Container" - innerHTML: "
" + innerHTML: "
" $.add pc.firstChild, [piM, pi, bq] # file @@ -2710,11 +2710,10 @@ QuotePreview = post = el: qp blockquote: bq - if fileInfo = $ '.fileInfo', qp - img = fileInfo.nextElementSibling.firstElementChild - if img.alt isnt 'File deleted.' - post.fileInfo = fileInfo - post.img = img + isArchived: /\barchivedPost\b/.test qp.className + if img = $ 'img[data-md5]', qp + post.fileInfo = img.parentNode.previousElementSibling + post.img = img if Conf['Reveal Spoilers'] RevealSpoilers.node post if Conf['Image Auto-Gif']