Template:ArcaneDateCalculator: Difference between revisions
Jump to navigation
Jump to search
(Created page with "<div class="arcane-date-calculator" style="border:1px solid #aaa; background:#f9f9f9; padding:10px; max-width:350px;"> <div style="text-align:center; font-weight:bold; font-size:110%; margin-bottom:5px;">Arcane Calendar Calculator</div> <label for="arcane-year">Year:</label> <input type="number" id="arcane-year" min="1" style="width:60px;"> <label for="arcane-month">Month:</label> <input type="number" id="arcane-month" min="1" max="12" style="width:...") |
No edit summary |
||
Line 27: | Line 27: | ||
} | } | ||
var apiUrl = mw.util.wikiScript('api') + '?action= | var apiUrl = mw.util.wikiScript('api') + '?action=parse&format=json&text={{#invoke:ArcaneCalendar|convertDate|year=' + year + '|month=' + month + '|day=' + day + '}}'; | ||
fetch(apiUrl) | fetch(apiUrl) |
Revision as of 12:42, 9 February 2025
Arcane Calendar Calculator
<label for="arcane-year">Year:</label> <input type="number" id="arcane-year" min="1" style="width:60px;">
<label for="arcane-month">Month:</label> <input type="number" id="arcane-month" min="1" max="12" style="width:50px;">
<label for="arcane-day">Day:</label> <input type="number" id="arcane-day" min="1" max="31" style="width:50px;">
<button onclick="convertArcaneDate()" style="margin-left:5px;">Convert</button>
<script> function convertArcaneDate() {
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").innerHTML = "Please enter a valid date."; return; }
var apiUrl = mw.util.wikiScript('api') + '?action=parse&format=json&text=Invalid date input. Please provide year, month, and day.';
fetch(apiUrl) .then(response => response.json()) .then(data => { document.getElementById("arcane-date-output").innerHTML = data.expandtemplates["*"]; }) .catch(error => { console.error("Error fetching Arcane Calendar date:", error); document.getElementById("arcane-date-output").innerHTML = "Error converting date."; });
} </script>