Content deleted Content added
Fix to quick reply options & reorder and fixes to replyoption list |
Changes to improve section detection & var -> let |
||
Line 34:
"Not done: page move requests should be made at Wikipedia:Requested moves.": ["m", "tableMoveColumnAfter", "Not done - Use [[WP:RM]]"],
"Not done: Please make your request for a new image to be uploaded to Files For Upload. Once the file has been properly uploaded, feel free to reactivate this request.": ["ffu", "imageLayoutFrameless", "Not done - Use [[WP:FFU]]"],
"Not done: this is not the right page to request additional user rights. You may reopen this request with the specific changes to be made and someone will add them for you.": ["p", "userAdd", "Not done - Use [[WP:RFPERM]]"],
"Partially undone: This request has been partially undone.": ["pud","undo", "Partly undone"],
Line 41 ⟶ 40:
function postEdit(wikitext, editSummary, pageName, secIdx) {
api.postWithEditToken({
action: 'edit',
Line 57 ⟶ 56:
if (confirmed) {
//Change buttons to label box + loading bar
if (leftOOUI.length > 1) {
leftOOUI[0].remove();
Line 63 ⟶ 62:
leftOOUI[0].remove();
currentBox.children[2].remove();
icon: 'pageSettings',
type: 'notice',
label: 'Processing request — Edit request starting, getting section data to edit.'
});
firstRow.style = "padding-bottom:10px";
firstRow.innerHTML = "";
progress: false
});
Line 79 ⟶ 78:
infoBox.$element[0].style = "margin:10px auto 0px; max-width:50em";
//Find header
do {
curElement = curElement.previousElementSibling;
Line 88 ⟶ 87:
}
while (header == "");
api.get( {
action: "parse",
Line 97 ⟶ 96:
infoBox.setLabel("Processing request — Making changes to the edit request");
boxType = replyERT[boxType];
if (answered) { answered = "yes"; } else { answered = "no"; }
for (
editTemplate += "|" + targets[c3];
}
editTemplate += "|answered=" + answered;
for (
if (tempSec.anchor == header && !isNaN(Number(tempSec.index))) {
secIndx = tempSec;
} else if (tempSec.number.
}
}
endIndx = wikitext.length;▼
wikitext = wikitext.slice(wikitext.indexOf("==", secIndx.byteoffset - 5), endIndx);▼
secIndx = secIndx.index;
let headings = [...wikitext.matchAll(/==[^\n]+==/g)];
▲ wikitext = wikitext.slice(
wikitext = wikitext.replace(/{{ *([SETFI]PER|Edit[ -]?[A-Z]+[ -]?Protected)\s*[^}}]*/i, editTemplate);
if (replyOption[1] != "Close") {
wikitext = wikitext.trim() + "\n:";
while(lastMsg == wikitext.indexOf(":", lastMsg)) {
Line 155 ⟶ 151:
function addButtons(currentBox) {
$(currentBox).append('<tr><td colspan="2"><div style="display: flex; justify-content: center;"></div></td></tr><tr style="display:none;"><td colspan=2 style="padding-bottom:10px; text-align:center"><div style="display: flex; justify-content: center;"></div></td></tr>');
//Create type change dropdown
value: boxType,
options: [
Line 174 ⟶ 170:
$(currentBox.children[2].children[0]).append(typeChange.$element);
//Create target page list
if (boxLinks.length > 0) {//Open request
for(
if (boxLinks[c1].parentElement.tagName == "LI" || boxLinks[c1].parentElement.tagName == "B") {
pageLinks[pageLinks.length] = boxLinks[c1].innerHTML;
Line 184 ⟶ 180:
} else {//Closed request
boxLinks = currentBox.getElementsByClassName("mbox-text")[0].getElementsByTagName("A");
for(
pageLinks[pageLinks.length] = boxLinks[c2].title;
}
Line 191 ⟶ 187:
}
}
placeholder: 'Target Pages',
allowArbitrary: true,
Line 199 ⟶ 195:
$(currentBox.children[2].children[0]).append(targetPages.$element);
//Create dropdown menu
label: "Select reply option - Add additional text below",
menu: {items: []}
});
for (
label: replyList[count][0],
icon: replyList[count][1][1]
Line 213 ⟶ 209:
$(currentBox.children[2].children[0]).append(dropMenu.$element);
//Create input box
inputText.$element[0].style = "margin:auto";
$(currentBox.children[2].children[0]).append(inputText.$element);
//Create top horizontal layout
//Done
icon: "checkAll",
label: "Done",
Line 232 ⟶ 228:
execute(currentBox, replyERT.Change, "", false, typeChange.value, targetPages.getValue());
}
if (targets.length == pageLinks.length) {
for(
if (targets[item].data != pageLinks[item]) { newTargets = true; }
}
Line 260 ⟶ 256:
});
//Respond
icon: "add",
label: "More",
Line 283 ⟶ 279:
hzLayoutT.addItems([respondB]);
//Toggle answer button
hzLayoutT.addItems([toggleAns, new OO.ui.LabelWidget({label: "Answered"})]);
//Create firstrow fieldset
// Add an horizontal field layout
fieldsetT.addItems( [
Line 297 ⟶ 293:
$(firstRow).append(fieldsetT.$element);
//Close request
icon: "unFlag",
invisibleLabel: true,
Line 310 ⟶ 306:
}
//Remove request
icon: "trash",
flags: ["primary", "destructive"],
Line 324 ⟶ 320:
function addRButton(currentBox) {
icon: "edit",
flags: "progressive",
Line 335 ⟶ 331:
openB.$element.remove();
currentBox.parentElement.className = "plainlinks tmbox tmbox-notice editrequest";
img += boxType[2] + imgSrc + "/60px-" + imgSrc + '.png" height="60" width="60" style="margin-top:5px">';
origImg.outerHTML = img;
mboxText.style = "font-size:120%; text-align:center;";
mboxText.innerHTML = mboxText.innerHTML.replace(/ Set.*\/b>/i, '<br/>Uncheck the "answered" checkbox and use a reply option');
Line 352 ⟶ 348:
mw.loader.using(["oojs-ui-core", "oojs-ui-widgets", "oojs-ui-windows"]).done(function() {
mw.loader.load(["oojs-ui.styles.icons-alerts", "oojs-ui.styles.icons-interactions", "oojs-ui.styles.icons-moderation", "oojs-ui.styles.icons-user", "oojs-ui.styles.icons-content", "oojs-ui.styles.icons-editing-core", "oojs-ui.styles.icons-editing-advanced"]);
for (
if (editRequestBoxes[i].id != "") {
addButtons(currentBox);
|