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

Content deleted Content added
fix the __proto__ bug
add refsDiv directly under #editform, not within .wikiEditor-ui (fixes overlap issue)
 
(3 intermediate revisions by the same user not shown)
Line 456:
refsTextbox.id = "PsRefsTextbox";
refsTextbox.value = segFormat.refCodes.join("\n\n");
refsTextbox.rows = Math.floor(mainTextbox.rows / 2)12;
refsTextbox.cols = mainTextbox.cols;
refsTextbox.style.border = "none";
Line 538 ⟶ 537:
refsTextbox.value = messages.refsCommentComplete +
segFormat.refCodes.join("\n");
refsTextbox.rows = Math.floor(mainTextbox.rows / 2)12;
refsTextbox.cols = mainTextbox.cols;
 
refsTextbox.style.border = "none";
Line 565 ⟶ 563:
return false;
}
 
function getEditboxContents() { // ajaxPreview compatibility
if(unloadHandlerRegistered) {
// wikEd compatibility (frame -> textarea)
if(typeof wikEdUseWikEd != "undefined" && wikEdUseWikEd) {
WikEdUpdateTextarea();
}
return integrateRefs(mainTextbox.value, refsTextbox.value, randPrefix, true).wikiText;
} else {
return mainTextbox.value;
}
}
 
// Leave a global for ajaxPreview to use.
window.getEditboxContents = getEditboxContents;
 
 
Line 586 ⟶ 569:
try {
 
if( !window.addEventListener ) {
return;
}
// Handle message translations
messages = (typeof SegregateRefsJsL10n == "object" &&
Line 630 ⟶ 609:
refsDiv.appendChild(refsButton);
refsDiv.appendChild(convertButton);
// Find position within the edit form to insert it at
mainTextbox.parentNode.insertBefore(refsDiv, mainTextbox.nextSibling);
var refsDivPos = mainTextbox, refsDivPosParent = refsDivPos.parentNode;
while (refsDivPosParent !== editForm) {
refsDivPos = refsDivPosParent;
refsDivPosParent = refsDivPos.parentNode;
if (!refsDivPosParent) {
refsTextbox.cols refsDivPos = mainTextbox.cols;
refsDivPosParent = refsDivPos.parentNode;
break;
}
}
refsDivPos = refsDivPos.nextSibling;
if (refsDivPos && refsDivPos.classList.contains("wikiEditor-ui-clear")) {
refsDivPos = refsDivPos.nextSibling;
}
refsDivPosParent.insertBefore(refsDiv, refsDivPos);
} catch(e) {
}