Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93

Warning: Undefined array key "page_file_edit_line" in /home/sportsfever/public_html/filemanger/edit_text_line.php on line 32
/home/sportsfe.../httpdocs/wp-conte.../plugins/wp-file-.../lib/codemirr.../lib
File: codemirror.js
};
[8500] Fix | Delete
[8501] Fix | Delete
function classTest(cls) { return new RegExp("(^|\\s)" + cls + "(?:$|\\s)\\s*"); }
[8502] Fix | Delete
var rmClass = CodeMirror.rmClass = function(node, cls) {
[8503] Fix | Delete
var current = node.className;
[8504] Fix | Delete
var match = classTest(cls).exec(current);
[8505] Fix | Delete
if (match) {
[8506] Fix | Delete
var after = current.slice(match.index + match[0].length);
[8507] Fix | Delete
node.className = current.slice(0, match.index) + (after ? match[1] + after : "");
[8508] Fix | Delete
}
[8509] Fix | Delete
};
[8510] Fix | Delete
var addClass = CodeMirror.addClass = function(node, cls) {
[8511] Fix | Delete
var current = node.className;
[8512] Fix | Delete
if (!classTest(cls).test(current)) node.className += (current ? " " : "") + cls;
[8513] Fix | Delete
};
[8514] Fix | Delete
function joinClasses(a, b) {
[8515] Fix | Delete
var as = a.split(" ");
[8516] Fix | Delete
for (var i = 0; i < as.length; i++)
[8517] Fix | Delete
if (as[i] && !classTest(as[i]).test(b)) b += " " + as[i];
[8518] Fix | Delete
return b;
[8519] Fix | Delete
}
[8520] Fix | Delete
[8521] Fix | Delete
// WINDOW-WIDE EVENTS
[8522] Fix | Delete
[8523] Fix | Delete
// These must be handled carefully, because naively registering a
[8524] Fix | Delete
// handler for each editor will cause the editors to never be
[8525] Fix | Delete
// garbage collected.
[8526] Fix | Delete
[8527] Fix | Delete
function forEachCodeMirror(f) {
[8528] Fix | Delete
if (!document.body.getElementsByClassName) return;
[8529] Fix | Delete
var byClass = document.body.getElementsByClassName("CodeMirror");
[8530] Fix | Delete
for (var i = 0; i < byClass.length; i++) {
[8531] Fix | Delete
var cm = byClass[i].CodeMirror;
[8532] Fix | Delete
if (cm) f(cm);
[8533] Fix | Delete
}
[8534] Fix | Delete
}
[8535] Fix | Delete
[8536] Fix | Delete
var globalsRegistered = false;
[8537] Fix | Delete
function ensureGlobalHandlers() {
[8538] Fix | Delete
if (globalsRegistered) return;
[8539] Fix | Delete
registerGlobalHandlers();
[8540] Fix | Delete
globalsRegistered = true;
[8541] Fix | Delete
}
[8542] Fix | Delete
function registerGlobalHandlers() {
[8543] Fix | Delete
// When the window resizes, we need to refresh active editors.
[8544] Fix | Delete
var resizeTimer;
[8545] Fix | Delete
on(window, "resize", function() {
[8546] Fix | Delete
if (resizeTimer == null) resizeTimer = setTimeout(function() {
[8547] Fix | Delete
resizeTimer = null;
[8548] Fix | Delete
forEachCodeMirror(onResize);
[8549] Fix | Delete
}, 100);
[8550] Fix | Delete
});
[8551] Fix | Delete
// When the window loses focus, we want to show the editor as blurred
[8552] Fix | Delete
on(window, "blur", function() {
[8553] Fix | Delete
forEachCodeMirror(onBlur);
[8554] Fix | Delete
});
[8555] Fix | Delete
}
[8556] Fix | Delete
[8557] Fix | Delete
// FEATURE DETECTION
[8558] Fix | Delete
[8559] Fix | Delete
// Detect drag-and-drop
[8560] Fix | Delete
var dragAndDrop = function() {
[8561] Fix | Delete
// There is *some* kind of drag-and-drop support in IE6-8, but I
[8562] Fix | Delete
// couldn't get it to work yet.
[8563] Fix | Delete
if (ie && ie_version < 9) return false;
[8564] Fix | Delete
var div = elt('div');
[8565] Fix | Delete
return "draggable" in div || "dragDrop" in div;
[8566] Fix | Delete
}();
[8567] Fix | Delete
[8568] Fix | Delete
var zwspSupported;
[8569] Fix | Delete
function zeroWidthElement(measure) {
[8570] Fix | Delete
if (zwspSupported == null) {
[8571] Fix | Delete
var test = elt("span", "\u200b");
[8572] Fix | Delete
removeChildrenAndAdd(measure, elt("span", [test, document.createTextNode("x")]));
[8573] Fix | Delete
if (measure.firstChild.offsetHeight != 0)
[8574] Fix | Delete
zwspSupported = test.offsetWidth <= 1 && test.offsetHeight > 2 && !(ie && ie_version < 8);
[8575] Fix | Delete
}
[8576] Fix | Delete
var node = zwspSupported ? elt("span", "\u200b") :
[8577] Fix | Delete
elt("span", "\u00a0", null, "display: inline-block; width: 1px; margin-right: -1px");
[8578] Fix | Delete
node.setAttribute("cm-text", "");
[8579] Fix | Delete
return node;
[8580] Fix | Delete
}
[8581] Fix | Delete
[8582] Fix | Delete
// Feature-detect IE's crummy client rect reporting for bidi text
[8583] Fix | Delete
var badBidiRects;
[8584] Fix | Delete
function hasBadBidiRects(measure) {
[8585] Fix | Delete
if (badBidiRects != null) return badBidiRects;
[8586] Fix | Delete
var txt = removeChildrenAndAdd(measure, document.createTextNode("A\u062eA"));
[8587] Fix | Delete
var r0 = range(txt, 0, 1).getBoundingClientRect();
[8588] Fix | Delete
var r1 = range(txt, 1, 2).getBoundingClientRect();
[8589] Fix | Delete
removeChildren(measure);
[8590] Fix | Delete
if (!r0 || r0.left == r0.right) return false; // Safari returns null in some cases (#2780)
[8591] Fix | Delete
return badBidiRects = (r1.right - r0.right < 3);
[8592] Fix | Delete
}
[8593] Fix | Delete
[8594] Fix | Delete
// See if "".split is the broken IE version, if so, provide an
[8595] Fix | Delete
// alternative way to split lines.
[8596] Fix | Delete
var splitLinesAuto = CodeMirror.splitLines = "\n\nb".split(/\n/).length != 3 ? function(string) {
[8597] Fix | Delete
var pos = 0, result = [], l = string.length;
[8598] Fix | Delete
while (pos <= l) {
[8599] Fix | Delete
var nl = string.indexOf("\n", pos);
[8600] Fix | Delete
if (nl == -1) nl = string.length;
[8601] Fix | Delete
var line = string.slice(pos, string.charAt(nl - 1) == "\r" ? nl - 1 : nl);
[8602] Fix | Delete
var rt = line.indexOf("\r");
[8603] Fix | Delete
if (rt != -1) {
[8604] Fix | Delete
result.push(line.slice(0, rt));
[8605] Fix | Delete
pos += rt + 1;
[8606] Fix | Delete
} else {
[8607] Fix | Delete
result.push(line);
[8608] Fix | Delete
pos = nl + 1;
[8609] Fix | Delete
}
[8610] Fix | Delete
}
[8611] Fix | Delete
return result;
[8612] Fix | Delete
} : function(string){return string.split(/\r\n?|\n/);};
[8613] Fix | Delete
[8614] Fix | Delete
var hasSelection = window.getSelection ? function(te) {
[8615] Fix | Delete
try { return te.selectionStart != te.selectionEnd; }
[8616] Fix | Delete
catch(e) { return false; }
[8617] Fix | Delete
} : function(te) {
[8618] Fix | Delete
try {var range = te.ownerDocument.selection.createRange();}
[8619] Fix | Delete
catch(e) {}
[8620] Fix | Delete
if (!range || range.parentElement() != te) return false;
[8621] Fix | Delete
return range.compareEndPoints("StartToEnd", range) != 0;
[8622] Fix | Delete
};
[8623] Fix | Delete
[8624] Fix | Delete
var hasCopyEvent = (function() {
[8625] Fix | Delete
var e = elt("div");
[8626] Fix | Delete
if ("oncopy" in e) return true;
[8627] Fix | Delete
e.setAttribute("oncopy", "return;");
[8628] Fix | Delete
return typeof e.oncopy == "function";
[8629] Fix | Delete
})();
[8630] Fix | Delete
[8631] Fix | Delete
var badZoomedRects = null;
[8632] Fix | Delete
function hasBadZoomedRects(measure) {
[8633] Fix | Delete
if (badZoomedRects != null) return badZoomedRects;
[8634] Fix | Delete
var node = removeChildrenAndAdd(measure, elt("span", "x"));
[8635] Fix | Delete
var normal = node.getBoundingClientRect();
[8636] Fix | Delete
var fromRange = range(node, 0, 1).getBoundingClientRect();
[8637] Fix | Delete
return badZoomedRects = Math.abs(normal.left - fromRange.left) > 1;
[8638] Fix | Delete
}
[8639] Fix | Delete
[8640] Fix | Delete
// KEY NAMES
[8641] Fix | Delete
[8642] Fix | Delete
var keyNames = CodeMirror.keyNames = {
[8643] Fix | Delete
3: "Enter", 8: "Backspace", 9: "Tab", 13: "Enter", 16: "Shift", 17: "Ctrl", 18: "Alt",
[8644] Fix | Delete
19: "Pause", 20: "CapsLock", 27: "Esc", 32: "Space", 33: "PageUp", 34: "PageDown", 35: "End",
[8645] Fix | Delete
36: "Home", 37: "Left", 38: "Up", 39: "Right", 40: "Down", 44: "PrintScrn", 45: "Insert",
[8646] Fix | Delete
46: "Delete", 59: ";", 61: "=", 91: "Mod", 92: "Mod", 93: "Mod",
[8647] Fix | Delete
106: "*", 107: "=", 109: "-", 110: ".", 111: "/", 127: "Delete",
[8648] Fix | Delete
173: "-", 186: ";", 187: "=", 188: ",", 189: "-", 190: ".", 191: "/", 192: "`", 219: "[", 220: "\\",
[8649] Fix | Delete
221: "]", 222: "'", 63232: "Up", 63233: "Down", 63234: "Left", 63235: "Right", 63272: "Delete",
[8650] Fix | Delete
63273: "Home", 63275: "End", 63276: "PageUp", 63277: "PageDown", 63302: "Insert"
[8651] Fix | Delete
};
[8652] Fix | Delete
(function() {
[8653] Fix | Delete
// Number keys
[8654] Fix | Delete
for (var i = 0; i < 10; i++) keyNames[i + 48] = keyNames[i + 96] = String(i);
[8655] Fix | Delete
// Alphabetic keys
[8656] Fix | Delete
for (var i = 65; i <= 90; i++) keyNames[i] = String.fromCharCode(i);
[8657] Fix | Delete
// Function keys
[8658] Fix | Delete
for (var i = 1; i <= 12; i++) keyNames[i + 111] = keyNames[i + 63235] = "F" + i;
[8659] Fix | Delete
})();
[8660] Fix | Delete
[8661] Fix | Delete
// BIDI HELPERS
[8662] Fix | Delete
[8663] Fix | Delete
function iterateBidiSections(order, from, to, f) {
[8664] Fix | Delete
if (!order) return f(from, to, "ltr");
[8665] Fix | Delete
var found = false;
[8666] Fix | Delete
for (var i = 0; i < order.length; ++i) {
[8667] Fix | Delete
var part = order[i];
[8668] Fix | Delete
if (part.from < to && part.to > from || from == to && part.to == from) {
[8669] Fix | Delete
f(Math.max(part.from, from), Math.min(part.to, to), part.level == 1 ? "rtl" : "ltr");
[8670] Fix | Delete
found = true;
[8671] Fix | Delete
}
[8672] Fix | Delete
}
[8673] Fix | Delete
if (!found) f(from, to, "ltr");
[8674] Fix | Delete
}
[8675] Fix | Delete
[8676] Fix | Delete
function bidiLeft(part) { return part.level % 2 ? part.to : part.from; }
[8677] Fix | Delete
function bidiRight(part) { return part.level % 2 ? part.from : part.to; }
[8678] Fix | Delete
[8679] Fix | Delete
function lineLeft(line) { var order = getOrder(line); return order ? bidiLeft(order[0]) : 0; }
[8680] Fix | Delete
function lineRight(line) {
[8681] Fix | Delete
var order = getOrder(line);
[8682] Fix | Delete
if (!order) return line.text.length;
[8683] Fix | Delete
return bidiRight(lst(order));
[8684] Fix | Delete
}
[8685] Fix | Delete
[8686] Fix | Delete
function lineStart(cm, lineN) {
[8687] Fix | Delete
var line = getLine(cm.doc, lineN);
[8688] Fix | Delete
var visual = visualLine(line);
[8689] Fix | Delete
if (visual != line) lineN = lineNo(visual);
[8690] Fix | Delete
var order = getOrder(visual);
[8691] Fix | Delete
var ch = !order ? 0 : order[0].level % 2 ? lineRight(visual) : lineLeft(visual);
[8692] Fix | Delete
return Pos(lineN, ch);
[8693] Fix | Delete
}
[8694] Fix | Delete
function lineEnd(cm, lineN) {
[8695] Fix | Delete
var merged, line = getLine(cm.doc, lineN);
[8696] Fix | Delete
while (merged = collapsedSpanAtEnd(line)) {
[8697] Fix | Delete
line = merged.find(1, true).line;
[8698] Fix | Delete
lineN = null;
[8699] Fix | Delete
}
[8700] Fix | Delete
var order = getOrder(line);
[8701] Fix | Delete
var ch = !order ? line.text.length : order[0].level % 2 ? lineLeft(line) : lineRight(line);
[8702] Fix | Delete
return Pos(lineN == null ? lineNo(line) : lineN, ch);
[8703] Fix | Delete
}
[8704] Fix | Delete
function lineStartSmart(cm, pos) {
[8705] Fix | Delete
var start = lineStart(cm, pos.line);
[8706] Fix | Delete
var line = getLine(cm.doc, start.line);
[8707] Fix | Delete
var order = getOrder(line);
[8708] Fix | Delete
if (!order || order[0].level == 0) {
[8709] Fix | Delete
var firstNonWS = Math.max(0, line.text.search(/\S/));
[8710] Fix | Delete
var inWS = pos.line == start.line && pos.ch <= firstNonWS && pos.ch;
[8711] Fix | Delete
return Pos(start.line, inWS ? 0 : firstNonWS);
[8712] Fix | Delete
}
[8713] Fix | Delete
return start;
[8714] Fix | Delete
}
[8715] Fix | Delete
[8716] Fix | Delete
function compareBidiLevel(order, a, b) {
[8717] Fix | Delete
var linedir = order[0].level;
[8718] Fix | Delete
if (a == linedir) return true;
[8719] Fix | Delete
if (b == linedir) return false;
[8720] Fix | Delete
return a < b;
[8721] Fix | Delete
}
[8722] Fix | Delete
var bidiOther;
[8723] Fix | Delete
function getBidiPartAt(order, pos) {
[8724] Fix | Delete
bidiOther = null;
[8725] Fix | Delete
for (var i = 0, found; i < order.length; ++i) {
[8726] Fix | Delete
var cur = order[i];
[8727] Fix | Delete
if (cur.from < pos && cur.to > pos) return i;
[8728] Fix | Delete
if ((cur.from == pos || cur.to == pos)) {
[8729] Fix | Delete
if (found == null) {
[8730] Fix | Delete
found = i;
[8731] Fix | Delete
} else if (compareBidiLevel(order, cur.level, order[found].level)) {
[8732] Fix | Delete
if (cur.from != cur.to) bidiOther = found;
[8733] Fix | Delete
return i;
[8734] Fix | Delete
} else {
[8735] Fix | Delete
if (cur.from != cur.to) bidiOther = i;
[8736] Fix | Delete
return found;
[8737] Fix | Delete
}
[8738] Fix | Delete
}
[8739] Fix | Delete
}
[8740] Fix | Delete
return found;
[8741] Fix | Delete
}
[8742] Fix | Delete
[8743] Fix | Delete
function moveInLine(line, pos, dir, byUnit) {
[8744] Fix | Delete
if (!byUnit) return pos + dir;
[8745] Fix | Delete
do pos += dir;
[8746] Fix | Delete
while (pos > 0 && isExtendingChar(line.text.charAt(pos)));
[8747] Fix | Delete
return pos;
[8748] Fix | Delete
}
[8749] Fix | Delete
[8750] Fix | Delete
// This is needed in order to move 'visually' through bi-directional
[8751] Fix | Delete
// text -- i.e., pressing left should make the cursor go left, even
[8752] Fix | Delete
// when in RTL text. The tricky part is the 'jumps', where RTL and
[8753] Fix | Delete
// LTR text touch each other. This often requires the cursor offset
[8754] Fix | Delete
// to move more than one unit, in order to visually move one unit.
[8755] Fix | Delete
function moveVisually(line, start, dir, byUnit) {
[8756] Fix | Delete
var bidi = getOrder(line);
[8757] Fix | Delete
if (!bidi) return moveLogically(line, start, dir, byUnit);
[8758] Fix | Delete
var pos = getBidiPartAt(bidi, start), part = bidi[pos];
[8759] Fix | Delete
var target = moveInLine(line, start, part.level % 2 ? -dir : dir, byUnit);
[8760] Fix | Delete
[8761] Fix | Delete
for (;;) {
[8762] Fix | Delete
if (target > part.from && target < part.to) return target;
[8763] Fix | Delete
if (target == part.from || target == part.to) {
[8764] Fix | Delete
if (getBidiPartAt(bidi, target) == pos) return target;
[8765] Fix | Delete
part = bidi[pos += dir];
[8766] Fix | Delete
return (dir > 0) == part.level % 2 ? part.to : part.from;
[8767] Fix | Delete
} else {
[8768] Fix | Delete
part = bidi[pos += dir];
[8769] Fix | Delete
if (!part) return null;
[8770] Fix | Delete
if ((dir > 0) == part.level % 2)
[8771] Fix | Delete
target = moveInLine(line, part.to, -1, byUnit);
[8772] Fix | Delete
else
[8773] Fix | Delete
target = moveInLine(line, part.from, 1, byUnit);
[8774] Fix | Delete
}
[8775] Fix | Delete
}
[8776] Fix | Delete
}
[8777] Fix | Delete
[8778] Fix | Delete
function moveLogically(line, start, dir, byUnit) {
[8779] Fix | Delete
var target = start + dir;
[8780] Fix | Delete
if (byUnit) while (target > 0 && isExtendingChar(line.text.charAt(target))) target += dir;
[8781] Fix | Delete
return target < 0 || target > line.text.length ? null : target;
[8782] Fix | Delete
}
[8783] Fix | Delete
[8784] Fix | Delete
// Bidirectional ordering algorithm
[8785] Fix | Delete
// See http://unicode.org/reports/tr9/tr9-13.html for the algorithm
[8786] Fix | Delete
// that this (partially) implements.
[8787] Fix | Delete
[8788] Fix | Delete
// One-char codes used for character types:
[8789] Fix | Delete
// L (L): Left-to-Right
[8790] Fix | Delete
// R (R): Right-to-Left
[8791] Fix | Delete
// r (AL): Right-to-Left Arabic
[8792] Fix | Delete
// 1 (EN): European Number
[8793] Fix | Delete
// + (ES): European Number Separator
[8794] Fix | Delete
// % (ET): European Number Terminator
[8795] Fix | Delete
// n (AN): Arabic Number
[8796] Fix | Delete
// , (CS): Common Number Separator
[8797] Fix | Delete
// m (NSM): Non-Spacing Mark
[8798] Fix | Delete
// b (BN): Boundary Neutral
[8799] Fix | Delete
// s (B): Paragraph Separator
[8800] Fix | Delete
// t (S): Segment Separator
[8801] Fix | Delete
// w (WS): Whitespace
[8802] Fix | Delete
// N (ON): Other Neutrals
[8803] Fix | Delete
[8804] Fix | Delete
// Returns null if characters are ordered as they appear
[8805] Fix | Delete
// (left-to-right), or an array of sections ({from, to, level}
[8806] Fix | Delete
// objects) in the order in which they occur visually.
[8807] Fix | Delete
var bidiOrdering = (function() {
[8808] Fix | Delete
// Character types for codepoints 0 to 0xff
[8809] Fix | Delete
var lowTypes = "bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN";
[8810] Fix | Delete
// Character types for codepoints 0x600 to 0x6ff
[8811] Fix | Delete
var arabicTypes = "rrrrrrrrrrrr,rNNmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmrrrrrrrnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmNmmmm";
[8812] Fix | Delete
function charType(code) {
[8813] Fix | Delete
if (code <= 0xf7) return lowTypes.charAt(code);
[8814] Fix | Delete
else if (0x590 <= code && code <= 0x5f4) return "R";
[8815] Fix | Delete
else if (0x600 <= code && code <= 0x6ed) return arabicTypes.charAt(code - 0x600);
[8816] Fix | Delete
else if (0x6ee <= code && code <= 0x8ac) return "r";
[8817] Fix | Delete
else if (0x2000 <= code && code <= 0x200b) return "w";
[8818] Fix | Delete
else if (code == 0x200c) return "b";
[8819] Fix | Delete
else return "L";
[8820] Fix | Delete
}
[8821] Fix | Delete
[8822] Fix | Delete
var bidiRE = /[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;
[8823] Fix | Delete
var isNeutral = /[stwN]/, isStrong = /[LRr]/, countsAsLeft = /[Lb1n]/, countsAsNum = /[1n]/;
[8824] Fix | Delete
// Browsers seem to always treat the boundaries of block elements as being L.
[8825] Fix | Delete
var outerType = "L";
[8826] Fix | Delete
[8827] Fix | Delete
function BidiSpan(level, from, to) {
[8828] Fix | Delete
this.level = level;
[8829] Fix | Delete
this.from = from; this.to = to;
[8830] Fix | Delete
}
[8831] Fix | Delete
[8832] Fix | Delete
return function(str) {
[8833] Fix | Delete
if (!bidiRE.test(str)) return false;
[8834] Fix | Delete
var len = str.length, types = [];
[8835] Fix | Delete
for (var i = 0, type; i < len; ++i)
[8836] Fix | Delete
types.push(type = charType(str.charCodeAt(i)));
[8837] Fix | Delete
[8838] Fix | Delete
// W1. Examine each non-spacing mark (NSM) in the level run, and
[8839] Fix | Delete
// change the type of the NSM to the type of the previous
[8840] Fix | Delete
// character. If the NSM is at the start of the level run, it will
[8841] Fix | Delete
// get the type of sor.
[8842] Fix | Delete
for (var i = 0, prev = outerType; i < len; ++i) {
[8843] Fix | Delete
var type = types[i];
[8844] Fix | Delete
if (type == "m") types[i] = prev;
[8845] Fix | Delete
else prev = type;
[8846] Fix | Delete
}
[8847] Fix | Delete
[8848] Fix | Delete
// W2. Search backwards from each instance of a European number
[8849] Fix | Delete
// until the first strong type (R, L, AL, or sor) is found. If an
[8850] Fix | Delete
// AL is found, change the type of the European number to Arabic
[8851] Fix | Delete
// number.
[8852] Fix | Delete
// W3. Change all ALs to R.
[8853] Fix | Delete
for (var i = 0, cur = outerType; i < len; ++i) {
[8854] Fix | Delete
var type = types[i];
[8855] Fix | Delete
if (type == "1" && cur == "r") types[i] = "n";
[8856] Fix | Delete
else if (isStrong.test(type)) { cur = type; if (type == "r") types[i] = "R"; }
[8857] Fix | Delete
}
[8858] Fix | Delete
[8859] Fix | Delete
// W4. A single European separator between two European numbers
[8860] Fix | Delete
// changes to a European number. A single common separator between
[8861] Fix | Delete
// two numbers of the same type changes to that type.
[8862] Fix | Delete
for (var i = 1, prev = types[0]; i < len - 1; ++i) {
[8863] Fix | Delete
var type = types[i];
[8864] Fix | Delete
if (type == "+" && prev == "1" && types[i+1] == "1") types[i] = "1";
[8865] Fix | Delete
else if (type == "," && prev == types[i+1] &&
[8866] Fix | Delete
(prev == "1" || prev == "n")) types[i] = prev;
[8867] Fix | Delete
prev = type;
[8868] Fix | Delete
}
[8869] Fix | Delete
[8870] Fix | Delete
// W5. A sequence of European terminators adjacent to European
[8871] Fix | Delete
// numbers changes to all European numbers.
[8872] Fix | Delete
// W6. Otherwise, separators and terminators change to Other
[8873] Fix | Delete
// Neutral.
[8874] Fix | Delete
for (var i = 0; i < len; ++i) {
[8875] Fix | Delete
var type = types[i];
[8876] Fix | Delete
if (type == ",") types[i] = "N";
[8877] Fix | Delete
else if (type == "%") {
[8878] Fix | Delete
for (var end = i + 1; end < len && types[end] == "%"; ++end) {}
[8879] Fix | Delete
var replace = (i && types[i-1] == "!") || (end < len && types[end] == "1") ? "1" : "N";
[8880] Fix | Delete
for (var j = i; j < end; ++j) types[j] = replace;
[8881] Fix | Delete
i = end - 1;
[8882] Fix | Delete
}
[8883] Fix | Delete
}
[8884] Fix | Delete
[8885] Fix | Delete
// W7. Search backwards from each instance of a European number
[8886] Fix | Delete
// until the first strong type (R, L, or sor) is found. If an L is
[8887] Fix | Delete
// found, then change the type of the European number to L.
[8888] Fix | Delete
for (var i = 0, cur = outerType; i < len; ++i) {
[8889] Fix | Delete
var type = types[i];
[8890] Fix | Delete
if (cur == "L" && type == "1") types[i] = "L";
[8891] Fix | Delete
else if (isStrong.test(type)) cur = type;
[8892] Fix | Delete
}
[8893] Fix | Delete
[8894] Fix | Delete
// N1. A sequence of neutrals takes the direction of the
[8895] Fix | Delete
// surrounding strong text if the text on both sides has the same
[8896] Fix | Delete
// direction. European and Arabic numbers act as if they were R in
[8897] Fix | Delete
// terms of their influence on neutrals. Start-of-level-run (sor)
[8898] Fix | Delete
// and end-of-level-run (eor) are used at level run boundaries.
[8899] Fix | Delete
// N2. Any remaining neutrals take the embedding direction.
[8900] Fix | Delete
for (var i = 0; i < len; ++i) {
[8901] Fix | Delete
if (isNeutral.test(types[i])) {
[8902] Fix | Delete
for (var end = i + 1; end < len && isNeutral.test(types[end]); ++end) {}
[8903] Fix | Delete
var before = (i ? types[i-1] : outerType) == "L";
[8904] Fix | Delete
var after = (end < len ? types[end] : outerType) == "L";
[8905] Fix | Delete
var replace = before || after ? "L" : "R";
[8906] Fix | Delete
for (var j = i; j < end; ++j) types[j] = replace;
[8907] Fix | Delete
i = end - 1;
[8908] Fix | Delete
}
[8909] Fix | Delete
}
[8910] Fix | Delete
[8911] Fix | Delete
// Here we depart from the documented algorithm, in order to avoid
[8912] Fix | Delete
// building up an actual levels array. Since there are only three
[8913] Fix | Delete
// levels (0, 1, 2) in an implementation that doesn't take
[8914] Fix | Delete
// explicit embedding into account, we can build up the order on
[8915] Fix | Delete
// the fly, without following the level-based algorithm.
[8916] Fix | Delete
var order = [], m;
[8917] Fix | Delete
for (var i = 0; i < len;) {
[8918] Fix | Delete
if (countsAsLeft.test(types[i])) {
[8919] Fix | Delete
var start = i;
[8920] Fix | Delete
for (++i; i < len && countsAsLeft.test(types[i]); ++i) {}
[8921] Fix | Delete
order.push(new BidiSpan(0, start, i));
[8922] Fix | Delete
} else {
[8923] Fix | Delete
var pos = i, at = order.length;
[8924] Fix | Delete
for (++i; i < len && types[i] != "L"; ++i) {}
[8925] Fix | Delete
for (var j = pos; j < i;) {
[8926] Fix | Delete
if (countsAsNum.test(types[j])) {
[8927] Fix | Delete
if (pos < j) order.splice(at, 0, new BidiSpan(1, pos, j));
[8928] Fix | Delete
var nstart = j;
[8929] Fix | Delete
for (++j; j < i && countsAsNum.test(types[j]); ++j) {}
[8930] Fix | Delete
order.splice(at, 0, new BidiSpan(2, nstart, j));
[8931] Fix | Delete
pos = j;
[8932] Fix | Delete
} else ++j;
[8933] Fix | Delete
}
[8934] Fix | Delete
if (pos < i) order.splice(at, 0, new BidiSpan(1, pos, i));
[8935] Fix | Delete
}
[8936] Fix | Delete
}
[8937] Fix | Delete
if (order[0].level == 1 && (m = str.match(/^\s+/))) {
[8938] Fix | Delete
order[0].from = m[0].length;
[8939] Fix | Delete
order.unshift(new BidiSpan(0, 0, m[0].length));
[8940] Fix | Delete
}
[8941] Fix | Delete
if (lst(order).level == 1 && (m = str.match(/\s+$/))) {
[8942] Fix | Delete
lst(order).to -= m[0].length;
[8943] Fix | Delete
order.push(new BidiSpan(0, len - m[0].length, len));
[8944] Fix | Delete
}
[8945] Fix | Delete
if (order[0].level == 2)
[8946] Fix | Delete
order.unshift(new BidiSpan(1, order[0].to, order[0].to));
[8947] Fix | Delete
if (order[0].level != lst(order).level)
[8948] Fix | Delete
order.push(new BidiSpan(order[0].level, len, len));
[8949] Fix | Delete
[8950] Fix | Delete
return order;
[8951] Fix | Delete
};
[8952] Fix | Delete
})();
[8953] Fix | Delete
[8954] Fix | Delete
// THE END
[8955] Fix | Delete
[8956] Fix | Delete
CodeMirror.version = "5.18.2";
[8957] Fix | Delete
[8958] Fix | Delete
return CodeMirror;
[8959] Fix | Delete
});
[8960] Fix | Delete
[8961] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function