MediaWiki:Gadget-purgetab.js

// jQuery(document).ready(function {

if (!mw.config.get('wgArticleId')) return; var link; var portletIdToAdd = $("#p-cactions").length != 0 ? "p-cactions" : "p-views";

link = mw.util.addPortletLink(		portletIdToAdd, mw.util.getUrl(mw.config.get('wgPageName'), { 'action': 'purge' }),		(mw.config.get('skin') == "vector") ? "Purge" : "*",		'ca-purge', "Purge cache for this page", '*'	);

var api = new mw.Api; link = mw.util.addPortletLink(		portletIdToAdd, mw.util.getUrl(mw.config.get('wgPageName'), { 'action': 'purge', 'forcelinkupdate': 1 }), // not sure if raw link works...		(mw.config.get('skin') == "vector") ? "Hard purge" : "**",		'ca-purge-forcelinkupdate', "Purge with forced link table update", ','	); link.addEventListener('click', function(ev) {		api.post({ action: 'purge', pageids: mw.config.get('wgArticleId'), forcelinkupdate: 1 }).then(function { location.reload; }, function(code, details) { var mesg; switch (code) { case 'http': mesg = 'HTTP error: ' + details.xhr.statusText; break; case 'ok-but-empty': mesg = 'Received empty response.'; break; default: mesg = details.error.info; }			mw.util.jsMessage('Hard purge failed: ' + mesg); console.error(arguments); });		ev.preventDefault;	}, false);

link = mw.util.addPortletLink(		portletIdToAdd, 'javascript:void window.warranty',		(mw.config.get('skin') == "vector") ? "Null edit" : "***",		'ca-nulledit', "Null edit", '0'	); link.addEventListener('click', function(ev) {		api.post({ action: 'edit', pageid: mw.config.get('wgArticleId'), appendtext: '', watchlist: 'nochange', nocreate: '1', token: mw.user.tokens.get('csrfToken') }).then(function { location.reload; }, function(code, details) { var mesg; switch (code) { case 'http': mesg = 'HTTP error: ' + details.xhr.statusText; break; case 'ok-but-empty': mesg = 'Received empty response.'; break; default: mesg = details.error.info; }			mw.util.jsMessage('Null edit failed: ' + mesg); console.error(arguments); });		ev.preventDefault;	}, false);

});