User:Terasail/COI Request Tool.js: Difference between revisions

Content deleted Content added
Same updates as ERT
Fix error stopping reply save
Line 1:
//<nowiki>
var COIResponse = [
["ntmp", "speechBubbleAdd", "Comment", "Comment (No template)", ""],
["d", "checkAll", "Done", "Done", "|A"],
["pd", "check", "Partly done", "Partly done:", "|P"],
["a", "clock", "Already Done", "Already Done", "|A"],
["q", "helpNotice", "Question", "Question:", ""],
["g", "edit", "Go ahead", "Go ahead: I have reviewed these proposed changes and suggest that you go ahead and make the proposed changes to the page.", "|G"],
["note", "ellipsis", "Note", "Note:", ""],
["n", "notice", "Not done", "Not done:", "|G"],
["nfn", "notice", "Not done for now", "Not done for now:", "|D"],
["c", "userGroup", "Not done – Needs consensus", "Not done for now: Please establish a consensus with editors engaged in the subject area before using the {{Request edit}} template for this proposed change.", "|D|C"],
["udp","undo", "Partly undone", "Undone: This request has been partially undone.", "|D|The requested edit has been partially undone"],
["ud", "undo", "Undone", "Undone: This request has been undone.", "|D|The requested edit has been undone"]];
 
function executeCOI(currentBox, selectedReply, inputText, answered) {
Line 18:
if (confirmed) {
currentBox.getElementsByTagName('tr')[2].remove();
currentBox.children[0].children[0].children[1].remove();
currentBox.children[0].children[0].children[1].remove();
var infoBox = new OO.ui.MessageWidget( {
icon: 'pageSettings',
Line 71 ⟶ 73:
var wikitext = data.parse.wikitext["*"];
var tempStr = "";
if (answered || selectedReply == "CLOSEREQ") {
tempStr = "|A";
} else {
tempStr = COIResponse[selectedReply][4];
}
var tempType = "{{request edit";
ifvar upperWT = (wikitext.searchtoUpperCase(tempType) == -1) {;
tempTypevar templateLoc = upperWT.indexOf("{{Request editREQ");
}if (templateLoc == -1) {
templateLoc = upperWT.indexOf("{{EDIT");
if (wikitext.search(tempType) == -1) {
}
if (wikitext.search(tempType)templateLoc == -1) {
templateLoc = upperWT.indexOf("{{COI");
}
if (templateLoc == -1) {
infoBox.setLabel('Failed to find {{Request edit}} template, please report to "User talk:Terasail/COI Request Tool"');
infoBox.setType("error");
} else {
var templateEnd = upperWT.indexOf("}}", templateLoc) + 2;
wikitext = wikitext.replace(tempType, "{{Request edit" + tempStr);
if (tempStr != "" || answered == false) {
if (answered == false) {
tempStr = "";
}
wikitext = wikitext.replaceslice(tempType0, templateLoc) + "{{Request edit" + tempStr + "}}" + wikitext.slice(templateEnd);
}
var editSummary = "/* " + header.replaceAll("_", " ") + " */ ";
if (selectedReply == "REMOVE") {