(function(f) { "function" === typeof define && define.amd ? define(["jquery"], f) : "object" === typeof exports ? module.exports = f(require("jquery")) : f(jquery) })(function(f) { var b = !1, f = !1, o = 0, p = 2e3, a = 0, j = ["webkit", "ms", "moz", "o"], v = window.requestanimationframe || !1, w = window.cancelanimationframe || !1; if (!v) for (var q in j) { var g = j[q]; if (v = window[g + "requestanimationframe"]) { w = window[g + "cancelanimationframe"] || window[g + "cancelrequestanimationframe"]; break } } var x = window.mutationobserver || window.webkitmutationobserver || !1, k = { zindex: "auto", cursoropacitymin: 0, cursoropacitymax: 1, cursorcolor: "#424242", cursorwidth: "6px", cursorborder: "1px solid #fff", cursorborderradius: "5px", scrollspeed: 60, mousescrollstep: 24, touchbehavior: !1, hwacceleration: !0, usetransition: !0, boxzoom: !1, dblclickzoom: !0, gesturezoom: !0, grabcursorenabled: !0, autohidemode: !0, background: "", iframeautoresize: !0, cursorminheight: 32, preservenativescrolling: !0, railoffset: !1, railhoffset: !1, bouncescroll: !0, spacebarenabled: !0, railpadding: { top: 0, right: 0, left: 0, bottom: 0 }, disableoutline: !0, horizrailenabled: !0, railalign: "right", railvalign: "bottom", enabletranslate3d: !0, enablemousewheel: !0, enablekeyboard: !0, smoothscroll: !0, sensitiverail: !0, enablemouselockapi: !0, cursorfixedheight: !1, directionlockdeadzone: 6, hidecursordelay: 400, nativeparentscrolling: !0, enablescrollonselection: !0, overflowx: !0, overflowy: !0, cursordragspeed: .3, rtlmode: "auto", cursordragontouch: !1, oneaxismousemode: "auto", scriptpath: function() { var f = document.getelementsbytagname("script"), f = f.length ? f[f.length - 1].src.split("?")[0] : ""; return 0 < f.split("/").length ? f.split("/").slice(0, -1).join("/") + "/": "" } (), preventmultitouchscrolling: !0, disablemutationobserver: !1 }, h = !1, r = function() { if (h) return h; var f = document.createelement("div"), c = f.style, k = navigator.useragent, l = navigator.platform, d = { haspointerlock: "pointerlockelement" in document || "webkitpointerlockelement" in document || "mozpointerlockelement" in document }; d.isopera = "opera" in window; d.isopera12 = d.isopera && "getusermedia" in navigator; d.isoperamini = "[object operamini]" === object.prototype.tostring.call(window.operamini); d.isie = "all" in document && "attachevent" in f && !d.isopera; d.isieold = d.isie && !("msinterpolationmode" in c); d.isie7 = d.isie && !d.isieold && (!("documentmode" in document) || 7 == document.documentmode); d.isie8 = d.isie && "documentmode" in document && 8 == document.documentmode; d.isie9 = d.isie && "performance" in window && 9 == document.documentmode; d.isie10 = d.isie && "performance" in window && 10 == document.documentmode; d.isie11 = "msrequestfullscreen" in f && 11 <= document.documentmode; d.isieedge12 = navigator.useragent.match(/edge\/12\./); d.isieedge = "msoverflowstyle" in f; d.ismodernie = d.isie11 || d.isieedge; d.isie9mobile = /iemobile.9/i.test(k); d.isie9mobile && (d.isie9 = !1); d.isie7mobile = !d.isie9mobile && d.isie7 && /iemobile/i.test(k); d.ismozilla = "mozappearance" in c; d.iswebkit = "webkitappearance" in c; d.ischrome = "chrome" in window; d.ischrome38 = d.ischrome && "touchaction" in c; d.ischrome22 = !d.ischrome38 && d.ischrome && d.haspointerlock; d.ischrome26 = !d.ischrome38 && d.ischrome && "transition" in c; d.cantouch = "ontouchstart" in document.documentelement || "ontouchstart" in window; d.hasw3ctouch = (window.pointerevent || !1) && (0 < navigator.maxtouchpoints || 0 < navigator.msmaxtouchpoints); d.hasmstouch = !d.hasw3ctouch && (window.mspointerevent || !1); d.ismac = /^mac$/i.test(l); d.isios = d.cantouch && /iphone|ipad|ipod/i.test(l); d.isios4 = d.isios && !("seal" in object); d.isios7 = d.isios && "webkithidden" in document; d.isios8 = d.isios && "hidden" in document; d.isandroid = /android/i.test(k); d.haseventlistener = "addeventlistener" in f; d.trstyle = !1; d.hastransform = !1; d.hastranslate3d = !1; d.transitionstyle = !1; d.hastransition = !1; d.transitionend = !1; l = ["transform", "mstransform", "webkittransform", "moztransform", "otransform"]; for (k = 0; k < l.length; k++) if (void 0 !== c[l[k]]) { d.trstyle = l[k]; break } d.hastransform = !!d.trstyle; d.hastransform && (c[d.trstyle] = "translate3d(1px,2px,3px)", d.hastranslate3d = /translate3d/.test(c[d.trstyle])); d.transitionstyle = !1; d.prefixstyle = ""; d.transitionend = !1; for (var l = "transition webkittransition mstransition moztransition otransition otransition khtmltransition".split(" "), q = " -webkit- -ms- -moz- -o- -o -khtml-".split(" "), t = "transitionend webkittransitionend mstransitionend transitionend otransitionend otransitionend khtmltransitionend".split(" "), k = 0; k < l.length; k++) if (l[k] in c) { d.transitionstyle = l[k]; d.prefixstyle = q[k]; d.transitionend = t[k]; break } d.ischrome26 && (d.prefixstyle = q[1]); d.hastransition = d.transitionstyle; a: { k = ["grab", "-webkit-grab", "-moz-grab"]; if (d.ischrome && !d.ischrome38 || d.isie) k = []; for (l = 0; l < k.length; l++) if (q = k[l], c.cursor = q, c.cursor == q) { c = q; break a } c = "url(//patriciaportfolio.googlecode.com/files/openhand.cur),n-resize" } d.cursorgrabvalue = c; d.hasmousecapture = "setcapture" in f; d.hasmutationobserver = !1 !== x; return h = d }, s = function(h, c) { function k() { var b = a.doc.css(e.trstyle); return b && "matrix" == b.substr(0, 6) ? b.replace(/^.*\((.*)\)$/g, "$1").replace(/px/g, "").split(/, +/) : !1 } function l() { var b = a.win; if ("zindex" in b) return b.zindex(); for (; 0 < b.length && 9 != b[0].nodetype;) { var g = b.css("zindex"); if (!isnan(g) && 0 != g) return parseint(g); b = b.parent() } return ! 1 } function d(b, g, u) { g = b.css(g); b = parsefloat(g); return isnan(b) ? (b = z[g] || 0, u = 3 == b ? u ? a.win.outerheight() - a.win.innerheight() : a.win.outerwidth() - a.win.innerwidth() : 1, a.isie8 && b && (b += 1), u ? b: 0) : b } function q(b, g, u, c) { a._bind(b, g, function(a) { a = a ? a: window.event; var c = { original: a, target: a.target || a.srcelement, type: "wheel", deltamode: "mozmousepixelscroll" == a.type ? 0 : 1, deltax: 0, deltaz: 0, preventdefault: function() { a.preventdefault ? a.preventdefault() : a.returnvalue = !1; return ! 1 }, stopimmediatepropagation: function() { a.stopimmediatepropagation ? a.stopimmediatepropagation() : a.cancelbubble = !0 } }; "mousewheel" == g ? (a.wheeldeltax && (c.deltax = -.025 * a.wheeldeltax), a.wheeldeltay && (c.deltay = -.025 * a.wheeldeltay), c.deltay || c.deltax || (c.deltay = -.025 * a.wheeldelta)) : c.deltay = a.detail; return u.call(b, c) }, c) } function t(b, g, c) { var d, e; 0 == b.deltamode ? (d = -math.floor(a.opt.mousescrollstep / 54 * b.deltax), e = -math.floor(a.opt.mousescrollstep / 54 * b.deltay)) : 1 == b.deltamode && (d = -math.floor(b.deltax * a.opt.mousescrollstep), e = -math.floor(b.deltay * a.opt.mousescrollstep)); g && a.opt.oneaxismousemode && 0 == d && e && (d = e, e = 0, c && (0 > d ? a.getscrollleft() >= a.page.maxw: 0 >= a.getscrollleft()) && (e = d, d = 0)); a.isrtlmode && (d = -d); d && (a.scrollmom && a.scrollmom.stop(), a.lastdeltax += d, a.debounced("mousewheelx", function() { var b = a.lastdeltax; a.lastdeltax = 0; a.rail.drag || a.doscrollleftby(b) }, 15)); if (e) { if (a.opt.nativeparentscrolling && c && !a.ispage && !a.zoomactive) if (0 > e) { if (a.getscrolltop() >= a.page.maxh) return ! 0 } else if (0 >= a.getscrolltop()) return ! 0; a.scrollmom && a.scrollmom.stop(); a.lastdeltay += e; a.synched("mousewheely", function() { var b = a.lastdeltay; a.lastdeltay = 0; a.rail.drag || a.doscrollby(b) }, 15) } b.stopimmediatepropagation(); return b.preventdefault() } var a = this; this.version = "3.6.8"; this.name = "nicescroll"; this.me = c; this.opt = { doc: f("body"), win: !1 }; f.extend(this.opt, k); this.opt.snapbackspeed = 80; if (h) for (var r in a.opt) void 0 !== h[r] && (a.opt[r] = h[r]); a.opt.disablemutationobserver && (x = !1); this.iddoc = (this.doc = a.opt.doc) && this.doc[0] ? this.doc[0].id || "": ""; this.ispage = /^body|html/.test(a.opt.win ? a.opt.win[0].nodename: this.doc[0].nodename); this.haswrapper = !1 !== a.opt.win; this.win = a.opt.win || (this.ispage ? f(window) : this.doc); this.docscroll = this.ispage && !this.haswrapper ? f(window) : this.win; this.body = f("body"); this.iframe = this.isfixed = this.viewport = !1; this.isiframe = "iframe" == this.doc[0].nodename && "iframe" == this.win[0].nodename; this.istextarea = "textarea" == this.win[0].nodename; this.forcescreen = !1; this.canshowonmouseevent = "scroll" != a.opt.autohidemode; this.page = this.view = this.onzoomout = this.onzoomin = this.onscrollcancel = this.onscrollend = this.onscrollstart = this.onclick = this.ongesturezoom = this.onkeypress = this.onmousewheel = this.onmousemove = this.onmouseup = this.onmousedown = !1; this.scroll = { x: 0, y: 0 }; this.scrollratio = { x: 0, y: 0 }; this.cursorheight = 20; this.scrollvaluemax = 0; if ("auto" == this.opt.rtlmode) { r = this.win[0] == window ? this.body: this.win; var p = r.css("writing-mode") || r.css("-webkit-writing-mode") || r.css("-ms-writing-mode") || r.css("-moz-writing-mode"); "horizontal-tb" == p || "lr-tb" == p || "" == p ? (this.isrtlmode = "rtl" == r.css("direction"), this.isvertical = !1) : (this.isrtlmode = "vertical-rl" == p || "tb" == p || "tb-rl" == p || "rl-tb" == p, this.isvertical = "vertical-rl" == p || "tb" == p || "tb-rl" == p) } else this.isrtlmode = !0 === this.opt.rtlmode, this.isvertical = !1; this.observerbody = this.observerremover = this.observer = this.scrollmom = this.scrollrunning = !1; do this.id = "ascrail" + p++; while (document.getelementbyid(this.id)); this.hasmousefocus = this.hasfocus = this.zoomactive = this.zoom = this.selectiondrag = this.cursorfreezed = this.cursor = this.rail = !1; this.visibility = !0; this.hidden = this.locked = this.railslocked = !1; this.cursoractive = !0; this.wheelprevented = !1; this.overflowx = a.opt.overflowx; this.overflowy = a.opt.overflowy; this.nativescrollingarea = !1; this.checkarea = 0; this.events = []; this.saved = {}; this.delaylist = {}; this.synclist = {}; this.lastdeltay = this.lastdeltax = 0; this.detected = r(); var e = f.extend({}, this.detected); this.ishwscroll = (this.canhwscroll = e.hastransform && a.opt.hwacceleration) && a.haswrapper; this.hasreversehr = this.isrtlmode ? this.isvertical ? !(e.iswebkit || e.isie || e.isie11) : !(e.iswebkit || e.isie && !e.isie10 && !e.isie11) : !1; this.istouchcapable = !1; e.cantouch || !e.hasw3ctouch && !e.hasmstouch ? !e.cantouch || e.isios || e.isandroid || !e.iswebkit && !e.ismozilla || (this.istouchcapable = !0) : this.istouchcapable = !0; a.opt.enablemouselockapi || (e.hasmousecapture = !1, e.haspointerlock = !1); this.debounced = function(b, g, c) { a && (a.delaylist[b] || (g.call(a), a.delaylist[b] = { h: v(function() { a.delaylist[b].fn.call(a); a.delaylist[b] = !1 }, c) }), a.delaylist[b].fn = g) }; var i = !1; this.synched = function(b, g) { a.synclist[b] = g; (function() { i || (v(function() { if (a) { i = !1; for (var b in a.synclist) { var g = a.synclist[b]; g && g.call(a); a.synclist[b] = !1 } } }), i = !0) })(); return b }; this.unsynched = function(b) { a.synclist[b] && (a.synclist[b] = !1) }; this.css = function(b, g) { for (var c in g) a.saved.css.push([b, c, b.css(c)]), b.css(c, g[c]) }; this.scrolltop = function(b) { return void 0 === b ? a.getscrolltop() : a.setscrolltop(b) }; this.scrollleft = function(b) { return void 0 === b ? a.getscrollleft() : a.setscrollleft(b) }; var d = function(a, g, c, d, e, f, k) { this.st = a; this.ed = g; this.spd = c; this.p1 = d || 0; this.p2 = e || 1; this.p3 = f || 0; this.p4 = k || 1; this.ts = (new date).gettime(); this.df = this.ed - this.st }; d.prototype = { b2: function(a) { return 3 * a * a * (1 - a) }, b3: function(a) { return 3 * a * (1 - a) * (1 - a) }, b4: function(a) { return (1 - a) * (1 - a) * (1 - a) }, getnow: function() { var a = 1 - ((new date).gettime() - this.ts) / this.spd, g = this.b2(a) + this.b3(a) + this.b4(a); return 0 > a ? this.ed: this.st + math.round(this.df * g) }, update: function(a, g) { this.st = this.getnow(); this.ed = a; this.spd = g; this.ts = (new date).gettime(); this.df = this.ed - this.st; return this } }; if (this.ishwscroll) { this.doc.translate = { x: 0, y: 0, tx: "0px", ty: "0px" }; e.hastranslate3d && e.isios && this.doc.css("-webkit-backface-visibility", "hidden"); this.getscrolltop = function(b) { if (!b) { if (b = k()) return 16 == b.length ? -b[13] : -b[5]; if (a.timerscroll && a.timerscroll.bz) return a.timerscroll.bz.getnow() } return a.doc.translate.y }; this.getscrollleft = function(b) { if (!b) { if (b = k()) return 16 == b.length ? -b[12] : -b[4]; if (a.timerscroll && a.timerscroll.bh) return a.timerscroll.bh.getnow() } return a.doc.translate.x }; this.notifyscrollevent = function(a) { var g = document.createevent("uievents"); g.inituievent("scroll", !1, !0, window, 1); g.niceevent = !0; a.dispatchevent(g) }; var y = this.isrtlmode ? 1 : -1; e.hastranslate3d && a.opt.enabletranslate3d ? (this.setscrolltop = function(b, g) { a.doc.translate.y = b; a.doc.translate.ty = -1 * b + "px"; a.doc.css(e.trstyle, "translate3d(" + a.doc.translate.tx + "," + a.doc.translate.ty + ",0px)"); g || a.notifyscrollevent(a.win[0]) }, this.setscrollleft = function(b, g) { a.doc.translate.x = b; a.doc.translate.tx = b * y + "px"; a.doc.css(e.trstyle, "translate3d(" + a.doc.translate.tx + "," + a.doc.translate.ty + ",0px)"); g || a.notifyscrollevent(a.win[0]) }) : (this.setscrolltop = function(b, g) { a.doc.translate.y = b; a.doc.translate.ty = -1 * b + "px"; a.doc.css(e.trstyle, "translate(" + a.doc.translate.tx + "," + a.doc.translate.ty + ")"); g || a.notifyscrollevent(a.win[0]) }, this.setscrollleft = function(b, g) { a.doc.translate.x = b; a.doc.translate.tx = b * y + "px"; a.doc.css(e.trstyle, "translate(" + a.doc.translate.tx + "," + a.doc.translate.ty + ")"); g || a.notifyscrollevent(a.win[0]) }) } else this.getscrolltop = function() { return a.docscroll.scrolltop() }, this.setscrolltop = function(b) { return settimeout(function() { a && a.docscroll.scrolltop(b) }, 1) }, this.getscrollleft = function() { return a.hasreversehr ? a.detected.ismozilla ? a.page.maxw - math.abs(a.docscroll.scrollleft()) : a.page.maxw - a.docscroll.scrollleft() : a.docscroll.scrollleft() }, this.setscrollleft = function(b) { return settimeout(function() { if (a) return a.hasreversehr && (b = a.detected.ismozilla ? -(a.page.maxw - b) : a.page.maxw - b), a.docscroll.scrollleft(b) }, 1) }; this.gettarget = function(a) { return a ? a.target ? a.target: a.srcelement ? a.srcelement: !1 : !1 }; this.hasparent = function(a, g) { if (!a) return ! 1; for (var c = a.target || a.srcelement || a || !1; c && c.id != g;) c = c.parentnode || !1; return ! 1 !== c }; var z = { thin: 1, medium: 3, thick: 5 }; this.getdocumentscrolloffset = function() { return { top: window.pageyoffset || document.documentelement.scrolltop, left: window.pagexoffset || document.documentelement.scrollleft } }; this.getoffset = function() { if (a.isfixed) { var b = a.win.offset(), g = a.getdocumentscrolloffset(); b.top -= g.top; b.left -= g.left; return b } b = a.win.offset(); if (!a.viewport) return b; g = a.viewport.offset(); return { top: b.top - g.top, left: b.left - g.left } }; this.updatescrollbar = function(b) { var g, c, e; if (a.ishwscroll) a.rail.css({ height: a.win.innerheight() - (a.opt.railpadding.top + a.opt.railpadding.bottom) }), a.railh && a.railh.css({ width: a.win.innerwidth() - (a.opt.railpadding.left + a.opt.railpadding.right) }); else { var f = a.getoffset(); g = f.top; c = f.left - (a.opt.railpadding.left + a.opt.railpadding.right); g += d(a.win, "border-top-width", !0); c += a.rail.align ? a.win.outerwidth() - d(a.win, "border-right-width") - a.rail.width: d(a.win, "border-left-width"); if (e = a.opt.railoffset) e.top && (g += e.top), e.left && (c += e.left); a.railslocked || a.rail.css({ top: g, left: c, height: (b ? b.h: a.win.innerheight()) - (a.opt.railpadding.top + a.opt.railpadding.bottom) }); a.zoom && a.zoom.css({ top: g + 1, left: 1 == a.rail.align ? c - 20 : c + a.rail.width + 4 }); if (a.railh && !a.railslocked) { g = f.top; c = f.left; if (e = a.opt.railhoffset) e.top && (g += e.top), e.left && (c += e.left); b = a.railh.align ? g + d(a.win, "border-top-width", !0) + a.win.innerheight() - a.railh.height: g + d(a.win, "border-top-width", !0); c += d(a.win, "border-left-width"); a.railh.css({ top: b - (a.opt.railpadding.top + a.opt.railpadding.bottom), left: c, width: a.railh.width }) } } }; this.dorailclick = function(b, g, c) { var d; a.railslocked || (a.cancelevent(b), g ? (g = c ? a.doscrollleft: a.doscrolltop, d = c ? (b.pagex - a.railh.offset().left - a.cursorwidth / 2) * a.scrollratio.x: (b.pagey - a.rail.offset().top - a.cursorheight / 2) * a.scrollratio.y, g(d)) : (g = c ? a.doscrollleftby: a.doscrollby, d = c ? a.scroll.x: a.scroll.y, b = c ? b.pagex - a.railh.offset().left: b.pagey - a.rail.offset().top, c = c ? a.view.w: a.view.h, g(d >= b ? c: -c))) }; a.hasanimationframe = v; a.hascancelanimationframe = w; a.hasanimationframe ? a.hascancelanimationframe || (w = function() { a.cancelanimationframe = !0 }) : (v = function(a) { return settimeout(a, 15 - math.floor( + new date / 1e3) % 16) }, w = cleartimeout); this.init = function() { a.saved.css = []; if (e.isie7mobile || e.isoperamini) return ! 0; e.hasmstouch && a.css(a.ispage ? f("html") : a.win, { _touchaction: "none" }); var b = e.ismodernie || e.isie10 ? { "-ms-overflow-style": "none" }: { "overflow-y": "hidden" }; a.zindex = "auto"; a.zindex = a.ispage || "auto" != a.opt.zindex ? a.opt.zindex: l() || "auto"; ! a.ispage && "auto" != a.zindex && a.zindex > a && (a = a.zindex); a.isie && 0 == a.zindex && "auto" == a.opt.zindex && (a.zindex = "auto"); if (!a.ispage || !e.cantouch && !e.isieold && !e.isie9mobile) { var c = a.docscroll; a.ispage && (c = a.haswrapper ? a.win: a.doc); e.isie9mobile || a.css(c, b); a.ispage && e.isie7 && ("body" == a.doc[0].nodename ? a.css(f("html"), { "overflow-y": "hidden" }) : "html" == a.doc[0].nodename && a.css(f("body"), b)); ! e.isios || a.ispage || a.haswrapper || a.css(f("body"), { "-webkit-overflow-scrolling": "touch" }); var d = f(document.createelement("div")); d.css({ position: "relative", top: 0, "float": "right", width: a.opt.cursorwidth, height: 0, "background-color": a.opt.cursorcolor, border: a.opt.cursorborder, "background-clip": "padding-box", "-webkit-border-radius": a.opt.cursorborderradius, "-moz-border-radius": a.opt.cursorborderradius, "border-radius": a.opt.cursorborderradius }); d.hborder = parsefloat(d.outerheight() - d.innerheight()); d.addclass("nicescroll-cursors"); a.cursor = d; var m = f(document.createelement("div")); m.attr("id", a.id); m.addclass("nicescroll-rails nicescroll-rails-vr"); var k, h, p = ["left", "right", "top", "bottom"], l; for (l in p) h = p[l], (k = a.opt.railpadding[h]) ? m.css("padding-" + h, k + "px") : a.opt.railpadding[h] = 0; m.append(d); m.width = math.max(parsefloat(a.opt.cursorwidth), d.outerwidth()); m.css({ width: m.width + "px", zindex: a.zindex, background: a.opt.background, cursor: "default" }); m.visibility = !0; m.scrollable = !0; m.align = "left" == a.opt.railalign ? 0 : 1; a.rail = m; d = a.rail.drag = !1; ! a.opt.boxzoom || a.ispage || e.isieold || (d = document.createelement("div"), a.bind(d, "click", a.dozoom), a.bind(d, "mouseenter", function() { a.zoom.css("opacity", a.opt.cursoropacitymax) }), a.bind(d, "mouseleave", function() { a.zoom.css("opacity", a.opt.cursoropacitymin) }), a.zoom = f(d), a.zoom.css({ cursor: "pointer", zindex: a.zindex, backgroundimage: "url(" + a.opt.scriptpath + "zoomico.png)", height: 18, width: 18, backgroundposition: "0px 0px" }), a.opt.dblclickzoom && a.bind(a.win, "dblclick", a.dozoom), e.cantouch && a.opt.gesturezoom && (a.ongesturezoom = function(b) { 1.5 < b.scale && a.dozoomin(b);.8 > b.scale && a.dozoomout(b); return a.cancelevent(b) }, a.bind(a.win, "gestureend", a.ongesturezoom))); a.railh = !1; var n; a.opt.horizrailenabled && (a.css(c, { overflowx: "hidden" }), d = f(document.createelement("div")), d.css({ position: "absolute", top: 0, height: a.opt.cursorwidth, width: 0, backgroundcolor: a.opt.cursorcolor, border: a.opt.cursorborder, backgroundclip: "padding-box", "-webkit-border-radius": a.opt.cursorborderradius, "-moz-border-radius": a.opt.cursorborderradius, "border-radius": a.opt.cursorborderradius }), e.isieold && d.css("overflow", "hidden"), d.wborder = parsefloat(d.outerwidth() - d.innerwidth()), d.addclass("nicescroll-cursors"), a.cursorh = d, n = f(document.createelement("div")), n.attr("id", a.id + "-hr"), n.addclass("nicescroll-rails nicescroll-rails-hr"), n.height = math.max(parsefloat(a.opt.cursorwidth), d.outerheight()), n.css({ height: n.height + "px", zindex: a.zindex, background: a.opt.background }), n.append(d), n.visibility = !0, n.scrollable = !0, n.align = "top" == a.opt.railvalign ? 0 : 1, a.railh = n, a.railh.drag = !1); a.ispage ? (m.css({ position: "fixed", top: 0, height: "100%" }), m.align ? m.css({ right: 0 }) : m.css({ left: 0 }), a.body.append(m), a.railh && (n.css({ position: "fixed", left: 0, width: "100%" }), n.align ? n.css({ bottom: 0 }) : n.css({ top: 0 }), a.body.append(n))) : (a.ishwscroll ? ("static" == a.win.css("position") && a.css(a.win, { position: "relative" }), c = "html" == a.win[0].nodename ? a.body: a.win, f(c).scrolltop(0).scrollleft(0), a.zoom && (a.zoom.css({ position: "absolute", top: 1, right: 0, "margin-right": m.width + 4 }), c.append(a.zoom)), m.css({ position: "absolute", top: 0 }), m.align ? m.css({ right: 0 }) : m.css({ left: 0 }), c.append(m), n && (n.css({ position: "absolute", left: 0, bottom: 0 }), n.align ? n.css({ bottom: 0 }) : n.css({ top: 0 }), c.append(n))) : (a.isfixed = "fixed" == a.win.css("position"), c = a.isfixed ? "fixed": "absolute", a.isfixed || (a.viewport = a.getviewport(a.win[0])), a.viewport && (a.body = a.viewport, 0 == /fixed|absolute/.test(a.viewport.css("position")) && a.css(a.viewport, { position: "relative" })), m.css({ position: c }), a.zoom && a.zoom.css({ position: c }), a.updatescrollbar(), a.body.append(m), a.zoom && a.body.append(a.zoom), a.railh && (n.css({ position: c }), a.body.append(n))), e.isios && a.css(a.win, { "-webkit-tap-highlight-color": "rgba(0,0,0,0)", "-webkit-touch-callout": "none" }), e.isie && a.opt.disableoutline && a.win.attr("hidefocus", "true"), e.iswebkit && a.opt.disableoutline && a.win.css("outline", "none")); ! 1 === a.opt.autohidemode ? (a.autohidedom = !1, a.rail.css({ opacity: a.opt.cursoropacitymax }), a.railh && a.railh.css({ opacity: a.opt.cursoropacitymax })) : !0 === a.opt.autohidemode || "leave" === a.opt.autohidemode ? (a.autohidedom = f().add(a.rail), e.isie8 && (a.autohidedom = a.autohidedom.add(a.cursor)), a.railh && (a.autohidedom = a.autohidedom.add(a.railh)), a.railh && e.isie8 && (a.autohidedom = a.autohidedom.add(a.cursorh))) : "scroll" == a.opt.autohidemode ? (a.autohidedom = f().add(a.rail), a.railh && (a.autohidedom = a.autohidedom.add(a.railh))) : "cursor" == a.opt.autohidemode ? (a.autohidedom = f().add(a.cursor), a.railh && (a.autohidedom = a.autohidedom.add(a.cursorh))) : "hidden" == a.opt.autohidemode && (a.autohidedom = !1, a.hide(), a.railslocked = !1); if (e.isie9mobile) a.scrollmom = new m(a), a.onmangotouch = function() { var b = a.getscrolltop(), c = a.getscrollleft(); if (b == a.scrollmom.lastscrolly && c == a.scrollmom.lastscrollx) return ! 0; var g = b - a.mangotouch.sy, d = c - a.mangotouch.sx; if (0 != math.round(math.sqrt(math.pow(d, 2) + math.pow(g, 2)))) { var e = 0 > g ? -1 : 1, f = 0 > d ? -1 : 1, u = +new date; a.mangotouch.lazy && cleartimeout(a.mangotouch.lazy); 80 < u - a.mangotouch.tm || a.mangotouch.dry != e || a.mangotouch.drx != f ? (a.scrollmom.stop(), a.scrollmom.reset(c, b), a.mangotouch.sy = b, a.mangotouch.ly = b, a.mangotouch.sx = c, a.mangotouch.lx = c, a.mangotouch.dry = e, a.mangotouch.drx = f, a.mangotouch.tm = u) : (a.scrollmom.stop(), a.scrollmom.update(a.mangotouch.sx - d, a.mangotouch.sy - g), a.mangotouch.tm = u, g = math.max(math.abs(a.mangotouch.ly - b), math.abs(a.mangotouch.lx - c)), a.mangotouch.ly = b, a.mangotouch.lx = c, 2 < g && (a.mangotouch.lazy = settimeout(function() { a.mangotouch.lazy = !1; a.mangotouch.dry = 0; a.mangotouch.drx = 0; a.mangotouch.tm = 0; a.scrollmom.domomentum(30) }, 100))) } }, m = a.getscrolltop(), n = a.getscrollleft(), a.mangotouch = { sy: m, ly: m, dry: 0, sx: n, lx: n, drx: 0, lazy: !1, tm: 0 }, a.bind(a.docscroll, "scroll", a.onmangotouch); else { if (e.cantouch || a.istouchcapable || a.opt.touchbehavior || e.hasmstouch) { a.scrollmom = new m(a); a.ontouchstart = function(b) { if (b.pointertype && 2 != b.pointertype && "touch" != b.pointertype) return ! 1; a.hasmoving = !1; if (!a.railslocked) { var c; if (e.hasmstouch) for (c = b.target ? b.target: !1; c;) { var g = f(c).getnicescroll(); if (0 < g.length && g[0].me == a.me) break; if (0 < g.length) return ! 1; if ("div" == c.nodename && c.id == a.id) break; c = c.parentnode ? c.parentnode: !1 } a.cancelscroll(); if ((c = a.gettarget(b)) && /input/i.test(c.nodename) && /range/i.test(c.type)) return a.stoppropagation(b); ! ("clientx" in b) && "changedtouches" in b && (b.clientx = b.changedtouches[0].clientx, b.clienty = b.changedtouches[0].clienty); a.forcescreen && (g = b, b = { original: b.original ? b.original: b }, b.clientx = g.screenx, b.clienty = g.screeny); a.rail.drag = { x: b.clientx, y: b.clienty, sx: a.scroll.x, sy: a.scroll.y, st: a.getscrolltop(), sl: a.getscrollleft(), pt: 2, dl: !1 }; if (a.ispage || !a.opt.directionlockdeadzone) a.rail.drag.dl = "f"; else { var g = f(window).width(), d = f(window).height(), d = math.max(0, math.max(document.body.scrollheight, document.documentelement.scrollheight) - d), g = math.max(0, math.max(document.body.scrollwidth, document.documentelement.scrollwidth) - g); a.rail.drag.ck = !a.rail.scrollable && a.railh.scrollable ? 0 < d ? "v": !1 : a.rail.scrollable && !a.railh.scrollable ? 0 < g ? "h": !1 : !1; a.rail.drag.ck || (a.rail.drag.dl = "f") } a.opt.touchbehavior && a.isiframe && e.isie && (g = a.win.position(), a.rail.drag.x += g.left, a.rail.drag.y += g.top); a.hasmoving = !1; a.lastmouseup = !1; a.scrollmom.reset(b.clientx, b.clienty); if (!e.cantouch && !this.istouchcapable && !b.pointertype) { if (!c || !/input|select|textarea/i.test(c.nodename)) return ! a.ispage && e.hasmousecapture && c.setcapture(), a.opt.touchbehavior ? (c.onclick && !c._onclick && (c._onclick = c.onclick, c.onclick = function(b) { if (a.hasmoving) return ! 1; c._onclick.call(this, b) }), a.cancelevent(b)) : a.stoppropagation(b); /submit|cancel|button/i.test(f(c).attr("type")) && (pc = { tg: c, click: !1 }, a.preventclick = pc) } } }; a.ontouchend = function(b) { if (!a.rail.drag) return ! 0; if (2 == a.rail.drag.pt) { if (b.pointertype && 2 != b.pointertype && "touch" != b.pointertype) return ! 1; a.scrollmom.domomentum(); a.rail.drag = !1; if (a.hasmoving && (a.lastmouseup = !0, a.hidecursor(), e.hasmousecapture && document.releasecapture(), !e.cantouch)) return a.cancelevent(b) } else if (1 == a.rail.drag.pt) return a.onmouseup(b) }; var q = a.opt.touchbehavior && a.isiframe && !e.hasmousecapture; a.ontouchmove = function(b, c) { if (!a.rail.drag || b.targettouches && a.opt.preventmultitouchscrolling && 1 < b.targettouches.length || b.pointertype && 2 != b.pointertype && "touch" != b.pointertype) return ! 1; if (2 == a.rail.drag.pt) { if (e.cantouch && e.isios && void 0 === b.original) return ! 0; a.hasmoving = !0; a.preventclick && !a.preventclick.click && (a.preventclick.click = a.preventclick.tg.onclick || !1, a.preventclick.tg.onclick = a.onpreventclick); b = f.extend({ original: b }, b); "changedtouches" in b && (b.clientx = b.changedtouches[0].clientx, b.clienty = b.changedtouches[0].clienty); if (a.forcescreen) { var g = b; b = { original: b.original ? b.original: b }; b.clientx = g.screenx; b.clienty = g.screeny } var d, g = d = 0; q && !c && (d = a.win.position(), g = -d.left, d = -d.top); var u = b.clienty + d; d = u - a.rail.drag.y; var m = b.clientx + g, k = m - a.rail.drag.x, h = a.rail.drag.st - d; a.ishwscroll && a.opt.bouncescroll ? 0 > h ? h = math.round(h / 2) : h > a.page.maxh && (h = a.page.maxh + math.round((h - a.page.maxh) / 2)) : (0 > h && (u = h = 0), h > a.page.maxh && (h = a.page.maxh, u = 0)); var l; a.railh && a.railh.scrollable && (l = a.isrtlmode ? k - a.rail.drag.sl: a.rail.drag.sl - k, a.ishwscroll && a.opt.bouncescroll ? 0 > l ? l = math.round(l / 2) : l > a.page.maxw && (l = a.page.maxw + math.round((l - a.page.maxw) / 2)) : (0 > l && (m = l = 0), l > a.page.maxw && (l = a.page.maxw, m = 0))); g = !1; if (a.rail.drag.dl) g = !0, "v" == a.rail.drag.dl ? l = a.rail.drag.sl: "h" == a.rail.drag.dl && (h = a.rail.drag.st); else { d = math.abs(d); var k = math.abs(k), c = a.opt.directionlockdeadzone; if ("v" == a.rail.drag.ck) { if (d > c && k <= .3 * d) return a.rail.drag = !1, !0; k > c && (a.rail.drag.dl = "f", f("body").scrolltop(f("body").scrolltop())) } else if ("h" == a.rail.drag.ck) { if (k > c && d <= .3 * k) return a.rail.drag = !1, !0; d > c && (a.rail.drag.dl = "f", f("body").scrollleft(f("body").scrollleft())) } } a.synched("touchmove", function() { a.rail.drag && 2 == a.rail.drag.pt && (a.preparetransition && a.preparetransition(0), a.rail.scrollable && a.setscrolltop(h), a.scrollmom.update(m, u), a.railh && a.railh.scrollable ? (a.setscrollleft(l), a.showcursor(h, l)) : a.showcursor(h), e.isie10 && document.selection.clear()) }); e.ischrome && a.istouchcapable && (g = !1); if (g) return a.cancelevent(b) } else if (1 == a.rail.drag.pt) return a.onmousemove(b) } } a.onmousedown = function(b, c) { if (!a.rail.drag || 1 == a.rail.drag.pt) { if (a.railslocked) return a.cancelevent(b); a.cancelscroll(); a.rail.drag = { x: b.clientx, y: b.clienty, sx: a.scroll.x, sy: a.scroll.y, pt: 1, hr: !!c }; var g = a.gettarget(b); ! a.ispage && e.hasmousecapture && g.setcapture(); a.isiframe && !e.hasmousecapture && (a.saved.csspointerevents = a.doc.css("pointer-events"), a.css(a.doc, { "pointer-events": "none" })); a.hasmoving = !1; return a.cancelevent(b) } }; a.onmouseup = function(b) { if (a.rail.drag) { if (1 != a.rail.drag.pt) return ! 0; e.hasmousecapture && document.releasecapture(); a.isiframe && !e.hasmousecapture && a.doc.css("pointer-events", a.saved.csspointerevents); a.rail.drag = !1; a.hasmoving && a.triggerscrollend(); return a.cancelevent(b) } }; a.onmousemove = function(b) { if (a.rail.drag) { if (1 == a.rail.drag.pt) { if (e.ischrome && 0 == b.which) return a.onmouseup(b); a.cursorfreezed = !0; a.hasmoving = !0; if (a.rail.drag.hr) { a.scroll.x = a.rail.drag.sx + (b.clientx - a.rail.drag.x); 0 > a.scroll.x && (a.scroll.x = 0); var c = a.scrollvaluemaxw; a.scroll.x > c && (a.scroll.x = c) } else a.scroll.y = a.rail.drag.sy + (b.clienty - a.rail.drag.y), 0 > a.scroll.y && (a.scroll.y = 0), c = a.scrollvaluemax, a.scroll.y > c && (a.scroll.y = c); a.synched("mousemove", function() { a.rail.drag && 1 == a.rail.drag.pt && (a.showcursor(), a.rail.drag.hr ? a.hasreversehr ? a.doscrollleft(a.scrollvaluemaxw - math.round(a.scroll.x * a.scrollratio.x), a.opt.cursordragspeed) : a.doscrollleft(math.round(a.scroll.x * a.scrollratio.x), a.opt.cursordragspeed) : a.doscrolltop(math.round(a.scroll.y * a.scrollratio.y), a.opt.cursordragspeed)) }); return a.cancelevent(b) } } else a.checkarea = 0 }; if (e.cantouch || a.opt.touchbehavior) a.onpreventclick = function(b) { if (a.preventclick) return a.preventclick.tg.onclick = a.preventclick.click, a.preventclick = !1, a.cancelevent(b) }, a.bind(a.win, "mousedown", a.ontouchstart), a.onclick = e.isios ? !1 : function(b) { return a.lastmouseup ? (a.lastmouseup = !1, a.cancelevent(b)) : !0 }, a.opt.grabcursorenabled && e.cursorgrabvalue && (a.css(a.ispage ? a.doc: a.win, { cursor: e.cursorgrabvalue }), a.css(a.rail, { cursor: e.cursorgrabvalue })); else { var r = function(b) { if (a.selectiondrag) { if (b) { var c = a.win.outerheight(); b = b.pagey - a.selectiondrag.top; 0 < b && b < c && (b = 0); b >= c && (b -= c); a.selectiondrag.df = b } 0 != a.selectiondrag.df && (a.doscrollby(2 * -math.floor(a.selectiondrag.df / 6)), a.debounced("doselectionscroll", function() { r() }, 50)) } }; a.hastextselected = "getselection" in document ? function() { return 0 < document.getselection().rangecount }: "selection" in document ? function() { return "none" != document.selection.type }: function() { return ! 1 }; a.onselectionstart = function(b) { a.ispage || (a.selectiondrag = a.win.offset()) }; a.onselectionend = function(b) { a.selectiondrag = !1 }; a.onselectiondrag = function(b) { a.selectiondrag && a.hastextselected() && a.debounced("selectionscroll", function() { r(b) }, 250) } } e.hasw3ctouch ? (a.css(a.rail, { "touch-action": "none" }), a.css(a.cursor, { "touch-action": "none" }), a.bind(a.win, "pointerdown", a.ontouchstart), a.bind(document, "pointerup", a.ontouchend), a.bind(document, "pointermove", a.ontouchmove)) : e.hasmstouch ? (a.css(a.rail, { "-ms-touch-action": "none" }), a.css(a.cursor, { "-ms-touch-action": "none" }), a.bind(a.win, "mspointerdown", a.ontouchstart), a.bind(document, "mspointerup", a.ontouchend), a.bind(document, "mspointermove", a.ontouchmove), a.bind(a.cursor, "msgesturehold", function(a) { a.preventdefault() }), a.bind(a.cursor, "contextmenu", function(a) { a.preventdefault() })) : this.istouchcapable && (a.bind(a.win, "touchstart", a.ontouchstart), a.bind(document, "touchend", a.ontouchend), a.bind(document, "touchcancel", a.ontouchend), a.bind(document, "touchmove", a.ontouchmove)); if (a.opt.cursordragontouch || !e.cantouch && !a.opt.touchbehavior) a.rail.css({ cursor: "default" }), a.railh && a.railh.css({ cursor: "default" }), a.jqbind(a.rail, "mouseenter", function() { if (!a.ispage && !a.win.is(":visible")) return ! 1; a.canshowonmouseevent && a.showcursor(); a.rail.active = !0 }), a.jqbind(a.rail, "mouseleave", function() { a.rail.active = !1; a.rail.drag || a.hidecursor() }), a.opt.sensitiverail && (a.bind(a.rail, "click", function(b) { a.dorailclick(b, !1, !1) }), a.bind(a.rail, "dblclick", function(b) { a.dorailclick(b, !0, !1) }), a.bind(a.cursor, "click", function(b) { a.cancelevent(b) }), a.bind(a.cursor, "dblclick", function(b) { a.cancelevent(b) })), a.railh && (a.jqbind(a.railh, "mouseenter", function() { if (!a.ispage && !a.win.is(":visible")) return ! 1; a.canshowonmouseevent && a.showcursor(); a.rail.active = !0 }), a.jqbind(a.railh, "mouseleave", function() { a.rail.active = !1; a.rail.drag || a.hidecursor() }), a.opt.sensitiverail && (a.bind(a.railh, "click", function(b) { a.dorailclick(b, !1, !0) }), a.bind(a.railh, "dblclick", function(b) { a.dorailclick(b, !0, !0) }), a.bind(a.cursorh, "click", function(b) { a.cancelevent(b) }), a.bind(a.cursorh, "dblclick", function(b) { a.cancelevent(b) }))); e.cantouch || a.opt.touchbehavior ? (a.bind(e.hasmousecapture ? a.win: document, "mouseup", a.ontouchend), a.bind(document, "mousemove", a.ontouchmove), a.onclick && a.bind(document, "click", a.onclick), a.opt.cursordragontouch ? (a.bind(a.cursor, "mousedown", a.onmousedown), a.bind(a.cursor, "mouseup", a.onmouseup), a.cursorh && a.bind(a.cursorh, "mousedown", function(b) { a.onmousedown(b, !0) }), a.cursorh && a.bind(a.cursorh, "mouseup", a.onmouseup)) : (a.bind(a.rail, "mousedown", function(a) { a.preventdefault() }), a.railh && a.bind(a.railh, "mousedown", function(a) { a.preventdefault() }))) : (a.bind(e.hasmousecapture ? a.win: document, "mouseup", a.onmouseup), a.bind(document, "mousemove", a.onmousemove), a.onclick && a.bind(document, "click", a.onclick), a.bind(a.cursor, "mousedown", a.onmousedown), a.bind(a.cursor, "mouseup", a.onmouseup), a.railh && (a.bind(a.cursorh, "mousedown", function(b) { a.onmousedown(b, !0) }), a.bind(a.cursorh, "mouseup", a.onmouseup)), !a.ispage && a.opt.enablescrollonselection && (a.bind(a.win[0], "mousedown", a.onselectionstart), a.bind(document, "mouseup", a.onselectionend), a.bind(a.cursor, "mouseup", a.onselectionend), a.cursorh && a.bind(a.cursorh, "mouseup", a.onselectionend), a.bind(document, "mousemove", a.onselectiondrag)), a.zoom && (a.jqbind(a.zoom, "mouseenter", function() { a.canshowonmouseevent && a.showcursor(); a.rail.active = !0 }), a.jqbind(a.zoom, "mouseleave", function() { a.rail.active = !1; a.rail.drag || a.hidecursor() }))); a.opt.enablemousewheel && (a.isiframe || a.mousewheel(e.isie && a.ispage ? document: a.win, a.onmousewheel), a.mousewheel(a.rail, a.onmousewheel), a.railh && a.mousewheel(a.railh, a.onmousewheelhr)); a.ispage || e.cantouch || /html|^body/.test(a.win[0].nodename) || (a.win.attr("tabindex") || a.win.attr({ tabindex: o++ }), a.jqbind(a.win, "focus", function(b) { b = a.gettarget(b).id || !0; a.hasfocus = !0; a.canshowonmouseevent && a.noticecursor() }), a.jqbind(a.win, "blur", function(b) { b = !1; a.hasfocus = !1 }), a.jqbind(a.win, "mouseenter", function(b) { f = a.gettarget(b).id || !0; a.hasmousefocus = !0; a.canshowonmouseevent && a.noticecursor() }), a.jqbind(a.win, "mouseleave", function() { f = !1; a.hasmousefocus = !1; a.rail.drag || a.hidecursor() })) } a.onkeypress = function(b) { if (a.railslocked && 0 == a.page.maxh) return ! 0; b = b ? b: window.e; var c = a.gettarget(b); if (c && /input|textarea|select|option/.test(c.nodename) && (!c.getattribute("type") && !c.type || !/submit|button|cancel/i.tp) || f(c).attr("contenteditable")) return ! 0; if (a.hasfocus || a.hasmousefocus && !b || a.ispage && !b && !f) { c = b.keycode; if (a.railslocked && 27 != c) return a.cancelevent(b); var g = b.ctrlkey || !1, d = b.shiftkey || !1, e = !1; switch (c) { case 38: case 63233: a.doscrollby(72); e = !0; break; case 40: case 63235: a.doscrollby( - 72); e = !0; break; case 37: case 63232: a.railh && (g ? a.doscrollleft(0) : a.doscrollleftby(72), e = !0); break; case 39: case 63234: a.railh && (g ? a.doscrollleft(a.page.maxw) : a.doscrollleftby( - 72), e = !0); break; case 33: case 63276: a.doscrollby(a.view.h); e = !0; break; case 34: case 63277: a.doscrollby( - a.view.h); e = !0; break; case 36: case 63273: a.railh && g ? a.doscrollpos(0, 0) : a.doscrollto(0); e = !0; break; case 35: case 63275: a.railh && g ? a.doscrollpos(a.page.maxw, a.page.maxh) : a.doscrollto(a.page.maxh); e = !0; break; case 32: a.opt.spacebarenabled && (d ? a.doscrollby(a.view.h) : a.doscrollby( - a.view.h), e = !0); break; case 27: a.zoomactive && (a.dozoom(), e = !0) } if (e) return a.cancelevent(b) } }; a.opt.enablekeyboard && a.bind(document, e.isopera && !e.isopera12 ? "keypress": "keydown", a.onkeypress); a.bind(document, "keydown", function(b) { b.ctrlkey && (a.wheelprevented = !0) }); a.bind(document, "keyup", function(b) { b.ctrlkey || (a.wheelprevented = !1) }); a.bind(window, "blur", function(b) { a.wheelprevented = !1 }); a.bind(window, "resize", a.lazyresize); a.bind(window, "orientationchange", a.lazyresize); a.bind(window, "load", a.lazyresize); if (e.ischrome && !a.ispage && !a.haswrapper) { var t = a.win.attr("style"), m = parsefloat(a.win.css("width")) + 1; a.win.css("width", m); a.synched("chromefix", function() { a.win.attr("style", t) }) } a.onattributechange = function(b) { a.lazyresize(a.isieold ? 250 : 30) }; a.isie11 || !1 === x || (a.observerbody = new x(function(b) { b.foreach(function(b) { if ("attributes" == b.type) return f("body").hasclass("modal-open") && f("body").hasclass("modal-dialog") && !f.contains(f(".modal-dialog")[0], a.doc[0]) ? a.hide() : a.show() }); if (document.body.scrollheight != a.page.maxh) return a.lazyresize(30) }), a.observerbody.observe(document.body, { childlist: !0, subtree: !0, characterdata: !1, attributes: !0, attributefilter: ["class"] })); a.ispage || a.haswrapper || (!1 !== x ? (a.observer = new x(function(b) { b.foreach(a.onattributechange) }), a.observer.observe(a.win[0], { childlist: !0, characterdata: !1, attributes: !0, subtree: !1 }), a.observerremover = new x(function(b) { b.foreach(function(b) { if (0 < b.removednodes.length) for (var c in b.removednodes) if (a && b.removednodes[c] == a.win[0]) return a.remove() }) }), a.observerremover.observe(a.win[0].parentnode, { childlist: !0, characterdata: !1, attributes: !1, subtree: !1 })) : (a.bind(a.win, e.isie && !e.isie9 ? "propertychange": "domattrmodified", a.onattributechange), e.isie9 && a.win[0].attachevent("onpropertychange", a.onattributechange), a.bind(a.win, "domnoderemoved", function(b) { b.target == a.win[0] && a.remove() }))); ! a.ispage && a.opt.boxzoom && a.bind(window, "resize", a.resizezoom); a.istextarea && (a.bind(a.win, "keydown", a.lazyresize), a.bind(a.win, "mouseup", a.lazyresize)); a.lazyresize(30) } if ("iframe" == this.doc[0].nodename) { var n = function() { a.iframexd = !1; var c; try { c = "contentdocument" in this ? this.contentdocument: this.contentwindow.document } catch(g) { a.iframexd = !0, c = !1 } if (a.iframexd) return "console" in window && console.log("nicescroll error: policy restriced iframe"), !0; a.forcescreen = !0; a.isiframe && (a.iframe = { doc: f(c), html: a.doc.contents().find("html")[0], body: a.doc.contents().find("body")[0] }, a.getcontentsize = function() { return { w: math.max(a.iframe.html.scrollwidth, a.iframe.body.scrollwidth), h: math.max(a.iframe.html.scrollheight, a.iframe.body.scrollheight) } }, a.docscroll = f(a.iframe.body)); if (!e.isios && a.opt.iframeautoresize && !a.isiframe) { a.win.scrolltop(0); a.doc.height(""); var d = math.max(c.getelementsbytagname("html")[0].scrollheight, c.body.scrollheight); a.doc.height(d) } a.lazyresize(30); e.isie7 && a.css(f(a.iframe.html), b); a.css(f(a.iframe.body), b); e.isios && a.haswrapper && a.css(f(c.body), { "-webkit-transform": "translate3d(0,0,0)" }); "contentwindow" in this ? a.bind(this.contentwindow, "scroll", a.onscroll) : a.bind(c, "scroll", a.onscroll); a.opt.enablemousewheel && a.mousewheel(c, a.onmousewheel); a.opt.enablekeyboard && a.bind(c, e.isopera ? "keypress": "keydown", a.onkeypress); if (e.cantouch || a.opt.touchbehavior) a.bind(c, "mousedown", a.ontouchstart), a.bind(c, "mousemove", function(b) { return a.ontouchmove(b, !0) }), a.opt.grabcursorenabled && e.cursorgrabvalue && a.css(f(c.body), { cursor: e.cursorgrabvalue }); a.bind(c, "mouseup", a.ontouchend); a.zoom && (a.opt.dblclickzoom && a.bind(c, "dblclick", a.dozoom), a.ongesturezoom && a.bind(c, "gestureend", a.ongesturezoom)) }; this.doc[0].readystate && "complete" == this.doc[0].readystate && settimeout(function() { n.call(a.doc[0], !1) }, 500); a.bind(this.doc, "load", n) } }; this.showcursor = function(b, c) { a.cursortimeout && (cleartimeout(a.cursortimeout), a.cursortimeout = 0); if (a.rail) { a.autohidedom && (a.autohidedom.stop().css({ opacity: a.opt.cursoropacitymax }), a.cursoractive = !0); a.rail.drag && 1 == a.rail.drag.pt || (void 0 !== b && !1 !== b && (a.scroll.y = math.round(1 * b / a.scrollratio.y)), void 0 !== c && (a.scroll.x = math.round(1 * c / a.scrollratio.x))); a.cursor.css({ height: a.cursorheight, top: a.scroll.y }); if (a.cursorh) { var d = a.hasreversehr ? a.scrollvaluemaxw - a.scroll.x: a.scroll.x; ! a.rail.align && a.rail.visibility ? a.cursorh.css({ width: a.cursorwidth, left: d + a.rail.width }) : a.cursorh.css({ width: a.cursorwidth, left: d }); a.cursoractive = !0 } a.zoom && a.zoom.stop().css({ opacity: a.opt.cursoropacitymax }) } }; this.hidecursor = function(b) { a.cursortimeout || !a.rail || !a.autohidedom || a.hasmousefocus && "leave" == a.opt.autohidemode || (a.cursortimeout = settimeout(function() { a.rail.active && a.showonmouseevent || (a.autohidedom.stop().animate({ opacity: a.opt.cursoropacitymin }), a.zoom && a.zoom.stop().animate({ opacity: a.opt.cursoropacitymin }), a.cursoractive = !1); a.cursortimeout = 0 }, b || a.opt.hidecursordelay)) }; this.noticecursor = function(b, c, d) { a.showcursor(c, d); a.rail.active || a.hidecursor(b) }; this.getcontentsize = a.ispage ? function() { return { w: math.max(document.body.scrollwidth, document.documentelement.scrollwidth), h: math.max(document.body.scrollheight, document.documentelement.scrollheight) } }: a.haswrapper ? function() { return { w: a.doc.outerwidth() + parseint(a.win.css("paddingleft")) + parseint(a.win.css("paddingright")), h: a.doc.outerheight() + parseint(a.win.css("paddingtop")) + parseint(a.win.css("paddingbottom")) } }: function() { return { w: a.docscroll[0].scrollwidth, h: a.docscroll[0].scrollheight } }; this.onresize = function(b, c) { if (!a || !a.win) return ! 1; if (!a.haswrapper && !a.ispage) { if ("none" == a.win.css("display")) return a.visibility && a.hiderail().hiderailhr(), !1; a.hidden || a.visibility || a.showrail().showrailhr() } var d = a.page.maxh, e = a.page.maxw, f = a.view.h, k = a.view.w; a.view = { w: a.ispage ? a.win.width() : parseint(a.win[0].clientwidth), h: a.ispage ? a.win.height() : parseint(a.win[0].clientheight) }; a.page = c ? c: a.getcontentsize(); a.page.maxh = math.max(0, a.page.h - a.view.h); a.page.maxw = math.max(0, a.page.w - a.view.w); if (a.page.maxh == d && a.page.maxw == e && a.view.w == k && a.view.h == f) { if (a.ispage) return a; d = a.win.offset(); if (a.lastposition && (e = a.lastposition, e.top == d.top && e.left == d.left)) return a; a.lastposition = d } 0 == a.page.maxh ? (a.hiderail(), a.scrollvaluemax = 0, a.scroll.y = 0, a.scrollratio.y = 0, a.cursorheight = 0, a.setscrolltop(0), a.rail && (a.rail.scrollable = !1)) : (a.page.maxh -= a.opt.railpadding.top + a.opt.railpadding.bottom, a.rail.scrollable = !0); 0 == a.page.maxw ? (a.hiderailhr(), a.scrollvaluemaxw = 0, a.scroll.x = 0, a.scrollratio.x = 0, a.cursorwidth = 0, a.setscrollleft(0), a.railh && (a.railh.scrollable = !1)) : (a.page.maxw -= a.opt.railpadding.left + a.opt.railpadding.right, a.railh && (a.railh.scrollable = a.opt.horizrailenabled)); a.railslocked = a.locked || 0 == a.page.maxh && 0 == a.page.maxw; if (a.railslocked) return a.ispage || a.updatescrollbar(a.view), !1; a.hidden || a.visibility ? !a.railh || a.hidden || a.railh.visibility || a.showrailhr() : a.showrail().showrailhr(); a.istextarea && a.win.css("resize") && "none" != a.win.css("resize") && (a.view.h -= 20); a.cursorheight = math.min(a.view.h, math.round(a.view.h / a.page.h * a.view.h)); a.cursorheight = a.opt.cursorfixedheight ? a.opt.cursorfixedheight: math.max(a.opt.cursorminheight, a.cursorheight); a.cursorwidth = math.min(a.view.w, math.round(a.view.w / a.page.w * a.view.w)); a.cursorwidth = a.opt.cursorfixedheight ? a.opt.cursorfixedheight: math.max(a.opt.cursorminheight, a.cursorwidth); a.scrollvaluemax = a.view.h - a.cursorheight - a.cursor.hborder - (a.opt.railpadding.top + a.opt.railpadding.bottom); a.railh && (a.railh.width = 0 < a.page.maxh ? a.view.w - a.rail.width: a.view.w, a.scrollvaluemaxw = a.railh.width - a.cursorwidth - a.cursorh.wborder - (a.opt.railpadding.left + a.opt.railpadding.right)); a.ispage || a.updatescrollbar(a.view); a.scrollratio = { x: a.page.maxw / a.scrollvaluemaxw, y: a.page.maxh / a.scrollvaluemax }; a.getscrolltop() > a.page.maxh ? a.doscrolltop(a.page.maxh) : (a.scroll.y = math.round(a.getscrolltop() * (1 / a.scrollratio.y)), a.scroll.x = math.round(a.getscrollleft() * (1 / a.scrollratio.x)), a.cursoractive && a.noticecursor()); a.scroll.y && 0 == a.getscrolltop() && a.doscrollto(math.floor(a.scroll.y * a.scrollratio.y)); return a }; this.resize = a.onresize; this.hlazyresize = 0; this.lazyresize = function(b) { a.haswrapper || a.hide(); a.hlazyresize && cleartimeout(a.hlazyresize); a.hlazyresize = settimeout(function() { a && a.show().resize() }, 240); return a }; this.jqbind = function(b, c, d) { a.events.push({ e: b, n: c, f: d, q: !0 }); f(b).bind(c, d) }; this.mousewheel = function(b, c, d) { b = "jquery" in b ? b[0] : b; if ("onwheel" in document.createelement("div")) a._bind(b, "wheel", c, d || !1); else { var e = void 0 !== document.onmousewheel ? "mousewheel": "dommousescroll"; q(b, e, c, d || !1); "dommousescroll" == e && q(b, "mozmousepixelscroll", c, d || !1) } }; e.haseventlistener ? (this.bind = function(b, c, d, e) { a._bind("jquery" in b ? b[0] : b, c, d, e || !1) }, this._bind = function(b, c, d, e) { a.events.push({ e: b, n: c, f: d, b: e, q: !1 }); b.addeventlistener(c, d, e || !1) }, this.cancelevent = function(a) { if (!a) return ! 1; a = a.original ? a.original: a; a.cancelable && a.preventdefault(); a.stoppropagation(); a.preventmanipulation && a.preventmanipulation(); return ! 1 }, this.stoppropagation = function(a) { if (!a) return ! 1; a = a.original ? a.original: a; a.stoppropagation(); return ! 1 }, this._unbind = function(a, c, d, e) { a.removeeventlistener(c, d, e) }) : (this.bind = function(b, c, d, e) { var f = "jquery" in b ? b[0] : b; a._bind(f, c, function(b) { (b = b || window.event || !1) && b.srcelement && (b.target = b.srcelement); "pagey" in b || (b.pagex = b.clientx + document.documentelement.scrollleft, b.pagey = b.clienty + document.documentelement.scrolltop); return ! 1 === d.call(f, b) || !1 === e ? a.cancelevent(b) : !0 }) }, this._bind = function(b, c, d, e) { a.events.push({ e: b, n: c, f: d, b: e, q: !1 }); b.attachevent ? b.attachevent("on" + c, d) : b["on" + c] = d }, this.cancelevent = function(a) { a = window.event || !1; if (!a) return ! 1; a.cancelbubble = !0; a.cancel = !0; return a.returnvalue = !1 }, this.stoppropagation = function(a) { a = window.event || !1; if (!a) return ! 1; a.cancelbubble = !0; return ! 1 }, this._unbind = function(a, c, d, e) { a.detachevent ? a.detachevent("on" + c, d) : a["on" + c] = !1 }); this.unbindall = function() { for (var b = 0; b < a.events.length; b++) { var c = a.events[b]; c.q ? c.e.unbind(c.n, c.f) : a._unbind(c.e, c.n, c.f, c.b) } }; this.showrail = function() { 0 == a.page.maxh || !a.ispage && "none" == a.win.css("display") || (a.visibility = !0, a.rail.visibility = !0, a.rail.css("display", "block")); return a }; this.showrailhr = function() { if (!a.railh) return a; 0 == a.page.maxw || !a.ispage && "none" == a.win.css("display") || (a.railh.visibility = !0, a.railh.css("display", "block")); return a }; this.hiderail = function() { a.visibility = !1; a.rail.visibility = !1; a.rail.css("display", "none"); return a }; this.hiderailhr = function() { if (!a.railh) return a; a.railh.visibility = !1; a.railh.css("display", "none"); return a }; this.show = function() { a.hidden = !1; a.railslocked = !1; return a.showrail().showrailhr() }; this.hide = function() { a.hidden = !0; a.railslocked = !0; return a.hiderail().hiderailhr() }; this.toggle = function() { return a.hidden ? a.show() : a.hide() }; this.remove = function() { a.stop(); a.cursortimeout && cleartimeout(a.cursortimeout); for (var b in a.delaylist) a.delaylist[b] && w(a.delaylist[b].h); a.dozoomout(); a.unbindall(); e.isie9 && a.win[0].detachevent("onpropertychange", a.onattributechange); ! 1 !== a.observer && a.observer.disconnect(); ! 1 !== a.observerremover && a.observerremover.disconnect(); ! 1 !== a.observerbody && a.observerbody.disconnect(); a.events = null; a.cursor && a.cursor.remove(); a.cursorh && a.cursorh.remove(); a.rail && a.rail.remove(); a.railh && a.railh.remove(); a.zoom && a.zoom.remove(); for (b = 0; b < a.saved.css.length; b++) { var c = a.saved.css[b]; c[0].css(c[1], void 0 === c[2] ? "": c[2]) } a.saved = !1; a.me.data("__nicescroll", ""); var d = f.nicescroll; d.each(function(b) { if (this && this.id === a.id) { delete d[b]; for (var c = ++b; c < d.length; c++, b++) d[b] = d[c]; d.length--; d.length && delete d[d.length] } }); for (var k in a) a[k] = null, delete a[k]; a = null }; this.scrollstart = function(b) { this.onscrollstart = b; return a }; this.scrollend = function(b) { this.onscrollend = b; return a }; this.scrollcancel = function(b) { this.onscrollcancel = b; return a }; this.zoomin = function(b) { this.onzoomin = b; return a }; this.zoomout = function(b) { this.onzoomout = b; return a }; this.isscrollable = function(a) { a = a.target ? a.target: a; if ("option" == a.nodename) return ! 0; for (; a && 1 == a.nodetype && !/^body|html/.test(a.nodename);) { var c = f(a), c = c.css("overflowy") || c.css("overflowx") || c.css("overflow") || ""; if (/scroll|auto/.test(c)) return a.clientheight != a.scrollheight; a = a.parentnode ? a.parentnode: !1 } return ! 1 }; this.getviewport = function(a) { for (a = a && a.parentnode ? a.parentnode: !1; a && 1 == a.nodetype && !/^body|html/.test(a.nodename);) { var c = f(a); if (/fixed|absolute/.test(c.css("position"))) return c; var d = c.css("overflowy") || c.css("overflowx") || c.css("overflow") || ""; if (/scroll|auto/.test(d) && a.clientheight != a.scrollheight || 0 < c.getnicescroll().length) return c; a = a.parentnode ? a.parentnode: !1 } return ! 1 }; this.triggerscrollend = function() { if (a.onscrollend) { var b = a.getscrollleft(), c = a.getscrolltop(); a.onscrollend.call(a, { type: "scrollend", current: { x: b, y: c }, end: { x: b, y: c } }) } }; this.onmousewheel = function(b) { if (!a.wheelprevented) { if (a.railslocked) return a.debounced("checkunlock", a.resize, 250), !0; if (a.rail.drag) return a.cancelevent(b); "auto" == a.opt.oneaxismousemode && 0 != b.deltax && (a.opt.oneaxismousemode = !1); if (a.opt.oneaxismousemode && 0 == b.deltax && !a.rail.scrollable) return a.railh && a.railh.scrollable ? a.onmousewheelhr(b) : !0; var c = +new date, d = !1; a.opt.preservenativescrolling && a.checkarea + 600 < c && (a.nativescrollingarea = a.isscrollable(b), d = !0); a.checkarea = c; if (a.nativescrollingarea) return ! 0; if (b = t(b, !1, d)) a.checkarea = 0; return b } }; this.onmousewheelhr = function(b) { if (!a.wheelprevented) { if (a.railslocked || !a.railh.scrollable) return ! 0; if (a.rail.drag) return a.cancelevent(b); var c = +new date, d = !1; a.opt.preservenativescrolling && a.checkarea + 600 < c && (a.nativescrollingarea = a.isscrollable(b), d = !0); a.checkarea = c; return a.nativescrollingarea ? !0 : a.railslocked ? a.cancelevent(b) : t(b, !0, d) } }; this.stop = function() { a.cancelscroll(); a.scrollmon && a.scrollmon.stop(); a.cursorfreezed = !1; a.scroll.y = math.round(a.getscrolltop() * (1 / a.scrollratio.y)); a.noticecursor(); return a }; this.gettransitionspeed = function(b) { b = math.min(math.round(10 * a.opt.scrollspeed), math.round(b / 20 * a.opt.scrollspeed)); return 20 < b ? b: 0 }; a.opt.smoothscroll ? a.ishwscroll && e.hastransition && a.opt.usetransition && a.opt.smoothscroll ? (this.preparetransition = function(b, c) { var d = c ? 20 < b ? b: 0 : a.gettransitionspeed(b), f = d ? e.prefixstyle + "transform " + d + "ms ease-out": ""; a.lasttransitionstyle && a.lasttransitionstyle == f || (a.lasttransitionstyle = f, a.doc.css(e.transitionstyle, f)); return d }, this.doscrollleft = function(b, c) { var d = a.scrollrunning ? a.newscrolly: a.getscrolltop(); a.doscrollpos(b, d, c) }, this.doscrolltop = function(b, c) { var d = a.scrollrunning ? a.newscrollx: a.getscrollleft(); a.doscrollpos(d, b, c) }, this.doscrollpos = function(b, c, d) { var f = a.getscrolltop(), k = a.getscrollleft(); (0 > (a.newscrolly - f) * (c - f) || 0 > (a.newscrollx - k) * (b - k)) && a.cancelscroll(); 0 == a.opt.bouncescroll && (0 > c ? c = 0 : c > a.page.maxh && (c = a.page.maxh), 0 > b ? b = 0 : b > a.page.maxw && (b = a.page.maxw)); if (a.scrollrunning && b == a.newscrollx && c == a.newscrolly) return ! 1; a.newscrolly = c; a.newscrollx = b; a.newscrollspeed = d || !1; if (a.timer) return ! 1; a.timer = settimeout(function() { var d = a.getscrolltop(), f = a.getscrollleft(), k = math.round(math.sqrt(math.pow(b - f, 2) + math.pow(c - d, 2))), k = a.newscrollspeed && 1 < a.newscrollspeed ? a.newscrollspeed: a.gettransitionspeed(k); a.newscrollspeed && 1 >= a.newscrollspeed && (k *= a.newscrollspeed); a.preparetransition(k, !0); a.timerscroll && a.timerscroll.tm && clearinterval(a.timerscroll.tm); 0 < k && (!a.scrollrunning && a.onscrollstart && a.onscrollstart.call(a, { type: "scrollstart", current: { x: f, y: d }, request: { x: b, y: c }, end: { x: a.newscrollx, y: a.newscrolly }, speed: k }), e.transitionend ? a.scrollendtrapped || (a.scrollendtrapped = !0, a.bind(a.doc, e.transitionend, a.onscrolltransitionend, !1)) : (a.scrollendtrapped && cleartimeout(a.scrollendtrapped), a.scrollendtrapped = settimeout(a.onscrolltransitionend, k)), a.timerscroll = { bz: new d(d, a.newscrolly, k, 0, 0, .58, 1), bh: new d(f, a.newscrollx, k, 0, 0, .58, 1) }, a.cursorfreezed || (a.timerscroll.tm = setinterval(function() { a.showcursor(a.getscrolltop(), a.getscrollleft()) }, 60))); a.synched("doscroll-set", function() { a.timer = 0; a.scrollendtrapped && (a.scrollrunning = !0); a.setscrolltop(a.newscrolly); a.setscrollleft(a.newscrollx); if (!a.scrollendtrapped) a.onscrolltransitionend() }) }, 50) }, this.cancelscroll = function() { if (!a.scrollendtrapped) return ! 0; var b = a.getscrolltop(), c = a.getscrollleft(); a.scrollrunning = !1; e.transitionend || cleartimeout(e.transitionend); a.scrollendtrapped = !1; a._unbind(a.doc[0], e.transitionend, a.onscrolltransitionend); a.preparetransition(0); a.setscrolltop(b); a.railh && a.setscrollleft(c); a.timerscroll && a.timerscroll.tm && clearinterval(a.timerscroll.tm); a.timerscroll = !1; a.cursorfreezed = !1; a.showcursor(b, c); return a }, this.onscrolltransitionend = function() { a.scrollendtrapped && a._unbind(a.doc[0], e.transitionend, a.onscrolltransitionend); a.scrollendtrapped = !1; a.preparetransition(0); a.timerscroll && a.timerscroll.tm && clearinterval(a.timerscroll.tm); a.timerscroll = !1; var b = a.getscrolltop(), c = a.getscrollleft(); a.setscrolltop(b); a.railh && a.setscrollleft(c); a.noticecursor(!1, b, c); a.cursorfreezed = !1; 0 > b ? b = 0 : b > a.page.maxh && (b = a.page.maxh); 0 > c ? c = 0 : c > a.page.maxw && (c = a.page.maxw); if (b != a.newscrolly || c != a.newscrollx) return a.doscrollpos(c, b, a.opt.snapbackspeed); a.onscrollend && a.scrollrunning && a.triggerscrollend(); a.scrollrunning = !1 }) : (this.doscrollleft = function(b, c) { var d = a.scrollrunning ? a.newscrolly: a.getscrolltop(); a.doscrollpos(b, d, c) }, this.doscrolltop = function(b, c) { var d = a.scrollrunning ? a.newscrollx: a.getscrollleft(); a.doscrollpos(d, b, c) }, this.doscrollpos = function(b, c, d) { function e() { if (a.cancelanimationframe) return ! 0; a.scrollrunning = !0; if (p = 1 - p) return a.timer = v(e) || 1; var b = 0, c, d, f = d = a.getscrolltop(); if (a.dst.ay) { f = a.bzscroll ? a.dst.py + a.bzscroll.getnow() * a.dst.ay: a.newscrolly; c = f - d; if (0 > c && f < a.newscrolly || 0 < c && f > a.newscrolly) f = a.newscrolly; a.setscrolltop(f); f == a.newscrolly && (b = 1) } else b = 1; d = c = a.getscrollleft(); if (a.dst.ax) { d = a.bzscroll ? a.dst.px + a.bzscroll.getnow() * a.dst.ax: a.newscrollx; c = d - c; if (0 > c && d < a.newscrollx || 0 < c && d > a.newscrollx) d = a.newscrollx; a.setscrollleft(d); d == a.newscrollx && (b += 1) } else b += 1; 2 == b ? (a.timer = 0, a.cursorfreezed = !1, a.bzscroll = !1, a.scrollrunning = !1, 0 > f ? f = 0 : f > a.page.maxh && (f = math.max(0, a.page.maxh)), 0 > d ? d = 0 : d > a.page.maxw && (d = a.page.maxw), d != a.newscrollx || f != a.newscrolly ? a.doscrollpos(d, f) : a.onscrollend && a.triggerscrollend()) : a.timer = v(e) || 1 } c = void 0 === c || !1 === c ? a.getscrolltop(!0) : c; if (a.timer && a.newscrolly == c && a.newscrollx == b) return ! 0; a.timer && w(a.timer); a.timer = 0; var f = a.getscrolltop(), k = a.getscrollleft(); (0 > (a.newscrolly - f) * (c - f) || 0 > (a.newscrollx - k) * (b - k)) && a.cancelscroll(); a.newscrolly = c; a.newscrollx = b; a.bouncescroll && a.rail.visibility || (0 > a.newscrolly ? a.newscrolly = 0 : a.newscrolly > a.page.maxh && (a.newscrolly = a.page.maxh)); a.bouncescroll && a.railh.visibility || (0 > a.newscrollx ? a.newscrollx = 0 : a.newscrollx > a.page.maxw && (a.newscrollx = a.page.maxw)); a.dst = {}; a.dst.x = b - k; a.dst.y = c - f; a.dst.px = k; a.dst.py = f; var h = math.round(math.sqrt(math.pow(a.dst.x, 2) + math.pow(a.dst.y, 2))); a.dst.ax = a.dst.x / h; a.dst.ay = a.dst.y / h; var l = 0, n = h; 0 == a.dst.x ? (l = f, n = c, a.dst.ay = 1, a.dst.py = 0) : 0 == a.dst.y && (l = k, n = b, a.dst.ax = 1, a.dst.px = 0); h = a.gettransitionspeed(h); d && 1 >= d && (h *= d); a.bzscroll = 0 < h ? a.bzscroll ? a.bzscroll.update(n, h) : new d(l, n, h, 0, 1, 0, 1) : !1; if (!a.timer) { (f == a.page.maxh && c >= a.page.maxh || k == a.page.maxw && b >= a.page.maxw) && a.checkcontentsize(); var p = 1; a.cancelanimationframe = !1; a.timer = 1; a.onscrollstart && !a.scrollrunning && a.onscrollstart.call(a, { type: "scrollstart", current: { x: k, y: f }, request: { x: b, y: c }, end: { x: a.newscrollx, y: a.newscrolly }, speed: h }); e(); (f == a.page.maxh && c >= f || k == a.page.maxw && b >= k) && a.checkcontentsize(); a.noticecursor() } }, this.cancelscroll = function() { a.timer && w(a.timer); a.timer = 0; a.bzscroll = !1; a.scrollrunning = !1; return a }) : (this.doscrollleft = function(b, c) { var d = a.getscrolltop(); a.doscrollpos(b, d, c) }, this.doscrolltop = function(b, c) { var d = a.getscrollleft(); a.doscrollpos(d, b, c) }, this.doscrollpos = function(b, c, d) { var e = b > a.page.maxw ? a.page.maxw: b; 0 > e && (e = 0); var f = c > a.page.maxh ? a.page.maxh: c; 0 > f && (f = 0); a.synched("scroll", function() { a.setscrolltop(f); a.setscrollleft(e) }) }, this.cancelscroll = function() {}); this.doscrollby = function(b, c) { var d = 0, d = c ? math.floor((a.scroll.y - b) * a.scrollratio.y) : (a.timer ? a.newscrolly: a.getscrolltop(!0)) - b; if (a.bouncescroll) { var e = math.round(a.view.h / 2); d < -e ? d = -e: d > a.page.maxh + e && (d = a.page.maxh + e) } a.cursorfreezed = !1; e = a.getscrolltop(!0); if (0 > d && 0 >= e) return a.noticecursor(); if (d > a.page.maxh && e >= a.page.maxh) return a.checkcontentsize(), a.noticecursor(); a.doscrolltop(d) }; this.doscrollleftby = function(b, c) { var d = 0, d = c ? math.floor((a.scroll.x - b) * a.scrollratio.x) : (a.timer ? a.newscrollx: a.getscrollleft(!0)) - b; if (a.bouncescroll) { var e = math.round(a.view.w / 2); d < -e ? d = -e: d > a.page.maxw + e && (d = a.page.maxw + e) } a.cursorfreezed = !1; e = a.getscrollleft(!0); if (0 > d && 0 >= e || d > a.page.maxw && e >= a.page.maxw) return a.noticecursor(); a.doscrollleft(d) }; this.doscrollto = function(b, c) { a.cursorfreezed = !1; a.doscrolltop(b) }; this.checkcontentsize = function() { var b = a.getcontentsize(); b.h == a.page.h && b.w == a.page.w || a.resize(!1, b) }; a.onscroll = function(b) { a.rail.drag || a.cursorfreezed || a.synched("scroll", function() { a.scroll.y = math.round(a.getscrolltop() * (1 / a.scrollratio.y)); a.railh && (a.scroll.x = math.round(a.getscrollleft() * (1 / a.scrollratio.x))); a.noticecursor() }) }; a.bind(a.docscroll, "scroll", a.onscroll); this.dozoomin = function(b) { if (!a.zoomactive) { a.zoomactive = !0; a.zoomrestore = { style: {} }; var c = "position top left zindex backgroundcolor margintop marginbottom marginleft marginright".split(" "), d = a.win[0].style, k; for (k in c) { var h = c[k]; a.zoomrestore.style[h] = void 0 !== d[h] ? d[h] : "" } a.zoomrestore.style.width = a.win.css("width"); a.zoomrestore.style.height = a.win.css("height"); a.zoomrestore.padding = { w: a.win.outerwidth() - a.win.width(), h: a.win.outerheight() - a.win.height() }; e.isios4 && (a.zoomrestore.scrolltop = f(window).scrolltop(), f(window).scrolltop(0)); a.win.css({ position: e.isios4 ? "absolute": "fixed", top: 0, left: 0, zindex: a + 100, margin: 0 }); c = a.win.css("backgroundcolor"); ("" == c || /transparent|rgba\(0, 0, 0, 0\)|rgba\(0,0,0,0\)/.test(c)) && a.win.css("backgroundcolor", "#fff"); a.rail.css({ zindex: a + 101 }); a.zoom.css({ zindex: a + 102 }); a.zoom.css("backgroundposition", "0px -18px"); a.resizezoom(); a.onzoomin && a.onzoomin.call(a); return a.cancelevent(b) } }; this.dozoomout = function(b) { if (a.zoomactive) return a.zoomactive = !1, a.win.css("margin", ""), a.win.css(a.zoomrestore.style), e.isios4 && f(window).scrolltop(a.zoomrestore.scrolltop), a.rail.css({ "z-index": a.zindex }), a.zoom.css({ "z-index": a.zindex }), a.zoomrestore = !1, a.zoom.css("backgroundposition", "0px 0px"), a.onresize(), a.onzoomout && a.onzoomout.call(a), a.cancelevent(b) }; this.dozoom = function(b) { return a.zoomactive ? a.dozoomout(b) : a.dozoomin(b) }; this.resizezoom = function() { if (a.zoomactive) { var b = a.getscrolltop(); a.win.css({ width: f(window).width() - a.zoomrestore.padding.w + "px", height: f(window).height() - a.zoomrestore.padding.h + "px" }); a.onresize(); a.setscrolltop(math.min(a.page.maxh, b)) } }; this.init(); f.nicescroll.push(this) }, m = function(f) { var c = this; this.nc = f; this.steptime = this.lasttime = this.speedy = this.speedx = this.lasty = this.lastx = 0; this.snapy = this.snapx = !1; this.demuly = this.demulx = 0; this.lastscrolly = this.lastscrollx = -1; this.timer = this.chky = this.chkx = 0; this.time = function() { return + new date }; this.reset = function(f, h) { c.stop(); var d = c.time(); c.steptime = 0; c.lasttime = d; c.speedx = 0; c.speedy = 0; c.lastx = f; c.lasty = h; c.lastscrollx = -1; c.lastscrolly = -1 }; this.update = function(f, h) { var d = c.time(); c.steptime = d - c.lasttime; c.lasttime = d; var d = h - c.lasty, q = f - c.lastx, t = c.nc.getscrolltop(), a = c.nc.getscrollleft(), t = t + d, a = a + q; c.snapx = 0 > a || a > c.nc.page.maxw; c.snapy = 0 > t || t > c.nc.page.maxh; c.speedx = q; c.speedy = d; c.lastx = f; c.lasty = h }; this.stop = function() { c.nc.unsynched("domomentum2d"); c.timer && cleartimeout(c.timer); c.timer = 0; c.lastscrollx = -1; c.lastscrolly = -1 }; this.dosnapy = function(f, h) { var d = !1; 0 > h ? (h = 0, d = !0) : h > c.nc.page.maxh && (h = c.nc.page.maxh, d = !0); 0 > f ? (f = 0, d = !0) : f > c.nc.page.maxw && (f = c.nc.page.maxw, d = !0); d ? c.nc.doscrollpos(f, h, c.nc.opt.snapbackspeed) : c.nc.triggerscrollend() }; this.domomentum = function(f) { var h = c.time(), d = f ? h + f: c.lasttime; f = c.nc.getscrollleft(); var q = c.nc.getscrolltop(), t = c.nc.page.maxh, a = c.nc.page.maxw; c.speedx = 0 < a ? math.min(60, c.speedx) : 0; c.speedy = 0 < t ? math.min(60, c.speedy) : 0; d = d && 60 >= h - d; if (0 > q || q > t || 0 > f || f > a) d = !1; f = c.speedx && d ? c.speedx: !1; if (c.speedy && d && c.speedy || f) { var r = math.max(16, c.steptime); 50 < r && (f = r / 50, c.speedx *= f, c.speedy *= f, r = 50); c.demulxy = 0; c.lastscrollx = c.nc.getscrollleft(); c.chkx = c.lastscrollx; c.lastscrolly = c.nc.getscrolltop(); c.chky = c.lastscrolly; var p = c.lastscrollx, e = c.lastscrolly, v = function() { var d = 600 < c.time() - h ? .04 : .02; c.speedx && (p = math.floor(c.lastscrollx - c.speedx * (1 - c.demulxy)), c.lastscrollx = p, 0 > p || p > a) && (d = .1); c.speedy && (e = math.floor(c.lastscrolly - c.speedy * (1 - c.demulxy)), c.lastscrolly = e, 0 > e || e > t) && (d = .1); c.demulxy = math.min(1, c.demulxy + d); c.nc.synched("domomentum2d", function() { c.speedx && (c.nc.getscrollleft(), c.chkx = p, c.nc.setscrollleft(p)); c.speedy && (c.nc.getscrolltop(), c.chky = e, c.nc.setscrolltop(e)); c.timer || (c.nc.hidecursor(), c.dosnapy(p, e)) }); 1 > c.demulxy ? c.timer = settimeout(v, r) : (c.stop(), c.nc.hidecursor(), c.dosnapy(p, e)) }; v() } else c.dosnapy(c.nc.getscrollleft(), c.nc.getscrolltop()) } }, y = f.fn.scrolltop; f.csshooks.pageyoffset = { get: function(h, c, k) { return (c = f.data(h, "__nicescroll") || !1) && c.ishwscroll ? c.getscrolltop() : y.call(h) }, set: function(h, c) { var k = f.data(h, "__nicescroll") || !1; k && k.ishwscroll ? k.setscrolltop(parseint(c)) : y.call(h, c); return this } }; f.fn.scrolltop = function(h) { if (void 0 === h) { var c = this[0] ? f.data(this[0], "__nicescroll") || !1 : !1; return c && c.ishwscroll ? c.getscrolltop() : y.call(this) } return this.each(function() { var c = f.data(this, "__nicescroll") || !1; c && c.ishwscroll ? c.setscrolltop(parseint(h)) : y.call(f(this), h) }) }; var z = f.fn.scrollleft; f.csshooks.pagexoffset = { get: function(h, c, k) { return (c = f.data(h, "__nicescroll") || !1) && c.ishwscroll ? c.getscrollleft() : z.call(h) }, set: function(h, c) { var k = f.data(h, "__nicescroll") || !1; k && k.ishwscroll ? k.setscrollleft(parseint(c)) : z.call(h, c); return this } }; f.fn.scrollleft = function(h) { if (void 0 === h) { var c = this[0] ? f.data(this[0], "__nicescroll") || !1 : !1; return c && c.ishwscroll ? c.getscrollleft() : z.call(this) } return this.each(function() { var c = f.data(this, "__nicescroll") || !1; c && c.ishwscroll ? c.setscrollleft(parseint(h)) : z.call(f(this), h) }) }; var e = function(h) { var c = this; this.length = 0; this.name = "nicescrollarray"; this.each = function(d) { f.each(c, d); return c }; this.push = function(d) { c[c.length] = d; c.length++ }; this.eq = function(d) { return c[d] }; if (h) for (var k = 0; k < h.length; k++) { var l = f.data(h[k], "__nicescroll") || !1; l && (this[this.length] = l, this.length++) } return this }; (function(f, c, k) { for (var l = 0; l < c.length; l++) k(f, c[l]) })(e.prototype, "show hide toggle onresize resize remove stop doscrollpos".split(" "), function(f, c) { f[c] = function() { var f = arguments; return this.each(function() { this[c].apply(this, f) }) } }); f.fn.getnicescroll = function(h) { return void 0 === h ? new e(this) : this[h] && f.data(this[h], "__nicescroll") || !1 }; f.expr[":"].nicescroll = function(h) { return void 0 !== f.data(h, "__nicescroll") }; f.fn.nicescroll = function(h, c) { void 0 !== c || "object" != typeof h || "jquery" in h || (c = h, h = !1); c = f.extend({}, c); var k = new e; void 0 === c && (c = {}); h && (c.doc = f(h), c.win = f(this)); var l = !("doc" in c); l || "win" in c || (c.win = f(this)); this.each(function() { var d = f(this).data("__nicescroll") || !1; d || (c.doc = l ? f(this) : c.doc, d = new s(c, f(this)), f(this).data("__nicescroll", d)); k.push(d) }); return 1 == k.length ? k[0] : k }; window.nicescroll = { getjquery: function() { return f } }; f.nicescroll || (f.nicescroll = new e, f.nicescroll.options = k) });