Created
October 17, 2022 17:17
-
-
Save CodeByAidan/c495003f0c8dde7b96f6d13fce4d5965 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var getElementsByClassName = function(e, s, t) { | |
return (getElementsByClassName = document.getElementsByClassName ? function(e, s, t) { | |
for (var a, n = (t = t || document) | |
.getElementsByClassName(e), c = s ? new RegExp("\\b" + s + "\\b", "i") : null, r = [], l = 0, i = n.length; l < i; l += 1) a = n[l], c && !c.test(a.nodeName) || r.push(a); | |
return r | |
} : document.evaluate ? function(e, s, t) { | |
s = s || "*", t = t || document; | |
for (var a, n, c = e.split(" "), r = "", l = "http://www.w3.org/1999/xhtml", i = document.documentElement.namespaceURI === l ? l : null, o = [], u = 0, h = c.length; u < h; u += 1) r += "[contains(concat(' ', @class, ' '), ' " + c[u] + " ')]"; | |
try { | |
a = document.evaluate(".//" + s + r, t, i, 0, null) | |
} catch (m) { | |
a = document.evaluate(".//" + s + r, t, null, 0, null) | |
} | |
for (; n = a.iterateNext();) o.push(n); | |
return o | |
} : function(e, s, t) { | |
s = s || "*", t = t || document; | |
for (var a, n, c = e.split(" "), r = [], l = "*" === s && t.all ? t.all : t.getElementsByTagName(s), i = [], o = 0, u = c.length; o < u; o += 1) r.push(new RegExp("(^|\\s)" + c[o] + "(\\s|$)")); | |
for (var h = 0, m = l.length; h < m; h += 1) { | |
a = l[h], n = !1; | |
for (var g = 0, d = r.length; g < d && (n = r[g].test(a.className)); g += 1); | |
n && i |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment