User:Alexander Misel/mycontrib.js
外观
注意:保存之后,你必须清除浏览器缓存才能看到做出的更改。Google Chrome、Firefox、Microsoft Edge及Safari:按住⇧ Shift键并单击工具栏的“刷新”按钮。参阅Help:绕过浏览器缓存以获取更多帮助。
var api = new mw.Api();
var userId = mw.config.get('wgUserId');
Object.filter = function (obj, predicate) {
var result = {};
for (var key in obj) {
if (obj.hasOwnProperty(key) && predicate(obj[key])) {
result[key] = obj[key];
}
}
return result;
};
var resultList = {};
var asyncCount = 0;
function getList (depth, ucContinue) {
api.get({
format: 'json',
action: 'query',
list: 'usercontribs',
ucuserids: userId,
ucnamespace: 0,
ucprop: 'title|comment|sizediff|tags',
ucshow: '!minor',
uclimit: 500,
uccontinue: ucContinue
}).done((data) => {
for (var item of data.query.usercontribs) {
if (item.sizediff >= 100 && !item.tags.includes('mw-undo') && !item.tags.includes('mw-rollback') &&
item.comment.substring(0,2)!='回退' && !item.comment.includes('reFill')) {
if (resultList[item.title]) {
resultList[item.title] += item.sizediff;
} else {
resultList[item.title] = item.sizediff;
}
}
}
if (data.continue) {
asyncCount++;
getList(depth+1, data.continue.uccontinue);
}
if (!(--asyncCount)) {
resultList = Object.filter(resultList, v => v>=2500);
console.log('[[' + Object.keys(resultList).join(']] [[') + ']]');
}
})
}
asyncCount++;
getList(0);