Edit File by line
/home/barbar84/www/wp-inclu.../js/dist
File: blocks.js
if (showdown.helper.isUndefined(ext.filter) && showdown.helper.isUndefined(ext.regex)) {
[8000] Fix | Delete
ret.valid = false;
[8001] Fix | Delete
ret.error = baseMsg + type + ' extensions must define either a "regex" property or a "filter" method';
[8002] Fix | Delete
return ret;
[8003] Fix | Delete
}
[8004] Fix | Delete
}
[8005] Fix | Delete
[8006] Fix | Delete
if (ext.listeners) {
[8007] Fix | Delete
if (typeof ext.listeners !== 'object') {
[8008] Fix | Delete
ret.valid = false;
[8009] Fix | Delete
ret.error = baseMsg + '"listeners" property must be an object but ' + typeof ext.listeners + ' given';
[8010] Fix | Delete
return ret;
[8011] Fix | Delete
}
[8012] Fix | Delete
for (var ln in ext.listeners) {
[8013] Fix | Delete
if (ext.listeners.hasOwnProperty(ln)) {
[8014] Fix | Delete
if (typeof ext.listeners[ln] !== 'function') {
[8015] Fix | Delete
ret.valid = false;
[8016] Fix | Delete
ret.error = baseMsg + '"listeners" property must be an hash of [event name]: [callback]. listeners.' + ln +
[8017] Fix | Delete
' must be a function but ' + typeof ext.listeners[ln] + ' given';
[8018] Fix | Delete
return ret;
[8019] Fix | Delete
}
[8020] Fix | Delete
}
[8021] Fix | Delete
}
[8022] Fix | Delete
}
[8023] Fix | Delete
[8024] Fix | Delete
if (ext.filter) {
[8025] Fix | Delete
if (typeof ext.filter !== 'function') {
[8026] Fix | Delete
ret.valid = false;
[8027] Fix | Delete
ret.error = baseMsg + '"filter" must be a function, but ' + typeof ext.filter + ' given';
[8028] Fix | Delete
return ret;
[8029] Fix | Delete
}
[8030] Fix | Delete
} else if (ext.regex) {
[8031] Fix | Delete
if (showdown.helper.isString(ext.regex)) {
[8032] Fix | Delete
ext.regex = new RegExp(ext.regex, 'g');
[8033] Fix | Delete
}
[8034] Fix | Delete
if (!(ext.regex instanceof RegExp)) {
[8035] Fix | Delete
ret.valid = false;
[8036] Fix | Delete
ret.error = baseMsg + '"regex" property must either be a string or a RegExp object, but ' + typeof ext.regex + ' given';
[8037] Fix | Delete
return ret;
[8038] Fix | Delete
}
[8039] Fix | Delete
if (showdown.helper.isUndefined(ext.replace)) {
[8040] Fix | Delete
ret.valid = false;
[8041] Fix | Delete
ret.error = baseMsg + '"regex" extensions must implement a replace string or function';
[8042] Fix | Delete
return ret;
[8043] Fix | Delete
}
[8044] Fix | Delete
}
[8045] Fix | Delete
}
[8046] Fix | Delete
return ret;
[8047] Fix | Delete
}
[8048] Fix | Delete
[8049] Fix | Delete
/**
[8050] Fix | Delete
* Validate extension
[8051] Fix | Delete
* @param {object} ext
[8052] Fix | Delete
* @returns {boolean}
[8053] Fix | Delete
*/
[8054] Fix | Delete
showdown.validateExtension = function (ext) {
[8055] Fix | Delete
'use strict';
[8056] Fix | Delete
[8057] Fix | Delete
var validateExtension = validate(ext, null);
[8058] Fix | Delete
if (!validateExtension.valid) {
[8059] Fix | Delete
console.warn(validateExtension.error);
[8060] Fix | Delete
return false;
[8061] Fix | Delete
}
[8062] Fix | Delete
return true;
[8063] Fix | Delete
};
[8064] Fix | Delete
[8065] Fix | Delete
/**
[8066] Fix | Delete
* showdownjs helper functions
[8067] Fix | Delete
*/
[8068] Fix | Delete
[8069] Fix | Delete
if (!showdown.hasOwnProperty('helper')) {
[8070] Fix | Delete
showdown.helper = {};
[8071] Fix | Delete
}
[8072] Fix | Delete
[8073] Fix | Delete
/**
[8074] Fix | Delete
* Check if var is string
[8075] Fix | Delete
* @static
[8076] Fix | Delete
* @param {string} a
[8077] Fix | Delete
* @returns {boolean}
[8078] Fix | Delete
*/
[8079] Fix | Delete
showdown.helper.isString = function (a) {
[8080] Fix | Delete
'use strict';
[8081] Fix | Delete
return (typeof a === 'string' || a instanceof String);
[8082] Fix | Delete
};
[8083] Fix | Delete
[8084] Fix | Delete
/**
[8085] Fix | Delete
* Check if var is a function
[8086] Fix | Delete
* @static
[8087] Fix | Delete
* @param {*} a
[8088] Fix | Delete
* @returns {boolean}
[8089] Fix | Delete
*/
[8090] Fix | Delete
showdown.helper.isFunction = function (a) {
[8091] Fix | Delete
'use strict';
[8092] Fix | Delete
var getType = {};
[8093] Fix | Delete
return a && getType.toString.call(a) === '[object Function]';
[8094] Fix | Delete
};
[8095] Fix | Delete
[8096] Fix | Delete
/**
[8097] Fix | Delete
* isArray helper function
[8098] Fix | Delete
* @static
[8099] Fix | Delete
* @param {*} a
[8100] Fix | Delete
* @returns {boolean}
[8101] Fix | Delete
*/
[8102] Fix | Delete
showdown.helper.isArray = function (a) {
[8103] Fix | Delete
'use strict';
[8104] Fix | Delete
return Array.isArray(a);
[8105] Fix | Delete
};
[8106] Fix | Delete
[8107] Fix | Delete
/**
[8108] Fix | Delete
* Check if value is undefined
[8109] Fix | Delete
* @static
[8110] Fix | Delete
* @param {*} value The value to check.
[8111] Fix | Delete
* @returns {boolean} Returns `true` if `value` is `undefined`, else `false`.
[8112] Fix | Delete
*/
[8113] Fix | Delete
showdown.helper.isUndefined = function (value) {
[8114] Fix | Delete
'use strict';
[8115] Fix | Delete
return typeof value === 'undefined';
[8116] Fix | Delete
};
[8117] Fix | Delete
[8118] Fix | Delete
/**
[8119] Fix | Delete
* ForEach helper function
[8120] Fix | Delete
* Iterates over Arrays and Objects (own properties only)
[8121] Fix | Delete
* @static
[8122] Fix | Delete
* @param {*} obj
[8123] Fix | Delete
* @param {function} callback Accepts 3 params: 1. value, 2. key, 3. the original array/object
[8124] Fix | Delete
*/
[8125] Fix | Delete
showdown.helper.forEach = function (obj, callback) {
[8126] Fix | Delete
'use strict';
[8127] Fix | Delete
// check if obj is defined
[8128] Fix | Delete
if (showdown.helper.isUndefined(obj)) {
[8129] Fix | Delete
throw new Error('obj param is required');
[8130] Fix | Delete
}
[8131] Fix | Delete
[8132] Fix | Delete
if (showdown.helper.isUndefined(callback)) {
[8133] Fix | Delete
throw new Error('callback param is required');
[8134] Fix | Delete
}
[8135] Fix | Delete
[8136] Fix | Delete
if (!showdown.helper.isFunction(callback)) {
[8137] Fix | Delete
throw new Error('callback param must be a function/closure');
[8138] Fix | Delete
}
[8139] Fix | Delete
[8140] Fix | Delete
if (typeof obj.forEach === 'function') {
[8141] Fix | Delete
obj.forEach(callback);
[8142] Fix | Delete
} else if (showdown.helper.isArray(obj)) {
[8143] Fix | Delete
for (var i = 0; i < obj.length; i++) {
[8144] Fix | Delete
callback(obj[i], i, obj);
[8145] Fix | Delete
}
[8146] Fix | Delete
} else if (typeof (obj) === 'object') {
[8147] Fix | Delete
for (var prop in obj) {
[8148] Fix | Delete
if (obj.hasOwnProperty(prop)) {
[8149] Fix | Delete
callback(obj[prop], prop, obj);
[8150] Fix | Delete
}
[8151] Fix | Delete
}
[8152] Fix | Delete
} else {
[8153] Fix | Delete
throw new Error('obj does not seem to be an array or an iterable object');
[8154] Fix | Delete
}
[8155] Fix | Delete
};
[8156] Fix | Delete
[8157] Fix | Delete
/**
[8158] Fix | Delete
* Standardidize extension name
[8159] Fix | Delete
* @static
[8160] Fix | Delete
* @param {string} s extension name
[8161] Fix | Delete
* @returns {string}
[8162] Fix | Delete
*/
[8163] Fix | Delete
showdown.helper.stdExtName = function (s) {
[8164] Fix | Delete
'use strict';
[8165] Fix | Delete
return s.replace(/[_?*+\/\\.^-]/g, '').replace(/\s/g, '').toLowerCase();
[8166] Fix | Delete
};
[8167] Fix | Delete
[8168] Fix | Delete
function escapeCharactersCallback (wholeMatch, m1) {
[8169] Fix | Delete
'use strict';
[8170] Fix | Delete
var charCodeToEscape = m1.charCodeAt(0);
[8171] Fix | Delete
return '¨E' + charCodeToEscape + 'E';
[8172] Fix | Delete
}
[8173] Fix | Delete
[8174] Fix | Delete
/**
[8175] Fix | Delete
* Callback used to escape characters when passing through String.replace
[8176] Fix | Delete
* @static
[8177] Fix | Delete
* @param {string} wholeMatch
[8178] Fix | Delete
* @param {string} m1
[8179] Fix | Delete
* @returns {string}
[8180] Fix | Delete
*/
[8181] Fix | Delete
showdown.helper.escapeCharactersCallback = escapeCharactersCallback;
[8182] Fix | Delete
[8183] Fix | Delete
/**
[8184] Fix | Delete
* Escape characters in a string
[8185] Fix | Delete
* @static
[8186] Fix | Delete
* @param {string} text
[8187] Fix | Delete
* @param {string} charsToEscape
[8188] Fix | Delete
* @param {boolean} afterBackslash
[8189] Fix | Delete
* @returns {XML|string|void|*}
[8190] Fix | Delete
*/
[8191] Fix | Delete
showdown.helper.escapeCharacters = function (text, charsToEscape, afterBackslash) {
[8192] Fix | Delete
'use strict';
[8193] Fix | Delete
// First we have to escape the escape characters so that
[8194] Fix | Delete
// we can build a character class out of them
[8195] Fix | Delete
var regexString = '([' + charsToEscape.replace(/([\[\]\\])/g, '\\$1') + '])';
[8196] Fix | Delete
[8197] Fix | Delete
if (afterBackslash) {
[8198] Fix | Delete
regexString = '\\\\' + regexString;
[8199] Fix | Delete
}
[8200] Fix | Delete
[8201] Fix | Delete
var regex = new RegExp(regexString, 'g');
[8202] Fix | Delete
text = text.replace(regex, escapeCharactersCallback);
[8203] Fix | Delete
[8204] Fix | Delete
return text;
[8205] Fix | Delete
};
[8206] Fix | Delete
[8207] Fix | Delete
/**
[8208] Fix | Delete
* Unescape HTML entities
[8209] Fix | Delete
* @param txt
[8210] Fix | Delete
* @returns {string}
[8211] Fix | Delete
*/
[8212] Fix | Delete
showdown.helper.unescapeHTMLEntities = function (txt) {
[8213] Fix | Delete
'use strict';
[8214] Fix | Delete
[8215] Fix | Delete
return txt
[8216] Fix | Delete
.replace(/&quot;/g, '"')
[8217] Fix | Delete
.replace(/&lt;/g, '<')
[8218] Fix | Delete
.replace(/&gt;/g, '>')
[8219] Fix | Delete
.replace(/&amp;/g, '&');
[8220] Fix | Delete
};
[8221] Fix | Delete
[8222] Fix | Delete
var rgxFindMatchPos = function (str, left, right, flags) {
[8223] Fix | Delete
'use strict';
[8224] Fix | Delete
var f = flags || '',
[8225] Fix | Delete
g = f.indexOf('g') > -1,
[8226] Fix | Delete
x = new RegExp(left + '|' + right, 'g' + f.replace(/g/g, '')),
[8227] Fix | Delete
l = new RegExp(left, f.replace(/g/g, '')),
[8228] Fix | Delete
pos = [],
[8229] Fix | Delete
t, s, m, start, end;
[8230] Fix | Delete
[8231] Fix | Delete
do {
[8232] Fix | Delete
t = 0;
[8233] Fix | Delete
while ((m = x.exec(str))) {
[8234] Fix | Delete
if (l.test(m[0])) {
[8235] Fix | Delete
if (!(t++)) {
[8236] Fix | Delete
s = x.lastIndex;
[8237] Fix | Delete
start = s - m[0].length;
[8238] Fix | Delete
}
[8239] Fix | Delete
} else if (t) {
[8240] Fix | Delete
if (!--t) {
[8241] Fix | Delete
end = m.index + m[0].length;
[8242] Fix | Delete
var obj = {
[8243] Fix | Delete
left: {start: start, end: s},
[8244] Fix | Delete
match: {start: s, end: m.index},
[8245] Fix | Delete
right: {start: m.index, end: end},
[8246] Fix | Delete
wholeMatch: {start: start, end: end}
[8247] Fix | Delete
};
[8248] Fix | Delete
pos.push(obj);
[8249] Fix | Delete
if (!g) {
[8250] Fix | Delete
return pos;
[8251] Fix | Delete
}
[8252] Fix | Delete
}
[8253] Fix | Delete
}
[8254] Fix | Delete
}
[8255] Fix | Delete
} while (t && (x.lastIndex = s));
[8256] Fix | Delete
[8257] Fix | Delete
return pos;
[8258] Fix | Delete
};
[8259] Fix | Delete
[8260] Fix | Delete
/**
[8261] Fix | Delete
* matchRecursiveRegExp
[8262] Fix | Delete
*
[8263] Fix | Delete
* (c) 2007 Steven Levithan <stevenlevithan.com>
[8264] Fix | Delete
* MIT License
[8265] Fix | Delete
*
[8266] Fix | Delete
* Accepts a string to search, a left and right format delimiter
[8267] Fix | Delete
* as regex patterns, and optional regex flags. Returns an array
[8268] Fix | Delete
* of matches, allowing nested instances of left/right delimiters.
[8269] Fix | Delete
* Use the "g" flag to return all matches, otherwise only the
[8270] Fix | Delete
* first is returned. Be careful to ensure that the left and
[8271] Fix | Delete
* right format delimiters produce mutually exclusive matches.
[8272] Fix | Delete
* Backreferences are not supported within the right delimiter
[8273] Fix | Delete
* due to how it is internally combined with the left delimiter.
[8274] Fix | Delete
* When matching strings whose format delimiters are unbalanced
[8275] Fix | Delete
* to the left or right, the output is intentionally as a
[8276] Fix | Delete
* conventional regex library with recursion support would
[8277] Fix | Delete
* produce, e.g. "<<x>" and "<x>>" both produce ["x"] when using
[8278] Fix | Delete
* "<" and ">" as the delimiters (both strings contain a single,
[8279] Fix | Delete
* balanced instance of "<x>").
[8280] Fix | Delete
*
[8281] Fix | Delete
* examples:
[8282] Fix | Delete
* matchRecursiveRegExp("test", "\\(", "\\)")
[8283] Fix | Delete
* returns: []
[8284] Fix | Delete
* matchRecursiveRegExp("<t<<e>><s>>t<>", "<", ">", "g")
[8285] Fix | Delete
* returns: ["t<<e>><s>", ""]
[8286] Fix | Delete
* matchRecursiveRegExp("<div id=\"x\">test</div>", "<div\\b[^>]*>", "</div>", "gi")
[8287] Fix | Delete
* returns: ["test"]
[8288] Fix | Delete
*/
[8289] Fix | Delete
showdown.helper.matchRecursiveRegExp = function (str, left, right, flags) {
[8290] Fix | Delete
'use strict';
[8291] Fix | Delete
[8292] Fix | Delete
var matchPos = rgxFindMatchPos (str, left, right, flags),
[8293] Fix | Delete
results = [];
[8294] Fix | Delete
[8295] Fix | Delete
for (var i = 0; i < matchPos.length; ++i) {
[8296] Fix | Delete
results.push([
[8297] Fix | Delete
str.slice(matchPos[i].wholeMatch.start, matchPos[i].wholeMatch.end),
[8298] Fix | Delete
str.slice(matchPos[i].match.start, matchPos[i].match.end),
[8299] Fix | Delete
str.slice(matchPos[i].left.start, matchPos[i].left.end),
[8300] Fix | Delete
str.slice(matchPos[i].right.start, matchPos[i].right.end)
[8301] Fix | Delete
]);
[8302] Fix | Delete
}
[8303] Fix | Delete
return results;
[8304] Fix | Delete
};
[8305] Fix | Delete
[8306] Fix | Delete
/**
[8307] Fix | Delete
*
[8308] Fix | Delete
* @param {string} str
[8309] Fix | Delete
* @param {string|function} replacement
[8310] Fix | Delete
* @param {string} left
[8311] Fix | Delete
* @param {string} right
[8312] Fix | Delete
* @param {string} flags
[8313] Fix | Delete
* @returns {string}
[8314] Fix | Delete
*/
[8315] Fix | Delete
showdown.helper.replaceRecursiveRegExp = function (str, replacement, left, right, flags) {
[8316] Fix | Delete
'use strict';
[8317] Fix | Delete
[8318] Fix | Delete
if (!showdown.helper.isFunction(replacement)) {
[8319] Fix | Delete
var repStr = replacement;
[8320] Fix | Delete
replacement = function () {
[8321] Fix | Delete
return repStr;
[8322] Fix | Delete
};
[8323] Fix | Delete
}
[8324] Fix | Delete
[8325] Fix | Delete
var matchPos = rgxFindMatchPos(str, left, right, flags),
[8326] Fix | Delete
finalStr = str,
[8327] Fix | Delete
lng = matchPos.length;
[8328] Fix | Delete
[8329] Fix | Delete
if (lng > 0) {
[8330] Fix | Delete
var bits = [];
[8331] Fix | Delete
if (matchPos[0].wholeMatch.start !== 0) {
[8332] Fix | Delete
bits.push(str.slice(0, matchPos[0].wholeMatch.start));
[8333] Fix | Delete
}
[8334] Fix | Delete
for (var i = 0; i < lng; ++i) {
[8335] Fix | Delete
bits.push(
[8336] Fix | Delete
replacement(
[8337] Fix | Delete
str.slice(matchPos[i].wholeMatch.start, matchPos[i].wholeMatch.end),
[8338] Fix | Delete
str.slice(matchPos[i].match.start, matchPos[i].match.end),
[8339] Fix | Delete
str.slice(matchPos[i].left.start, matchPos[i].left.end),
[8340] Fix | Delete
str.slice(matchPos[i].right.start, matchPos[i].right.end)
[8341] Fix | Delete
)
[8342] Fix | Delete
);
[8343] Fix | Delete
if (i < lng - 1) {
[8344] Fix | Delete
bits.push(str.slice(matchPos[i].wholeMatch.end, matchPos[i + 1].wholeMatch.start));
[8345] Fix | Delete
}
[8346] Fix | Delete
}
[8347] Fix | Delete
if (matchPos[lng - 1].wholeMatch.end < str.length) {
[8348] Fix | Delete
bits.push(str.slice(matchPos[lng - 1].wholeMatch.end));
[8349] Fix | Delete
}
[8350] Fix | Delete
finalStr = bits.join('');
[8351] Fix | Delete
}
[8352] Fix | Delete
return finalStr;
[8353] Fix | Delete
};
[8354] Fix | Delete
[8355] Fix | Delete
/**
[8356] Fix | Delete
* Returns the index within the passed String object of the first occurrence of the specified regex,
[8357] Fix | Delete
* starting the search at fromIndex. Returns -1 if the value is not found.
[8358] Fix | Delete
*
[8359] Fix | Delete
* @param {string} str string to search
[8360] Fix | Delete
* @param {RegExp} regex Regular expression to search
[8361] Fix | Delete
* @param {int} [fromIndex = 0] Index to start the search
[8362] Fix | Delete
* @returns {Number}
[8363] Fix | Delete
* @throws InvalidArgumentError
[8364] Fix | Delete
*/
[8365] Fix | Delete
showdown.helper.regexIndexOf = function (str, regex, fromIndex) {
[8366] Fix | Delete
'use strict';
[8367] Fix | Delete
if (!showdown.helper.isString(str)) {
[8368] Fix | Delete
throw 'InvalidArgumentError: first parameter of showdown.helper.regexIndexOf function must be a string';
[8369] Fix | Delete
}
[8370] Fix | Delete
if (regex instanceof RegExp === false) {
[8371] Fix | Delete
throw 'InvalidArgumentError: second parameter of showdown.helper.regexIndexOf function must be an instance of RegExp';
[8372] Fix | Delete
}
[8373] Fix | Delete
var indexOf = str.substring(fromIndex || 0).search(regex);
[8374] Fix | Delete
return (indexOf >= 0) ? (indexOf + (fromIndex || 0)) : indexOf;
[8375] Fix | Delete
};
[8376] Fix | Delete
[8377] Fix | Delete
/**
[8378] Fix | Delete
* Splits the passed string object at the defined index, and returns an array composed of the two substrings
[8379] Fix | Delete
* @param {string} str string to split
[8380] Fix | Delete
* @param {int} index index to split string at
[8381] Fix | Delete
* @returns {[string,string]}
[8382] Fix | Delete
* @throws InvalidArgumentError
[8383] Fix | Delete
*/
[8384] Fix | Delete
showdown.helper.splitAtIndex = function (str, index) {
[8385] Fix | Delete
'use strict';
[8386] Fix | Delete
if (!showdown.helper.isString(str)) {
[8387] Fix | Delete
throw 'InvalidArgumentError: first parameter of showdown.helper.regexIndexOf function must be a string';
[8388] Fix | Delete
}
[8389] Fix | Delete
return [str.substring(0, index), str.substring(index)];
[8390] Fix | Delete
};
[8391] Fix | Delete
[8392] Fix | Delete
/**
[8393] Fix | Delete
* Obfuscate an e-mail address through the use of Character Entities,
[8394] Fix | Delete
* transforming ASCII characters into their equivalent decimal or hex entities.
[8395] Fix | Delete
*
[8396] Fix | Delete
* Since it has a random component, subsequent calls to this function produce different results
[8397] Fix | Delete
*
[8398] Fix | Delete
* @param {string} mail
[8399] Fix | Delete
* @returns {string}
[8400] Fix | Delete
*/
[8401] Fix | Delete
showdown.helper.encodeEmailAddress = function (mail) {
[8402] Fix | Delete
'use strict';
[8403] Fix | Delete
var encode = [
[8404] Fix | Delete
function (ch) {
[8405] Fix | Delete
return '&#' + ch.charCodeAt(0) + ';';
[8406] Fix | Delete
},
[8407] Fix | Delete
function (ch) {
[8408] Fix | Delete
return '&#x' + ch.charCodeAt(0).toString(16) + ';';
[8409] Fix | Delete
},
[8410] Fix | Delete
function (ch) {
[8411] Fix | Delete
return ch;
[8412] Fix | Delete
}
[8413] Fix | Delete
];
[8414] Fix | Delete
[8415] Fix | Delete
mail = mail.replace(/./g, function (ch) {
[8416] Fix | Delete
if (ch === '@') {
[8417] Fix | Delete
// this *must* be encoded. I insist.
[8418] Fix | Delete
ch = encode[Math.floor(Math.random() * 2)](ch);
[8419] Fix | Delete
} else {
[8420] Fix | Delete
var r = Math.random();
[8421] Fix | Delete
// roughly 10% raw, 45% hex, 45% dec
[8422] Fix | Delete
ch = (
[8423] Fix | Delete
r > 0.9 ? encode[2](ch) : r > 0.45 ? encode[1](ch) : encode[0](ch)
[8424] Fix | Delete
);
[8425] Fix | Delete
}
[8426] Fix | Delete
return ch;
[8427] Fix | Delete
});
[8428] Fix | Delete
[8429] Fix | Delete
return mail;
[8430] Fix | Delete
};
[8431] Fix | Delete
[8432] Fix | Delete
/**
[8433] Fix | Delete
*
[8434] Fix | Delete
* @param str
[8435] Fix | Delete
* @param targetLength
[8436] Fix | Delete
* @param padString
[8437] Fix | Delete
* @returns {string}
[8438] Fix | Delete
*/
[8439] Fix | Delete
showdown.helper.padEnd = function padEnd (str, targetLength, padString) {
[8440] Fix | Delete
'use strict';
[8441] Fix | Delete
/*jshint bitwise: false*/
[8442] Fix | Delete
// eslint-disable-next-line space-infix-ops
[8443] Fix | Delete
targetLength = targetLength>>0; //floor if number or convert non-number to 0;
[8444] Fix | Delete
/*jshint bitwise: true*/
[8445] Fix | Delete
padString = String(padString || ' ');
[8446] Fix | Delete
if (str.length > targetLength) {
[8447] Fix | Delete
return String(str);
[8448] Fix | Delete
} else {
[8449] Fix | Delete
targetLength = targetLength - str.length;
[8450] Fix | Delete
if (targetLength > padString.length) {
[8451] Fix | Delete
padString += padString.repeat(targetLength / padString.length); //append to original to ensure we are longer than needed
[8452] Fix | Delete
}
[8453] Fix | Delete
return String(str) + padString.slice(0,targetLength);
[8454] Fix | Delete
}
[8455] Fix | Delete
};
[8456] Fix | Delete
[8457] Fix | Delete
/**
[8458] Fix | Delete
* POLYFILLS
[8459] Fix | Delete
*/
[8460] Fix | Delete
// use this instead of builtin is undefined for IE8 compatibility
[8461] Fix | Delete
if (typeof console === 'undefined') {
[8462] Fix | Delete
console = {
[8463] Fix | Delete
warn: function (msg) {
[8464] Fix | Delete
'use strict';
[8465] Fix | Delete
alert(msg);
[8466] Fix | Delete
},
[8467] Fix | Delete
log: function (msg) {
[8468] Fix | Delete
'use strict';
[8469] Fix | Delete
alert(msg);
[8470] Fix | Delete
},
[8471] Fix | Delete
error: function (msg) {
[8472] Fix | Delete
'use strict';
[8473] Fix | Delete
throw msg;
[8474] Fix | Delete
}
[8475] Fix | Delete
};
[8476] Fix | Delete
}
[8477] Fix | Delete
[8478] Fix | Delete
/**
[8479] Fix | Delete
* Common regexes.
[8480] Fix | Delete
* We declare some common regexes to improve performance
[8481] Fix | Delete
*/
[8482] Fix | Delete
showdown.helper.regexes = {
[8483] Fix | Delete
asteriskDashAndColon: /([*_:~])/g
[8484] Fix | Delete
};
[8485] Fix | Delete
[8486] Fix | Delete
/**
[8487] Fix | Delete
* EMOJIS LIST
[8488] Fix | Delete
*/
[8489] Fix | Delete
showdown.helper.emojis = {
[8490] Fix | Delete
'+1':'\ud83d\udc4d',
[8491] Fix | Delete
'-1':'\ud83d\udc4e',
[8492] Fix | Delete
'100':'\ud83d\udcaf',
[8493] Fix | Delete
'1234':'\ud83d\udd22',
[8494] Fix | Delete
'1st_place_medal':'\ud83e\udd47',
[8495] Fix | Delete
'2nd_place_medal':'\ud83e\udd48',
[8496] Fix | Delete
'3rd_place_medal':'\ud83e\udd49',
[8497] Fix | Delete
'8ball':'\ud83c\udfb1',
[8498] Fix | Delete
'a':'\ud83c\udd70\ufe0f',
[8499] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function