User:JJPMaster/Scripts/AfC time logger.js: Difference between revisions

Content deleted Content added
No edit summary
No edit summary
Line 14:
function postToLog(title, time, action) {
var params = {
action: "editparse",
titletitles: "User:" + mw.config.get("wgUserName") + "/AfC time log",
appendtext: "\r\n* [[" + title + "]] - " + action + " after " + time + " seconds",
format: "json"
},
api = new mw.Api();
api.postWithTokenget("csrf", params).done((data) => {
if(data.error.code.equals("missingtitle")) {
console.log(data);
} params );= {
action: "edit",
 
title: "User:" + mw.config.get("wgUserName") + "/AfCL time log",
text: "This page measures the amount of time it takes for me to review articles at AfC. This information is obtained using a [[User:JJPMaster/afc.js|user script]].\r\n* [[" + title + "]] - " + action + " after " + time + " seconds",
summary: "Added " + title + " to AfC time log using [[User:JJPMaster/afc.js]]",
format: "json"
},
api.postWithToken("csrf", params).done((data) => {
console.log(data);
});
}
else {
params = {
action: "edit",
title: "User:" + mw.config.get("wgUserName") + "/AfC time log",
appendtext: "\r\n* [[" + title + "]] - " + action + " after " + time + " seconds",
summary: "Added " + title + " to AfC time log using [[User:JJPMaster/afc.js]]",
format: "json"
},
api.postWithToken("csrf", params).done((data) => {
console.log(data);
});
}
});
}