MediaWiki:Common.js: Difference between revisions
MediaWiki interface page
More actions
No edit summary |
No edit summary |
||
| (3 intermediate revisions by the same user not shown) | |||
| Line 16: | Line 16: | ||
}); | }); | ||
$box.children('[aria-expanded]').addBack('[aria-expanded]').attr('aria-expanded', 'false'); | $box.children('[aria-expanded]').addBack('[aria-expanded]').attr('aria-expanded', 'false'); | ||
var previousMargin = $box[0].style.scrollMarginTop; | |||
$box[0].style.scrollMarginTop = offset + 'px'; | |||
$box[0].scrollIntoView({ block: 'start', inline: 'nearest', behavior: 'instant' }); | |||
$box[0].style.scrollMarginTop = previousMargin; | |||
}); | }); | ||
}); | }); | ||
| Line 164: | Line 164: | ||
.toggleClass('is-open', !isOpen) | .toggleClass('is-open', !isOpen) | ||
.attr('aria-expanded', isOpen ? 'false' : 'true'); | .attr('aria-expanded', isOpen ? 'false' : 'true'); | ||
if (isOpen) { wizlordsScrollToCollapsedHeader($card); } | |||
} | } | ||
| Line 698: | Line 699: | ||
.toggleClass('is-open', !isOpen) | .toggleClass('is-open', !isOpen) | ||
.attr('aria-expanded', isOpen ? 'false' : 'true'); | .attr('aria-expanded', isOpen ? 'false' : 'true'); | ||
if (isOpen) { wizlordsScrollToCollapsedHeader($card); } | |||
} | } | ||
| Line 809: | Line 811: | ||
$(document).on('click', '.wizlords-lore-profile > .wizlords-collapsible-section-title, .wizlords-lore-profile > .wizlords-lore-profile-mobile-icon', function () { | $(document).on('click', '.wizlords-lore-profile > .wizlords-collapsible-section-title, .wizlords-lore-profile > .wizlords-lore-profile-mobile-icon', function () { | ||
if (!query.matches) { return; } | if (!query.matches) { return; } | ||
$(this).parent().children('.mw-collapsible-toggle').first().trigger('click'); | var $profile = $(this).parent(); | ||
var wasOpen = !$profile.hasClass('mw-collapsed'); | |||
$profile.children('.mw-collapsible-toggle').first().trigger('click'); | |||
prepareLoreProfiles(); | prepareLoreProfiles(); | ||
if (wasOpen) { wizlordsScrollToCollapsedHeader($profile); } | |||
}); | }); | ||
$(document).on('keydown', '.wizlords-lore-profile > .wizlords-collapsible-section-title, .wizlords-lore-profile > .wizlords-lore-profile-mobile-icon', function (event) { | $(document).on('keydown', '.wizlords-lore-profile > .wizlords-collapsible-section-title, .wizlords-lore-profile > .wizlords-lore-profile-mobile-icon', function (event) { | ||