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
cur.changes.push(historyChangeFromChange(doc, change));
[8000] Fix | Delete
}
[8001] Fix | Delete
} else {
[8002] Fix | Delete
// Can not be merged, start a new event.
[8003] Fix | Delete
var before = lst(hist.done);
[8004] Fix | Delete
if (!before || !before.ranges)
[8005] Fix | Delete
pushSelectionToHistory(doc.sel, hist.done);
[8006] Fix | Delete
cur = {changes: [historyChangeFromChange(doc, change)],
[8007] Fix | Delete
generation: hist.generation};
[8008] Fix | Delete
hist.done.push(cur);
[8009] Fix | Delete
while (hist.done.length > hist.undoDepth) {
[8010] Fix | Delete
hist.done.shift();
[8011] Fix | Delete
if (!hist.done[0].ranges) hist.done.shift();
[8012] Fix | Delete
}
[8013] Fix | Delete
}
[8014] Fix | Delete
hist.done.push(selAfter);
[8015] Fix | Delete
hist.generation = ++hist.maxGeneration;
[8016] Fix | Delete
hist.lastModTime = hist.lastSelTime = time;
[8017] Fix | Delete
hist.lastOp = hist.lastSelOp = opId;
[8018] Fix | Delete
hist.lastOrigin = hist.lastSelOrigin = change.origin;
[8019] Fix | Delete
[8020] Fix | Delete
if (!last) signal(doc, "historyAdded");
[8021] Fix | Delete
}
[8022] Fix | Delete
[8023] Fix | Delete
function selectionEventCanBeMerged(doc, origin, prev, sel) {
[8024] Fix | Delete
var ch = origin.charAt(0);
[8025] Fix | Delete
return ch == "*" ||
[8026] Fix | Delete
ch == "+" &&
[8027] Fix | Delete
prev.ranges.length == sel.ranges.length &&
[8028] Fix | Delete
prev.somethingSelected() == sel.somethingSelected() &&
[8029] Fix | Delete
new Date - doc.history.lastSelTime <= (doc.cm ? doc.cm.options.historyEventDelay : 500);
[8030] Fix | Delete
}
[8031] Fix | Delete
[8032] Fix | Delete
// Called whenever the selection changes, sets the new selection as
[8033] Fix | Delete
// the pending selection in the history, and pushes the old pending
[8034] Fix | Delete
// selection into the 'done' array when it was significantly
[8035] Fix | Delete
// different (in number of selected ranges, emptiness, or time).
[8036] Fix | Delete
function addSelectionToHistory(doc, sel, opId, options) {
[8037] Fix | Delete
var hist = doc.history, origin = options && options.origin;
[8038] Fix | Delete
[8039] Fix | Delete
// A new event is started when the previous origin does not match
[8040] Fix | Delete
// the current, or the origins don't allow matching. Origins
[8041] Fix | Delete
// starting with * are always merged, those starting with + are
[8042] Fix | Delete
// merged when similar and close together in time.
[8043] Fix | Delete
if (opId == hist.lastSelOp ||
[8044] Fix | Delete
(origin && hist.lastSelOrigin == origin &&
[8045] Fix | Delete
(hist.lastModTime == hist.lastSelTime && hist.lastOrigin == origin ||
[8046] Fix | Delete
selectionEventCanBeMerged(doc, origin, lst(hist.done), sel))))
[8047] Fix | Delete
hist.done[hist.done.length - 1] = sel;
[8048] Fix | Delete
else
[8049] Fix | Delete
pushSelectionToHistory(sel, hist.done);
[8050] Fix | Delete
[8051] Fix | Delete
hist.lastSelTime = +new Date;
[8052] Fix | Delete
hist.lastSelOrigin = origin;
[8053] Fix | Delete
hist.lastSelOp = opId;
[8054] Fix | Delete
if (options && options.clearRedo !== false)
[8055] Fix | Delete
clearSelectionEvents(hist.undone);
[8056] Fix | Delete
}
[8057] Fix | Delete
[8058] Fix | Delete
function pushSelectionToHistory(sel, dest) {
[8059] Fix | Delete
var top = lst(dest);
[8060] Fix | Delete
if (!(top && top.ranges && top.equals(sel)))
[8061] Fix | Delete
dest.push(sel);
[8062] Fix | Delete
}
[8063] Fix | Delete
[8064] Fix | Delete
// Used to store marked span information in the history.
[8065] Fix | Delete
function attachLocalSpans(doc, change, from, to) {
[8066] Fix | Delete
var existing = change["spans_" + doc.id], n = 0;
[8067] Fix | Delete
doc.iter(Math.max(doc.first, from), Math.min(doc.first + doc.size, to), function(line) {
[8068] Fix | Delete
if (line.markedSpans)
[8069] Fix | Delete
(existing || (existing = change["spans_" + doc.id] = {}))[n] = line.markedSpans;
[8070] Fix | Delete
++n;
[8071] Fix | Delete
});
[8072] Fix | Delete
}
[8073] Fix | Delete
[8074] Fix | Delete
// When un/re-doing restores text containing marked spans, those
[8075] Fix | Delete
// that have been explicitly cleared should not be restored.
[8076] Fix | Delete
function removeClearedSpans(spans) {
[8077] Fix | Delete
if (!spans) return null;
[8078] Fix | Delete
for (var i = 0, out; i < spans.length; ++i) {
[8079] Fix | Delete
if (spans[i].marker.explicitlyCleared) { if (!out) out = spans.slice(0, i); }
[8080] Fix | Delete
else if (out) out.push(spans[i]);
[8081] Fix | Delete
}
[8082] Fix | Delete
return !out ? spans : out.length ? out : null;
[8083] Fix | Delete
}
[8084] Fix | Delete
[8085] Fix | Delete
// Retrieve and filter the old marked spans stored in a change event.
[8086] Fix | Delete
function getOldSpans(doc, change) {
[8087] Fix | Delete
var found = change["spans_" + doc.id];
[8088] Fix | Delete
if (!found) return null;
[8089] Fix | Delete
for (var i = 0, nw = []; i < change.text.length; ++i)
[8090] Fix | Delete
nw.push(removeClearedSpans(found[i]));
[8091] Fix | Delete
return nw;
[8092] Fix | Delete
}
[8093] Fix | Delete
[8094] Fix | Delete
// Used both to provide a JSON-safe object in .getHistory, and, when
[8095] Fix | Delete
// detaching a document, to split the history in two
[8096] Fix | Delete
function copyHistoryArray(events, newGroup, instantiateSel) {
[8097] Fix | Delete
for (var i = 0, copy = []; i < events.length; ++i) {
[8098] Fix | Delete
var event = events[i];
[8099] Fix | Delete
if (event.ranges) {
[8100] Fix | Delete
copy.push(instantiateSel ? Selection.prototype.deepCopy.call(event) : event);
[8101] Fix | Delete
continue;
[8102] Fix | Delete
}
[8103] Fix | Delete
var changes = event.changes, newChanges = [];
[8104] Fix | Delete
copy.push({changes: newChanges});
[8105] Fix | Delete
for (var j = 0; j < changes.length; ++j) {
[8106] Fix | Delete
var change = changes[j], m;
[8107] Fix | Delete
newChanges.push({from: change.from, to: change.to, text: change.text});
[8108] Fix | Delete
if (newGroup) for (var prop in change) if (m = prop.match(/^spans_(\d+)$/)) {
[8109] Fix | Delete
if (indexOf(newGroup, Number(m[1])) > -1) {
[8110] Fix | Delete
lst(newChanges)[prop] = change[prop];
[8111] Fix | Delete
delete change[prop];
[8112] Fix | Delete
}
[8113] Fix | Delete
}
[8114] Fix | Delete
}
[8115] Fix | Delete
}
[8116] Fix | Delete
return copy;
[8117] Fix | Delete
}
[8118] Fix | Delete
[8119] Fix | Delete
// Rebasing/resetting history to deal with externally-sourced changes
[8120] Fix | Delete
[8121] Fix | Delete
function rebaseHistSelSingle(pos, from, to, diff) {
[8122] Fix | Delete
if (to < pos.line) {
[8123] Fix | Delete
pos.line += diff;
[8124] Fix | Delete
} else if (from < pos.line) {
[8125] Fix | Delete
pos.line = from;
[8126] Fix | Delete
pos.ch = 0;
[8127] Fix | Delete
}
[8128] Fix | Delete
}
[8129] Fix | Delete
[8130] Fix | Delete
// Tries to rebase an array of history events given a change in the
[8131] Fix | Delete
// document. If the change touches the same lines as the event, the
[8132] Fix | Delete
// event, and everything 'behind' it, is discarded. If the change is
[8133] Fix | Delete
// before the event, the event's positions are updated. Uses a
[8134] Fix | Delete
// copy-on-write scheme for the positions, to avoid having to
[8135] Fix | Delete
// reallocate them all on every rebase, but also avoid problems with
[8136] Fix | Delete
// shared position objects being unsafely updated.
[8137] Fix | Delete
function rebaseHistArray(array, from, to, diff) {
[8138] Fix | Delete
for (var i = 0; i < array.length; ++i) {
[8139] Fix | Delete
var sub = array[i], ok = true;
[8140] Fix | Delete
if (sub.ranges) {
[8141] Fix | Delete
if (!sub.copied) { sub = array[i] = sub.deepCopy(); sub.copied = true; }
[8142] Fix | Delete
for (var j = 0; j < sub.ranges.length; j++) {
[8143] Fix | Delete
rebaseHistSelSingle(sub.ranges[j].anchor, from, to, diff);
[8144] Fix | Delete
rebaseHistSelSingle(sub.ranges[j].head, from, to, diff);
[8145] Fix | Delete
}
[8146] Fix | Delete
continue;
[8147] Fix | Delete
}
[8148] Fix | Delete
for (var j = 0; j < sub.changes.length; ++j) {
[8149] Fix | Delete
var cur = sub.changes[j];
[8150] Fix | Delete
if (to < cur.from.line) {
[8151] Fix | Delete
cur.from = Pos(cur.from.line + diff, cur.from.ch);
[8152] Fix | Delete
cur.to = Pos(cur.to.line + diff, cur.to.ch);
[8153] Fix | Delete
} else if (from <= cur.to.line) {
[8154] Fix | Delete
ok = false;
[8155] Fix | Delete
break;
[8156] Fix | Delete
}
[8157] Fix | Delete
}
[8158] Fix | Delete
if (!ok) {
[8159] Fix | Delete
array.splice(0, i + 1);
[8160] Fix | Delete
i = 0;
[8161] Fix | Delete
}
[8162] Fix | Delete
}
[8163] Fix | Delete
}
[8164] Fix | Delete
[8165] Fix | Delete
function rebaseHist(hist, change) {
[8166] Fix | Delete
var from = change.from.line, to = change.to.line, diff = change.text.length - (to - from) - 1;
[8167] Fix | Delete
rebaseHistArray(hist.done, from, to, diff);
[8168] Fix | Delete
rebaseHistArray(hist.undone, from, to, diff);
[8169] Fix | Delete
}
[8170] Fix | Delete
[8171] Fix | Delete
// EVENT UTILITIES
[8172] Fix | Delete
[8173] Fix | Delete
// Due to the fact that we still support jurassic IE versions, some
[8174] Fix | Delete
// compatibility wrappers are needed.
[8175] Fix | Delete
[8176] Fix | Delete
var e_preventDefault = CodeMirror.e_preventDefault = function(e) {
[8177] Fix | Delete
if (e.preventDefault) e.preventDefault();
[8178] Fix | Delete
else e.returnValue = false;
[8179] Fix | Delete
};
[8180] Fix | Delete
var e_stopPropagation = CodeMirror.e_stopPropagation = function(e) {
[8181] Fix | Delete
if (e.stopPropagation) e.stopPropagation();
[8182] Fix | Delete
else e.cancelBubble = true;
[8183] Fix | Delete
};
[8184] Fix | Delete
function e_defaultPrevented(e) {
[8185] Fix | Delete
return e.defaultPrevented != null ? e.defaultPrevented : e.returnValue == false;
[8186] Fix | Delete
}
[8187] Fix | Delete
var e_stop = CodeMirror.e_stop = function(e) {e_preventDefault(e); e_stopPropagation(e);};
[8188] Fix | Delete
[8189] Fix | Delete
function e_target(e) {return e.target || e.srcElement;}
[8190] Fix | Delete
function e_button(e) {
[8191] Fix | Delete
var b = e.which;
[8192] Fix | Delete
if (b == null) {
[8193] Fix | Delete
if (e.button & 1) b = 1;
[8194] Fix | Delete
else if (e.button & 2) b = 3;
[8195] Fix | Delete
else if (e.button & 4) b = 2;
[8196] Fix | Delete
}
[8197] Fix | Delete
if (mac && e.ctrlKey && b == 1) b = 3;
[8198] Fix | Delete
return b;
[8199] Fix | Delete
}
[8200] Fix | Delete
[8201] Fix | Delete
// EVENT HANDLING
[8202] Fix | Delete
[8203] Fix | Delete
// Lightweight event framework. on/off also work on DOM nodes,
[8204] Fix | Delete
// registering native DOM handlers.
[8205] Fix | Delete
[8206] Fix | Delete
var on = CodeMirror.on = function(emitter, type, f) {
[8207] Fix | Delete
if (emitter.addEventListener)
[8208] Fix | Delete
emitter.addEventListener(type, f, false);
[8209] Fix | Delete
else if (emitter.attachEvent)
[8210] Fix | Delete
emitter.attachEvent("on" + type, f);
[8211] Fix | Delete
else {
[8212] Fix | Delete
var map = emitter._handlers || (emitter._handlers = {});
[8213] Fix | Delete
var arr = map[type] || (map[type] = []);
[8214] Fix | Delete
arr.push(f);
[8215] Fix | Delete
}
[8216] Fix | Delete
};
[8217] Fix | Delete
[8218] Fix | Delete
var noHandlers = []
[8219] Fix | Delete
function getHandlers(emitter, type, copy) {
[8220] Fix | Delete
var arr = emitter._handlers && emitter._handlers[type]
[8221] Fix | Delete
if (copy) return arr && arr.length > 0 ? arr.slice() : noHandlers
[8222] Fix | Delete
else return arr || noHandlers
[8223] Fix | Delete
}
[8224] Fix | Delete
[8225] Fix | Delete
var off = CodeMirror.off = function(emitter, type, f) {
[8226] Fix | Delete
if (emitter.removeEventListener)
[8227] Fix | Delete
emitter.removeEventListener(type, f, false);
[8228] Fix | Delete
else if (emitter.detachEvent)
[8229] Fix | Delete
emitter.detachEvent("on" + type, f);
[8230] Fix | Delete
else {
[8231] Fix | Delete
var handlers = getHandlers(emitter, type, false)
[8232] Fix | Delete
for (var i = 0; i < handlers.length; ++i)
[8233] Fix | Delete
if (handlers[i] == f) { handlers.splice(i, 1); break; }
[8234] Fix | Delete
}
[8235] Fix | Delete
};
[8236] Fix | Delete
[8237] Fix | Delete
var signal = CodeMirror.signal = function(emitter, type /*, values...*/) {
[8238] Fix | Delete
var handlers = getHandlers(emitter, type, true)
[8239] Fix | Delete
if (!handlers.length) return;
[8240] Fix | Delete
var args = Array.prototype.slice.call(arguments, 2);
[8241] Fix | Delete
for (var i = 0; i < handlers.length; ++i) handlers[i].apply(null, args);
[8242] Fix | Delete
};
[8243] Fix | Delete
[8244] Fix | Delete
var orphanDelayedCallbacks = null;
[8245] Fix | Delete
[8246] Fix | Delete
// Often, we want to signal events at a point where we are in the
[8247] Fix | Delete
// middle of some work, but don't want the handler to start calling
[8248] Fix | Delete
// other methods on the editor, which might be in an inconsistent
[8249] Fix | Delete
// state or simply not expect any other events to happen.
[8250] Fix | Delete
// signalLater looks whether there are any handlers, and schedules
[8251] Fix | Delete
// them to be executed when the last operation ends, or, if no
[8252] Fix | Delete
// operation is active, when a timeout fires.
[8253] Fix | Delete
function signalLater(emitter, type /*, values...*/) {
[8254] Fix | Delete
var arr = getHandlers(emitter, type, false)
[8255] Fix | Delete
if (!arr.length) return;
[8256] Fix | Delete
var args = Array.prototype.slice.call(arguments, 2), list;
[8257] Fix | Delete
if (operationGroup) {
[8258] Fix | Delete
list = operationGroup.delayedCallbacks;
[8259] Fix | Delete
} else if (orphanDelayedCallbacks) {
[8260] Fix | Delete
list = orphanDelayedCallbacks;
[8261] Fix | Delete
} else {
[8262] Fix | Delete
list = orphanDelayedCallbacks = [];
[8263] Fix | Delete
setTimeout(fireOrphanDelayed, 0);
[8264] Fix | Delete
}
[8265] Fix | Delete
function bnd(f) {return function(){f.apply(null, args);};};
[8266] Fix | Delete
for (var i = 0; i < arr.length; ++i)
[8267] Fix | Delete
list.push(bnd(arr[i]));
[8268] Fix | Delete
}
[8269] Fix | Delete
[8270] Fix | Delete
function fireOrphanDelayed() {
[8271] Fix | Delete
var delayed = orphanDelayedCallbacks;
[8272] Fix | Delete
orphanDelayedCallbacks = null;
[8273] Fix | Delete
for (var i = 0; i < delayed.length; ++i) delayed[i]();
[8274] Fix | Delete
}
[8275] Fix | Delete
[8276] Fix | Delete
// The DOM events that CodeMirror handles can be overridden by
[8277] Fix | Delete
// registering a (non-DOM) handler on the editor for the event name,
[8278] Fix | Delete
// and preventDefault-ing the event in that handler.
[8279] Fix | Delete
function signalDOMEvent(cm, e, override) {
[8280] Fix | Delete
if (typeof e == "string")
[8281] Fix | Delete
e = {type: e, preventDefault: function() { this.defaultPrevented = true; }};
[8282] Fix | Delete
signal(cm, override || e.type, cm, e);
[8283] Fix | Delete
return e_defaultPrevented(e) || e.codemirrorIgnore;
[8284] Fix | Delete
}
[8285] Fix | Delete
[8286] Fix | Delete
function signalCursorActivity(cm) {
[8287] Fix | Delete
var arr = cm._handlers && cm._handlers.cursorActivity;
[8288] Fix | Delete
if (!arr) return;
[8289] Fix | Delete
var set = cm.curOp.cursorActivityHandlers || (cm.curOp.cursorActivityHandlers = []);
[8290] Fix | Delete
for (var i = 0; i < arr.length; ++i) if (indexOf(set, arr[i]) == -1)
[8291] Fix | Delete
set.push(arr[i]);
[8292] Fix | Delete
}
[8293] Fix | Delete
[8294] Fix | Delete
function hasHandler(emitter, type) {
[8295] Fix | Delete
return getHandlers(emitter, type).length > 0
[8296] Fix | Delete
}
[8297] Fix | Delete
[8298] Fix | Delete
// Add on and off methods to a constructor's prototype, to make
[8299] Fix | Delete
// registering events on such objects more convenient.
[8300] Fix | Delete
function eventMixin(ctor) {
[8301] Fix | Delete
ctor.prototype.on = function(type, f) {on(this, type, f);};
[8302] Fix | Delete
ctor.prototype.off = function(type, f) {off(this, type, f);};
[8303] Fix | Delete
}
[8304] Fix | Delete
[8305] Fix | Delete
// MISC UTILITIES
[8306] Fix | Delete
[8307] Fix | Delete
// Number of pixels added to scroller and sizer to hide scrollbar
[8308] Fix | Delete
var scrollerGap = 30;
[8309] Fix | Delete
[8310] Fix | Delete
// Returned or thrown by various protocols to signal 'I'm not
[8311] Fix | Delete
// handling this'.
[8312] Fix | Delete
var Pass = CodeMirror.Pass = {toString: function(){return "CodeMirror.Pass";}};
[8313] Fix | Delete
[8314] Fix | Delete
// Reused option objects for setSelection & friends
[8315] Fix | Delete
var sel_dontScroll = {scroll: false}, sel_mouse = {origin: "*mouse"}, sel_move = {origin: "+move"};
[8316] Fix | Delete
[8317] Fix | Delete
function Delayed() {this.id = null;}
[8318] Fix | Delete
Delayed.prototype.set = function(ms, f) {
[8319] Fix | Delete
clearTimeout(this.id);
[8320] Fix | Delete
this.id = setTimeout(f, ms);
[8321] Fix | Delete
};
[8322] Fix | Delete
[8323] Fix | Delete
// Counts the column offset in a string, taking tabs into account.
[8324] Fix | Delete
// Used mostly to find indentation.
[8325] Fix | Delete
var countColumn = CodeMirror.countColumn = function(string, end, tabSize, startIndex, startValue) {
[8326] Fix | Delete
if (end == null) {
[8327] Fix | Delete
end = string.search(/[^\s\u00a0]/);
[8328] Fix | Delete
if (end == -1) end = string.length;
[8329] Fix | Delete
}
[8330] Fix | Delete
for (var i = startIndex || 0, n = startValue || 0;;) {
[8331] Fix | Delete
var nextTab = string.indexOf("\t", i);
[8332] Fix | Delete
if (nextTab < 0 || nextTab >= end)
[8333] Fix | Delete
return n + (end - i);
[8334] Fix | Delete
n += nextTab - i;
[8335] Fix | Delete
n += tabSize - (n % tabSize);
[8336] Fix | Delete
i = nextTab + 1;
[8337] Fix | Delete
}
[8338] Fix | Delete
};
[8339] Fix | Delete
[8340] Fix | Delete
// The inverse of countColumn -- find the offset that corresponds to
[8341] Fix | Delete
// a particular column.
[8342] Fix | Delete
var findColumn = CodeMirror.findColumn = function(string, goal, tabSize) {
[8343] Fix | Delete
for (var pos = 0, col = 0;;) {
[8344] Fix | Delete
var nextTab = string.indexOf("\t", pos);
[8345] Fix | Delete
if (nextTab == -1) nextTab = string.length;
[8346] Fix | Delete
var skipped = nextTab - pos;
[8347] Fix | Delete
if (nextTab == string.length || col + skipped >= goal)
[8348] Fix | Delete
return pos + Math.min(skipped, goal - col);
[8349] Fix | Delete
col += nextTab - pos;
[8350] Fix | Delete
col += tabSize - (col % tabSize);
[8351] Fix | Delete
pos = nextTab + 1;
[8352] Fix | Delete
if (col >= goal) return pos;
[8353] Fix | Delete
}
[8354] Fix | Delete
}
[8355] Fix | Delete
[8356] Fix | Delete
var spaceStrs = [""];
[8357] Fix | Delete
function spaceStr(n) {
[8358] Fix | Delete
while (spaceStrs.length <= n)
[8359] Fix | Delete
spaceStrs.push(lst(spaceStrs) + " ");
[8360] Fix | Delete
return spaceStrs[n];
[8361] Fix | Delete
}
[8362] Fix | Delete
[8363] Fix | Delete
function lst(arr) { return arr[arr.length-1]; }
[8364] Fix | Delete
[8365] Fix | Delete
var selectInput = function(node) { node.select(); };
[8366] Fix | Delete
if (ios) // Mobile Safari apparently has a bug where select() is broken.
[8367] Fix | Delete
selectInput = function(node) { node.selectionStart = 0; node.selectionEnd = node.value.length; };
[8368] Fix | Delete
else if (ie) // Suppress mysterious IE10 errors
[8369] Fix | Delete
selectInput = function(node) { try { node.select(); } catch(_e) {} };
[8370] Fix | Delete
[8371] Fix | Delete
function indexOf(array, elt) {
[8372] Fix | Delete
for (var i = 0; i < array.length; ++i)
[8373] Fix | Delete
if (array[i] == elt) return i;
[8374] Fix | Delete
return -1;
[8375] Fix | Delete
}
[8376] Fix | Delete
function map(array, f) {
[8377] Fix | Delete
var out = [];
[8378] Fix | Delete
for (var i = 0; i < array.length; i++) out[i] = f(array[i], i);
[8379] Fix | Delete
return out;
[8380] Fix | Delete
}
[8381] Fix | Delete
[8382] Fix | Delete
function insertSorted(array, value, score) {
[8383] Fix | Delete
var pos = 0, priority = score(value)
[8384] Fix | Delete
while (pos < array.length && score(array[pos]) <= priority) pos++
[8385] Fix | Delete
array.splice(pos, 0, value)
[8386] Fix | Delete
}
[8387] Fix | Delete
[8388] Fix | Delete
function nothing() {}
[8389] Fix | Delete
[8390] Fix | Delete
function createObj(base, props) {
[8391] Fix | Delete
var inst;
[8392] Fix | Delete
if (Object.create) {
[8393] Fix | Delete
inst = Object.create(base);
[8394] Fix | Delete
} else {
[8395] Fix | Delete
nothing.prototype = base;
[8396] Fix | Delete
inst = new nothing();
[8397] Fix | Delete
}
[8398] Fix | Delete
if (props) copyObj(props, inst);
[8399] Fix | Delete
return inst;
[8400] Fix | Delete
};
[8401] Fix | Delete
[8402] Fix | Delete
function copyObj(obj, target, overwrite) {
[8403] Fix | Delete
if (!target) target = {};
[8404] Fix | Delete
for (var prop in obj)
[8405] Fix | Delete
if (obj.hasOwnProperty(prop) && (overwrite !== false || !target.hasOwnProperty(prop)))
[8406] Fix | Delete
target[prop] = obj[prop];
[8407] Fix | Delete
return target;
[8408] Fix | Delete
}
[8409] Fix | Delete
[8410] Fix | Delete
function bind(f) {
[8411] Fix | Delete
var args = Array.prototype.slice.call(arguments, 1);
[8412] Fix | Delete
return function(){return f.apply(null, args);};
[8413] Fix | Delete
}
[8414] Fix | Delete
[8415] Fix | Delete
var nonASCIISingleCaseWordChar = /[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;
[8416] Fix | Delete
var isWordCharBasic = CodeMirror.isWordChar = function(ch) {
[8417] Fix | Delete
return /\w/.test(ch) || ch > "\x80" &&
[8418] Fix | Delete
(ch.toUpperCase() != ch.toLowerCase() || nonASCIISingleCaseWordChar.test(ch));
[8419] Fix | Delete
};
[8420] Fix | Delete
function isWordChar(ch, helper) {
[8421] Fix | Delete
if (!helper) return isWordCharBasic(ch);
[8422] Fix | Delete
if (helper.source.indexOf("\\w") > -1 && isWordCharBasic(ch)) return true;
[8423] Fix | Delete
return helper.test(ch);
[8424] Fix | Delete
}
[8425] Fix | Delete
[8426] Fix | Delete
function isEmpty(obj) {
[8427] Fix | Delete
for (var n in obj) if (obj.hasOwnProperty(n) && obj[n]) return false;
[8428] Fix | Delete
return true;
[8429] Fix | Delete
}
[8430] Fix | Delete
[8431] Fix | Delete
// Extending unicode characters. A series of a non-extending char +
[8432] Fix | Delete
// any number of extending chars is treated as a single unit as far
[8433] Fix | Delete
// as editing and measuring is concerned. This is not fully correct,
[8434] Fix | Delete
// since some scripts/fonts/browsers also treat other configurations
[8435] Fix | Delete
// of code points as a group.
[8436] Fix | Delete
var extendingChars = /[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/;
[8437] Fix | Delete
function isExtendingChar(ch) { return ch.charCodeAt(0) >= 768 && extendingChars.test(ch); }
[8438] Fix | Delete
[8439] Fix | Delete
// DOM UTILITIES
[8440] Fix | Delete
[8441] Fix | Delete
function elt(tag, content, className, style) {
[8442] Fix | Delete
var e = document.createElement(tag);
[8443] Fix | Delete
if (className) e.className = className;
[8444] Fix | Delete
if (style) e.style.cssText = style;
[8445] Fix | Delete
if (typeof content == "string") e.appendChild(document.createTextNode(content));
[8446] Fix | Delete
else if (content) for (var i = 0; i < content.length; ++i) e.appendChild(content[i]);
[8447] Fix | Delete
return e;
[8448] Fix | Delete
}
[8449] Fix | Delete
[8450] Fix | Delete
var range;
[8451] Fix | Delete
if (document.createRange) range = function(node, start, end, endNode) {
[8452] Fix | Delete
var r = document.createRange();
[8453] Fix | Delete
r.setEnd(endNode || node, end);
[8454] Fix | Delete
r.setStart(node, start);
[8455] Fix | Delete
return r;
[8456] Fix | Delete
};
[8457] Fix | Delete
else range = function(node, start, end) {
[8458] Fix | Delete
var r = document.body.createTextRange();
[8459] Fix | Delete
try { r.moveToElementText(node.parentNode); }
[8460] Fix | Delete
catch(e) { return r; }
[8461] Fix | Delete
r.collapse(true);
[8462] Fix | Delete
r.moveEnd("character", end);
[8463] Fix | Delete
r.moveStart("character", start);
[8464] Fix | Delete
return r;
[8465] Fix | Delete
};
[8466] Fix | Delete
[8467] Fix | Delete
function removeChildren(e) {
[8468] Fix | Delete
for (var count = e.childNodes.length; count > 0; --count)
[8469] Fix | Delete
e.removeChild(e.firstChild);
[8470] Fix | Delete
return e;
[8471] Fix | Delete
}
[8472] Fix | Delete
[8473] Fix | Delete
function removeChildrenAndAdd(parent, e) {
[8474] Fix | Delete
return removeChildren(parent).appendChild(e);
[8475] Fix | Delete
}
[8476] Fix | Delete
[8477] Fix | Delete
var contains = CodeMirror.contains = function(parent, child) {
[8478] Fix | Delete
if (child.nodeType == 3) // Android browser always returns false when child is a textnode
[8479] Fix | Delete
child = child.parentNode;
[8480] Fix | Delete
if (parent.contains)
[8481] Fix | Delete
return parent.contains(child);
[8482] Fix | Delete
do {
[8483] Fix | Delete
if (child.nodeType == 11) child = child.host;
[8484] Fix | Delete
if (child == parent) return true;
[8485] Fix | Delete
} while (child = child.parentNode);
[8486] Fix | Delete
};
[8487] Fix | Delete
[8488] Fix | Delete
function activeElt() {
[8489] Fix | Delete
var activeElement = document.activeElement;
[8490] Fix | Delete
while (activeElement && activeElement.root && activeElement.root.activeElement)
[8491] Fix | Delete
activeElement = activeElement.root.activeElement;
[8492] Fix | Delete
return activeElement;
[8493] Fix | Delete
}
[8494] Fix | Delete
// Older versions of IE throws unspecified error when touching
[8495] Fix | Delete
// document.activeElement in some cases (during loading, in iframe)
[8496] Fix | Delete
if (ie && ie_version < 11) activeElt = function() {
[8497] Fix | Delete
try { return document.activeElement; }
[8498] Fix | Delete
catch(e) { return document.body; }
[8499] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function