(function(f) { var g = false; var h = false; var i = false; var j = 5000; var k = 2000; var $ = f; function getscriptpath() { var a = document.getelementsbytagname('script'); var b = a[a.length - 1].src.split('?')[0]; return (b.split('/').length > 0) ? b.split('/').slice(0, -1).join('/') + '/': '' } var l = getscriptpath(); var m = (function() { return window.requestanimationframe || window.webkitrequestanimationframe || window.mozrequestanimationframe || window.orequestanimationframe || window.msrequestanimationframe || false })(); var n = (function() { return window.cancelrequestanimationframe || window.webkitcancelrequestanimationframe || window.mozcancelrequestanimationframe || window.ocancelrequestanimationframe || window.mscancelrequestanimationframe || false })(); var o = false; var p = function() { if (o) return o; var c = document.createelement('div'); var d = {}; d.haspointerlock = "pointerlockelement" in document || "mozpointerlockelement" in document || "webkitpointerlockelement" in document; d.isopera = ("opera" in window); d.isopera12 = (d.isopera && ("getusermedia" in navigator)); d.isie = (("all" in document) && ("attachevent" in c) && !d.isopera); d.isieold = (d.isie && !("msinterpolationmode" in c.style)); d.isie7 = d.isie && !d.isieold && (!("documentmode" in document) || (document.documentmode == 7)); d.isie8 = d.isie && ("documentmode" in document) && (document.documentmode == 8); d.isie9 = d.isie && ("performance" in window) && (document.documentmode >= 9); d.isie10 = d.isie && ("performance" in window) && (document.documentmode >= 10); d.isie9mobile = /iemobile.9/i.test(navigator.useragent); if (d.isie9mobile) d.isie9 = false; d.isie7mobile = (!d.isie9mobile && d.isie7) && /iemobile/i.test(navigator.useragent); d.ismozilla = ("mozappearance" in c.style); d.iswebkit = ("webkitappearance" in c.style); d.ischrome = ("chrome" in window); d.ischrome22 = (d.ischrome && d.haspointerlock); d.cantouch = ("ontouchstart" in document.documentelement) || ("ontouchstart" in window); d.hasmstouch = (window.navigator.mspointerenabled || false); d.ismac = /^mac$/i.test(navigator.platform); d.isios = (d.cantouch && /iphone|ipad|ipod/i.test(navigator.platform)); d.isios4 = ((d.isios) && !("seal" in object)); d.isandroid = (/android/i.test(navigator.useragent)); d.trstyle = false; d.hastransform = false; d.hastranslate3d = false; d.transitionstyle = false; d.hastransition = false; d.transitionend = false; var e = ['transform', 'mstransform', 'webkittransform', 'moztransform', 'otransform']; for (var a = 0; a < e.length; a++) { if (typeof c.style[e[a]] != "undefined") { d.trstyle = e[a]; break } } d.hastransform = (d.trstyle != false); if (d.hastransform) { c.style[d.trstyle] = "translate3d(1px,2px,3px)"; d.hastranslate3d = /translate3d/.test(c.style[d.trstyle]) } d.transitionstyle = false; d.prefixstyle = ''; d.transitionend = false; var e = ['transition', 'webkittransition', 'moztransition', 'otransition', 'otransition', 'mstransition', 'khtmltransition']; var f = ['', '-webkit-', '-moz-', '-o-', '-o', '-ms-', '-khtml-']; var g = ['transitionend', 'webkittransitionend', 'transitionend', 'otransitionend', 'otransitionend', 'mstransitionend', 'khtmltransitionend']; for (var a = 0; a < e.length; a++) { if (e[a] in c.style) { d.transitionstyle = e[a]; d.prefixstyle = f[a]; d.transitionend = g[a]; break } } d.hastransition = (d.transitionstyle); function detectcursorgrab() { var b = ['-moz-grab', '-webkit-grab', 'grab']; if ((d.ischrome && !d.ischrome22) || d.isie) b = []; for (var a = 0; a < b.length; a++) { var p = b[a]; c.style['cursor'] = p; if (c.style['cursor'] == p) return p } return 'url(http://www.google.com/intl/en_all/mapfiles/openhand.cur),n-resize' } d.cursorgrabvalue = detectcursorgrab(); d.hasmousecapture = ("setcapture" in c); c = null; o = d; return d }; var q = function(a, b) { var c = this; this.version = '3.1.4'; this.name = 'nicescroll'; c.me = b; this.opt = { doc: $("body"), win: false, zindex: 0, cursoropacitymin: 0, cursoropacitymax: 1, cursorcolor: "#424242", cursorwidth: "5px", cursorborder: "1px solid #fff", cursorborderradius: "5px", scrollspeed: 60, mousescrollstep: 8 * 3, touchbehavior: false, hwacceleration: true, usetransition: true, boxzoom: false, dblclickzoom: true, gesturezoom: true, grabcursorenabled: true, autohidemode: true, background: "", iframeautoresize: true, cursorminheight: 32, preservenativescrolling: true, railoffset: false, bouncescroll: true, spacebarenabled: true, railpadding: { top: 0, right: 0, left: 0, bottom: 0 }, disableoutline: true, horizrailenabled: true, railalign: "right", railvalign: "bottom", enabletranslate3d: true, enablemousewheel: true, enablekeyboard: true, smoothscroll: true, sensitiverail: true, enablemouselockapi: true, cursorfixedheight: false }; this.opt.snapbackspeed = 80; if (a || false) { for (var a in c.opt) { if (typeof a[a] != "undefined") c.opt[a] = a[a] } } this.doc = c.opt.doc; this.iddoc = (this.doc && this.doc[0]) ? this.doc[0].id || '': ''; this.ispage = /body|html/.test((c.opt.win) ? c.opt.win[0].nodename: this.doc[0].nodename); this.haswrapper = (c.opt.win !== false); this.win = c.opt.win || (this.ispage ? $(window) : this.doc); this.docscroll = (this.ispage && !this.haswrapper) ? $(window) : this.win; this.body = $("body"); this.viewport = false; this.isfixed = false; this.iframe = false; this.isiframe = ((this.doc[0].nodename == 'iframe') && (this.win[0].nodename == 'iframe')); this.istextarea = (this.win[0].nodename == 'textarea'); this.forcescreen = false; this.canshowonmouseevent = (c.opt.autohidemode != "scroll"); this.onmousedown = false; this.onmouseup = false; this.onmousemove = false; this.onmousewheel = false; this.onkeypress = false; this.ongesturezoom = false; this.onclick = false; this.onscrollstart = false; this.onscrollend = false; this.onscrollcancel = false; this.onzoomin = false; this.onzoomout = false; this.view = false; this.page = false; this.scroll = { x: 0, y: 0 }; this.scrollratio = { x: 0, y: 0 }; this.cursorheight = 20; this.scrollvaluemax = 0; this.scrollrunning = false; this.scrollmom = false; this.observer = false; do { this.id = "ascrail" + (k++) } while ( document . getelementbyid ( this . id )); this.rail = false; this.cursor = false; this.cursorfreezed = false; this.zoom = false; this.zoomactive = false; this.hasfocus = false; this.hasmousefocus = false; this.visibility = true; this.locked = false; this.hidden = false; this.cursoractive = true; this.nativescrollingarea = false; this.events = []; this.saved = {}; this.delaylist = {}; this.synclist = {}; this.lastdeltax = 0; this.lastdeltay = 0; this.detected = p(); var d = $.extend({}, this.detected); this.canhwscroll = (d.hastransform && c.opt.hwacceleration); this.ishwscroll = (this.canhwscroll && c.haswrapper); this.istouchcapable = false; if (d.cantouch && d.ischrome && !d.isios && !d.isandroid) { this.istouchcapable = true; d.cantouch = false } if (d.cantouch && d.ismozilla && !d.isios) { this.istouchcapable = true; d.cantouch = false } if (!c.opt.enablemouselockapi) { d.hasmousecapture = false; d.haspointerlock = false } this.delayed = function(a, b, c, d) { var e = c.delaylist[a]; var f = (new date()).gettime(); if (!d && e && e.tt) return false; if (e && e.tt) cleartimeout(e.tt); if (e && e.last + c > f && !e.tt) { c.delaylist[a] = { last: f + c, tt: settimeout(function() { c.delaylist[a].tt = 0; b.call() }, c) } } else if (!e || !e.tt) { c.delaylist[a] = { last: f, tt: 0 }; settimeout(function() { b.call() }, 0) } }; this.synched = function(b, c) { function requestsync() { if (c.onsync) return; m(function() { c.onsync = false; for (b in c.synclist) { var a = c.synclist[b]; if (a) a.call(c); c.synclist[b] = false } }); c.onsync = true }; c.synclist[b] = c; requestsync(); return b }; this.unsynched = function(a) { if (c.synclist[a]) c.synclist[a] = false }; this.css = function(a, b) { for (var n in b) { c.saved.css.push([a, n, a.css(n)]); a.css(n, b[n]) } }; this.scrolltop = function(a) { return (typeof a == "undefined") ? c.getscrolltop() : c.setscrolltop(a) }; this.scrollleft = function(a) { return (typeof a == "undefined") ? c.getscrollleft() : c.setscrollleft(a) }; bezierclass = function(a, b, c, d, e, f, g) { this.st = a; this.ed = b; this.spd = c; this.p1 = d || 0; this.p2 = e || 1; this.p3 = f || 0; this.p4 = g || 1; this.ts = (new date()).gettime(); this.df = this.ed - this.st }; bezierclass.prototype = { b2: function(t) { return 3 * t * t * (1 - t) }, b3: function(t) { return 3 * t * (1 - t) * (1 - t) }, b4: function(t) { return (1 - t) * (1 - t) * (1 - t) }, getnow: function() { var a = (new date()).gettime(); var b = 1 - ((a - this.ts) / this.spd); var c = this.b2(b) + this.b3(b) + this.b4(b); return (b < 0) ? this.ed: this.st + math.round(this.df * c) }, update: function(a, b) { this.st = this.getnow(); this.ed = a; this.spd = b; 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" }; if (d.hastranslate3d && d.isios) this.doc.css("-webkit-backface-visibility", "hidden"); function getmatrixvalues() { var a = c.doc.css(d.trstyle); if (a && (a.substr(0, 6) == "matrix")) { return a.replace(/^.*\((.*)\)$/g, "$1").replace(/px/g, '').split(/, +/) } return false } this.getscrolltop = function(a) { if (!a) { var b = getmatrixvalues(); if (b) return (b.length == 16) ? -b[13] : -b[5]; if (c.timerscroll && c.timerscroll.bz) return c.timerscroll.bz.getnow() } return c.doc.translate.y }; this.getscrollleft = function(a) { if (!a) { var b = getmatrixvalues(); if (b) return (b.length == 16) ? -b[12] : -b[4]; if (c.timerscroll && c.timerscroll.bh) return c.timerscroll.bh.getnow() } return c.doc.translate.x }; if (document.createevent) { this.notifyscrollevent = function(a) { var e = document.createevent("uievents"); e.inituievent("scroll", false, true, window, 1); a.dispatchevent(e) } } else if (document.fireevent) { this.notifyscrollevent = function(a) { var e = document.createeventobject(); a.fireevent("onscroll"); e.cancelbubble = true } } else { this.notifyscrollevent = function(a, b) {} } if (d.hastranslate3d && c.opt.enabletranslate3d) { this.setscrolltop = function(a, b) { c.doc.translate.y = a; c.doc.translate.ty = (a * -1) + "px"; c.doc.css(d.trstyle, "translate3d(" + c.doc.translate.tx + "," + c.doc.translate.ty + ",0px)"); if (!b) c.notifyscrollevent(c.win[0]) }; this.setscrollleft = function(a, b) { c.doc.translate.x = a; c.doc.translate.tx = (a * -1) + "px"; c.doc.css(d.trstyle, "translate3d(" + c.doc.translate.tx + "," + c.doc.translate.ty + ",0px)"); if (!b) c.notifyscrollevent(c.win[0]) } } else { this.setscrolltop = function(a, b) { c.doc.translate.y = a; c.doc.translate.ty = (a * -1) + "px"; c.doc.css(d.trstyle, "translate(" + c.doc.translate.tx + "," + c.doc.translate.ty + ")"); if (!b) c.notifyscrollevent(c.win[0]) }; this.setscrollleft = function(a, b) { c.doc.translate.x = a; c.doc.translate.tx = (a * -1) + "px"; c.doc.css(d.trstyle, "translate(" + c.doc.translate.tx + "," + c.doc.translate.ty + ")"); if (!b) c.notifyscrollevent(c.win[0]) } } } else { this.getscrolltop = function() { return c.docscroll.scrolltop() }; this.setscrolltop = function(a) { return c.docscroll.scrolltop(a) }; this.getscrollleft = function() { return c.docscroll.scrollleft() }; this.setscrollleft = function(a) { return c.docscroll.scrollleft(a) } } this.gettarget = function(e) { if (!e) return false; if (e.target) return e.target; if (e.srcelement) return e.srcelement; return false }; this.hasparent = function(e, a) { if (!e) return false; var b = e.target || e.srcelement || e || false; while (b && b.id != a) { b = b.parentnode || false } return (b !== false) }; var e = { "thin": 1, "medium": 3, "thick": 5 }; function getwidthtopixel(a, b, c) { var d = a.css(b); var e = parsefloat(d); if (isnan(e)) { e = e[d] || 0; var f = (e == 3) ? ((c) ? (c.win.outerheight() - c.win.innerheight()) : (c.win.outerwidth() - c.win.innerwidth())) : 1; if (c.isie8 && e) e += 1; return (f) ? e: 0 } return e }; this.getoffset = function() { if (c.isfixed) return { top: parsefloat(c.win.css('top')), left: parsefloat(c.win.css('left')) }; if (!c.viewport) return c.win.offset(); var a = c.win.offset(); var b = c.viewport.offset(); return { top: a.top - b.top + c.viewport.scrolltop(), left: a.left - b.left + c.viewport.scrollleft() } }; this.updatescrollbar = function(a) { if (c.ishwscroll) { c.rail.css({ height: c.win.innerheight() }); if (c.railh) c.railh.css({ width: c.win.innerwidth() }) } else { var b = c.getoffset(); var c = { top: b.top, left: b.left }; c.top += getwidthtopixel(c.win, 'border-top-width', true); var d = (c.win.outerwidth() - c.win.innerwidth()) / 2; c.left += (c.rail.align) ? c.win.outerwidth() - getwidthtopixel(c.win, 'border-right-width') - c.rail.width: getwidthtopixel(c.win, 'border-left-width'); var e = c.opt.railoffset; if (e) { if (e.top) c.top += e.top; if (c.rail.align && e.left) c.left += e.left } if (!c.locked) c.rail.css({ top: c.top, left: c.left, height: (a) ? a.h: c.win.innerheight() }); if (c.zoom) { c.zoom.css({ top: c.top + 1, left: (c.rail.align == 1) ? c.left - 20 : c.left + c.rail.width + 4 }) } if (c.railh && !c.locked) { var c = { top: b.top, left: b.left }; var y = (c.railh.align) ? c.top + getwidthtopixel(c.win, 'border-top-width', true) + c.win.innerheight() - c.railh.height: c.top + getwidthtopixel(c.win, 'border-top-width', true); var x = c.left + getwidthtopixel(c.win, 'border-left-width'); c.railh.css({ top: y, left: x, width: c.railh.width }) } } }; this.dorailclick = function(e, a, b) { var c, pg, cur, pos; if (c.rail.drag && c.rail.drag.pt != 1) return; if (c.locked) return; if (c.rail.drag) return; c.cancelscroll(); c.cancelevent(e); if (a) { c = (b) ? c.doscrollleft: c.doscrolltop; cur = (b) ? ((e.pagex - c.railh.offset().left - (c.cursorwidth / 2)) * c.scrollratio.x) : ((e.pagey - c.rail.offset().top - (c.cursorheight / 2)) * c.scrollratio.y); c(cur) } else { c = (b) ? c.doscrollleftby: c.doscrollby; cur = (b) ? c.scroll.x: c.scroll.y; pos = (b) ? e.pagex - c.railh.offset().left: e.pagey - c.rail.offset().top; pg = (b) ? c.view.w: c.view.h; (cur >= pos) ? c(pg) : c( - pg) } }; c.hasanimationframe = (m); c.hascancelanimationframe = (n); if (!c.hasanimationframe) { m = function(a) { return settimeout(a, 16) }; n = clearinterval } else if (!c.hascancelanimationframe) n = function() { c.cancelanimationframe = true }; this.init = function() { c.saved.css = []; if (d.isie7mobile) return true; if (d.hasmstouch) c.css((c.ispage) ? $("html") : c.win, { '-ms-touch-action': 'none' }); if (!c.ispage || (!d.cantouch && !d.isieold && !d.isie9mobile)) { var m = c.docscroll; if (c.ispage) m = (c.haswrapper) ? c.win: c.doc; if (!d.isie9mobile) c.css(m, { 'overflow-y': 'hidden' }); if (c.ispage && d.isie7) { if (c.doc[0].nodename == 'body') c.css($("html"), { 'overflow-y': 'hidden' }); else if (c.doc[0].nodename == 'html') c.css($("body"), { 'overflow-y': 'hidden' }) } if (d.isios && !c.ispage && !c.haswrapper) c.css($("body"), { "-webkit-overflow-scrolling": "touch" }); var o = $(document.createelement('div')); o.css({ position: "relative", top: 0, "float": "right", width: c.opt.cursorwidth, height: "0px", 'background-color': c.opt.cursorcolor, border: c.opt.cursorborder, 'background-clip': 'padding-box', '-webkit-border-radius': c.opt.cursorborderradius, '-moz-border-radius': c.opt.cursorborderradius, 'border-radius': c.opt.cursorborderradius }); o.hborder = parsefloat(o.outerheight() - o.innerheight()); c.cursor = o; var p = $(document.createelement('div')); p.attr('id', c.id); var v, a, kp = ["left", "right"]; for (var n in kp) { a = kp[n]; v = c.opt.railpadding[a]; (v) ? p.css("padding-" + a, v + "px") : c.opt.railpadding[a] = 0 } p.append(o); p.width = math.max(parsefloat(c.opt.cursorwidth), o.outerwidth()) + c.opt.railpadding['left'] + c.opt.railpadding['right']; p.css({ width: p.width + "px", 'zindex': (c.ispage) ? c.opt.zindex: c.opt.zindex + 2, "background": c.opt.background }); p.visibility = true; p.scrollable = true; p.align = (c.opt.railalign == "left") ? 0 : 1; c.rail = p; c.rail.drag = false; var q = false; if (c.opt.boxzoom && !c.ispage && !d.isieold) { q = document.createelement('div'); c.bind(q, "click", c.dozoom); c.zoom = $(q); c.zoom.css({ "cursor": "pointer", 'z-index': c.opt.zindex, 'backgroundimage': 'url(' + l + 'zoomico_wev8.png)', 'height': 18, 'width': 18, 'backgroundposition': '0px 0px' }); if (c.opt.dblclickzoom) c.bind(c.win, "dblclick", c.dozoom); if (d.cantouch && c.opt.gesturezoom) { c.ongesturezoom = function(e) { if (e.scale > 1.5) c.dozoomin(e); if (e.scale < 0.8) c.dozoomout(e); return c.cancelevent(e) }; c.bind(c.win, "gestureend", c.ongesturezoom) } }; c.railh = false; if (c.opt.horizrailenabled) { c.css(m, { 'overflow-x': 'hidden' }); var o = $(document.createelement('div')); o.css({ position: "relative", top: 0, height: c.opt.cursorwidth, width: "0px", 'background-color': c.opt.cursorcolor, border: c.opt.cursorborder, 'background-clip': 'padding-box', '-webkit-border-radius': c.opt.cursorborderradius, '-moz-border-radius': c.opt.cursorborderradius, 'border-radius': c.opt.cursorborderradius }); o.wborder = parsefloat(o.outerwidth() - o.innerwidth()); c.cursorh = o; var r = $(document.createelement('div')); r.attr('id', c.id + '-hr'); r.height = 1 + math.max(parsefloat(c.opt.cursorwidth), o.outerheight()); r.css({ height: r.height + "px", 'zindex': (c.ispage) ? c.opt.zindex: c.opt.zindex + 2, "background": c.opt.background }); r.append(o); r.visibility = true; r.scrollable = true; r.align = (c.opt.railvalign == "top") ? 0 : 1; c.railh = r; c.railh.drag = false } if (c.ispage) { p.css({ position: "fixed", top: "0px", height: "100%" }); (p.align) ? p.css({ right: "0px" }) : p.css({ left: "0px" }); c.body.append(p); if (c.railh) { r.css({ position: "fixed", left: "0px", width: "100%" }); (r.align) ? r.css({ bottom: "0px" }) : r.css({ top: "0px" }); c.body.append(r) } } else { if (c.ishwscroll) { if (c.win.css('position') == 'static') c.css(c.win, { 'position': 'relative' }); var s = (c.win[0].nodename == 'html') ? c.body: c.win; if (c.zoom) { c.zoom.css({ position: "absolute", top: 1, right: 0, "margin-right": p.width + 4 }); s.append(c.zoom) } p.css({ position: "absolute", top: 0 }); (p.align) ? p.css({ right: 0 }) : p.css({ left: 0 }); s.append(p); if (r) { r.css({ position: "absolute", left: 0, bottom: 0 }); (r.align) ? r.css({ bottom: 0 }) : r.css({ top: 0 }); s.append(r) } } else { c.isfixed = (c.win.css("position") == "fixed"); var t = (c.isfixed) ? "fixed": "absolute"; if (!c.isfixed) c.viewport = c.getviewport(c.win[0]); if (c.viewport) c.body = c.viewport; p.css({ position: t }); if (c.zoom) c.zoom.css({ position: t }); c.updatescrollbar(); c.body.append(p); if (c.zoom) c.body.append(c.zoom); if (c.railh) { r.css({ position: t }); c.body.append(r) } } if (d.isios) c.css(c.win, { '-webkit-tap-highlight-color': 'rgba(0,0,0,0)', '-webkit-touch-callout': 'none' }); if (d.isie && c.opt.disableoutline) c.win.attr("hidefocus", "true"); if (d.iswebkit && c.opt.disableoutline) c.win.css({ "outline": "none" }) } if (c.opt.autohidemode === false) { c.autohidedom = false; c.rail.css({ opacity: c.opt.cursoropacitymax }); if (c.railh) c.railh.css({ opacity: c.opt.cursoropacitymax }) } else if (c.opt.autohidemode === true) { c.autohidedom = $().add(c.rail); if (c.railh) c.autohidedom = c.autohidedom.add(c.railh) } else if (c.opt.autohidemode == "scroll") { c.autohidedom = $().add(c.rail); if (c.railh) c.autohidedom = c.autohidedom.add(c.railh) } else if (c.opt.autohidemode == "cursor") { c.autohidedom = $().add(c.cursor); if (c.railh) c.autohidedom = c.autohidedom.add(c.railh.cursor) } else if (c.opt.autohidemode == "hidden") { c.autohidedom = false; c.hide(); c.locked = false } if (d.isie9mobile) { c.scrollmom = new r(c); c.onmangotouch = function(e) { var a = c.getscrolltop(); var b = c.getscrollleft(); if ((a == c.scrollmom.lastscrolly) && (b == c.scrollmom.lastscrollx)) return true; var c = a - c.mangotouch.sy; var d = b - c.mangotouch.sx; var f = math.round(math.sqrt(math.pow(d, 2) + math.pow(c, 2))); if (f == 0) return; var g = (c < 0) ? -1 : 1; var h = (d < 0) ? -1 : 1; var i = +new date(); if (c.mangotouch.lazy) cleartimeout(c.mangotouch.lazy); if (((i - c.mangotouch.tm) > 80) || (c.mangotouch.dry != g) || (c.mangotouch.drx != h)) { c.scrollmom.stop(); c.scrollmom.reset(b, a); c.mangotouch.sy = a; c.mangotouch.ly = a; c.mangotouch.sx = b; c.mangotouch.lx = b; c.mangotouch.dry = g; c.mangotouch.drx = h; c.mangotouch.tm = i } else { c.scrollmom.stop(); c.scrollmom.update(c.mangotouch.sx - d, c.mangotouch.sy - c); var j = i - c.mangotouch.tm; c.mangotouch.tm = i; var k = math.max(math.abs(c.mangotouch.ly - a), math.abs(c.mangotouch.lx - b)); c.mangotouch.ly = a; c.mangotouch.lx = b; if (k > 2) { c.mangotouch.lazy = settimeout(function() { c.mangotouch.lazy = false; c.mangotouch.dry = 0; c.mangotouch.drx = 0; c.mangotouch.tm = 0; c.scrollmom.domomentum(30) }, 100) } } }; var u = c.getscrolltop(); var w = c.getscrollleft(); c.mangotouch = { sy: u, ly: u, dry: 0, sx: w, lx: w, drx: 0, lazy: false, tm: 0 }; c.bind(c.docscroll, "scroll", c.onmangotouch) } else { if (d.cantouch || c.istouchcapable || c.opt.touchbehavior || d.hasmstouch) { c.scrollmom = new r(c); c.ontouchstart = function(e) { if (e.pointertype && e.pointertype != 2) return false; if (!c.locked) { if (d.hasmstouch) { var a = (e.target) ? e.target: false; while (a) { var b = $(a).getnicescroll(); if ((b.length > 0) && (b[0].me == c.me)) break; if (b.length > 0) return false; if ((a.nodename == 'div') && (a.id == c.id)) break; a = (a.parentnode) ? a.parentnode: false } } c.cancelscroll(); var a = c.gettarget(e); if (a) { var c = (/input/i.test(a.nodename)) && (/range/i.test(a.type)); if (c) return c.stoppropagation(e) } if (! ("clientx" in e) && ("changedtouches" in e)) { e.clientx = e.changedtouches[0].clientx; e.clienty = e.changedtouches[0].clienty } if (c.forcescreen) { var d = e; var e = { "original": (e.original) ? e.original: e }; e.clientx = d.screenx; e.clienty = d.screeny } c.rail.drag = { x: e.clientx, y: e.clienty, sx: c.scroll.x, sy: c.scroll.y, st: c.getscrolltop(), sl: c.getscrollleft(), pt: 2 }; if (c.opt.touchbehavior && c.isiframe && d.isie) { var f = c.win.position(); c.rail.drag.x += f.left; c.rail.drag.y += f.top } c.hasmoving = false; c.lastmouseup = false; c.scrollmom.reset(e.clientx, e.clienty); if (!d.cantouch && !this.istouchcapable && !d.hasmstouch) { var g = (a) ? /input|select|textarea/i.test(a.nodename) : false; if (!g) { if (!c.ispage && d.hasmousecapture) a.setcapture(); return c.cancelevent(e) } if (/submit|cancel|button/i.test($(a).attr('type'))) { pc = { "tg": a, "click": false }; c.preventclick = pc } } } }; c.ontouchend = function(e) { if (e.pointertype && e.pointertype != 2) return false; if (c.rail.drag && (c.rail.drag.pt == 2)) { c.scrollmom.domomentum(); c.rail.drag = false; if (c.hasmoving) { c.hasmoving = false; c.lastmouseup = true; c.hidecursor(); if (d.hasmousecapture) document.releasecapture(); if (!d.cantouch) return c.cancelevent(e) } } }; var x = (c.opt.touchbehavior && c.isiframe && !d.hasmousecapture); c.ontouchmove = function(e, a) { if (e.pointertype && e.pointertype != 2) return false; if (c.rail.drag && (c.rail.drag.pt == 2)) { if (d.cantouch && (typeof e.original == "undefined")) return true; c.hasmoving = true; if (c.preventclick && !c.preventclick.click) { c.preventclick.click = c.preventclick.tg.onclick || false; c.preventclick.tg.onclick = c.onpreventclick } var b = $.extend({ "original": e }, e); e = b; if (("changedtouches" in e)) { e.clientx = e.changedtouches[0].clientx; e.clienty = e.changedtouches[0].clienty } if (c.forcescreen) { var c = e; var e = { "original": (e.original) ? e.original: e }; e.clientx = c.screenx; e.clienty = c.screeny } var d = ofy = 0; if (x && !a) { var f = c.win.position(); d = -f.left; ofy = -f.top } var g = e.clienty + ofy; var h = (g - c.rail.drag.y); var i = c.rail.drag.st - h; if (c.ishwscroll && c.opt.bouncescroll) { if (i < 0) { i = math.round(i / 2) } else if (i > c.page.maxh) { i = c.page.maxh + math.round((i - c.page.maxh) / 2) } } else { if (i < 0) { i = 0; g = 0 } if (i > c.page.maxh) { i = c.page.maxh; g = 0 } } var j = e.clientx + d; if (c.railh && c.railh.scrollable) { var k = (j - c.rail.drag.x); var l = c.rail.drag.sl - k; if (c.ishwscroll && c.opt.bouncescroll) { if (l < 0) { l = math.round(l / 2) } else if (l > c.page.maxw) { l = c.page.maxw + math.round((l - c.page.maxw) / 2) } } else { if (l < 0) { l = 0; j = 0 } if (l > c.page.maxw) { l = c.page.maxw; j = 0 } } } c.synched("touchmove", function() { try { if (c.me.is(":visible") === false) return } catch(e) {} if (c.rail.drag && (c.rail.drag.pt == 2)) { if (c.preparetransition) c.preparetransition(0); if (c.rail.scrollable) c.setscrolltop(i); c.scrollmom.update(j, g); if (c.railh && c.railh.scrollable) { c.setscrollleft(l); c.showcursor(i, l) } else { c.showcursor(i) } if (d.isie10) document.selection.clear() } }); if (!d.ischrome && !c.istouchcapable) return c.cancelevent(e) } } } if (d.cantouch || c.opt.touchbehavior) { c.onpreventclick = function(e) { if (c.preventclick) { c.preventclick.tg.onclick = c.preventclick.click; c.preventclick = false; return c.cancelevent(e) } }; c.onmousedown = c.ontouchstart; c.onmouseup = c.ontouchend; c.onclick = (d.isios) ? false: function(e) { if (c.lastmouseup) { c.lastmouseup = false; return c.cancelevent(e) } else { return true } }; c.onmousemove = c.ontouchmove; if (d.cursorgrabvalue) { c.css((c.ispage) ? c.doc: c.win, { 'cursor': d.cursorgrabvalue }); c.css(c.rail, { 'cursor': d.cursorgrabvalue }) } } else { c.onmousedown = function(e, a) { if (c.rail.drag && c.rail.drag.pt != 1) return; if (c.locked) return c.cancelevent(e); c.cancelscroll(); c.rail.drag = { x: e.clientx, y: e.clienty, sx: c.scroll.x, sy: c.scroll.y, pt: 1, hr: ( !! a) }; var b = c.gettarget(e); if (!c.ispage && d.hasmousecapture) b.setcapture(); if (c.isiframe && !d.hasmousecapture) { c.saved["csspointerevents"] = c.doc.css("pointer-events"); c.css(c.doc, { "pointer-events": "none" }) } return c.cancelevent(e) }; c.onmouseup = function(e) { if (c.rail.drag) { if (d.hasmousecapture) document.releasecapture(); if (c.isiframe && !d.hasmousecapture) c.doc.css("pointer-events", c.saved["csspointerevents"]); if (c.rail.drag.pt != 1) return; c.rail.drag = false; return c.cancelevent(e) } }; c.onmousemove = function(e) { if (c.rail.drag) { if (c.rail.drag.pt != 1) return; if (d.ischrome && e.which == 0) return c.onmouseup(e); c.cursorfreezed = true; if (c.rail.drag.hr) { c.scroll.x = c.rail.drag.sx + (e.clientx - c.rail.drag.x); if (c.scroll.x < 0) c.scroll.x = 0; var a = c.scrollvaluemaxw; if (c.scroll.x > a) c.scroll.x = a } else { c.scroll.y = c.rail.drag.sy + (e.clienty - c.rail.drag.y); if (c.scroll.y < 0) c.scroll.y = 0; var b = c.scrollvaluemax; if (c.scroll.y > b) c.scroll.y = b } c.synched('mousemove', function() { try { if (c.me.is(":visible") === false) return } catch(e) {} if (c.rail.drag && (c.rail.drag.pt == 1)) { c.showcursor(); if (c.rail.drag.hr) c.doscrollleft(math.round(c.scroll.x * c.scrollratio.x)); else c.doscrolltop(math.round(c.scroll.y * c.scrollratio.y)) } }); return c.cancelevent(e) } else { c.checkarea = true } } } if (d.cantouch || c.opt.touchbehavior) { c.bind(c.win, "mousedown", c.onmousedown) } if (d.hasmstouch) { c.css(c.rail, { '-ms-touch-action': 'none' }); c.css(c.cursor, { '-ms-touch-action': 'none' }); c.bind(c.win, "mspointerdown", c.ontouchstart); c.bind(document, "mspointerup", c.ontouchend); c.bind(document, "mspointermove", c.ontouchmove); c.bind(c.cursor, "msgesturehold", function(e) { e.preventdefault() }); c.bind(c.cursor, "contextmenu", function(e) { e.preventdefault() }) } if (this.istouchcapable) { c.bind(c.win, "touchstart", c.ontouchstart); c.bind(document, "touchend", c.ontouchend); c.bind(document, "touchcancel", c.ontouchend); c.bind(document, "touchmove", c.ontouchmove) } c.bind(c.cursor, "mousedown", c.onmousedown); c.bind(c.cursor, "mouseup", c.onmouseup); if (c.railh) { c.bind(c.cursorh, "mousedown", function(e) { c.onmousedown(e, true) }); c.bind(c.cursorh, "mouseup", function(e) { if (c.rail.drag && c.rail.drag.pt == 2) return; c.rail.drag = false; c.hasmoving = false; c.hidecursor(); if (d.hasmousecapture) document.releasecapture(); return c.cancelevent(e) }) } c.bind(document, "mouseup", c.onmouseup); if (d.hasmousecapture) c.bind(c.win, "mouseup", c.onmouseup); c.bind(document, "mousemove", c.onmousemove); if (c.onclick) c.bind(document, "click", c.onclick); if (!d.cantouch && !c.opt.touchbehavior) { c.jqbind(c.rail, "mouseenter", function() { try { if (c.me.is(":visible") === false) return } catch(e) {} if (c.canshowonmouseevent) c.showcursor(); c.rail.active = true }); c.jqbind(c.rail, "mouseleave", function() { c.rail.active = false; if (!c.rail.drag) c.hidecursor() }); if (c.opt.sensitiverail) { c.bind(c.rail, "click", function(e) { c.dorailclick(e, false, false) }); c.bind(c.rail, "dblclick", function(e) { c.dorailclick(e, true, false) }); c.bind(c.cursor, "click", function(e) { c.cancelevent(e) }); c.bind(c.cursor, "dblclick", function(e) { c.cancelevent(e) }) } if (c.railh) { c.jqbind(c.railh, "mouseenter", function() { try { if (c.me.is(":visible") === false) return } catch(e) {} if (c.canshowonmouseevent) c.showcursor(); c.rail.active = true }); c.jqbind(c.railh, "mouseleave", function() { c.rail.active = false; if (!c.rail.drag) c.hidecursor() }); if (c.opt.sensitiverail) { c.bind(c.railh, "click", function(e) { c.dorailclick(e, false, true) }); c.bind(c.railh, "dblclick", function(e) { c.dorailclick(e, true, true) }); c.bind(c.cursorh, "click", function(e) { c.cancelevent(e) }); c.bind(c.cursorh, "dblclick", function(e) { c.cancelevent(e) }) } } if (c.zoom) { c.jqbind(c.zoom, "mouseenter", function() { try { if (c.me.is(":visible") === false) return } catch(e) {} if (c.canshowonmouseevent) c.showcursor(); c.rail.active = true }); c.jqbind(c.zoom, "mouseleave", function() { c.rail.active = false; if (!c.rail.drag) c.hidecursor() }) } } if (c.opt.enablemousewheel) { if (!c.isiframe) c.bind((d.isie && c.ispage) ? document: c.docscroll, "mousewheel", c.onmousewheel); c.bind(c.rail, "mousewheel", c.onmousewheel); if (c.railh) c.bind(c.railh, "mousewheel", c.onmousewheelhr) } if (!c.ispage && !d.cantouch && !(/html|body/.test(c.win[0].nodename))) { if (!c.win.attr("tabindex")) c.win.attr({ "tabindex": j++ }); c.jqbind(c.win, "focus", function(e) { try { if (c.me.is(":visible") === false) return } catch(e) {} g = (c.gettarget(e)).id || true; c.hasfocus = true; if (c.canshowonmouseevent) c.noticecursor() }); c.jqbind(c.win, "blur", function(e) { g = false; c.hasfocus = false }); c.jqbind(c.win, "mouseenter", function(e) { try { if (c.me.is(":visible") === false) return } catch(e) {} h = (c.gettarget(e)).id || true; c.hasmousefocus = true; if (c.canshowonmouseevent) c.noticecursor() }); c.jqbind(c.win, "mouseleave", function() { h = false; c.hasmousefocus = false }) } } c.onkeypress = function(e) { if (c.locked && c.page.maxh == 0) return true; e = (e) ? e: window.e; var a = c.gettarget(e); if (a && /input|textarea|select|option/.test(a.nodename)) { var b = a.getattribute('type') || a.type || false; if ((!b) || !(/submit|button|cancel/i.tp)) return true } if (c.hasfocus || (c.hasmousefocus && !g) || (c.ispage && !g && !h)) { var c = e.keycode; if (c.locked && c != 27) return c.cancelevent(e); var d = e.ctrlkey || false; var f = e.shiftkey || false; var g = false; switch (c) { case 38: case 63233: c.doscrollby(24 * 3); g = true; break; case 40: case 63235: c.doscrollby( - 24 * 3); g = true; break; case 37: case 63232: if (c.railh) { (d) ? c.doscrollleft(0) : c.doscrollleftby(24 * 3); g = true } break; case 39: case 63234: if (c.railh) { (d) ? c.doscrollleft(c.page.maxw) : c.doscrollleftby( - 24 * 3); g = true } break; case 33: case 63276: c.doscrollby(c.view.h); g = true; break; case 34: case 63277: c.doscrollby( - c.view.h); g = true; break; case 36: case 63273: (c.railh && d) ? c.doscrollpos(0, 0) : c.doscrollto(0); g = true; break; case 35: case 63275: (c.railh && d) ? c.doscrollpos(c.page.maxw, c.page.maxh) : c.doscrollto(c.page.maxh); g = true; break; case 32: if (c.opt.spacebarenabled) { (f) ? c.doscrollby(c.view.h) : c.doscrollby( - c.view.h); g = true } break; case 27: if (c.zoomactive) { c.dozoom(); g = true } break } if (g) return c.cancelevent(e) } }; if (c.opt.enablekeyboard) c.bind(document, (d.isopera && !d.isopera12) ? "keypress": "keydown", c.onkeypress); c.bind(window, 'resize', c.resize); c.bind(window, 'orientationchange', c.resize); c.bind(window, "load", c.resize); if (d.ischrome && !c.ispage && !c.haswrapper) { var y = c.win.attr("style"); var z = parsefloat(c.win.css("width")) + 1; c.win.css('width', z); c.synched("chromefix", function() { c.win.attr("style", y) }) } c.onattributechange = function(e) { c.lazyresize() }; if (!c.ispage && !c.haswrapper) { if ("webkitmutationobserver" in window) { c.observer = new webkitmutationobserver(function(a) { a.foreach(c.onattributechange) }); c.observer.observe(c.win[0], { attributes: true, subtree: false }) } else { c.bind(c.win, (d.isie && !d.isie9) ? "propertychange": "domattrmodified", c.onattributechange); if (d.isie9) c.win[0].attachevent("onpropertychange", c.onattributechange) } } if (!c.ispage && c.opt.boxzoom) c.bind(window, "resize", c.resizezoom); if (c.istextarea) c.bind(c.win, "mouseup", c.resize); c.resize() } if (this.doc[0].nodename == 'iframe') { function oniframeload(e) { c.iframexd = false; try { var b = 'contentdocument' in this ? this.contentdocument: this.contentwindow.document; var a = b.domain } catch(e) { c.iframexd = true; b = false }; if (c.iframexd) { if ("console" in window) console.log('nicescroll error: policy restriced iframe'); return true } c.forcescreen = true; if (c.isiframe) { c.iframe = { "doc": $(b), "html": c.doc.contents().find('html')[0], "body": c.doc.contents().find('body')[0] }; c.getcontentsize = function() { return { w: math.max(c.iframe.html.scrollwidth, c.iframe.body.scrollwidth), h: math.max(c.iframe.html.scrollheight, c.iframe.body.scrollheight) } }; c.docscroll = $(c.iframe.body) } if (!d.isios && c.opt.iframeautoresize && !c.isiframe) { c.win.scrolltop(0); c.doc.height(""); var c = math.max(b.getelementsbytagname('html')[0].scrollheight, b.body.scrollheight); c.doc.height(c) } c.resize(); if (d.isie7) c.css($(c.iframe.html), { 'overflow-y': 'hidden' }); c.css($(c.iframe.body), { 'overflow-y': 'hidden' }); if ('contentwindow' in this) { c.bind(this.contentwindow, "scroll", c.onscroll) } else { c.bind(b, "scroll", c.onscroll) } if (c.opt.enablemousewheel) { c.bind(b, "mousewheel", c.onmousewheel) } if (c.opt.enablekeyboard) c.bind(b, (d.isopera) ? "keypress": "keydown", c.onkeypress); if (d.cantouch || c.opt.touchbehavior) { c.bind(b, "mousedown", c.onmousedown); c.bind(b, "mousemove", function(e) { c.onmousemove(e, true) }); if (d.cursorgrabvalue) c.css($(b.body), { 'cursor': d.cursorgrabvalue }) } c.bind(b, "mouseup", c.onmouseup); if (c.zoom) { if (c.opt.dblclickzoom) c.bind(b, 'dblclick', c.dozoom); if (c.ongesturezoom) c.bind(b, "gestureend", c.ongesturezoom) } }; if (this.doc[0].readystate && this.doc[0].readystate == "complete") { settimeout(function() { oniframeload.call(c.doc[0], false) }, 500) } c.bind(this.doc, "load", oniframeload) } }; this.showcursor = function(a, b) { if (c.cursortimeout) { cleartimeout(c.cursortimeout); c.cursortimeout = 0 } if (!c.rail) return; try { var c = c.me.offset().top; if (c.me.scrollparent && c.me.scrollparent().length > 0) { if (c.rail.parent().get(0).tagname != "body") { c = c - c.me.scrollparent().offset().top; c = c + c.me.scrollparent().offset().scrolltop() } } if (c.rail.parent().get(0).tagname != "body") { c = c - f(".e8_boxhead").height() } c.rail.css("top", c); if (!c.rail.data("__resize")) { c.resize(); c.rail.data("__resize", true) } } catch(e) { if (window.console) console.log(e, "jquery.nicescroll.js#showcursor") } if (c.autohidedom) { c.autohidedom.stop().css({ opacity: c.opt.cursoropacitymax }); c.cursoractive = true } if ((typeof a != "undefined") && (a !== false)) { c.scroll.y = math.round(a * 1 / c.scrollratio.y) } if (typeof b != "undefined") { c.scroll.x = math.round(b * 1 / c.scrollratio.x) } c.cursor.css({ height: c.cursorheight, top: c.scroll.y }); if (c.cursorh) { (!c.rail.align && c.rail.visibility) ? c.cursorh.css({ width: c.cursorwidth, left: c.scroll.x + c.rail.width }) : c.cursorh.css({ width: c.cursorwidth, left: c.scroll.x }); c.cursoractive = true } if (c.zoom) c.zoom.stop().css({ opacity: c.opt.cursoropacitymax }) }; this.hidecursor = function(a) { if (c.cursortimeout) return; if (!c.rail) return; if (!c.autohidedom) return; if (a) { c.cursortimeout = settimeout(function() { if (!c.rail.active || !c.showonmouseevent) { c.autohidedom.stop().animate({ opacity: c.opt.cursoropacitymin }); if (c.zoom) c.zoom.stop().animate({ opacity: c.opt.cursoropacitymin }); c.cursoractive = false } c.cursortimeout = 0 }, a || 400) } else { if (!c.rail.active || !c.showonmouseevent) { c.autohidedom.stop().animate({ opacity: c.opt.cursoropacitymin }); if (c.zoom) c.zoom.stop().animate({ opacity: c.opt.cursoropacitymin }); c.cursoractive = false } c.cursortimeout = 0 } }; this.noticecursor = function(a, b, c) { c.showcursor(b, c); if (!c.rail.active) c.hidecursor(a) }; this.getcontentsize = (c.ispage) ? function() { return { w: math.max(document.body.scrollwidth, document.documentelement.scrollwidth), h: math.max(document.body.scrollheight, document.documentelement.scrollheight) } }: (c.haswrapper) ? function() { return { w: c.doc.outerwidth() + parseint(c.win.css('paddingleft')) + parseint(c.win.css('paddingright')), h: c.doc.outerheight() + parseint(c.win.css('paddingtop')) + parseint(c.win.css('paddingbottom')) } }: function() { return { w: c.docscroll[0].scrollwidth, h: c.docscroll[0].scrollheight } }; this.onresize = function(e, a) { try { if (c.me.is(":visible") === false) return } catch(e) {} if (!c.win) return false; if (!c.haswrapper && !c.ispage) { if (c.win.css('display') == 'none') { if (c.visibility) c.hiderail().hiderailhr(); return false } else { if (!c.hidden && !c.visibility) c.showrail().showrailhr() } } var b = c.page.maxh; var c = c.page.maxw; var d = { h: c.view.h, w: c.view.w }; c.view = { w: (c.ispage) ? c.win.width() : parseint(c.win[0].clientwidth), h: (c.ispage) ? c.win.height() : parseint(c.win[0].clientheight) }; c.page = (a) ? a: c.getcontentsize(); c.page.maxh = math.max(0, c.page.h - c.view.h); c.page.maxw = math.max(0, c.page.w - c.view.w); if ((c.page.maxh == b) && (c.page.maxw == c) && (c.view.w == d.w)) { if (!c.ispage) { var f = c.win.offset(); if (c.lastposition) { var g = c.lastposition; if ((g.top == f.top) && (g.left == f.left)) return c } c.lastposition = f } else { return c } } if (c.page.maxh == 0) { c.hiderail(); c.scrollvaluemax = 0; c.scroll.y = 0; c.scrollratio.y = 0; c.cursorheight = 0; c.setscrolltop(0); c.rail.scrollable = false } else { c.rail.scrollable = true } if (c.page.maxw == 0) { c.hiderailhr(); c.scrollvaluemaxw = 0; c.scroll.x = 0; c.scrollratio.x = 0; c.cursorwidth = 0; c.setscrollleft(0); c.railh.scrollable = false } else { c.railh.scrollable = true } c.locked = (c.page.maxh == 0) && (c.page.maxw == 0); if (c.locked) { if (!c.ispage) c.updatescrollbar(c.view); return false } if (!c.hidden && !c.visibility) { c.showrail().showrailhr() } else if (!c.hidden && !c.railh.visibility) c.showrailhr(); if (c.istextarea && c.win.css('resize') && c.win.css('resize') != 'none') c.view.h -= 20; if (!c.ispage) c.updatescrollbar(c.view); c.cursorheight = math.min(c.view.h, math.round(c.view.h * (c.view.h / c.page.h))); c.cursorheight = (c.opt.cursorfixedheight) ? c.opt.cursorfixedheight: math.max(c.opt.cursorminheight, c.cursorheight); c.cursorwidth = math.min(c.view.w, math.round(c.view.w * (c.view.w / c.page.w))); c.cursorwidth = (c.opt.cursorfixedheight) ? c.opt.cursorfixedheight: math.max(c.opt.cursorminheight, c.cursorwidth); c.scrollvaluemax = c.view.h - c.cursorheight - c.cursor.hborder; if (c.railh) { c.railh.width = (c.page.maxh > 0) ? (c.view.w - c.rail.width) : c.view.w; c.scrollvaluemaxw = c.railh.width - c.cursorwidth - c.cursorh.wborder } c.scrollratio = { x: (c.page.maxw / c.scrollvaluemaxw), y: (c.page.maxh / c.scrollvaluemax) }; var h = c.getscrolltop(); if (h > c.page.maxh) { c.doscrolltop(c.page.maxh) } else { c.scroll.y = math.round(c.getscrolltop() * (1 / c.scrollratio.y)); c.scroll.x = math.round(c.getscrollleft() * (1 / c.scrollratio.x)); if (c.cursoractive) c.noticecursor() } if (c.scroll.y && (c.getscrolltop() == 0)) c.doscrollto(math.floor(c.scroll.y * c.scrollratio.y)); return c }; this.resize = function() { c.delayed('resize', c.onresize, 30); return c }; this.lazyresize = function() { c.delayed('resize', c.resize, 250) }; this._bind = function(a, b, c, d) { c.events.push({ e: a, n: b, f: c, b: d, q: false }); if (a.addeventlistener) { a.addeventlistener(b, c, d || false) } else if (a.attachevent) { a.attachevent("on" + b, c) } else { a["on" + b] = c } }; this.jqbind = function(a, b, c) { c.events.push({ e: a, n: b, f: c, q: true }); $(a).bind(b, c) }; this.bind = function(b, c, d, f) { var g = ("jquery" in b) ? b[0] : b; if (g.addeventlistener) { if (d.cantouch && /mouseup|mousedown|mousemove/.test(c)) { var h = (c == 'mousedown') ? 'touchstart': (c == 'mouseup') ? 'touchend': 'touchmove'; c._bind(g, h, function(e) { if (e.touches) { if (e.touches.length < 2) { var a = (e.touches.length) ? e.touches[0] : e; a.original = e; d.call(this, a) } } else if (e.changedtouches) { var a = e.changedtouches[0]; a.original = e; d.call(this, a) } }, f || false) } c._bind(g, c, d, f || false); if (c == 'mousewheel') c._bind(g, "dommousescroll", d, f || false); if (d.cantouch && c == "mouseup") c._bind(g, "touchcancel", d, f || false) } else { c._bind(g, c, function(e) { e = e || window.event || false; if (e) { if (e.srcelement) e.target = e.srcelement } return ((d.call(g, e) === false) || f === false) ? c.cancelevent(e) : true }) } }; this._unbind = function(a, b, c, d) { if (a.removeeventlistener) { a.removeeventlistener(b, c, d) } else if (a.detachevent) { a.detachevent('on' + b, c) } else { a['on' + b] = false } }; this.unbindall = function() { for (var a = 0; a < c.events.length; a++) { var r = c.events[a]; (r.q) ? r.e.unbind(r.n, r.f) : c._unbind(r.e, r.n, r.f, r.b) } }; this.cancelevent = function(e) { var e = (e.original) ? e.original: (e) ? e: window.event || false; if (!e) return false; if (e.preventdefault) e.preventdefault(); if (e.stoppropagation) e.stoppropagation(); if (e.preventmanipulation) e.preventmanipulation(); e.cancelbubble = true; e.cancel = true; e.returnvalue = false; return false }; this.stoppropagation = function(e) { var e = (e.original) ? e.original: (e) ? e: window.event || false; if (!e) return false; if (e.stoppropagation) return e.stoppropagation(); if (e.cancelbubble) e.cancelbubble = true; return false }; this.showrail = function() { if ((c.page.maxh != 0) && (c.ispage || c.win.css('display') != 'none')) { c.visibility = true; c.rail.visibility = true; c.rail.css('display', 'block') } return c }; this.showrailhr = function() { if (!c.railh) return c; if ((c.page.maxw != 0) && (c.ispage || c.win.css('display') != 'none')) { c.railh.visibility = true; c.railh.css('display', 'block') } return c }; this.hiderail = function() { c.visibility = false; c.rail.visibility = false; c.rail.css('display', 'none'); return c }; this.hiderailhr = function() { if (!c.railh) return c; c.railh.visibility = false; c.railh.css('display', 'none'); return c }; this.show = function() { c.hidden = false; c.locked = false; return c.showrail().showrailhr() }; this.hide = function() { c.hidden = true; c.locked = true; return c.hiderail().hiderailhr() }; this.toggle = function() { return (c.hidden) ? c.show() : c.hide() }; this.remove = function() { c.stop(); if (c.cursortimeout) cleartimeout(c.cursortimeout); c.dozoomout(); c.unbindall(); if (c.observer !== false) c.observer.disconnect(); c.events = []; if (c.cursor) { c.cursor.remove(); c.cursor = null } if (c.cursorh) { c.cursorh.remove(); c.cursorh = null } if (c.rail) { c.rail.remove(); c.rail = null } if (c.railh) { c.railh.remove(); c.railh = null } if (c.zoom) { c.zoom.remove(); c.zoom = null } for (var a = 0; a < c.saved.css.length; a++) { var d = c.saved.css[a]; d[0].css(d[1], (typeof d[2] == "undefined") ? '': d[2]) } c.saved = false; c.me.data('__nicescroll', ''); c.me = null; c.doc = null; c.docscroll = null; c.win = null; return c }; this.scrollstart = function(a) { this.onscrollstart = a; return c }; this.scrollend = function(a) { this.onscrollend = a; return c }; this.scrollcancel = function(a) { this.onscrollcancel = a; return c }; this.zoomin = function(a) { this.onzoomin = a; return c }; this.zoomout = function(a) { this.onzoomout = a; return c }; this.isscrollable = function(e) { var a = (e.target) ? e.target: e; while (a && (a.nodetype == 1) && !(/body|html/.test(a.nodename))) { var b = $(a); var c = b.css('overflowy') || b.css('overflowx') || b.css('overflow') || ''; if (/scroll|auto/.test(c)) return (a.clientheight != a.scrollheight); a = (a.parentnode) ? a.parentnode: false } return false }; this.getviewport = function(a) { var b = (a && a.parentnode) ? a.parentnode: false; while (b && (b.nodetype == 1) && !(/body|html/.test(b.nodename))) { var c = $(b); var d = c.css('overflowy') || c.css('overflowx') || c.css('overflow') || ''; if ((/scroll|auto/.test(d)) && (b.clientheight != b.scrollheight)) return c; if (c.getnicescroll().length > 0) return c; b = (b.parentnode) ? b.parentnode: false } return false }; function execscrollwheel(e, b) { var c = 0; var d = 0; var f = 1; if ("wheeldeltay" in e) { f = c.opt.mousescrollstep / (16 * 3); c = math.floor(e.wheeldeltax * f); d = math.floor(e.wheeldeltay * f); if (d < 0) d = d + 1; if (b && (c == 0) && d) { c = d; d = 0 } } else { var g = e.detail ? e.detail * -1 : e.wheeldelta / 40; if (g) { (b) ? c = math.floor(g * c.opt.mousescrollstep) : d = math.floor(g * c.opt.mousescrollstep) } } if (c) { if (c.scrollmom) { c.scrollmom.stop() } c.lastdeltax += c; c.synched("mousewheelx", function() { var a = c.lastdeltax; c.lastdeltax = 0; if (!c.rail.drag) { c.doscrollleftby(a) } }) } if (d) { if (c.scrollmom) { c.scrollmom.stop() } c.lastdeltay += d; c.synched("mousewheely", function() { var a = c.lastdeltay; c.lastdeltay = 0; if (!c.rail.drag) { c.doscrollby(a) } }) } }; this.onmousewheel = function(e) { if (c.locked) return true; if (!c.rail.scrollable) { if (c.railh && c.railh.scrollable) { return c.onmousewheelhr(e) } else { return true } } if (c.opt.preservenativescrolling && c.checkarea) { c.checkarea = false; c.nativescrollingarea = c.isscrollable(e) } if (c.nativescrollingarea) return true; if (c.locked) return c.cancelevent(e); if (c.rail.drag) return c.cancelevent(e); execscrollwheel(e, false); return c.cancelevent(e) }; this.onmousewheelhr = function(e) { if (c.locked || !c.railh.scrollable) return true; if (c.opt.preservenativescrolling && c.checkarea) { c.checkarea = false; c.nativescrollingarea = c.isscrollable(e) } if (c.nativescrollingarea) return true; if (c.locked) return c.cancelevent(e); if (c.rail.drag) return c.cancelevent(e); execscrollwheel(e, true); return c.cancelevent(e) }; this.stop = function() { try { if (c.me.is(":visible") === false) return } catch(e) {} c.cancelscroll(); if (c.scrollmon) c.scrollmon.stop(); c.cursorfreezed = false; c.scroll.y = math.round(c.getscrolltop() * (1 / c.scrollratio.y)); c.noticecursor(); return c }; this.gettransitionspeed = function(a) { var b = math.round(c.opt.scrollspeed * 10); var c = math.min(b, math.round((a / 20) * c.opt.scrollspeed)); return (c > 20) ? c: 0 }; if (!c.opt.smoothscroll) { this.doscrollleft = function(x, a) { var y = c.getscrolltop(); c.doscrollpos(x, y, a) }; this.doscrolltop = function(y, a) { var x = c.getscrollleft(); c.doscrollpos(x, y, a) }; this.doscrollpos = function(x, y, a) { var b = (x > c.page.maxw) ? c.page.maxw: x; if (b < 0) b = 0; var c = (y > c.page.maxh) ? c.page.maxh: y; if (c < 0) c = 0; c.synched('scroll', function() { c.setscrolltop(c); c.setscrollleft(b) }) }; this.cancelscroll = function() {} } else if (c.ishwscroll && d.hastransition && c.opt.usetransition) { this.preparetransition = function(a, b) { var c = (b) ? ((a > 20) ? a: 0) : c.gettransitionspeed(a); var d = (c) ? d.prefixstyle + 'transform ' + c + 'ms ease-out': ''; if (!c.lasttransitionstyle || c.lasttransitionstyle != d) { c.lasttransitionstyle = d; c.doc.css(d.transitionstyle, d) } return c }; this.doscrollleft = function(x, a) { var y = (c.scrollrunning) ? c.newscrolly: c.getscrolltop(); c.doscrollpos(x, y, a) }; this.doscrolltop = function(y, a) { var x = (c.scrollrunning) ? c.newscrollx: c.getscrollleft(); c.doscrollpos(x, y, a) }; this.doscrollpos = function(x, y, k) { var l = c.getscrolltop(); var m = c.getscrollleft(); if (((c.newscrolly - l) * (y - l) < 0) || ((c.newscrollx - m) * (x - m) < 0)) c.cancelscroll(); if (c.opt.bouncescroll == false) { if (y < 0) y = 0; else if (y > c.page.maxh) y = c.page.maxh; if (x < 0) x = 0; else if (x > c.page.maxw) x = c.page.maxw } if (x == c.newscrollx && y == c.newscrolly) return false; c.newscrolly = y; c.newscrollx = x; c.newscrollspeed = k || false; if (c.timer) return false; c.timer = settimeout(function() { var a = c.getscrolltop(); var b = c.getscrollleft(); var c = {}; c.x = x - b; c.y = y - a; c.px = b; c.py = a; var d = math.round(math.sqrt(math.pow(c.x, 2) + math.pow(c.y, 2))); var f = (c.newscrollspeed) ? c.newscrollspeed: d; var g = c.preparetransition(f); if (c.timerscroll && c.timerscroll.tm) clearinterval(c.timerscroll.tm); if (g > 0) { if (!c.scrollrunning && c.onscrollstart) { var h = { "type": "scrollstart", "current": { "x": b, "y": a }, "request": { "x": x, "y": y }, "end": { "x": c.newscrollx, "y": c.newscrolly }, "speed": g }; c.onscrollstart.call(c, h) } if (d.transitionend) { if (!c.scrollendtrapped) { c.scrollendtrapped = true; c.bind(c.doc, d.transitionend, c.onscrollend, false) } } else { if (c.scrollendtrapped) cleartimeout(c.scrollendtrapped); c.scrollendtrapped = settimeout(c.onscrollend, g) } var i = a; var j = b; c.timerscroll = { bz: new bezierclass(i, c.newscrolly, g, 0, 0, 0.58, 1), bh: new bezierclass(j, c.newscrollx, g, 0, 0, 0.58, 1) }; if (!c.cursorfreezed) c.timerscroll.tm = setinterval(function() { try { if (c.me.is(":visible") === false) return } catch(e) {} c.showcursor(c.getscrolltop(), c.getscrollleft()) }, 60) } c.synched("doscroll-set", function() { c.timer = 0; if (c.scrollendtrapped) c.scrollrunning = true; c.setscrolltop(c.newscrolly); c.setscrollleft(c.newscrollx); if (!c.scrollendtrapped) c.onscrollend() }) }, 50) }; this.cancelscroll = function() { try { if (c.me.is(":visible") === false) return } catch(e) {} if (!c.scrollendtrapped) return true; var a = c.getscrolltop(); var b = c.getscrollleft(); c.scrollrunning = false; if (!d.transitionend) cleartimeout(d.transitionend); c.scrollendtrapped = false; c._unbind(c.doc, d.transitionend, c.onscrollend); c.preparetransition(0); c.setscrolltop(a); if (c.railh) c.setscrollleft(b); if (c.timerscroll && c.timerscroll.tm) clearinterval(c.timerscroll.tm); c.timerscroll = false; c.cursorfreezed = false; c.showcursor(a, b); return c }; this.onscrollend = function() { try { if (c.me.is(":visible") === false) return } catch(e) {}; if (c.scrollendtrapped) c._unbind(c.doc, d.transitionend, c.onscrollend); c.scrollendtrapped = false; c.preparetransition(0); if (c.timerscroll && c.timerscroll.tm) clearinterval(c.timerscroll.tm); c.timerscroll = false; var a = c.getscrolltop(); var b = c.getscrollleft(); c.setscrolltop(a); if (c.railh) c.setscrollleft(b); c.noticecursor(false, a, b); c.cursorfreezed = false; if (a < 0) a = 0; else if (a > c.page.maxh) a = c.page.maxh; if (b < 0) b = 0; else if (b > c.page.maxw) b = c.page.maxw; if ((a != c.newscrolly) || (b != c.newscrollx)) return c.doscrollpos(b, a, c.opt.snapbackspeed); if (c.onscrollend && c.scrollrunning) { var c = { "type": "scrollend", "current": { "x": b, "y": a }, "end": { "x": c.newscrollx, "y": c.newscrolly } }; c.onscrollend.call(c, c) } c.scrollrunning = false } } else { this.doscrollleft = function(x) { var y = (c.scrollrunning) ? c.newscrolly: c.getscrolltop(); c.doscrollpos(x, y) }; this.doscrolltop = function(y) { var x = (c.scrollrunning) ? c.newscrollx: c.getscrollleft(); c.doscrollpos(x, y) }; this.doscrollpos = function(x, y) { var y = ((typeof y == "undefined") || (y === false)) ? c.getscrolltop(true) : y; if ((c.timer) && (c.newscrolly == y) && (c.newscrollx == x)) return true; if (c.timer) n(c.timer); c.timer = 0; var g = c.getscrolltop(); var h = c.getscrollleft(); if (((c.newscrolly - g) * (y - g) < 0) || ((c.newscrollx - h) * (x - h) < 0)) c.cancelscroll(); c.newscrolly = y; c.newscrollx = x; if (!c.bouncescroll || !c.rail.visibility) { if (c.newscrolly < 0) { c.newscrolly = 0 } else if (c.newscrolly > c.page.maxh) { c.newscrolly = c.page.maxh } } if (!c.bouncescroll || !c.railh.visibility) { if (c.newscrollx < 0) { c.newscrollx = 0 } else if (c.newscrollx > c.page.maxw) { c.newscrollx = c.page.maxw } } c.dst = {}; c.dst.x = x - h; c.dst.y = y - g; c.dst.px = h; c.dst.py = g; var i = math.round(math.sqrt(math.pow(c.dst.x, 2) + math.pow(c.dst.y, 2))); c.dst.ax = c.dst.x / i; c.dst.ay = c.dst.y / i; var j = 0; var k = i; if (c.dst.x == 0) { j = g; k = y; c.dst.ay = 1; c.dst.py = 0 } else if (c.dst.y == 0) { j = h; k = x; c.dst.ax = 1; c.dst.px = 0 } var l = c.gettransitionspeed(i); if (l > 0) { c.bzscroll = (c.bzscroll) ? c.bzscroll.update(k, l) : new bezierclass(j, k, l, 0, 1, 0, 1) } else { c.bzscroll = false } if (c.timer) return; if ((g == c.page.maxh && y >= c.page.maxh) || (h == c.page.maxw && x >= c.page.maxw)) c.checkcontentsize(); var m = 1; function scrolling() { try { if (c.me.is(":visible") === false) return } catch(e) {} if (c.cancelanimationframe) return true; c.scrollrunning = true; m = 1 - m; if (m) return (c.timer = m(scrolling) || 1); var a = 0; var b = sy = c.getscrolltop(); if (c.dst.ay) { b = (c.bzscroll) ? c.dst.py + (c.bzscroll.getnow() * c.dst.ay) : c.newscrolly; var c = b - sy; if ((c < 0 && b < c.newscrolly) || (c > 0 && b > c.newscrolly)) b = c.newscrolly; c.setscrolltop(b); if (b == c.newscrolly) a = 1 } else { a = 1 } var d = sx = c.getscrollleft(); if (c.dst.ax) { d = (c.bzscroll) ? c.dst.px + (c.bzscroll.getnow() * c.dst.ax) : c.newscrollx; var c = d - sx; if ((c < 0 && d < c.newscrollx) || (c > 0 && d > c.newscrollx)) d = c.newscrollx; c.setscrollleft(d); if (d == c.newscrollx) a += 1 } else { a += 1 } if (a == 2) { c.timer = 0; c.cursorfreezed = false; c.bzscroll = false; c.scrollrunning = false; if (b < 0) b = 0; else if (b > c.page.maxh) b = c.page.maxh; if (d < 0) d = 0; else if (d > c.page.maxw) d = c.page.maxw; if ((d != c.newscrollx) || (b != c.newscrolly)) c.doscrollpos(d, b); else { if (c.onscrollend) { var f = { "type": "scrollend", "current": { "x": sx, "y": sy }, "end": { "x": c.newscrollx, "y": c.newscrolly } }; c.onscrollend.call(c, f) } } } else { c.timer = m(scrolling) || 1 } }; c.cancelanimationframe = false; c.timer = 1; if (c.onscrollstart && !c.scrollrunning) { var n = { "type": "scrollstart", "current": { "x": h, "y": g }, "request": { "x": x, "y": y }, "end": { "x": c.newscrollx, "y": c.newscrolly }, "speed": l }; c.onscrollstart.call(c, n) } scrolling(); if ((g == c.page.maxh && y >= g) || (h == c.page.maxw && x >= h)) c.checkcontentsize(); c.noticecursor() }; this.cancelscroll = function() { if (c.timer) n(c.timer); c.timer = 0; c.bzscroll = false; c.scrollrunning = false; return c } }; this.doscrollby = function(a, b) { try { if (c.me.is(":visible") === false) return } catch(e) {}; var c = 0; if (b) { c = math.floor((c.scroll.y - a) * c.scrollratio.y) } else { var d = (c.timer) ? c.newscrolly: c.getscrolltop(true); c = d - a } if (c.bouncescroll) { var f = math.round(c.view.h / 2); if (c < -f) c = -f; else if (c > (c.page.maxh + f)) c = (c.page.maxh + f) } c.cursorfreezed = false; py = c.getscrolltop(true); if (c < 0 && py <= 0) return c.noticecursor(); else if (c > c.page.maxh && py >= c.page.maxh) { c.checkcontentsize(); return c.noticecursor() } c.doscrolltop(c) }; this.doscrollleftby = function(a, b) { try { if (c.me.is(":visible") === false) return } catch(e) {}; var c = 0; if (b) { c = math.floor((c.scroll.x - a) * c.scrollratio.x) } else { var d = (c.timer) ? c.newscrollx: c.getscrollleft(true); c = d - a } if (c.bouncescroll) { var f = math.round(c.view.w / 2); if (c < -f) c = -f; else if (c > (c.page.maxw + f)) c = (c.page.maxw + f) } c.cursorfreezed = false; px = c.getscrollleft(true); if (c < 0 && px <= 0) return c.noticecursor(); else if (c > c.page.maxw && px >= c.page.maxw) return c.noticecursor(); c.doscrollleft(c) }; this.doscrollto = function(a, b) { var c = (b) ? math.round(a * c.scrollratio.y) : a; if (c < 0) c = 0; else if (c > c.page.maxh) c = c.page.maxh; c.cursorfreezed = false; c.doscrolltop(a) }; this.checkcontentsize = function() { var a = c.getcontentsize(); if ((a.h != c.page.h) || (a.w != c.page.w)) c.resize(false, a) }; c.onscroll = function(e) { try { if (c.me.is(":visible") === false) return } catch(e) {}; if (c.rail.drag) return; if (!c.cursorfreezed) { c.synched('scroll', function() { c.scroll.y = math.round(c.getscrolltop() * (1 / c.scrollratio.y)); if (c.railh) c.scroll.x = math.round(c.getscrollleft() * (1 / c.scrollratio.x)); c.noticecursor() }) } }; c.bind(c.docscroll, "scroll", c.onscroll); this.dozoomin = function(e) { if (c.zoomactive) return; c.zoomactive = true; c.zoomrestore = { style: {} }; var b = ['position', 'top', 'left', 'zindex', 'backgroundcolor', 'margintop', 'marginbottom', 'marginleft', 'marginright']; var c = c.win[0].style; for (var a in b) { var d = b[a]; c.zoomrestore.style[d] = (typeof c[d] != 'undefined') ? c[d] : '' } c.zoomrestore.style.width = c.win.css('width'); c.zoomrestore.style.height = c.win.css('height'); c.zoomrestore.padding = { w: c.win.outerwidth() - c.win.width(), h: c.win.outerheight() - c.win.height() }; if (d.isios4) { c.zoomrestore.scrolltop = $(window).scrolltop(); $(window).scrolltop(0) } c.win.css({ "position": (d.isios4) ? "absolute": "fixed", "top": 0, "left": 0, "z-index": c.opt.zindex + 100, "margin": "0px" }); var f = c.win.css("backgroundcolor"); if (f == "" || /transparent|rgba\(0, 0, 0, 0\)|rgba\(0,0,0,0\)/.test(f)) c.win.css("backgroundcolor", "#fff"); c.rail.css({ "z-index": c.opt.zindex + 110 }); c.zoom.css({ "z-index": c.opt.zindex + 112 }); c.zoom.css('backgroundposition', '0px -18px'); c.resizezoom(); if (c.onzoomin) c.onzoomin.call(c); return c.cancelevent(e) }; this.dozoomout = function(e) { if (!c.zoomactive) return; c.zoomactive = false; c.win.css("margin", ""); c.win.css(c.zoomrestore.style); if (d.isios4) { $(window).scrolltop(c.zoomrestore.scrolltop) } c.rail.css({ "z-index": (c.ispage) ? c.opt.zindex: c.opt.zindex + 2 }); c.zoom.css({ "z-index": c.opt.zindex }); c.zoomrestore = false; c.zoom.css('backgroundposition', '0px 0px'); c.onresize(); if (c.onzoomout) c.onzoomout.call(c); return c.cancelevent(e) }; this.dozoom = function(e) { return (c.zoomactive) ? c.dozoomout(e) : c.dozoomin(e) }; this.resizezoom = function() { if (!c.zoomactive) return; var a = c.getscrolltop(); c.win.css({ width: $(window).width() - c.zoomrestore.padding.w + "px", height: $(window).height() - c.zoomrestore.padding.h + "px" }); c.onresize(); console.log(a); c.setscrolltop(math.min(c.page.maxh, a)) }; this.init(); $.nicescroll.push(this) }; var r = function(r) { var s = this; this.nc = r; this.lastx = 0; this.lasty = 0; this.speedx = 0; this.speedy = 0; this.lasttime = 0; this.steptime = 0; this.snapx = false; this.snapy = false; this.demulx = 0; this.demuly = 0; this.lastscrollx = -1; this.lastscrolly = -1; this.chkx = 0; this.chky = 0; this.timer = 0; this.time = function() { return + new date() }; this.reset = function(a, b) { s.stop(); var c = s.time(); s.steptime = 0; s.lasttime = c; s.speedx = 0; s.speedy = 0; s.lastx = a; s.lasty = b; s.lastscrollx = -1; s.lastscrolly = -1 }; this.update = function(a, b) { var c = s.time(); s.steptime = c - s.lasttime; s.lasttime = c; var d = b - s.lasty; var e = a - s.lastx; var f = s.nc.getscrolltop(); var g = s.nc.getscrollleft(); var h = f + d; var i = g + e; s.snapx = (i < 0) || (i > s.nc.page.maxw); s.snapy = (h < 0) || (h > s.nc.page.maxh); s.speedx = e; s.speedy = d; s.lastx = a; s.lasty = b }; this.stop = function() { s.nc.unsynched("domomentum2d"); if (s.timer) cleartimeout(s.timer); s.timer = 0; s.lastscrollx = -1; s.lastscrolly = -1 }; this.dosnapy = function(a, b) { var c = false; if (b < 0) { b = 0; c = true } else if (b > s.nc.page.maxh) { b = s.nc.page.maxh; c = true } if (a < 0) { a = 0; c = true } else if (a > s.nc.page.maxw) { a = s.nc.page.maxw; c = true } if (c) s.nc.doscrollpos(a, b, s.nc.opt.snapbackspeed) }; this.domomentum = function(d) { var t = s.time(); var l = (d) ? t + d: s.lasttime; var e = s.nc.getscrollleft(); var f = s.nc.getscrolltop(); var g = s.nc.page.maxh; var h = s.nc.page.maxw; s.speedx = (h > 0) ? math.min(60, s.speedx) : 0; s.speedy = (g > 0) ? math.min(60, s.speedy) : 0; var i = l && (t - l) <= 50; if ((f < 0) || (f > g) || (e < 0) || (e > h)) i = false; var j = (s.speedy && i) ? s.speedy: false; var k = (s.speedx && i) ? s.speedx: false; if (j || k) { var m = math.max(16, s.steptime); if (m > 50) { var n = m / 50; s.speedx *= n; s.speedy *= n; m = 50 } s.demulxy = 0; s.lastscrollx = s.nc.getscrollleft(); s.chkx = s.lastscrollx; s.lastscrolly = s.nc.getscrolltop(); s.chky = s.lastscrolly; var o = s.lastscrollx; var p = s.lastscrolly; var q = function() { var c = ((s.time() - t) > 600) ? 0.04 : 0.02; if (s.speedx) { o = math.floor(s.lastscrollx - (s.speedx * (1 - s.demulxy))); s.lastscrollx = o; if ((o < 0) || (o > h)) c = 0.10 } if (s.speedy) { p = math.floor(s.lastscrolly - (s.speedy * (1 - s.demulxy))); s.lastscrolly = p; if ((p < 0) || (p > g)) c = 0.10 } s.demulxy = math.min(1, s.demulxy + c); s.nc.synched("domomentum2d", function() { if (s.speedx) { var a = s.nc.getscrollleft(); if (a != s.chkx) s.stop(); s.chkx = o; s.nc.setscrollleft(o) } if (s.speedy) { var b = s.nc.getscrolltop(); if (b != s.chky) s.stop(); s.chky = p; s.nc.setscrolltop(p) } if (!s.timer) { s.nc.hidecursor(); s.dosnapy(o, p) } }); if (s.demulxy < 1) { s.timer = settimeout(q, m) } else { s.stop(); s.nc.hidecursor(); s.dosnapy(o, p) } }; q() } else { s.dosnapy(s.nc.getscrollleft(), s.nc.getscrolltop()) } } }; var s = f.fn.scrolltop; $.csshooks["pageyoffset"] = { get: function(a, b, c) { var d = $.data(a, '__nicescroll') || false; return (d && d.ishwscroll) ? d.getscrolltop() : s.call(a) }, set: function(a, b) { var c = $.data(a, '__nicescroll') || false; (c && c.ishwscroll) ? c.setscrolltop(parseint(b)) : s.call(a, b); return this } }; f.fn.scrolltop = function(b) { if (typeof b == "undefined") { var c = (this[0]) ? $.data(this[0], '__nicescroll') || false: false; return (c && c.ishwscroll) ? c.getscrolltop() : s.call(this) } else { return this.each(function() { var a = $.data(this, '__nicescroll') || false; (a && a.ishwscroll) ? a.setscrolltop(parseint(b)) : s.call($(this), b) }) } }; var t = f.fn.scrollleft; $.csshooks.pagexoffset = { get: function(a, b, c) { var d = $.data(a, '__nicescroll') || false; return (d && d.ishwscroll) ? d.getscrollleft() : t.call(a) }, set: function(a, b) { var c = $.data(a, '__nicescroll') || false; (c && c.ishwscroll) ? c.setscrollleft(parseint(b)) : t.call(a, b); return this } }; f.fn.scrollleft = function(b) { if (typeof b == "undefined") { var c = (this[0]) ? $.data(this[0], '__nicescroll') || false: false; return (c && c.ishwscroll) ? c.getscrollleft() : t.call(this) } else { return this.each(function() { var a = $.data(this, '__nicescroll') || false; (a && a.ishwscroll) ? a.setscrollleft(parseint(b)) : t.call($(this), b) }) } }; var u = function(c) { var d = this; this.length = 0; this.name = "nicescrollarray"; this.each = function(b) { for (var a = 0; a < d.length; a++) b.call(d[a]); return d }; this.push = function(a) { d[d.length] = a; d.length++ }; this.eq = function(a) { return d[a] }; if (c) { for (a = 0; a < c.length; a++) { var e = $.data(c[a], '__nicescroll') || false; if (e) { this[this.length] = e; this.length++ } } } return this }; function mplex(b, c, d) { for (var a = 0; a < c.length; a++) d(b, c[a]) }; mplex(u.prototype, ['show', 'hide', 'toggle', 'onresize', 'resize', 'remove', 'stop', 'doscrollpos'], function(e, n) { e[n] = function() { var a = arguments; return this.each(function() { this[n].apply(this, a) }) } }); f.fn.getnicescroll = function(a) { if (typeof a == "undefined") { return new u(this) } else { var b = $.data(this[a], '__nicescroll') || false; return b } }; f.extend(f.expr[':'], { nicescroll: function(a) { return ($.data(a, '__nicescroll')) ? true: false } }); $.fn.nicescroll = function(b, c) { if (typeof c == "undefined") { if ((typeof b == "object") && !("jquery" in b)) { c = b; b = false } } var d = new u(); if (typeof c == "undefined") c = {}; if (b || false) { c.doc = $(b); c.win = $(this) } var e = !("doc" in c); if (!e && !("win" in c)) c.win = $(this); this.each(function() { var a = $(this).data('__nicescroll') || false; if (!a) { c.doc = (e) ? $(this) : c.doc; a = new q(c, $(this)); $(this).data('__nicescroll', a) } d.push(a) }); return (d.length == 1) ? d[0] : d }; window.nicescroll = { getjquery: function() { return f } }; if (!$.nicescroll) { $.nicescroll = new u() } })(jquery); (function($) { $.fn.perfectscrollbar = function(a) { if (a === "update" || a === "resize") { $(this).getnicescroll().resize(); return } else if (a === "getscrollobj") { return $(this).getnicescroll() } else if (a === "getscrolltop") { var b = $(this).getnicescroll().eq(0); return b.getscrolltop() } else if (a === "hide") { $(this).getnicescroll().hide() } else if (a === "show") { $(this).getnicescroll().show() } else if (a === "toggle") { $(this).getnicescroll().toggle() } else if (a === "remove" || a === "destroy") { $(this).getnicescroll().remove() } else if (a === "stop") { $(this).getnicescroll().stop() } else if (a === "doscrollpos") { $(this).getnicescroll().doscrollpos() } a = jquery.extend({ cursorwidth: 5, cursorborder: "none", cursorcolor: "#999", hidecursordelay: 0, zindex: 10001, horizrailenabled: false }, a); return $(this).nicescroll(a) } })(jquery);