MediaWiki: Common.js

From Spire Trading Inc.
Jump to: navigation, search
Line 1: Line 1:
 
/* Any JavaScript here will be loaded for all users on every page load. */
 
/* Any JavaScript here will be loaded for all users on every page load. */
jQuery(function($) {
+
(function() {
     $(window).on('load', function() {
+
     function fixFooter() {
         $(window).trigger('resize');
+
        var footer = document.querySelector('#footer.footer-sticky');
     });
+
        if (!footer) return;
});
+
        var current = parseFloat(window.getComputedStyle(footer).marginTop) || 0;
 +
        var additional = window.innerHeight - document.body.offsetHeight;
 +
        var newmargin = Math.max(current + additional, 50);
 +
        footer.style.marginTop = newmargin + 'px';
 +
    }
 +
    function init() {
 +
         setTimeout(fixFooter, 100);
 +
        setTimeout(fixFooter, 500);
 +
        setTimeout(fixFooter, 1500);
 +
    }
 +
    if (document.readyState === 'loading') {
 +
        document.addEventListener('DOMContentLoaded', init);
 +
     } else {
 +
        init();
 +
    }
 +
})();

Revision as of 18:52, 27 May 2026

/* Any JavaScript here will be loaded for all users on every page load. */
(function() {
    function fixFooter() {
        var footer = document.querySelector('#footer.footer-sticky');
        if (!footer) return;
        var current = parseFloat(window.getComputedStyle(footer).marginTop) || 0;
        var additional = window.innerHeight - document.body.offsetHeight;
        var newmargin = Math.max(current + additional, 50);
        footer.style.marginTop = newmargin + 'px';
    }
    function init() {
        setTimeout(fixFooter, 100);
        setTimeout(fixFooter, 500);
        setTimeout(fixFooter, 1500);
    }
    if (document.readyState === 'loading') {
        document.addEventListener('DOMContentLoaded', init);
    } else {
        init();
    }
})();