편집 요약 없음 태그: 되돌려진 기여 |
편집 요약 없음 태그: 수동 되돌리기 |
||
| 1번째 줄: | 1번째 줄: | ||
/* MediaWiki:Common.js */ | /* MediaWiki:Common.js */ | ||
mw.hook('wikipage.content').add(function ($content) { | |||
$content.find('[class*="mw-customtoggle-"]').each(function () { | |||
$ | var $toggle = $(this); | ||
var classList = ($toggle.attr('class') || '').split(/\s+/); | |||
classList.forEach(function (cls) { | |||
if (cls.indexOf('mw-customtoggle-') === 0) { | |||
if ( | var targetId = 'mw-customcollapsible-' + cls.replace('mw-customtoggle-', ''); | ||
var targetId = 'mw-customcollapsible-' + | |||
var $target = $('#' + targetId); | var $target = $('#' + targetId); | ||
if ($target.length) { | if ($target.length) { | ||
// 슬라이드 | $toggle.off('click.smoothSlide').on('click.smoothSlide', function (e) { | ||
var $contentTarget = $target.find('.mw-collapsible-content'); | |||
var $animTarget = $contentTarget.length ? $contentTarget : $target; | |||
// 너비 고정 후 슬라이드 실행 | |||
$animTarget.stop(true, true).slideToggle(200, function () { | |||
// 애니메이션 완료 후 잔여 inline style 제거 | |||
if ($(this).is(':visible')) { | |||
$(this).css('display', ''); | |||
} | |||
}); | |||
}); | |||
} | } | ||
} | } | ||
} | }); | ||
}); | }); | ||
}); | }); | ||
2026년 8월 20일 (목) 14:53 판
/* MediaWiki:Common.js */
mw.hook('wikipage.content').add(function ($content) {
$content.find('[class*="mw-customtoggle-"]').each(function () {
var $toggle = $(this);
var classList = ($toggle.attr('class') || '').split(/\s+/);
classList.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) {
var $contentTarget = $target.find('.mw-collapsible-content');
var $animTarget = $contentTarget.length ? $contentTarget : $target;
// 너비 고정 후 슬라이드 실행
$animTarget.stop(true, true).slideToggle(200, function () {
// 애니메이션 완료 후 잔여 inline style 제거
if ($(this).is(':visible')) {
$(this).css('display', '');
}
});
});
}
}
});
});
});