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/clone/wp-inclu.../js/dist
File: blocks.js
[1000] Fix | Delete
if (!showdown.helper.isString(name)) {
[1001] Fix | Delete
throw Error('Extension \'name\' must be a string');
[1002] Fix | Delete
}
[1003] Fix | Delete
[1004] Fix | Delete
name = showdown.helper.stdExtName(name);
[1005] Fix | Delete
[1006] Fix | Delete
// Getter
[1007] Fix | Delete
if (showdown.helper.isUndefined(ext)) {
[1008] Fix | Delete
if (!extensions.hasOwnProperty(name)) {
[1009] Fix | Delete
throw Error('Extension named ' + name + ' is not registered!');
[1010] Fix | Delete
}
[1011] Fix | Delete
return extensions[name];
[1012] Fix | Delete
[1013] Fix | Delete
// Setter
[1014] Fix | Delete
} else {
[1015] Fix | Delete
// Expand extension if it's wrapped in a function
[1016] Fix | Delete
if (typeof ext === 'function') {
[1017] Fix | Delete
ext = ext();
[1018] Fix | Delete
}
[1019] Fix | Delete
[1020] Fix | Delete
// Ensure extension is an array
[1021] Fix | Delete
if (!showdown.helper.isArray(ext)) {
[1022] Fix | Delete
ext = [ext];
[1023] Fix | Delete
}
[1024] Fix | Delete
[1025] Fix | Delete
var validExtension = validate(ext, name);
[1026] Fix | Delete
[1027] Fix | Delete
if (validExtension.valid) {
[1028] Fix | Delete
extensions[name] = ext;
[1029] Fix | Delete
} else {
[1030] Fix | Delete
throw Error(validExtension.error);
[1031] Fix | Delete
}
[1032] Fix | Delete
}
[1033] Fix | Delete
};
[1034] Fix | Delete
[1035] Fix | Delete
/**
[1036] Fix | Delete
* Gets all extensions registered
[1037] Fix | Delete
* @returns {{}}
[1038] Fix | Delete
*/
[1039] Fix | Delete
showdown.getAllExtensions = function () {
[1040] Fix | Delete
'use strict';
[1041] Fix | Delete
return extensions;
[1042] Fix | Delete
};
[1043] Fix | Delete
[1044] Fix | Delete
/**
[1045] Fix | Delete
* Remove an extension
[1046] Fix | Delete
* @param {string} name
[1047] Fix | Delete
*/
[1048] Fix | Delete
showdown.removeExtension = function (name) {
[1049] Fix | Delete
'use strict';
[1050] Fix | Delete
delete extensions[name];
[1051] Fix | Delete
};
[1052] Fix | Delete
[1053] Fix | Delete
/**
[1054] Fix | Delete
* Removes all extensions
[1055] Fix | Delete
*/
[1056] Fix | Delete
showdown.resetExtensions = function () {
[1057] Fix | Delete
'use strict';
[1058] Fix | Delete
extensions = {};
[1059] Fix | Delete
};
[1060] Fix | Delete
[1061] Fix | Delete
/**
[1062] Fix | Delete
* Validate extension
[1063] Fix | Delete
* @param {array} extension
[1064] Fix | Delete
* @param {string} name
[1065] Fix | Delete
* @returns {{valid: boolean, error: string}}
[1066] Fix | Delete
*/
[1067] Fix | Delete
function validate (extension, name) {
[1068] Fix | Delete
'use strict';
[1069] Fix | Delete
[1070] Fix | Delete
var errMsg = (name) ? 'Error in ' + name + ' extension->' : 'Error in unnamed extension',
[1071] Fix | Delete
ret = {
[1072] Fix | Delete
valid: true,
[1073] Fix | Delete
error: ''
[1074] Fix | Delete
};
[1075] Fix | Delete
[1076] Fix | Delete
if (!showdown.helper.isArray(extension)) {
[1077] Fix | Delete
extension = [extension];
[1078] Fix | Delete
}
[1079] Fix | Delete
[1080] Fix | Delete
for (var i = 0; i < extension.length; ++i) {
[1081] Fix | Delete
var baseMsg = errMsg + ' sub-extension ' + i + ': ',
[1082] Fix | Delete
ext = extension[i];
[1083] Fix | Delete
if (typeof ext !== 'object') {
[1084] Fix | Delete
ret.valid = false;
[1085] Fix | Delete
ret.error = baseMsg + 'must be an object, but ' + typeof ext + ' given';
[1086] Fix | Delete
return ret;
[1087] Fix | Delete
}
[1088] Fix | Delete
[1089] Fix | Delete
if (!showdown.helper.isString(ext.type)) {
[1090] Fix | Delete
ret.valid = false;
[1091] Fix | Delete
ret.error = baseMsg + 'property "type" must be a string, but ' + typeof ext.type + ' given';
[1092] Fix | Delete
return ret;
[1093] Fix | Delete
}
[1094] Fix | Delete
[1095] Fix | Delete
var type = ext.type = ext.type.toLowerCase();
[1096] Fix | Delete
[1097] Fix | Delete
// normalize extension type
[1098] Fix | Delete
if (type === 'language') {
[1099] Fix | Delete
type = ext.type = 'lang';
[1100] Fix | Delete
}
[1101] Fix | Delete
[1102] Fix | Delete
if (type === 'html') {
[1103] Fix | Delete
type = ext.type = 'output';
[1104] Fix | Delete
}
[1105] Fix | Delete
[1106] Fix | Delete
if (type !== 'lang' && type !== 'output' && type !== 'listener') {
[1107] Fix | Delete
ret.valid = false;
[1108] Fix | Delete
ret.error = baseMsg + 'type ' + type + ' is not recognized. Valid values: "lang/language", "output/html" or "listener"';
[1109] Fix | Delete
return ret;
[1110] Fix | Delete
}
[1111] Fix | Delete
[1112] Fix | Delete
if (type === 'listener') {
[1113] Fix | Delete
if (showdown.helper.isUndefined(ext.listeners)) {
[1114] Fix | Delete
ret.valid = false;
[1115] Fix | Delete
ret.error = baseMsg + '. Extensions of type "listener" must have a property called "listeners"';
[1116] Fix | Delete
return ret;
[1117] Fix | Delete
}
[1118] Fix | Delete
} else {
[1119] Fix | Delete
if (showdown.helper.isUndefined(ext.filter) && showdown.helper.isUndefined(ext.regex)) {
[1120] Fix | Delete
ret.valid = false;
[1121] Fix | Delete
ret.error = baseMsg + type + ' extensions must define either a "regex" property or a "filter" method';
[1122] Fix | Delete
return ret;
[1123] Fix | Delete
}
[1124] Fix | Delete
}
[1125] Fix | Delete
[1126] Fix | Delete
if (ext.listeners) {
[1127] Fix | Delete
if (typeof ext.listeners !== 'object') {
[1128] Fix | Delete
ret.valid = false;
[1129] Fix | Delete
ret.error = baseMsg + '"listeners" property must be an object but ' + typeof ext.listeners + ' given';
[1130] Fix | Delete
return ret;
[1131] Fix | Delete
}
[1132] Fix | Delete
for (var ln in ext.listeners) {
[1133] Fix | Delete
if (ext.listeners.hasOwnProperty(ln)) {
[1134] Fix | Delete
if (typeof ext.listeners[ln] !== 'function') {
[1135] Fix | Delete
ret.valid = false;
[1136] Fix | Delete
ret.error = baseMsg + '"listeners" property must be an hash of [event name]: [callback]. listeners.' + ln +
[1137] Fix | Delete
' must be a function but ' + typeof ext.listeners[ln] + ' given';
[1138] Fix | Delete
return ret;
[1139] Fix | Delete
}
[1140] Fix | Delete
}
[1141] Fix | Delete
}
[1142] Fix | Delete
}
[1143] Fix | Delete
[1144] Fix | Delete
if (ext.filter) {
[1145] Fix | Delete
if (typeof ext.filter !== 'function') {
[1146] Fix | Delete
ret.valid = false;
[1147] Fix | Delete
ret.error = baseMsg + '"filter" must be a function, but ' + typeof ext.filter + ' given';
[1148] Fix | Delete
return ret;
[1149] Fix | Delete
}
[1150] Fix | Delete
} else if (ext.regex) {
[1151] Fix | Delete
if (showdown.helper.isString(ext.regex)) {
[1152] Fix | Delete
ext.regex = new RegExp(ext.regex, 'g');
[1153] Fix | Delete
}
[1154] Fix | Delete
if (!(ext.regex instanceof RegExp)) {
[1155] Fix | Delete
ret.valid = false;
[1156] Fix | Delete
ret.error = baseMsg + '"regex" property must either be a string or a RegExp object, but ' + typeof ext.regex + ' given';
[1157] Fix | Delete
return ret;
[1158] Fix | Delete
}
[1159] Fix | Delete
if (showdown.helper.isUndefined(ext.replace)) {
[1160] Fix | Delete
ret.valid = false;
[1161] Fix | Delete
ret.error = baseMsg + '"regex" extensions must implement a replace string or function';
[1162] Fix | Delete
return ret;
[1163] Fix | Delete
}
[1164] Fix | Delete
}
[1165] Fix | Delete
}
[1166] Fix | Delete
return ret;
[1167] Fix | Delete
}
[1168] Fix | Delete
[1169] Fix | Delete
/**
[1170] Fix | Delete
* Validate extension
[1171] Fix | Delete
* @param {object} ext
[1172] Fix | Delete
* @returns {boolean}
[1173] Fix | Delete
*/
[1174] Fix | Delete
showdown.validateExtension = function (ext) {
[1175] Fix | Delete
'use strict';
[1176] Fix | Delete
[1177] Fix | Delete
var validateExtension = validate(ext, null);
[1178] Fix | Delete
if (!validateExtension.valid) {
[1179] Fix | Delete
console.warn(validateExtension.error);
[1180] Fix | Delete
return false;
[1181] Fix | Delete
}
[1182] Fix | Delete
return true;
[1183] Fix | Delete
};
[1184] Fix | Delete
[1185] Fix | Delete
/**
[1186] Fix | Delete
* showdownjs helper functions
[1187] Fix | Delete
*/
[1188] Fix | Delete
[1189] Fix | Delete
if (!showdown.hasOwnProperty('helper')) {
[1190] Fix | Delete
showdown.helper = {};
[1191] Fix | Delete
}
[1192] Fix | Delete
[1193] Fix | Delete
/**
[1194] Fix | Delete
* Check if var is string
[1195] Fix | Delete
* @static
[1196] Fix | Delete
* @param {string} a
[1197] Fix | Delete
* @returns {boolean}
[1198] Fix | Delete
*/
[1199] Fix | Delete
showdown.helper.isString = function (a) {
[1200] Fix | Delete
'use strict';
[1201] Fix | Delete
return (typeof a === 'string' || a instanceof String);
[1202] Fix | Delete
};
[1203] Fix | Delete
[1204] Fix | Delete
/**
[1205] Fix | Delete
* Check if var is a function
[1206] Fix | Delete
* @static
[1207] Fix | Delete
* @param {*} a
[1208] Fix | Delete
* @returns {boolean}
[1209] Fix | Delete
*/
[1210] Fix | Delete
showdown.helper.isFunction = function (a) {
[1211] Fix | Delete
'use strict';
[1212] Fix | Delete
var getType = {};
[1213] Fix | Delete
return a && getType.toString.call(a) === '[object Function]';
[1214] Fix | Delete
};
[1215] Fix | Delete
[1216] Fix | Delete
/**
[1217] Fix | Delete
* isArray helper function
[1218] Fix | Delete
* @static
[1219] Fix | Delete
* @param {*} a
[1220] Fix | Delete
* @returns {boolean}
[1221] Fix | Delete
*/
[1222] Fix | Delete
showdown.helper.isArray = function (a) {
[1223] Fix | Delete
'use strict';
[1224] Fix | Delete
return Array.isArray(a);
[1225] Fix | Delete
};
[1226] Fix | Delete
[1227] Fix | Delete
/**
[1228] Fix | Delete
* Check if value is undefined
[1229] Fix | Delete
* @static
[1230] Fix | Delete
* @param {*} value The value to check.
[1231] Fix | Delete
* @returns {boolean} Returns `true` if `value` is `undefined`, else `false`.
[1232] Fix | Delete
*/
[1233] Fix | Delete
showdown.helper.isUndefined = function (value) {
[1234] Fix | Delete
'use strict';
[1235] Fix | Delete
return typeof value === 'undefined';
[1236] Fix | Delete
};
[1237] Fix | Delete
[1238] Fix | Delete
/**
[1239] Fix | Delete
* ForEach helper function
[1240] Fix | Delete
* Iterates over Arrays and Objects (own properties only)
[1241] Fix | Delete
* @static
[1242] Fix | Delete
* @param {*} obj
[1243] Fix | Delete
* @param {function} callback Accepts 3 params: 1. value, 2. key, 3. the original array/object
[1244] Fix | Delete
*/
[1245] Fix | Delete
showdown.helper.forEach = function (obj, callback) {
[1246] Fix | Delete
'use strict';
[1247] Fix | Delete
// check if obj is defined
[1248] Fix | Delete
if (showdown.helper.isUndefined(obj)) {
[1249] Fix | Delete
throw new Error('obj param is required');
[1250] Fix | Delete
}
[1251] Fix | Delete
[1252] Fix | Delete
if (showdown.helper.isUndefined(callback)) {
[1253] Fix | Delete
throw new Error('callback param is required');
[1254] Fix | Delete
}
[1255] Fix | Delete
[1256] Fix | Delete
if (!showdown.helper.isFunction(callback)) {
[1257] Fix | Delete
throw new Error('callback param must be a function/closure');
[1258] Fix | Delete
}
[1259] Fix | Delete
[1260] Fix | Delete
if (typeof obj.forEach === 'function') {
[1261] Fix | Delete
obj.forEach(callback);
[1262] Fix | Delete
} else if (showdown.helper.isArray(obj)) {
[1263] Fix | Delete
for (var i = 0; i < obj.length; i++) {
[1264] Fix | Delete
callback(obj[i], i, obj);
[1265] Fix | Delete
}
[1266] Fix | Delete
} else if (typeof (obj) === 'object') {
[1267] Fix | Delete
for (var prop in obj) {
[1268] Fix | Delete
if (obj.hasOwnProperty(prop)) {
[1269] Fix | Delete
callback(obj[prop], prop, obj);
[1270] Fix | Delete
}
[1271] Fix | Delete
}
[1272] Fix | Delete
} else {
[1273] Fix | Delete
throw new Error('obj does not seem to be an array or an iterable object');
[1274] Fix | Delete
}
[1275] Fix | Delete
};
[1276] Fix | Delete
[1277] Fix | Delete
/**
[1278] Fix | Delete
* Standardidize extension name
[1279] Fix | Delete
* @static
[1280] Fix | Delete
* @param {string} s extension name
[1281] Fix | Delete
* @returns {string}
[1282] Fix | Delete
*/
[1283] Fix | Delete
showdown.helper.stdExtName = function (s) {
[1284] Fix | Delete
'use strict';
[1285] Fix | Delete
return s.replace(/[_?*+\/\\.^-]/g, '').replace(/\s/g, '').toLowerCase();
[1286] Fix | Delete
};
[1287] Fix | Delete
[1288] Fix | Delete
function escapeCharactersCallback (wholeMatch, m1) {
[1289] Fix | Delete
'use strict';
[1290] Fix | Delete
var charCodeToEscape = m1.charCodeAt(0);
[1291] Fix | Delete
return '¨E' + charCodeToEscape + 'E';
[1292] Fix | Delete
}
[1293] Fix | Delete
[1294] Fix | Delete
/**
[1295] Fix | Delete
* Callback used to escape characters when passing through String.replace
[1296] Fix | Delete
* @static
[1297] Fix | Delete
* @param {string} wholeMatch
[1298] Fix | Delete
* @param {string} m1
[1299] Fix | Delete
* @returns {string}
[1300] Fix | Delete
*/
[1301] Fix | Delete
showdown.helper.escapeCharactersCallback = escapeCharactersCallback;
[1302] Fix | Delete
[1303] Fix | Delete
/**
[1304] Fix | Delete
* Escape characters in a string
[1305] Fix | Delete
* @static
[1306] Fix | Delete
* @param {string} text
[1307] Fix | Delete
* @param {string} charsToEscape
[1308] Fix | Delete
* @param {boolean} afterBackslash
[1309] Fix | Delete
* @returns {XML|string|void|*}
[1310] Fix | Delete
*/
[1311] Fix | Delete
showdown.helper.escapeCharacters = function (text, charsToEscape, afterBackslash) {
[1312] Fix | Delete
'use strict';
[1313] Fix | Delete
// First we have to escape the escape characters so that
[1314] Fix | Delete
// we can build a character class out of them
[1315] Fix | Delete
var regexString = '([' + charsToEscape.replace(/([\[\]\\])/g, '\\$1') + '])';
[1316] Fix | Delete
[1317] Fix | Delete
if (afterBackslash) {
[1318] Fix | Delete
regexString = '\\\\' + regexString;
[1319] Fix | Delete
}
[1320] Fix | Delete
[1321] Fix | Delete
var regex = new RegExp(regexString, 'g');
[1322] Fix | Delete
text = text.replace(regex, escapeCharactersCallback);
[1323] Fix | Delete
[1324] Fix | Delete
return text;
[1325] Fix | Delete
};
[1326] Fix | Delete
[1327] Fix | Delete
/**
[1328] Fix | Delete
* Unescape HTML entities
[1329] Fix | Delete
* @param txt
[1330] Fix | Delete
* @returns {string}
[1331] Fix | Delete
*/
[1332] Fix | Delete
showdown.helper.unescapeHTMLEntities = function (txt) {
[1333] Fix | Delete
'use strict';
[1334] Fix | Delete
[1335] Fix | Delete
return txt
[1336] Fix | Delete
.replace(/&quot;/g, '"')
[1337] Fix | Delete
.replace(/&lt;/g, '<')
[1338] Fix | Delete
.replace(/&gt;/g, '>')
[1339] Fix | Delete
.replace(/&amp;/g, '&');
[1340] Fix | Delete
};
[1341] Fix | Delete
[1342] Fix | Delete
var rgxFindMatchPos = function (str, left, right, flags) {
[1343] Fix | Delete
'use strict';
[1344] Fix | Delete
var f = flags || '',
[1345] Fix | Delete
g = f.indexOf('g') > -1,
[1346] Fix | Delete
x = new RegExp(left + '|' + right, 'g' + f.replace(/g/g, '')),
[1347] Fix | Delete
l = new RegExp(left, f.replace(/g/g, '')),
[1348] Fix | Delete
pos = [],
[1349] Fix | Delete
t, s, m, start, end;
[1350] Fix | Delete
[1351] Fix | Delete
do {
[1352] Fix | Delete
t = 0;
[1353] Fix | Delete
while ((m = x.exec(str))) {
[1354] Fix | Delete
if (l.test(m[0])) {
[1355] Fix | Delete
if (!(t++)) {
[1356] Fix | Delete
s = x.lastIndex;
[1357] Fix | Delete
start = s - m[0].length;
[1358] Fix | Delete
}
[1359] Fix | Delete
} else if (t) {
[1360] Fix | Delete
if (!--t) {
[1361] Fix | Delete
end = m.index + m[0].length;
[1362] Fix | Delete
var obj = {
[1363] Fix | Delete
left: {start: start, end: s},
[1364] Fix | Delete
match: {start: s, end: m.index},
[1365] Fix | Delete
right: {start: m.index, end: end},
[1366] Fix | Delete
wholeMatch: {start: start, end: end}
[1367] Fix | Delete
};
[1368] Fix | Delete
pos.push(obj);
[1369] Fix | Delete
if (!g) {
[1370] Fix | Delete
return pos;
[1371] Fix | Delete
}
[1372] Fix | Delete
}
[1373] Fix | Delete
}
[1374] Fix | Delete
}
[1375] Fix | Delete
} while (t && (x.lastIndex = s));
[1376] Fix | Delete
[1377] Fix | Delete
return pos;
[1378] Fix | Delete
};
[1379] Fix | Delete
[1380] Fix | Delete
/**
[1381] Fix | Delete
* matchRecursiveRegExp
[1382] Fix | Delete
*
[1383] Fix | Delete
* (c) 2007 Steven Levithan <stevenlevithan.com>
[1384] Fix | Delete
* MIT License
[1385] Fix | Delete
*
[1386] Fix | Delete
* Accepts a string to search, a left and right format delimiter
[1387] Fix | Delete
* as regex patterns, and optional regex flags. Returns an array
[1388] Fix | Delete
* of matches, allowing nested instances of left/right delimiters.
[1389] Fix | Delete
* Use the "g" flag to return all matches, otherwise only the
[1390] Fix | Delete
* first is returned. Be careful to ensure that the left and
[1391] Fix | Delete
* right format delimiters produce mutually exclusive matches.
[1392] Fix | Delete
* Backreferences are not supported within the right delimiter
[1393] Fix | Delete
* due to how it is internally combined with the left delimiter.
[1394] Fix | Delete
* When matching strings whose format delimiters are unbalanced
[1395] Fix | Delete
* to the left or right, the output is intentionally as a
[1396] Fix | Delete
* conventional regex library with recursion support would
[1397] Fix | Delete
* produce, e.g. "<<x>" and "<x>>" both produce ["x"] when using
[1398] Fix | Delete
* "<" and ">" as the delimiters (both strings contain a single,
[1399] Fix | Delete
* balanced instance of "<x>").
[1400] Fix | Delete
*
[1401] Fix | Delete
* examples:
[1402] Fix | Delete
* matchRecursiveRegExp("test", "\\(", "\\)")
[1403] Fix | Delete
* returns: []
[1404] Fix | Delete
* matchRecursiveRegExp("<t<<e>><s>>t<>", "<", ">", "g")
[1405] Fix | Delete
* returns: ["t<<e>><s>", ""]
[1406] Fix | Delete
* matchRecursiveRegExp("<div id=\"x\">test</div>", "<div\\b[^>]*>", "</div>", "gi")
[1407] Fix | Delete
* returns: ["test"]
[1408] Fix | Delete
*/
[1409] Fix | Delete
showdown.helper.matchRecursiveRegExp = function (str, left, right, flags) {
[1410] Fix | Delete
'use strict';
[1411] Fix | Delete
[1412] Fix | Delete
var matchPos = rgxFindMatchPos (str, left, right, flags),
[1413] Fix | Delete
results = [];
[1414] Fix | Delete
[1415] Fix | Delete
for (var i = 0; i < matchPos.length; ++i) {
[1416] Fix | Delete
results.push([
[1417] Fix | Delete
str.slice(matchPos[i].wholeMatch.start, matchPos[i].wholeMatch.end),
[1418] Fix | Delete
str.slice(matchPos[i].match.start, matchPos[i].match.end),
[1419] Fix | Delete
str.slice(matchPos[i].left.start, matchPos[i].left.end),
[1420] Fix | Delete
str.slice(matchPos[i].right.start, matchPos[i].right.end)
[1421] Fix | Delete
]);
[1422] Fix | Delete
}
[1423] Fix | Delete
return results;
[1424] Fix | Delete
};
[1425] Fix | Delete
[1426] Fix | Delete
/**
[1427] Fix | Delete
*
[1428] Fix | Delete
* @param {string} str
[1429] Fix | Delete
* @param {string|function} replacement
[1430] Fix | Delete
* @param {string} left
[1431] Fix | Delete
* @param {string} right
[1432] Fix | Delete
* @param {string} flags
[1433] Fix | Delete
* @returns {string}
[1434] Fix | Delete
*/
[1435] Fix | Delete
showdown.helper.replaceRecursiveRegExp = function (str, replacement, left, right, flags) {
[1436] Fix | Delete
'use strict';
[1437] Fix | Delete
[1438] Fix | Delete
if (!showdown.helper.isFunction(replacement)) {
[1439] Fix | Delete
var repStr = replacement;
[1440] Fix | Delete
replacement = function () {
[1441] Fix | Delete
return repStr;
[1442] Fix | Delete
};
[1443] Fix | Delete
}
[1444] Fix | Delete
[1445] Fix | Delete
var matchPos = rgxFindMatchPos(str, left, right, flags),
[1446] Fix | Delete
finalStr = str,
[1447] Fix | Delete
lng = matchPos.length;
[1448] Fix | Delete
[1449] Fix | Delete
if (lng > 0) {
[1450] Fix | Delete
var bits = [];
[1451] Fix | Delete
if (matchPos[0].wholeMatch.start !== 0) {
[1452] Fix | Delete
bits.push(str.slice(0, matchPos[0].wholeMatch.start));
[1453] Fix | Delete
}
[1454] Fix | Delete
for (var i = 0; i < lng; ++i) {
[1455] Fix | Delete
bits.push(
[1456] Fix | Delete
replacement(
[1457] Fix | Delete
str.slice(matchPos[i].wholeMatch.start, matchPos[i].wholeMatch.end),
[1458] Fix | Delete
str.slice(matchPos[i].match.start, matchPos[i].match.end),
[1459] Fix | Delete
str.slice(matchPos[i].left.start, matchPos[i].left.end),
[1460] Fix | Delete
str.slice(matchPos[i].right.start, matchPos[i].right.end)
[1461] Fix | Delete
)
[1462] Fix | Delete
);
[1463] Fix | Delete
if (i < lng - 1) {
[1464] Fix | Delete
bits.push(str.slice(matchPos[i].wholeMatch.end, matchPos[i + 1].wholeMatch.start));
[1465] Fix | Delete
}
[1466] Fix | Delete
}
[1467] Fix | Delete
if (matchPos[lng - 1].wholeMatch.end < str.length) {
[1468] Fix | Delete
bits.push(str.slice(matchPos[lng - 1].wholeMatch.end));
[1469] Fix | Delete
}
[1470] Fix | Delete
finalStr = bits.join('');
[1471] Fix | Delete
}
[1472] Fix | Delete
return finalStr;
[1473] Fix | Delete
};
[1474] Fix | Delete
[1475] Fix | Delete
/**
[1476] Fix | Delete
* Returns the index within the passed String object of the first occurrence of the specified regex,
[1477] Fix | Delete
* starting the search at fromIndex. Returns -1 if the value is not found.
[1478] Fix | Delete
*
[1479] Fix | Delete
* @param {string} str string to search
[1480] Fix | Delete
* @param {RegExp} regex Regular expression to search
[1481] Fix | Delete
* @param {int} [fromIndex = 0] Index to start the search
[1482] Fix | Delete
* @returns {Number}
[1483] Fix | Delete
* @throws InvalidArgumentError
[1484] Fix | Delete
*/
[1485] Fix | Delete
showdown.helper.regexIndexOf = function (str, regex, fromIndex) {
[1486] Fix | Delete
'use strict';
[1487] Fix | Delete
if (!showdown.helper.isString(str)) {
[1488] Fix | Delete
throw 'InvalidArgumentError: first parameter of showdown.helper.regexIndexOf function must be a string';
[1489] Fix | Delete
}
[1490] Fix | Delete
if (regex instanceof RegExp === false) {
[1491] Fix | Delete
throw 'InvalidArgumentError: second parameter of showdown.helper.regexIndexOf function must be an instance of RegExp';
[1492] Fix | Delete
}
[1493] Fix | Delete
var indexOf = str.substring(fromIndex || 0).search(regex);
[1494] Fix | Delete
return (indexOf >= 0) ? (indexOf + (fromIndex || 0)) : indexOf;
[1495] Fix | Delete
};
[1496] Fix | Delete
[1497] Fix | Delete
/**
[1498] Fix | Delete
* Splits the passed string object at the defined index, and returns an array composed of the two substrings
[1499] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function