expand-images.js: shrink all images functionality

This commit is contained in:
sinuca 2014-03-25 11:41:20 +01:00 committed by czaks
parent e0a89c597d
commit b0c837ce93

View File

@ -7,6 +7,7 @@
* Released under the MIT license * Released under the MIT license
* Copyright (c) 2012-2013 Michael Save <savetheinternet@tinyboard.org> * Copyright (c) 2012-2013 Michael Save <savetheinternet@tinyboard.org>
* Copyright (c) 2013-2014 Marcin Łabanowski <marcin@6irc.net> * Copyright (c) 2013-2014 Marcin Łabanowski <marcin@6irc.net>
* Copyright (c) 2014 sinuca <#55ch@rizon.net>
* *
* Usage: * Usage:
* $config['additional_javascript'][] = 'js/jquery.min.js'; * $config['additional_javascript'][] = 'js/jquery.min.js';
@ -25,6 +26,16 @@ onready(function(){
if (!$(this).parent()[0].dataset.expanded) if (!$(this).parent()[0].dataset.expanded)
$(this).parent().click(); $(this).parent().click();
}); });
$('hr:first').before('<div id="shrink-all-images" style="text-align:right"><a class="unimportant" href="javascript:void(0)"></a></div>');
$('div#shrink-all-images a')
.text(_('Shrink all images'))
.click(function(){
$('a img.post-image').each(function() {
if ($(this).parent()[0].dataset.expanded)
$(this).parent().click();
});
$(this).parent().remove(); $(this).parent().remove();
}); });
});
}); });