m (Nekomusume Daisuki moved page Widget:Moonstack to Widget:MoonStack without leaving a redirect: Misspelled title) |
No edit summary Tag: Reverted |
||
| Line 13: | Line 13: | ||
| ''id'' || || unique id prefix if you embed multiple widgets on one page || || wh | | ''id'' || || unique id prefix if you embed multiple widgets on one page || || wh | ||
|} | |} | ||
</noinclude><includeonly> | </noinclude><includeonly><content><![CDATA[ | ||
<div class="wh-moonstack" style="max-width: | <div class="wh-moonstack" style="max-width:{size}px;margin:1rem 0;"> | ||
<label for="wh-x"> | |||
<strong>Alignment step:</strong> | |||
<span id="wh-xval">1</span> / 6433 | |||
</label> | |||
<input id="wh-x" type="range" min="1" max="6433" value="1" style="width:100%;"> | |||
<div style="margin:.5rem 0;"> | |||
<strong>When:</strong> | |||
<span id="wh-cycles">0</span> Cycles, | |||
<span id="wh-days">1</span> days | |||
</div> | |||
<div id="wh-stage" | |||
style="position:relative;width:{size}px;height:{size}px;isolation:isolate;border:1px solid #333;background:#000;overflow:hidden;"> | |||
<img id="wh-base" | |||
src="{basePath}WyrdeHaven_center.png" | |||
alt="WyrdeHaven base" | |||
style="position:absolute;inset:0;width:100%;height:100%;object-fit:contain;z-index:1;" | |||
loading="lazy" decoding="async"/> | |||
<img id="wh-tiriel" | |||
src="" | |||
alt="Tiriel" | |||
style="position:absolute;inset:0;width:100%;height:100%;object-fit:contain;z-index:2;" | |||
loading="lazy" decoding="async"/> | |||
<img id="wh-rhaen" | |||
src="" | |||
alt="Rhaen" | |||
style="position:absolute;inset:0;width:100%;height:100%;object-fit:contain;z-index:3;" | |||
loading="lazy" decoding="async"/> | |||
<img id="wh-veyra" | |||
src="" | |||
alt="Veyra" | |||
style="position:absolute;inset:0;width:100%;height:100%;object-fit:contain;z-index:4;" | |||
loading="lazy" decoding="async"/> | |||
</div> | |||
</div> | </div> | ||
< | <script type="text/javascript"> | ||
(function() { | |||
// Normalize basePath to end with a slash | |||
let BASE = "{basePath}"; | |||
if (BASE && !BASE.endsWith("/")) BASE += "/"; | |||
const el = { | |||
x: document.getElementById("wh-x"), | |||
xval: document.getElementById("wh-xval"), | |||
cyc: document.getElementById("wh-cycles"), | |||
days: document.getElementById("wh-days"), | |||
tiriel: document.getElementById("wh-tiriel"), | |||
rhaen: document.getElementById("wh-rhaen"), | |||
veyra: document.getElementById("wh-veyra") | |||
}; | |||
function pad2(n){ return ("0"+n).slice(-2); } | |||
function update(){ | |||
const X = parseInt(el.x.value,10); | |||
// Show cycles/days with days in 1..479 | |||
const Y = Math.floor((X - 1) / 479); | |||
const Z = ((X - 1) % 479) + 1; | |||
const iT = (X - 1) % 12; | |||
const iR = (X - 1) % 32; | |||
const iV = (X - 1) % 67; | |||
el.xval.textContent = X; | |||
el.cyc.textContent = Y; | |||
el.days.textContent = Z; | |||
el.tiriel.src = BASE + "Tiriel_" + pad2(iT) + ".png"; | |||
el.rhaen.src = BASE + "Rhaen_" + pad2(iR) + ".png"; | |||
el.veyra.src = BASE + "Veyra_" + pad2(iV) + ".png"; | |||
} | |||
el.x.addEventListener("input", update); | |||
update(); | |||
})(); | |||
</script> | |||
]]></content> | |||
</includeonly> | |||
})(); | |||
</script></includeonly> | |||
Revision as of 14:02, 10 November 2025
This widget allows you to embed the lunar orbits of WyrdeHaven in your mediaWiki page
Usage
{{#widget:MoonStack | basePath=/images/moons/ | size=512 | id=ms1}}
| basePath | Location of image files for the orbits | /images/moons/ | ||
| size | maximum image size in pixels | 512 | ||
| id | unique id prefix if you embed multiple widgets on one page | wh |