User:Kephir/common.js

From Wikipedia, the free encyclopedia
Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.
/*jshint undef:true */
/*global mw, jQuery, importScript */
importScript('User:Kephir/gadgets/sagittarius.js');     // [[User:Kephir/gadgets/sagittarius]]
importScript('User:Kephir/gadgets/table-editor.js');    // [[User:Kephir/gadgets/table-editor]]

importScript("User:This, that and the other/cleanupCleanup.js"); // [[User:This, that and the other/cleanupCleanup.js]]

mw.loader.using(['mediawiki.api', 'mediawiki.Uri', 'mediawiki.language.months'], function () {
	mw.loader.load('https://en.wiktionary.org/w/index.php?action=raw&ctype=text/javascript&title=MediaWiki:Gadget-RevdelInfo.js&maxage=86400&smaxage=86400');
});

if ((mw.config.get('wgAction') === 'view') && (mw.config.get('wgNamespaceNumber') > 0))
mw.loader.using(['mediawiki.api'], function () {
	var link = document.createElement('a');
	var api = new mw.Api();
	link.accessKey = '\'';
	link.addEventListener('click', function (ev) {
		api.get({
			action: 'purge',
			pageids: mw.config.get('wgArticleId'),
			forcelinkupdate: 1
		}).then(function () {
			mw.notify('Page purged.');
		});
	});
	document.body.appendChild(link);	
});

document.getElementById('t-upload').getElementsByTagName('a')[0].href = mw.util.getUrl('Special:Upload');