MediaWiki:Gadget-purge.js: Difference between revisions
Jump to navigation
Jump to search
Created page with "(function($,mw,rs){ function purgePage(e) { mw.notify("The page is now purging and will refresh when it is ready.", { title: 'Purging', tag: 'purge', autoHide: false });..." |
mNo edit summary |
||
| Line 1: | Line 1: | ||
(function($,mw, | (function($,mw,gs){ | ||
function purgePage(e) { | function purgePage(e) { | ||
mw.notify("The page is now purging and will refresh when it is ready.", { title: 'Purging', tag: 'purge', autoHide: false }); | mw.notify("The page is now purging and will refresh when it is ready.", { title: 'Purging', tag: 'purge', autoHide: false }); | ||
Revision as of 18:05, 9 August 2021
(function($,mw,gs){
function purgePage(e) {
mw.notify("The page is now purging and will refresh when it is ready.", { title: 'Purging', tag: 'purge', autoHide: false });
(new mw.Api()).post({
action: 'purge',
titles: mw.config.get('wgPageName')
}).then(function(){
window.location.reload();
}, function(){
var uri = new mw.Uri();
uri.query.action = 'purge';
mw.notify($.parseHTML('Purging the page failed. Please try again or <a href="'+uri.toString()+'">do so manually</a>.'), { title: 'Purging failed', tag: 'purge', type: 'error', autoHide:false });
});
e.preventDefault();
}
function init() {
$('.jsPurgeLink').click(purgePage);
$('.jsPurgeLink > a').attr({'href': '#', target: ''});
}
$(init);
}(jQuery, mediaWiki, gswiki));