MediaWiki:Common.js: Difference between revisions
Appearance
No edit summary |
No edit summary |
||
| Line 71: | Line 71: | ||
$block.css('position', 'relative').prepend($button); | $block.css('position', 'relative').prepend($button); | ||
}); | |||
}); | |||
/* Variations toggle arrow rotation */ | |||
$(function () { | |||
$('.variations-toggle').on('click', function () { | |||
var $arrow = $(this).find('.arrow-icon'); | |||
// small delay to let MediaWiki toggle first | |||
setTimeout(() => { | |||
var targetId = this.className.match(/mw-customtoggle-(\d+)/); | |||
if (!targetId) return; | |||
var collapsibleId = '#mw-customcollapsible-' + targetId[1]; | |||
var $collapsible = $(collapsibleId); | |||
if ($collapsible.hasClass('mw-collapsed')) { | |||
$arrow.removeClass('rotated'); | |||
} else { | |||
$arrow.addClass('rotated'); | |||
} | |||
}, 50); | |||
}); | }); | ||
}); | }); | ||