[WikiEN-l] MediaWiki <head> quirks in alternate skins

Harry Willis en.haza-w at ip3.co.uk
Wed Nov 5 21:25:36 UTC 2008


This is undoubtedly entirely the wrong list to be posting to, but I imagine
that there will be at least one or two people who know what's going on, or
who have experienced a similar phenomenon.

Checking for cross-skin compatibility on a script which utilises
MediaWiki's AJAX functions in ajax.js, I was surprised to see that the
scripts were throwing errors due to the functions not being defined,
despite the fact that ajax.js was definitely being run. Turns out that in
Monobook, the user script (User:<x>/monobook.js) is the very last element
of the document head, whereas in other skins it is called *before* the
newer "sexier" MediaWiki JS scripts (ajax.js, ajaxwatch.js, mwsuggest.js,
centralnotice.js), not allowing use of the functionality of those scripts
without a contrived workaround.

I apologise if I've made that incredibly unclear, but here's how it looks:
an excerpt from the source of a page viewed in Classic rather than
Monobook.

<script type="text/javascript"
src="/skins-1.5/common/wikibits.js?182"></script>
<script type="text/javascript"
src="/w/index.php?title=-&amp;action=raw&amp;smaxage=0&amp;gen=js&amp;usesk
in=standard"><!-- site js --></script>
<script type="text/javascript"
src="/w/index.php?title=User:Haza-w.debug/standard.js&amp;action=raw&amp;ct
ype=text/javascript"></script>				<script type="text/javascript"
src="/skins-1.5/common/ajax.js?182"></script>
<script type="text/javascript"
src="/skins-1.5/common/ajaxwatch.js?182"></script>
<script type="text/javascript"
src="/skins-1.5/common/mwsuggest.js?182"></script>

Compare with Monobook, where the site and user JS scripts are only called
right at the end of the document head:

<script type="text/javascript"
src="/w/index.php?title=-&amp;action=raw&amp;smaxage=0&amp;gen=js&amp;usesk
in=monobook"><!-- site js --></script>
<script type="text/javascript"
src="/w/index.php?title=User:Haza-w.debug/monobook.js&amp;action=raw&amp;ct
ype=text/javascript"></script>
</head>

Does anyone know why this occurs, and how I could go about getting the
discontinuity addressed?

- H



More information about the WikiEN-l mailing list