User:PleaseStand/segregate-refs-dev.js: Difference between revisions

Content deleted Content added
bugfix
use library functions, unquoting of group name
Line 29:
*/
 
/*global window, SegregateRefsJsL10naddOnloadHook, SegregateRefsJsEmptyRefsWarningGivenaddHandler, SegregateRefsJsL10n,
SegregateRefsJsEmptyRefsWarningGiven, wikEdUseWikEd, WikEdUpdateTextarea, WikEdUpdateFrame*/
WikEdUpdateFrame*/
 
// Translate the right-hand side of these if necessary.
Line 58 ⟶ 59:
"migration. If there is consensus to make the conversion, click OK to " +
"do so.",
groupPrompt: "Please enter the unescaped name of a group (leaveas it appears blankin ifthe " +
"wikitext, including any quotes). Leave this blank if unsure.",
"unsure).",
refsHeader: "Inline footnotes",
convertHeader: "Generated refs list",
Line 385 ⟶ 386:
 
function submitHandler() {
// Prevent double integration and restore the previous onsubmit value
this.onsubmit = this.PsOnsubmit;
// Do the actual integration work, updating the textbox
mainTextbox.value = integrateRefs(mainTextbox.value, refsTextbox.value,
Line 395 ⟶ 393:
refsDiv.removeChild(refsH2);
refsDiv.removeChild(refsTextbox);
// Run any previously registered submit handler
if(this.onsubmit) {
return this.onsubmit.apply(this, arguments);
}
return true;
}
 
Line 445 ⟶ 437:
// Set up the submit handler (to integrate refs when done editing)
addHandler(editForm.onsubmit, ="submit", submitHandler);
editForm.PsOnsubmit = editForm.submit;
editForm.onsubmit = submitHandler;
// Don't submit form
Line 464 ⟶ 454:
return false;
}
group = group.PsHTMLUnquote();
// The first button should disappear
Line 520 ⟶ 511:
function loadHandler() { // This function is called on page load
try {
// Restore the previous load handler;
window.onload = window.PsOnload;
// Handle message translations
messages = (typeof SegregateRefsJsL10n == "object" &&
Line 560 ⟶ 548:
window.document.getElementById("editpage-copywarn"));
} catch(e) {
}
// Run any previously registered load handler
if(this.onload) {
this.onload.apply(this, arguments);
}
}
 
// Register load handler
window.onload = addOnloadHook(loadHandler);
window.PsOnload = window.onload;
window.onload = loadHandler;
 
} SegregateRefsJs();