MediaWiki:Gadget-purge.js
Revision as of 18:21, 3 October 2022 by Jacmob (talk | contribs) (Created page with "$(function () { 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()+...")
Note: After publishing, you may have to bypass your browser's cache to see the changes.
- Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
- Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
- Internet Explorer / Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5
- Opera: Press Ctrl-F5.
1 $(function () {
2 function purgePage(e) {
3 mw.notify("The page is now purging and will refresh when it is ready.", { title: 'Purging', tag: 'purge', autoHide: false });
4 (new mw.Api()).post({
5 action: 'purge',
6 titles: mw.config.get('wgPageName')
7 }).then(function(){
8 window.location.reload();
9 }, function(){
10 var uri = new mw.Uri();
11 uri.query.action = 'purge';
12 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 });
13 });
14 e.preventDefault();
15 }
16 function init() {
17 $('.jsPurgeLink').click(purgePage);
18 $('.jsPurgeLink > a').attr({'href': '#', target: ''});
19 }
20
21 init();
22 })