MediaWiki:Common.js: Difference between revisions
From jugglingpatterns
No edit summary Tag: Reverted |
Tag: Undo |
||
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. */ |
||
$(function () { |
|||
<div class="horizontal-split"> |
|||
⚫ | |||
<div id="siteswapanimation" data-siteswapnr="your_siteswap_value_here"></div> |
|||
siteswap=animationPlace.innerHTML; |
|||
</div> |
|||
<script type="module"> |
|||
import Siteswap from '/js/siteswap.mjs'; |
|||
import AnimationWidget from '/js/animation-widget-standalone.mjs'; |
|||
// Get the siteswapnr from the data attribute of the element |
|||
⚫ | |||
const siteswapnr = animationPlace.dataset.siteswapnr; |
|||
// Use siteswapnr to create the Siteswap object |
|||
const sw = new Siteswap(siteswapnr); |
|||
}()); |
|||
// Your other logic for creating jif and AnimationWidget |
|||
console.log(JSON.stringify(sw)); |
|||
const myjson = { jugglers: 2, limbs: "ABCD" }; |
|||
myjson.props = Array.apply(null, Array(sw.nProps)).map(function () { return {}; }); |
Revision as of 16:04, 14 November 2023
/* Any JavaScript here will be loaded for all users on every page load. */ $(function () { var animationPlace = document.getElementById('siteswapanimation'); siteswap=animationPlace.innerHTML; }());