MediaWiki:Common.js
From jugglingpatterns
Note: After publishing, you may have to bypass your browser's cache to see the changes.
- Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
- Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
- Internet Explorer / Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5
- Opera: Press Ctrl-F5.
/* Any JavaScript here will be loaded for all users on every page load. */ // Wait for the document to be ready $(function () { // Get the element with id 'siteswapanimation' var animationPlace = document.getElementById('siteswapanimation'); // Check if the element exists if (animationPlace) { // Extract the siteswapnr value from the innerHTML of the element var siteswapnr = animationPlace.innerHTML.trim(); // Perform your logic with siteswapnr console.log("siteswapnr " + siteswapnr); // The rest of your script... import('/js/siteswap.mjs').then(({ default: Siteswap }) => { var sw = new Siteswap(siteswapnr); console.log(JSON.stringify(sw)); }).catch((error) => { console.error("Error loading module:", error); }); } else { console.error("Element with id 'siteswapanimation' not found."); } });