Created
September 25, 2022 11:55
-
-
Save extratone/2d43d718c5b9001737886f9dda14f281 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
!(function (t) { | |
function e(n) { | |
if (i[n]) return i[n].exports; | |
var o = (i[n] = { exports: {}, id: n, loaded: !1 }); | |
return t[n].call(o.exports, o, o.exports, e), (o.loaded = !0), o.exports; | |
} | |
var i = {}; | |
return (e.m = t), (e.c = i), (e.p = ""), e(0); | |
})([ | |
function (t, e, i) { | |
t.exports = i(1); | |
}, | |
function (t, e, i) { | |
"use strict"; | |
var n = i(2), | |
o = i(6), | |
s = i(7); | |
!(function () { | |
function t(t, e) { | |
return new RegExp("(\\s|^)" + e + "(\\s|$)").test(t.className); | |
} | |
function e(e, i) { | |
e.classList ? e.classList.add(i) : t(e, i) || (e.className += " " + i); | |
} | |
function i(t, e, i) { | |
var n; | |
3 === arguments.length | |
? (n = e + ":" + i + ";") | |
: 2 === arguments.length && "string" == typeof e && (n = e); | |
var o = t.style; | |
n && (o.cssText += ";" + n), (n = e); | |
for (var s in n) | |
o[ | |
"float" === s || "cssFloat" === s | |
? "undefined" == typeof o.styleFloat | |
? "cssFloat" | |
: "styleFloat" | |
: s | |
] = n[s]; | |
} | |
function r(t, e) { | |
var i = ""; | |
for (var n in e) { | |
var o = e[n]; | |
i += encodeURIComponent(n) + "=" + encodeURIComponent(o) + "&"; | |
} | |
return i.length > 0 && ((i = i.substring(0, i.length - 1)), (t = t + "?" + i)), t; | |
} | |
function c(t) { | |
for ( | |
var e = [/^((http|https):)?\/\/([\w\.-]+\.)?tumblr\.(com|net)(:[0-9]+)?(\/.*)?$/i], | |
i = 0, | |
n = e.length; | |
i < n; | |
i++ | |
) | |
if (e[i].test(t)) return !0; | |
return !1; | |
} | |
function a(t) { | |
function o() { | |
var t = new n({ namespace: "tumblr-post", iframe: u, origin: "*" }); | |
t.listen_to("sizeChange", function (t) { | |
u.height = t; | |
}), | |
i(u, { visibility: "visible" }), | |
e(u, "tumblr-embed-loaded"); | |
var o = s.create(u); | |
o.enterViewport(function () { | |
t.call("loadPostGifs"); | |
}); | |
} | |
var a, | |
h = {}, | |
p = 542; | |
if (t && (a = t.getAttribute("data-href")) && c(a) && !l) { | |
var d = parseInt(t.getAttribute("data-width"), 10) || p; | |
(h.width = d), | |
(h.language = t.getAttribute("data-language") || "en_US"), | |
(h.did = t.getAttribute("data-did") || null); | |
var u = document.createElement("iframe"); | |
u.setAttribute("title", "Tumblr post"), | |
u.setAttribute("frameborder", 0), | |
u.setAttribute("allowfullscreen", !0), | |
(u.src = r(a, h)), | |
e(u, "tumblr-embed"), | |
i(u, { | |
display: "block", | |
padding: "0", | |
margin: "10px 0", | |
border: "none", | |
visibility: "hidden", | |
width: d + "px", | |
minHeight: "200px", | |
maxWidth: "100%", | |
}), | |
u.attachEvent | |
? u.attachEvent("onload", function () { | |
o(); | |
}) | |
: (u.onload = function () { | |
o(); | |
}), | |
t.parentNode.replaceChild(u, t); | |
} | |
} | |
function h() { | |
for (var t = document.querySelectorAll(".tumblr-post"), e = 0, i = t.length; e < i; e++) a(t[e]); | |
} | |
var l = !window.addEventListener; | |
!(function () { | |
var t = window.tumblr || {}; | |
(t.embed = t.embed || {}), | |
o(function () { | |
h(); | |
}); | |
})(); | |
})(); | |
}, | |
function (t, e, i) { | |
"use strict"; | |
function n(t) { | |
return ( | |
"string" == typeof t || | |
(t && "object" === ("undefined" == typeof t ? "undefined" : a(t)) && "[object String]" === u.call(t)) || | |
!1 | |
); | |
} | |
function o() { | |
var t = new w(); | |
return (t.cid = m), (m += 1), (v[t.cid] = t), t; | |
} | |
function s(t, e) { | |
for (var i, n = g.length - 1; n >= 0; n--) g[n].message_callback(t, e); | |
for (n = y.length - 1; n >= 0; n--) (i = y[n]), i && i.shouldRespond && i.shouldRespond(t, e) && i.cb(t, e); | |
} | |
function r(t) { | |
if ((t || (t = {}), !(l && l.stringify && l.parse))) throw "Must have JSON parsing and stringify"; | |
if (t.iframe && ((t.window = t.iframe.contentWindow), !t.origin)) { | |
var e = t.iframe.src, | |
i = e.match(/^(http(?:s)?:\/\/[\w_\-\.]+(?::\d+)?)\/?/); | |
i && (t.origin = i[1]); | |
} | |
(this.namespace = t.namespace ? t.namespace + ":" : ""), | |
(this.origin = t.origin || "*"), | |
(this.responders = { _method_callback_responder: _, _syn: d(this._syn, this) }), | |
(this._on_connected = new f()), | |
(this._unanswered_calls = {}), | |
this.on_connection(d(this.enable_sending_post_message, this)), | |
g.push(this), | |
t.window && this.setWindow(t.window); | |
} | |
function c(t, e, i) { | |
i || (i = this.origin), t.postMessage(e, i); | |
} | |
var a = | |
"function" == typeof Symbol && "symbol" == typeof Symbol.iterator | |
? function (t) { | |
return typeof t; | |
} | |
: function (t) { | |
return t && | |
"function" == typeof Symbol && | |
t.constructor === Symbol && | |
t !== Symbol.prototype | |
? "symbol" | |
: typeof t; | |
}, | |
h = i(3), | |
l = h("JSON", function (t) { | |
return t && t.stringify; | |
}), | |
p = [].slice, | |
d = function (t, e) { | |
return function () { | |
return t.apply(e, arguments); | |
}; | |
}, | |
u = Object.prototype.toString, | |
f = i(4), | |
w = i(5), | |
m = 1, | |
v = {}, | |
g = [], | |
y = []; | |
!(function () { | |
var t = window.addEventListener ? "addEventListener" : "attachEvent", | |
e = window[t], | |
i = "attachEvent" === t ? "onmessage" : "message"; | |
e( | |
i, | |
function (t) { | |
var e; | |
if ("string" == typeof t.data) { | |
try { | |
t.data && "{" === t.data[0] && (e = l.parse(t.data)); | |
} catch (t) {} | |
e && e.method && s(t, e); | |
} | |
}, | |
!1 | |
); | |
})(); | |
var _ = function (t) { | |
if (t.cid_response && t.cid_response in v) { | |
var e = v[t.cid_response]; | |
e.resolve.call(null, this, t.response), delete v[t.cid_response]; | |
} | |
}; | |
(r.prototype.setWindow = function (t) { | |
if (t) { | |
this.window = t; | |
var e = this.call("_syn"); | |
e.then( | |
d(function (t, e) { | |
"ack" === e && this._is_connected(); | |
}, this) | |
); | |
} | |
}), | |
(r.on = function (t, e) { | |
var i; | |
(i = | |
"*" === t | |
? function () { | |
return !0; | |
} | |
: "*" === t[t.length - 1] | |
? function (e, i) { | |
return 0 === i.method.indexOf(t.substring(0, t.length - 2)); | |
} | |
: function (e, i) { | |
return i.method === t; | |
}), | |
y.push({ shouldRespond: i, cb: e }); | |
}), | |
(r.off = function (t) { | |
for (var e, i = y.length - 1; i >= 0; i--) | |
if (y[i].cb === t) { | |
e = i; | |
break; | |
} | |
return !!(e && e > -1) && (y.splice(e, 1), !0); | |
}), | |
(r.prototype.match_origin = function (t) { | |
return "*" === this.origin || this.origin === t; | |
}), | |
(r.prototype.message_callback = function (t, e) { | |
var i; | |
if ((!this.window || t.source === this.window) && this.match_origin(t.origin)) { | |
if ( | |
(e.method && | |
e.method.slice(0, this.namespace.length) === this.namespace && | |
(i = e.method.slice(this.namespace.length, e.method.length)), | |
e.args && n(e.args)) | |
) | |
try { | |
e.args = l.parse(e.args); | |
} catch (t) { | |
return; | |
} | |
this.call_responder(i, t, e); | |
} | |
}), | |
(r.prototype.call_responder = function (t, e, i) { | |
var n, o; | |
if (t) { | |
if ((i.args || (i.args = []), (o = this.responders[t]), !o)) | |
return ( | |
this._unanswered_calls[t] || (this._unanswered_calls[t] = []), | |
void this._unanswered_calls[t].push(arguments) | |
); | |
(n = o.apply(e, i.args)), | |
i.cid && | |
"_method_callback_responder" !== t && | |
this.send_to_window(e.source, "_method_callback_responder", { | |
cid_response: i.cid, | |
response: n, | |
}); | |
} | |
}), | |
(r.prototype._syn = function () { | |
return this._is_connected(), "ack"; | |
}), | |
(r.prototype._is_connected = function () { | |
this.connected || ((this.connected = !0), this._on_connected.trigger(this)); | |
}), | |
(r.prototype.on_connection = function (t) { | |
return this._on_connected.push.apply(this._on_connected, arguments), this; | |
}), | |
(r.prototype.method = function t(e) { | |
var i = this, | |
t = function () { | |
var t = 1 <= arguments.length ? p.call(arguments, 0) : []; | |
return t.unshift(e), i.send.apply(i, t); | |
}; | |
return t; | |
}), | |
(r.prototype.call = function () { | |
var t = 1 <= arguments.length ? p.call(arguments, 0) : []; | |
return this.window | |
? (t.unshift(this.window), this.call_on_window.apply(this, t)) | |
: void console.warn("no window specified on channel"); | |
}), | |
(r.prototype.call_on_window = function (t, e) { | |
var i = 3 <= arguments.length ? p.call(arguments, 2) : [], | |
n = o(); | |
try { | |
var s = l.stringify({ method: this.namespace + e, args: i, cid: n.cid }); | |
"_syn" === e || "_method_callback_responder" === e | |
? c.call(this, t, s) | |
: this.send_post_message(t, s); | |
} catch (t) { | |
n.reject(t); | |
} | |
return n.promise(); | |
}), | |
(r.prototype.send = function () { | |
var t = 1 <= arguments.length ? p.call(arguments, 0) : []; | |
return this.window | |
? (t.unshift(this.window), this.send_to_window.apply(this, t)) | |
: void console.warn("no window specified on channel"); | |
}), | |
(r.prototype.send_to_window = function (t, e) { | |
var i = 3 <= arguments.length ? p.call(arguments, 2) : [], | |
n = l.stringify({ method: this.namespace + e, args: i }); | |
"_syn" === e || "_method_callback_responder" === e ? c.call(this, t, n) : this.send_post_message(t, n); | |
}), | |
(r.prototype.send_post_message = function () { | |
this._delayed_sent_messages || (this._delayed_sent_messages = []), | |
this._delayed_sent_messages.push(arguments); | |
}), | |
(r.prototype.enable_sending_post_message = function () { | |
if (((this.send_post_message = c), this._delayed_sent_messages)) { | |
for (var t = 0; t < this._delayed_sent_messages.length; t += 1) | |
c.apply(this, this._delayed_sent_messages[t]); | |
delete this._delayed_sent_messages; | |
} | |
}), | |
(r.prototype.listening_to = function (t) { | |
return t in this.responders; | |
}), | |
(r.prototype.listen_to = function (t, e, i) { | |
if (n(t)) { | |
if (t in this.responders) | |
return void console.warn("already listening to this method, turn it off first"); | |
if ((i && (e = d(e, i)), (this.responders[t] = e), this._unanswered_calls[t])) { | |
var o, | |
s = this._unanswered_calls[t]; | |
delete this._unanswered_calls[t]; | |
for (var r = 0; r < s.length; r += 1) (o = s[r]), this.call_responder.apply(this, o); | |
} | |
} else { | |
var c = t; | |
for (t in c) c.hasOwnProperty(t) && this.listen_to(t, c[t], i); | |
} | |
}), | |
(r.prototype.stop_listen_to = function (t) { | |
return "_method_callback_responder" === t | |
? void console.warn("cannot disable the method callback responder") | |
: void delete this.responders[t]; | |
}), | |
(r.prototype.ensureChannelConnection = function (t) { | |
this.send_to_window(t, "_syn"); | |
}), | |
(t.exports = r); | |
}, | |
function (t, e) { | |
"use strict"; | |
function i(t, e) { | |
if (t in n) return n[t]; | |
var i = window[t]; | |
if (!e || !e(i)) { | |
var o = document.createElement("iframe"); | |
document.body.appendChild(o), (i = o.contentWindow[t]), document.body.removeChild(o); | |
} | |
return (n[t] = i), i; | |
} | |
var n = {}; | |
t.exports = i; | |
}, | |
function (t, e) { | |
"use strict"; | |
function i() { | |
this.length = 0; | |
} | |
var n = [].slice, | |
o = [].push; | |
(i.prototype = { slice: n, indexOf: Array.prototype.indexOf }), | |
(i.prototype.push = function () { | |
if (this.triggered_with) | |
for (var t = 1 <= arguments.length ? n.call(arguments, 0) : [], e = 0; e < t.length; e += 1) | |
t[e].apply(null, this.triggered_with); | |
return o.apply(this, arguments); | |
}), | |
(i.prototype.trigger = function () { | |
var t = 1 <= arguments.length ? n.call(arguments, 0) : [], | |
e = this.length; | |
this.triggered_with = t; | |
for (var i = 0; i < e; i += 1) this[i].apply(null, this.triggered_with); | |
return this; | |
}), | |
(t.exports = i); | |
}, | |
function (t, e, i) { | |
"use strict"; | |
function n() { | |
(this._on_resolved = new r()), | |
(this._on_rejected = new r()), | |
(this.then = s(this.then, this)), | |
(this.fail = s(this.fail, this)), | |
(this.resolve = s(this.resolve, this)), | |
(this.reject = s(this.reject, this)); | |
} | |
var o = [].slice, | |
s = function (t, e) { | |
return function () { | |
return t.apply(e, arguments); | |
}; | |
}, | |
r = i(4); | |
(n.prototype.then = function () { | |
return this._on_resolved.push.apply(this._on_resolved, arguments), this; | |
}), | |
(n.prototype.success = n.prototype.then), | |
(n.prototype.fail = function () { | |
return this._on_resolved.push.apply(this._on_rejected, arguments), this; | |
}), | |
(n.prototype.resolve = function () { | |
if (!this.resolved && !this.rejected) | |
return this._on_resolved.trigger.apply(this._on_resolved, arguments), (this.resolved = !0), this; | |
}), | |
(n.prototype.reject = function () { | |
if (!this.resolved && !this.rejected) | |
return this._on_rejected.trigger.apply(this._on_rejected, arguments), (this.rejected = !0), this; | |
}), | |
(n.prototype.reject_timeout = function () { | |
var t = 1 <= arguments.length ? o.call(arguments, 0) : [], | |
e = t.shift(); | |
return ( | |
setTimeout( | |
s(function () { | |
this.reject.apply(this, t); | |
}, this), | |
e | |
), | |
this | |
); | |
}), | |
(n.prototype.promise = function () { | |
function t() { | |
var t = this; | |
(this.fail = function () { | |
return e.fail.apply(e, arguments), t; | |
}), | |
(this.then = function () { | |
return e.then.apply(e, arguments), t; | |
}), | |
(this.success = this.then), | |
(this.reject_timeout = function () { | |
return e.reject_timeout.apply(e, arguments), t; | |
}), | |
(this.cid = e.cid); | |
} | |
var e = this; | |
return new t(); | |
}), | |
(t.exports = n); | |
}, | |
function (t, e) { | |
"use strict"; | |
function i(t) { | |
function e() { | |
s.removeEventListener("DOMContentLoaded", e), t(); | |
} | |
s.addEventListener("DOMContentLoaded", e); | |
} | |
function n(t) { | |
o || (o = /^loaded|^i|^c/.test(s.readyState)), o ? setTimeout(t) : i(t); | |
} | |
var o, | |
s = document; | |
t.exports = n; | |
}, | |
function (t, e, i) { | |
!(function (e, i) { | |
t.exports = i(); | |
})(this, function () { | |
return (function (t) { | |
function e(n) { | |
if (i[n]) return i[n].exports; | |
var o = (i[n] = { exports: {}, id: n, loaded: !1 }); | |
return t[n].call(o.exports, o, o.exports, e), (o.loaded = !0), o.exports; | |
} | |
var i = {}; | |
return (e.m = t), (e.c = i), (e.p = ""), e(0); | |
})([ | |
function (t, e, i) { | |
"use strict"; | |
var n = i(1), | |
o = n.isInBrowser, | |
s = i(2), | |
r = new s(o ? document.body : null); | |
r.setStateFromDOM(null), r.listenToDOM(), o && (window.scrollMonitor = r), (t.exports = r); | |
}, | |
function (t, e) { | |
"use strict"; | |
(e.VISIBILITYCHANGE = "visibilityChange"), | |
(e.ENTERVIEWPORT = "enterViewport"), | |
(e.FULLYENTERVIEWPORT = "fullyEnterViewport"), | |
(e.EXITVIEWPORT = "exitViewport"), | |
(e.PARTIALLYEXITVIEWPORT = "partiallyExitViewport"), | |
(e.LOCATIONCHANGE = "locationChange"), | |
(e.STATECHANGE = "stateChange"), | |
(e.eventTypes = [ | |
e.VISIBILITYCHANGE, | |
e.ENTERVIEWPORT, | |
e.FULLYENTERVIEWPORT, | |
e.EXITVIEWPORT, | |
e.PARTIALLYEXITVIEWPORT, | |
e.LOCATIONCHANGE, | |
e.STATECHANGE, | |
]), | |
(e.isOnServer = "undefined" == typeof window), | |
(e.isInBrowser = !e.isOnServer), | |
(e.defaultOffsets = { top: 0, bottom: 0 }); | |
}, | |
function (t, e, i) { | |
"use strict"; | |
function n(t, e) { | |
if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function"); | |
} | |
function o(t) { | |
return a | |
? 0 | |
: t === document.body | |
? window.innerHeight || document.documentElement.clientHeight | |
: t.clientHeight; | |
} | |
function s(t) { | |
return a | |
? 0 | |
: t === document.body | |
? Math.max( | |
document.body.scrollHeight, | |
document.documentElement.scrollHeight, | |
document.body.offsetHeight, | |
document.documentElement.offsetHeight, | |
document.documentElement.clientHeight | |
) | |
: t.scrollHeight; | |
} | |
function r(t) { | |
return a | |
? 0 | |
: t === document.body | |
? window.pageYOffset || | |
(document.documentElement && document.documentElement.scrollTop) || | |
document.body.scrollTop | |
: t.scrollTop; | |
} | |
var c = i(1), | |
a = c.isOnServer, | |
h = c.isInBrowser, | |
l = c.eventTypes, | |
p = i(3), | |
d = (function () { | |
function t(e, i) { | |
function c() { | |
if ( | |
((h.viewportTop = r(e)), | |
(h.viewportBottom = h.viewportTop + h.viewportHeight), | |
(h.documentHeight = s(e)), | |
h.documentHeight !== p) | |
) { | |
for (d = h.watchers.length; d--; ) h.watchers[d].recalculateLocation(); | |
p = h.documentHeight; | |
} | |
} | |
function a() { | |
for (u = h.watchers.length; u--; ) h.watchers[u].update(); | |
for (u = h.watchers.length; u--; ) h.watchers[u].triggerCallbacks(); | |
} | |
n(this, t); | |
var h = this; | |
(this.item = e), | |
(this.watchers = []), | |
(this.viewportTop = null), | |
(this.viewportBottom = null), | |
(this.documentHeight = s(e)), | |
(this.viewportHeight = o(e)), | |
(this.DOMListener = function () { | |
t.prototype.DOMListener.apply(h, arguments); | |
}), | |
(this.eventTypes = l), | |
i && (this.containerWatcher = i.create(e)); | |
var p, d, u; | |
(this.update = function () { | |
c(), a(); | |
}), | |
(this.recalculateLocations = function () { | |
(this.documentHeight = 0), this.update(); | |
}); | |
} | |
return ( | |
(t.prototype.listenToDOM = function () { | |
h && | |
(window.addEventListener | |
? (this.item === document.body | |
? window.addEventListener("scroll", this.DOMListener) | |
: this.item.addEventListener("scroll", this.DOMListener), | |
window.addEventListener("resize", this.DOMListener)) | |
: (this.item === document.body | |
? window.attachEvent("onscroll", this.DOMListener) | |
: this.item.attachEvent("onscroll", this.DOMListener), | |
window.attachEvent("onresize", this.DOMListener)), | |
(this.destroy = function () { | |
window.addEventListener | |
? (this.item === document.body | |
? (window.removeEventListener("scroll", this.DOMListener), | |
this.containerWatcher.destroy()) | |
: this.item.removeEventListener("scroll", this.DOMListener), | |
window.removeEventListener("resize", this.DOMListener)) | |
: (this.item === document.body | |
? (window.detachEvent("onscroll", this.DOMListener), | |
this.containerWatcher.destroy()) | |
: this.item.detachEvent("onscroll", this.DOMListener), | |
window.detachEvent("onresize", this.DOMListener)); | |
})); | |
}), | |
(t.prototype.destroy = function () {}), | |
(t.prototype.DOMListener = function (t) { | |
this.setStateFromDOM(t); | |
}), | |
(t.prototype.setStateFromDOM = function (t) { | |
var e = r(this.item), | |
i = o(this.item), | |
n = s(this.item); | |
this.setState(e, i, n, t); | |
}), | |
(t.prototype.setState = function (t, e, i, n) { | |
var o = e !== this.viewportHeight || i !== this.contentHeight; | |
if ( | |
((this.latestEvent = n), | |
(this.viewportTop = t), | |
(this.viewportHeight = e), | |
(this.viewportBottom = t + e), | |
(this.contentHeight = i), | |
o) | |
) | |
for (var s = this.watchers.length; s--; ) | |
this.watchers[s].recalculateLocation(); | |
this.updateAndTriggerWatchers(n); | |
}), | |
(t.prototype.updateAndTriggerWatchers = function (t) { | |
for (var e = this.watchers.length; e--; ) this.watchers[e].update(); | |
for (e = this.watchers.length; e--; ) this.watchers[e].triggerCallbacks(t); | |
}), | |
(t.prototype.createCustomContainer = function () { | |
return new t(); | |
}), | |
(t.prototype.createContainer = function (e) { | |
"string" == typeof e | |
? (e = document.querySelector(e)) | |
: e && e.length > 0 && (e = e[0]); | |
var i = new t(e, this); | |
return i.setStateFromDOM(), i.listenToDOM(), i; | |
}), | |
(t.prototype.create = function (t, e) { | |
"string" == typeof t | |
? (t = document.querySelector(t)) | |
: t && t.length > 0 && (t = t[0]); | |
var i = new p(this, t, e); | |
return this.watchers.push(i), i; | |
}), | |
(t.prototype.beget = function (t, e) { | |
return this.create(t, e); | |
}), | |
t | |
); | |
})(); | |
t.exports = d; | |
}, | |
function (t, e, i) { | |
"use strict"; | |
function n(t, e, i) { | |
function n(t, e) { | |
if (0 !== t.length) | |
for (_ = t.length; _--; ) | |
(b = t[_]), b.callback.call(o, e, o), b.isOne && t.splice(_, 1); | |
} | |
var o = this; | |
(this.watchItem = e), | |
(this.container = t), | |
i | |
? i === +i | |
? (this.offsets = { top: i, bottom: i }) | |
: (this.offsets = { top: i.top || u.top, bottom: i.bottom || u.bottom }) | |
: (this.offsets = u), | |
(this.callbacks = {}); | |
for (var f = 0, w = d.length; f < w; f++) o.callbacks[d[f]] = []; | |
this.locked = !1; | |
var m, v, g, y, _, b; | |
(this.triggerCallbacks = function (t) { | |
switch ( | |
(this.isInViewport && !m && n(this.callbacks[r], t), | |
this.isFullyInViewport && !v && n(this.callbacks[c], t), | |
this.isAboveViewport !== g && | |
this.isBelowViewport !== y && | |
(n(this.callbacks[s], t), | |
v || this.isFullyInViewport || (n(this.callbacks[c], t), n(this.callbacks[h], t)), | |
m || this.isInViewport || (n(this.callbacks[r], t), n(this.callbacks[a], t))), | |
!this.isFullyInViewport && v && n(this.callbacks[h], t), | |
!this.isInViewport && m && n(this.callbacks[a], t), | |
this.isInViewport !== m && n(this.callbacks[s], t), | |
!0) | |
) { | |
case m !== this.isInViewport: | |
case v !== this.isFullyInViewport: | |
case g !== this.isAboveViewport: | |
case y !== this.isBelowViewport: | |
n(this.callbacks[p], t); | |
} | |
(m = this.isInViewport), | |
(v = this.isFullyInViewport), | |
(g = this.isAboveViewport), | |
(y = this.isBelowViewport); | |
}), | |
(this.recalculateLocation = function () { | |
if (!this.locked) { | |
var t = this.top, | |
e = this.bottom; | |
if (this.watchItem.nodeName) { | |
var i = this.watchItem.style.display; | |
"none" === i && (this.watchItem.style.display = ""); | |
for (var o = 0, s = this.container; s.containerWatcher; ) | |
(o += s.containerWatcher.top - s.containerWatcher.container.viewportTop), | |
(s = s.containerWatcher.container); | |
var r = this.watchItem.getBoundingClientRect(); | |
(this.top = r.top + this.container.viewportTop - o), | |
(this.bottom = r.bottom + this.container.viewportTop - o), | |
"none" === i && (this.watchItem.style.display = i); | |
} else | |
this.watchItem === +this.watchItem | |
? this.watchItem > 0 | |
? (this.top = this.bottom = this.watchItem) | |
: (this.top = this.bottom = | |
this.container.documentHeight - this.watchItem) | |
: ((this.top = this.watchItem.top), (this.bottom = this.watchItem.bottom)); | |
(this.top -= this.offsets.top), | |
(this.bottom += this.offsets.bottom), | |
(this.height = this.bottom - this.top), | |
(void 0 === t && void 0 === e) || | |
(this.top === t && this.bottom === e) || | |
n(this.callbacks[l], null); | |
} | |
}), | |
this.recalculateLocation(), | |
this.update(), | |
(m = this.isInViewport), | |
(v = this.isFullyInViewport), | |
(g = this.isAboveViewport), | |
(y = this.isBelowViewport); | |
} | |
var o = i(1), | |
s = o.VISIBILITYCHANGE, | |
r = o.ENTERVIEWPORT, | |
c = o.FULLYENTERVIEWPORT, | |
a = o.EXITVIEWPORT, | |
h = o.PARTIALLYEXITVIEWPORT, | |
l = o.LOCATIONCHANGE, | |
p = o.STATECHANGE, | |
d = o.eventTypes, | |
u = o.defaultOffsets; | |
n.prototype = { | |
on: function (t, e, i) { | |
switch (!0) { | |
case t === s && !this.isInViewport && this.isAboveViewport: | |
case t === r && this.isInViewport: | |
case t === c && this.isFullyInViewport: | |
case t === a && this.isAboveViewport && !this.isInViewport: | |
case t === h && this.isInViewport && this.isAboveViewport: | |
if ((e.call(this, this.container.latestEvent, this), i)) return; | |
} | |
if (!this.callbacks[t]) | |
throw new Error( | |
"Tried to add a scroll monitor listener of type " + | |
t + | |
". Your options are: " + | |
d.join(", ") | |
); | |
this.callbacks[t].push({ callback: e, isOne: i || !1 }); | |
}, | |
off: function (t, e) { | |
if (!this.callbacks[t]) | |
throw new Error( | |
"Tried to remove a scroll monitor listener of type " + | |
t + | |
". Your options are: " + | |
d.join(", ") | |
); | |
for (var i, n = 0; (i = this.callbacks[t][n]); n++) | |
if (i.callback === e) { | |
this.callbacks[t].splice(n, 1); | |
break; | |
} | |
}, | |
one: function (t, e) { | |
this.on(t, e, !0); | |
}, | |
recalculateSize: function () { | |
(this.height = this.watchItem.offsetHeight + this.offsets.top + this.offsets.bottom), | |
(this.bottom = this.top + this.height); | |
}, | |
update: function () { | |
(this.isAboveViewport = this.top < this.container.viewportTop), | |
(this.isBelowViewport = this.bottom > this.container.viewportBottom), | |
(this.isInViewport = | |
this.top < this.container.viewportBottom && | |
this.bottom > this.container.viewportTop), | |
(this.isFullyInViewport = | |
(this.top >= this.container.viewportTop && | |
this.bottom <= this.container.viewportBottom) || | |
(this.isAboveViewport && this.isBelowViewport)); | |
}, | |
destroy: function () { | |
var t = this.container.watchers.indexOf(this), | |
e = this; | |
this.container.watchers.splice(t, 1); | |
for (var i = 0, n = d.length; i < n; i++) e.callbacks[d[i]].length = 0; | |
}, | |
lock: function () { | |
this.locked = !0; | |
}, | |
unlock: function () { | |
this.locked = !1; | |
}, | |
}; | |
for ( | |
var f = function (t) { | |
return function (e, i) { | |
this.on.call(this, t, e, i); | |
}; | |
}, | |
w = 0, | |
m = d.length; | |
w < m; | |
w++ | |
) { | |
var v = d[w]; | |
n.prototype[v] = f(v); | |
} | |
t.exports = n; | |
}, | |
]); | |
}); | |
}, | |
]); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment