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.
var api = new mw.Api();
var reason = prompt('Why would you want to undelete those again?', 'fehlerhafte Löschung rückgängig gemacht');
api.get({
action: 'query',
meta: 'tokens'
}).done(function (data) {
console.log(data);
var token = data.query.tokens.csrftoken;
var timestamps = '';
var i = 0;
var attempt = function() {
{
api.get({
action: 'query',
prop: 'deletedrevisions',
titles: mw.config.get('wgPageName'),
drvlimit: 500
}).done(function (drvdata) {
console.log(drvdata);
// -1 if completely deleted, otherwise it would be the respective page id
timestamps = drvdata.query.pages[mw.config.get('wgArticleId')/*'-1'*/].deletedrevisions
.map(function (revision) {
return revision.timestamp;
});
console.log(timestamps);
console.log('Restoring #' + (++i) + ' batch');
api.post({
action: 'undelete',
title: mw.config.get('wgPageName'),
reason: reason,
token: token,
timestamps: timestamps
},
{
contentType: 'multipart/form-data'
}
).done(function (data) {
console.log('Batch #' + i + ' must have been undeleted');
if(drvdata.continue){
attempt();
}
})
});
}
}
attempt();
});