Jump to content

JavaScript

From Wikven

Wikven bundles the wiki's own JavaScript into the static export at build time, so site scripts and gadgets run without a live server or load.php.

MediaWiki:Common.js

Site-wide JavaScript lives in MediaWiki:Common.js, just like on a regular wiki. Create a MediaWiki:Common.js file in your source directory and it runs on every page. A .js page carries its own content model, so it needs no .wikitext marker. The skin's MediaWiki:Vector.js (and so on) works the same way.

Gadgets

To use gadgets, enable the bundled Gadgets extension in .wikven.yaml:

extensions:
  - Gadgets

List your gadgets in MediaWiki:Gadgets-definition.wikitext, and put each gadget's code in MediaWiki:Gadget-<name>.js:

* MyGadget[ResourceLoader|default]|MyGadget.js

Only gadgets marked default are loaded: a static site has no logged-in readers to turn other gadgets on. A gadget's own CSS (in the same module) is included, but standalone styles-only gadgets are not yet covered.

These docs ship one such gadget, PersistTabber, which remembers whether you pick the Docker or the binary tab in the install steps and keeps that choice as you move between pages.

← Skins


Retrieved from "JavaScript.html"