MediaWiki:Common.js: Difference between revisions

From Ikwipedia
No edit summary
No edit summary
Line 1: Line 1:
/* Any JavaScript here will be loaded for all users on every page load. */
document.addEventListener('DOMContentLoaded', function () {
document.addEventListener("DOMContentLoaded", function() {
     var closeButton = document.getElementById('sitenotice-close');
     const footnotes = document.querySelectorAll("sup.reference a");
     if (closeButton) {
     footnotes.forEach((footnote, index) => {
        closeButton.addEventListener('click', function () {
        // Replace the entire text with alphabetic labels
            var banner = document.getElementById('sitenotice-banner');
        const letter = String.fromCharCode(97 + index); // 'a' for 0, 'b' for 1, etc.
            if (banner) {
         footnote.textContent = `[${letter}]`;
                banner.style.display = 'none';
     });
            }
         });
     }
});
});

Revision as of 05:30, 17 November 2024

document.addEventListener('DOMContentLoaded', function () {
    var closeButton = document.getElementById('sitenotice-close');
    if (closeButton) {
        closeButton.addEventListener('click', function () {
            var banner = document.getElementById('sitenotice-banner');
            if (banner) {
                banner.style.display = 'none';
            }
        });
    }
});