Skip to content

Instantly share code, notes, and snippets.

@sXakil
Last active May 18, 2022 10:42
Show Gist options
  • Save sXakil/f7753ee9f11d82b427e1803e1de3f025 to your computer and use it in GitHub Desktop.
Save sXakil/f7753ee9f11d82b427e1803e1de3f025 to your computer and use it in GitHub Desktop.
function main(deem) {
"use strict";
var unicodeRegex =
/([\uD800-\uDBFF][\uDC00-\uDFFF](?:[\u200D\uFE0F][\uD800-\uDBFF][\uDC00-\uDFFF]){2,}|\uD83D\uDC69(?:\u200D(?:(?:\uD83D\uDC69\u200D)?\uD83D\uDC67|(?:\uD83D\uDC69\u200D)?\uD83D\uDC66)|\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC69\u200D(?:\uD83D\uDC69\u200D)?\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D(?:\uD83D\uDC69\u200D)?\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]\uFE0F|\uD83D\uDC69(?:\uD83C[\uDFFB-\uDFFF])\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92])|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC6F\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3C-\uDD3E\uDDD6-\uDDDF])\u200D[\u2640\u2642]\uFE0F|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF6\uD83C\uDDE6|\uD83C\uDDF4\uD83C\uDDF2|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F\u200D[\u2640\u2642]|(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642])\uFE0F|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83D\uDC69(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2695\u2696\u2708]|\uD83D\uDC69\u200D[\u2695\u2696\u2708]|\uD83D\uDC68(?:(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708]))\uFE0F|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83D\uDC69\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69]))|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDEB(?:\uD83C[\uDDE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95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD36\uDDD1-\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\u200D(?:(?:(?:\uD83D[\uDC68\uDC69])\u200D)?\uD83D\uDC67|(?:(?:\uD83D[\uDC68\uDC69])\u200D)?\uD83D\uDC66)|\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC69\uDC6E\uDC70-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD18-\uDD1C\uDD1E\uDD1F\uDD26\uDD30-\uDD39\uDD3D\uDD3E\uDDD1-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])?|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDEEB\uDEEC\uDEF4-\uDEF8]|\uD83E[\uDD10-\uDD3A\uDD3C-\uDD3E\uDD40-\uDD45\uDD47-\uDD4C\uDD50-\uDD6B\uDD80-\uDD97\uDDC0\uDDD0-\uDDE6])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u2660\u2663\u2665\u2666\u2668\u267B\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEF8]|\uD83E[\uDD10-\uDD3A\uDD3C-\uDD3E\uDD40-\uDD45\uDD47-\uDD4C\uDD50-\uDD6B\uDD80-\uDD97\uDDC0\uDDD0-\uDDE6])\uFE0F)/;
function splitNodes(nodes) {
var typeOfD = typeof nodes;
if (Array.isArray(nodes)) {
return nodes;
}
if (nodes) {
if (typeOfD === "string") {
var elements = Array.from(document.querySelectorAll(nodes));
return elements.splice(0);
}
if (typeOfD === "object" && "length" in nodes) {
var elements = Array.from(nodes);
return elements.splice(0);
}
return [nodes];
}
return [];
}
function errantry(cot, counsels) {
for (var coverlet, covet = counsels.length; -1 < --covet; )
if (
((coverlet = counsels[covet]),
cot.substr(0, coverlet.length) === coverlet)
)
return coverlet.length;
}
function cools(coomb, coop) {
void 0 === coomb && (coomb = "");
var corbel = coomb.indexOf("++") >= 0,
coronal = 1;
return (
corbel && (coomb = coomb.split("++").join("")),
function () {
return (
"<" +
coop +
" style='position:relative;display:inline-block;'" +
(coomb ? " class='" + coomb + (corbel ? coronal++ : "") + "'>" : ">")
);
}
);
}
function coney(confines, confusticate, constellate) {
var cony = confines.nodeType;
if (cony === 1 || cony === 9 || cony === 11)
for (
confines = confines.firstChild;
confines;
confines = confines.nextSibling
)
coney(confines, confusticate, constellate);
else
(3 !== cony && 4 !== cony) ||
(confines.nodeValue = confines.nodeValue
.split(confusticate)
.join(constellate));
}
function commons(compass, conclave) {
for (var concourse = conclave.length; -1 < --concourse; )
compass.push(conclave[concourse]);
}
function cloven(cob, cockshut, coffer) {
for (var comely; cob && cob !== cockshut; ) {
if ((comely = cob._next || cob.nextSibling))
return comely.textContent.charAt(0) === coffer;
cob = cob.parentNode || cob._parent;
}
}
function chine(churl) {
var circlet,
clamant,
clave = splitNodes(churl.childNodes),
clomb = clave.length;
for (circlet = 0; circlet < clomb; circlet++)
(clamant = clave[circlet])._isSplit
? chine(clamant)
: circlet &&
clamant.previousSibling &&
clamant.previousSibling.nodeType === 3
? ((clamant.previousSibling.nodeValue +=
clamant.nodeType === 3
? clamant.nodeValue
: clamant.firstChild.nodeValue),
churl.removeChild(clamant))
: 3 !== clamant.nodeType &&
(churl.insertBefore(clamant.firstChild, clamant),
churl.removeChild(clamant));
}
function parseFloatOrZero(num) {
return parseFloat(num) || 0;
}
function extrctMesurments(computedStyles, lineThreshold = null) {
return {
paddingLeft: parseFloatOrZero(computedStyles.paddingLeft),
horizontalBorderWidth:
parseFloatOrZero(computedStyles.borderBottomWidth) +
parseFloatOrZero(computedStyles.borderTopWidth),
verticalBorderWidth:
parseFloatOrZero(computedStyles.borderLeftWidth) +
parseFloatOrZero(computedStyles.borderRightWidth),
horizontalPadding:
parseFloatOrZero(computedStyles.paddingTop) +
parseFloatOrZero(computedStyles.paddingBottom),
verticalPadding:
parseFloatOrZero(computedStyles.paddingLeft) +
parseFloatOrZero(computedStyles.paddingRight),
fontSize:
parseFloatOrZero(computedStyles.fontSize) * (lineThreshold || 0.2),
};
}
function billow(beset, besom, besotted, besought, bier, billow, bivouac) {
var blazoned,
bole,
bond,
booby,
boon,
brakes,
brazen,
brock,
brood,
brook,
buckler,
bulwark,
burg = window.getComputedStyle(beset),
offset = -999;
var {
paddingLeft,
horizontalBorderWidth,
verticalBorderWidth,
horizontalPadding,
verticalPadding,
fontSize,
} = extrctMesurments(burg, besom.lineThreshold);
var burgeon = burg.textAlign,
burnished = [],
byre = [],
cairn = [],
canker = besom.wordDelimiter || " ",
carcanet = besom.tag ? besom.tag : besom.span ? "span" : "div",
carouse = besom.type || besom.split || "chars,words,lines",
carven = bier && carouse.indexOf("lines") >= 0 ? [] : null,
cataract = carouse.indexOf("words") >= 0,
causeway = carouse.indexOf("chars") >= 0,
cesspool = besom.position === "absolute" || besom.absolute,
chalcedony = besom.linesClass,
champ = (chalcedony || "").indexOf("++") >= 0,
charger = [],
chestnut = "flex" === burg.display,
chime = beset.style.display;
for (
champ && (chalcedony = chalcedony.split("++").join("")),
chestnut && (beset.style.display = "block"),
bond = (bole = beset.getElementsByTagName("*")).length,
boon = [],
blazoned = 0;
blazoned < bond;
blazoned++
)
boon[blazoned] = bole[blazoned];
if (carven || cesspool)
for (blazoned = 0; blazoned < bond; blazoned++)
((brakes = (booby = boon[blazoned]).parentNode === beset) ||
cesspool ||
(causeway && !cataract)) &&
((bulwark = booby.offsetTop),
carven &&
brakes &&
Math.abs(bulwark - offset) > fontSize &&
("BR" !== booby.nodeName || blazoned === 0) &&
((brazen = []), carven.push(brazen), (offset = bulwark)),
cesspool &&
((booby._x = booby.offsetLeft),
(booby._y = bulwark),
(booby._w = booby.offsetWidth),
(booby._h = booby.offsetHeight)),
carven &&
(((booby._isSplit && brakes) ||
(!causeway && brakes) ||
(cataract && brakes) ||
(!cataract &&
booby.parentNode.parentNode === beset &&
!booby.parentNode._isSplit)) &&
(brazen.push(booby),
(booby._x -= paddingLeft),
cloven(booby, beset, canker) && (booby._wordEnd = true)),
"BR" === booby.nodeName &&
((booby.nextSibling && "BR" === booby.nextSibling.nodeName) ||
blazoned === 0) &&
carven.push([])));
for (blazoned = 0; blazoned < bond; blazoned++)
if (
((brakes = (booby = boon[blazoned]).parentNode === beset),
"BR" !== booby.nodeName)
)
if (
(cesspool &&
((brood = booby.style),
cataract ||
brakes ||
((booby._x += booby.parentNode._x),
(booby._y += booby.parentNode._y)),
(brood.left = booby._x + "px"),
(brood.top = booby._y + "px"),
(brood.position = "absolute"),
(brood.display = "block"),
(brood.width = booby._w + 1 + "px"),
(brood.height = booby._h + "px")),
!cataract && causeway)
)
if (booby._isSplit)
for (
booby._next = bole = booby.nextSibling,
booby.parentNode.appendChild(booby);
bole && bole.nodeType === 3 && " " === bole.textContent;
)
(booby._next = bole.nextSibling),
booby.parentNode.appendChild(bole),
(bole = bole.nextSibling);
else
booby.parentNode._isSplit
? ((booby._parent = booby.parentNode),
!booby.previousSibling &&
booby.firstChild &&
(booby.firstChild._isFirst = true),
booby.nextSibling &&
" " === booby.nextSibling.textContent &&
!booby.nextSibling.nextSibling &&
charger.push(booby.nextSibling),
(booby._next =
booby.nextSibling && booby.nextSibling._isFirst
? null
: booby.nextSibling),
booby.parentNode.removeChild(booby),
boon.splice(blazoned--, 1),
bond--)
: brakes ||
((bulwark =
!booby.nextSibling &&
cloven(booby.parentNode, beset, canker)),
booby.parentNode._parent &&
booby.parentNode._parent.appendChild(booby),
bulwark &&
booby.parentNode.appendChild(document.createTextNode(" ")),
"span" === carcanet && (booby.style.display = "inline"),
burnished.push(booby));
else
booby.parentNode._isSplit && !booby._isSplit && "" !== booby.innerHTML
? byre.push(booby)
: causeway &&
!booby._isSplit &&
("span" === carcanet && (booby.style.display = "inline"),
burnished.push(booby));
else
carven || cesspool
? (booby.parentNode && booby.parentNode.removeChild(booby),
boon.splice(blazoned--, 1),
bond--)
: cataract || beset.appendChild(booby);
for (blazoned = charger.length; -1 < --blazoned; )
charger[blazoned].parentNode.removeChild(charger[blazoned]);
if (carven) {
for (
cesspool &&
((brook = document.createElement(carcanet)),
beset.appendChild(brook),
(buckler = brook.offsetWidth + "px"),
(bulwark = brook.offsetParent === beset ? 0 : beset.offsetLeft),
beset.removeChild(brook)),
brood = beset.style.cssText,
beset.style.cssText = "display:none;";
beset.firstChild;
)
beset.removeChild(beset.firstChild);
for (
brock = " " === canker && (!cesspool || (!cataract && !causeway)),
blazoned = 0;
blazoned < carven.length;
blazoned++
) {
for (
brazen = carven[blazoned],
(brook = document.createElement(carcanet)).style.cssText =
"display:block;text-align:" +
burgeon +
";position:" +
(cesspool ? "absolute;" : "relative;"),
chalcedony &&
(brook.className = chalcedony + (champ ? blazoned + 1 : "")),
cairn.push(brook),
bond = brazen.length,
bole = 0;
bole < bond;
bole++
)
"BR" !== brazen[bole].nodeName &&
((booby = brazen[bole]),
brook.appendChild(booby),
brock &&
booby._wordEnd &&
brook.appendChild(document.createTextNode(" ")),
cesspool &&
(bole === 0 &&
((brook.style.top = booby._y + "px"),
(brook.style.left = paddingLeft + bulwark + "px")),
(booby.style.top = "0px"),
bulwark && (booby.style.left = booby._x - bulwark + "px")));
bond === 0
? (brook.innerHTML = "&nbsp;")
: cataract ||
causeway ||
(chine(brook), coney(brook, String.fromCharCode(160), " ")),
cesspool &&
((brook.style.width = buckler),
(brook.style.height = booby._h + "px")),
beset.appendChild(brook);
}
beset.style.cssText = brood;
}
cesspool &&
(bivouac > beset.clientHeight &&
((beset.style.height = bivouac - horizontalPadding + "px"),
beset.clientHeight < bivouac &&
(beset.style.height = bivouac + horizontalBorderWidth + "px")),
billow > beset.clientWidth &&
((beset.style.width = billow - verticalPadding + "px"),
beset.clientWidth < billow &&
(beset.style.width = billow + verticalBorderWidth + "px"))),
chestnut &&
(chime
? (beset.style.display = chime)
: beset.style.removeProperty("display")),
commons(besotted, burnished),
cataract && commons(besought, byre),
commons(bier, cairn);
}
function tagify(abide, abjure, abroad, adamant) {
var afield,
aforetime,
aghast,
agin,
aloof,
amiss,
anon,
apace,
argent = abjure.tag ? abjure.tag : abjure.span ? "span" : "div",
arrassed =
(abjure.type || abjure.split || "chars,words,lines").indexOf("chars") >=
0,
askance = abjure.position === "absolute" || abjure.absolute,
assuage = abjure.wordDelimiter || " ",
astonied = " " !== assuage ? "" : askance ? "&#173; " : " ",
attercop = "</" + argent + ">",
aught = 1,
aumbry = abjure.specialChars
? "function" == typeof abjure.specialChars
? abjure.specialChars
: errantry
: null,
bade = document.createElement("div"),
baldric = abide.parentNode;
for (
baldric.insertBefore(bade, abide),
bade.textContent = abide.nodeValue,
baldric.removeChild(abide),
anon =
(afield = (function getText(abide) {
var eaves = abide.nodeType,
abjure = "";
if (eaves === 1 || eaves === 9 || eaves === 11) {
if ("string" == typeof abide.textContent)
return abide.textContent;
for (abide = abide.firstChild; abide; abide = abide.nextSibling)
abjure += getText(abide);
} else if (eaves === 3 || eaves === 4) return abide.nodeValue;
return abjure;
})((abide = bade))).indexOf("<") !== -1,
!!abjure.reduceWhiteSpace &&
(afield = afield.replace(cunning, " ").replace(linebreakRegex, "")),
anon && (afield = afield.split("<").join("{{LT}}")),
aloof = afield.length,
aforetime = (" " === afield.charAt(0) ? astonied : "") + abroad(),
aghast = 0;
aghast < aloof;
aghast++
)
if (
((amiss = afield.charAt(aghast)),
aumbry && (apace = aumbry(afield.substr(aghast), abjure.specialChars)))
)
(amiss = afield.substr(aghast, apace || 1)),
(aforetime +=
arrassed && " " !== amiss
? adamant() + amiss + "</" + argent + ">"
: amiss),
(aghast += apace - 1);
else if (
amiss === assuage &&
afield.charAt(aghast - 1) !== assuage &&
aghast
) {
for (
aforetime += aught ? attercop : "", aught = 0;
afield.charAt(aghast + 1) === assuage;
)
(aforetime += astonied), aghast++;
aghast === aloof - 1
? (aforetime += astonied)
: ")" !== afield.charAt(aghast + 1) &&
((aforetime += astonied + abroad()), (aught = 1));
} else
"{" === amiss && "{{LT}}" === afield.substr(aghast, 6)
? ((aforetime += arrassed
? adamant() + "{{LT}}</" + argent + ">"
: "{{LT}}"),
(aghast += 5))
: (55296 <= amiss.charCodeAt(0) && amiss.charCodeAt(0) <= 56319) ||
(65024 <= afield.charCodeAt(aghast + 1) &&
afield.charCodeAt(aghast + 1) <= 65039)
? ((agin =
((afield.substr(aghast, 12).split(unicodeRegex) || [])[1] || "")
.length || 2),
(aforetime +=
arrassed && " " !== amiss
? adamant() + afield.substr(aghast, agin) + "</" + argent + ">"
: afield.substr(aghast, agin)),
(aghast += agin - 1))
: (aforetime +=
arrassed && " " !== amiss
? adamant() + amiss + "</" + argent + ">"
: amiss);
(abide.outerHTML = aforetime + (aught ? attercop : "")),
anon && coney(baldric, "{{LT}}", "<");
}
function bent(bannock, barrel, baseborn, bason) {
var bay,
bebother,
befall = splitNodes(bannock.childNodes),
belie = befall.length,
benighted = barrel.position === "absolute" || barrel.absolute;
if (3 !== bannock.nodeType || 1 < belie) {
for (barrel.absolute = false, bay = 0; bay < belie; bay++)
((bebother = befall[bay])._next =
bebother._isFirst =
bebother._parent =
bebother._wordEnd =
null),
(bebother.nodeType === 3 && !/\S+/.test(bebother.nodeValue)) ||
(benighted &&
3 !== bebother.nodeType &&
"inline" === window.getComputedStyle(bebother).display &&
((bebother.style.display = "inline-block"),
(bebother.style.position = "relative")),
(bebother._isSplit = true),
bent(bebother, barrel, baseborn, bason));
return (barrel.absolute = benighted), void (bannock._isSplit = true);
}
tagify(bannock, barrel, baseborn, bason);
}
var craven,
cumbrous,
linebreakRegex = /(?:\r|\n|\t\t)/g,
cunning = /(?:\s\s+)/g,
devices,
dell =
(((cumbrous = SplitText.prototype).split = function split(divers) {
this.isSplit && this.revert(),
(this.vars = devices = divers || this.vars),
(this._originals.length =
this.chars.length =
this.words.length =
this.lines.length =
0);
for (
var cur,
curdle,
dainty,
darkling = this.elements.length,
crocks = devices.tag ? devices.tag : devices.span ? "span" : "div",
culvert = cools(devices.wordsClass, crocks),
dastard = cools(devices.charsClass, crocks);
-1 < --darkling;
)
(dainty = this.elements[darkling]),
(this._originals[darkling] = dainty.innerHTML),
(cur = dainty.clientHeight),
(curdle = dainty.clientWidth),
bent(dainty, devices, culvert, dastard),
billow(
dainty,
devices,
this.chars,
this.words,
this.lines,
curdle,
cur
);
return (
this.chars.reverse(),
this.words.reverse(),
this.lines.reverse(),
(this.isSplit = true),
this
);
}),
(cumbrous.revert = function revert() {
var declaim = this._originals;
if (!declaim) throw "revert() call wasn't scoped properly.";
return (
this.elements.forEach(function (defray, defile) {
return (defray.innerHTML = declaim[defile]);
}),
(this.chars = []),
(this.words = []),
(this.lines = []),
(this.isSplit = false),
this
);
}),
(SplitText.create = function create(descry, dingle) {
return new SplitText(descry, dingle);
}),
SplitText);
function SplitText(covetice, cozen) {
craven ||
(function _initCore() {
craven = 1;
})(),
(this.elements = splitNodes(covetice)),
(this.chars = []),
(this.words = []),
(this.lines = []),
(this._originals = []),
(this.vars = cozen || {}),
this.split(cozen);
}
deem.SplitText = dell;
if (typeof window === "undefined" || window !== deem) {
deem.default = dell;
Object.defineProperty(deem, "__esModule", { value: true });
}
return deem;
}
if (typeof exports == "object" && typeof module != "undefined") {
main(exports);
} else if ("function" == typeof define && define.amd) {
define(["exports"], main);
} else {
main(((this || self).window = this.window || {}));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment