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) {
var side;
if (post.isInlined || /\bop\b/.test(post["class"])) {
if (post.isInlined || post.ID === post.threadID) {
return;
}
side = $('.sideArrows', post.root);
@ -2869,12 +2869,14 @@
return Main.callbacks.push(this.node);
},
node: function(post) {
var img;
var img, s;
img = post.img;
if (!(img && /^Spoiler/.test(img.alt)) || post.isInlined && !post.isCrosspost || post.isArchived) {
return;
}
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'));
}
};
@ -4895,17 +4897,6 @@ textarea.field {\
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 {\
position: fixed;\
}\

View File

@ -766,7 +766,7 @@ ReplyHiding =
Main.callbacks.push @node
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
$.addClass side, 'hide_reply_button'
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
return
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'}"
Time =
@ -3841,17 +3844,6 @@ textarea.field {
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 {
position: fixed;
}