How Can I Make The Topbar Extension Work With The Newest Mediawiki?
I run a MediaWiki site which uses the Topbar extension. I recently upgraded the installation to the bleeding edge version from MediaWiki's master branch: version 1.28.0-alpha (91e5
Solution 1:
You need to convert the code to use ResourceLoader - currently the extension adds the code using OutputPage's addScriptFile(), and just assumes jQuery will be available by the time it runs. Starting with MediaWiki 1.26, everything loads asynchronously, so this doesn't work, and thus the need to convert it to the new system.
Instructions for doing so are here:
- https://www.mediawiki.org/wiki/ResourceLoader/Migration_guide_for_extension_developers
- https://www.mediawiki.org/wiki/ResourceLoader/Developing_with_ResourceLoader#Registering
Two notes:
- Since MediaWiki 1.25, extensions are supposed to use the so-called "extension registration" instead of following the above manuals, but this might require more work and expertise.
- Ugly hack warning: you can ignore all of this, and simply wrap the code in the JS file using
RLQ.push( function(){ /* All of the code here */ } );
. This shoves it all into the ResourceLoader's queue, so it will load after jQuery is available. I do not recommend this, but show it here for completeness' sake.
Post a Comment for "How Can I Make The Topbar Extension Work With The Newest Mediawiki?"