No edit summary |
No edit summary |
||
| Line 3: | Line 3: | ||
=Usage= | =Usage= | ||
{{#widget:MoonStack | basePath=/images/moons/ | size=512}} | {{#widget:MoonStack | basePath=/images/moons/ | size=512 | id=ms1}} | ||
{| | {| | ||
|- | |- | ||
| ''basePath'' || || Location of image files for the orbits || || / | | ''basePath'' || || Location of image files for the orbits || || /images/moons/ | ||
|- | |- | ||
| ''size'' || || maximum image size in pixels || || 512 | | ''size'' || || maximum image size in pixels || || 512 | ||
|- | |||
| ''id'' || || unique id prefix if you embed multiple widgets on one page || || wh | |||
|} | |} | ||
</noinclude><includeonly> | </noinclude><includeonly> | ||
<div class="wh-moonstack" style="max-width:<!--{$size|default:512|escape:'html'}-->px;margin:1rem 0;"> | |||
<label for="<!--{$id|default:'wh'|escape:'html'}-->-x"> | |||
<strong>Alignment step:</strong> | |||
<span id="<!--{$id|default:'wh'|escape:'html'}-->-xval">1</span> / 6433 | |||
</label> | |||
<input id="<!--{$id|default:'wh'|escape:'html'}-->-x" type="range" min="1" max="6433" value="1" style="width:100%;"> | |||
<div style="margin:.5rem 0;"> | |||
<strong>When:</strong> | |||
<span id="<!--{$id|default:'wh'|escape:'html'}-->-cycles">0</span> Cycles, | |||
<span id="<!--{$id|default:'wh'|escape:'html'}-->-days">1</span> days | |||
</div> | |||
<div id="<!--{$id|default:'wh'|escape:'html'}-->-stage" | |||
style="position:relative;width:<!--{$size|default:512|escape:'html'}-->px;height:<!--{$size|default:512|escape:'html'}-->px;isolation:isolate;background:#000;border:1px solid #333;"> | |||
<img id="<!--{$id|default:'wh'|escape:'html'}-->-base" | |||
src="<!--{$basePath|default:'/images/moons/'|escape:'html'}-->WyrdeHaven_center.png" | |||
alt="WyrdeHaven base" | |||
style="position:absolute;inset:0;object-fit:contain;z-index:1;"/> | |||
<img id="<!--{$id|default:'wh'|escape:'html'}-->-tiriel" src="" alt="Tiriel" | |||
style="position:absolute;inset:0;object-fit:contain;z-index:2;"/> | |||
<img id="<!--{$id|default:'wh'|escape:'html'}-->-rhaen" src="" alt="Rhaen" | |||
style="position:absolute;inset:0;object-fit:contain;z-index:3;"/> | |||
<img id="<!--{$id|default:'wh'|escape:'html'}-->-veyra" src="" alt="Veyra" | |||
style="position:absolute;inset:0;object-fit:contain;z-index:4;"/> | |||
</div> | |||
</div> | |||
</ | <script type="text/javascript"> | ||
(function() { | |||
var ID = "<!--{$id|default:'wh'|escape:'js'}-->"; | |||
var BASE = "<!--{$basePath|default:'/images/moons/'|escape:'js'}-->"; | |||
function ge(s){return document.getElementById(ID + s);} | |||
var el = { | |||
x: ge("-x"), | |||
xval: ge("-xval"), | |||
cyc: ge("-cycles"), | |||
day: ge("-days"), | |||
t: ge("-tiriel"), | |||
r: ge("-rhaen"), | |||
v: ge("-veyra") | |||
}; | |||
function pad2(n){return ("0"+n).slice(-2);} | |||
function update(){ | |||
var X = parseInt(el.x.value,10); | |||
var Y = Math.floor(X/479); | |||
var Z = X % 479; | |||
var iT = (X-1) % 12; | |||
var iR = (X-1) % 32; | |||
var iV = (X-1) % 67; | |||
el.xval.textContent = X; | |||
el.cyc.textContent = Y; | |||
el.day.textContent = Z; | |||
el.t.src = BASE + "Tiriel_" + pad2(iT) + ".png"; | |||
el.r.src = BASE + "Rhaen_" + pad2(iR) + ".png"; | |||
el.v.src = BASE + "Veyra_" + pad2(iV) + ".png"; | |||
} | |||
el.x.addEventListener("input", update); | |||
update(); | |||
})(); | |||
</script></includeonly> | |||
Revision as of 13:06, 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 |