User:Bosco/Unsigned helper.js: Difference between revisions

From Test Wiki
Content deleted Content added
copy-paste
fix + tweak
Line 16: Line 16:
return;
return;
}
}
const oldText = editSummaryField.val().replace(/\s+$/, ""); // get text without trailing whitespace
const oldText = editSummaryField.val().trimEnd(); // get text without trailing whitespace
let newText = "";
let newText = "";
if (oldText.match(/[*]\/$/)) { // check if "/* section name */" is present
if (oldText.match(/[*]\/$/)) { // check if "/* section name */" is present
newText = text + " " + newSummary;
newText = oldText + " " + newSummary;
} else if (oldText.length!=0) {
} else if (oldText.length!=0) {
newText = oldText + ", " + newSummary;
newText = oldText + ", " + newSummary;