Various fixes.

This commit is contained in:
Nicolas Stepien 2012-06-15 21:58:50 +02:00
parent 9372c1dc32
commit 38623937be
2 changed files with 19 additions and 22 deletions

View File

@ -2809,7 +2809,7 @@
node: function(post) { node: function(post) {
var img, link, nodes, _i, _len, _ref; var img, link, nodes, _i, _len, _ref;
img = post.img; img = post.img;
if (post.isInlined && !post.isCrosspost || !img) { if (post.isInlined && !post.isCrosspost || post.isArchived || !img) {
return; return;
} }
img = img.parentNode; img = img.parentNode;
@ -3099,7 +3099,7 @@
} }
}, },
parseArchivedPost: function(req, board, postID, root, cb) { 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); data = JSON.parse(req.response);
$.addClass(root, 'archivedPost'); $.addClass(root, 'archivedPost');
if (data.error) { if (data.error) {
@ -3108,7 +3108,7 @@
} }
threadID = data.thread_num; threadID = data.thread_num;
isOP = postID === threadID; isOP = postID === threadID;
name = data.name, trip = data.trip; name = data.name, trip = data.trip, timestamp = data.timestamp;
subject = data.title; subject = data.title;
piM = $.el('div', { piM = $.el('div', {
id: "pim" + postID, id: "pim" + postID,
@ -3144,7 +3144,7 @@
pi = $.el('div', { pi = $.el('div', {
id: "pi" + postID, id: "pi" + postID,
className: 'postInfo desktop', className: 'postInfo desktop',
innerHTML: "<input type=checkbox name=" + postID + " value=delete> <span class=userInfo><span class=subject></span> <span class=nameBlock></span></span> <span class=dateTime data-utc=" + data.timestamp + ">data.fourchan_date</span> <span class='postNum desktop'><a href='/" + board + "/res/" + threadID + "#p" + postID + "' title='Highlight this post'>No.</a><a href='/" + board + "/res/" + threadID + "#q" + postID + "' title='Quote this post'>" + postID + "</a>" + (isOP ? ' &nbsp; ' : '') + "</span> " innerHTML: "<input type=checkbox name=" + postID + " value=delete> <span class=userInfo><span class=subject></span> <span class=nameBlock></span></span> <span class=dateTime data-utc=" + timestamp + ">data.fourchan_date</span> <span class='postNum desktop'><a href='/" + board + "/res/" + threadID + "#p" + postID + "' title='Highlight this post'>No.</a><a href='/" + board + "/res/" + threadID + "#q" + postID + "' title='Quote this post'>" + postID + "</a>" + (isOP ? ' &nbsp; ' : '') + "</span> "
}); });
$('.subject', pi).textContent = subject; $('.subject', pi).textContent = subject;
nameBlock = $('.nameBlock', pi); nameBlock = $('.nameBlock', pi);
@ -3221,7 +3221,7 @@
pc = $.el('div', { pc = $.el('div', {
id: "pc" + postID, id: "pc" + postID,
className: "postContainer " + (isOP ? 'op' : 'reply') + "Container", className: "postContainer " + (isOP ? 'op' : 'reply') + "Container",
innerHTML: "<div id=p" + postID + " class='postContainer " + (isOP ? 'op' : 'reply') + "'></div>" innerHTML: "<div id=p" + postID + " class='post " + (isOP ? 'op' : 'reply') + "'></div>"
}); });
$.add(pc.firstChild, [piM, pi, bq]); $.add(pc.firstChild, [piM, pi, bq]);
if (data.media_filename) { if (data.media_filename) {
@ -3490,19 +3490,17 @@
UI.hover(e); UI.hover(e);
$.add(d.body, qp); $.add(d.body, qp);
Get.post(board, threadID, postID, qp, function() { Get.post(board, threadID, postID, qp, function() {
var bq, fileInfo, img, post; var bq, img, post;
bq = $('blockquote', qp); bq = $('blockquote', qp);
Main.prettify(bq); Main.prettify(bq);
post = { post = {
el: qp, el: qp,
blockquote: bq blockquote: bq,
isArchived: /\barchivedPost\b/.test(qp.className)
}; };
if (fileInfo = $('.fileInfo', qp)) { if (img = $('img[data-md5]', qp)) {
img = fileInfo.nextElementSibling.firstElementChild; post.fileInfo = img.parentNode.previousElementSibling;
if (img.alt !== 'File deleted.') { post.img = img;
post.fileInfo = fileInfo;
post.img = img;
}
} }
if (Conf['Reveal Spoilers']) { if (Conf['Reveal Spoilers']) {
RevealSpoilers.node(post); RevealSpoilers.node(post);

View File

@ -2193,7 +2193,7 @@ Sauce =
node: (post) -> node: (post) ->
{img} = 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 img = img.parentNode
nodes = [] nodes = []
for link in Sauce.links for link in Sauce.links
@ -2385,7 +2385,7 @@ Get =
threadID = data.thread_num threadID = data.thread_num
isOP = postID is threadID isOP = postID is threadID
{name, trip} = data {name, trip, timestamp} = data
subject = data.title subject = data.title
# post info (mobile) # post info (mobile)
@ -2424,7 +2424,7 @@ Get =
pi = $.el 'div', pi = $.el 'div',
id: "pi#{postID}" id: "pi#{postID}"
className: 'postInfo desktop' className: 'postInfo desktop'
innerHTML: "<input type=checkbox name=#{postID} value=delete> <span class=userInfo><span class=subject></span> <span class=nameBlock></span></span> <span class=dateTime data-utc=#{data.timestamp}>data.fourchan_date</span> <span class='postNum desktop'><a href='/#{board}/res/#{threadID}#p#{postID}' title='Highlight this post'>No.</a><a href='/#{board}/res/#{threadID}#q#{postID}' title='Quote this post'>#{postID}</a>#{if isOP then ' &nbsp; ' else ''}</span> " innerHTML: "<input type=checkbox name=#{postID} value=delete> <span class=userInfo><span class=subject></span> <span class=nameBlock></span></span> <span class=dateTime data-utc=#{timestamp}>data.fourchan_date</span> <span class='postNum desktop'><a href='/#{board}/res/#{threadID}#p#{postID}' title='Highlight this post'>No.</a><a href='/#{board}/res/#{threadID}#q#{postID}' title='Quote this post'>#{postID}</a>#{if isOP then ' &nbsp; ' else ''}</span> "
# subject # subject
$('.subject', pi).textContent = subject $('.subject', pi).textContent = subject
nameBlock = $ '.nameBlock', pi nameBlock = $ '.nameBlock', pi
@ -2504,7 +2504,7 @@ Get =
pc = $.el 'div', pc = $.el 'div',
id: "pc#{postID}" id: "pc#{postID}"
className: "postContainer #{if isOP then 'op' else 'reply'}Container" className: "postContainer #{if isOP then 'op' else 'reply'}Container"
innerHTML: "<div id=p#{postID} class='postContainer #{if isOP then 'op' else 'reply'}'></div>" innerHTML: "<div id=p#{postID} class='post #{if isOP then 'op' else 'reply'}'></div>"
$.add pc.firstChild, [piM, pi, bq] $.add pc.firstChild, [piM, pi, bq]
# file # file
@ -2710,11 +2710,10 @@ QuotePreview =
post = post =
el: qp el: qp
blockquote: bq blockquote: bq
if fileInfo = $ '.fileInfo', qp isArchived: /\barchivedPost\b/.test qp.className
img = fileInfo.nextElementSibling.firstElementChild if img = $ 'img[data-md5]', qp
if img.alt isnt 'File deleted.' post.fileInfo = img.parentNode.previousElementSibling
post.fileInfo = fileInfo post.img = img
post.img = img
if Conf['Reveal Spoilers'] if Conf['Reveal Spoilers']
RevealSpoilers.node post RevealSpoilers.node post
if Conf['Image Auto-Gif'] if Conf['Image Auto-Gif']