Content deleted Content added
PleaseStand (talk | contribs) m remove stray s |
PleaseStand (talk | contribs) add refsDiv directly under #editform, not within .wikiEditor-ui (fixes overlap issue) |
||
(5 intermediate revisions by the same user not shown) | |||
Line 29:
/*global window, addOnloadHook, SegregateRefsJsL10n, SegregateRefsJsAllowConversion,
wikEdUseWikEd, WikEdUpdateTextarea, WikEdUpdateFrame*/
// <nowiki>
// Translate the right-hand side of these if necessary.
Line 54 ⟶ 56:
var editForm, refsDiv, refsH2, mainTextbox, refsTextbox, randPrefix, messages,
refsButton, convertButton, unloadHandlerRegistered = false;
/**
Line 130 ⟶ 128:
return null;
}
var attributes =
while ( ( results = attParseRegex.exec( this.parsedRef[1] ) ) ) {
attributes[results[1].toLowerCase()] = htmlUnquote( results[2] );
Line 148 ⟶ 146:
var prefixChars, randNo, randPrefix, refPreferred, scanner, ref, parser, attributes,
refGroup, refName, refStored, refEmpty, refLong, unnamedRefs = 0,
refNames =
// Create a random prefix for autogenerated ref names
Line 176 ⟶ 174:
// The ref already has a name (possibly the empty string)
refName = attributes.name;
refStored =
refEmpty = parser.parsedRef[2].slice( -2 ) == '/>' ||
parser.parsedRef[2].slice( 0, 3 ) == '></';
Line 257 ⟶ 255:
}
var scanner, ref, parser, attributes, refCodes =
preferredRef =
// First, we build an associative array of all the ref codes
Line 268 ⟶ 266:
if ( attributes.name !== undefined ) {
// Only use the first ref having each name
if ( !
refCodes[attributes.name] = ref;
}
Line 282 ⟶ 280:
attributes = parser.getAttributes();
if ( attributes.name !== undefined ) {
if ( !
usageFreq[attributes.name] = 1;
} else {
Line 300 ⟶ 298:
parser = new RefParser( ref );
attributes = parser.getAttributes();
if (
// Is this name on the replacement list?
if (
// If we are using caseCues, and another ___location is
// preferred, skip to the next ref.
if ( caseCues &&
ref.slice( 0, 4 ) != '<REF'
) {
Line 376 ⟶ 374:
// Find all unused ref names
for(refName in result.unusedRefs) {
▲ unusedRefNamesQuoted.push(htmlQuote(refName));
}▼
}
// If any refs are unused, warn and allow the user to cancel;
Line 460 ⟶ 456:
refsTextbox.id = "PsRefsTextbox";
refsTextbox.value = segFormat.refCodes.join("\n\n");
refsTextbox.rows =
refsTextbox.cols = mainTextbox.cols;▼
refsTextbox.style.border = "none";
Line 542 ⟶ 537:
refsTextbox.value = messages.refsCommentComplete +
segFormat.refCodes.join("\n");
refsTextbox.rows =
refsTextbox.style.border = "none";
Line 569 ⟶ 563:
return false;
}
}▼
Line 590 ⟶ 569:
try {
}▼
// Handle message translations
messages = (typeof SegregateRefsJsL10n == "object" &&
Line 634 ⟶ 609:
refsDiv.appendChild(refsButton);
refsDiv.appendChild(convertButton);
// Find position within the edit form to insert it at
var refsDivPos = mainTextbox, refsDivPosParent = refsDivPos.parentNode;
while (refsDivPosParent !== editForm) {
refsDivPos = refsDivPosParent;
refsDivPosParent = refsDivPos.parentNode;
if (!refsDivPosParent) {
refsDivPosParent = refsDivPos.parentNode;
break;
▲ }
▲ }
refsDivPos = refsDivPos.nextSibling;
if (refsDivPos && refsDivPos.classList.contains("wikiEditor-ui-clear")) {
refsDivPos = refsDivPos.nextSibling;
▲ }
refsDivPosParent.insertBefore(refsDiv, refsDivPos);
} catch(e) {
}
Line 641 ⟶ 631:
})( jQuery );
// </nowiki>
|