Content deleted Content added
Fix template edit request targets & Don't link to edit request when removing request. |
Update from test version - Fix answered checkbox not working & cropping error |
||
Line 35:
"Undone: This request has been undone.": ["ud", "undo", "Undone"]
};
function postEdit(wikitext, editSummary, pageName, secIdx) {
title: pageName,
}
function execute(currentBox, replyOption, inputText, answered, boxType, targets) {
Line 71 ⟶ 83:
}
while (header == "");
var
var api = new mw.Api();
api.get( {
action: "parse",
page:
prop: "sections|wikitext|revid"
}).done(function(data) {
infoBox.setLabel("Processing request — Making changes to the edit request");
boxType = replyERT[boxType];
var editTemplate = "{{Edit " + boxType[1] + "-protected
if (answered) { answered = "yes"; } else { answered = "no"; }
editTemplate += "yes";▼
} else {▼
}▼
for (var c3 = 0; c3 < targets.length; c3++) {
editTemplate += "|" + targets[c3];
}
var sections = data.parse.sections;
var wikitext = data.parse.wikitext["*"];
var
var secIndx = -1, endIndx = -1;
for (var j = 0; j < sections.length; j++) {
var tempSec = sections[j];
if (tempSec.anchor == header && !isNaN(Number(tempSec.index))) {
if (sections[j+1]) { endIndx = j; } else { endIndx = -1; }
▲ } else if (tempSec.number.indexOf(sectionIndx[1]) == 0) {
}
}
if (endIndx == -1) {
wikitext = wikitext.slice(offset, sections[sectionIndx[2]].byteoffset);▼
} else {
}
▲
secIndx = secIndx.index;
wikitext = wikitext.replace(/{{ *([SETFI]PER|Edit[ -]?[A-Z]+[ -]?Protected)\s*[^}}]*/i, editTemplate);
var editSummary = "/* " + header.replaceAll("_", " ") + " */ " + replyOption[2] + " ([[User:Terasail/Edit_Request_Tool|Edit Request Tool]])";
Line 128 ⟶ 137:
infoBox.setType("success");
infoBox.setLabel("Processing '" + replyOption[2] + "' request — Saving changes to the talk page.");
▲ api.postWithEditToken({
postEdit(wikitext, editSummary, pageName, secIndx);
▲ action: 'edit',
▲ } else {
▲ title: mw.config.values.wgPageName,
OO.ui.confirm("There has been a new revision to the page, do you wish to continue?").done(function(revCon) {
▲ text: wikitext,
if (revCon) { postEdit(wikitext, editSummary, pageName, secIndx); }
▲ section: sectionIndx[0],
});
▲ summary: editSummary
▲ }
▲ }).done(function(result) {
▲ window.___location = "https" + "://en.wikipedia.org/w/index.php?title=" + mw.config.values.wgPageName + "&type=revision&diff=cur&oldid=prev";
▲ });
});
}
|