MediaWiki:Common.js
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)
- Internet Explorer / Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5
- Opera: Press Ctrl-F5.
/* Any JavaScript here will be loaded for all users on every page load. */ function calculateArcaneDate() { var year = document.getElementById("arcane-year").value; var month = document.getElementById("arcane-month").value; var day = document.getElementById("arcane-day").value; if (!year || !month || !day) { document.getElementById("arcane-date-output").innerText = "Please enter a valid date."; return; } var apiUrl = mw.util.wikiScript('api') + '?action=expandtemplates&format=json&text={{#invoke:ArcaneCalendar|convertDate|year=' + year + '|month=' + month + '|day=' + day + '}}'; fetch(apiUrl) .then(response => response.json()) .then(data => { if (data.expandtemplates && data.expandtemplates["*"]) { document.getElementById("arcane-date-output").innerHTML = data.expandtemplates["*"]; } else { document.getElementById("arcane-date-output").innerText = "Error fetching date."; } }) .catch(error => { console.error("Error fetching Arcane Calendar date:", error); document.getElementById("arcane-date-output").innerText = "Error converting date."; }); }