편집 요약 없음 |
편집 요약 없음 태그: 되돌려진 기여 |
||
| 3번째 줄: | 3번째 줄: | ||
$content.find('[class*="mw-customtoggle-"]').each(function () { | $content.find('[class*="mw-customtoggle-"]').each(function () { | ||
var $toggle = $(this); | var $toggle = $(this); | ||
var | var classNames = ($toggle.attr('class') || '').split(/\s+/); | ||
classNames.forEach(function (cls) { | |||
if (cls.indexOf('mw-customtoggle-') === 0) { | if (cls.indexOf('mw-customtoggle-') === 0) { | ||
var targetId = 'mw-customcollapsible-' + cls.replace('mw-customtoggle-', ''); | var targetId = 'mw-customcollapsible-' + cls.replace('mw-customtoggle-', ''); | ||
| 12번째 줄: | 12번째 줄: | ||
if ($target.length) { | if ($target.length) { | ||
$toggle.off('click.smoothSlide').on('click.smoothSlide', function (e) { | $toggle.off('click.smoothSlide').on('click.smoothSlide', function (e) { | ||
var $ | e.preventDefault(); | ||
var $animTarget = $ | var $collapsibleContent = $target.find('.mw-collapsible-content'); | ||
var $animTarget = $collapsibleContent.length ? $collapsibleContent : $target; | |||
$animTarget.stop(true, true).slideToggle(200); | |||
$animTarget.stop(true, true).slideToggle(200 | |||
}); | }); | ||
} | } | ||
2026년 8월 20일 (목) 14:52 판
/* MediaWiki:Common.js */
mw.hook('wikipage.content').add(function ($content) {
$content.find('[class*="mw-customtoggle-"]').each(function () {
var $toggle = $(this);
var classNames = ($toggle.attr('class') || '').split(/\s+/);
classNames.forEach(function (cls) {
if (cls.indexOf('mw-customtoggle-') === 0) {
var targetId = 'mw-customcollapsible-' + cls.replace('mw-customtoggle-', '');
var $target = $('#' + targetId);
if ($target.length) {
$toggle.off('click.smoothSlide').on('click.smoothSlide', function (e) {
e.preventDefault();
var $collapsibleContent = $target.find('.mw-collapsible-content');
var $animTarget = $collapsibleContent.length ? $collapsibleContent : $target;
$animTarget.stop(true, true).slideToggle(200);
});
}
}
});
});
});