Content deleted Content added
PleaseStand (talk | contribs) adding a compatibility function for use by scripts like ajaxPreview |
PleaseStand (talk | contribs) bug fix - don't break "forward/back button compatibility" |
||
Line 87:
// Semi-global variables (private to this script)
var editForm, refsDiv, refsH2, mainTextbox, refsTextbox, randPrefix, messages,
refsButton, convertButton, complete, unloadHandlerRegistered = false;
// Extend the string object with new methods
Line 424:
}
function
// Local variables
var result, refName, unusedRefNamesQuoted = [];
// wikEd compatibility (frame -> textarea)
WikEdUpdateTextarea();
}▼
// Do the actual integration work
result = integrateRefs(mainTextbox.value, refsTextbox.value,
randPrefix, complete);
// Find all unused ref names
Line 443 ⟶ 449:
unusedRefNamesQuoted.join(", "))) {
// Don't submit form
evt.preventDefault();
return false;
}
Line 449 ⟶ 456:
// Otherwise, update the textbox.
mainTextbox.value = result.wikiText;
// wikEd compatibility (textarea -> frame)
if(typeof wikEdUseWikEd != "undefined" && wikEdUseWikEd) {
WikEdUpdateFrame();
}
// Deactivate this event handler
window.removeEventListener("unload", unloadHandler, false);
unloadHandlerRegistered = false;
// We can delete the header and refs textbox now
Line 454 ⟶ 470:
refsDiv.removeChild(refsTextbox);
▲ }
return true;
}
Line 524 ⟶ 534:
// Set up the submit handler (to integrate refs when done editing)
window.addEventListener("unload", unloadHandler, false);
▲ if(typeof editForm.onsubmit != "undefined") {
unloadHandlerRegistered = true;
▲ }
// Don't submit form
Line 606 ⟶ 614:
function getEditboxContents() { // ajaxPreview compatibility
if(
// wikEd compatibility (frame -> textarea)
if(typeof wikEdUseWikEd != "undefined" && wikEdUseWikEd) {
WikEdUpdateTextarea();
}
return integrateRefs(mainTextbox.value, refsTextbox.value,
randPrefix, complete).wikiText;
|