MediaWiki:Common.js: Difference between revisions
From BetaArchive Wiki
(+massrollback) |
(order) |
||
Line 1: | Line 1: | ||
/* Any JavaScript here will be loaded for all users on every page load. */ | /* Any JavaScript here will be loaded for all users on every page load. */ | ||
/* | /* For mass rollback */ | ||
(function () | (function () | ||
{ | { | ||
var script = document.createElement('script'); | var script = document.createElement('script'); | ||
script.src = '//en.wikipedia.org/w/index.php?title=User: | script.src = '//en.wikipedia.org/w/index.php?title=User:Writ_Keeper/Scripts/massRollback.js&action=raw&ctype=text/javascript'; | ||
script.async = true; | script.async = true; | ||
document.getElementsByTagName('head')[0].appendChild(script); | document.getElementsByTagName('head')[0].appendChild(script); | ||
} | } | ||
) (); | ) (); | ||
/* | /* for WikiEd */ | ||
(function () | (function () | ||
{ | { | ||
var script = document.createElement('script'); | var script = document.createElement('script'); | ||
script.src = '//en.wikipedia.org/w/index.php?title=User: | script.src = '//en.wikipedia.org/w/index.php?title=User:Cacycle/wikEd.js&action=raw&ctype=text/javascript'; | ||
script.async = true; | script.async = true; | ||
document.getElementsByTagName('head')[0].appendChild(script); | document.getElementsByTagName('head')[0].appendChild(script); |
Revision as of 17:01, 26 March 2019
/* 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); } ) (); /* 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(); }); });