MediaWiki:Common.js: Difference between revisions

From jugglingpatterns
Content deleted Content added
No edit summary
No edit summary
 
(28 intermediate revisions by the same user not shown)
Line 1: Line 1:
function loadModule(src) {
// 'scripts' => array( '/js/animation-widget-standalone.mjs', 'js/siteswap.mjs' ),
const s = document.createElement('script');
// these two scripts loaded in /etc/mediawiki/LocalSettings.php
s.type = 'module';
s.src = src;
document.head.appendChild(s);
}


// deine beiden Dateien laden
var siteswapnr = "531";
loadModule('/js/animation.js');
console.log("siteswapnr " + siteswapnr);

var sw=new Siteswap(siteswapnr);
// use by using Template:AnimateSiteswap which provides the matching html
var myjson = {jugglers:2, limbs:"ABCD"};
console.log(JSON.stringify(sw));
console.log("importing animations");
myjson.props=Array.apply(null, Array(sw.nProps)).map(function () {return {}})
var jif=sw.toJif(myjson);
console.log(JSON.stringify(jif));

Latest revision as of 19:20, 8 September 2025

function loadModule(src) {
    const s = document.createElement('script');
    s.type = 'module';
    s.src = src;
    document.head.appendChild(s);
}

// deine beiden Dateien laden
loadModule('/js/animation.js');

// use by using Template:AnimateSiteswap which provides the matching html
console.log("importing animations");