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. */
/* Any JavaScript here will be loaded for all users on every page load. */
document.addEventListener("DOMContentLoaded", function() {
document.addEventListener("DOMContentLoaded", function() {
     var footnotes = document.querySelectorAll("sup.reference a");
     const footnotes = document.querySelectorAll("sup.reference a");
     footnotes.forEach((fn, index) => {
     footnotes.forEach((footnote, index) => {
        // Replace the entire text with alphabetic labels
         const letter = String.fromCharCode(97 + index); // 'a' for 0, 'b' for 1, etc.
         const letter = String.fromCharCode(97 + index); // 'a' for 0, 'b' for 1, etc.
         fn.textContent = `[${letter}]`;
         footnote.textContent = `[${letter}]`;
     });
     });
});
});

Revision as of 07:57, 5 November 2024

/* Any JavaScript here will be loaded for all users on every page load. */
document.addEventListener("DOMContentLoaded", function() {
    const footnotes = document.querySelectorAll("sup.reference a");
    footnotes.forEach((footnote, index) => {
        // Replace the entire text with alphabetic labels
        const letter = String.fromCharCode(97 + index); // 'a' for 0, 'b' for 1, etc.
        footnote.textContent = `[${letter}]`;
    });
});