diff --git a/js/expand-all-images.js b/js/expand-all-images.js index c110f51c..6f446af6 100644 --- a/js/expand-all-images.js +++ b/js/expand-all-images.js @@ -16,37 +16,42 @@ * */ -if (active_page == 'ukko' || active_page == 'thread' || active_page == 'index') -onready(function(){ - $('hr:first').before('
'); - $('div#expand-all-images a') - .text(_('Expand all images')) - .click(function() { - $('a img.post-image').each(function() { - // Don't expand YouTube embeds - if ($(this).parent().parent().hasClass('video-container')) - return; +if (active_page == 'ukko' || active_page == 'thread' || active_page == 'index') { + onready(function() { + $('hr:first').before('
'); + $('div#expand-all-images a') + .text(_('Expand all images')) + .click(function() { + $('a img.post-image').each(function() { + // Don't expand YouTube embeds + if ($(this).parent().parent().hasClass('video-container')) { + return; + } - // or WEBM - if (/^\/player\.php\?/.test($(this).parent().attr('href'))) - return; + // or WEBM + if (/^\/player\.php\?/.test($(this).parent().attr('href'))) { + return; + } - if (!$(this).parent().data('expanded')) - $(this).parent().click(); - }); - - if (!$('#shrink-all-images').length) { - $('hr:first').before('
'); - } - - $('div#shrink-all-images a') - .text(_('Shrink all images')) - .click(function(){ - $('a img.full-image').each(function() { - if ($(this).parent().data('expanded')) - $(this).parent().click(); - }); - $(this).parent().remove(); + if (!$(this).parent().data('expanded')) { + $(this).parent().click(); + } }); - }); -}); + + if (!$('#shrink-all-images').length) { + $('hr:first').before('
'); + } + + $('div#shrink-all-images a') + .text(_('Shrink all images')) + .click(function() { + $('a img.full-image').each(function() { + if ($(this).parent().data('expanded')) { + $(this).parent().click(); + } + }); + $(this).parent().remove(); + }); + }); + }); +} \ No newline at end of file