/*! enscroll - v0.5.2 - 2013-12-08 * Copyright (c) 2013 ; Licensed */ ! function(a, b, c, d) { var e = { verticalScrolling: !0, horizontalScrolling: !1, showOnHover: !1, scrollIncrement: 20, minScrollbarLength: 40, pollChanges: !0, drawCorner: !0, drawScrollButtons: !1, clickTrackToScroll: !0, easingDuration: 500, verticalTrackClass: "vertical-track", horizontalTrackClass: "horizontal-track", horizontalHandleClass: "horizontal-handle", verticalHandleClass: "vertical-handle", scrollUpButtonClass: "scroll-up-btn", scrollDownButtonClass: "scroll-down-btn", scrollLeftButtonClass: "scroll-left-btn", scrollRightButtonClass: "scroll-right-btn", cornerClass: "scrollbar-corner", zIndex: 1, addPaddingToPane: !0, horizontalHandleHTML: '
', verticalHandleHTML: '
' }, f = function(a) { a.preventDefault ? a.preventDefault() : a.returnValue = !1 }, g = b.requestAnimationFrame || b.mozRequestAnimationFrame || b.webkitRequestAnimationFrame || b.oRequestAnimationFrame || b.msRequestAnimationFrame || function(a) { setTimeout(a, 17) }, h = .5 * Math.PI, i = 10 * Math.log(2), j = function(a, b, c) { var d = h / b, e = a * d; return Math.round(e * Math.cos(d * c)) }, k = function(a, b, c) { return Math.round(a * i * Math.pow(2, -10 * c / b + 1) / b) }, l = function(a, b, c, d) { return 2 * c / Math.PI * Math.asin((d - a) / b) }, m = function(b) { var c = a(this).data("enscroll"), d = this, e = c.settings, f = function() { var b = a(this).data("enscroll"), c = b.settings; b && c.showOnHover && (c.verticalScrolling && a(b.verticalTrackWrapper).is(":visible") && a(b.verticalTrackWrapper).stop().fadeTo(275, 0), c.horizontalScrolling && a(b.horizontalTrackWrapper).is(":visible") && a(b.horizontalTrackWrapper).stop().fadeTo(275, 0), b._fadeTimer = null) }; c && e.showOnHover && (c._fadeTimer ? clearTimeout(c._fadeTimer) : (e.verticalScrolling && a(c.verticalTrackWrapper).is(":visible") && a(c.verticalTrackWrapper).stop().fadeTo(275, 1), e.horizontalScrolling && a(c.horizontalTrackWrapper).is(":visible") && a(c.horizontalTrackWrapper).stop().fadeTo(275, 1)), b !== !1 && (c._fadeTimer = setTimeout(function() { f.call(d) }, 1750))) }, n = function(b, c) { var d = a(b), e = d.data("enscroll"), f = d.scrollTop(); e && e.settings.verticalScrolling && (d.scrollTop(f + c), e.settings.showOnHover && m.call(b)) }, o = function(b, c) { var d = a(b), e = d.data("enscroll"), f = d.scrollLeft(); e && e.settings.horizontalScrolling && (d.scrollLeft(f + c), e.settings.showOnHover && m.call(b)) }, p = function(b) { if (1 === b.which) { var d, e, f, h, i, j, k, l, n, o = b.data.pane, p = a(o), q = p.data("enscroll"), s = !0, t = function() { s && (f !== h && (q._scrollingY || (q._scrollingY = !0, q._startY = p.scrollTop(), g(function() { r(p) })), e.style.top = f + "px", q._endY = f * n / l, h = f), g(t), q.settings.showOnHover && m.call(o)) }, u = function(a) { return s && (f = a.clientY - j - i, f = Math.min(0 > f ? 0 : f, l)), !1 }, w = function() { return s = !1, c.body.style.cursor = k, this.style.cursor = "", d.removeClass("dragging"), a(c.body).off("mousemove.enscroll.vertical").off("mouseup.enscroll.vertical"), a(c).off("mouseout.enscroll.vertical"), p.on("scroll.enscroll.pane", function(a) { v.call(this, a) }), !1 }; return d = a(q.verticalTrackWrapper).find(".enscroll-track"), e = d.children().first()[0], f = parseInt(e.style.top, 10), n = o.scrollHeight - a(o).innerHeight(), i = b.clientY - a(e).offset().top, l = d.height() - a(e).outerHeight(), j = d.offset().top, p.off("scroll.enscroll.pane"), a(c.body).on({ "mousemove.enscroll.vertical": u, "mouseup.enscroll.vertical": function(a) { w.call(e, a) } }), a(c).on("mouseout.enscroll.vertical", function(a) { a.target.nodeName && "HTML" === a.target.nodeName.toUpperCase() && w.call(e, a) }), d.hasClass("dragging") || (d.addClass("dragging"), k = a(c.body).css("cursor"), this.style.cursor = c.body.style.cursor = "ns-resize"), g(t), !1 } }, q = function(b) { if (1 === b.which) { var d, e, f, h, i, j, k, l, n, o = b.data.pane, p = a(o), q = a(o).data("enscroll"), s = !0, t = function() { s && (f !== h && (q._scrollingX || (q._scrollingX = !0, q._startX = p.scrollLeft(), g(function() { r(p) })), e.style.left = f + "px", q._endX = f * i / n, h = f), g(t), q.settings.showOnHover && m.call(o)) }, u = function(a) { return s && (f = a.clientX - k - j, f = Math.min(0 > f ? 0 : f, n)), !1 }, w = function() { return s = !1, d.removeClass("dragging"), c.body.style.cursor = l, this.style.cursor = "", d.removeClass("dragging"), a(c.body).off("mousemove.enscroll.horizontal").off("mouseup.enscroll.horizontal"), a(c).off("mouseout.enscroll.horizontal"), p.on("scroll.enscroll.pane", function(a) { v.call(this, a) }), !1 }; return d = a(q.horizontalTrackWrapper).find(".enscroll-track"), e = d.children().first()[0], f = parseInt(e.style.left, 10), i = o.scrollWidth - a(o).innerWidth(), j = b.clientX - a(e).offset().left, n = d.width() - a(e).outerWidth(), k = d.offset().left, p.off("scroll.enscroll.pane"), a(c.body).on({ "mousemove.enscroll.horizontal": u, "mouseup.enscroll.horizontal": function(a) { w.call(e, a) } }), a(c).on("mouseout.enscroll.horizontal", function(a) { a.target.nodeName && "HTML" === a.target.nodeName.toUpperCase() && w.call(e, a) }), d.hasClass("dragging") || (d.addClass("dragging"), l = a("body").css("cursor"), this.style.cursor = c.body.style.cursor = "ew-resize"), g(t), !1 } }, r = function(a) { var b, c, d, e = a.data("enscroll"), f = e._duration; e._scrollingX === !0 && (b = e._endX - e._startX, 0 === b ? e._scrollingX = !1 : (c = a.scrollLeft(), d = l(e._startX, b, f, c), b > 0 ? c >= e._endX || c < e._startX ? e._scrollingX = !1 : (o(a, Math.max(1, j(b, f, d))), g(function() { r(a) })) : c <= e._endX || c > e._startX ? e._scrollingX = !1 : (o(a, Math.min(-1, j(b, f, d))), g(function() { r(a) })))), e._scrollingY === !0 && (b = e._endY - e._startY, 0 === b ? e._scrollingY = !1 : (c = a.scrollTop(), d = l(e._startY, b, f, c), b > 0 ? c >= e._endY || c < e._startY ? e._scrollingY = !1 : (n(a, Math.max(1, j(b, f, d))), g(function() { r(a) })) : c <= e._endY || c > e._startY ? e._scrollingY = !1 : (n(a, Math.min(-1, j(b, f, d))), g(function() { r(a) })))) }, s = function(a, b) { var c = a.data("enscroll"), d = a.scrollLeft(), e = a[0].scrollWidth - a.innerWidth(); return c._scrollingX || (c._scrollingX = !0, c._startX = d, c._endX = c._startX, g(function() { r(a) })), c._endX = b > 0 ? Math.min(d + b, e) : Math.max(0, d + b), 0 > b && d > 0 || b > 0 && e > d }, t = function(a, b) { var c = a.data("enscroll"), d = a.scrollTop(), e = a[0].scrollHeight - a.innerHeight(); return c._scrollingY || (c._scrollingY = !0, c._startY = d, c._endY = c._startY, g(function() { r(a) })), c._endY = b > 0 ? Math.min(d + b, e) : Math.max(0, d + b), 0 > b && d > 0 || b > 0 && e > d }, u = function(b) { var c = a(this), d = c.data("enscroll"), e = b.deltaX ? -b.deltaX : b.deltaY ? -b.deltaY : b.detail ? -b.detail : b.wheelDelta, g = d.settings.scrollIncrement, h = (e > 0 ? -g : g) << 2; b.delta && b.deltaX && 0 !== b.deltaX || b.wheelDelta && b.wheelDeltaX && b.wheelDelta === b.wheelDeltaX || b.axis && b.HORIZONTAL_AXIS && b.axis === b.HORIZONTAL_AXIS ? s(c, h) && f(b) : t(c, h) && f(b) }, v = function() { var b, c, d, e = a(this), f = e.data("enscroll"); f && (f.settings.verticalScrolling && (c = a(f.verticalTrackWrapper).find(".enscroll-track")[0], b = c.firstChild, d = e.scrollTop() / (this.scrollHeight - e.innerHeight()), d = isNaN(d) ? 0 : d, b.style.top = d * (a(c).height() - a(b).outerHeight()) + "px"), f.settings.horizontalScrolling && (c = a(f.horizontalTrackWrapper).find(".enscroll-track")[0], b = c.firstChild, d = e.scrollLeft() / (this.scrollWidth - e.innerWidth()), d = isNaN(d) ? 0 : d, b.style.left = d * (a(c).width() - a(b).innerWidth()) + "px")) }, w = function(b) { var c, d = a(this), e = d.data("enscroll"); if (!/(input)|(select)|(textarea)/i.test(this.nodeName) && b.target === this && e) { switch (c = e.settings.scrollIncrement, b.keyCode) { case 32: case 34: return t(d, d.height()), !1; case 33: return t(d, -d.height()), !1; case 35: return t(d, this.scrollHeight), !1; case 36: return t(d, -this.scrollHeight), !1; case 37: return s(d, -c), !1; case 38: return t(d, -c), !1; case 39: return s(d, c), !1; case 40: return t(d, c), !1 } return !0 } }, x = function(a) { var b, c, e, h, i, j, l, m = this, p = function(a) { b = a.touches[0].clientX, c = a.touches[0].clientY, e || (e = c === i && b === h ? d : Math.abs(i - c) > Math.abs(h - b) ? "y" : "x"), f(a) }, q = function() { j && ("y" === e ? (n(m, i - c), l = i - c, i = c) : "x" === e && (o(m, h - b), l = h - b, h = b), g(q)) }, r = function() { var a = 0, b = Math.abs(1.5 * l); this.removeEventListener("touchmove", p, !1), this.removeEventListener("touchend", r, !1), j = !1, g(function c() { var d; a === b || j || (d = k(l, b, a), isNaN(d) || 0 === d || (a += 1, "y" === e ? n(m, d) : o(m, d), g(c))) }) }; 1 === a.touches.length && (h = a.touches[0].clientX, i = a.touches[0].clientY, j = !0, this.addEventListener("touchmove", p, !1), this.addEventListener("touchend", r, !1), g(q)) }, y = { reposition: function() { return this.each(function() { var b, c, d, e, f, g = a(this), h = g.data("enscroll"), i = function(a, b, c) { a.style.left = b + "px", a.style.top = c + "px" }, j = function(b, c) { var d = a(b).css(c), e = /^-?\d+/.exec(d); return e ? +e[0] : 0 }; h && (d = g.position(), b = h.corner, h.settings.verticalScrolling && (c = h.verticalTrackWrapper, i(c, d.left + g.outerWidth() - a(c).width() - j(this, "border-right-width") - (f ? j(e, "padding-left") : 0), d.top + j(this, "border-top-width") + (f ? j(e, "border-top-width") : 0))), h.settings.horizontalScrolling && (c = h.horizontalTrackWrapper, i(c, d.left + j(this, "border-left-width") - (f ? j(e, "padding-left") : 0), d.top + g.outerHeight() - a(c).height() - j(this, "border-bottom-width") + (f ? j(e, "border-bottom-width") : 0))), b && i(b, d.left + g.outerWidth() - a(b).outerWidth() - j(this, "border-right-width") - (f ? j(e, "padding-left") : 0), d.top + g.outerHeight() - a(b).outerHeight() - j(this, "border-bottom-width") + (f ? j(e, "border-bottom-width") : 0))) }) }, resize: function() { return this.each(function() { var b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r = a(this), s = r.data("enscroll"); return s ? (b = s.settings, r.is(":visible") ? (b.verticalScrolling && (e = s.verticalTrackWrapper, c = r.innerHeight(), f = c / this.scrollHeight, g = a(e).find(".enscroll-track")[0], j = a(e).find("." + b.scrollUpButtonClass), k = a(e).find("." + b.scrollDownButtonClass), i = b.horizontalScrolling ? c - a(s.horizontalTrackWrapper).find(".enscroll-track").outerHeight() : c, i -= a(g).outerHeight() - a(g).height() + j.outerHeight() + k.outerHeight(), n = g.firstChild, p = Math.max(f * i, b.minScrollbarLength), p -= a(n).outerHeight() - a(n).height(), e.style.display = "none", g.style.height = i + "px", n.style.height = p + "px", 1 > f && (f = r.scrollTop() / (this.scrollHeight - r.height()), n.style.top = f * (i - p) + "px", e.style.display = "block")), b.horizontalScrolling && (e = s.horizontalTrackWrapper, d = r.innerWidth(), f = d / this.scrollWidth, g = a(e).find(".enscroll-track")[0], l = a(e).find("." + b.scrollLeftButtonClass), m = a(e).find("." + b.scrollRightButtonClass), h = b.verticalScrolling ? d - a(s.verticalTrackWrapper).find(".enscroll-track").outerWidth() : d, h -= a(g).outerWidth() - a(g).width() + l.outerWidth() + m.outerWidth(), n = g.firstChild, o = Math.max(f * h, b.minScrollbarLength), o -= a(n).outerWidth() - a(n).width(), e.style.display = "none", g.style.width = h + "px", n.style.width = o + "px", 1 > f && (f = r.scrollLeft() / (this.scrollWidth - r.width()), n.style.left = f * (h - o) + "px", e.style.display = "block"), s._prybar && (q = s._prybar, this.removeChild(q), b.verticalScrolling && (q.style.width = this.scrollWidth + a(s.verticalTrackWrapper).find(".enscroll-track").outerWidth() + "px", this.appendChild(q)))), s.corner && (s.corner.style.display = s.verticalTrackWrapper && s.horizontalTrackWrapper && a(s.verticalTrackWrapper).is(":visible") && a(s.horizontalTrackWrapper).is(":visible") ? "" : "none")) : (b.verticalScrolling && (s.verticalTrackWrapper.style.display = "none"), b.horizontalScrolling && (s.horizontalTrackWrapper.style.display = "none"), s.corner && (s.corner.style.display = "none")), void 0) : !0 }) }, startPolling: function() { return this.each(function() { var b, c = a(this).data("enscroll"), d = this, e = a(d), f = -1, g = -1, h = -1, i = -1, j = function() { if (c.settings.pollChanges) { var a = d.scrollWidth, k = d.scrollHeight, l = e.width(), m = e.height(), n = e.offset(); (c.settings.verticalScrolling && (m !== g || k !== i) || c.settings.horizontalScrolling && (l !== f || a !== h)) && (h = a, i = k, y.resize.call(e)), (b.left !== n.left || b.top !== n.top || l !== f || m !== g) && (b = n, f = l, g = m, y.reposition.call(e)), setTimeout(j, 350) } }; c && (c.settings.pollChanges = !0, i = d.scrollHeight, h = d.scrollWidth, b = e.offset(), j()) }) }, stopPolling: function() { return this.each(function() { var b = a(this).data("enscroll"); b && (b.settings.pollChanges = !1) }) }, destroy: function() { return this.each(function() { var c, d, e = a(this), f = e.data("enscroll"); f && (y.stopPolling.call(e), d = f._mouseScrollHandler, f.settings.verticalScrolling && (c = f.verticalTrackWrapper, a(c).remove(), c = null), f.settings.horizontalScrolling && (c = f.horizontalTrackWrapper, a(c).remove(), c = null), f._fadeTimer && clearTimeout(f._fadeTimer), f.corner && a(f.corner).remove(), f._prybar && f._prybar.parentNode && f._prybar.parentNode === this && a(f._prybar).remove(), this.setAttribute("style", f._style || ""), f._hadTabIndex || e.removeAttr("tabindex"), e.off("scroll.enscroll.pane").off("keydown.enscroll.pane").off("mouseenter.enscroll.pane").data("enscroll", null), this.removeEventListener ? (this.removeEventListener("mousewheel", d, !1), this.removeEventListener("DOMMouseScroll", d, !1), this.removeEventListener("touchstart", x, !1)) : this.detachEvent && this.detachEvent("onmousewheel", d), a(b).off("resize.enscroll.window")) }) } }; a.fn.enscroll = function(d) { var f; return y[d] ? y[d].call(this) : (f = a.extend({}, e, d), this.each(function() { if (f.verticalScrolling || f.horizontalScrolling) { var d, e, g, h, i, j, k, l, r, z, A, B, C, D, E, F, G, H = a(this), I = this, J = H.attr("style"), K = !0, L = { position: "absolute", "z-index": f.zIndex, margin: 0, padding: 0 }, M = function(a) { u.call(I, a) }, N = function(b, c) { "string" == typeof c ? a(b).html(c) : b.appendChild(c) }; if (f.verticalScrolling) { e = c.createElement("div"), h = c.createElement("div"), j = c.createElement("a"), a(h).css("position", "relative").addClass("enscroll-track").addClass(f.verticalTrackClass).appendTo(e), f.drawScrollButtons && (k = c.createElement("a"), l = c.createElement("a"), a(k).css({ display: "block", "text-decoration": "none" }).attr("href", "").html(" ").addClass(f.scrollUpButtonClass).on("click", function() { return n(I, -f.scrollIncrement), !1 }).insertBefore(h), a(l).css({ display: "block", "text-decoration": "none" }).attr("href", "").html(" ").on("click", function() { return n(I, f.scrollIncrement), !1 }).addClass(f.scrollDownButtonClass).appendTo(e)), f.clickTrackToScroll && a(h).on("click", function(b) { b.target === this && t(H, b.pageY > a(j).offset().top ? H.height() : -H.height()) }), a(j).css({ position: "absolute", "z-index": 1 }).attr("href", "").addClass(f.verticalHandleClass).mousedown({ pane: this }, p).click(function() { return !1 }).appendTo(h), N(j, f.verticalHandleHTML), a(e).css(L).insertAfter(this), f.showOnHover && a(e).css("opacity", 0).on("mouseover.enscroll.vertical", function() { m.call(I, !1) }).on("mouseout.enscroll.vertical", function() { m.call(I) }), B = a(h).outerWidth(), f.addPaddingToPane && H.css({ width: H.width() - B + "px", "padding-right": parseInt(H.css("padding-right"), 10) + B + "px" }); try { F = parseInt(H.css("outline-width"), 10), 0 !== F && !isNaN(F) || "none" !== H.css("outline-style") || H.css("outline", "none") } catch (O) { H.css("outline", "none") } } f.horizontalScrolling && (d = c.createElement("div"), g = c.createElement("div"), i = c.createElement("a"), a(g).css({ position: "relative", "z-index": 1 }).addClass("enscroll-track").addClass(f.horizontalTrackClass).appendTo(d), f.drawScrollButtons && (r = c.createElement("a"), z = c.createElement("a"), a(r).css("display", "block").attr("href", "").on("click", function() { return o(I, -f.scrollIncrement), !1 }).addClass(f.scrollLeftButtonClass).insertBefore(g), a(z).css("display", "block").attr("href", "").on("click", function() { return o(I, f.scrollIncrement), !1 }).addClass(f.scrollRightButtonClass).appendTo(d)), f.clickTrackToScroll && a(g).on("click", function(b) { b.target === this && s(H, b.pageX > a(i).offset().left ? H.width() : -H.width()) }), a(i).css({ position: "absolute", "z-index": 1 }).attr("href", "").addClass(f.horizontalHandleClass).click(function() { return !1 }).mousedown({ pane: this }, q).appendTo(g), N(i, f.horizontalHandleHTML), a(d).css(L).insertAfter(this), f.showOnHover && a(d).css("opacity", 0).on("mouseover.enscroll.horizontal", function() { m.call(I, !1) }).on("mouseout.enscroll.horizontal", function() { m.call(I) }), A = a(g).outerHeight(), f.addPaddingToPane && H.css({ height: H.height() - A + "px", "padding-bottom": parseInt(H.css("padding-bottom"), 10) + A + "px" }), G = document.createElement("div"), a(G).css({ width: "1px", height: "1px", visibility: "hidden", padding: 0, margin: "-1px" }).appendTo(this)), f.verticalScrolling && f.horizontalScrolling && f.drawCorner && (C = c.createElement("div"), a(C).addClass(f.cornerClass).css(L).insertAfter(this)), E = H.attr("tabindex"), E || (H.attr("tabindex", 0), K = !1); try { D = H.css("outline"), (!D || D.length < 1) && H.css("outline", "none") } catch (O) { H.css("outline", "none") } H.on({ "scroll.enscroll.pane": function(a) { v.call(this, a) }, "keydown.enscroll.pane": w }).css("overflow", "hidden").data("enscroll", { settings: f, horizontalTrackWrapper: d, verticalTrackWrapper: e, corner: C, _prybar: G, _mouseScrollHandler: M, _hadTabIndex: K, _style: J, _scrollingX: !1, _scrollingY: !1, _startX: 0, _startY: 0, _endX: 0, _endY: 0, _duration: parseInt(f.easingDuration / 16.66666, 10) }), a(b).on("resize.enscroll.window", function() { y.reposition.call(H) }), f.showOnHover && H.on("mouseenter.enscroll.pane", function() { m.call(this) }), this.addEventListener ? ("onwheel" in this ? this.addEventListener("wheel", M, !1) : "onmousewheel" in this ? this.addEventListener("mousewheel", M, !1) : this.addEventListener("DOMMouseScroll", M, !1), "ontouchstart" in this && this.addEventListener("touchstart", x, !1)) : this.attachEvent && this.attachEvent("onmousewheel", M), f.pollChanges ? y.startPolling.call(H) : (y.resize.call(H), y.reposition.call(H)) } })) } }(jQuery, window, document);