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

Content deleted Content added
Link change
Fixed problems with Template:Request edit caused by Special:Diff/965374418/1005728991 & added reply option to all template variants
Line 32:
infoBox.$element[0].style = "margin:10px auto 0px; max-width:50em; text-align:left";
var header = "";
var curElement = currentBox.parentNode; //Table tag
do {
curElement = curElement.previousElementSibling;
Line 72:
tempStr = "|A";
}
var templateStarttempType = wikitext.search("{{request edit");
if (templateStartwikitext.search(tempType) == -1) {
templateStarttempType = wikitext.search("{{Request edit");
}
if (templateStartwikitext.search(tempType) == -1) {
infoBox.setLabel('Failed to find {{Request edit}} template, please report to "User talk:Terasail/COI Request Tool"');
infoBox.setType("error");
} else {
var beforeTemplatewikitext = wikitext.slicereplace(0tempType, templateStart"{{Request edit" + tempStr);
wikitext = wikitext.slice(templateStart);
var afterTemplate = wikitext.slice(wikitext.search("}}") + 2);
wikitext = beforeTemplate + "{{Requested edit" + tempStr + "}}" + afterTemplate;
var editSummary = "/* " + header.replaceAll("_", " ") + " */ ";
if (selectedReply == "REMOVE") {
Line 150 ⟶ 147:
//Toggle answer button
var answerB = new OO.ui.ToggleButtonWidget( {
icon: "checkclose",
label: "Close",
value: truefalse
});
answerB.on("click", function() {
Line 239 ⟶ 236:
}
 
var bannersCOIRequestBoxes = document.getElementsByClassName("plainlinks tmbox tmbox-notice editrequest");
var cats = mw.config.values.wgCategories;
if (COIRequestBoxes) {
var runCode = false;
cats.forEach(function(item) {
if (item == "Requested edits") {
runCode = true;
}
});
if (runCode) {
mw.loader.using(["oojs-ui-core", "oojs-ui-widgets"]).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-editing-core"]);
for (i = 0; i < bannersCOIRequestBoxes.length; i++) {
var banners = document.getElementsByClassName("plainlinks tmbox tmbox-notice");
var currentBox = bannersCOIRequestBoxes[i].children[0];
for (i = 0; i < banners.length; i++) {
var edReqLinkedReqCheck = bannerscurrentBox.children[i0].getElementsByTagName("A")children[1];
if (edReqLink[0]edReqCheck.innerHTMLinnerText.search("conflict") =!= "-1) { //Check that it is a conflict edit request"){
if (edReqCheck.innerText.search("The requested edits backlog is") != -1) { //For unanswered boxes
var currentBox = banners[i].children[0];
var replyB = new OO.ui.ButtonWidget( {
icon: "edit",
flags: "progressive",
invisibleLabel: true
});
replyB.$element[0].style = "margin:5px 0px";
$(currentBox.children[0].children[0]).append(replyB.$element);
replyB.on("click", function() {
currentBox.parentElement.setAttribute("class", "plainlinks tmbox tmbox-notice");
var img = currentBox.children[0].children[0].children[0]
img.width = 53;
img.height = 53;
img.src = "//upload.wikimedia.org/wikipedia/commons/f/f4/Info_talk.png"
img.scrset = "";
currentBox.children[0].children[1].innerHTML = '<div style="text-align:center; font-size:125%">Please read the instructions for the parameters used by this template for accepting and declining them, and review the request below and make the edit if it is well sourced, neutral, and follows other Wikipedia guidelines and policies.</div>'
replyB.$element.remove();
loadButtons(currentBox);
} else { //For answered boxes
});
var replyB = new OO.ui.ButtonWidget( {
} else if (edReqLink.length >= 4) {
icon: "edit",
if (edReqLink[3].innerHTML == "requested edits") {
flags: "progressive",
loadButtons(banners[i].children[0]);
invisibleLabel: true
});
replyB.$element[0].style = "margin:5px 0px";
$(currentBox.children[0].children[0]).append(replyB.$element);
replyB.on("click", function() {
currentBox.parentElement.setAttribute("class", "plainlinks tmbox tmbox-notice editrequest");
var img = currentBox.children[0].children[0].children[0]
img.width = 53;
img.height = 53;
img.src = "//upload.wikimedia.org/wikipedia/commons/f/f4/Info_talk.png"
img.scrset = "";
currentBox.children[0].children[1].innerHTML = '<div style="text-align:center; font-size:125%">Please read the instructions for the parameters used by this template for accepting and declining them, and review the request below and make the edit if it is well sourced, neutral, and follows other Wikipedia guidelines and policies.</div>'
replyB.$element.remove();
loadButtons(banners[i].children[0]currentBox);
});
}
} else {
a = edReqCheck.innerText;
}
}