Toggle menu
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

MediaWiki:Common.js: Difference between revisions

MediaWiki interface page
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');
window.scrollTo({
var previousMargin = $box[0].style.scrollMarginTop;
top: Math.max(0, window.scrollY + $box[0].getBoundingClientRect().top - offset),
$box[0].style.scrollMarginTop = offset + 'px';
behavior: window.matchMedia('(prefers-reduced-motion: reduce)').matches ? 'auto' : 'smooth'
$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) {