blob: 52701fd07eb8bc0a644e26751551a8db2b04fda8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
/*!
* This file is part of the Semantic MediaWiki Purge module
* @see https://www.semantic-mediawiki.org/wiki/Help:Purge
*
* @since 2.5
* @revision 0.0.1
*
* @file
* @ingroup SMW
*
* @licence GNU GPL v2+
* @author samwilson, mwjames
*/
/*global jQuery, mediaWiki, smw */
/*jslint white: true */
( function( $, mw ) {
'use strict';
mw.loader.using( [ 'mediawiki.api', 'mediawiki.notify' ] ).then( function () {
// JS is loaded, now remove the "soft" disabled functionality
$( "#ca-purge" ).removeClass( 'is-disabled' );
// Observed on the chameleon skin
$( "#ca-purge a" ).removeClass( 'is-disabled' );
$( "#ca-purge a" ).on( 'click', function ( e ) {
var postArgs = { action: 'purge', titles: mw.config.get( 'wgPageName' ) };
new mw.Api().post( postArgs ).then( function () {
location.reload();
}, function () {
mw.notify( mw.msg( 'smw-purge-failed' ), { type: 'error' } );
} );
e.preventDefault();
} );
} );
}( jQuery, mediaWiki ) );
|