function init() { if (!document.body) return; var e = document.body, t = document.documentelement, n = window.innerheight, r = e.scrollheight; root = document.compatmode.indexof("css") >= 0 ? t : e; activeelement = e; initdone = !0; if (top != self) frame = !0; else if (r > n && (e.offsetheight <= n || t.offsetheight <= n)) { var i = !1, s = function() { if (!i && t.scrollheight != document.height) { i = !0; settimeout(function() { t.style.height = document.height + "px"; i = !1 }, 500) } }; t.style.height = ""; settimeout(s, 10); addevent("domnodeinserted", s); addevent("domnoderemoved", s); if (root.offsetheight <= n) { var o = document.createelement("div"); o.style.clear = "both"; e.appendchild(o) } } if (document.url.indexof("mail.google.com") > -1) { var u = document.createelement("style"); u.innerhtml = ".iu { visibility: hidden }"; (document.getelementsbytagname("head")[0] || t).appendchild(u) } if (!fixedback && !disabled) { e.style.backgroundattachment = "scroll"; t.style.backgroundattachment = "scroll" } } function scrollarray(e, t, n, r) { r || (r = 1e3); directioncheck(t, n); if (acceleration) { var i = +(new date), s = i - lastscroll; if (s < acceldelta) { var o = (1 + 30 / s) / 2; if (o > 1) { o = math.min(o, accelmax); t *= o; n *= o } } lastscroll = +(new date) } que.push({ x: t, y: n, lastx: t < 0 ? .99 : -0.99, lasty: n < 0 ? .99 : -0.99, start: +(new date) }); if (pending) return; var u = e === document.body, a = function() { var i = +(new date), s = 0, o = 0; for (var f = 0; f < que.length; f++) { var l = que[f], c = i - l.start, h = c >= animtime, p = h ? 1 : c / animtime; pulsealgorithm && (p = pulse(p)); var d = l.x * p - l.lastx >> 0, v = l.y * p - l.lasty >> 0; s += d; o += v; l.lastx += d; l.lasty += v; if (h) { que.splice(f, 1); f-- } } if (u) window.scrollby(s, o); else { s && (e.scrollleft += s); o && (e.scrolltop += o) }!t && !n && (que = []); que.length ? requestframe(a, e, r / framerate + 1) : pending = !1 }; requestframe(a, e, 0); pending = !0 } function wheel(e) { initdone || init(); var t = e.target, n = overflowingancestor(t); if (!n || e.defaultprevented || isnodename(activeelement, "embed") || isnodename(t, "embed") && /\.pdf/i.test(t .src)) return !0; var r = e.wheeldeltax || 0, i = e.wheeldeltay || 0; !r && !i && (i = e.wheeldelta || 0); math.abs(r) > 1.2 && (r *= stepsize / 120); math.abs(i) > 1.2 && (i *= stepsize / 120); scrollarray(n, -r, -i); e.preventdefault() } function keydown(e) { var t = e.target, n = e.ctrlkey || e.altkey || e.metakey || e.shiftkey && e.keycode !== key.spacebar; if (/input|textarea|select|embed/i.test(t.nodename) || t.iscontenteditable || e.defaultprevented || n) return !0; if (isnodename(t, "button") && e.keycode === key.spacebar) return !0; var r, i = 0, s = 0, o = overflowingancestor(activeelement), u = o.clientheight; o == document.body && (u = window.innerheight); switch (e.keycode) { case key.up: s = -arrowscroll; break; case key.down: s = arrowscroll; break; case key.spacebar: r = e.shiftkey ? 1 : -1; s = -r * u * .9; break; case key.pageup: s = -u * .9; break; case key.pagedown: s = u * .9; break; case key.home: s = -o.scrolltop; break; case key.end: var a = o.scrollheight - o.scrolltop - u; s = a > 0 ? a + 10 : 0; break; case key.left: i = -arrowscroll; break; case key.right: i = arrowscroll; break; default: return !0 } scrollarray(o, i, s); e.preventdefault() } function mousedown(e) { activeelement = e.target } function setcache(e, t) { for (var n = e.length; n--;) cache[uniqueid(e[n])] = t; return t } function overflowingancestor(e) { var t = [], n = root.scrollheight; do { var r = cache[uniqueid(e)]; if (r) return setcache(t, r); t.push(e); if (n === e.scrollheight) { if (!frame || root.clientheight + 10 < n) return setcache(t, document.body) } else if (e.clientheight + 10 < e.scrollheight) { overflow = getcomputedstyle(e, "").getpropertyvalue("overflow-y"); if (overflow === "scroll" || overflow === "auto") return setcache(t, e) } } while (e = e.parentnode) } function addevent(e, t, n) { window.addeventlistener(e, t, {passive:n || !1}) } function removeevent(e, t, n) { window.removeeventlistener(e, t, {passive:n || !1}) } function isnodename(e, t) { return (e.nodename || "").tolowercase() === t.tolowercase() } function directioncheck(e, t) { e = e > 0 ? 1 : -1; t = t > 0 ? 1 : -1; if (direction.x !== e || direction.y !== t) { direction.x = e; direction.y = t; que = []; lastscroll = 0 } } function pulse_(e) { var t, n, r; e *= pulsescale; if (e < 1) t = e - (1 - math.exp(-e)); else { n = math.exp(-1); e -= 1; r = 1 - math.exp(-e); t = n + r * (1 - n) } return t * pulsenormalize } function pulse(e) { if (e >= 1) return 1; if (e <= 0) return 0; pulsenormalize == 1 && (pulsenormalize /= pulse_(1)); return pulse_(e) } var framerate = 150, animtime = 1e3, stepsize = 80, pulsealgorithm = !0, pulsescale = 8, pulsenormalize = 1, acceleration = !0, acceldelta = 10, accelmax = 1, keyboardsupport = !0, disablekeyboard = !1, arrowscroll = 50, exclude = "", disabled = !1, frame = !1, direction = { x: 0, y: 0 }, initdone = !1, fixedback = !0, root = document.documentelement, activeelement, key = { left: 37, up: 38, right: 39, down: 40, spacebar: 32, pageup: 33, pagedown: 34, end: 35, home: 36 }, que = [], pending = !1, lastscroll = +(new date), cache = {}; setinterval(function() { cache = {} }, 1e4); var uniqueid = function() { var e = 0; return function(t) { return t.uniqueid || (t.uniqueid = e++) } }(), requestframe = function() { return window.requestanimationframe || window.webkitrequestanimationframe || function(e, t, n) { window.settimeout(e, n || 1e3 / 60) } }(); addevent("mousedown", mousedown); addevent("mousewheel", wheel); addevent("load", init);