expand-all-images.js: format

This commit is contained in:
Zankaria 2024-08-05 19:15:26 +02:00
parent 41f9aed606
commit e92e9469a8

View File

@ -16,7 +16,7 @@
*
*/
if (active_page == 'ukko' || active_page == 'thread' || active_page == 'index')
if (active_page == 'ukko' || active_page == 'thread' || active_page == 'index') {
onready(function() {
$('hr:first').before('<div id="expand-all-images" style="text-align:right"><a class="unimportant" href="javascript:void(0)"></a></div>');
$('div#expand-all-images a')
@ -24,15 +24,18 @@ onready(function(){
.click(function() {
$('a img.post-image').each(function() {
// Don't expand YouTube embeds
if ($(this).parent().parent().hasClass('video-container'))
if ($(this).parent().parent().hasClass('video-container')) {
return;
}
// or WEBM
if (/^\/player\.php\?/.test($(this).parent().attr('href')))
if (/^\/player\.php\?/.test($(this).parent().attr('href'))) {
return;
}
if (!$(this).parent().data('expanded'))
if (!$(this).parent().data('expanded')) {
$(this).parent().click();
}
});
if (!$('#shrink-all-images').length) {
@ -43,10 +46,12 @@ onready(function(){
.text(_('Shrink all images'))
.click(function() {
$('a img.full-image').each(function() {
if ($(this).parent().data('expanded'))
if ($(this).parent().data('expanded')) {
$(this).parent().click();
}
});
$(this).parent().remove();
});
});
});
}