Content deleted Content added
Casual overhaul of script... |
Fix section edit errors |
||
Line 49:
}
while (header == "");
var conVal = mw.config.values;
var api = new mw.Api();
api.get( {
action: "parse",
page:
prop: "sections|wikitext"
}).done(function(data) {
infoBox.setLabel("Processing request — Making changes to the edit request");
var sections = data.parse.sections;
var wikitext = data.parse.wikitext["*"];
var
var
var endSection = -1;
for (var j = 0; j < sections.length; j++) {
if (tempSec.anchor == header && !isNaN(Number(tempSec.index))) {
sectionNum
sectionIndx = tempSec.index;
}▼
endSection = sectionIndx;
} else if (tempSec.number.indexOf(sectionNum) == 0) {
offset++;▼
endSection = tempSec.index;
}
}
var offset = sections[
if (endSection < sections.length) {
} else {
wikitext = wikitext.slice(
}
var templateR = replyOption[3];
Line 98 ⟶ 101:
var editSummary = "/* " + header.replaceAll("_", " ") + " */ " + replyOption[2] + " ([[User:Terasail/COI_Request_Tool|COI Request Tool]])";
if (replyOption[1] != "Close") {
var lastMsg = wikitext.lastIndexOf("\n", wikitext.lastIndexOf("(UTC)")) + 1;
wikitext = wikitext.trim() + "\n:";
while(lastMsg == wikitext.indexOf(":", lastMsg)) {
wikitext += ":";
▲ }
if (replyOption[0] != "") {
wikitext += "{{subst:ECOI|" + replyOption[0] + "}}";
Line 114 ⟶ 122:
api.postWithEditToken({
action: 'edit',
title:
text: wikitext,
section:
summary: editSummary
}).done(function(result) {
Line 148 ⟶ 156:
$(currentBox.children[2].children[0]).append(dropMenu.$element);
//Create input box
var inputText = new OO.ui.MultilineTextInputWidget({autosize: true, label: "
inputText.$element[0].style = "margin:auto";
$(currentBox.children[2].children[0]).append(inputText.$element);
|