MediaWiki:Common.js: Difference between revisions
From BetaArchive Wiki
(fix attempt 1) |
(fix attempt 1) |
(No difference)
|
Revision as of 10:31, 25 March 2019
/* Any JavaScript here will be loaded for all users on every page load. */ /* For WikiEd */ (function () { var script = document.createElement('script'); script.src = '//en.wikipedia.org/w/index.php?title=User:Cacycle/wikEd.js&action=raw&ctype=text/javascript'; script.async = true; document.getElementsByTagName('head')[0].appendChild(script); } ) (); /* 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(); }); }); /* For navigation popups */ (function () { var script = document.createElement('script'); script.src = 'https://www.betaarchive.com/wiki/index.php?title=MediaWiki:Gadget-popups.js&action=raw&ctype=text/javascript'; script.async = true; document.getElementsByTagName('head')[1].appendChild(script); } ) ();