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