MediaWiki:Vector-2022.js

Revision as of 20:38, 8 November 2025 by Karl (talk | contribs) (fixing the last edit)

Note: After publishing, you may have to bypass your browser's cache to see the changes.

  • Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
  • Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
  • Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5.
$(function() {
    // create body overlay
    $('body').children().wrapAll('<div class="mw-body-wrapper"></div>');

    // create object just for backgrounds
    $('.mw-body-wrapper').prepend('<div class="custom-bg-overlay"></div>');
    $('.custom-bg-overlay').css({'height': $('.mw-body-wrapper').height(),
                                 'position': 'absolute',
                                 'pointer-events': 'none'});

    $('.vector-header-container').prepend('<div class="custom-header-container-overlay"></div>');
    $('.custom-custom-header-container-overlay').css(
        {'height':$('.vector-header-container').height,
         'position': 'absolute'});

    const ro = new ResizeObserver(([entry]) => {
        $('.custom-bg-overlay').height($('.mw-body-wrapper').height());
    });

    ro.observe($('.mw-body-wrapper')[0]);
});