Content deleted Content added
PleaseStand (talk | contribs) found the bug |
PleaseStand (talk | contribs) updating to warn against accidentally deleting ref codes |
||
Line 37:
// var SegregateRefsJsL10n = {
var SegregateRefsJsMsgs = {
version: 1.
buttonText: "Segregate refs for editing",
buttonStyle: "background: #dfd;",
Line 76:
"with the Find/Replace command in many text editors. (Always use the " +
"quoted form of the attributes.) Then, paste the text back into the edit " +
"form and save the page.",
integrateWarning: "The refs listed below are missing from the text. If you " +
"continue, they will be permanently deleted. Are you sure?\n\nUnused refs: "
};
Line 384 ⟶ 386:
}
}
// Return both the combined output and the ref codes that were not used.
return {wikiText: scanner.wikiText, unusedRefs: refCodes};
}
function submitHandler() {
// Local variables
// Do the actual integration work, updating the textbox▼
var result; var refName; var unusedRefNamesQuoted = [];
mainTextbox.value = integrateRefs(mainTextbox.value, refsTextbox.value,▼
randPrefix);
// Find all unused ref names
for(refName in result.unusedRefs) {
if(result.unusedRefs.hasOwnProperty(refName)) {
unusedRefNamesQuoted.push(refName.PsHTMLQuote());
}
}
// If any refs are unused, warn and allow the user to cancel
if(unusedRefNamesQuoted.length) {
if(!window.confirm(messages.integrateWarning +
unusedRefNamesQuoted.join(", ").slice(0, -2))) {
// Don't submit form
return false;
}
}
// Otherwise, update the textbox.
mainTextbox.value = result.wikiText;
// We can delete the header and refs textbox now
refsDiv.removeChild(refsH2);
refsDiv.removeChild(refsTextbox);
// Deactivate this submit handler and run any previously registered handler
editForm.onsubmit = null;
if(typeof editForm.PsOnsubmit == "function") {
editForm.onsubmit = editForm.PsOnsubmit;
editForm.onsubmit.apply(this, arguments);
}
}
Line 443 ⟶ 474:
// Set up the submit handler (to integrate refs when done editing)
editForm.PsOnsubmit = editForm.onsubmit;
}
editForm.onsubmit = submitHandler;
// Don't submit form
Line 530 ⟶ 564:
messages = (typeof SegregateRefsJsL10n == "object" &&
typeof SegregateRefsJsL10n.version != "undefined" &&
SegregateRefsJsL10n.version == 1.
SegregateRefsJsMsgs);
|