Fix Expand all being too damn slow.
This commit is contained in:
parent
90d6a5a90a
commit
4af24cc60d
@ -3467,9 +3467,10 @@
|
|||||||
return ImageExpand.toggle(Get.postFromNode(this));
|
return ImageExpand.toggle(Get.postFromNode(this));
|
||||||
},
|
},
|
||||||
all: function() {
|
all: function() {
|
||||||
var ID, file, post, thumb, _i, _len, _ref, _ref1;
|
var ID, file, func, post, posts, _i, _j, _len, _len1, _ref, _ref1;
|
||||||
$.event('CloseMenu');
|
$.event('CloseMenu');
|
||||||
ImageExpand.on = this.checked;
|
ImageExpand.on = this.checked;
|
||||||
|
posts = [];
|
||||||
_ref = g.posts;
|
_ref = g.posts;
|
||||||
for (ID in _ref) {
|
for (ID in _ref) {
|
||||||
post = _ref[ID];
|
post = _ref[ID];
|
||||||
@ -3477,23 +3478,20 @@
|
|||||||
for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
|
for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
|
||||||
post = _ref1[_i];
|
post = _ref1[_i];
|
||||||
file = post.file;
|
file = post.file;
|
||||||
if (!(file && file.isImage)) {
|
if (!(file && file.isImage && doc.contains(post.nodes.root))) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
thumb = file.thumb;
|
if (ImageExpand.on && (!ImageExpand.spoilers && file.isSpoiler || ImageExpand.fromPosition && file.thumb.getBoundingClientRect().top < 0)) {
|
||||||
if (!doc.contains(thumb)) {
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (ImageExpand.on) {
|
posts.push(post);
|
||||||
if (!ImageExpand.spoilers && file.isSpoiler || ImageExpand.fromPosition && thumb.getBoundingClientRect().top < 0) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
ImageExpand.expand(post);
|
|
||||||
} else {
|
|
||||||
ImageExpand.contract(post);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
func = ImageExpand.on ? ImageExpand.expand : ImageExpand.contract;
|
||||||
|
for (_j = 0, _len1 = posts.length; _j < _len1; _j++) {
|
||||||
|
post = posts[_j];
|
||||||
|
func(post);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
updateFitness: function() {
|
updateFitness: function() {
|
||||||
var checked;
|
var checked;
|
||||||
@ -3616,7 +3614,7 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
el = $.el('span', {
|
el = $.el('span', {
|
||||||
textContent: 'Image expansion'
|
textContent: 'Image Expansion'
|
||||||
});
|
});
|
||||||
ImageExpand.menu.config = $.get('ImageExpansionConfig', {
|
ImageExpand.menu.config = $.get('ImageExpansionConfig', {
|
||||||
'Fit width': true,
|
'Fit width': true,
|
||||||
|
|||||||
@ -2114,19 +2114,19 @@ ImageExpand =
|
|||||||
all: ->
|
all: ->
|
||||||
$.event 'CloseMenu'
|
$.event 'CloseMenu'
|
||||||
ImageExpand.on = @checked
|
ImageExpand.on = @checked
|
||||||
|
posts = []
|
||||||
for ID, post of g.posts
|
for ID, post of g.posts
|
||||||
for post in [post].concat post.clones
|
for post in [post].concat post.clones
|
||||||
{file} = post
|
{file} = post
|
||||||
continue unless file and file.isImage
|
continue unless file and file.isImage and doc.contains post.nodes.root
|
||||||
{thumb} = file
|
if ImageExpand.on and
|
||||||
continue unless doc.contains thumb
|
(!ImageExpand.spoilers and file.isSpoiler or
|
||||||
if ImageExpand.on
|
ImageExpand.fromPosition and file.thumb.getBoundingClientRect().top < 0)
|
||||||
if !ImageExpand.spoilers and file.isSpoiler or
|
continue
|
||||||
ImageExpand.fromPosition and thumb.getBoundingClientRect().top < 0
|
posts.push post
|
||||||
continue
|
func = if ImageExpand.on then ImageExpand.expand else ImageExpand.contract
|
||||||
ImageExpand.expand post
|
for post in posts
|
||||||
else
|
func post
|
||||||
ImageExpand.contract post
|
|
||||||
return
|
return
|
||||||
updateFitness: ->
|
updateFitness: ->
|
||||||
{checked} = @
|
{checked} = @
|
||||||
@ -2211,7 +2211,7 @@ ImageExpand =
|
|||||||
return if g.VIEW is 'catalog' or !Conf['Image Expansion']
|
return if g.VIEW is 'catalog' or !Conf['Image Expansion']
|
||||||
|
|
||||||
el = $.el 'span',
|
el = $.el 'span',
|
||||||
textContent: 'Image expansion'
|
textContent: 'Image Expansion'
|
||||||
|
|
||||||
ImageExpand.menu.config = $.get 'ImageExpansionConfig',
|
ImageExpand.menu.config = $.get 'ImageExpansionConfig',
|
||||||
'Fit width': true
|
'Fit width': true
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user