Changes

Jump to: navigation, search

MediaWiki:Gadget-HotCat.js

249 bytes added, 18:33, 21 April 2016
no edit summary
/*
HotCat V2.3233
Ajax-based simple Category manager. Allows adding/removing/changing categories on a page view.
var mwVersion = conf.wgVersion.split('.');
if (mwVersion[0] >= 1 && parseFloat(mwVersion[1]) > 20) {
if (parseFloat(mwVersion[1]) > 21) {
// Use wikipage.content hook so that HotCat reloads after VE edits (bug T103285)
var startHotCat = function() {
mw.hook('wikipage.content').add( function() {
// Reset HotCat in case this is a soft reload (VE edit)
catLine = null;
editors = [];
initialized = false;
HotCat.started = false;
run ();
} );
};
} else {
// We are using MediaWiki 1.21, which doesn't support mw.hook. Fall back to dom-ready.
var startHotCat = function() {
jQuery(document).ready(run);
};
}
// We can safely trigger just after user configuration is loaded. Also start HotCat if the user module fails to load.
// Avoid using Promise methods of mw.loader.using as those aren't supported in older
// MediaWiki versions.
var startHotCat = function(){
jQuery(document).ready(run);
};
mw.loader.using('user', startHotCat, startHotCat);
if (parseFloat(mwVersion[1]) > 21) {
// Reload HotCat after page is saved (bug T103285)
mw.hook('postEdit').add( function () {
catLine = null;
editors = [];
initialized = false;
HotCat.started = false;
run ();
} );
}
} else {
// mw.loader.using('user', ...) could have unintended side-effects on MW <= 1.20. Fall back to dom-ready.



Navigation menu