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)
- Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5.
// /w/api.php?action=query&format=xml&list=usercontribs&uclimit=max&ucstart=2019-01-06T18%3A00%3A00.000Z&ucuser=Aamrs&ucdir=newer&ucnamespace=0%7C4%7C200&ucprop=ids%7Ctitle%7Ctimestamp%7Ccomment%7Csize%7Cflags&ucshow=new
const api = new mw.Api();
const reason = 'Deleting translation pages created with wrong incorrect language code';
const namespace = '0|4|200';
const user = 'Aamrs';
const startDate = '2019-01-06T18:00:00.000Z';
const wrongLanguage = 'en-gb';
api.get({
action: 'query',
meta: 'tokens'
}).done((data) => {
console.log(data);
const token = data.query.tokens.csrftoken;
api.get({
action: 'query',
list: 'usercontribs',
ucuser: user,
ucstart: startDate,
ucnamespace: namespace,
ucdir: 'newer',
uclimit: 'max',
ucshow: 'new'
}).done((data) => {
const dataToProceed = data.query.usercontribs.filter(item => item.title.endsWith('/' + wrongLanguage));
dataToProceed.forEach(item => {
api.post({
action: 'delete',
pageid: item.pageid,
reason: reason,
token: token
}).done(function(data){
console.log(item.title + ' must has been deleted');
});
});
});
});