MediaWiki:Common.js: Difference between revisions

From Crafters Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 5: Line 5:
   const css = document.createElement('link');
   const css = document.createElement('link');
   css.rel = 'stylesheet';
   css.rel = 'stylesheet';
   css.href = 'https://ehhthan.github.io/widgets/bookDisplayWidget.css';
   css.href = 'https://ehhthan.github.io/widgets/book-styles.css';
   head.appendChild(css);
   head.appendChild(css);



Revision as of 19:36, 1 August 2025

mw.loader.using('mediawiki.util', function () {
  const head = document.head;

  // CSS (optional)
  const css = document.createElement('link');
  css.rel = 'stylesheet';
  css.href = 'https://ehhthan.github.io/widgets/book-styles.css';
  head.appendChild(css);

  // JS: main gadget (depends on commons)
  const gadget = document.createElement('script');
  gadget.src = 'https://ehhthan.github.io/widgets/bookDisplayWidget.js';
  gadget.defer = true;
  head.appendChild(gadget);
});