build on ahodesuka's work

This commit is contained in:
James Campos 2012-02-20 14:16:48 -08:00
parent 4a54b9aa09
commit 2b62ce1231
2 changed files with 24 additions and 21 deletions

View File

@ -100,7 +100,7 @@
Imaging: { Imaging: {
'Image Auto-Gif': [false, 'Animate gif thumbnails'], 'Image Auto-Gif': [false, 'Animate gif thumbnails'],
'Image Expansion': [true, 'Expand images'], 'Image Expansion': [true, 'Expand images'],
'Expand All (Unscrolled)': [false, 'Expand all images will only expand those which you have not scrolled past'], 'Expand From Current': [true, 'Expand images from current position to thread end'],
'Image Hover': [false, 'Show full image on mouseover'], 'Image Hover': [false, 'Show full image on mouseover'],
'Sauce': [true, 'Add sauce to images'], 'Sauce': [true, 'Add sauce to images'],
'Reveal Spoilers': [false, 'Replace spoiler thumbnails by the original thumbnail'] 'Reveal Spoilers': [false, 'Replace spoiler thumbnails by the original thumbnail']
@ -3388,24 +3388,25 @@
return imgExpand.toggle(this); return imgExpand.toggle(this);
}, },
all: function() { all: function() {
var thumb, _i, _j, _len, _len2, _ref, _ref2; var i, thumb, thumbs, _i, _j, _len, _len2, _len3, _ref;
imgExpand.on = this.checked; imgExpand.on = this.checked;
if (imgExpand.on) { if (imgExpand.on) {
_ref = $$('img[md5]'); thumbs = $$('img[md5]');
for (_i = 0, _len = _ref.length; _i < _len; _i++) { if (conf['Expand From Current']) {
thumb = _ref[_i]; for (i = 0, _len = thumbs.length; i < _len; i++) {
if (conf['Expand All (Unscrolled)']) { thumb = thumbs[i];
if (thumb.getBoundingClientRect().bottom >= 0) { if (thumb.getBoundingClientRect().top > 0) break;
imgExpand.expand(thumb);
}
} else {
imgExpand.expand(thumb);
} }
thumbs = thumbs.slice(i);
}
for (_i = 0, _len2 = thumbs.length; _i < _len2; _i++) {
thumb = thumbs[_i];
imgExpand.expand(thumb);
} }
} else { } else {
_ref2 = $$('img[md5][hidden]'); _ref = $$('img[md5][hidden]');
for (_j = 0, _len2 = _ref2.length; _j < _len2; _j++) { for (_j = 0, _len3 = _ref.length; _j < _len3; _j++) {
thumb = _ref2[_j]; thumb = _ref[_j];
imgExpand.contract(thumb); imgExpand.contract(thumb);
} }
} }

View File

@ -22,7 +22,7 @@ config =
Imaging: Imaging:
'Image Auto-Gif': [false, 'Animate gif thumbnails'] 'Image Auto-Gif': [false, 'Animate gif thumbnails']
'Image Expansion': [true, 'Expand images'] 'Image Expansion': [true, 'Expand images']
'Expand All (Unscrolled)': [false, 'Expand all images will only expand those which you have not scrolled past'] 'Expand From Current': [true, 'Expand images from current position to thread end']
'Image Hover': [false, 'Show full image on mouseover'] 'Image Hover': [false, 'Show full image on mouseover']
'Sauce': [true, 'Add sauce to images'] 'Sauce': [true, 'Add sauce to images']
'Reveal Spoilers': [false, 'Replace spoiler thumbnails by the original thumbnail'] 'Reveal Spoilers': [false, 'Replace spoiler thumbnails by the original thumbnail']
@ -2664,12 +2664,14 @@ imgExpand =
all: -> all: ->
imgExpand.on = @checked imgExpand.on = @checked
if imgExpand.on #expand if imgExpand.on #expand
for thumb in $$ 'img[md5]' thumbs = $$ 'img[md5]'
if conf['Expand All (Unscrolled)'] if conf['Expand From Current']
if thumb.getBoundingClientRect().bottom >= 0 for thumb, i in thumbs
imgExpand.expand thumb if thumb.getBoundingClientRect().top > 0
else break
imgExpand.expand thumb thumbs = thumbs[i...]
for thumb in thumbs
imgExpand.expand thumb
else #contract else #contract
for thumb in $$ 'img[md5][hidden]' for thumb in $$ 'img[md5][hidden]'
imgExpand.contract thumb imgExpand.contract thumb