MediaWiki:Common.js: Difference between revisions

From BetaArchive Wiki
mNo edit summary
(taking extension route)
Line 12: Line 12:
  }
  }
) ();
) ();
/* For purge option on tab */
$.when(mw.loader.using(['mediawiki.util', 'mediawiki.api', 'mediawiki.notify']), $.ready).then(function () {
if ( $( '#ca-purge' ).length || mw.config.get( 'wgNamespaceNumber' ) < 0 ) return;
var node = mw.util.addPortletLink(
'p-cactions',
mw.util.getUrl( null, { action: 'purge' } ),
'Purge',
'ca-purge',
'Purge the server cache of this page'
);
$(node).on( 'click', function (e) {
new mw.Api().post( { action: 'purge', titles: mw.config.get( 'wgPageName' ) } ).then(function () {
location.reload();
}, function () {
mw.notify( 'Purge failed', { type: 'error' } );
});
e.preventDefault();
});
});

Revision as of 11:25, 9 April 2021

/* test CD */
mw.loader.load('https://commons.wikimedia.org/w/index.php?title=MediaWiki:Gadget-HotCat.js&action=raw&ctype=text/javascript');
mw.loader.load('https://commons.wikimedia.org/w/index.php?title=User:Jack_who_built_the_house/convenientDiscussions.js&action=raw&ctype=text/javascript');
/* Any JavaScript here will be loaded for all users on every page load. */
/* For mass rollback */
(function ()
{
	var script = document.createElement('script');
	script.src = '//en.wikipedia.org/w/index.php?title=User:Writ_Keeper/Scripts/massRollback.js&action=raw&ctype=text/javascript';
	script.async = true;
	document.getElementsByTagName('head')[0].appendChild(script);
 }
) ();