User:TheDJ/CatPurge.js
Jump to navigation
Jump to search
Note: After saving, you have to bypass your browser's cache to see the changes. Internet Explorer: press Ctrl-F5, Mozilla: hold down Shift while clicking Reload (or press Ctrl-Shift-R), Opera/Konqueror: press F5, Safari: hold down Shift + Alt while clicking Reload, Chrome: hold down Shift while clicking Reload.
![]() |
Documentation for this user script can be added at User:TheDJ/CatPurge. |
- Report page listing warnings and errors.
var catpurge = {
init: function() {
mw.util.addPortletLink( "p-cactions", "javascript:catpurge.purge()", 'CatPurge', 'ca-catpurge', 'Purge all images in this category', null );
},
purge: function() {
var api = new mw.Api();
api.post( {
action: 'purge',
generator: 'categorymembers',
gcmtitle: mw.config.get( 'wgPageName' ),
gcmnamespace: '6',
gcmlimit: '500'
})
.done( function( data ) {
mw.log( 'API result:', data );
} )
.fail( function( error ) {
mw.log( 'API failed :(', error );
alert( 'API failed: ' + error );
});
}
};
if( mw.config.get( 'wgNamespaceNumber' ) === 14 ) {
$( catpurge.init );
}