VOOZH about

URL: https://minecraft.wiki/w/MediaWiki:Gadget-patrolAll.js

⇱ MediaWiki:Gadget-patrolAll.js – Minecraft Wiki


MediaWiki:Gadget-patrolAll.js

From Minecraft Wiki
Jump to navigation Jump to search
In other languages

Note: After saving, you have to bypass your browser's cache to see the changes.

Google Chrome, Firefox, Microsoft Edge, and Safari: Hold down the key and click the Reload toolbar button.
For details and instructions about other browsers, see Wikipedia:Bypass your cache.

(function($,mw){
'use strict';
if(!mw.config.get('wgRelevantUserName'))return;
varids=[];
varquery={
list:'usercontribs',
formatversion:2,
ucuser:mw.config.get('wgRelevantUserName'),
ucprop:'patrolled|ids',
uclimit:1000
};
varqueryApi=newmw.Api({parameters:query});
functionmarkPatrolled(revId){
returnnewmw.Api().postWithToken('patrol',{
action:'patrol',
revid:revId
});
}
functioncomplete(error){
if(error){
mw.notify(error,{type:'error'});
}
if(!error||ids.length){
ids.forEach(function(entry){
varrequest=markPatrolled(entry);
//if (request.fail) {
//	mw.notify('Failed to patrol revision ' + entry + '.', {type: 'error'});
//}
});
mw.notify('Done patrolling all edits.',{type:'success'});
}
}
functioncollect(more){
varqueryReq=queryApi.get(more);
queryReq.always(function(result,resultIfRejected){
vardata=result.query&&result.query[query.list];
varerror=(result.error&&result.error.code)||'unknown';
varcontinueData=result.continue;
if(data){
data.forEach(function(entry){
if(!entry.patrolled&&!entry.autopatrolled&&!ids.includes(entry.revid)){
ids.push(entry.revid);
}
});
}else{
complete(error);
return;
}
if(continueData){
collect(continueData);
}else{
complete();
}
});
}
varpatrolAllParent=document.createElement('span');
varpatrolAll=document.createElement('span');
patrolAll.classList.add('jslink');
patrolAll.textContent='Patrol all';
patrolAll.addEventListener('click',collect);
patrolAllParent.append(patrolAll);
document.getElementsByClassName('mw-changeslist-links')[0].append(patrolAllParent);
})(window.jQuery,window.mediaWiki);
Retrieved from "https://minecraft.wiki/w/MediaWiki:Gadget-patrolAll.js?oldid=2323852"

Navigation menu