Anonymous user
MediaWiki:Gadget-HotCat.js: Difference between revisions
avoid deprecation warning
Southparkfan (talk | contribs) (Update HotCat to newer version) |
(avoid deprecation warning) |
||
Line 1:
// <nowiki>
/*
HotCat V2.
Ajax-based simple Category manager. Allows adding/removing/changing categories on a page view.
Line 28:
(function () {
// Support: MW 1.16
var conf = window.mw ? mw.config.
if (
Line 377:
loadURI ('//commons.wikimedia.org/w/index.php?title='
+ 'MediaWiki:Gadget-HotCat.js/' + conf.wgUserLanguage
+ '&action=raw&ctype=text/javascript
);
} else {
Line 3,072:
var mwVersion = conf.wgVersion.split('.');
if (mwVersion[0] >= 1 && parseFloat(mwVersion[1]) > 20) {
if (parseFloat(mwVersion[1]) > 21 && conf.wgCanonicalSpecialPageName !== 'Upload') {▼
// Use wikipage.content hook so that HotCat reloads after VE edits (bug T103285)
var startHotCat = 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.
// OR: We're running on Special:Upload, where the 'wikipage.content' hook is fired for
// various previewed wikitext snippets, which shouldn't reload HotCat interface.
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) {
▲ 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.
Line 3,095 ⟶ 3,102:
})();
// </
|