Fix thumbnail dimensions in posts fetched from /foolz/ and the like.

This commit is contained in:
Nicolas Stepien 2012-06-19 18:08:55 +02:00
parent c3827c716d
commit 009f8f7ba0
2 changed files with 8 additions and 25 deletions

View File

@ -1002,7 +1002,7 @@
}, },
node: function(post) { node: function(post) {
var side; var side;
if (post.isInlined || /\bop\b/.test(post["class"])) { if (post.isInlined || post.ID === post.threadID) {
return; return;
} }
side = $('.sideArrows', post.root); side = $('.sideArrows', post.root);
@ -2869,12 +2869,14 @@
return Main.callbacks.push(this.node); return Main.callbacks.push(this.node);
}, },
node: function(post) { node: function(post) {
var img; var img, s;
img = post.img; img = post.img;
if (!(img && /^Spoiler/.test(img.alt)) || post.isInlined && !post.isCrosspost || post.isArchived) { if (!(img && /^Spoiler/.test(img.alt)) || post.isInlined && !post.isCrosspost || post.isArchived) {
return; return;
} }
img.removeAttribute('style'); img.removeAttribute('style');
s = img.style;
s.maxHeight = s.maxWidth = /\bop\b/.test(post["class"]) ? '250px' : '125px';
return img.src = "//thumbs.4chan.org" + (img.parentNode.pathname.replace(/src(\/\d+).+$/, 'thumb$1s.jpg')); return img.src = "//thumbs.4chan.org" + (img.parentNode.pathname.replace(/src(\/\d+).+$/, 'thumb$1s.jpg'));
} }
}; };
@ -4895,17 +4897,6 @@ textarea.field {\
width: 100%;\ width: 100%;\
}\ }\
\ \
/* revealed spoilers do not have height/width,\
this fixes "expanded" auto-gifs */\
.op > div > a > img[data-md5] {\
max-height: 252px;\
max-width: 252px;\
}\
.reply > div > a > img[data-md5] {\
max-height: 127px;\
max-width: 127px;\
}\
\
#qr, #qp, #updater, #stats, #ihover, #overlay, #navlinks {\ #qr, #qp, #updater, #stats, #ihover, #overlay, #navlinks {\
position: fixed;\ position: fixed;\
}\ }\

View File

@ -766,7 +766,7 @@ ReplyHiding =
Main.callbacks.push @node Main.callbacks.push @node
node: (post) -> node: (post) ->
return if post.isInlined or /\bop\b/.test post.class return if post.isInlined or post.ID is post.threadID
side = $ '.sideArrows', post.root side = $ '.sideArrows', post.root
$.addClass side, 'hide_reply_button' $.addClass side, 'hide_reply_button'
side.innerHTML = '<a href="javascript:;"><span>[ - ]</span></a>' side.innerHTML = '<a href="javascript:;"><span>[ - ]</span></a>'
@ -2250,6 +2250,9 @@ RevealSpoilers =
if not (img and /^Spoiler/.test img.alt) or post.isInlined and not post.isCrosspost or post.isArchived if not (img and /^Spoiler/.test img.alt) or post.isInlined and not post.isCrosspost or post.isArchived
return return
img.removeAttribute 'style' img.removeAttribute 'style'
# revealed spoilers do not have height/width set, this fixes auto-gifs dimensions.
s = img.style
s.maxHeight = s.maxWidth = if /\bop\b/.test post.class then '250px' else '125px'
img.src = "//thumbs.4chan.org#{img.parentNode.pathname.replace /src(\/\d+).+$/, 'thumb$1s.jpg'}" img.src = "//thumbs.4chan.org#{img.parentNode.pathname.replace /src(\/\d+).+$/, 'thumb$1s.jpg'}"
Time = Time =
@ -3841,17 +3844,6 @@ textarea.field {
width: 100%; width: 100%;
} }
/* revealed spoilers do not have height/width,
this fixes "expanded" auto-gifs */
.op > div > a > img[data-md5] {
max-height: 252px;
max-width: 252px;
}
.reply > div > a > img[data-md5] {
max-height: 127px;
max-width: 127px;
}
#qr, #qp, #updater, #stats, #ihover, #overlay, #navlinks { #qr, #qp, #updater, #stats, #ihover, #overlay, #navlinks {
position: fixed; position: fixed;
} }