Here are a few things that would make it much easier to hook in custom JS code,
integrate external tools, etc. Most of it should be quite trivial to add.
Page specific stuff (should be set in a <script> tag in the html header):
- page name, encoded (with namespace, not encoded, with blanks, as in
the visible page title)
- page title (the same, without namespace)
- page namespace (canonical name)
- numeric page id (for external tools that have access to the database - like
things on the toolserver)
encode, but with space-to-underscore.
In case of a redirect, the above should reflect the page that is actually shown.
Maybe the page that contains the redirect should be available too, not sure.
User specific stuff (could be set in a <script> tag in the html header, or
referenced there like the user js page; probably the latter, what with caching
- user name (with whitespace - should be null or false for anons)
- user lang (should also work for anons)
- user skin (maybe - since js code is skin-specific already, this is not
really needed. But it may be nice to have anyway)
- a onHtmlLoad (or similar) hook, analogous to onLoad, triggered near the end of
html output. There should be an addHtmlOnloadHook analogous to addOnloadHook as
defined in wikibits.js (there's also something in upload.js - not sure why)
Conveniance functions for injecting things would also be nice. Especially:
- addTab for injecting a tab
- addTool for injecting into the toolbox
- maybe addPersonalTool for injecting into the personal toolbar (that has my
talk, preferences, etc)
Generally, it may be a good idea to introduce an MediaWiki:common.js page,
analogous to common.css