Fix image expansion

DURR
This commit is contained in:
Zixaphir 2014-01-21 13:57:28 -07:00
parent 11e5f348f0
commit 702a343f5e
4 changed files with 18 additions and 14 deletions

View File

@ -1,5 +1,5 @@
/*
* 4chan X - Version 1.3.2 - 2014-01-19
* 4chan X - Version 1.3.2 - 2014-01-21
*
* Licensed under the MIT license.
* https://github.com/seaweedchan/4chan-x/blob/master/LICENSE

View File

@ -22,7 +22,7 @@
// ==/UserScript==
/*
* 4chan X - Version 1.3.2 - 2014-01-19
* 4chan X - Version 1.3.2 - 2014-01-21
*
* Licensed under the MIT license.
* https://github.com/seaweedchan/4chan-x/blob/master/LICENSE
@ -7506,9 +7506,9 @@
return ImageExpand.toggle(Get.postFromNode(this));
},
toggleAll: function() {
var func;
var func, toggle;
$.event('CloseMenu');
func = function(post) {
toggle = function(post) {
var file;
file = post.file;
if (!(file && file.isImage && doc.contains(post.nodes.root))) {
@ -7530,11 +7530,11 @@
}
return g.posts.forEach(function(post) {
var _i, _len, _ref;
func(post);
toggle(post);
_ref = post.clones;
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
post = _ref[_i];
func(post);
toggle(post);
}
});
},

View File

@ -1,6 +1,6 @@
// Generated by CoffeeScript
/*
* 4chan X - Version 1.3.2 - 2014-01-19
* 4chan X - Version 1.3.2 - 2014-01-21
*
* Licensed under the MIT license.
* https://github.com/seaweedchan/4chan-x/blob/master/LICENSE
@ -7489,9 +7489,9 @@
return ImageExpand.toggle(Get.postFromNode(this));
},
toggleAll: function() {
var func;
var func, toggle;
$.event('CloseMenu');
func = function(post) {
toggle = function(post) {
var file;
file = post.file;
if (!(file && file.isImage && doc.contains(post.nodes.root))) {
@ -7513,11 +7513,11 @@
}
return g.posts.forEach(function(post) {
var _i, _len, _ref;
func(post);
toggle(post);
_ref = post.clones;
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
post = _ref[_i];
func(post);
toggle(post);
}
});
},

View File

@ -30,9 +30,10 @@ ImageExpand =
return if e.shiftKey or e.altKey or e.ctrlKey or e.metaKey or e.button isnt 0
e.preventDefault()
ImageExpand.toggle Get.postFromNode @
toggleAll: ->
$.event 'CloseMenu'
func = (post) ->
toggle = (post) ->
{file} = post
return unless file and file.isImage and doc.contains post.nodes.root
if ImageExpand.on and
@ -40,6 +41,7 @@ ImageExpand =
Conf['Expand from here'] and Header.getTopOf(file.thumb) < 0)
return
$.queueTask func, post
if ImageExpand.on = $.hasClass ImageExpand.EAI, 'expand-all-shortcut'
ImageExpand.EAI.className = 'contract-all-shortcut fa fa-compress'
ImageExpand.EAI.title = 'Contract All Images'
@ -48,10 +50,12 @@ ImageExpand =
ImageExpand.EAI.className = 'expand-all-shortcut fa fa-expand'
ImageExpand.EAI.title = 'Expand All Images'
func = ImageExpand.contract
g.posts.forEach (post) ->
func post
func post for post in post.clones
toggle post
toggle post for post in post.clones
return
setFitness: ->
(if @checked then $.addClass else $.rmClass) doc, @name.toLowerCase().replace /\s+/g, '-'