From 30568c88e38576ff5562ef43ae9a352b388ef8d1 Mon Sep 17 00:00:00 2001 From: InuYaksa Date: Tue, 27 Jun 2017 22:51:02 +0200 Subject: [PATCH 01/14] RC1 Please test this developer release Fixes - touchpad scrolling support for MS Surface aka FYI - Browser test results on Surface Pro touchscreen and touchpad #668 Changes - more responsive direct scrolling from bars - minor code optimizations and jshint check - jQuery "bind" event function changed to "on", migration to jQuery 3 (still jQuery 1 compatible) #361 - Using jQuery.expr.pseudos, migration to jQuery 3 (still jQuery 1 compatible) #361 - changed arguments for doScrollBy and doScrollLeftBy --- README.md | 4 +- bower.json | 14 - changelog_3.7.3.txt | 12 - changelog_3.7.4.txt | 16 + demo/browser.html | 292 -- demo/iframe/lgpl-3.0-standalone.html | 185 - demo/index.html | 207 -- demo/js/jquery.nicescroll.min.js | 2 - demo/js/zoomico.png | Bin 254 -> 0 bytes demo/rtlmode/horizontal.html | 92 - demo/rtlmode/index.html | 302 -- dist/jquery.nicescroll.iframehelper.js | 107 - dist/jquery.nicescroll.iframehelper.min.js | 2 - dist/jquery.nicescroll.js | 3721 -------------------- dist/jquery.nicescroll.min.js | 2 - dist/zoomico.png | Bin 254 -> 0 bytes jquery.nicescroll.iframehelper.min.js | 2 +- jquery.nicescroll.js | 950 ++--- jquery.nicescroll.min.js | 4 +- package.json | 82 - 20 files changed, 533 insertions(+), 5463 deletions(-) delete mode 100644 bower.json delete mode 100644 changelog_3.7.3.txt create mode 100644 changelog_3.7.4.txt delete mode 100644 demo/browser.html delete mode 100644 demo/iframe/lgpl-3.0-standalone.html delete mode 100644 demo/index.html delete mode 100644 demo/js/jquery.nicescroll.min.js delete mode 100644 demo/js/zoomico.png delete mode 100644 demo/rtlmode/horizontal.html delete mode 100644 demo/rtlmode/index.html delete mode 100644 dist/jquery.nicescroll.iframehelper.js delete mode 100644 dist/jquery.nicescroll.iframehelper.min.js delete mode 100644 dist/jquery.nicescroll.js delete mode 100644 dist/jquery.nicescroll.min.js delete mode 100644 dist/zoomico.png delete mode 100644 package.json diff --git a/README.md b/README.md index d17f028..6845f16 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ # jQuery.NiceScroll -v. 3.7.3 2017-06-18 +v. 3.7.4 [[ DEVELOPER RELEASE ]] + +== this is a testing releasing, not suitable for production == - [Web Site: nicescroll.areaaperta.com](https://nicescroll.areaaperta.com) - [Repo: github.com/inuyaksa/jquery.nicescroll](https://github.com/inuyaksa/jquery.nicescroll) diff --git a/bower.json b/bower.json deleted file mode 100644 index 735924a..0000000 --- a/bower.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "name": "jquery.nicescroll", - "main": [ - "./jquery.nicescroll.min.js" - ], - "ignore": [ - "**/.*", - "demo", - "package.json" - ], - "dependencies": { - "jquery": ">=1.8.3" - } -} diff --git a/changelog_3.7.3.txt b/changelog_3.7.3.txt deleted file mode 100644 index cc6fb1c..0000000 --- a/changelog_3.7.3.txt +++ /dev/null @@ -1,12 +0,0 @@ -Changelog nicescroll release 3.7.3 -https://nicescroll.areaaperta.com/ -https://github.com/inuyaksa/jquery.nicescroll - - - -Fixes -- onscrollstart error on emulatetouch - - -Changes -- a little size optimization for uglufy version diff --git a/changelog_3.7.4.txt b/changelog_3.7.4.txt new file mode 100644 index 0000000..54ef7e5 --- /dev/null +++ b/changelog_3.7.4.txt @@ -0,0 +1,16 @@ +Changelog nicescroll release 3.7.4 +https://nicescroll.areaaperta.com/ +https://github.com/inuyaksa/jquery.nicescroll + + + +Fixes +- touchpad scrolling support for MS Surface aka FYI - Browser test results on Surface Pro touchscreen and touchpad #668 + + +Changes +- more responsive direct scrolling from bars +- minor code optimizations and jshint check +- jQuery "bind" event function changed to "on", migration to jQuery 3 (still jQuery 1 compatible) #361 +- Using jQuery.expr.pseudos, migration to jQuery 3 (still jQuery 1 compatible) #361 +- changed arguments for doScrollBy and doScrollLeftBy diff --git a/demo/browser.html b/demo/browser.html deleted file mode 100644 index 0b709ab..0000000 --- a/demo/browser.html +++ /dev/null @@ -1,292 +0,0 @@ - - - - -jQuery NiceScroll Browser Detection - - - - - - - - - - - - -

CHECK YOU BROWSER PAGE

-
NiceScroll version:
-
You browser user agent:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
       
Browser classMozillaWebKitIEOperaiOS (7)ChromeIE11+
Families  IE10+Opera 12iOS4- (6)Chrome 22+MSEdge
   IE9+Opera MiniiOS8Chrome 26+ 
   IE8 iOS10  
   IE7    
   IE6- (1)    
        
Touch  MSPointer   Pointer (W3C)
        
Browser capabilitiesTransform (2)Transition (4)AnimationFrame (5)MutationObserver   
 translate3d (3)transitionEndcancelAnimationFrame    
 setCapturecursor:grabPointer Lock API    
        
InputKeyboardMouseTouch/Pen    
-

 

- -

(1) position:fixed not supported, scrollbar for page and zoom features disabled
- (2) hardware scroll for wrapped div
-(3) hardware scroll preferable for mobile devices
-(4) transition (animation) used for scroll content (hw full implementation)
-(5) more smooth native scroll and cpu saving
-(6) some problem with zoom feature for browser limitation
-(7) use native scrollbar for page
-

-

 

- - - - - diff --git a/demo/iframe/lgpl-3.0-standalone.html b/demo/iframe/lgpl-3.0-standalone.html deleted file mode 100644 index 339913a..0000000 --- a/demo/iframe/lgpl-3.0-standalone.html +++ /dev/null @@ -1,185 +0,0 @@ - - - - GNU Lesser General Public License v3.0 - GNU Project - Free Software Foundation (FSF) - - - -

GNU LESSER GENERAL PUBLIC LICENSE

-

Version 3, 29 June 2007

- -

Copyright © 2007 Free Software Foundation, Inc. - <http://fsf.org/>

- Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed.

- -

This version of the GNU Lesser General Public License incorporates -the terms and conditions of version 3 of the GNU General Public -License, supplemented by the additional permissions listed below.

- -

0. Additional Definitions.

- -

As used herein, “this License” refers to version 3 of the GNU Lesser -General Public License, and the “GNU GPL” refers to version 3 of the GNU -General Public License.

- -

“The Library” refers to a covered work governed by this License, -other than an Application or a Combined Work as defined below.

- -

An “Application” is any work that makes use of an interface provided -by the Library, but which is not otherwise based on the Library. -Defining a subclass of a class defined by the Library is deemed a mode -of using an interface provided by the Library.

- -

A “Combined Work” is a work produced by combining or linking an -Application with the Library. The particular version of the Library -with which the Combined Work was made is also called the “Linked -Version”.

- -

The “Minimal Corresponding Source” for a Combined Work means the -Corresponding Source for the Combined Work, excluding any source code -for portions of the Combined Work that, considered in isolation, are -based on the Application, and not on the Linked Version.

- -

The “Corresponding Application Code” for a Combined Work means the -object code and/or source code for the Application, including any data -and utility programs needed for reproducing the Combined Work from the -Application, but excluding the System Libraries of the Combined Work.

- -

1. Exception to Section 3 of the GNU GPL.

- -

You may convey a covered work under sections 3 and 4 of this License -without being bound by section 3 of the GNU GPL.

- -

2. Conveying Modified Versions.

- -

If you modify a copy of the Library, and, in your modifications, a -facility refers to a function or data to be supplied by an Application -that uses the facility (other than as an argument passed when the -facility is invoked), then you may convey a copy of the modified -version:

- - - -

3. Object Code Incorporating Material from Library Header Files.

- -

The object code form of an Application may incorporate material from -a header file that is part of the Library. You may convey such object -code under terms of your choice, provided that, if the incorporated -material is not limited to numerical parameters, data structure -layouts and accessors, or small macros, inline functions and templates -(ten or fewer lines in length), you do both of the following:

- - - -

4. Combined Works.

- -

You may convey a Combined Work under terms of your choice that, -taken together, effectively do not restrict modification of the -portions of the Library contained in the Combined Work and reverse -engineering for debugging such modifications, if you also do each of -the following:

- - - -

5. Combined Libraries.

- -

You may place library facilities that are a work based on the -Library side by side in a single library together with other library -facilities that are not Applications and are not covered by this -License, and convey such a combined library under terms of your -choice, if you do both of the following:

- - - -

6. Revised Versions of the GNU Lesser General Public License.

- -

The Free Software Foundation may publish revised and/or new versions -of the GNU Lesser General Public License from time to time. Such new -versions will be similar in spirit to the present version, but may -differ in detail to address new problems or concerns.

- -

Each version is given a distinguishing version number. If the -Library as you received it specifies that a certain numbered version -of the GNU Lesser General Public License “or any later version” -applies to it, you have the option of following the terms and -conditions either of that published version or of any later version -published by the Free Software Foundation. If the Library as you -received it does not specify a version number of the GNU Lesser -General Public License, you may choose any version of the GNU Lesser -General Public License ever published by the Free Software Foundation.

- -

If the Library as you received it specifies that a proxy can decide -whether future versions of the GNU Lesser General Public License shall -apply, that proxy's public statement of acceptance of any version is -permanent authorization for you to choose that version for the -Library.

- - - \ No newline at end of file diff --git a/demo/index.html b/demo/index.html deleted file mode 100644 index 3a4602c..0000000 --- a/demo/index.html +++ /dev/null @@ -1,207 +0,0 @@ - - - - -jQuery NiceScroll Test Page - - - - - - - - - - - - - -
NiceScroll version:
- -
-THIS IS A SIMPLE SCROLLABLE DIV -

Package Description

-

Release Date: August 10, 2010

-

The HPIJS driver is the free, open-source driver issued by HP for their DeskJet and LaserJet printers. For most supported printers, this driver produces output quality equivalent to the proprietary HP drivers. In photo mode, with photo paper, the output quality is very high, especially for the HP DeskJet 990C and later models, which auto-detect the paper type in hardware. Photo printing is fully supported in the newer 6- and 7-ink models.

-

A major advantage of using this driver over those supplied by HP is the direct interface between HPIJS and the native CUPS spooler, which allows printing from any printer over any available connection such as USB, AppleTalk, TCP/IP (via LPD and IPP), HP JetDirect, and shared windows printers via SAMBA. Additionally, this driver utilizes the existing Mac OS X USB "backend" and thus does not install any software that might interfere with standard USB operation.

-

Please note:

- -

Release Notes

- -

-

Printer Set Up Instructions

-

To add a printer queue, Leopard (Mac OS X 10.5.x) users should use the Print & Fax from System Preferences. Click on the + (plus) icon at the lower left. A new window will open. In that window, click the Default Browser icon at the top left. Highlight your printer in the section below. Use the "Print Using" pop-up menu near the bottom of the window to select the correct PPD for your printer and click Add.

-

Tiger users should open the Printer Setup Utility and click on the Add icon at the top of the Printer List window. A new window will open. In that window, click the Default Browser icon at the top left. Highlight your printer in the section below. Use the "Print Using" pop-up menu near the bottom of the window to select the correct PPD for your printer and click Add.

-

Jaguar (OS X 10.2.x) and Panther (OS X 10.3.x) users should open Print Center (Jaguar) or Printer Setup Utility (Panther), hold down the Option key, and click the Add Printer button in the Print Center toolbar. Within the setup sheet, choose Advanced from the top popup menu; then in the "Device:" popup menu select your printer by name (it should be the last item in the menu list). Finally, select the correct PPD from the model browser and click Add.

-
- -
-
- THIS IS A DIV + WRAPPER -

Package Description

-

Release Date: August 10, 2010

-

The HPIJS driver is the free, open-source driver issued by HP for their DeskJet and LaserJet printers. For most supported printers, this driver produces output quality equivalent to the proprietary HP drivers. In photo mode, with photo paper, the output quality is very high, especially for the HP DeskJet 990C and later models, which auto-detect the paper type in hardware. Photo printing is fully supported in the newer 6- and 7-ink models.

-

A major advantage of using this driver over those supplied by HP is the direct interface between HPIJS and the native CUPS spooler, which allows printing from any printer over any available connection such as USB, AppleTalk, TCP/IP (via LPD and IPP), HP JetDirect, and shared windows printers via SAMBA. Additionally, this driver utilizes the existing Mac OS X USB "backend" and thus does not install any software that might interfere with standard USB operation.

-

Please note:

-
    -
  • HP does not provide any support for HPLIP or HPIJS on the Mac OS X platform.
  • -
  • Several HP USB devices may not print successfully over the standard Mac OS X USB "backend". Please see this note for more information.
  • -
-

Release Notes

-
    -
  • This release fixes a problem with the PPDs that caused many job options such as page orientation, color/grayscale mode, duplex printing, etc. to fail.
  • -
  • HPIJS is HP's universal printer driver for most of their non-PostScript printers. It comes as a part of HPLIP, HP Linux Imaging and Printing.
  • -
  • The PPDs for HP printers are now sourced from the HPLIP package rather than the OpenPrinting.org database.
  • -
  • PPDs for printers from other manufacturers are provided by OpenPrinting.org.
  • -
  • Some printers are only partially supported. Printers such as
    - HP LaserJet 1022
    - HP LaserJet p1505n
    - HP LaserJet p12014
    - HP LaserJet p2035
    - require a proprietary plug-in for full support. This package does not contain or support such plug-ins.
  • -
-

-

Printer Set Up Instructions

-

To add a printer queue, Leopard (Mac OS X 10.5.x) users should use the Print & Fax from System Preferences. Click on the + (plus) icon at the lower left. A new window will open. In that window, click the Default Browser icon at the top left. Highlight your printer in the section below. Use the "Print Using" pop-up menu near the bottom of the window to select the correct PPD for your printer and click Add.

-

Tiger users should open the Printer Setup Utility and click on the Add icon at the top of the Printer List window. A new window will open. In that window, click the Default Browser icon at the top left. Highlight your printer in the section below. Use the "Print Using" pop-up menu near the bottom of the window to select the correct PPD for your printer and click Add.

-

Jaguar (OS X 10.2.x) and Panther (OS X 10.3.x) users should open Print Center (Jaguar) or Printer Setup Utility (Panther), hold down the Option key, and click the Add Printer button in the Print Center toolbar. Within the setup sheet, choose Advanced from the top popup menu; then in the "Device:" popup menu select your printer by name (it should be the last item in the menu list). Finally, select the correct PPD from the model browser and click Add.

-
-
- -
- -
- - -
-
-

Goggles
- From Wikipedia, the free encyclopedia
- http://en.wikipedia.org/wiki/Goggles

-


- Page semi-protected
- SealMask watersport goggles made by AquaSphere

-

Goggles or safety glasses are forms of protective eyewear that usually enclose or protect the area surrounding the eye in order to prevent particulates, water or chemicals from striking the eyes. They are used in chemistry laboratories and in woodworking. They are often used in snow sports as well, and in swimming. Goggles are often worn when using power tools such as drills or chainsaws to prevent flying particles from damaging the eyes. Many types of goggles are available as prescription goggles for those with vision problems.
- Contents
- [hide]

-

1 History
- 2 Types
- 3 Fashion
- 4 Non-human
- 5 See also
- 6 References

-

History

-

The Eskimos carved Inuit snow goggles from caribou antler, and wood and shell, to help prevent snow blindness. The goggles were curved to fit the user's face and had a large groove cut in the back to allow for the nose. A long thin slit was cut through the goggles to allow in a small amount of light, diminishing subsequent ultraviolet rays. The goggles were held to the head by a cord made of caribou sinew.

-

In the early 20th century, goggles were worn by drivers of uncovered cars to prevent irritation of the eyes by dust or wind. [1] Likewise in the first ten years after the invention of the airplane in 1903 goggles became a necessity as wind blow became more severe as aircraft speeds increased and as protection against bugstrikes at high altitudes. The first pilot to wear goggles was probably Charles Manly in his failed attempt to fly Samuel Langley's aerodrome in 1903.

-

Traditional Inuit goggles used to combat snow blindness

-

Metal nenets goggles

-

Blowtorching goggles and safety helmet

-

Swimming goggles

-

Types

-

The requirements for goggles varies depending on the use. Some examples:

-

Cold weather: Most modern cold-weather goggles have two layers of lens to prevent the interior from becoming "foggy". With only a single lens, the interior water vapor condenses onto the lens because the lens is colder than the vapor, although anti-fog agents can be used. The reasoning behind dual layer lens is that the inner lens will be warm while the outer lens will be cold. As long as the temperature of the inner lens is close to that of the interior water vapor, the vapor should not condense. However, if water vapor gets between the layers of the lens, condensation can occur between the lenses and is almost impossible to get rid of; thus, properly constructed and maintained dual-layer lenses should be air-tight to prevent water vapor from getting in between the lenses.
- Swimming: Must be watertight to prevent water, such as salt water when swimming in the ocean, or chlorinated water when swimming in a pool, from irritating the eyes or blurring vision. Allows swimmers to see clearly underwater. They will not be usable more than a few feet underwater, because the water pressure will press them tightly against the face. Examples of these include the Swedish goggles.
- Power tools: Must be made of an unbreakable material that prevents chunks of metal, wood, plastic, concrete, and so on from hitting or piercing the eye. Usually has some sort of ventilation to prevent sweat from building up inside the goggles and fogging the surface.
- Blowtorch goggles: These protect the eyes from glare and flying sparks and hot metal splashes while using or near as blowtorch. They are not the correct filters for arc welding.
- Welding goggles: Includes all goggles for eye protection during welding or cutting. They provide protection against debris, the heat from welding, and, with the proper filters, the optical radiation resulting from the welding, which can otherwise cause arc eye.
- Motorcycle riding and other open-air activities: Prevents insects, dust, and so on from hitting the eyes.
- Laboratory and research: Combines impact resistance with side shields to prevent chemical splashes reaching the eyes. May also include laser protection which would be covered by EN 207 (Europe) and ANSI Z 136 (United States). Examples of these include red adaptation goggles.
- Racquetball: Protect the eyes from racquets swinging in an enclosed area and from impact from hard rubber ball.
- Winter sports: Protect the eyes from glare and from icy particles flying up from the ground.
- Astronomy and meteorology: dark adaptor goggles are used before going outside at night, in order to help the eyes adapt to the dark.
- Basketball: Several NBA players have worn goggles during play, including Kareem Abdul-Jabbar, James Worthy, Horace Grant, Kurt Rambis and Amar'e Stoudemire; they prevent a fellow player from scratching or hitting the eyes when trying to grab the basketball.
- Aviation: In open cockpit aircraft, such as old biplanes, aviators, such as Amelia Earhart and Charles Kingsford Smith, would wear goggles to help protect from the wind and are still in use today. Examples of these include the AN-6530 goggles.
- Virtual reality: A virtual reality headset, sometimes called "goggles", is a wrap-around visual interface to display computer output. Commonly the computer display information is presented as a three-dimensional representation of real-world environments.

-

Fashion

-

Goggles are often worn as a fashion statement in certain subcultures, most often as part of the cybergoth subculture. They are usually worn over the eyes or up on the forehead to secure 'falls': a type of long, often brightly-coloured, synthetic hairpiece. Fans of the steampunk genre or subculture also frequently wear steampunk-styled goggles, particularly when performing in a live action role-playing game.

-

Goggles are also frequently used by anime and manga characters as a fashion statement. For example, it is an idiosyncrasy of team leader characters in the Digimon anime to wear goggles. Other notable characters who wear goggles are the young Naruto Uzumaki and Konohamaru from Naruto, Matt from Death Note and Usopp from One Piece.
- Non-human
- Bullfighting horse wearing eye protection
- A US Military working dog attached to a helicopter hoist in Afghanistan.

-

Goggles are available for horses used in speed sports such as horse racing.[2] In some traditions of horse mounted bullfighting, the horse may wear a protective cloth over its eyes.

-

Goggles have been used on military working dogs, for protection in harsh conditions, such as sandstorms and rotorwash from helicopters. One of the brands of these types of goggles are Doggles.
- See also
- Wikimedia Commons has media related to: Goggles

-

Ballistic Eye Wear
- Beer goggles
- Google Goggles
- Night vision device
- Personal protective equipment
- Safety engineering
- Visor

-

References

-

^ Alfred C. Harmsworth (1904). Motors and Motor-driving.
- ^ Landers T. A. (2006) Professional Care of the Racehorse, Revised Edition: A Guide to Grooming, Feeding, and Handling the Equine Athlete. Blood Horse Publications. 308 pages. Page 138.

-

-
-
- - - diff --git a/demo/js/jquery.nicescroll.min.js b/demo/js/jquery.nicescroll.min.js deleted file mode 100644 index b16abae..0000000 --- a/demo/js/jquery.nicescroll.min.js +++ /dev/null @@ -1,2 +0,0 @@ -/* nicescroll v3.7.3 InuYaksa - MIT - https://nicescroll.areaaperta.com */ -!function(e){"function"==typeof define&&define.amd?define(["jquery"],e):"object"==typeof exports?module.exports=e(require("jquery")):e(jQuery)}(function(e){"use strict";var o=!1,t=!1,r=0,i=2e3,s=0,n=e,l=document,a=n(window),c=function(){return window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||!1}(),d=function(){return window.cancelAnimationFrame||window.webkitCancelAnimationFrame||window.mozCancelAnimationFrame||!1}();if(c)window.cancelAnimationFrame||(d=function(e){});else{var u=0;c=function(e,o){var t=(new Date).getTime(),r=Math.max(0,16-(t-u)),i=window.setTimeout(function(){e(t+r)},r);return u=t+r,i},d=function(e){window.clearTimeout(e)}}var h=window.MutationObserver||window.WebKitMutationObserver||!1,p=Date.now||function(){return(new Date).getTime()},m={zindex:"auto",cursoropacitymin:0,cursoropacitymax:1,cursorcolor:"#424242",cursorwidth:"6px",cursorborder:"1px solid #fff",cursorborderradius:"5px",scrollspeed:60,mousescrollstep:24,touchbehavior:!1,emulatetouch:!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 e=l.currentScript||function(){var e=l.getElementsByTagName("script");return!!e.length&&e[e.length-1]}(),o=e?e.src.split("?")[0]:"";return o.split("/").length>0?o.split("/").slice(0,-1).join("/")+"/":""}(),preventmultitouchscrolling:!0,disablemutationobserver:!1,enableobserver:!0,scrollbarid:!1},f=!1,g=function(){if(f)return f;var e=l.createElement("DIV"),o=e.style,t=navigator.userAgent,r=navigator.platform,i={};return i.haspointerlock="pointerLockElement"in l||"webkitPointerLockElement"in l||"mozPointerLockElement"in l,i.isopera="opera"in window,i.isopera12=i.isopera&&"getUserMedia"in navigator,i.isoperamini="[object OperaMini]"===Object.prototype.toString.call(window.operamini),i.isie="all"in l&&"attachEvent"in e&&!i.isopera,i.isieold=i.isie&&!("msInterpolationMode"in o),i.isie7=i.isie&&!i.isieold&&(!("documentMode"in l)||7===l.documentMode),i.isie8=i.isie&&"documentMode"in l&&8===l.documentMode,i.isie9=i.isie&&"performance"in window&&9===l.documentMode,i.isie10=i.isie&&"performance"in window&&10===l.documentMode,i.isie11="msRequestFullscreen"in e&&l.documentMode>=11,i.ismsedge="msCredentials"in window,i.ismozilla="MozAppearance"in o,i.iswebkit=!i.ismsedge&&"WebkitAppearance"in o,i.ischrome=i.iswebkit&&"chrome"in window,i.ischrome38=i.ischrome&&"touchAction"in o,i.ischrome22=!i.ischrome38&&i.ischrome&&i.haspointerlock,i.ischrome26=!i.ischrome38&&i.ischrome&&"transition"in o,i.cantouch="ontouchstart"in l.documentElement||"ontouchstart"in window,i.hasw3ctouch=(window.PointerEvent||!1)&&(navigator.MaxTouchPoints>0||navigator.msMaxTouchPoints>0),i.hasmstouch=!i.hasw3ctouch&&(window.MSPointerEvent||!1),i.ismac=/^mac$/i.test(r),i.isios=i.cantouch&&/iphone|ipad|ipod/i.test(r),i.isios4=i.isios&&!("seal"in Object),i.isios7=i.isios&&"webkitHidden"in l,i.isios8=i.isios&&"hidden"in l,i.isios10=i.isios&&window.Proxy,i.isandroid=/android/i.test(t),i.haseventlistener="addEventListener"in e,i.trstyle=!1,i.hastransform=!1,i.hastranslate3d=!1,i.transitionstyle=!1,i.hastransition=!1,i.transitionend=!1,i.trstyle="transform",i.hastransform="transform"in o||function(){for(var e=["msTransform","webkitTransform","MozTransform","OTransform"],t=0,r=e.length;t0;){if(9==e[0].nodeType)return!1;var o=e.css("zIndex");if(!isNaN(o)&&0!=o)return parseInt(o);e=e.parent()}return!1}function b(e,o,t){var r=e.css(o),i=parseFloat(r);if(isNaN(i)){var s=3==(i=P[r]||0)?t?S.win.outerHeight()-S.win.innerHeight():S.win.outerWidth()-S.win.innerWidth():1;return S.isie8&&i&&(i+=1),s?i:0}return i}function y(e,o,t,r){S._bind(e,o,function(r){var i={original:r=r||window.event,target:r.target||r.srcElement,type:"wheel",deltaMode:"MozMousePixelScroll"==r.type?0:1,deltaX:0,deltaZ:0,preventDefault:function(){return r.preventDefault?r.preventDefault():r.returnValue=!1,!1},stopImmediatePropagation:function(){r.stopImmediatePropagation?r.stopImmediatePropagation():r.cancelBubble=!0}};return"mousewheel"==o?(r.wheelDeltaX&&(i.deltaX=-.025*r.wheelDeltaX),r.wheelDeltaY&&(i.deltaY=-.025*r.wheelDeltaY),!i.deltaY&&!i.deltaX&&(i.deltaY=-.025*r.wheelDelta)):i.deltaY=r.detail,t.call(e,i)},r)}function x(e,o,t){var r,i;if(0==e.deltaMode?(r=-Math.floor(e.deltaX*(S.opt.mousescrollstep/54)),i=-Math.floor(e.deltaY*(S.opt.mousescrollstep/54))):1==e.deltaMode&&(r=-Math.floor(e.deltaX*S.opt.mousescrollstep),i=-Math.floor(e.deltaY*S.opt.mousescrollstep)),o&&S.opt.oneaxismousemode&&0===r&&i&&(r=i,i=0,t&&(r<0?S.getScrollLeft()>=S.page.maxw:S.getScrollLeft()<=0)&&(i=r,r=0)),S.isrtlmode&&(r=-r),r){if(S.scrollmom)S.scrollmom.stop();else if(r<0){if(S.getScrollLeft()>=S.page.maxw)return!0}else if(S.getScrollLeft()<=0)return!0;S.lastdeltax+=r,S.debounced("mousewheelx",function(){var e=S.lastdeltax;S.lastdeltax=0,S.rail.drag||S.doScrollLeftBy(e)},15)}if(i){if(S.opt.nativeparentscrolling&&t&&!S.ispage&&!S.zoomactive)if(i<0){if(S.getScrollTop()>=S.page.maxh)return!0}else if(S.getScrollTop()<=0)return!0;S.scrollmom&&S.scrollmom.stop(),S.lastdeltay+=i,S.synched("mousewheely",function(){var e=S.lastdeltay;S.lastdeltay=0,S.rail.drag||S.doScrollBy(e)},15)}return e.stopImmediatePropagation(),e.preventDefault()}var S=this;this.version="3.7.3",this.name="nicescroll",this.me=u;var z=n("body");if(this.opt={doc:z,win:!1},n.extend(this.opt,m),this.opt.snapbackspeed=80,e)for(var k in S.opt)void 0!==e[k]&&(S.opt[k]=e[k]);if(S.opt.disablemutationobserver&&(h=!1),this.doc=S.opt.doc,this.iddoc=this.doc&&this.doc[0]?this.doc[0].id||"":"",this.ispage=/^BODY|HTML/.test(S.opt.win?S.opt.win[0].nodeName:this.doc[0].nodeName),this.haswrapper=!1!==S.opt.win,this.win=S.opt.win||(this.ispage?a:this.doc),this.docscroll=this.ispage&&!this.haswrapper?a:this.win,this.body=z,this.viewport=!1,this.isfixed=!1,this.iframe=!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"!=S.opt.autohidemode,this.onmousedown=!1,this.onmouseup=!1,this.onmousemove=!1,this.onmousewheel=!1,this.onkeypress=!1,this.ongesturezoom=!1,this.onclick=!1,this.onscrollstart=!1,this.onscrollend=!1,this.onscrollcancel=!1,this.onzoomin=!1,this.onzoomout=!1,this.view=!1,this.page=!1,this.scroll={x:0,y:0},this.scrollratio={x:0,y:0},this.cursorheight=20,this.scrollvaluemax=0,"auto"==this.opt.rtlmode){var T=this.win[0]==window?this.body:this.win,M=T.css("writing-mode")||T.css("-webkit-writing-mode")||T.css("-ms-writing-mode")||T.css("-moz-writing-mode");"horizontal-tb"==M||"lr-tb"==M||""==M?(this.isrtlmode="rtl"==T.css("direction"),this.isvertical=!1):(this.isrtlmode="vertical-rl"==M||"tb"==M||"tb-rl"==M||"rl-tb"==M,this.isvertical="vertical-rl"==M||"tb"==M||"tb-rl"==M)}else this.isrtlmode=!0===this.opt.rtlmode,this.isvertical=!1;if(this.scrollrunning=!1,this.scrollmom=!1,this.observer=!1,this.observerremover=!1,this.observerbody=!1,!1===S.opt.scrollbarid)do{this.id="ascrail"+i++}while(l.getElementById(this.id));else this.id=S.opt.scrollbarid;this.rail=!1,this.cursor=!1,this.cursorfreezed=!1,this.selectiondrag=!1,this.zoom=!1,this.zoomactive=!1,this.hasfocus=!1,this.hasmousefocus=!1,this.visibility=!0,this.railslocked=!1,this.locked=!1,this.hidden=!1,this.cursoractive=!0,this.wheelprevented=!1,this.overflowx=S.opt.overflowx,this.overflowy=S.opt.overflowy,this.nativescrollingarea=!1,this.checkarea=0,this.events=[],this.saved={},this.delaylist={},this.synclist={},this.lastdeltax=0,this.lastdeltay=0,this.detected=g();var E=n.extend({},this.detected);this.canhwscroll=E.hastransform&&S.opt.hwacceleration,this.ishwscroll=this.canhwscroll&&S.haswrapper,this.isrtlmode?this.isvertical?this.hasreversehr=!(E.iswebkit||E.isie||E.isie11):this.hasreversehr=!(E.iswebkit||E.isie&&!E.isie10&&!E.isie11):this.hasreversehr=!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,S.opt.enablemouselockapi||(E.hasmousecapture=!1,E.haspointerlock=!1),this.debounced=function(e,o,t){S&&(S.delaylist[e]||!1||(S.delaylist[e]={h:c(function(){S.delaylist[e].fn.call(S),S.delaylist[e]=!1},t)},o.call(S)),S.delaylist[e].fn=o)};var L=!1;this.synched=function(e,o){return S.synclist[e]=o,function(){L||(c(function(){if(S){L=!1;for(var e in S.synclist){var o=S.synclist[e];o&&o.call(S),S.synclist[e]=!1}}}),L=!0)}(),e},this.unsynched=function(e){S.synclist[e]&&(S.synclist[e]=!1)},this.css=function(e,o){for(var t in o)S.saved.css.push([e,t,e.css(t)]),e.css(t,o[t])},this.scrollTop=function(e){return void 0===e?S.getScrollTop():S.setScrollTop(e)},this.scrollLeft=function(e){return void 0===e?S.getScrollLeft():S.setScrollLeft(e)};var C=function(e,o,t,r,i,s,n){this.st=e,this.ed=o,this.spd=t,this.p1=r||0,this.p2=i||1,this.p3=s||0,this.p4=n||1,this.ts=p(),this.df=this.ed-this.st};if(C.prototype={B2:function(e){return 3*e*e*(1-e)},B3:function(e){return 3*e*(1-e)*(1-e)},B4:function(e){return(1-e)*(1-e)*(1-e)},getNow:function(){var e=1-(p()-this.ts)/this.spd,o=this.B2(e)+this.B3(e)+this.B4(e);return e<0?this.ed:this.st+Math.round(this.df*o)},update:function(e,o){return this.st=this.getNow(),this.ed=e,this.spd=o,this.ts=p(),this.df=this.ed-this.st,this}},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(e){if(!e){var o=f();if(o)return 16==o.length?-o[13]:-o[5];if(S.timerscroll&&S.timerscroll.bz)return S.timerscroll.bz.getNow()}return S.doc.translate.y},this.getScrollLeft=function(e){if(!e){var o=f();if(o)return 16==o.length?-o[12]:-o[4];if(S.timerscroll&&S.timerscroll.bh)return S.timerscroll.bh.getNow()}return S.doc.translate.x},this.notifyScrollEvent=function(e){var o=l.createEvent("UIEvents");o.initUIEvent("scroll",!1,!0,window,1),o.niceevent=!0,e.dispatchEvent(o)};var N=this.isrtlmode?1:-1;E.hastranslate3d&&S.opt.enabletranslate3d?(this.setScrollTop=function(e,o){S.doc.translate.y=e,S.doc.translate.ty=-1*e+"px",S.doc.css(E.trstyle,"translate3d("+S.doc.translate.tx+","+S.doc.translate.ty+",0)"),o||S.notifyScrollEvent(S.win[0])},this.setScrollLeft=function(e,o){S.doc.translate.x=e,S.doc.translate.tx=e*N+"px",S.doc.css(E.trstyle,"translate3d("+S.doc.translate.tx+","+S.doc.translate.ty+",0)"),o||S.notifyScrollEvent(S.win[0])}):(this.setScrollTop=function(e,o){S.doc.translate.y=e,S.doc.translate.ty=-1*e+"px",S.doc.css(E.trstyle,"translate("+S.doc.translate.tx+","+S.doc.translate.ty+")"),o||S.notifyScrollEvent(S.win[0])},this.setScrollLeft=function(e,o){S.doc.translate.x=e,S.doc.translate.tx=e*N+"px",S.doc.css(E.trstyle,"translate("+S.doc.translate.tx+","+S.doc.translate.ty+")"),o||S.notifyScrollEvent(S.win[0])})}else this.getScrollTop=function(){return S.docscroll.scrollTop()},this.setScrollTop=function(e){return setTimeout(function(){S&&S.docscroll.scrollTop(e)},1)},this.getScrollLeft=function(){return S.hasreversehr?S.detected.ismozilla?S.page.maxw-Math.abs(S.docscroll.scrollLeft()):S.page.maxw-S.docscroll.scrollLeft():S.docscroll.scrollLeft()},this.setScrollLeft=function(e){return setTimeout(function(){if(S)return S.hasreversehr&&(e=S.detected.ismozilla?-(S.page.maxw-e):S.page.maxw-e),S.docscroll.scrollLeft(e)},1)};this.getTarget=function(e){return!!e&&(e.target?e.target:!!e.srcElement&&e.srcElement)},this.hasParent=function(e,o){if(!e)return!1;for(var t=e.target||e.srcElement||e||!1;t&&t.id!=o;)t=t.parentNode||!1;return!1!==t};var P={thin:1,medium:3,thick:5};this.getDocumentScrollOffset=function(){return{top:window.pageYOffset||l.documentElement.scrollTop,left:window.pageXOffset||l.documentElement.scrollLeft}},this.getOffset=function(){if(S.isfixed){var e=S.win.offset(),o=S.getDocumentScrollOffset();return e.top-=o.top,e.left-=o.left,e}var t=S.win.offset();if(!S.viewport)return t;var r=S.viewport.offset();return{top:t.top-r.top,left:t.left-r.left}},this.updateScrollBar=function(e){var o,t;if(S.ishwscroll)S.rail.css({height:S.win.innerHeight()-(S.opt.railpadding.top+S.opt.railpadding.bottom)}),S.railh&&S.railh.css({width:S.win.innerWidth()-(S.opt.railpadding.left+S.opt.railpadding.right)});else{var r=S.getOffset();if(o={top:r.top,left:r.left-(S.opt.railpadding.left+S.opt.railpadding.right)},o.top+=b(S.win,"border-top-width",!0),o.left+=S.rail.align?S.win.outerWidth()-b(S.win,"border-right-width")-S.rail.width:b(S.win,"border-left-width"),(t=S.opt.railoffset)&&(t.top&&(o.top+=t.top),t.left&&(o.left+=t.left)),S.railslocked||S.rail.css({top:o.top,left:o.left,height:(e?e.h:S.win.innerHeight())-(S.opt.railpadding.top+S.opt.railpadding.bottom)}),S.zoom&&S.zoom.css({top:o.top+1,left:1==S.rail.align?o.left-20:o.left+S.rail.width+4}),S.railh&&!S.railslocked){o={top:r.top,left:r.left},(t=S.opt.railhoffset)&&(t.top&&(o.top+=t.top),t.left&&(o.left+=t.left));var i=S.railh.align?o.top+b(S.win,"border-top-width",!0)+S.win.innerHeight()-S.railh.height:o.top+b(S.win,"border-top-width",!0),s=o.left+b(S.win,"border-left-width");S.railh.css({top:i-(S.opt.railpadding.top+S.opt.railpadding.bottom),left:s,width:S.railh.width})}}},this.doRailClick=function(e,o,t){var r,i,s,n;S.railslocked||(S.cancelEvent(e),"pageY"in e||(e.pageX=e.clientX+l.documentElement.scrollLeft,e.pageY=e.clientY+l.documentElement.scrollTop),o?(r=t?S.doScrollLeft:S.doScrollTop)(s=t?(e.pageX-S.railh.offset().left-S.cursorwidth/2)*S.scrollratio.x:(e.pageY-S.rail.offset().top-S.cursorheight/2)*S.scrollratio.y):(r=t?S.doScrollLeftBy:S.doScrollBy,s=t?S.scroll.x:S.scroll.y,n=t?e.pageX-S.railh.offset().left:e.pageY-S.rail.offset().top,i=t?S.view.w:S.view.h,r(s>=n?i:-i)))},S.hasanimationframe="requestAnimationFrame"in window,S.hascancelanimationframe="cancelAnimationFrame"in window,this.init=function(){if(S.saved.css=[],E.isoperamini)return!0;if(E.isandroid&&!("hidden"in l))return!0;S.opt.emulatetouch=S.opt.emulatetouch||S.opt.touchbehavior;var e={"overflow-y":"hidden"};if((E.isie11||E.isie10)&&(e["-ms-overflow-style"]="none"),S.zindex="auto",S.ispage||"auto"!=S.opt.zindex?S.zindex=S.opt.zindex:S.zindex=w()||"auto",!S.ispage&&"auto"!=S.zindex&&S.zindex>s&&(s=S.zindex),S.isie&&0==S.zindex&&"auto"==S.opt.zindex&&(S.zindex="auto"),!S.ispage||!E.cantouch&&!E.isieold){var i=S.docscroll;S.ispage&&(i=S.haswrapper?S.win:S.doc),S.css(i,e),S.ispage&&(E.isie11||E.isie)&&S.css(n("html"),e),!E.isios||S.ispage||S.haswrapper||S.css(z,{"-webkit-overflow-scrolling":"touch"});var c=n(l.createElement("div"));c.css({position:"relative",top:0,float:"right",width:S.opt.cursorwidth,height:0,"background-color":S.opt.cursorcolor,border:S.opt.cursorborder,"background-clip":"padding-box","-webkit-border-radius":S.opt.cursorborderradius,"-moz-border-radius":S.opt.cursorborderradius,"border-radius":S.opt.cursorborderradius}),c.addClass("nicescroll-cursors"),S.cursor=c;var d=n(l.createElement("div"));d.attr("id",S.id),d.addClass("nicescroll-rails nicescroll-rails-vr");var u,p,m=["left","right","top","bottom"];for(var f in m)p=m[f],(u=S.opt.railpadding[p])?d.css("padding-"+p,u+"px"):S.opt.railpadding[p]=0;d.append(c),d.width=Math.max(parseFloat(S.opt.cursorwidth),c.outerWidth()),d.css({width:d.width+"px",zIndex:S.zindex,background:S.opt.background,cursor:"default"}),d.visibility=!0,d.scrollable=!0,d.align="left"==S.opt.railalign?0:1,S.rail=d,S.rail.drag=!1;var g=!1;!S.opt.boxzoom||S.ispage||E.isieold||(g=l.createElement("div"),S.bind(g,"click",S.doZoom),S.bind(g,"mouseenter",function(){S.zoom.css("opacity",S.opt.cursoropacitymax)}),S.bind(g,"mouseleave",function(){S.zoom.css("opacity",S.opt.cursoropacitymin)}),S.zoom=n(g),S.zoom.css({cursor:"pointer",zIndex:S.zindex,backgroundImage:"url("+S.opt.scriptpath+"zoomico.png)",height:18,width:18,backgroundPosition:"0 0"}),S.opt.dblclickzoom&&S.bind(S.win,"dblclick",S.doZoom),E.cantouch&&S.opt.gesturezoom&&(S.ongesturezoom=function(e){return e.scale>1.5&&S.doZoomIn(e),e.scale<.8&&S.doZoomOut(e),S.cancelEvent(e)},S.bind(S.win,"gestureend",S.ongesturezoom))),S.railh=!1;var b;if(S.opt.horizrailenabled&&(S.css(i,{overflowX:"hidden"}),(c=n(l.createElement("div"))).css({position:"absolute",top:0,height:S.opt.cursorwidth,width:0,backgroundColor:S.opt.cursorcolor,border:S.opt.cursorborder,backgroundClip:"padding-box","-webkit-border-radius":S.opt.cursorborderradius,"-moz-border-radius":S.opt.cursorborderradius,"border-radius":S.opt.cursorborderradius}),E.isieold&&c.css("overflow","hidden"),c.addClass("nicescroll-cursors"),S.cursorh=c,(b=n(l.createElement("div"))).attr("id",S.id+"-hr"),b.addClass("nicescroll-rails nicescroll-rails-hr"),b.height=Math.max(parseFloat(S.opt.cursorwidth),c.outerHeight()),b.css({height:b.height+"px",zIndex:S.zindex,background:S.opt.background}),b.append(c),b.visibility=!0,b.scrollable=!0,b.align="top"==S.opt.railvalign?0:1,S.railh=b,S.railh.drag=!1),S.ispage)d.css({position:"fixed",top:0,height:"100%"}),d.align?d.css({right:0}):d.css({left:0}),S.body.append(d),S.railh&&(b.css({position:"fixed",left:0,width:"100%"}),b.align?b.css({bottom:0}):b.css({top:0}),S.body.append(b));else{if(S.ishwscroll){"static"==S.win.css("position")&&S.css(S.win,{position:"relative"});var y="HTML"==S.win[0].nodeName?S.body:S.win;n(y).scrollTop(0).scrollLeft(0),S.zoom&&(S.zoom.css({position:"absolute",top:1,right:0,"margin-right":d.width+4}),y.append(S.zoom)),d.css({position:"absolute",top:0}),d.align?d.css({right:0}):d.css({left:0}),y.append(d),b&&(b.css({position:"absolute",left:0,bottom:0}),b.align?b.css({bottom:0}):b.css({top:0}),y.append(b))}else{S.isfixed="fixed"==S.win.css("position");var x=S.isfixed?"fixed":"absolute";S.isfixed||(S.viewport=S.getViewport(S.win[0])),S.viewport&&(S.body=S.viewport,0==/fixed|absolute/.test(S.viewport.css("position"))&&S.css(S.viewport,{position:"relative"})),d.css({position:x}),S.zoom&&S.zoom.css({position:x}),S.updateScrollBar(),S.body.append(d),S.zoom&&S.body.append(S.zoom),S.railh&&(b.css({position:x}),S.body.append(b))}E.isios&&S.css(S.win,{"-webkit-tap-highlight-color":"rgba(0,0,0,0)","-webkit-touch-callout":"none"}),E.isie&&S.opt.disableoutline&&S.win.attr("hideFocus","true"),E.iswebkit&&S.opt.disableoutline&&S.win.css("outline","none")}if(!1===S.opt.autohidemode?(S.autohidedom=!1,S.rail.css({opacity:S.opt.cursoropacitymax}),S.railh&&S.railh.css({opacity:S.opt.cursoropacitymax})):!0===S.opt.autohidemode||"leave"===S.opt.autohidemode?(S.autohidedom=n().add(S.rail),E.isie8&&(S.autohidedom=S.autohidedom.add(S.cursor)),S.railh&&(S.autohidedom=S.autohidedom.add(S.railh)),S.railh&&E.isie8&&(S.autohidedom=S.autohidedom.add(S.cursorh))):"scroll"==S.opt.autohidemode?(S.autohidedom=n().add(S.rail),S.railh&&(S.autohidedom=S.autohidedom.add(S.railh))):"cursor"==S.opt.autohidemode?(S.autohidedom=n().add(S.cursor),S.railh&&(S.autohidedom=S.autohidedom.add(S.cursorh))):"hidden"==S.opt.autohidemode&&(S.autohidedom=!1,S.hide(),S.railslocked=!1),E.cantouch||S.istouchcapable||S.opt.emulatetouch||E.hasmstouch){S.scrollmom=new v(S),S.ontouchstart=function(e){if(e.pointerType&&2!=e.pointerType&&"touch"!=e.pointerType)return!1;if(S.hasmoving=!1,!S.railslocked){var o;if(E.hasmstouch)for(o=!!e.target&&e.target;o;){var t=n(o).getNiceScroll();if(t.length>0&&t[0].me==S.me)break;if(t.length>0)return!1;if("DIV"==o.nodeName&&o.id==S.id)break;o=!!o.parentNode&&o.parentNode}if(e.stopPropagation(),S.cancelScroll(),(o=S.getTarget(e))&&/INPUT/i.test(o.nodeName)&&/range/i.test(o.type))return S.stopPropagation(e);if(!("clientX"in e)&&"changedTouches"in e&&(e.clientX=e.changedTouches[0].clientX,e.clientY=e.changedTouches[0].clientY),S.forcescreen){var r=e;(e={original:e.original?e.original:e}).clientX=r.screenX,e.clientY=r.screenY}if(S.rail.drag={x:e.clientX,y:e.clientY,sx:S.scroll.x,sy:S.scroll.y,st:S.getScrollTop(),sl:S.getScrollLeft(),pt:2,dl:!1,tg:o},S.ispage||!S.opt.directionlockdeadzone)S.rail.drag.dl="f";else{var i={w:a.width(),h:a.height()},s={w:Math.max(l.body.scrollWidth,l.documentElement.scrollWidth),h:Math.max(l.body.scrollHeight,l.documentElement.scrollHeight)},c=Math.max(0,s.h-i.h),d=Math.max(0,s.w-i.w);!S.rail.scrollable&&S.railh.scrollable?S.rail.drag.ck=c>0&&"v":S.rail.scrollable&&!S.railh.scrollable?S.rail.drag.ck=d>0&&"h":S.rail.drag.ck=!1,S.rail.drag.ck||(S.rail.drag.dl="f")}if(S.opt.emulatetouch&&S.isiframe&&E.isie){var u=S.win.position();S.rail.drag.x+=u.left,S.rail.drag.y+=u.top}if(S.hasmoving=!1,S.lastmouseup=!1,S.scrollmom.reset(e.clientX,e.clientY),!E.cantouch&&!this.istouchcapable&&!e.pointerType){if(!(!!o&&/INPUT|SELECT|BUTTON|TEXTAREA/i.test(o.nodeName)))return!S.ispage&&E.hasmousecapture&&o.setCapture(),S.opt.emulatetouch?(o.onclick&&!o._onclick&&(o._onclick=o.onclick,o.onclick=function(e){if(S.hasmoving)return!1;o._onclick.call(this,e)}),S.cancelEvent(e)):S.stopPropagation(e);/SUBMIT|CANCEL|BUTTON/i.test(n(o).attr("type"))&&(S.preventclick={tg:o,click:!1})}}},S.ontouchend=function(e){if(!S.rail.drag)return!0;if(2==S.rail.drag.pt){if(e.pointerType&&2!=e.pointerType&&"touch"!=e.pointerType)return!1;if(S.rail.drag=!1,S.hasmoving&&(S.scrollmom.doMomentum(),S.lastmouseup=!0,S.hideCursor(),E.hasmousecapture&&l.releaseCapture(),!E.cantouch))return S.cancelEvent(e)}else if(1==S.rail.drag.pt)return S.onmouseup(e)};var k=S.opt.emulatetouch&&S.isiframe&&!E.hasmousecapture;S.ontouchmove=function(e,o){if(!S.rail.drag)return!1;if(e.targetTouches&&S.opt.preventmultitouchscrolling&&e.targetTouches.length>1)return!1;if(e.pointerType&&2!=e.pointerType&&"touch"!=e.pointerType)return!1;if(2==S.rail.drag.pt){if("changedTouches"in e&&(e.clientX=e.changedTouches[0].clientX,e.clientY=e.changedTouches[0].clientY),S.rail.drag.y===e.clientY&&S.rail.drag.x===e.clientX)return!1;S.hasmoving||S.onscrollstart&&S.triggerScrollStart(e.clientX,e.clientY,0,0,0),S.hasmoving=!0,S.preventclick&&!S.preventclick.click&&(S.preventclick.click=S.preventclick.tg.onclick||!1,S.preventclick.tg.onclick=S.onpreventclick);var t,r;if(r=t=0,k&&!o){var i=S.win.position();r=-i.left,t=-i.top}var s=e.clientY+t,n=s-S.rail.drag.y,a=e.clientX+r,c=a-S.rail.drag.x,d=S.rail.drag.st-n;S.ishwscroll&&S.opt.bouncescroll?d<0?d=Math.round(d/2):d>S.page.maxh&&(d=S.page.maxh+Math.round((d-S.page.maxh)/2)):(d<0&&(d=0,s=0),d>S.page.maxh&&(d=S.page.maxh,s=0));var u;S.railh&&S.railh.scrollable&&(u=S.isrtlmode?c-S.rail.drag.sl:S.rail.drag.sl-c,S.ishwscroll&&S.opt.bouncescroll?u<0?u=Math.round(u/2):u>S.page.maxw&&(u=S.page.maxw+Math.round((u-S.page.maxw)/2)):(u<0&&(u=0,a=0),u>S.page.maxw&&(u=S.page.maxw,a=0)));var h=!1;if(S.rail.drag.dl)h=!0,"v"==S.rail.drag.dl?u=S.rail.drag.sl:"h"==S.rail.drag.dl&&(d=S.rail.drag.st);else{var p=Math.abs(n),m=Math.abs(c),f=S.opt.directionlockdeadzone;if("v"==S.rail.drag.ck){if(p>f&&m<=.3*p)return S.rail.drag=!1,!0;m>f&&(S.rail.drag.dl="f",z.scrollTop(z.scrollTop()))}else if("h"==S.rail.drag.ck){if(m>f&&p<=.3*m)return S.rail.drag=!1,!0;p>f&&(S.rail.drag.dl="f",z.scrollLeft(z.scrollLeft()))}}if(S.synched("touchmove",function(){S.rail.drag&&2==S.rail.drag.pt&&(S.prepareTransition&&S.prepareTransition(0),S.rail.scrollable&&S.setScrollTop(d),S.scrollmom.update(a,s),S.railh&&S.railh.scrollable?(S.setScrollLeft(u),S.showCursor(d,u)):S.showCursor(d),E.isie10&&l.selection.clear())}),E.ischrome&&S.istouchcapable&&(h=!1),h)return S.cancelEvent(e)}else if(1==S.rail.drag.pt)return S.onmousemove(e)},S.ontouchstartCursor=function(e,o){if(!S.rail.drag||3==S.rail.drag.pt){if(S.locked)return S.cancelEvent(e);S.cancelScroll(),S.rail.drag={x:e.touches[0].clientX,y:e.touches[0].clientY,sx:S.scroll.x,sy:S.scroll.y,pt:3,hr:!!o};var t=S.getTarget(e);return!S.ispage&&E.hasmousecapture&&t.setCapture(),S.isiframe&&!E.hasmousecapture&&(S.saved.csspointerevents=S.doc.css("pointer-events"),S.css(S.doc,{"pointer-events":"none"})),S.cancelEvent(e)}},S.ontouchendCursor=function(e){if(S.rail.drag){if(E.hasmousecapture&&l.releaseCapture(),S.isiframe&&!E.hasmousecapture&&S.doc.css("pointer-events",S.saved.csspointerevents),3!=S.rail.drag.pt)return;return S.rail.drag=!1,S.cancelEvent(e)}},S.ontouchmoveCursor=function(e){if(S.rail.drag){if(3!=S.rail.drag.pt)return;if(S.cursorfreezed=!0,S.rail.drag.hr){S.scroll.x=S.rail.drag.sx+(e.touches[0].clientX-S.rail.drag.x),S.scroll.x<0&&(S.scroll.x=0);var o=S.scrollvaluemaxw;S.scroll.x>o&&(S.scroll.x=o)}else{S.scroll.y=S.rail.drag.sy+(e.touches[0].clientY-S.rail.drag.y),S.scroll.y<0&&(S.scroll.y=0);var t=S.scrollvaluemax;S.scroll.y>t&&(S.scroll.y=t)}return S.synched("touchmove",function(){S.rail.drag&&3==S.rail.drag.pt&&(S.showCursor(),S.rail.drag.hr?S.doScrollLeft(Math.round(S.scroll.x*S.scrollratio.x),S.opt.cursordragspeed):S.doScrollTop(Math.round(S.scroll.y*S.scrollratio.y),S.opt.cursordragspeed))}),S.cancelEvent(e)}}}if(S.onmousedown=function(e,o){if(!S.rail.drag||1==S.rail.drag.pt){if(S.railslocked)return S.cancelEvent(e);S.cancelScroll(),S.rail.drag={x:e.clientX,y:e.clientY,sx:S.scroll.x,sy:S.scroll.y,pt:1,hr:o||!1};var t=S.getTarget(e);return!S.ispage&&E.hasmousecapture&&t.setCapture(),S.isiframe&&!E.hasmousecapture&&(S.saved.csspointerevents=S.doc.css("pointer-events"),S.css(S.doc,{"pointer-events":"none"})),S.hasmoving=!1,S.cancelEvent(e)}},S.onmouseup=function(e){if(S.rail.drag)return 1!=S.rail.drag.pt||(E.hasmousecapture&&l.releaseCapture(),S.isiframe&&!E.hasmousecapture&&S.doc.css("pointer-events",S.saved.csspointerevents),S.rail.drag=!1,S.hasmoving&&S.triggerScrollEnd(),S.cancelEvent(e))},S.onmousemove=function(e){if(S.rail.drag){if(1!==S.rail.drag.pt)return;if(E.ischrome&&0===e.which)return S.onmouseup(e);if(S.cursorfreezed=!0,S.hasmoving=!0,S.rail.drag.hr){S.scroll.x=S.rail.drag.sx+(e.clientX-S.rail.drag.x),S.scroll.x<0&&(S.scroll.x=0);var o=S.scrollvaluemaxw;S.scroll.x>o&&(S.scroll.x=o)}else{S.scroll.y=S.rail.drag.sy+(e.clientY-S.rail.drag.y),S.scroll.y<0&&(S.scroll.y=0);var t=S.scrollvaluemax;S.scroll.y>t&&(S.scroll.y=t)}return S.synched("mousemove",function(){S.rail.drag&&1==S.rail.drag.pt&&(S.showCursor(),S.rail.drag.hr?S.hasreversehr?S.doScrollLeft(S.scrollvaluemaxw-Math.round(S.scroll.x*S.scrollratio.x),S.opt.cursordragspeed):S.doScrollLeft(Math.round(S.scroll.x*S.scrollratio.x),S.opt.cursordragspeed):S.doScrollTop(Math.round(S.scroll.y*S.scrollratio.y),S.opt.cursordragspeed))}),S.cancelEvent(e)}S.checkarea=0},E.cantouch||S.opt.emulatetouch)S.onpreventclick=function(e){if(S.preventclick)return S.preventclick.tg.onclick=S.preventclick.click,S.preventclick=!1,S.cancelEvent(e)},S.onclick=!E.isios&&function(e){return!S.lastmouseup||(S.lastmouseup=!1,S.cancelEvent(e))},S.opt.grabcursorenabled&&E.cursorgrabvalue&&(S.css(S.ispage?S.doc:S.win,{cursor:E.cursorgrabvalue}),S.css(S.rail,{cursor:E.cursorgrabvalue}));else{var T=function(e){if(S.selectiondrag){if(e){var o=S.win.outerHeight(),t=e.pageY-S.selectiondrag.top;t>0&&t=o&&(t-=o),S.selectiondrag.df=t}if(0!=S.selectiondrag.df){var r=2*-Math.floor(S.selectiondrag.df/6);S.doScrollBy(r),S.debounced("doselectionscroll",function(){T()},50)}}};S.hasTextSelected="getSelection"in l?function(){return l.getSelection().rangeCount>0}:"selection"in l?function(){return"None"!=l.selection.type}:function(){return!1},S.onselectionstart=function(e){S.ispage||(S.selectiondrag=S.win.offset())},S.onselectionend=function(e){S.selectiondrag=!1},S.onselectiondrag=function(e){S.selectiondrag&&S.hasTextSelected()&&S.debounced("selectionscroll",function(){T(e)},250)}}if(E.hasw3ctouch?(S.css(S.ispage?n("html"):S.win,{"touch-action":"none"}),S.css(S.rail,{"touch-action":"none"}),S.css(S.cursor,{"touch-action":"none"}),S.bind(S.win,"pointerdown",S.ontouchstart),S.bind(l,"pointerup",S.ontouchend),S.bind(l,"pointermove",S.ontouchmove)):E.hasmstouch?(S.css(S.ispage?n("html"):S.win,{"-ms-touch-action":"none"}),S.css(S.rail,{"-ms-touch-action":"none"}),S.css(S.cursor,{"-ms-touch-action":"none"}),S.bind(S.win,"MSPointerDown",S.ontouchstart),S.bind(l,"MSPointerUp",S.ontouchend),S.bind(l,"MSPointerMove",S.ontouchmove),S.bind(S.cursor,"MSGestureHold",function(e){e.preventDefault()}),S.bind(S.cursor,"contextmenu",function(e){e.preventDefault()})):E.cantouch&&(S.bind(S.win,"touchstart",S.ontouchstart,!1,!0),S.bind(l,"touchend",S.ontouchend,!1,!0),S.bind(l,"touchcancel",S.ontouchend,!1,!0),S.bind(l,"touchmove",S.ontouchmove,!1,!0)),S.opt.emulatetouch&&(S.bind(S.win,"mousedown",S.ontouchstart,!1,!0),S.bind(l,"mouseup",S.ontouchend,!1,!0),S.bind(l,"mousemove",S.ontouchmove,!1,!0)),(S.opt.cursordragontouch||!E.cantouch&&!S.opt.emulatetouch)&&(S.rail.css({cursor:"default"}),S.railh&&S.railh.css({cursor:"default"}),S.jqbind(S.rail,"mouseenter",function(){if(!S.ispage&&!S.win.is(":visible"))return!1;S.canshowonmouseevent&&S.showCursor(),S.rail.active=!0}),S.jqbind(S.rail,"mouseleave",function(){S.rail.active=!1,S.rail.drag||S.hideCursor()}),S.opt.sensitiverail&&(S.bind(S.rail,"click",function(e){S.doRailClick(e,!1,!1)}),S.bind(S.rail,"dblclick",function(e){S.doRailClick(e,!0,!1)}),S.bind(S.cursor,"click",function(e){S.cancelEvent(e)}),S.bind(S.cursor,"dblclick",function(e){S.cancelEvent(e)})),S.railh&&(S.jqbind(S.railh,"mouseenter",function(){if(!S.ispage&&!S.win.is(":visible"))return!1;S.canshowonmouseevent&&S.showCursor(),S.rail.active=!0}),S.jqbind(S.railh,"mouseleave",function(){S.rail.active=!1,S.rail.drag||S.hideCursor()}),S.opt.sensitiverail&&(S.bind(S.railh,"click",function(e){S.doRailClick(e,!1,!0)}),S.bind(S.railh,"dblclick",function(e){S.doRailClick(e,!0,!0)}),S.bind(S.cursorh,"click",function(e){S.cancelEvent(e)}),S.bind(S.cursorh,"dblclick",function(e){S.cancelEvent(e)})))),S.opt.cursordragontouch&&(this.istouchcapable||E.cantouch)&&(S.bind(S.cursor,"touchstart",S.ontouchstartCursor),S.bind(S.cursor,"touchmove",S.ontouchmoveCursor),S.bind(S.cursor,"touchend",S.ontouchendCursor),S.cursorh&&S.bind(S.cursorh,"touchstart",function(e){S.ontouchstartCursor(e,!0)}),S.cursorh&&S.bind(S.cursorh,"touchmove",S.ontouchmoveCursor),S.cursorh&&S.bind(S.cursorh,"touchend",S.ontouchendCursor)),E.cantouch||S.opt.emulatetouch?(S.bind(E.hasmousecapture?S.win:l,"mouseup",S.ontouchend),S.onclick&&S.bind(l,"click",S.onclick),S.opt.cursordragontouch?(S.bind(S.cursor,"mousedown",S.onmousedown),S.bind(S.cursor,"mouseup",S.onmouseup),S.cursorh&&S.bind(S.cursorh,"mousedown",function(e){S.onmousedown(e,!0)}),S.cursorh&&S.bind(S.cursorh,"mouseup",S.onmouseup)):(S.bind(S.rail,"mousedown",function(e){e.preventDefault()}),S.railh&&S.bind(S.railh,"mousedown",function(e){e.preventDefault()}))):(S.bind(E.hasmousecapture?S.win:l,"mouseup",S.onmouseup),S.bind(l,"mousemove",S.onmousemove),S.onclick&&S.bind(l,"click",S.onclick),S.bind(S.cursor,"mousedown",S.onmousedown),S.bind(S.cursor,"mouseup",S.onmouseup),S.railh&&(S.bind(S.cursorh,"mousedown",function(e){S.onmousedown(e,!0)}),S.bind(S.cursorh,"mouseup",S.onmouseup)),!S.ispage&&S.opt.enablescrollonselection&&(S.bind(S.win[0],"mousedown",S.onselectionstart),S.bind(l,"mouseup",S.onselectionend),S.bind(S.cursor,"mouseup",S.onselectionend),S.cursorh&&S.bind(S.cursorh,"mouseup",S.onselectionend),S.bind(l,"mousemove",S.onselectiondrag)),S.zoom&&(S.jqbind(S.zoom,"mouseenter",function(){S.canshowonmouseevent&&S.showCursor(),S.rail.active=!0}),S.jqbind(S.zoom,"mouseleave",function(){S.rail.active=!1,S.rail.drag||S.hideCursor()}))),S.opt.enablemousewheel&&(S.isiframe||S.mousewheel(E.isie&&S.ispage?l:S.win,S.onmousewheel),S.mousewheel(S.rail,S.onmousewheel),S.railh&&S.mousewheel(S.railh,S.onmousewheelhr)),S.ispage||E.cantouch||/HTML|^BODY/.test(S.win[0].nodeName)||(S.win.attr("tabindex")||S.win.attr({tabindex:++r}),S.bind(S.win,"focus",function(e){o=S.getTarget(e).id||!0,S.hasfocus=!0,S.canshowonmouseevent&&S.noticeCursor()}),S.bind(S.win,"blur",function(e){o=!1,S.hasfocus=!1}),S.bind(S.win,"mouseenter",function(e){t=S.getTarget(e).id||!0,S.hasmousefocus=!0,S.canshowonmouseevent&&S.noticeCursor()}),S.bind(S.win,"mouseleave",function(e){t=!1,S.hasmousefocus=!1,S.rail.drag||S.hideCursor()})),S.onkeypress=function(e){if(S.railslocked&&0==S.page.maxh)return!0;e=e||window.e;var r=S.getTarget(e);if(r&&/INPUT|TEXTAREA|SELECT|OPTION/.test(r.nodeName)&&(!(r.getAttribute("type")||r.type||!1)||!/submit|button|cancel/i.tp))return!0;if(n(r).attr("contenteditable"))return!0;if(S.hasfocus||S.hasmousefocus&&!o||S.ispage&&!o&&!t){var i=e.keyCode;if(S.railslocked&&27!=i)return S.cancelEvent(e);var s=e.ctrlKey||!1,l=e.shiftKey||!1,a=!1;switch(i){case 38:case 63233:S.doScrollBy(72),a=!0;break;case 40:case 63235:S.doScrollBy(-72),a=!0;break;case 37:case 63232:S.railh&&(s?S.doScrollLeft(0):S.doScrollLeftBy(72),a=!0);break;case 39:case 63234:S.railh&&(s?S.doScrollLeft(S.page.maxw):S.doScrollLeftBy(-72),a=!0);break;case 33:case 63276:S.doScrollBy(S.view.h),a=!0;break;case 34:case 63277:S.doScrollBy(-S.view.h),a=!0;break;case 36:case 63273:S.railh&&s?S.doScrollPos(0,0):S.doScrollTo(0),a=!0;break;case 35:case 63275:S.railh&&s?S.doScrollPos(S.page.maxw,S.page.maxh):S.doScrollTo(S.page.maxh),a=!0;break;case 32:S.opt.spacebarenabled&&(l?S.doScrollBy(S.view.h):S.doScrollBy(-S.view.h),a=!0);break;case 27:S.zoomactive&&(S.doZoom(),a=!0)}if(a)return S.cancelEvent(e)}},S.opt.enablekeyboard&&S.bind(l,E.isopera&&!E.isopera12?"keypress":"keydown",S.onkeypress),S.bind(l,"keydown",function(e){(e.ctrlKey||!1)&&(S.wheelprevented=!0)}),S.bind(l,"keyup",function(e){e.ctrlKey||!1||(S.wheelprevented=!1)}),S.bind(window,"blur",function(e){S.wheelprevented=!1}),S.bind(window,"resize",S.lazyResize),S.bind(window,"orientationchange",S.lazyResize),S.bind(window,"load",S.lazyResize),E.ischrome&&!S.ispage&&!S.haswrapper){var M=S.win.attr("style"),L=parseFloat(S.win.css("width"))+1;S.win.css("width",L),S.synched("chromefix",function(){S.win.attr("style",M)})}S.onAttributeChange=function(e){S.lazyResize(S.isieold?250:30)},S.opt.enableobserver&&(S.isie11||!1===h||(S.observerbody=new h(function(e){if(e.forEach(function(e){if("attributes"==e.type)return z.hasClass("modal-open")&&z.hasClass("modal-dialog")&&!n.contains(n(".modal-dialog")[0],S.doc[0])?S.hide():S.show()}),S.me.clientWidth!=S.page.width||S.me.clientHeight!=S.page.height)return S.lazyResize(30)}),S.observerbody.observe(l.body,{childList:!0,subtree:!0,characterData:!1,attributes:!0,attributeFilter:["class"]})),S.ispage||S.haswrapper||(!1!==h?(S.observer=new h(function(e){e.forEach(S.onAttributeChange)}),S.observer.observe(S.win[0],{childList:!0,characterData:!1,attributes:!0,subtree:!1}),S.observerremover=new h(function(e){e.forEach(function(e){if(e.removedNodes.length>0)for(var o in e.removedNodes)if(S&&e.removedNodes[o]==S.win[0])return S.remove()})}),S.observerremover.observe(S.win[0].parentNode,{childList:!0,characterData:!1,attributes:!1,subtree:!1})):(S.bind(S.win,E.isie&&!E.isie9?"propertychange":"DOMAttrModified",S.onAttributeChange),E.isie9&&S.win[0].attachEvent("onpropertychange",S.onAttributeChange),S.bind(S.win,"DOMNodeRemoved",function(e){e.target==S.win[0]&&S.remove()})))),!S.ispage&&S.opt.boxzoom&&S.bind(window,"resize",S.resizeZoom),S.istextarea&&(S.bind(S.win,"keydown",S.lazyResize),S.bind(S.win,"mouseup",S.lazyResize)),S.lazyResize(30)}if("IFRAME"==this.doc[0].nodeName){var C=function(){S.iframexd=!1;var o;try{(o="contentDocument"in this?this.contentDocument:this.contentWindow._doc).domain}catch(e){S.iframexd=!0,o=!1}if(S.iframexd)return"console"in window&&console.log("NiceScroll error: policy restriced iframe"),!0;if(S.forcescreen=!0,S.isiframe&&(S.iframe={doc:n(o),html:S.doc.contents().find("html")[0],body:S.doc.contents().find("body")[0]},S.getContentSize=function(){return{w:Math.max(S.iframe.html.scrollWidth,S.iframe.body.scrollWidth),h:Math.max(S.iframe.html.scrollHeight,S.iframe.body.scrollHeight)}},S.docscroll=n(S.iframe.body)),!E.isios&&S.opt.iframeautoresize&&!S.isiframe){S.win.scrollTop(0),S.doc.height("");var t=Math.max(o.getElementsByTagName("html")[0].scrollHeight,o.body.scrollHeight);S.doc.height(t)}S.lazyResize(30),S.css(n(S.iframe.body),e),E.isios&&S.haswrapper&&S.css(n(o.body),{"-webkit-transform":"translate3d(0,0,0)"}),"contentWindow"in this?S.bind(this.contentWindow,"scroll",S.onscroll):S.bind(o,"scroll",S.onscroll),S.opt.enablemousewheel&&S.mousewheel(o,S.onmousewheel),S.opt.enablekeyboard&&S.bind(o,E.isopera?"keypress":"keydown",S.onkeypress),E.cantouch?(S.bind(o,"touchstart",S.ontouchstart),S.bind(o,"touchmove",S.ontouchmove)):S.opt.emulatetouch&&(S.bind(o,"mousedown",S.ontouchstart),S.bind(o,"mousemove",function(e){return S.ontouchmove(e,!0)}),S.opt.grabcursorenabled&&E.cursorgrabvalue&&S.css(n(o.body),{cursor:E.cursorgrabvalue})),S.bind(o,"mouseup",S.ontouchend),S.zoom&&(S.opt.dblclickzoom&&S.bind(o,"dblclick",S.doZoom),S.ongesturezoom&&S.bind(o,"gestureend",S.ongesturezoom))};this.doc[0].readyState&&"complete"==this.doc[0].readyState&&setTimeout(function(){C.call(S.doc[0],!1)},500),S.bind(this.doc,"load",C)}},this.showCursor=function(e,o){if(S.cursortimeout&&(clearTimeout(S.cursortimeout),S.cursortimeout=0),S.rail){if(S.autohidedom&&(S.autohidedom.stop().css({opacity:S.opt.cursoropacitymax}),S.cursoractive=!0),S.rail.drag&&1==S.rail.drag.pt||(void 0!==e&&!1!==e&&(S.scroll.y=Math.round(1*e/S.scrollratio.y)),void 0!==o&&(S.scroll.x=Math.round(1*o/S.scrollratio.x))),S.cursor.css({height:S.cursorheight,top:S.scroll.y}),S.cursorh){var t=S.hasreversehr?S.scrollvaluemaxw-S.scroll.x:S.scroll.x;!S.rail.align&&S.rail.visibility?S.cursorh.css({width:S.cursorwidth,left:t+S.rail.width}):S.cursorh.css({width:S.cursorwidth,left:t}),S.cursoractive=!0}S.zoom&&S.zoom.stop().css({opacity:S.opt.cursoropacitymax})}},this.hideCursor=function(e){S.cursortimeout||S.rail&&S.autohidedom&&(S.hasmousefocus&&"leave"==S.opt.autohidemode||(S.cursortimeout=setTimeout(function(){S.rail.active&&S.showonmouseevent||(S.autohidedom.stop().animate({opacity:S.opt.cursoropacitymin}),S.zoom&&S.zoom.stop().animate({opacity:S.opt.cursoropacitymin}),S.cursoractive=!1),S.cursortimeout=0},e||S.opt.hidecursordelay)))},this.noticeCursor=function(e,o,t){S.showCursor(o,t),S.rail.active||S.hideCursor(e)},this.getContentSize=S.ispage?function(){return{w:Math.max(l.body.scrollWidth,l.documentElement.scrollWidth),h:Math.max(l.body.scrollHeight,l.documentElement.scrollHeight)}}:S.haswrapper?function(){return{w:S.doc[0].offsetWidth,h:S.doc[0].offsetHeight}}:function(){return{w:S.docscroll[0].scrollWidth,h:S.docscroll[0].scrollHeight}},this.onResize=function(e,o){if(!S||!S.win)return!1;if(!S.haswrapper&&!S.ispage){if("none"==S.win.css("display"))return S.visibility&&S.hideRail().hideRailHr(),!1;S.hidden||S.visibility||S.showRail().showRailHr()}var t=S.page.maxh,r=S.page.maxw,i={h:S.view.h,w:S.view.w};if(S.view={w:S.ispage?S.win.width():S.win[0].clientWidth,h:S.ispage?S.win.height():S.win[0].clientHeight},S.page=o||S.getContentSize(),S.page.maxh=Math.max(0,S.page.h-S.view.h),S.page.maxw=Math.max(0,S.page.w-S.view.w),S.page.maxh==t&&S.page.maxw==r&&S.view.w==i.w&&S.view.h==i.h){if(S.ispage)return S;var s=S.win.offset();if(S.lastposition){var n=S.lastposition;if(n.top==s.top&&n.left==s.left)return S}S.lastposition=s}return 0===S.page.maxh?(S.hideRail(),S.scrollvaluemax=0,S.scroll.y=0,S.scrollratio.y=0,S.cursorheight=0,S.setScrollTop(0),S.rail&&(S.rail.scrollable=!1)):(S.page.maxh-=S.opt.railpadding.top+S.opt.railpadding.bottom,S.rail.scrollable=!0),0===S.page.maxw?(S.hideRailHr(),S.scrollvaluemaxw=0,S.scroll.x=0,S.scrollratio.x=0,S.cursorwidth=0,S.setScrollLeft(0),S.railh&&(S.railh.scrollable=!1)):(S.page.maxw-=S.opt.railpadding.left+S.opt.railpadding.right,S.railh&&(S.railh.scrollable=S.opt.horizrailenabled)),S.railslocked=S.locked||0===S.page.maxh&&0===S.page.maxw,S.railslocked?(S.ispage||S.updateScrollBar(S.view),!1):(S.hidden||S.visibility?!S.railh||S.hidden||S.railh.visibility||S.showRailHr():S.showRail().showRailHr(),S.istextarea&&S.win.css("resize")&&"none"!=S.win.css("resize")&&(S.view.h-=20),S.cursorheight=Math.min(S.view.h,Math.round(S.view.h*(S.view.h/S.page.h))),S.cursorheight=S.opt.cursorfixedheight?S.opt.cursorfixedheight:Math.max(S.opt.cursorminheight,S.cursorheight),S.cursorwidth=Math.min(S.view.w,Math.round(S.view.w*(S.view.w/S.page.w))),S.cursorwidth=S.opt.cursorfixedheight?S.opt.cursorfixedheight:Math.max(S.opt.cursorminheight,S.cursorwidth),S.scrollvaluemax=S.view.h-S.cursorheight-(S.opt.railpadding.top+S.opt.railpadding.bottom),S.railh&&(S.railh.width=S.page.maxh>0?S.view.w-S.rail.width:S.view.w,S.scrollvaluemaxw=S.railh.width-S.cursorwidth-(S.opt.railpadding.left+S.opt.railpadding.right)),S.ispage||S.updateScrollBar(S.view),S.scrollratio={x:S.page.maxw/S.scrollvaluemaxw,y:S.page.maxh/S.scrollvaluemax},S.getScrollTop()>S.page.maxh?S.doScrollTop(S.page.maxh):(S.scroll.y=Math.round(S.getScrollTop()*(1/S.scrollratio.y)),S.scroll.x=Math.round(S.getScrollLeft()*(1/S.scrollratio.x)),S.cursoractive&&S.noticeCursor()),S.scroll.y&&0==S.getScrollTop()&&S.doScrollTo(Math.floor(S.scroll.y*S.scrollratio.y)),S)},this.resize=S.onResize,this.hlazyresize=0,this.lazyResize=function(e){return S.haswrapper||S.hide(),S.hlazyresize&&clearTimeout(S.hlazyresize),S.hlazyresize=setTimeout(function(){S&&(S.resize(),S.show())},240),S},this.jqbind=function(e,o,t){S.events.push({e:e,n:o,f:t,q:!0}),n(e).bind(o,t)},this.mousewheel=function(e,o,t){var r="jquery"in e?e[0]:e;if("onwheel"in l.createElement("div"))S._bind(r,"wheel",o,t||!1);else{var i=void 0!==l.onmousewheel?"mousewheel":"DOMMouseScroll";y(r,i,o,t||!1),"DOMMouseScroll"==i&&y(r,"MozMousePixelScroll",o,t||!1)}};var R=!1;if(E.haseventlistener){try{var H=Object.defineProperty({},"passive",{get:function(){R=!0}});window.addEventListener("test",null,H)}catch(e){}this.cancelEvent=function(e){return!!e&&((e=e.original?e.original:e).cancelable&&e.preventDefault(),e.stopPropagation(),e.preventManipulation&&e.preventManipulation(),!1)},this.stopPropagation=function(e){return!!e&&((e=e.original?e.original:e).stopPropagation(),!1)}}else Event.prototype.preventDefault=function(){this.returnValue=!1},Event.prototype.stopPropagation=function(){this.cancelBubble=!0},window.constructor.prototype.addEventListener=l.constructor.prototype.addEventListener=Element.prototype.addEventListener=function(e,o,t){this.attachEvent("on"+e,o)},window.constructor.prototype.removeEventListener=l.constructor.prototype.removeEventListener=Element.prototype.removeEventListener=function(e,o,t){this.detachEvent("on"+e,o)},this.cancelEvent=function(e){return!!(e=window.event||!1)&&(e.cancelBubble=!0,e.cancel=!0,e.returnValue=!1,!1)},this.stopPropagation=function(e){return!!(e=window.event||!1)&&(e.cancelBubble=!0,!1)};this.bind=function(e,o,t,r,i){var s="jquery"in e?e[0]:e;S._bind(s,o,t,r||!1,i||!1)},this._bind=function(e,o,t,r,i){S.events.push({e:e,n:o,f:t,b:r,q:!1}),R&&i?e.addEventListener(o,t,{passive:!1,capture:r}):e.addEventListener(o,t,r||!1)},this._unbind=function(e,o,t,r){e.removeEventListener(o,t,r)},this.unbindAll=function(){for(var e=0;e0)return t;o=!!o.parentNode&&o.parentNode}return!1},this.triggerScrollStart=function(e,o,t,r,i){var s={type:"scrollstart",current:{x:e,y:o},request:{x:t,y:r},end:{x:S.newscrollx,y:S.newscrolly},speed:i};S.onscrollstart.call(S,s)},this.triggerScrollEnd=function(){if(S.onscrollend){var e=S.getScrollLeft(),o=S.getScrollTop(),t={type:"scrollend",current:{x:e,y:o},end:{x:e,y:o}};S.onscrollend.call(S,t)}},this.onmousewheel=function(e){if(!S.wheelprevented){if(S.railslocked)return S.debounced("checkunlock",S.resize,250),!0;if(S.rail.drag)return S.cancelEvent(e);if("auto"===S.opt.oneaxismousemode&&0!==e.deltaX&&(S.opt.oneaxismousemode=!1),S.opt.oneaxismousemode&&0===e.deltaX&&!S.rail.scrollable)return!S.railh||!S.railh.scrollable||S.onmousewheelhr(e);var o=p(),t=!1;if(S.opt.preservenativescrolling&&S.checkarea+60020?t:0},S.opt.smoothscroll?S.ishwscroll&&E.hastransition&&S.opt.usetransition&&S.opt.smoothscroll?(this.prepareTransition=function(e,o){var t=o?e>20?e:0:S.getTransitionSpeed(e),r=t?E.prefixstyle+"transform "+t+"ms ease-out":"";return S.lasttransitionstyle&&S.lasttransitionstyle==r||(S.lasttransitionstyle=r,S.doc.css(E.transitionstyle,r)),t},this.doScrollLeft=function(e,o){var t=S.scrollrunning?S.newscrolly:S.getScrollTop();S.doScrollPos(e,t,o)},this.doScrollTop=function(e,o){var t=S.scrollrunning?S.newscrollx:S.getScrollLeft();S.doScrollPos(t,e,o)},this.doScrollPos=function(e,o,t){var r=S.getScrollTop(),i=S.getScrollLeft();return((S.newscrolly-r)*(o-r)<0||(S.newscrollx-i)*(e-i)<0)&&S.cancelScroll(),0==S.opt.bouncescroll&&(o<0?o=0:o>S.page.maxh&&(o=S.page.maxh),e<0?e=0:e>S.page.maxw&&(e=S.page.maxw)),(!S.scrollrunning||e!=S.newscrollx||o!=S.newscrolly)&&(S.newscrolly=o,S.newscrollx=e,S.newscrollspeed=t||!1,!S.timer&&void(S.timer=setTimeout(function(){var t=S.getScrollTop(),r=S.getScrollLeft(),i={};i.x=e-r,i.y=o-t,i.px=r,i.py=t;var s=Math.round(Math.sqrt(Math.pow(i.x,2)+Math.pow(i.y,2))),n=S.newscrollspeed&&S.newscrollspeed>1?S.newscrollspeed:S.getTransitionSpeed(s);if(S.newscrollspeed&&S.newscrollspeed<=1&&(n*=S.newscrollspeed),S.prepareTransition(n,!0),S.timerscroll&&S.timerscroll.tm&&clearInterval(S.timerscroll.tm),n>0){!S.scrollrunning&&S.onscrollstart&&S.triggerScrollStart(r,t,e,o,n),E.transitionend?S.scrollendtrapped||(S.scrollendtrapped=!0,S.bind(S.doc,E.transitionend,S.onScrollTransitionEnd,!1)):(S.scrollendtrapped&&clearTimeout(S.scrollendtrapped),S.scrollendtrapped=setTimeout(S.onScrollTransitionEnd,n));var l=t,a=r;S.timerscroll={bz:new C(l,S.newscrolly,n,0,0,.58,1),bh:new C(a,S.newscrollx,n,0,0,.58,1)},S.cursorfreezed||(S.timerscroll.tm=setInterval(function(){S.showCursor(S.getScrollTop(),S.getScrollLeft())},60))}S.synched("doScroll-set",function(){S.timer=0,S.scrollendtrapped&&(S.scrollrunning=!0),S.setScrollTop(S.newscrolly),S.setScrollLeft(S.newscrollx),S.scrollendtrapped||S.onScrollTransitionEnd()})},50)))},this.cancelScroll=function(){if(!S.scrollendtrapped)return!0;var e=S.getScrollTop(),o=S.getScrollLeft();return S.scrollrunning=!1,E.transitionend||clearTimeout(E.transitionend),S.scrollendtrapped=!1,S._unbind(S.doc[0],E.transitionend,S.onScrollTransitionEnd),S.prepareTransition(0),S.setScrollTop(e),S.railh&&S.setScrollLeft(o),S.timerscroll&&S.timerscroll.tm&&clearInterval(S.timerscroll.tm),S.timerscroll=!1,S.cursorfreezed=!1,S.showCursor(e,o),S},this.onScrollTransitionEnd=function(){S.scrollendtrapped&&S._unbind(S.doc[0],E.transitionend,S.onScrollTransitionEnd),S.scrollendtrapped=!1,S.prepareTransition(0),S.timerscroll&&S.timerscroll.tm&&clearInterval(S.timerscroll.tm),S.timerscroll=!1;var e=S.getScrollTop(),o=S.getScrollLeft();if(S.setScrollTop(e),S.railh&&S.setScrollLeft(o),S.noticeCursor(!1,e,o),S.cursorfreezed=!1,e<0?e=0:e>S.page.maxh&&(e=S.page.maxh),o<0?o=0:o>S.page.maxw&&(o=S.page.maxw),e!=S.newscrolly||o!=S.newscrollx)return S.doScrollPos(o,e,S.opt.snapbackspeed);S.onscrollend&&S.scrollrunning&&S.triggerScrollEnd(),S.scrollrunning=!1}):(this.doScrollLeft=function(e,o){var t=S.scrollrunning?S.newscrolly:S.getScrollTop();S.doScrollPos(e,t,o)},this.doScrollTop=function(e,o){var t=S.scrollrunning?S.newscrollx:S.getScrollLeft();S.doScrollPos(t,e,o)},this.doScrollPos=function(e,o,t){function r(){if(S.cancelAnimationFrame)return!0;if(S.scrollrunning=!0,h=1-h)return S.timer=c(r)||1;var e,o,t=0,i=o=S.getScrollTop();S.dst.ay?(((n=(i=S.bzscroll?S.dst.py+S.bzscroll.getNow()*S.dst.ay:S.newscrolly)-o)<0&&i0&&i>S.newscrolly)&&(i=S.newscrolly),S.setScrollTop(i),i==S.newscrolly&&(t=1)):t=1;var s=e=S.getScrollLeft();if(S.dst.ax){var n=(s=S.bzscroll?S.dst.px+S.bzscroll.getNow()*S.dst.ax:S.newscrollx)-e;(n<0&&s0&&s>S.newscrollx)&&(s=S.newscrollx),S.setScrollLeft(s),s==S.newscrollx&&(t+=1)}else t+=1;2==t?(S.timer=0,S.cursorfreezed=!1,S.bzscroll=!1,S.scrollrunning=!1,i<0?i=0:i>S.page.maxh&&(i=Math.max(0,S.page.maxh)),s<0?s=0:s>S.page.maxw&&(s=S.page.maxw),s!=S.newscrollx||i!=S.newscrolly?S.doScrollPos(s,i):S.onscrollend&&S.triggerScrollEnd()):S.timer=c(r)||1}var o=void 0===o||!1===o?S.getScrollTop(!0):o;if(S.timer&&S.newscrolly==o&&S.newscrollx==e)return!0;S.timer&&d(S.timer),S.timer=0;var i=S.getScrollTop(),s=S.getScrollLeft();((S.newscrolly-i)*(o-i)<0||(S.newscrollx-s)*(e-s)<0)&&S.cancelScroll(),S.newscrolly=o,S.newscrollx=e,S.bouncescroll&&S.rail.visibility||(S.newscrolly<0?S.newscrolly=0:S.newscrolly>S.page.maxh&&(S.newscrolly=S.page.maxh)),S.bouncescroll&&S.railh.visibility||(S.newscrollx<0?S.newscrollx=0:S.newscrollx>S.page.maxw&&(S.newscrollx=S.page.maxw)),S.dst={},S.dst.x=e-s,S.dst.y=o-i,S.dst.px=s,S.dst.py=i;var n=Math.round(Math.sqrt(Math.pow(S.dst.x,2)+Math.pow(S.dst.y,2)));S.dst.ax=S.dst.x/n,S.dst.ay=S.dst.y/n;var l=0,a=n;0==S.dst.x?(l=i,a=o,S.dst.ay=1,S.dst.py=0):0==S.dst.y&&(l=s,a=e,S.dst.ax=1,S.dst.px=0);var u=S.getTransitionSpeed(n);if(t&&t<=1&&(u*=t),S.bzscroll=u>0&&(S.bzscroll?S.bzscroll.update(a,u):new C(l,a,u,0,1,0,1)),!S.timer){(i==S.page.maxh&&o>=S.page.maxh||s==S.page.maxw&&e>=S.page.maxw)&&S.checkContentSize();var h=1;S.cancelAnimationFrame=!1,S.timer=1,S.onscrollstart&&!S.scrollrunning&&S.triggerScrollStart(s,i,e,o,u),r(),(i==S.page.maxh&&o>=i||s==S.page.maxw&&e>=s)&&S.checkContentSize(),S.noticeCursor()}},this.cancelScroll=function(){return S.timer&&d(S.timer),S.timer=0,S.bzscroll=!1,S.scrollrunning=!1,S}):(this.doScrollLeft=function(e,o){var t=S.getScrollTop();S.doScrollPos(e,t,o)},this.doScrollTop=function(e,o){var t=S.getScrollLeft();S.doScrollPos(t,e,o)},this.doScrollPos=function(e,o,t){var r=e>S.page.maxw?S.page.maxw:e;r<0&&(r=0);var i=o>S.page.maxh?S.page.maxh:o;i<0&&(i=0),S.synched("scroll",function(){S.setScrollTop(i),S.setScrollLeft(r)})},this.cancelScroll=function(){}),this.doScrollBy=function(e,o){var t=0;if(t=o?Math.floor((S.scroll.y-e)*S.scrollratio.y):(S.timer?S.newscrolly:S.getScrollTop(!0))-e,S.bouncescroll){var r=Math.round(S.view.h/2);t<-r?t=-r:t>S.page.maxh+r&&(t=S.page.maxh+r)}S.cursorfreezed=!1;var i=S.getScrollTop(!0);return t<0&&i<=0?S.noticeCursor():t>S.page.maxh&&i>=S.page.maxh?(S.checkContentSize(),S.noticeCursor()):void S.doScrollTop(t)},this.doScrollLeftBy=function(e,o){var t=0;if(t=o?Math.floor((S.scroll.x-e)*S.scrollratio.x):(S.timer?S.newscrollx:S.getScrollLeft(!0))-e,S.bouncescroll){var r=Math.round(S.view.w/2);t<-r?t=-r:t>S.page.maxw+r&&(t=S.page.maxw+r)}S.cursorfreezed=!1;var i=S.getScrollLeft(!0);return t<0&&i<=0?S.noticeCursor():t>S.page.maxw&&i>=S.page.maxw?S.noticeCursor():void S.doScrollLeft(t)},this.doScrollTo=function(e,o){var t=o?Math.round(e*S.scrollratio.y):e;t<0?t=0:t>S.page.maxh&&(t=S.page.maxh),S.cursorfreezed=!1,S.doScrollTop(e)},this.checkContentSize=function(){var e=S.getContentSize();e.h==S.page.h&&e.w==S.page.w||S.resize(!1,e)},S.onscroll=function(e){S.rail.drag||S.cursorfreezed||S.synched("scroll",function(){S.scroll.y=Math.round(S.getScrollTop()*(1/S.scrollratio.y)),S.railh&&(S.scroll.x=Math.round(S.getScrollLeft()*(1/S.scrollratio.x))),S.noticeCursor()})},S.bind(S.docscroll,"scroll",S.onscroll),this.doZoomIn=function(e){if(!S.zoomactive){S.zoomactive=!0,S.zoomrestore={style:{}};var o=["position","top","left","zIndex","backgroundColor","marginTop","marginBottom","marginLeft","marginRight"],t=S.win[0].style;for(var r in o){var i=o[r];S.zoomrestore.style[i]=void 0!==t[i]?t[i]:""}S.zoomrestore.style.width=S.win.css("width"),S.zoomrestore.style.height=S.win.css("height"),S.zoomrestore.padding={w:S.win.outerWidth()-S.win.width(),h:S.win.outerHeight()-S.win.height()},E.isios4&&(S.zoomrestore.scrollTop=a.scrollTop(),a.scrollTop(0)),S.win.css({position:E.isios4?"absolute":"fixed",top:0,left:0,zIndex:s+100,margin:0});var n=S.win.css("backgroundColor");return(""==n||/transparent|rgba\(0, 0, 0, 0\)|rgba\(0,0,0,0\)/.test(n))&&S.win.css("backgroundColor","#fff"),S.rail.css({zIndex:s+101}),S.zoom.css({zIndex:s+102}),S.zoom.css("backgroundPosition","0 -18px"),S.resizeZoom(),S.onzoomin&&S.onzoomin.call(S),S.cancelEvent(e)}},this.doZoomOut=function(e){if(S.zoomactive)return S.zoomactive=!1,S.win.css("margin",""),S.win.css(S.zoomrestore.style),E.isios4&&a.scrollTop(S.zoomrestore.scrollTop),S.rail.css({"z-index":S.zindex}),S.zoom.css({"z-index":S.zindex}),S.zoomrestore=!1,S.zoom.css("backgroundPosition","0 0"),S.onResize(),S.onzoomout&&S.onzoomout.call(S),S.cancelEvent(e)},this.doZoom=function(e){return S.zoomactive?S.doZoomOut(e):S.doZoomIn(e)},this.resizeZoom=function(){if(S.zoomactive){var e=S.getScrollTop();S.win.css({width:a.width()-S.zoomrestore.padding.w+"px",height:a.height()-S.zoomrestore.padding.h+"px"}),S.onResize(),S.setScrollTop(Math.min(S.page.maxh,e))}},this.init(),n.nicescroll.push(this)},v=function(e){var o=this;this.nc=e,this.lastx=0,this.lasty=0,this.speedx=0,this.speedy=0,this.lasttime=0,this.steptime=0,this.snapx=!1,this.snapy=!1,this.demulx=0,this.demuly=0,this.lastscrollx=-1,this.lastscrolly=-1,this.chkx=0,this.chky=0,this.timer=0,this.reset=function(e,t){o.stop(),o.steptime=0,o.lasttime=p(),o.speedx=0,o.speedy=0,o.lastx=e,o.lasty=t,o.lastscrollx=-1,o.lastscrolly=-1},this.update=function(e,t){var r=p();o.steptime=r-o.lasttime,o.lasttime=r;var i=t-o.lasty,s=e-o.lastx,n=o.nc.getScrollTop()+i,l=o.nc.getScrollLeft()+s;o.snapx=l<0||l>o.nc.page.maxw,o.snapy=n<0||n>o.nc.page.maxh,o.speedx=s,o.speedy=i,o.lastx=e,o.lasty=t},this.stop=function(){o.nc.unsynched("domomentum2d"),o.timer&&clearTimeout(o.timer),o.timer=0,o.lastscrollx=-1,o.lastscrolly=-1},this.doSnapy=function(e,t){var r=!1;t<0?(t=0,r=!0):t>o.nc.page.maxh&&(t=o.nc.page.maxh,r=!0),e<0?(e=0,r=!0):e>o.nc.page.maxw&&(e=o.nc.page.maxw,r=!0),r?o.nc.doScrollPos(e,t,o.nc.opt.snapbackspeed):o.nc.triggerScrollEnd()},this.doMomentum=function(e){var t=p(),r=e?t+e:o.lasttime,i=o.nc.getScrollLeft(),s=o.nc.getScrollTop(),n=o.nc.page.maxh,l=o.nc.page.maxw;o.speedx=l>0?Math.min(60,o.speedx):0,o.speedy=n>0?Math.min(60,o.speedy):0;var a=r&&t-r<=60;(s<0||s>n||i<0||i>l)&&(a=!1);var c=!(!o.speedy||!a)&&o.speedy,d=!(!o.speedx||!a)&&o.speedx;if(c||d){var u=Math.max(16,o.steptime);if(u>50){var h=u/50;o.speedx*=h,o.speedy*=h,u=50}o.demulxy=0,o.lastscrollx=o.nc.getScrollLeft(),o.chkx=o.lastscrollx,o.lastscrolly=o.nc.getScrollTop(),o.chky=o.lastscrolly;var m=o.lastscrollx,f=o.lastscrolly,g=function(){var e=p()-t>600?.04:.02;o.speedx&&(m=Math.floor(o.lastscrollx-o.speedx*(1-o.demulxy)),o.lastscrollx=m,(m<0||m>l)&&(e=.1)),o.speedy&&(f=Math.floor(o.lastscrolly-o.speedy*(1-o.demulxy)),o.lastscrolly=f,(f<0||f>n)&&(e=.1)),o.demulxy=Math.min(1,o.demulxy+e),o.nc.synched("domomentum2d",function(){if(o.speedx){o.nc.getScrollLeft();o.chkx=m,o.nc.setScrollLeft(m)}if(o.speedy){o.nc.getScrollTop();o.chky=f,o.nc.setScrollTop(f)}o.timer||(o.nc.hideCursor(),o.doSnapy(m,f))}),o.demulxy<1?o.timer=setTimeout(g,u):(o.stop(),o.nc.hideCursor(),o.doSnapy(m,f))};g()}else o.doSnapy(o.nc.getScrollLeft(),o.nc.getScrollTop())}},b=e.fn.scrollTop;e.cssHooks.pageYOffset={get:function(e,o,t){var r=n.data(e,"__nicescroll")||!1;return r&&r.ishwscroll?r.getScrollTop():b.call(e)},set:function(e,o){var t=n.data(e,"__nicescroll")||!1;return t&&t.ishwscroll?t.setScrollTop(parseInt(o)):b.call(e,o),this}},e.fn.scrollTop=function(e){if(void 0===e){var o=!!this[0]&&(n.data(this[0],"__nicescroll")||!1);return o&&o.ishwscroll?o.getScrollTop():b.call(this)}return this.each(function(){var o=n.data(this,"__nicescroll")||!1;o&&o.ishwscroll?o.setScrollTop(parseInt(e)):b.call(n(this),e)})};var y=e.fn.scrollLeft;n.cssHooks.pageXOffset={get:function(e,o,t){var r=n.data(e,"__nicescroll")||!1;return r&&r.ishwscroll?r.getScrollLeft():y.call(e)},set:function(e,o){var t=n.data(e,"__nicescroll")||!1;return t&&t.ishwscroll?t.setScrollLeft(parseInt(o)):y.call(e,o),this}},e.fn.scrollLeft=function(e){if(void 0===e){var o=!!this[0]&&(n.data(this[0],"__nicescroll")||!1);return o&&o.ishwscroll?o.getScrollLeft():y.call(this)}return this.each(function(){var o=n.data(this,"__nicescroll")||!1;o&&o.ishwscroll?o.setScrollLeft(parseInt(e)):y.call(n(this),e)})};var x=function(e){var o=this;if(this.length=0,this.name="nicescrollarray",this.each=function(e){return n.each(o,e),o},this.push=function(e){o[o.length]=e,o.length++},this.eq=function(e){return o[e]},e)for(var t=0;t1?n(e,r):s,i.win=r}!("doc"in i)||"win"in i||(i.win=r);var l=r.data("__nicescroll")||!1;l||(i.doc=i.doc||r,l=new w(i,r),r.data("__nicescroll",l)),t.push(l)}),1===t.length?t[0]:t},window.NiceScroll={getjQuery:function(){return e}},n.nicescroll||(n.nicescroll=new x,n.nicescroll.options=m)}); \ No newline at end of file diff --git a/demo/js/zoomico.png b/demo/js/zoomico.png deleted file mode 100644 index 667ea3340ce6144f3a97e8813af29f6e07784142..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 254 zcmV{4YqWT1XJ7s!9UNhFuUm>u?3jf3kx)Q|6gFRZ&CLxFi`U z>wVnxeRw4cjiX?a@}tVs2UX^>NTmhy#7eYbOF}q(09E!Z=$*I{Bme*a07*qoM6N<$ Eg2 - - - - - - - - - - -

RTL horizontal

-
-

- هناك حقيقة مثبتة منذ زمن طويل وهي أن المحتوى المقروء لصفحة ما سيلهي القارئ عن التركيز على الشكل الخارجي للنص أو شكل توضع الفقرات في الصفحة التي يقرأها. ولذلك يتم استخدام طريقة لوريم إيبسوم لأنها تعطي توزيعاَ طبيعياَ -إلى حد ما- للأحرف عوضاً عن استخدام "هنا يوجد محتوى نصي، هنا يوجد محتوى نصي" فتجعلها تبدو (أي الأحرف) وكأنها نص مقروء. العديد من برامح النشر المكتبي وبرامح تحرير صفحات الويب تستخدم لوريم إيبسوم بشكل إفتراضي كنموذج عن النص، وإذا قمت بإدخال "lorem ipsum" في أي محرك بحث ستظهر العديد من المواقع الحديثة العهد في نتائج البحث. على مدى السنين ظهرت نسخ جديدة ومختلفة من نص لوريم إيبسوم، أحياناً عن طريق الصدفة، وأحياناً عن عمد كإدخال بعض العبارات الفكاهية إليها. -

-
-

RTL vertical

-
-

- 「天は人の上に人を造らず人の下に人を造らず」と言えり。 - されば天より人を生ずるには、万人は万人みな同じ位にして、生まれながら貴賤上下の差別なく、 - 万物の霊たる身と心との働きをもって天地の間にあるよろずの物を資り、もって衣食住の用を達し、 - 自由自在、互いに人の妨げをなさずしておのおの安楽にこの世を渡らしめ給うの趣意なり。 - されども今、広くこの人間世界を見渡すに、かしこき人あり、おろかなる人あり、貧しきもあり、 - 富めるもあり、貴人もあり、下人もありて、その有様雲と泥との相違あるに似たるはなんぞや。 - その次第はなはだ明らかなり。『実語教』に、「人学ばざれば智なし、智なき者は愚人なり」とあり。 - されば賢人と愚人との別は学ぶと学ばざるとによりてできるものなり。 - また世の中にむずかしき仕事もあり、やすき仕事もあり。 - そのむずかしき仕事をする者を身分重き人と名づけ、やすき仕事をする者を身分軽き人という。 - すべて心を用い、心配する仕事はむずかしくして、手足を用うる力役はやすし。 - ゆえに医者、学者、政府の役人、または大なる商売をする町人、 - あまたの奉公人を召し使う大百姓などは、身分重くして貴き者と言うべし。 -

-
-

LTR horizontal

-
-

- هناك حقيقة مثبتة منذ زمن طويل وهي أن المحتوى المقروء لصفحة ما سيلهي القارئ عن التركيز على الشكل الخارجي للنص أو شكل توضع الفقرات في الصفحة التي يقرأها. ولذلك يتم استخدام طريقة لوريم إيبسوم لأنها تعطي توزيعاَ طبيعياَ -إلى حد ما- للأحرف عوضاً عن استخدام "هنا يوجد محتوى نصي، هنا يوجد محتوى نصي" فتجعلها تبدو (أي الأحرف) وكأنها نص مقروء. العديد من برامح النشر المكتبي وبرامح تحرير صفحات الويب تستخدم لوريم إيبسوم بشكل إفتراضي كنموذج عن النص، وإذا قمت بإدخال "lorem ipsum" في أي محرك بحث ستظهر العديد من المواقع الحديثة العهد في نتائج البحث. على مدى السنين ظهرت نسخ جديدة ومختلفة من نص لوريم إيبسوم، أحياناً عن طريق الصدفة، وأحياناً عن عمد كإدخال بعض العبارات الفكاهية إليها. -

-
-

LTR vertical

-
-

- 「天は人の上に人を造らず人の下に人を造らず」と言えり。 - されば天より人を生ずるには、万人は万人みな同じ位にして、生まれながら貴賤上下の差別なく、 - 万物の霊たる身と心との働きをもって天地の間にあるよろずの物を資り、もって衣食住の用を達し、 - 自由自在、互いに人の妨げをなさずしておのおの安楽にこの世を渡らしめ給うの趣意なり。 - されども今、広くこの人間世界を見渡すに、かしこき人あり、おろかなる人あり、貧しきもあり、 - 富めるもあり、貴人もあり、下人もありて、その有様雲と泥との相違あるに似たるはなんぞや。 - その次第はなはだ明らかなり。『実語教』に、「人学ばざれば智なし、智なき者は愚人なり」とあり。 - されば賢人と愚人との別は学ぶと学ばざるとによりてできるものなり。 - また世の中にむずかしき仕事もあり、やすき仕事もあり。 - そのむずかしき仕事をする者を身分重き人と名づけ、やすき仕事をする者を身分軽き人という。 - すべて心を用い、心配する仕事はむずかしくして、手足を用うる力役はやすし。 - ゆえに医者、学者、政府の役人、または大なる商売をする町人、 - あまたの奉公人を召し使う大百姓などは、身分重くして貴き者と言うべし。 -

-
- - diff --git a/demo/rtlmode/index.html b/demo/rtlmode/index.html deleted file mode 100644 index 1e914c4..0000000 --- a/demo/rtlmode/index.html +++ /dev/null @@ -1,302 +0,0 @@ - - - - -jQuery NiceScroll Test Page - - - - - - - - - - - -
- -
- -
-
-

RTL Browser default

- THIS IS A SIMPLE SCROLLABLE DIV -

Package Description

-

Release Date: August 10, 2010

-

The HPIJS driver is the free, open-source driver issued by HP for their DeskJet and LaserJet printers. For most supported printers, this driver produces output quality equivalent to the proprietary HP drivers. In photo mode, with photo paper, the output quality is very high, especially for the HP DeskJet 990C and later models, which auto-detect the paper type in hardware. Photo printing is fully supported in the newer 6- and 7-ink models.

-

A major advantage of using this driver over those supplied by HP is the direct interface between HPIJS and the native CUPS spooler, which allows printing from any printer over any available connection such as USB, AppleTalk, TCP/IP (via LPD and IPP), HP JetDirect, and shared windows printers via SAMBA. Additionally, this driver utilizes the existing Mac OS X USB "backend" and thus does not install any software that might interfere with standard USB operation.

-

Please note:

-
    -
  • HP does not provide any support for HPLIP or HPIJS on the Mac OS X platform.
  • -
  • Several HP USB devices may not print successfully over the standard Mac OS X USB "backend". Please see this note for more information.
  • -
-

Release Notes

-
    -
  • This release fixes a problem with the PPDs that caused many job options such as page orientation, color/grayscale mode, duplex printing, etc. to fail.
  • -
  • HPIJS is HP's universal printer driver for most of their non-PostScript printers. It comes as a part of HPLIP, HP Linux Imaging and Printing.
  • -
  • The PPDs for HP printers are now sourced from the HPLIP package rather than the OpenPrinting.org database.
  • -
  • PPDs for printers from other manufacturers are provided by OpenPrinting.org.
  • -
  • Some printers are only partially supported. Printers such as
    - HP LaserJet 1022
    - HP LaserJet p1505n
    - HP LaserJet p12014
    - HP LaserJet p2035
    - require a proprietary plug-in for full support. This package does not contain or support such plug-ins.
  • -
-

-

Printer Set Up Instructions

-

To add a printer queue, Leopard (Mac OS X 10.5.x) users should use the Print & Fax from System Preferences. Click on the + (plus) icon at the lower left. A new window will open. In that window, click the Default Browser icon at the top left. Highlight your printer in the section below. Use the "Print Using" pop-up menu near the bottom of the window to select the correct PPD for your printer and click Add.

-

Tiger users should open the Printer Setup Utility and click on the Add icon at the top of the Printer List window. A new window will open. In that window, click the Default Browser icon at the top left. Highlight your printer in the section below. Use the "Print Using" pop-up menu near the bottom of the window to select the correct PPD for your printer and click Add.

-

Jaguar (OS X 10.2.x) and Panther (OS X 10.3.x) users should open Print Center (Jaguar) or Printer Setup Utility (Panther), hold down the Option key, and click the Add Printer button in the Print Center toolbar. Within the setup sheet, choose Advanced from the top popup menu; then in the "Device:" popup menu select your printer by name (it should be the last item in the menu list). Finally, select the correct PPD from the model browser and click Add.

-
- -
-
-

LTR Browser default

- THIS IS A SIMPLE SCROLLABLE DIV -

Package Description

-

Release Date: August 10, 2010

-

The HPIJS driver is the free, open-source driver issued by HP for their DeskJet and LaserJet printers. For most supported printers, this driver produces output quality equivalent to the proprietary HP drivers. In photo mode, with photo paper, the output quality is very high, especially for the HP DeskJet 990C and later models, which auto-detect the paper type in hardware. Photo printing is fully supported in the newer 6- and 7-ink models.

-

A major advantage of using this driver over those supplied by HP is the direct interface between HPIJS and the native CUPS spooler, which allows printing from any printer over any available connection such as USB, AppleTalk, TCP/IP (via LPD and IPP), HP JetDirect, and shared windows printers via SAMBA. Additionally, this driver utilizes the existing Mac OS X USB "backend" and thus does not install any software that might interfere with standard USB operation.

-

Please note:

-
    -
  • HP does not provide any support for HPLIP or HPIJS on the Mac OS X platform.
  • -
  • Several HP USB devices may not print successfully over the standard Mac OS X USB "backend". Please see this note for more information.
  • -
-

Release Notes

-
    -
  • This release fixes a problem with the PPDs that caused many job options such as page orientation, color/grayscale mode, duplex printing, etc. to fail.
  • -
  • HPIJS is HP's universal printer driver for most of their non-PostScript printers. It comes as a part of HPLIP, HP Linux Imaging and Printing.
  • -
  • The PPDs for HP printers are now sourced from the HPLIP package rather than the OpenPrinting.org database.
  • -
  • PPDs for printers from other manufacturers are provided by OpenPrinting.org.
  • -
  • Some printers are only partially supported. Printers such as
    - HP LaserJet 1022
    - HP LaserJet p1505n
    - HP LaserJet p12014
    - HP LaserJet p2035
    - require a proprietary plug-in for full support. This package does not contain or support such plug-ins.
  • -
-

-

Printer Set Up Instructions

-

To add a printer queue, Leopard (Mac OS X 10.5.x) users should use the Print & Fax from System Preferences. Click on the + (plus) icon at the lower left. A new window will open. In that window, click the Default Browser icon at the top left. Highlight your printer in the section below. Use the "Print Using" pop-up menu near the bottom of the window to select the correct PPD for your printer and click Add.

-

Tiger users should open the Printer Setup Utility and click on the Add icon at the top of the Printer List window. A new window will open. In that window, click the Default Browser icon at the top left. Highlight your printer in the section below. Use the "Print Using" pop-up menu near the bottom of the window to select the correct PPD for your printer and click Add.

-

Jaguar (OS X 10.2.x) and Panther (OS X 10.3.x) users should open Print Center (Jaguar) or Printer Setup Utility (Panther), hold down the Option key, and click the Add Printer button in the Print Center toolbar. Within the setup sheet, choose Advanced from the top popup menu; then in the "Device:" popup menu select your printer by name (it should be the last item in the menu list). Finally, select the correct PPD from the model browser and click Add.

-
- -
-
- -
-
-

RTL with wrap

- THIS IS A SIMPLE SCROLLABLE DIV -

Package Description

-

Release Date: August 10, 2010

-

The HPIJS driver is the free, open-source driver issued by HP for their DeskJet and LaserJet printers. For most supported printers, this driver produces output quality equivalent to the proprietary HP drivers. In photo mode, with photo paper, the output quality is very high, especially for the HP DeskJet 990C and later models, which auto-detect the paper type in hardware. Photo printing is fully supported in the newer 6- and 7-ink models.

-

A major advantage of using this driver over those supplied by HP is the direct interface between HPIJS and the native CUPS spooler, which allows printing from any printer over any available connection such as USB, AppleTalk, TCP/IP (via LPD and IPP), HP JetDirect, and shared windows printers via SAMBA. Additionally, this driver utilizes the existing Mac OS X USB "backend" and thus does not install any software that might interfere with standard USB operation.

-

Please note:

-
    -
  • HP does not provide any support for HPLIP or HPIJS on the Mac OS X platform.
  • -
  • Several HP USB devices may not print successfully over the standard Mac OS X USB "backend". Please see this note for more information.
  • -
-

Release Notes

-
    -
  • This release fixes a problem with the PPDs that caused many job options such as page orientation, color/grayscale mode, duplex printing, etc. to fail.
  • -
  • HPIJS is HP's universal printer driver for most of their non-PostScript printers. It comes as a part of HPLIP, HP Linux Imaging and Printing.
  • -
  • The PPDs for HP printers are now sourced from the HPLIP package rather than the OpenPrinting.org database.
  • -
  • PPDs for printers from other manufacturers are provided by OpenPrinting.org.
  • -
  • Some printers are only partially supported. Printers such as
    - HP LaserJet 1022
    - HP LaserJet p1505n
    - HP LaserJet p12014
    - HP LaserJet p2035
    - require a proprietary plug-in for full support. This package does not contain or support such plug-ins.
  • -
-

-

Printer Set Up Instructions

-

To add a printer queue, Leopard (Mac OS X 10.5.x) users should use the Print & Fax from System Preferences. Click on the + (plus) icon at the lower left. A new window will open. In that window, click the Default Browser icon at the top left. Highlight your printer in the section below. Use the "Print Using" pop-up menu near the bottom of the window to select the correct PPD for your printer and click Add.

-

Tiger users should open the Printer Setup Utility and click on the Add icon at the top of the Printer List window. A new window will open. In that window, click the Default Browser icon at the top left. Highlight your printer in the section below. Use the "Print Using" pop-up menu near the bottom of the window to select the correct PPD for your printer and click Add.

-

Jaguar (OS X 10.2.x) and Panther (OS X 10.3.x) users should open Print Center (Jaguar) or Printer Setup Utility (Panther), hold down the Option key, and click the Add Printer button in the Print Center toolbar. Within the setup sheet, choose Advanced from the top popup menu; then in the "Device:" popup menu select your printer by name (it should be the last item in the menu list). Finally, select the correct PPD from the model browser and click Add.

-
-
- -
-
-

LTR with wrap

- THIS IS A SIMPLE SCROLLABLE DIV -

Package Description

-

Release Date: August 10, 2010

-

The HPIJS driver is the free, open-source driver issued by HP for their DeskJet and LaserJet printers. For most supported printers, this driver produces output quality equivalent to the proprietary HP drivers. In photo mode, with photo paper, the output quality is very high, especially for the HP DeskJet 990C and later models, which auto-detect the paper type in hardware. Photo printing is fully supported in the newer 6- and 7-ink models.

-

A major advantage of using this driver over those supplied by HP is the direct interface between HPIJS and the native CUPS spooler, which allows printing from any printer over any available connection such as USB, AppleTalk, TCP/IP (via LPD and IPP), HP JetDirect, and shared windows printers via SAMBA. Additionally, this driver utilizes the existing Mac OS X USB "backend" and thus does not install any software that might interfere with standard USB operation.

-

Please note:

-
    -
  • HP does not provide any support for HPLIP or HPIJS on the Mac OS X platform.
  • -
  • Several HP USB devices may not print successfully over the standard Mac OS X USB "backend". Please see this note for more information.
  • -
-

Release Notes

-
    -
  • This release fixes a problem with the PPDs that caused many job options such as page orientation, color/grayscale mode, duplex printing, etc. to fail.
  • -
  • HPIJS is HP's universal printer driver for most of their non-PostScript printers. It comes as a part of HPLIP, HP Linux Imaging and Printing.
  • -
  • The PPDs for HP printers are now sourced from the HPLIP package rather than the OpenPrinting.org database.
  • -
  • PPDs for printers from other manufacturers are provided by OpenPrinting.org.
  • -
  • Some printers are only partially supported. Printers such as
    - HP LaserJet 1022
    - HP LaserJet p1505n
    - HP LaserJet p12014
    - HP LaserJet p2035
    - require a proprietary plug-in for full support. This package does not contain or support such plug-ins.
  • -
-

-

Printer Set Up Instructions

-

To add a printer queue, Leopard (Mac OS X 10.5.x) users should use the Print & Fax from System Preferences. Click on the + (plus) icon at the lower left. A new window will open. In that window, click the Default Browser icon at the top left. Highlight your printer in the section below. Use the "Print Using" pop-up menu near the bottom of the window to select the correct PPD for your printer and click Add.

-

Tiger users should open the Printer Setup Utility and click on the Add icon at the top of the Printer List window. A new window will open. In that window, click the Default Browser icon at the top left. Highlight your printer in the section below. Use the "Print Using" pop-up menu near the bottom of the window to select the correct PPD for your printer and click Add.

-

Jaguar (OS X 10.2.x) and Panther (OS X 10.3.x) users should open Print Center (Jaguar) or Printer Setup Utility (Panther), hold down the Option key, and click the Add Printer button in the Print Center toolbar. Within the setup sheet, choose Advanced from the top popup menu; then in the "Device:" popup menu select your printer by name (it should be the last item in the menu list). Finally, select the correct PPD from the model browser and click Add.

-
-
- -
-
- -
-
-

RTL without wrap

- THIS IS A SIMPLE SCROLLABLE DIV -

Package Description

-

Release Date: August 10, 2010

-

The HPIJS driver is the free, open-source driver issued by HP for their DeskJet and LaserJet printers. For most supported printers, this driver produces output quality equivalent to the proprietary HP drivers. In photo mode, with photo paper, the output quality is very high, especially for the HP DeskJet 990C and later models, which auto-detect the paper type in hardware. Photo printing is fully supported in the newer 6- and 7-ink models.

-

A major advantage of using this driver over those supplied by HP is the direct interface between HPIJS and the native CUPS spooler, which allows printing from any printer over any available connection such as USB, AppleTalk, TCP/IP (via LPD and IPP), HP JetDirect, and shared windows printers via SAMBA. Additionally, this driver utilizes the existing Mac OS X USB "backend" and thus does not install any software that might interfere with standard USB operation.

-

Please note:

-
    -
  • HP does not provide any support for HPLIP or HPIJS on the Mac OS X platform.
  • -
  • Several HP USB devices may not print successfully over the standard Mac OS X USB "backend". Please see this note for more information.
  • -
-

Release Notes

-
    -
  • This release fixes a problem with the PPDs that caused many job options such as page orientation, color/grayscale mode, duplex printing, etc. to fail.
  • -
  • HPIJS is HP's universal printer driver for most of their non-PostScript printers. It comes as a part of HPLIP, HP Linux Imaging and Printing.
  • -
  • The PPDs for HP printers are now sourced from the HPLIP package rather than the OpenPrinting.org database.
  • -
  • PPDs for printers from other manufacturers are provided by OpenPrinting.org.
  • -
  • Some printers are only partially supported. Printers such as
    - HP LaserJet 1022
    - HP LaserJet p1505n
    - HP LaserJet p12014
    - HP LaserJet p2035
    - require a proprietary plug-in for full support. This package does not contain or support such plug-ins.
  • -
-

-

Printer Set Up Instructions

-

To add a printer queue, Leopard (Mac OS X 10.5.x) users should use the Print & Fax from System Preferences. Click on the + (plus) icon at the lower left. A new window will open. In that window, click the Default Browser icon at the top left. Highlight your printer in the section below. Use the "Print Using" pop-up menu near the bottom of the window to select the correct PPD for your printer and click Add.

-

Tiger users should open the Printer Setup Utility and click on the Add icon at the top of the Printer List window. A new window will open. In that window, click the Default Browser icon at the top left. Highlight your printer in the section below. Use the "Print Using" pop-up menu near the bottom of the window to select the correct PPD for your printer and click Add.

-

Jaguar (OS X 10.2.x) and Panther (OS X 10.3.x) users should open Print Center (Jaguar) or Printer Setup Utility (Panther), hold down the Option key, and click the Add Printer button in the Print Center toolbar. Within the setup sheet, choose Advanced from the top popup menu; then in the "Device:" popup menu select your printer by name (it should be the last item in the menu list). Finally, select the correct PPD from the model browser and click Add.

-
- -
-
-

LTR without wrap

- THIS IS A SIMPLE SCROLLABLE DIV -

Package Description

-

Release Date: August 10, 2010

-

The HPIJS driver is the free, open-source driver issued by HP for their DeskJet and LaserJet printers. For most supported printers, this driver produces output quality equivalent to the proprietary HP drivers. In photo mode, with photo paper, the output quality is very high, especially for the HP DeskJet 990C and later models, which auto-detect the paper type in hardware. Photo printing is fully supported in the newer 6- and 7-ink models.

-

A major advantage of using this driver over those supplied by HP is the direct interface between HPIJS and the native CUPS spooler, which allows printing from any printer over any available connection such as USB, AppleTalk, TCP/IP (via LPD and IPP), HP JetDirect, and shared windows printers via SAMBA. Additionally, this driver utilizes the existing Mac OS X USB "backend" and thus does not install any software that might interfere with standard USB operation.

-

Please note:

-
    -
  • HP does not provide any support for HPLIP or HPIJS on the Mac OS X platform.
  • -
  • Several HP USB devices may not print successfully over the standard Mac OS X USB "backend". Please see this note for more information.
  • -
-

Release Notes

-
    -
  • This release fixes a problem with the PPDs that caused many job options such as page orientation, color/grayscale mode, duplex printing, etc. to fail.
  • -
  • HPIJS is HP's universal printer driver for most of their non-PostScript printers. It comes as a part of HPLIP, HP Linux Imaging and Printing.
  • -
  • The PPDs for HP printers are now sourced from the HPLIP package rather than the OpenPrinting.org database.
  • -
  • PPDs for printers from other manufacturers are provided by OpenPrinting.org.
  • -
  • Some printers are only partially supported. Printers such as
    - HP LaserJet 1022
    - HP LaserJet p1505n
    - HP LaserJet p12014
    - HP LaserJet p2035
    - require a proprietary plug-in for full support. This package does not contain or support such plug-ins.
  • -
-

-

Printer Set Up Instructions

-

To add a printer queue, Leopard (Mac OS X 10.5.x) users should use the Print & Fax from System Preferences. Click on the + (plus) icon at the lower left. A new window will open. In that window, click the Default Browser icon at the top left. Highlight your printer in the section below. Use the "Print Using" pop-up menu near the bottom of the window to select the correct PPD for your printer and click Add.

-

Tiger users should open the Printer Setup Utility and click on the Add icon at the top of the Printer List window. A new window will open. In that window, click the Default Browser icon at the top left. Highlight your printer in the section below. Use the "Print Using" pop-up menu near the bottom of the window to select the correct PPD for your printer and click Add.

-

Jaguar (OS X 10.2.x) and Panther (OS X 10.3.x) users should open Print Center (Jaguar) or Printer Setup Utility (Panther), hold down the Option key, and click the Add Printer button in the Print Center toolbar. Within the setup sheet, choose Advanced from the top popup menu; then in the "Device:" popup menu select your printer by name (it should be the last item in the menu list). Finally, select the correct PPD from the model browser and click Add.

-
- -
- -
- - diff --git a/dist/jquery.nicescroll.iframehelper.js b/dist/jquery.nicescroll.iframehelper.js deleted file mode 100644 index 2fe40c3..0000000 --- a/dist/jquery.nicescroll.iframehelper.js +++ /dev/null @@ -1,107 +0,0 @@ -/* iframe script helper for jquery.nicescroll --- version 0.9.0 --- copyright 2017-06-18 InuYaksa*2017 --- licensed under the MIT --- --- https://nicescroll.areaaperta.com/ --- https://github.com/inuyaksa/jquery.nicescroll --- -*/ - -(function (document,window) { - - var body = document.body; - var parent = window.parent; - - if (parent && ("createEvent" in document)) { - - var isoldie = ("documentMode" in document); // 11- - var ismsedge = ("msCredentials" in window); // MS Edge 14+ - - function onwheel(e) { - - var evt = document.createEvent("MouseEvents"); - evt.initEvent('wheel', true, true); - evt.deltaMode = e.deltaMode; - evt.deltaX = e.deltaX; - evt.deltaY = e.deltaY; - evt.deltaZ = e.deltaZ; - evt.wheelDelta = e.wheelDelta; - evt.wheelDeltaX = e.wheelDeltaX; - evt.wheelDeltaY = e.wheelDeltaY; - - parent.dispatchEvent(evt); - } - - body.addEventListener("wheel", onwheel); - - } - - if (window.addEventListener) { - - // https://davidwalsh.name/add-rules-stylesheets - var sheet = (function () { - var style = document.createElement("style"); - style.appendChild(document.createTextNode("")); - document.head.appendChild(style); - return style.sheet; - })(); - - var tmrscroll = false; - var lastiframe = null; - var lastiframeviewport = null; - var lastscroll = []; - - window.addEventListener("scroll", function (e) { - if (lastiframeviewport) { - // var df = [ window.scrollX - lastscroll[0], window.scrollY - lastscroll[1] ]; - window.scrollTo(lastscroll[0], lastscroll[1]); - // lastiframeviewport.scrollBy(df[0],df[1]); - // console.log(df); - } - }); - - function findNiceParent(t) { - do { - if ($.data(t, '__nicescroll') !== undefined) return t; - t = t.parentNode || false; - } while (t); - return false; - } - - window.addEventListener("load", function () { - - var hasstyle = false; - - $.nicescroll.each(function () { - var nice = this; - nice.scrollstart(function () { - console.log("start"); - if (!hasstyle) sheet.insertRule("iframe { pointer-events: none !important; }", 0); - hasstyle = true; - }); - nice.scrollend(function () { - console.log("end"); - if (hasstyle) sheet.deleteRule(0); - hasstyle = false; - }); - }); - - $("iframe").each(function () { - this.addEventListener("mouseenter", function (e) { - lastiframe = e.target; - var chk = findNiceParent(lastiframe); - lastiframeviewport = chk; - //if (chk) lastiframeviewport = $(chk).getNiceScroll(); - lastscroll = [window.scrollX, window.scrollY]; - }); - this.addEventListener("mouseleave", function (e) { - lastiframe = lastiframeviewport = null; - }); - }); - - }); - - } - -})(document,window); \ No newline at end of file diff --git a/dist/jquery.nicescroll.iframehelper.min.js b/dist/jquery.nicescroll.iframehelper.min.js deleted file mode 100644 index a482986..0000000 --- a/dist/jquery.nicescroll.iframehelper.min.js +++ /dev/null @@ -1,2 +0,0 @@ -/* iframe helper for nicescroll v3.7.3 InuYaksa - MIT - https://nicescroll.areaaperta.com */ -!function(e,t){function n(t){var n=e.createEvent("MouseEvents");n.initEvent("wheel",!0,!0),n.deltaMode=t.deltaMode,n.deltaX=t.deltaX,n.deltaY=t.deltaY,n.deltaZ=t.deltaZ,n.wheelDelta=t.wheelDelta,n.wheelDeltaX=t.wheelDeltaX,n.wheelDeltaY=t.wheelDeltaY,o.dispatchEvent(n)}function l(e){do{if(void 0!==$.data(e,"__nicescroll"))return e;e=e.parentNode||!1}while(e);return!1}var a=e.body,o=t.parent;if(o&&"createEvent"in e){a.addEventListener("wheel",n)}if(t.addEventListener){var r=function(){var t=e.createElement("style");return t.appendChild(e.createTextNode("")),e.head.appendChild(t),t.sheet}(),d=null,i=null,c=[];t.addEventListener("scroll",function(e){i&&t.scrollTo(c[0],c[1])}),t.addEventListener("load",function(){var e=!1;$.nicescroll.each(function(){var t=this;t.scrollstart(function(){console.log("start"),e||r.insertRule("iframe { pointer-events: none !important; }",0),e=!0}),t.scrollend(function(){console.log("end"),e&&r.deleteRule(0),e=!1})}),$("iframe").each(function(){this.addEventListener("mouseenter",function(e){var n=l(d=e.target);i=n,c=[t.scrollX,t.scrollY]}),this.addEventListener("mouseleave",function(e){d=i=null})})})}}(document,window); \ No newline at end of file diff --git a/dist/jquery.nicescroll.js b/dist/jquery.nicescroll.js deleted file mode 100644 index 7b465ad..0000000 --- a/dist/jquery.nicescroll.js +++ /dev/null @@ -1,3721 +0,0 @@ -/* jquery.nicescroll --- version 3.7.3 --- copyright 2017-06-18 InuYaksa*2017 --- licensed under the MIT --- --- https://nicescroll.areaaperta.com/ --- https://github.com/inuyaksa/jquery.nicescroll --- -*/ - -(function (factory) { - if (typeof define === 'function' && define.amd) { - // AMD. Register as anonymous module. - define(['jquery'], factory); - } else if (typeof exports === 'object') { - // Node/CommonJS. - module.exports = factory(require('jquery')); - } else { - // Browser globals. - factory(jQuery); - } -}(function (jQuery) { - "use strict"; - - // globals - var domfocus = false; - var mousefocus = false; - var tabindexcounter = 0; - var ascrailcounter = 2000; - var globalmaxzindex = 0; - - var $ = jQuery; // sandbox - - var _doc = document; - var $window = $(window); - - // http://stackoverflow.com/questions/2161159/get-script-path - function getScriptPath() { - var scripts = _doc.currentScript || (function () { var s = _doc.getElementsByTagName('script'); return (s.length) ? s[s.length - 1] : false; })(); - var path = scripts ? scripts.src.split('?')[0] : ''; - return (path.split('/').length > 0) ? path.split('/').slice(0, -1).join('/') + '/' : ''; - } - - // based on code by Paul Irish https://www.paulirish.com/2011/requestanimationframe-for-smart-animating/ - var setAnimationFrame = (function () { return window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || false; })(); - var clearAnimationFrame = (function () { return window.cancelAnimationFrame || window.webkitCancelAnimationFrame || window.mozCancelAnimationFrame || false; })(); - - if (!setAnimationFrame) { - var anilasttime = 0; - setAnimationFrame = function (callback, element) { - var currTime = new Date().getTime(); - var timeToCall = Math.max(0, 16 - (currTime - anilasttime)); - var id = window.setTimeout(function () { callback(currTime + timeToCall); }, - timeToCall); - anilasttime = currTime + timeToCall; - return id; - }; - clearAnimationFrame = function (id) { - window.clearTimeout(id); - }; - } else { - if (!window.cancelAnimationFrame) clearAnimationFrame = function (id) { }; - } - - var ClsMutationObserver = window.MutationObserver || window.WebKitMutationObserver || false; - - var now = Date.now || function () { return new Date().getTime(); }; - - var _globaloptions = { - zindex: "auto", - cursoropacitymin: 0, - cursoropacitymax: 1, - cursorcolor: "#424242", - cursorwidth: "6px", - cursorborder: "1px solid #fff", - cursorborderradius: "5px", - scrollspeed: 60, - mousescrollstep: 8 * 3, - touchbehavior: false, // deprecated - emulatetouch: false, // replacing touchbehavior - hwacceleration: true, - usetransition: true, - boxzoom: false, - dblclickzoom: true, - gesturezoom: true, - grabcursorenabled: true, - autohidemode: true, - background: "", - iframeautoresize: true, - cursorminheight: 32, - preservenativescrolling: true, - railoffset: false, - railhoffset: 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, - // cursormaxheight:false, - cursorfixedheight: false, - directionlockdeadzone: 6, - hidecursordelay: 400, - nativeparentscrolling: true, - enablescrollonselection: true, - overflowx: true, - overflowy: true, - cursordragspeed: 0.3, - rtlmode: "auto", - cursordragontouch: false, - oneaxismousemode: "auto", - scriptpath: getScriptPath(), - preventmultitouchscrolling: true, - disablemutationobserver: false, - enableobserver: true, - scrollbarid: false - }; - - var browserdetected = false; - - var getBrowserDetection = function () { - - if (browserdetected) return browserdetected; - - var _el = _doc.createElement('DIV'), - _style = _el.style, - _agent = navigator.userAgent, - _platform = navigator.platform, - d = {}; - - d.haspointerlock = "pointerLockElement" in _doc || "webkitPointerLockElement" in _doc || "mozPointerLockElement" in _doc; - - d.isopera = ("opera" in window); // 12- - d.isopera12 = (d.isopera && ("getUserMedia" in navigator)); - d.isoperamini = (Object.prototype.toString.call(window.operamini) === "[object OperaMini]"); - - d.isie = (("all" in _doc) && ("attachEvent" in _el) && !d.isopera); //IE10- - d.isieold = (d.isie && !("msInterpolationMode" in _style)); // IE6 and older - d.isie7 = d.isie && !d.isieold && (!("documentMode" in _doc) || (_doc.documentMode === 7)); - d.isie8 = d.isie && ("documentMode" in _doc) && (_doc.documentMode === 8); - d.isie9 = d.isie && ("performance" in window) && (_doc.documentMode === 9); - d.isie10 = d.isie && ("performance" in window) && (_doc.documentMode === 10); - d.isie11 = ("msRequestFullscreen" in _el) && (_doc.documentMode >= 11); // IE11+ - - d.ismsedge = ("msCredentials" in window); // MS Edge 14+ - - d.ismozilla = ("MozAppearance" in _style); - - d.iswebkit = !d.ismsedge && ("WebkitAppearance" in _style); - - d.ischrome = d.iswebkit && ("chrome" in window); - d.ischrome38 = (d.ischrome && ("touchAction" in _style)); // behavior changed in touch emulation - d.ischrome22 = (!d.ischrome38) && (d.ischrome && d.haspointerlock); - d.ischrome26 = (!d.ischrome38) && (d.ischrome && ("transition" in _style)); // issue with transform detection (maintain prefix) - - d.cantouch = ("ontouchstart" in _doc.documentElement) || ("ontouchstart" in window); // with detection for Chrome Touch Emulation - d.hasw3ctouch = (window.PointerEvent || false) && ((navigator.MaxTouchPoints > 0) || (navigator.msMaxTouchPoints > 0)); //IE11 pointer events, following W3C Pointer Events spec - d.hasmstouch = (!d.hasw3ctouch) && (window.MSPointerEvent || false); // IE10 pointer events - - d.ismac = /^mac$/i.test(_platform); - - d.isios = d.cantouch && /iphone|ipad|ipod/i.test(_platform); - d.isios4 = d.isios && !("seal" in Object); - d.isios7 = d.isios && ("webkitHidden" in _doc); //iOS 7+ - d.isios8 = d.isios && ("hidden" in _doc); //iOS 8+ - d.isios10 = d.isios && window.Proxy; //iOS 10+ - - d.isandroid = (/android/i.test(_agent)); - - d.haseventlistener = ("addEventListener" in _el); - - d.trstyle = false; - d.hastransform = false; - d.hastranslate3d = false; - d.transitionstyle = false; - d.hastransition = false; - d.transitionend = false; - - d.trstyle = "transform"; - d.hastransform = ("transform" in _style) || (function () { - var check = ['msTransform', 'webkitTransform', 'MozTransform', 'OTransform']; - for (var a = 0, c = check.length; a < c; a++) { - if (_style[check[a]] !== undefined) { - d.trstyle = check[a]; - break; - } - } - d.hastransform = (!!d.trstyle); - })(); - - if (d.hastransform) { - _style[d.trstyle] = "translate3d(1px,2px,3px)"; - d.hastranslate3d = /translate3d/.test(_style[d.trstyle]); - } - - d.transitionstyle = "transition"; - d.prefixstyle = ''; - d.transitionend = "transitionend"; - - d.hastransition = ("transition" in _style) || (function () { - - d.transitionend = false; - var check = ['webkitTransition', 'msTransition', 'MozTransition', 'OTransition', 'OTransition', 'KhtmlTransition']; - var prefix = ['-webkit-', '-ms-', '-moz-', '-o-', '-o', '-khtml-']; - var evs = ['webkitTransitionEnd', 'msTransitionEnd', 'transitionend', 'otransitionend', 'oTransitionEnd', 'KhtmlTransitionEnd']; - for (var a = 0, c = check.length; a < c; a++) { - if (check[a] in _style) { - d.transitionstyle = check[a]; - d.prefixstyle = prefix[a]; - d.transitionend = evs[a]; - break; - } - } - if (d.ischrome26) { // always use prefix - d.prefixstyle = prefix[1]; - } - d.hastransition = (d.transitionstyle); - - })(); - - - - function detectCursorGrab() { - var lst = ['grab', '-webkit-grab', '-moz-grab']; - if ((d.ischrome && !d.ischrome38) || d.isie) lst = []; // force setting for IE returns false positive and chrome cursor bug - for (var a = 0, l = lst.length; a < l; a++) { - var p = lst[a]; - _style.cursor = p; - if (_style.cursor == p) return p; - } - return 'url(https://cdnjs.cloudflare.com/ajax/libs/slider-pro/1.3.0/css/images/openhand.cur),n-resize'; // thanks to https://cdnjs.com/ for the openhand cursor! - } - d.cursorgrabvalue = detectCursorGrab(); - - d.hasmousecapture = ("setCapture" in _el); - - d.hasMutationObserver = (ClsMutationObserver !== false); - - _el = null; //memory released - - browserdetected = d; - - return d; - }; - - var NiceScrollClass = function (myopt, me) { - - var self = this; - - this.version = '3.7.3'; - this.name = 'nicescroll'; - - this.me = me; - - var $body = $("body"); - - this.opt = { - doc: $body, - win: false - }; - - $.extend(this.opt, _globaloptions); // clone opts - - // Options for internal use - this.opt.snapbackspeed = 80; - - if (myopt || false) { - for (var a in self.opt) { - if (myopt[a] !== undefined) self.opt[a] = myopt[a]; - } - } - - if (self.opt.disablemutationobserver) ClsMutationObserver = false; - - this.doc = self.opt.doc; - this.iddoc = (this.doc && this.doc[0]) ? this.doc[0].id || '' : ''; - this.ispage = /^BODY|HTML/.test((self.opt.win) ? self.opt.win[0].nodeName : this.doc[0].nodeName); - this.haswrapper = (self.opt.win !== false); - this.win = self.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; //force to use screen position on events - - this.canshowonmouseevent = (self.opt.autohidemode != "scroll"); - - // Events jump table - this.onmousedown = false; - this.onmouseup = false; - this.onmousemove = false; - this.onmousewheel = false; - this.onkeypress = false; - this.ongesturezoom = false; - this.onclick = false; - - // Nicescroll custom events - this.onscrollstart = false; - this.onscrollend = false; - this.onscrollcancel = false; - - this.onzoomin = false; - this.onzoomout = false; - - // Let's start! - this.view = false; - this.page = false; - - this.scroll = { - x: 0, - y: 0 - }; - this.scrollratio = { - x: 0, - y: 0 - }; - this.cursorheight = 20; - this.scrollvaluemax = 0; - - // http://dev.w3.org/csswg/css-writing-modes-3/#logical-to-physical - // http://dev.w3.org/csswg/css-writing-modes-3/#svg-writing-mode - if (this.opt.rtlmode == "auto") { - var target = this.win[0] == window ? this.body : this.win; - var writingMode = target.css("writing-mode") || target.css("-webkit-writing-mode") || target.css("-ms-writing-mode") || target.css("-moz-writing-mode"); - - if (writingMode == "horizontal-tb" || writingMode == "lr-tb" || writingMode == "") { - this.isrtlmode = (target.css("direction") == "rtl"); - this.isvertical = false; - } else { - this.isrtlmode = (writingMode == "vertical-rl" || writingMode == "tb" || writingMode == "tb-rl" || writingMode == "rl-tb"); - this.isvertical = (writingMode == "vertical-rl" || writingMode == "tb" || writingMode == "tb-rl"); - } - } else { - this.isrtlmode = (this.opt.rtlmode === true); - this.isvertical = false; - } - // this.checkrtlmode = false; - - this.scrollrunning = false; - - this.scrollmom = false; - - this.observer = false; // observer div changes - this.observerremover = false; // observer on parent for remove detection - this.observerbody = false; // observer on body for position change - - if (self.opt.scrollbarid === false) { - do { - this.id = "ascrail" + (ascrailcounter++); - } while (_doc.getElementById(this.id)); - } else { - this.id = self.opt.scrollbarid; - } - - this.rail = false; - this.cursor = false; - this.cursorfreezed = false; - this.selectiondrag = false; - - this.zoom = false; - this.zoomactive = false; - - this.hasfocus = false; - this.hasmousefocus = false; - - this.visibility = true; - this.railslocked = false; // locked by resize - this.locked = false; // prevent lost of locked status sets by user - this.hidden = false; // rails always hidden - this.cursoractive = true; // user can interact with cursors - - this.wheelprevented = false; //prevent mousewheel event - - this.overflowx = self.opt.overflowx; - this.overflowy = self.opt.overflowy; - - this.nativescrollingarea = false; - this.checkarea = 0; - - this.events = []; // event list for unbind - - this.saved = {}; // style saved - - this.delaylist = {}; - this.synclist = {}; - - this.lastdeltax = 0; - this.lastdeltay = 0; - - this.detected = getBrowserDetection(); - - var cap = $.extend({}, this.detected); - - this.canhwscroll = (cap.hastransform && self.opt.hwacceleration); - this.ishwscroll = (this.canhwscroll && self.haswrapper); - - if (!this.isrtlmode) { - this.hasreversehr = false; - } else if (this.isvertical) { // RTL mode with reverse horizontal axis - this.hasreversehr = !(cap.iswebkit || cap.isie || cap.isie11); - } else { - this.hasreversehr = !(cap.iswebkit || (cap.isie && !cap.isie10 && !cap.isie11)); - } - - this.istouchcapable = false; // desktop devices with touch screen support - - //## Check WebKit-based desktop with touch support - //## + Firefox 18 nightly build (desktop) false positive (or desktop with touch support) - - if (!cap.cantouch && (cap.hasw3ctouch || cap.hasmstouch)) { // desktop device with multiple input - this.istouchcapable = true; - } else if (cap.cantouch && !cap.isios && !cap.isandroid && (cap.iswebkit || cap.ismozilla)) { - this.istouchcapable = true; - // cap.cantouch = false; // parse normal desktop events - } - - //## disable MouseLock API on user request - if (!self.opt.enablemouselockapi) { - cap.hasmousecapture = false; - cap.haspointerlock = false; - } - - this.debounced = function (name, fn, tm) { - if (!self) return; - var dd = self.delaylist[name] || false; - if (!dd) { - //fixed loop call fn:checkSelectionScroll - //fn.call(self); - self.delaylist[name] = { - h: setAnimationFrame(function () { - self.delaylist[name].fn.call(self); - self.delaylist[name] = false; - }, tm) - }; - fn.call(self); - } - self.delaylist[name].fn = fn; - }; - - - var _onsync = false; - - this.synched = function (name, fn) { - - function requestSync() { - if (_onsync) return; - setAnimationFrame(function () { - if (!self) return; - _onsync = false; - for (var nn in self.synclist) { - var fn = self.synclist[nn]; - if (fn) fn.call(self); - self.synclist[nn] = false; - } - }); - _onsync = true; - } - - self.synclist[name] = fn; - requestSync(); - return name; - }; - - this.unsynched = function (name) { - if (self.synclist[name]) self.synclist[name] = false; - }; - - this.css = function (el, pars) { // save & set - for (var n in pars) { - self.saved.css.push([el, n, el.css(n)]); - el.css(n, pars[n]); - } - }; - - this.scrollTop = function (val) { - return (val === undefined) ? self.getScrollTop() : self.setScrollTop(val); - }; - - this.scrollLeft = function (val) { - return (val === undefined) ? self.getScrollLeft() : self.setScrollLeft(val); - }; - - // derived by by Dan Pupius www.pupius.net - var BezierClass = function (st, ed, spd, p1, p2, p3, p4) { - - this.st = st; - this.ed = ed; - this.spd = spd; - - this.p1 = p1 || 0; - this.p2 = p2 || 1; - this.p3 = p3 || 0; - this.p4 = p4 || 1; - - this.ts = now(); - 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 nw = now(); - var pc = 1 - ((nw - this.ts) / this.spd); - var bz = this.B2(pc) + this.B3(pc) + this.B4(pc); - return (pc < 0) ? this.ed : this.st + Math.round(this.df * bz); - }, - update: function (ed, spd) { - this.st = this.getNow(); - this.ed = ed; - this.spd = spd; - this.ts = now(); - this.df = this.ed - this.st; - return this; - } - }; - - //derived from http://stackoverflow.com/questions/11236090/ - function getMatrixValues() { - var tr = self.doc.css(cap.trstyle); - if (tr && (tr.substr(0, 6) == "matrix")) { - return tr.replace(/^.*\((.*)\)$/g, "$1").replace(/px/g, '').split(/, +/); - } - return false; - } - - if (this.ishwscroll) { - // hw accelerated scroll - this.doc.translate = { - x: 0, - y: 0, - tx: "0px", - ty: "0px" - }; - - //this one can help to enable hw accel on ios6 http://indiegamr.com/ios6-html-hardware-acceleration-changes-and-how-to-fix-them/ - if (cap.hastranslate3d && cap.isios) this.doc.css("-webkit-backface-visibility", "hidden"); // prevent flickering http://stackoverflow.com/questions/3461441/ - - this.getScrollTop = function (last) { - if (!last) { - var mtx = getMatrixValues(); - if (mtx) return (mtx.length == 16) ? -mtx[13] : -mtx[5]; //matrix3d 16 on IE10 - if (self.timerscroll && self.timerscroll.bz) return self.timerscroll.bz.getNow(); - } - return self.doc.translate.y; - }; - - this.getScrollLeft = function (last) { - if (!last) { - var mtx = getMatrixValues(); - if (mtx) return (mtx.length == 16) ? -mtx[12] : -mtx[4]; //matrix3d 16 on IE10 - if (self.timerscroll && self.timerscroll.bh) return self.timerscroll.bh.getNow(); - } - return self.doc.translate.x; - }; - - this.notifyScrollEvent = function (el) { - var e = _doc.createEvent("UIEvents"); - e.initUIEvent("scroll", false, true, window, 1); - e.niceevent = true; - el.dispatchEvent(e); - }; - - var cxscrollleft = (this.isrtlmode) ? 1 : -1; - - if (cap.hastranslate3d && self.opt.enabletranslate3d) { - this.setScrollTop = function (val, silent) { - self.doc.translate.y = val; - self.doc.translate.ty = (val * -1) + "px"; - self.doc.css(cap.trstyle, "translate3d(" + self.doc.translate.tx + "," + self.doc.translate.ty + ",0)"); - if (!silent) self.notifyScrollEvent(self.win[0]); - }; - this.setScrollLeft = function (val, silent) { - self.doc.translate.x = val; - self.doc.translate.tx = (val * cxscrollleft) + "px"; - self.doc.css(cap.trstyle, "translate3d(" + self.doc.translate.tx + "," + self.doc.translate.ty + ",0)"); - if (!silent) self.notifyScrollEvent(self.win[0]); - }; - } else { - this.setScrollTop = function (val, silent) { - self.doc.translate.y = val; - self.doc.translate.ty = (val * -1) + "px"; - self.doc.css(cap.trstyle, "translate(" + self.doc.translate.tx + "," + self.doc.translate.ty + ")"); - if (!silent) self.notifyScrollEvent(self.win[0]); - }; - this.setScrollLeft = function (val, silent) { - self.doc.translate.x = val; - self.doc.translate.tx = (val * cxscrollleft) + "px"; - self.doc.css(cap.trstyle, "translate(" + self.doc.translate.tx + "," + self.doc.translate.ty + ")"); - if (!silent) self.notifyScrollEvent(self.win[0]); - }; - } - } else { - // native scroll - this.getScrollTop = function () { - return self.docscroll.scrollTop(); - }; - this.setScrollTop = function (val) { - return setTimeout(function () { (self) && self.docscroll.scrollTop(val) }, 1); - }; - this.getScrollLeft = function () { - var val; - if (!self.hasreversehr) { - val = self.docscroll.scrollLeft(); - } else if (self.detected.ismozilla) { - val = self.page.maxw - Math.abs(self.docscroll.scrollLeft()); - } else { - val = self.page.maxw - self.docscroll.scrollLeft(); - } - return val; - }; - this.setScrollLeft = function (val) { - return setTimeout(function () { - if (!self) return; - if (self.hasreversehr) { - if (self.detected.ismozilla) { - val = -(self.page.maxw - val); - } else { - val = self.page.maxw - val; - } - } - return self.docscroll.scrollLeft(val); - }, 1); - }; - } - - 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, id) { - if (!e) return false; - var el = e.target || e.srcElement || e || false; - while (el && el.id != id) { - el = el.parentNode || false; - } - return (el !== false); - }; - - function getZIndex() { - var dom = self.win; - if ("zIndex" in dom) return dom.zIndex(); // use jQuery UI method when available - while (dom.length > 0) { - if (dom[0].nodeType == 9) return false; - var zi = dom.css('zIndex'); - if (!isNaN(zi) && zi != 0) return parseInt(zi); - dom = dom.parent(); - } - return false; - } - - //inspired by http://forum.jquery.com/topic/width-includes-border-width-when-set-to-thin-medium-thick-in-ie - var _convertBorderWidth = { - "thin": 1, - "medium": 3, - "thick": 5 - }; - - function getWidthToPixel(dom, prop, chkheight) { - var wd = dom.css(prop); - var px = parseFloat(wd); - if (isNaN(px)) { - px = _convertBorderWidth[wd] || 0; - var brd = (px == 3) ? ((chkheight) ? (self.win.outerHeight() - self.win.innerHeight()) : (self.win.outerWidth() - self.win.innerWidth())) : 1; //DON'T TRUST CSS - if (self.isie8 && px) px += 1; - return (brd) ? px : 0; - } - return px; - } - - this.getDocumentScrollOffset = function () { - return { - top: window.pageYOffset || _doc.documentElement.scrollTop, - left: window.pageXOffset || _doc.documentElement.scrollLeft - }; - }; - - this.getOffset = function () { - if (self.isfixed) { - var ofs = self.win.offset(); // fix Chrome auto issue (when right/bottom props only) - var scrl = self.getDocumentScrollOffset(); - ofs.top -= scrl.top; - ofs.left -= scrl.left; - return ofs; - } - var ww = self.win.offset(); - if (!self.viewport) return ww; - var vp = self.viewport.offset(); - return { - top: ww.top - vp.top,// + self.viewport.scrollTop(), - left: ww.left - vp.left // + self.viewport.scrollLeft() - }; - }; - - this.updateScrollBar = function (len) { - var pos, off; - if (self.ishwscroll) { - self.rail.css({ //** - height: self.win.innerHeight() - (self.opt.railpadding.top + self.opt.railpadding.bottom) - }); - if (self.railh) self.railh.css({ //** - width: self.win.innerWidth() - (self.opt.railpadding.left + self.opt.railpadding.right) - }); - - } else { - var wpos = self.getOffset(); - pos = { - top: wpos.top, - left: wpos.left - (self.opt.railpadding.left + self.opt.railpadding.right) - }; - pos.top += getWidthToPixel(self.win, 'border-top-width', true); - pos.left += (self.rail.align) ? self.win.outerWidth() - getWidthToPixel(self.win, 'border-right-width') - self.rail.width : getWidthToPixel(self.win, 'border-left-width'); - - off = self.opt.railoffset; - if (off) { - if (off.top) pos.top += off.top; - if (off.left) pos.left += off.left; - } - - if (!self.railslocked) self.rail.css({ - top: pos.top, - left: pos.left, - height: ((len) ? len.h : self.win.innerHeight()) - (self.opt.railpadding.top + self.opt.railpadding.bottom) - }); - - if (self.zoom) { - self.zoom.css({ - top: pos.top + 1, - left: (self.rail.align == 1) ? pos.left - 20 : pos.left + self.rail.width + 4 - }); - } - - if (self.railh && !self.railslocked) { - pos = { - top: wpos.top, - left: wpos.left - }; - off = self.opt.railhoffset; - if (off) { - if (off.top) pos.top += off.top; - if (off.left) pos.left += off.left; - } - var y = (self.railh.align) ? pos.top + getWidthToPixel(self.win, 'border-top-width', true) + self.win.innerHeight() - self.railh.height : pos.top + getWidthToPixel(self.win, 'border-top-width', true); - var x = pos.left + getWidthToPixel(self.win, 'border-left-width'); - self.railh.css({ - top: y - (self.opt.railpadding.top + self.opt.railpadding.bottom), - left: x, - width: self.railh.width - }); - } - - } - }; - - this.doRailClick = function (e, dbl, hr) { - var fn, pg, cur, pos; - - if (self.railslocked) return; - self.cancelEvent(e); - - if (!("pageY" in e)) { - e.pageX = e.clientX + _doc.documentElement.scrollLeft; - e.pageY = e.clientY + _doc.documentElement.scrollTop; - } - - if (dbl) { - fn = (hr) ? self.doScrollLeft : self.doScrollTop; - cur = (hr) ? ((e.pageX - self.railh.offset().left - (self.cursorwidth / 2)) * self.scrollratio.x) : ((e.pageY - self.rail.offset().top - (self.cursorheight / 2)) * self.scrollratio.y); - fn(cur); - } else { - fn = (hr) ? self.doScrollLeftBy : self.doScrollBy; - cur = (hr) ? self.scroll.x : self.scroll.y; - pos = (hr) ? e.pageX - self.railh.offset().left : e.pageY - self.rail.offset().top; - pg = (hr) ? self.view.w : self.view.h; - fn((cur >= pos) ? pg : -pg);// (cur >= pos) ? fn(pg): fn(-pg); - } - - }; - - self.hasanimationframe = ("requestAnimationFrame" in window); - self.hascancelanimationframe = ("cancelAnimationFrame" in window); - - this.init = function () { - - self.saved.css = []; - - if (cap.isoperamini) return true; // SORRY, DO NOT WORK! - if (cap.isandroid && !("hidden" in _doc)) return true; // Android 3- SORRY, DO NOT WORK! - - self.opt.emulatetouch = self.opt.emulatetouch || self.opt.touchbehavior; // mantain compatibility with "touchbehavior" - - var _scrollyhidden = { 'overflow-y': 'hidden' }; - if (cap.isie11 || cap.isie10) _scrollyhidden['-ms-overflow-style'] = 'none'; // IE 10 & 11 is always a world apart! - - self.zindex = "auto"; - if (!self.ispage && self.opt.zindex == "auto") { - self.zindex = getZIndex() || "auto"; - } else { - self.zindex = self.opt.zindex; - } - - if (!self.ispage && self.zindex != "auto" && self.zindex > globalmaxzindex) { - globalmaxzindex = self.zindex; - } - - if (self.isie && self.zindex == 0 && self.opt.zindex == "auto") { // fix IE auto == 0 - self.zindex = "auto"; - } - - if (!self.ispage || (!cap.cantouch && !cap.isieold)) { - - var cont = self.docscroll; - if (self.ispage) cont = (self.haswrapper) ? self.win : self.doc; - - self.css(cont, _scrollyhidden); - - if (self.ispage && (cap.isie11 || cap.isie)) { // IE 7-11 - self.css($("html"), _scrollyhidden); - } - - if (cap.isios && !self.ispage && !self.haswrapper) self.css($body, { - "-webkit-overflow-scrolling": "touch" - }); //force hw acceleration - - var cursor = $(_doc.createElement('div')); - cursor.css({ - position: "relative", - top: 0, - "float": "right", - width: self.opt.cursorwidth, - height: 0, - 'background-color': self.opt.cursorcolor, - border: self.opt.cursorborder, - 'background-clip': 'padding-box', - '-webkit-border-radius': self.opt.cursorborderradius, - '-moz-border-radius': self.opt.cursorborderradius, - 'border-radius': self.opt.cursorborderradius - }); - - cursor.addClass('nicescroll-cursors'); - - self.cursor = cursor; - - var rail = $(_doc.createElement('div')); - rail.attr('id', self.id); - rail.addClass('nicescroll-rails nicescroll-rails-vr'); - - var v, a, kp = ["left", "right", "top", "bottom"]; //** - for (var n in kp) { - a = kp[n]; - v = self.opt.railpadding[a]; - (v) ? rail.css("padding-" + a, v + "px") : self.opt.railpadding[a] = 0; - } - - rail.append(cursor); - - rail.width = Math.max(parseFloat(self.opt.cursorwidth), cursor.outerWidth()); - rail.css({ - width: rail.width + "px", - zIndex: self.zindex, - background: self.opt.background, - cursor: "default" - }); - - rail.visibility = true; - rail.scrollable = true; - - rail.align = (self.opt.railalign == "left") ? 0 : 1; - - self.rail = rail; - - self.rail.drag = false; - - var zoom = false; - if (self.opt.boxzoom && !self.ispage && !cap.isieold) { - zoom = _doc.createElement('div'); - - self.bind(zoom, "click", self.doZoom); - self.bind(zoom, "mouseenter", function () { - self.zoom.css('opacity', self.opt.cursoropacitymax); - }); - self.bind(zoom, "mouseleave", function () { - self.zoom.css('opacity', self.opt.cursoropacitymin); - }); - - self.zoom = $(zoom); - self.zoom.css({ - cursor: "pointer", - zIndex: self.zindex, - backgroundImage: 'url(' + self.opt.scriptpath + 'zoomico.png)', - height: 18, - width: 18, - backgroundPosition: '0 0' - }); - if (self.opt.dblclickzoom) self.bind(self.win, "dblclick", self.doZoom); - if (cap.cantouch && self.opt.gesturezoom) { - self.ongesturezoom = function (e) { - if (e.scale > 1.5) self.doZoomIn(e); - if (e.scale < 0.8) self.doZoomOut(e); - return self.cancelEvent(e); - }; - self.bind(self.win, "gestureend", self.ongesturezoom); - } - } - - // init HORIZ - - self.railh = false; - var railh; - - if (self.opt.horizrailenabled) { - - self.css(cont, { - overflowX: 'hidden' - }); - - var cursor = $(_doc.createElement('div')); - cursor.css({ - position: "absolute", - top: 0, - height: self.opt.cursorwidth, - width: 0, - backgroundColor: self.opt.cursorcolor, - border: self.opt.cursorborder, - backgroundClip: 'padding-box', - '-webkit-border-radius': self.opt.cursorborderradius, - '-moz-border-radius': self.opt.cursorborderradius, - 'border-radius': self.opt.cursorborderradius - }); - - if (cap.isieold) cursor.css('overflow', 'hidden'); //IE6 horiz scrollbar issue - - // cursor.wborder = parseFloat(cursor.outerWidth() - cursor.innerWidth()); // ** - - cursor.addClass('nicescroll-cursors'); - - self.cursorh = cursor; - - railh = $(_doc.createElement('div')); - railh.attr('id', self.id + '-hr'); - railh.addClass('nicescroll-rails nicescroll-rails-hr'); - railh.height = Math.max(parseFloat(self.opt.cursorwidth), cursor.outerHeight()); - railh.css({ - height: railh.height + "px", - 'zIndex': self.zindex, - "background": self.opt.background - }); - - railh.append(cursor); - - railh.visibility = true; - railh.scrollable = true; - - railh.align = (self.opt.railvalign == "top") ? 0 : 1; - - self.railh = railh; - - self.railh.drag = false; - - } - - // - - if (self.ispage) { - rail.css({ - position: "fixed", - top: 0, - height: "100%" - }); - (rail.align) ? rail.css({ - right: 0 - }) : rail.css({ - left: 0 - }); - self.body.append(rail); - if (self.railh) { - railh.css({ - position: "fixed", - left: 0, - width: "100%" - }); - (railh.align) ? railh.css({ - bottom: 0 - }) : railh.css({ - top: 0 - }); - self.body.append(railh); - } - } else { - if (self.ishwscroll) { - if (self.win.css('position') == 'static') self.css(self.win, { - 'position': 'relative' - }); - var bd = (self.win[0].nodeName == 'HTML') ? self.body : self.win; - $(bd).scrollTop(0).scrollLeft(0); // fix rail position if content already scrolled - if (self.zoom) { - self.zoom.css({ - position: "absolute", - top: 1, - right: 0, - "margin-right": rail.width + 4 - }); - bd.append(self.zoom); - } - rail.css({ - position: "absolute", - top: 0 - }); - (rail.align) ? rail.css({ - right: 0 - }) : rail.css({ - left: 0 - }); - bd.append(rail); - if (railh) { - railh.css({ - position: "absolute", - left: 0, - bottom: 0 - }); - (railh.align) ? railh.css({ - bottom: 0 - }) : railh.css({ - top: 0 - }); - bd.append(railh); - } - } else { - self.isfixed = (self.win.css("position") == "fixed"); - var rlpos = (self.isfixed) ? "fixed" : "absolute"; - - if (!self.isfixed) self.viewport = self.getViewport(self.win[0]); - if (self.viewport) { - self.body = self.viewport; - if ((/fixed|absolute/.test(self.viewport.css("position"))) == false) self.css(self.viewport, { - "position": "relative" - }); - } - - rail.css({ - position: rlpos - }); - if (self.zoom) self.zoom.css({ - position: rlpos - }); - self.updateScrollBar(); - self.body.append(rail); - if (self.zoom) self.body.append(self.zoom); - if (self.railh) { - railh.css({ - position: rlpos - }); - self.body.append(railh); - } - } - - if (cap.isios) self.css(self.win, { - '-webkit-tap-highlight-color': 'rgba(0,0,0,0)', - '-webkit-touch-callout': 'none' - }); // prevent grey layer on click - - if (cap.isie && self.opt.disableoutline) self.win.attr("hideFocus", "true"); // IE, prevent dotted rectangle on focused div - if (cap.iswebkit && self.opt.disableoutline) self.win.css('outline', 'none'); // Webkit outline - - } - - if (self.opt.autohidemode === false) { - self.autohidedom = false; - self.rail.css({ - opacity: self.opt.cursoropacitymax - }); - if (self.railh) self.railh.css({ - opacity: self.opt.cursoropacitymax - }); - } else if ((self.opt.autohidemode === true) || (self.opt.autohidemode === "leave")) { - self.autohidedom = $().add(self.rail); - if (cap.isie8) self.autohidedom = self.autohidedom.add(self.cursor); - if (self.railh) self.autohidedom = self.autohidedom.add(self.railh); - if (self.railh && cap.isie8) self.autohidedom = self.autohidedom.add(self.cursorh); - } else if (self.opt.autohidemode == "scroll") { - self.autohidedom = $().add(self.rail); - if (self.railh) self.autohidedom = self.autohidedom.add(self.railh); - } else if (self.opt.autohidemode == "cursor") { - self.autohidedom = $().add(self.cursor); - if (self.railh) self.autohidedom = self.autohidedom.add(self.cursorh); - } else if (self.opt.autohidemode == "hidden") { - self.autohidedom = false; - self.hide(); - self.railslocked = false; - } - - if (cap.cantouch || self.istouchcapable || self.opt.emulatetouch || cap.hasmstouch) { - - self.scrollmom = new ScrollMomentumClass2D(self); - - self.ontouchstart = function (e) { - - if (e.pointerType && e.pointerType != 2 && e.pointerType != "touch") return false; - - self.hasmoving = false; - - if (!self.railslocked) { - var tg; - if (cap.hasmstouch) { - tg = (e.target) ? e.target : false; - while (tg) { - var nc = $(tg).getNiceScroll(); - if ((nc.length > 0) && (nc[0].me == self.me)) break; - if (nc.length > 0) return false; - if ((tg.nodeName == 'DIV') && (tg.id == self.id)) break; - tg = (tg.parentNode) ? tg.parentNode : false; - } - } - - e.stopPropagation(); - - self.cancelScroll(); - - tg = self.getTarget(e); - - if (tg) { - var skp = (/INPUT/i.test(tg.nodeName)) && (/range/i.test(tg.type)); - if (skp) return self.stopPropagation(e); - } - - if (!("clientX" in e) && ("changedTouches" in e)) { - e.clientX = e.changedTouches[0].clientX; - e.clientY = e.changedTouches[0].clientY; - } - - if (self.forcescreen) { - var le = e; - e = { - "original": (e.original) ? e.original : e - }; - e.clientX = le.screenX; - e.clientY = le.screenY; - } - - self.rail.drag = { - x: e.clientX, - y: e.clientY, - sx: self.scroll.x, - sy: self.scroll.y, - st: self.getScrollTop(), - sl: self.getScrollLeft(), - pt: 2, - dl: false, - tg: tg - }; - - if (self.ispage || !self.opt.directionlockdeadzone) { - - self.rail.drag.dl = "f"; - - } else { - - var view = { - w: $window.width(), - h: $window.height() - }; - - var page = { - w: Math.max(_doc.body.scrollWidth, _doc.documentElement.scrollWidth), - h: Math.max(_doc.body.scrollHeight, _doc.documentElement.scrollHeight) - }; - - var maxh = Math.max(0, page.h - view.h); - var maxw = Math.max(0, page.w - view.w); - - if (!self.rail.scrollable && self.railh.scrollable) self.rail.drag.ck = (maxh > 0) ? "v" : false; - else if (self.rail.scrollable && !self.railh.scrollable) self.rail.drag.ck = (maxw > 0) ? "h" : false; - else self.rail.drag.ck = false; - if (!self.rail.drag.ck) self.rail.drag.dl = "f"; - } - - if (self.opt.emulatetouch && self.isiframe && cap.isie) { - var wp = self.win.position(); - self.rail.drag.x += wp.left; - self.rail.drag.y += wp.top; - } - - self.hasmoving = false; - self.lastmouseup = false; - self.scrollmom.reset(e.clientX, e.clientY); - - if (!cap.cantouch && !this.istouchcapable && !e.pointerType) { - - var ip = (tg) ? /INPUT|SELECT|BUTTON|TEXTAREA/i.test(tg.nodeName) : false; - if (!ip) { - if (!self.ispage && cap.hasmousecapture) tg.setCapture(); - if (self.opt.emulatetouch) { - if (tg.onclick && !(tg._onclick || false)) { // intercept DOM0 onclick event - tg._onclick = tg.onclick; - tg.onclick = function (e) { - if (self.hasmoving) return false; - tg._onclick.call(this, e); - }; - } - return self.cancelEvent(e); - } - return self.stopPropagation(e); - } - - if (/SUBMIT|CANCEL|BUTTON/i.test($(tg).attr('type'))) { - self.preventclick = { - "tg": tg, - "click": false - }; - } - - } - } - - }; - - self.ontouchend = function (e) { - - if (!self.rail.drag) return true; - - if (self.rail.drag.pt == 2) { - if (e.pointerType && e.pointerType != 2 && e.pointerType != "touch") return false; - - /* - if (!self.hasmoving) { - if (e.type === "mouseup") { - var tg = self.rail.drag.tg; - setTimeout(function () { - tg && $(tg).trigger("click"); - }, 20); - } - } - */ - - self.rail.drag = false; - - if (self.hasmoving) { - self.scrollmom.doMomentum(); - self.lastmouseup = true; - self.hideCursor(); - if (cap.hasmousecapture) _doc.releaseCapture(); - if (!cap.cantouch) return self.cancelEvent(e); - } - - } - else if (self.rail.drag.pt == 1) { - return self.onmouseup(e); - } - - }; - - var moveneedoffset = (self.opt.emulatetouch && self.isiframe && !cap.hasmousecapture); - - self.ontouchmove = function (e, byiframe) { - - if (!self.rail.drag) return false; - - if (e.targetTouches && self.opt.preventmultitouchscrolling) { - if (e.targetTouches.length > 1) return false; // multitouch - } - - if (e.pointerType && e.pointerType != 2 && e.pointerType != "touch") return false; - - if (self.rail.drag.pt == 2) { - - if (("changedTouches" in e)) { - e.clientX = e.changedTouches[0].clientX; - e.clientY = e.changedTouches[0].clientY; - } - - if (self.rail.drag.y === e.clientY && self.rail.drag.x === e.clientX) return false; // prevent first useless move event - - if (!self.hasmoving) self.onscrollstart && self.triggerScrollStart(e.clientX,e.clientY,0,0,0); - self.hasmoving = true; - - if (self.preventclick && !self.preventclick.click) { - self.preventclick.click = self.preventclick.tg.onclick || false; - self.preventclick.tg.onclick = self.onpreventclick; - } - - var ofy, ofx; - ofx = ofy = 0; - - if (moveneedoffset && !byiframe) { - var wp = self.win.position(); - ofx = -wp.left; - ofy = -wp.top; - } - - var fy = e.clientY + ofy; - var my = (fy - self.rail.drag.y); - var fx = e.clientX + ofx; - var mx = (fx - self.rail.drag.x); - - var ny = self.rail.drag.st - my; - - if (self.ishwscroll && self.opt.bouncescroll) { - if (ny < 0) { - ny = Math.round(ny / 2); - } else if (ny > self.page.maxh) { - ny = self.page.maxh + Math.round((ny - self.page.maxh) / 2); - } - } else { - if (ny < 0) { - ny = 0; - fy = 0; - } - if (ny > self.page.maxh) { - ny = self.page.maxh; - fy = 0; - } - } - - var nx; - if (self.railh && self.railh.scrollable) { - nx = (self.isrtlmode) ? mx - self.rail.drag.sl : self.rail.drag.sl - mx; - - if (self.ishwscroll && self.opt.bouncescroll) { - if (nx < 0) { - nx = Math.round(nx / 2); - } else if (nx > self.page.maxw) { - nx = self.page.maxw + Math.round((nx - self.page.maxw) / 2); - } - } else { - if (nx < 0) { - nx = 0; - fx = 0; - } - if (nx > self.page.maxw) { - nx = self.page.maxw; - fx = 0; - } - } - - } - - var grabbed = false; - if (self.rail.drag.dl) { - grabbed = true; - if (self.rail.drag.dl == "v") nx = self.rail.drag.sl; - else if (self.rail.drag.dl == "h") ny = self.rail.drag.st; - } else { - var ay = Math.abs(my); - var ax = Math.abs(mx); - var dz = self.opt.directionlockdeadzone; - if (self.rail.drag.ck == "v") { - if (ay > dz && (ax <= (ay * 0.3))) { - self.rail.drag = false; - return true; - } else if (ax > dz) { - self.rail.drag.dl = "f"; - $body.scrollTop($body.scrollTop()); // stop iOS native scrolling (when active javascript has blocked) - } - } else if (self.rail.drag.ck == "h") { - if (ax > dz && (ay <= (ax * 0.3))) { - self.rail.drag = false; - return true; - } else if (ay > dz) { - self.rail.drag.dl = "f"; - $body.scrollLeft($body.scrollLeft()); // stop iOS native scrolling (when active javascript has blocked) - } - } - } - - self.synched("touchmove", function () { - if (self.rail.drag && (self.rail.drag.pt == 2)) { - if (self.prepareTransition) self.prepareTransition(0); - if (self.rail.scrollable) self.setScrollTop(ny); - self.scrollmom.update(fx, fy); - if (self.railh && self.railh.scrollable) { - self.setScrollLeft(nx); - self.showCursor(ny, nx); - } else { - self.showCursor(ny); - } - if (cap.isie10) _doc.selection.clear(); - } - }); - - if (cap.ischrome && self.istouchcapable) grabbed = false; //chrome touch emulation doesn't like! - if (grabbed) return self.cancelEvent(e); - } - else if (self.rail.drag.pt == 1) { // drag on cursor - return self.onmousemove(e); - } - - }; - - self.ontouchstartCursor = function (e, hronly) { - if (self.rail.drag && self.rail.drag.pt != 3) return; - if (self.locked) return self.cancelEvent(e); - self.cancelScroll(); - self.rail.drag = { - x: e.touches[0].clientX, - y: e.touches[0].clientY, - sx: self.scroll.x, - sy: self.scroll.y, - pt: 3, - hr: (!!hronly) - }; - var tg = self.getTarget(e); - if (!self.ispage && cap.hasmousecapture) tg.setCapture(); - if (self.isiframe && !cap.hasmousecapture) { - self.saved["csspointerevents"] = self.doc.css("pointer-events"); - self.css(self.doc, { "pointer-events": "none" }); - } - return self.cancelEvent(e); - }; - - self.ontouchendCursor = function (e) { - if (self.rail.drag) { - if (cap.hasmousecapture) _doc.releaseCapture(); - if (self.isiframe && !cap.hasmousecapture) self.doc.css("pointer-events", self.saved["csspointerevents"]); - if (self.rail.drag.pt != 3) return; - self.rail.drag = false; - return self.cancelEvent(e); - } - }; - - self.ontouchmoveCursor = function (e) { - if (self.rail.drag) { - if (self.rail.drag.pt != 3) return; - - self.cursorfreezed = true; - - if (self.rail.drag.hr) { - self.scroll.x = self.rail.drag.sx + (e.touches[0].clientX - self.rail.drag.x); - if (self.scroll.x < 0) self.scroll.x = 0; - var mw = self.scrollvaluemaxw; - if (self.scroll.x > mw) self.scroll.x = mw; - } else { - self.scroll.y = self.rail.drag.sy + (e.touches[0].clientY - self.rail.drag.y); - if (self.scroll.y < 0) self.scroll.y = 0; - var my = self.scrollvaluemax; - if (self.scroll.y > my) self.scroll.y = my; - } - - self.synched('touchmove', function () { - if (self.rail.drag && (self.rail.drag.pt == 3)) { - self.showCursor(); - if (self.rail.drag.hr) self.doScrollLeft(Math.round(self.scroll.x * self.scrollratio.x), self.opt.cursordragspeed); - else self.doScrollTop(Math.round(self.scroll.y * self.scrollratio.y), self.opt.cursordragspeed); - } - }); - - return self.cancelEvent(e); - } - - }; - - } - - self.onmousedown = function (e, hronly) { - if (self.rail.drag && self.rail.drag.pt != 1) return; - if (self.railslocked) return self.cancelEvent(e); - self.cancelScroll(); - self.rail.drag = { - x: e.clientX, - y: e.clientY, - sx: self.scroll.x, - sy: self.scroll.y, - pt: 1, - hr: hronly || false - }; - var tg = self.getTarget(e); - if (!self.ispage && cap.hasmousecapture) tg.setCapture(); - if (self.isiframe && !cap.hasmousecapture) { - self.saved.csspointerevents = self.doc.css("pointer-events"); - self.css(self.doc, { - "pointer-events": "none" - }); - } - self.hasmoving = false; - return self.cancelEvent(e); - }; - - self.onmouseup = function (e) { - if (self.rail.drag) { - if (self.rail.drag.pt != 1) return true; - - if (cap.hasmousecapture) _doc.releaseCapture(); - if (self.isiframe && !cap.hasmousecapture) self.doc.css("pointer-events", self.saved.csspointerevents); - self.rail.drag = false; - if (self.hasmoving) self.triggerScrollEnd(); // TODO - check &&!self.scrollrunning - return self.cancelEvent(e); - } - }; - - self.onmousemove = function (e) { - if (self.rail.drag) { - if (self.rail.drag.pt !== 1) return; - - if (cap.ischrome && e.which === 0) return self.onmouseup(e); - - self.cursorfreezed = true; - self.hasmoving = true; - - if (self.rail.drag.hr) { - self.scroll.x = self.rail.drag.sx + (e.clientX - self.rail.drag.x); - if (self.scroll.x < 0) self.scroll.x = 0; - var mw = self.scrollvaluemaxw; - if (self.scroll.x > mw) self.scroll.x = mw; - } else { - self.scroll.y = self.rail.drag.sy + (e.clientY - self.rail.drag.y); - if (self.scroll.y < 0) self.scroll.y = 0; - var my = self.scrollvaluemax; - if (self.scroll.y > my) self.scroll.y = my; - } - - self.synched('mousemove', function () { - if (self.rail.drag && (self.rail.drag.pt == 1)) { - self.showCursor(); - if (self.rail.drag.hr) { - if (self.hasreversehr) { - self.doScrollLeft(self.scrollvaluemaxw - Math.round(self.scroll.x * self.scrollratio.x), self.opt.cursordragspeed); - } else { - self.doScrollLeft(Math.round(self.scroll.x * self.scrollratio.x), self.opt.cursordragspeed); - } - } - else self.doScrollTop(Math.round(self.scroll.y * self.scrollratio.y), self.opt.cursordragspeed); - } - }); - - return self.cancelEvent(e); - } - else { - self.checkarea = 0; - } - }; - - if (cap.cantouch || self.opt.emulatetouch) { - - self.onpreventclick = function (e) { - if (self.preventclick) { - self.preventclick.tg.onclick = self.preventclick.click; - self.preventclick = false; - return self.cancelEvent(e); - } - }; - - //self.bind(self.win, "mousedown", self.ontouchstart); // control content dragging <-- REENABLE!! - - self.onclick = (cap.isios) ? false : function (e) { // it needs to check IE11 ??? - if (self.lastmouseup) { - self.lastmouseup = false; - return self.cancelEvent(e); - } else { - return true; - } - }; - - if (self.opt.grabcursorenabled && cap.cursorgrabvalue) { - self.css((self.ispage) ? self.doc : self.win, { - 'cursor': cap.cursorgrabvalue - }); - self.css(self.rail, { - 'cursor': cap.cursorgrabvalue - }); - } - - } else { - - var checkSelectionScroll = function (e) { - if (!self.selectiondrag) return; - - if (e) { - var ww = self.win.outerHeight(); - var df = (e.pageY - self.selectiondrag.top); - if (df > 0 && df < ww) df = 0; - if (df >= ww) df -= ww; - self.selectiondrag.df = df; - } - if (self.selectiondrag.df == 0) return; - - var rt = -Math.floor(self.selectiondrag.df / 6) * 2; - self.doScrollBy(rt); - - self.debounced("doselectionscroll", function () { - checkSelectionScroll(); - }, 50); - }; - - if ("getSelection" in _doc) { // A grade - Major browsers - self.hasTextSelected = function () { - return (_doc.getSelection().rangeCount > 0); - }; - } else if ("selection" in _doc) { //IE9- - self.hasTextSelected = function () { - return (_doc.selection.type != "None"); - }; - } else { - self.hasTextSelected = function () { // no support - return false; - }; - } - - self.onselectionstart = function (e) { - /* More testing - severe chrome issues - if (!self.haswrapper&&(e.which&&e.which==2)) { // fool browser to manage middle button scrolling - self.win.css({'overflow':'auto'}); - setTimeout(function(){ - self.win.css({'overflow':''}); - },10); - return true; - } - */ - if (self.ispage) return; - self.selectiondrag = self.win.offset(); - }; - - self.onselectionend = function (e) { - self.selectiondrag = false; - }; - self.onselectiondrag = function (e) { - if (!self.selectiondrag) return; - if (self.hasTextSelected()) self.debounced("selectionscroll", function () { - checkSelectionScroll(e); - }, 250); - }; - } - - if (cap.hasw3ctouch) { //IE11+ - self.css((self.ispage) ? $("html") : self.win, { 'touch-action': 'none' }); - self.css(self.rail, { - 'touch-action': 'none' - }); - self.css(self.cursor, { - 'touch-action': 'none' - }); - self.bind(self.win, "pointerdown", self.ontouchstart); - self.bind(_doc, "pointerup", self.ontouchend); - self.bind(_doc, "pointermove", self.ontouchmove); - } else if (cap.hasmstouch) { //IE10 - self.css((self.ispage) ? $("html") : self.win, { '-ms-touch-action': 'none' }); - self.css(self.rail, { - '-ms-touch-action': 'none' - }); - self.css(self.cursor, { - '-ms-touch-action': 'none' - }); - self.bind(self.win, "MSPointerDown", self.ontouchstart); - self.bind(_doc, "MSPointerUp", self.ontouchend); - self.bind(_doc, "MSPointerMove", self.ontouchmove); - self.bind(self.cursor, "MSGestureHold", function (e) { - e.preventDefault(); - }); - self.bind(self.cursor, "contextmenu", function (e) { - e.preventDefault(); - }); - } else if (cap.cantouch) { // smartphones/touch devices - self.bind(self.win, "touchstart", self.ontouchstart, false, true); - self.bind(_doc, "touchend", self.ontouchend, false, true); - self.bind(_doc, "touchcancel", self.ontouchend, false, true); - self.bind(_doc, "touchmove", self.ontouchmove, false, true); - } - - if (self.opt.emulatetouch) { - self.bind(self.win, "mousedown", self.ontouchstart, false, true); - self.bind(_doc, "mouseup", self.ontouchend, false, true); - self.bind(_doc, "mousemove", self.ontouchmove, false, true); - } - - if (self.opt.cursordragontouch || (!cap.cantouch && !self.opt.emulatetouch)) { - - self.rail.css({ - cursor: "default" - }); - self.railh && self.railh.css({ - cursor: "default" - }); - - self.jqbind(self.rail, "mouseenter", function () { - if (!self.ispage && !self.win.is(":visible")) return false; - if (self.canshowonmouseevent) self.showCursor(); - self.rail.active = true; - }); - self.jqbind(self.rail, "mouseleave", function () { - self.rail.active = false; - if (!self.rail.drag) self.hideCursor(); - }); - - if (self.opt.sensitiverail) { - self.bind(self.rail, "click", function (e) { - self.doRailClick(e, false, false); - }); - self.bind(self.rail, "dblclick", function (e) { - self.doRailClick(e, true, false); - }); - self.bind(self.cursor, "click", function (e) { - self.cancelEvent(e); - }); - self.bind(self.cursor, "dblclick", function (e) { - self.cancelEvent(e); - }); - } - - if (self.railh) { - self.jqbind(self.railh, "mouseenter", function () { - if (!self.ispage && !self.win.is(":visible")) return false; - if (self.canshowonmouseevent) self.showCursor(); - self.rail.active = true; - }); - self.jqbind(self.railh, "mouseleave", function () { - self.rail.active = false; - if (!self.rail.drag) self.hideCursor(); - }); - - if (self.opt.sensitiverail) { - self.bind(self.railh, "click", function (e) { - self.doRailClick(e, false, true); - }); - self.bind(self.railh, "dblclick", function (e) { - self.doRailClick(e, true, true); - }); - self.bind(self.cursorh, "click", function (e) { - self.cancelEvent(e); - }); - self.bind(self.cursorh, "dblclick", function (e) { - self.cancelEvent(e); - }); - } - - } - - } - - if (self.opt.cursordragontouch && (this.istouchcapable || cap.cantouch)) { - self.bind(self.cursor, "touchstart", self.ontouchstartCursor); - self.bind(self.cursor, "touchmove", self.ontouchmoveCursor); - self.bind(self.cursor, "touchend", self.ontouchendCursor); - self.cursorh && self.bind(self.cursorh, "touchstart", function (e) { - self.ontouchstartCursor(e, true); - }); - self.cursorh && self.bind(self.cursorh, "touchmove", self.ontouchmoveCursor); - self.cursorh && self.bind(self.cursorh, "touchend", self.ontouchendCursor); - } - - if (!cap.cantouch && !self.opt.emulatetouch) { - - self.bind((cap.hasmousecapture) ? self.win : _doc, "mouseup", self.onmouseup); - self.bind(_doc, "mousemove", self.onmousemove); - if (self.onclick) self.bind(_doc, "click", self.onclick); - - self.bind(self.cursor, "mousedown", self.onmousedown); - self.bind(self.cursor, "mouseup", self.onmouseup); - - if (self.railh) { - self.bind(self.cursorh, "mousedown", function (e) { - self.onmousedown(e, true); - }); - self.bind(self.cursorh, "mouseup", self.onmouseup); - } - - if (!self.ispage && self.opt.enablescrollonselection) { - self.bind(self.win[0], "mousedown", self.onselectionstart); - self.bind(_doc, "mouseup", self.onselectionend); - self.bind(self.cursor, "mouseup", self.onselectionend); - if (self.cursorh) self.bind(self.cursorh, "mouseup", self.onselectionend); - self.bind(_doc, "mousemove", self.onselectiondrag); - } - - if (self.zoom) { - self.jqbind(self.zoom, "mouseenter", function () { - if (self.canshowonmouseevent) self.showCursor(); - self.rail.active = true; - }); - self.jqbind(self.zoom, "mouseleave", function () { - self.rail.active = false; - if (!self.rail.drag) self.hideCursor(); - }); - } - - } else { - - self.bind((cap.hasmousecapture) ? self.win : _doc, "mouseup", self.ontouchend); - if (self.onclick) self.bind(_doc, "click", self.onclick); - - if (self.opt.cursordragontouch) { - self.bind(self.cursor, "mousedown", self.onmousedown); - self.bind(self.cursor, "mouseup", self.onmouseup); - self.cursorh && self.bind(self.cursorh, "mousedown", function (e) { - self.onmousedown(e, true); - }); - self.cursorh && self.bind(self.cursorh, "mouseup", self.onmouseup); - } else { - self.bind(self.rail, "mousedown", function (e) { e.preventDefault(); }); // prevent text selection - self.railh && self.bind(self.railh, "mousedown", function (e) { e.preventDefault(); }); - } - - } - - - if (self.opt.enablemousewheel) { - if (!self.isiframe) self.mousewheel((cap.isie && self.ispage) ? _doc : self.win, self.onmousewheel); - self.mousewheel(self.rail, self.onmousewheel); - if (self.railh) self.mousewheel(self.railh, self.onmousewheelhr); - } - - if (!self.ispage && !cap.cantouch && !(/HTML|^BODY/.test(self.win[0].nodeName))) { - if (!self.win.attr("tabindex")) self.win.attr({ - "tabindex": ++tabindexcounter - }); - - // self.jqbind(self.win, "focus", function (e) { - self.bind(self.win, "focus", function (e) { // better using native events - domfocus = (self.getTarget(e)).id || true; - self.hasfocus = true; - if (self.canshowonmouseevent) self.noticeCursor(); - }); - // self.jqbind(self.win, "blur", function (e) { - self.bind(self.win, "blur", function (e) { // * - domfocus = false; - self.hasfocus = false; - }); - - // self.jqbind(self.win, "mouseenter", function (e) { - self.bind(self.win, "mouseenter", function (e) { // * - mousefocus = (self.getTarget(e)).id || true; - self.hasmousefocus = true; - if (self.canshowonmouseevent) self.noticeCursor(); - }); - //self.jqbind(self.win, "mouseleave", function (e) { - self.bind(self.win, "mouseleave", function (e) { // * - mousefocus = false; - self.hasmousefocus = false; - if (!self.rail.drag) self.hideCursor(); - }); - - } - - - //Thanks to http://www.quirksmode.org !! - self.onkeypress = function (e) { - if (self.railslocked && self.page.maxh == 0) return true; - - e = (e) ? e : window.e; - var tg = self.getTarget(e); - if (tg && /INPUT|TEXTAREA|SELECT|OPTION/.test(tg.nodeName)) { - var tp = tg.getAttribute('type') || tg.type || false; - if ((!tp) || !(/submit|button|cancel/i.tp)) return true; - } - - if ($(tg).attr('contenteditable')) return true; - - if (self.hasfocus || (self.hasmousefocus && !domfocus) || (self.ispage && !domfocus && !mousefocus)) { - var key = e.keyCode; - - if (self.railslocked && key != 27) return self.cancelEvent(e); - - var ctrl = e.ctrlKey || false; - var shift = e.shiftKey || false; - - var ret = false; - switch (key) { - case 38: - case 63233: //safari - self.doScrollBy(24 * 3); - ret = true; - break; - case 40: - case 63235: //safari - self.doScrollBy(-24 * 3); - ret = true; - break; - case 37: - case 63232: //safari - if (self.railh) { - (ctrl) ? self.doScrollLeft(0) : self.doScrollLeftBy(24 * 3); - ret = true; - } - break; - case 39: - case 63234: //safari - if (self.railh) { - (ctrl) ? self.doScrollLeft(self.page.maxw) : self.doScrollLeftBy(-24 * 3); - ret = true; - } - break; - case 33: - case 63276: // safari - self.doScrollBy(self.view.h); - ret = true; - break; - case 34: - case 63277: // safari - self.doScrollBy(-self.view.h); - ret = true; - break; - case 36: - case 63273: // safari - (self.railh && ctrl) ? self.doScrollPos(0, 0) : self.doScrollTo(0); - ret = true; - break; - case 35: - case 63275: // safari - (self.railh && ctrl) ? self.doScrollPos(self.page.maxw, self.page.maxh) : self.doScrollTo(self.page.maxh); - ret = true; - break; - case 32: - if (self.opt.spacebarenabled) { - (shift) ? self.doScrollBy(self.view.h) : self.doScrollBy(-self.view.h); - ret = true; - } - break; - case 27: // ESC - if (self.zoomactive) { - self.doZoom(); - ret = true; - } - break; - } - if (ret) return self.cancelEvent(e); - } - }; - - if (self.opt.enablekeyboard) self.bind(_doc, (cap.isopera && !cap.isopera12) ? "keypress" : "keydown", self.onkeypress); - - self.bind(_doc, "keydown", function (e) { - var ctrl = e.ctrlKey || false; - if (ctrl) self.wheelprevented = true; - }); - self.bind(_doc, "keyup", function (e) { - var ctrl = e.ctrlKey || false; - if (!ctrl) self.wheelprevented = false; - }); - self.bind(window, "blur", function (e) { - self.wheelprevented = false; - }); - - self.bind(window, 'resize', self.lazyResize); - self.bind(window, 'orientationchange', self.lazyResize); - - self.bind(window, "load", self.lazyResize); - - if (cap.ischrome && !self.ispage && !self.haswrapper) { //chrome void scrollbar bug - it persists in version 26 - var tmp = self.win.attr("style"); - var ww = parseFloat(self.win.css("width")) + 1; - self.win.css('width', ww); - self.synched("chromefix", function () { - self.win.attr("style", tmp); - }); - } - - - // Trying a cross-browser implementation - good luck! - - self.onAttributeChange = function (e) { - self.lazyResize(self.isieold ? 250 : 30); - }; - - if (self.opt.enableobserver) { - - if ((!self.isie11) && (ClsMutationObserver !== false)) { // IE11 crashes #568 - self.observerbody = new ClsMutationObserver(function (mutations) { - mutations.forEach(function (mut) { - if (mut.type == "attributes") { - return ($body.hasClass("modal-open") && $body.hasClass("modal-dialog") && !$.contains($('.modal-dialog')[0], self.doc[0])) ? self.hide() : self.show(); // Support for Bootstrap modal; Added check if the nice scroll element is inside a modal - } - }); - if (self.me.clientWidth != self.page.width || self.me.clientHeight != self.page.height) return self.lazyResize(30); - }); - self.observerbody.observe(_doc.body, { - childList: true, - subtree: true, - characterData: false, - attributes: true, - attributeFilter: ['class'] - }); - } - - if (!self.ispage && !self.haswrapper) { - // redesigned MutationObserver for Chrome18+/Firefox14+/iOS6+ with support for: remove div, add/remove content - if (ClsMutationObserver !== false) { - self.observer = new ClsMutationObserver(function (mutations) { - mutations.forEach(self.onAttributeChange); - }); - self.observer.observe(self.win[0], { - childList: true, - characterData: false, - attributes: true, - subtree: false - }); - self.observerremover = new ClsMutationObserver(function (mutations) { - mutations.forEach(function (mo) { - if (mo.removedNodes.length > 0) { - for (var dd in mo.removedNodes) { - if (!!self && (mo.removedNodes[dd] == self.win[0])) return self.remove(); - } - } - }); - }); - self.observerremover.observe(self.win[0].parentNode, { - childList: true, - characterData: false, - attributes: false, - subtree: false - }); - } else { - self.bind(self.win, (cap.isie && !cap.isie9) ? "propertychange" : "DOMAttrModified", self.onAttributeChange); - if (cap.isie9) self.win[0].attachEvent("onpropertychange", self.onAttributeChange); //IE9 DOMAttrModified bug - self.bind(self.win, "DOMNodeRemoved", function (e) { - if (e.target == self.win[0]) self.remove(); - }); - } - } - - } - - // - - if (!self.ispage && self.opt.boxzoom) self.bind(window, "resize", self.resizeZoom); - if (self.istextarea) { - self.bind(self.win, "keydown", self.lazyResize); - self.bind(self.win, "mouseup", self.lazyResize); - } - - // self.checkrtlmode = true; - self.lazyResize(30); - - } - - if (this.doc[0].nodeName == 'IFRAME') { - var oniframeload = function () { - self.iframexd = false; - var doc; - try { - doc = 'contentDocument' in this ? this.contentDocument : this.contentWindow._doc; - var a = doc.domain; - } catch (e) { - self.iframexd = true; - doc = false; - } - - if (self.iframexd) { - if ("console" in window) console.log('NiceScroll error: policy restriced iframe'); - return true; //cross-domain - I can't manage this - } - - self.forcescreen = true; - - if (self.isiframe) { - self.iframe = { - "doc": $(doc), - "html": self.doc.contents().find('html')[0], - "body": self.doc.contents().find('body')[0] - }; - self.getContentSize = function () { - return { - w: Math.max(self.iframe.html.scrollWidth, self.iframe.body.scrollWidth), - h: Math.max(self.iframe.html.scrollHeight, self.iframe.body.scrollHeight) - }; - }; - self.docscroll = $(self.iframe.body); //$(this.contentWindow); - } - - if (!cap.isios && self.opt.iframeautoresize && !self.isiframe) { - self.win.scrollTop(0); // reset position - self.doc.height(""); //reset height to fix browser bug - var hh = Math.max(doc.getElementsByTagName('html')[0].scrollHeight, doc.body.scrollHeight); - self.doc.height(hh); - } - self.lazyResize(30); - - //if (cap.isie7) self.css($(self.iframe.html), _scrollyhidden); - self.css($(self.iframe.body), _scrollyhidden); - - if (cap.isios && self.haswrapper) { - self.css($(doc.body), { - '-webkit-transform': 'translate3d(0,0,0)' - }); // avoid iFrame content clipping - thanks to http://blog.derraab.com/2012/04/02/avoid-iframe-content-clipping-with-css-transform-on-ios/ - } - - if ('contentWindow' in this) { - self.bind(this.contentWindow, "scroll", self.onscroll); //IE8 & minor - } else { - self.bind(doc, "scroll", self.onscroll); - } - - if (self.opt.enablemousewheel) { - self.mousewheel(doc, self.onmousewheel); - } - - if (self.opt.enablekeyboard) self.bind(doc, (cap.isopera) ? "keypress" : "keydown", self.onkeypress); - - if (cap.cantouch) { - self.bind(doc, "touchstart", self.ontouchstart); - self.bind(doc, "touchmove", self.ontouchmove); - } - else if (self.opt.emulatetouch) { - self.bind(doc, "mousedown", self.ontouchstart); - self.bind(doc, "mousemove", function (e) { - return self.ontouchmove(e, true); - }); - if (self.opt.grabcursorenabled && cap.cursorgrabvalue) self.css($(doc.body), { - 'cursor': cap.cursorgrabvalue - }); - } - - self.bind(doc, "mouseup", self.ontouchend); - - if (self.zoom) { - if (self.opt.dblclickzoom) self.bind(doc, 'dblclick', self.doZoom); - if (self.ongesturezoom) self.bind(doc, "gestureend", self.ongesturezoom); - } - }; - - if (this.doc[0].readyState && this.doc[0].readyState == "complete") { - setTimeout(function () { - oniframeload.call(self.doc[0], false); - }, 500); - } - self.bind(this.doc, "load", oniframeload); - - } - - }; - - this.showCursor = function (py, px) { - if (self.cursortimeout) { - clearTimeout(self.cursortimeout); - self.cursortimeout = 0; - } - if (!self.rail) return; - if (self.autohidedom) { - self.autohidedom.stop().css({ - opacity: self.opt.cursoropacitymax - }); - self.cursoractive = true; - } - - if (!self.rail.drag || self.rail.drag.pt != 1) { - if (py !== undefined && py !== false) { - self.scroll.y = Math.round(py * 1 / self.scrollratio.y); - } - if (px !== undefined) { - self.scroll.x = Math.round(px * 1 / self.scrollratio.x); - } - } - - self.cursor.css({ - height: self.cursorheight, - top: self.scroll.y - }); - if (self.cursorh) { - var lx = (self.hasreversehr) ? self.scrollvaluemaxw - self.scroll.x : self.scroll.x; - (!self.rail.align && self.rail.visibility) ? self.cursorh.css({ - width: self.cursorwidth, - left: lx + self.rail.width - }) : self.cursorh.css({ - width: self.cursorwidth, - left: lx - }); - self.cursoractive = true; - } - - if (self.zoom) self.zoom.stop().css({ - opacity: self.opt.cursoropacitymax - }); - }; - - this.hideCursor = function (tm) { - if (self.cursortimeout) return; - if (!self.rail) return; - if (!self.autohidedom) return; - if (self.hasmousefocus && self.opt.autohidemode == "leave") return; - self.cursortimeout = setTimeout(function () { - if (!self.rail.active || !self.showonmouseevent) { - self.autohidedom.stop().animate({ - opacity: self.opt.cursoropacitymin - }); - if (self.zoom) self.zoom.stop().animate({ - opacity: self.opt.cursoropacitymin - }); - self.cursoractive = false; - } - self.cursortimeout = 0; - }, tm || self.opt.hidecursordelay); - }; - - this.noticeCursor = function (tm, py, px) { - self.showCursor(py, px); - if (!self.rail.active) self.hideCursor(tm); - }; - - this.getContentSize = - (self.ispage) ? - function () { - return { - w: Math.max(_doc.body.scrollWidth, _doc.documentElement.scrollWidth), - h: Math.max(_doc.body.scrollHeight, _doc.documentElement.scrollHeight) - }; - } : (self.haswrapper) ? - function () { - return { - w: self.doc[0].offsetWidth, - h: self.doc[0].offsetHeight - }; - } : function () { - return { - w: self.docscroll[0].scrollWidth, - h: self.docscroll[0].scrollHeight - }; - }; - - this.onResize = function (e, page) { - - if (!self || !self.win) return false; - - if (!self.haswrapper && !self.ispage) { - if (self.win.css('display') == 'none') { - if (self.visibility) self.hideRail().hideRailHr(); - return false; - } else { - if (!self.hidden && !self.visibility) self.showRail().showRailHr(); - } - } - - var premaxh = self.page.maxh; - var premaxw = self.page.maxw; - - var preview = { - h: self.view.h, - w: self.view.w - }; - - self.view = { - w: (self.ispage) ? self.win.width() : self.win[0].clientWidth, - h: (self.ispage) ? self.win.height() : self.win[0].clientHeight - }; - - self.page = (page) ? page : self.getContentSize(); - - self.page.maxh = Math.max(0, self.page.h - self.view.h); - self.page.maxw = Math.max(0, self.page.w - self.view.w); - - if ((self.page.maxh == premaxh) && (self.page.maxw == premaxw) && (self.view.w == preview.w) && (self.view.h == preview.h)) { - // test position - if (!self.ispage) { - var pos = self.win.offset(); - if (self.lastposition) { - var lst = self.lastposition; - if ((lst.top == pos.top) && (lst.left == pos.left)) return self; //nothing to do - } - self.lastposition = pos; - } else { - return self; //nothing to do - } - } - - if (self.page.maxh === 0) { - self.hideRail(); - self.scrollvaluemax = 0; - self.scroll.y = 0; - self.scrollratio.y = 0; - self.cursorheight = 0; - self.setScrollTop(0); - if (self.rail) self.rail.scrollable = false; - } else { - self.page.maxh -= (self.opt.railpadding.top + self.opt.railpadding.bottom); //** - self.rail.scrollable = true; - } - - if (self.page.maxw === 0) { - self.hideRailHr(); - self.scrollvaluemaxw = 0; - self.scroll.x = 0; - self.scrollratio.x = 0; - self.cursorwidth = 0; - self.setScrollLeft(0); - if (self.railh) { - self.railh.scrollable = false; - } - } else { - self.page.maxw -= (self.opt.railpadding.left + self.opt.railpadding.right); //** - if (self.railh) self.railh.scrollable = (self.opt.horizrailenabled); - } - - self.railslocked = (self.locked) || ((self.page.maxh === 0) && (self.page.maxw === 0)); - if (self.railslocked) { - if (!self.ispage) self.updateScrollBar(self.view); - return false; - } - - if (!self.hidden && !self.visibility) { - self.showRail().showRailHr(); - } - else if (self.railh && (!self.hidden && !self.railh.visibility)) self.showRailHr(); - - if (self.istextarea && self.win.css('resize') && self.win.css('resize') != 'none') self.view.h -= 20; - - self.cursorheight = Math.min(self.view.h, Math.round(self.view.h * (self.view.h / self.page.h))); - self.cursorheight = (self.opt.cursorfixedheight) ? self.opt.cursorfixedheight : Math.max(self.opt.cursorminheight, self.cursorheight); - - self.cursorwidth = Math.min(self.view.w, Math.round(self.view.w * (self.view.w / self.page.w))); - self.cursorwidth = (self.opt.cursorfixedheight) ? self.opt.cursorfixedheight : Math.max(self.opt.cursorminheight, self.cursorwidth); - - self.scrollvaluemax = self.view.h - self.cursorheight - (self.opt.railpadding.top + self.opt.railpadding.bottom); // - self.cursor.hborder //** - - if (self.railh) { - self.railh.width = (self.page.maxh > 0) ? (self.view.w - self.rail.width) : self.view.w; - self.scrollvaluemaxw = self.railh.width - self.cursorwidth - (self.opt.railpadding.left + self.opt.railpadding.right); // - self.cursorh.wborder //** - } - - /* - if (self.checkrtlmode&&self.railh) { - self.checkrtlmode = false; - if (self.opt.rtlmode&&self.scroll.x==0) self.setScrollLeft(self.page.maxw); - } -*/ - - if (!self.ispage) self.updateScrollBar(self.view); - - self.scrollratio = { - x: (self.page.maxw / self.scrollvaluemaxw), - y: (self.page.maxh / self.scrollvaluemax) - }; - - var sy = self.getScrollTop(); - if (sy > self.page.maxh) { - self.doScrollTop(self.page.maxh); - } else { - self.scroll.y = Math.round(self.getScrollTop() * (1 / self.scrollratio.y)); - self.scroll.x = Math.round(self.getScrollLeft() * (1 / self.scrollratio.x)); - if (self.cursoractive) self.noticeCursor(); - } - - if (self.scroll.y && (self.getScrollTop() == 0)) self.doScrollTo(Math.floor(self.scroll.y * self.scrollratio.y)); - - return self; - }; - - this.resize = self.onResize; - - this.hlazyresize = 0; - - this.lazyResize = function (tm) { // event debounce - - if (!self.haswrapper) self.hide(); - if (self.hlazyresize) clearTimeout(self.hlazyresize); - self.hlazyresize = setTimeout(function () { - if (self) { self.resize(); self.show(); } // this form mandatory for uglify - }, 240); - - return self; - - }; - - // derived by MDN https://developer.mozilla.org/en-US/docs/DOM/Mozilla_event_reference/wheel - function _modernWheelEvent(dom, name, fn, bubble) { - self._bind(dom, name, function (e) { - var e = (e) ? e : window.event; - var event = { - original: e, - target: e.target || e.srcElement, - type: "wheel", - deltaMode: e.type == "MozMousePixelScroll" ? 0 : 1, - deltaX: 0, - deltaZ: 0, - preventDefault: function () { - e.preventDefault ? e.preventDefault() : e.returnValue = false; - return false; - }, - stopImmediatePropagation: function () { - (e.stopImmediatePropagation) ? e.stopImmediatePropagation() : e.cancelBubble = true; - } - }; - - if (name == "mousewheel") { - e.wheelDeltaX && (event.deltaX = -1 / 40 * e.wheelDeltaX); - e.wheelDeltaY && (event.deltaY = -1 / 40 * e.wheelDeltaY); - !event.deltaY && !event.deltaX && (event.deltaY = -1 / 40 * e.wheelDelta); - } else { - event.deltaY = e.detail; - } - - return fn.call(dom, event); - }, bubble); - } - - - - this.jqbind = function (dom, name, fn) { // use jquery bind for non-native events (mouseenter/mouseleave) - self.events.push({ - e: dom, - n: name, - f: fn, - q: true - }); - $(dom).bind(name, fn); - }; - - this.mousewheel = function (dom, fn, bubble) { // bind mousewheel - var el = ("jquery" in dom) ? dom[0] : dom; - if ("onwheel" in _doc.createElement("div")) { // Modern browsers support "wheel" - self._bind(el, "wheel", fn, bubble || false); - } else { - var wname = (_doc.onmousewheel !== undefined) ? "mousewheel" : "DOMMouseScroll"; // older Webkit+IE support or older Firefox - _modernWheelEvent(el, wname, fn, bubble || false); - if (wname == "DOMMouseScroll") _modernWheelEvent(el, "MozMousePixelScroll", fn, bubble || false); // Firefox legacy - } - }; - - var passiveSupported = false; - - if (cap.haseventlistener) { // W3C standard event model - - // thanks to https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener - try { var options = Object.defineProperty({}, "passive", { get: function () { passiveSupported = !0 } }); window.addEventListener("test", null, options) } catch (err) { } - - this.cancelEvent = function (e) { - if (!e) return false; - var e = (e.original) ? e.original : e; - if (e.cancelable) e.preventDefault(); - e.stopPropagation(); - if (e.preventManipulation) e.preventManipulation(); //IE10 - return false; - }; - this.stopPropagation = function (e) { - if (!e) return false; - var e = (e.original) ? e.original : e; - e.stopPropagation(); - return false; - }; - - } else { - - // inspired from https://gist.github.com/jonathantneal/2415137 - - Event.prototype.preventDefault = function () { - this.returnValue = false; - }; - - Event.prototype.stopPropagation = function () { - this.cancelBubble = true; - }; - - window.constructor.prototype.addEventListener = _doc.constructor.prototype.addEventListener = Element.prototype.addEventListener = function (type, listener, useCapture) { - this.attachEvent("on" + type, listener); - } - window.constructor.prototype.removeEventListener = _doc.constructor.prototype.removeEventListener = Element.prototype.removeEventListener = function (type, listener, useCapture) { - this.detachEvent("on" + type, listener); - } - - // Thanks to http://www.switchonthecode.com !! - this.cancelEvent = function (e) { - var e = window.event || false; - if (!e) return false; - e.cancelBubble = true; - e.cancel = true; - e.returnValue = false; - return false; - }; - this.stopPropagation = function (e) { - var e = window.event || false; - if (!e) return false; - e.cancelBubble = true; - return false; - }; - - } - - this.bind = function (dom, name, fn, bubble, active) { // W3C - var el = ("jquery" in dom) ? dom[0] : dom; - self._bind(el, name, fn, bubble || false, active || false); - }; - - this._bind = function (el, name, fn, bubble, active) { // primitive bind - - self.events.push({ - e: el, - n: name, - f: fn, - b: bubble, - q: false - }); - - (passiveSupported && active) ? el.addEventListener(name, fn, { passive: false, capture: bubble }) : el.addEventListener(name, fn, bubble || false); - }; - - this._unbind = function (el, name, fn, bub) { // primitive unbind - el.removeEventListener(name, fn, bub); - }; - - this.unbindAll = function () { - for (var a = 0; a < self.events.length; a++) { - var r = self.events[a]; - (r.q) ? r.e.unbind(r.n, r.f) : self._unbind(r.e, r.n, r.f, r.b); - } - }; - - this.showRail = function () { - if ((self.page.maxh != 0) && (self.ispage || self.win.css('display') != 'none')) { - self.visibility = true; - self.rail.visibility = true; - self.rail.css('display', 'block'); - } - return self; - }; - - this.showRailHr = function () { - if (!self.railh) return self; - if ((self.page.maxw != 0) && (self.ispage || self.win.css('display') != 'none')) { - self.railh.visibility = true; - self.railh.css('display', 'block'); - } - return self; - }; - - this.hideRail = function () { - self.visibility = false; - self.rail.visibility = false; - self.rail.css('display', 'none'); - return self; - }; - - this.hideRailHr = function () { - if (!self.railh) return self; - self.railh.visibility = false; - self.railh.css('display', 'none'); - return self; - }; - - this.show = function () { - self.hidden = false; - self.railslocked = false; - return self.showRail().showRailHr(); - }; - - this.hide = function () { - self.hidden = true; - self.railslocked = true; - return self.hideRail().hideRailHr(); - }; - - this.toggle = function () { - return (self.hidden) ? self.show() : self.hide(); - }; - - this.remove = function () { - self.stop(); - if (self.cursortimeout) clearTimeout(self.cursortimeout); - for (var n in self.delaylist) if (self.delaylist[n]) clearAnimationFrame(self.delaylist[n].h); - self.doZoomOut(); - self.unbindAll(); - - if (cap.isie9) self.win[0].detachEvent("onpropertychange", self.onAttributeChange); //IE9 DOMAttrModified bug - - if (self.observer !== false) self.observer.disconnect(); - if (self.observerremover !== false) self.observerremover.disconnect(); - if (self.observerbody !== false) self.observerbody.disconnect(); - - self.events = null; - - if (self.cursor) { - self.cursor.remove(); - } - if (self.cursorh) { - self.cursorh.remove(); - } - if (self.rail) { - self.rail.remove(); - } - if (self.railh) { - self.railh.remove(); - } - if (self.zoom) { - self.zoom.remove(); - } - for (var a = 0; a < self.saved.css.length; a++) { - var d = self.saved.css[a]; - d[0].css(d[1], (d[2] === undefined) ? '' : d[2]); - } - self.saved = false; - self.me.data('__nicescroll', ''); //erase all traces - - // memory leak fixed by GianlucaGuarini - thanks a lot! - // remove the current nicescroll from the $.nicescroll array & normalize array - var lst = $.nicescroll; - lst.each(function (i) { - if (!this) return; - if (this.id === self.id) { - delete lst[i]; - for (var b = ++i; b < lst.length; b++ , i++) lst[i] = lst[b]; - lst.length--; - if (lst.length) delete lst[lst.length]; - } - }); - - for (var i in self) { - self[i] = null; - delete self[i]; - } - - self = null; - - }; - - this.scrollstart = function (fn) { - this.onscrollstart = fn; - return self; - }; - this.scrollend = function (fn) { - this.onscrollend = fn; - return self; - }; - this.scrollcancel = function (fn) { - this.onscrollcancel = fn; - return self; - }; - - this.zoomin = function (fn) { - this.onzoomin = fn; - return self; - }; - this.zoomout = function (fn) { - this.onzoomout = fn; - return self; - }; - - this.isScrollable = function (e) { - var dom = (e.target) ? e.target : e; - if (dom.nodeName == 'OPTION') return true; - while (dom && (dom.nodeType == 1) && (dom !== this.me[0]) && !(/^BODY|HTML/.test(dom.nodeName))) { - var dd = $(dom); - var ov = dd.css('overflowY') || dd.css('overflowX') || dd.css('overflow') || ''; - if (/scroll|auto/.test(ov)) return (dom.clientHeight != dom.scrollHeight); - dom = (dom.parentNode) ? dom.parentNode : false; - } - return false; - }; - - this.getViewport = function (me) { - var dom = (me && me.parentNode) ? me.parentNode : false; - while (dom && (dom.nodeType == 1) && !(/^BODY|HTML/.test(dom.nodeName))) { - var dd = $(dom); - if (/fixed|absolute/.test(dd.css("position"))) return dd; - var ov = dd.css('overflowY') || dd.css('overflowX') || dd.css('overflow') || ''; - if ((/scroll|auto/.test(ov)) && (dom.clientHeight != dom.scrollHeight)) return dd; - if (dd.getNiceScroll().length > 0) return dd; - dom = (dom.parentNode) ? dom.parentNode : false; - } - return false; //(dom) ? $(dom) : false; - }; - - this.triggerScrollStart = function (px,py,x,y,ms) { - - var info = { - "type": "scrollstart", - "current": { - "x": px, - "y": py - }, - "request": { - "x": x, - "y": y - }, - "end": { - "x": self.newscrollx, - "y": self.newscrolly - }, - "speed": ms - }; - - self.onscrollstart.call(self, info); - - }; - - this.triggerScrollEnd = function () { - if (!self.onscrollend) return; - - var px = self.getScrollLeft(); - var py = self.getScrollTop(); - - var info = { - type: "scrollend", - current: { - x: px, - y: py - }, - end: { - x: px, - y: py - } - }; - self.onscrollend.call(self, info); - }; - - function execScrollWheel(e, hr, chkscroll) { - var px, py; - - if (e.deltaMode == 0) { // PIXEL - px = -Math.floor(e.deltaX * (self.opt.mousescrollstep / (18 * 3))); - py = -Math.floor(e.deltaY * (self.opt.mousescrollstep / (18 * 3))); - } else if (e.deltaMode == 1) { // LINE - px = -Math.floor(e.deltaX * self.opt.mousescrollstep); - py = -Math.floor(e.deltaY * self.opt.mousescrollstep); - } - - if (hr && self.opt.oneaxismousemode && (px === 0) && py) { // classic vertical-only mousewheel + browser with x/y support - px = py; - py = 0; - - if (chkscroll) { - var hrend = (px < 0) ? (self.getScrollLeft() >= self.page.maxw) : (self.getScrollLeft() <= 0); - if (hrend) { // preserve vertical scrolling - py = px; - px = 0; - } - } - - } - - // invert horizontal direction for rtl mode - if (self.isrtlmode) px = -px; - - if (px) { - - if (self.scrollmom) { - self.scrollmom.stop(); - } else { - - if (px < 0) { // fix apple magic mouse swipe back/forward - if (self.getScrollLeft() >= self.page.maxw) return true; - } else { - if (self.getScrollLeft() <= 0) return true; - } - - } - - self.lastdeltax += px; - self.debounced("mousewheelx", function () { - var dt = self.lastdeltax; - self.lastdeltax = 0; - if (!self.rail.drag) { - self.doScrollLeftBy(dt); - } - }, 15); - } - if (py) { - if (self.opt.nativeparentscrolling && chkscroll && !self.ispage && !self.zoomactive) { - if (py < 0) { - if (self.getScrollTop() >= self.page.maxh) return true; - } else { - if (self.getScrollTop() <= 0) return true; - } - } - if (self.scrollmom) { - self.scrollmom.stop(); - } - self.lastdeltay += py; - // self.debounced("mousewheely", function() { - self.synched("mousewheely", function () { - var dt = self.lastdeltay; - self.lastdeltay = 0; - if (!self.rail.drag) { - self.doScrollBy(dt); - } - }, 15); - } - - e.stopImmediatePropagation(); - return e.preventDefault(); - } - - this.onmousewheel = function (e) { - if (self.wheelprevented) return; - if (self.railslocked) { - self.debounced("checkunlock", self.resize, 250); - return true; - } - if (self.rail.drag) return self.cancelEvent(e); - - if (self.opt.oneaxismousemode === "auto" && e.deltaX !== 0) self.opt.oneaxismousemode = false; // check two-axis mouse support (not very elegant) - - if (self.opt.oneaxismousemode && e.deltaX === 0) { - if (!self.rail.scrollable) { - if (self.railh && self.railh.scrollable) { - return self.onmousewheelhr(e); - } else { - return true; - } - } - } - - var nw = now(); - var chk = false; - if (self.opt.preservenativescrolling && ((self.checkarea + 600) < nw)) { - self.nativescrollingarea = self.isScrollable(e); - chk = true; - } - self.checkarea = nw; - if (self.nativescrollingarea) return true; // this isn't my business - var ret = execScrollWheel(e, false, chk); - if (ret) self.checkarea = 0; - return ret; - }; - - this.onmousewheelhr = function (e) { - if (self.wheelprevented) return; - if (self.railslocked || !self.railh.scrollable) return true; - if (self.rail.drag) return self.cancelEvent(e); - - var nw = now(); - var chk = false; - if (self.opt.preservenativescrolling && ((self.checkarea + 600) < nw)) { - self.nativescrollingarea = self.isScrollable(e); - chk = true; - } - self.checkarea = nw; - if (self.nativescrollingarea) return true; // this is not my business - if (self.railslocked) return self.cancelEvent(e); - - return execScrollWheel(e, true, chk); - }; - - this.stop = function () { - self.cancelScroll(); - if (self.scrollmon) self.scrollmon.stop(); - self.cursorfreezed = false; - self.scroll.y = Math.round(self.getScrollTop() * (1 / self.scrollratio.y)); - self.noticeCursor(); - return self; - }; - - this.getTransitionSpeed = function (dif) { - var sp = Math.round(self.opt.scrollspeed * 10); - var ex = Math.min(sp, Math.round((dif / 20) * self.opt.scrollspeed)); - return (ex > 20) ? ex : 0; - }; - - if (!self.opt.smoothscroll) { - this.doScrollLeft = function (x, spd) { //direct - var y = self.getScrollTop(); - self.doScrollPos(x, y, spd); - }; - this.doScrollTop = function (y, spd) { //direct - var x = self.getScrollLeft(); - self.doScrollPos(x, y, spd); - }; - this.doScrollPos = function (x, y, spd) { //direct - var nx = (x > self.page.maxw) ? self.page.maxw : x; - if (nx < 0) nx = 0; - var ny = (y > self.page.maxh) ? self.page.maxh : y; - if (ny < 0) ny = 0; - self.synched('scroll', function () { - self.setScrollTop(ny); - self.setScrollLeft(nx); - }); - }; - this.cancelScroll = function () { }; // direct - } else if (self.ishwscroll && cap.hastransition && self.opt.usetransition && !!self.opt.smoothscroll) { - this.prepareTransition = function (dif, istime) { - var ex = (istime) ? ((dif > 20) ? dif : 0) : self.getTransitionSpeed(dif); - var trans = (ex) ? cap.prefixstyle + 'transform ' + ex + 'ms ease-out' : ''; - if (!self.lasttransitionstyle || self.lasttransitionstyle != trans) { - self.lasttransitionstyle = trans; - self.doc.css(cap.transitionstyle, trans); - } - return ex; - }; - - this.doScrollLeft = function (x, spd) { //trans - var y = (self.scrollrunning) ? self.newscrolly : self.getScrollTop(); - self.doScrollPos(x, y, spd); - }; - - this.doScrollTop = function (y, spd) { //trans - var x = (self.scrollrunning) ? self.newscrollx : self.getScrollLeft(); - self.doScrollPos(x, y, spd); - }; - - this.doScrollPos = function (x, y, spd) { //trans - - var py = self.getScrollTop(); - var px = self.getScrollLeft(); - - if (((self.newscrolly - py) * (y - py) < 0) || ((self.newscrollx - px) * (x - px) < 0)) self.cancelScroll(); //inverted movement detection - - if (self.opt.bouncescroll == false) { - if (y < 0) y = 0; - else if (y > self.page.maxh) y = self.page.maxh; - if (x < 0) x = 0; - else if (x > self.page.maxw) x = self.page.maxw; - } - - if (self.scrollrunning && x == self.newscrollx && y == self.newscrolly) return false; - - self.newscrolly = y; - self.newscrollx = x; - - self.newscrollspeed = spd || false; - - if (self.timer) return false; - - self.timer = setTimeout(function () { - - var top = self.getScrollTop(); - var lft = self.getScrollLeft(); - - var dst = {}; - dst.x = x - lft; - dst.y = y - top; - dst.px = lft; - dst.py = top; - - var dd = Math.round(Math.sqrt(Math.pow(dst.x, 2) + Math.pow(dst.y, 2))); - var ms = (self.newscrollspeed && self.newscrollspeed > 1) ? self.newscrollspeed : self.getTransitionSpeed(dd); - if (self.newscrollspeed && self.newscrollspeed <= 1) ms *= self.newscrollspeed; - - self.prepareTransition(ms, true); - - if (self.timerscroll && self.timerscroll.tm) clearInterval(self.timerscroll.tm); - - if (ms > 0) { - - if (!self.scrollrunning && self.onscrollstart) { - self.triggerScrollStart(lft,top,x,y,ms); - } - - if (cap.transitionend) { - if (!self.scrollendtrapped) { - self.scrollendtrapped = true; - self.bind(self.doc, cap.transitionend, self.onScrollTransitionEnd, false); //I have got to do something usefull!! - } - } else { - if (self.scrollendtrapped) clearTimeout(self.scrollendtrapped); - self.scrollendtrapped = setTimeout(self.onScrollTransitionEnd, ms); // simulate transitionend event - } - - var py = top; - var px = lft; - self.timerscroll = { - bz: new BezierClass(py, self.newscrolly, ms, 0, 0, 0.58, 1), - bh: new BezierClass(px, self.newscrollx, ms, 0, 0, 0.58, 1) - }; - if (!self.cursorfreezed) self.timerscroll.tm = setInterval(function () { - self.showCursor(self.getScrollTop(), self.getScrollLeft()); - }, 60); - - } - - self.synched("doScroll-set", function () { - self.timer = 0; - if (self.scrollendtrapped) self.scrollrunning = true; - self.setScrollTop(self.newscrolly); - self.setScrollLeft(self.newscrollx); - if (!self.scrollendtrapped) self.onScrollTransitionEnd(); - }); - - - }, 50); - - }; - - this.cancelScroll = function () { - if (!self.scrollendtrapped) return true; - var py = self.getScrollTop(); - var px = self.getScrollLeft(); - self.scrollrunning = false; - if (!cap.transitionend) clearTimeout(cap.transitionend); - self.scrollendtrapped = false; - self._unbind(self.doc[0], cap.transitionend, self.onScrollTransitionEnd); - self.prepareTransition(0); - self.setScrollTop(py); // fire event onscroll - if (self.railh) self.setScrollLeft(px); - if (self.timerscroll && self.timerscroll.tm) clearInterval(self.timerscroll.tm); - self.timerscroll = false; - - self.cursorfreezed = false; - - self.showCursor(py, px); - return self; - }; - this.onScrollTransitionEnd = function () { - if (self.scrollendtrapped) self._unbind(self.doc[0], cap.transitionend, self.onScrollTransitionEnd); - self.scrollendtrapped = false; - self.prepareTransition(0); - if (self.timerscroll && self.timerscroll.tm) clearInterval(self.timerscroll.tm); - self.timerscroll = false; - var py = self.getScrollTop(); - var px = self.getScrollLeft(); - self.setScrollTop(py); // fire event onscroll - if (self.railh) self.setScrollLeft(px); // fire event onscroll left - - self.noticeCursor(false, py, px); - - self.cursorfreezed = false; - - if (py < 0) py = 0; - else if (py > self.page.maxh) py = self.page.maxh; - if (px < 0) px = 0; - else if (px > self.page.maxw) px = self.page.maxw; - if ((py != self.newscrolly) || (px != self.newscrollx)) return self.doScrollPos(px, py, self.opt.snapbackspeed); - - if (self.onscrollend && self.scrollrunning) { - self.triggerScrollEnd(); - } - self.scrollrunning = false; - - }; - - } else { - - this.doScrollLeft = function (x, spd) { //no-trans - var y = (self.scrollrunning) ? self.newscrolly : self.getScrollTop(); - self.doScrollPos(x, y, spd); - }; - - this.doScrollTop = function (y, spd) { //no-trans - var x = (self.scrollrunning) ? self.newscrollx : self.getScrollLeft(); - self.doScrollPos(x, y, spd); - }; - - this.doScrollPos = function (x, y, spd) { //no-trans - var y = (y === undefined || y === false) ? self.getScrollTop(true) : y; - - if ((self.timer) && (self.newscrolly == y) && (self.newscrollx == x)) return true; - - if (self.timer) clearAnimationFrame(self.timer); - self.timer = 0; - - var py = self.getScrollTop(); - var px = self.getScrollLeft(); - - if (((self.newscrolly - py) * (y - py) < 0) || ((self.newscrollx - px) * (x - px) < 0)) self.cancelScroll(); //inverted movement detection - - self.newscrolly = y; - self.newscrollx = x; - - if (!self.bouncescroll || !self.rail.visibility) { - if (self.newscrolly < 0) { - self.newscrolly = 0; - } else if (self.newscrolly > self.page.maxh) { - self.newscrolly = self.page.maxh; - } - } - if (!self.bouncescroll || !self.railh.visibility) { - if (self.newscrollx < 0) { - self.newscrollx = 0; - } else if (self.newscrollx > self.page.maxw) { - self.newscrollx = self.page.maxw; - } - } - - self.dst = {}; - self.dst.x = x - px; - self.dst.y = y - py; - self.dst.px = px; - self.dst.py = py; - - var dst = Math.round(Math.sqrt(Math.pow(self.dst.x, 2) + Math.pow(self.dst.y, 2))); - - self.dst.ax = self.dst.x / dst; - self.dst.ay = self.dst.y / dst; - - var pa = 0; - var pe = dst; - - if (self.dst.x == 0) { - pa = py; - pe = y; - self.dst.ay = 1; - self.dst.py = 0; - } else if (self.dst.y == 0) { - pa = px; - pe = x; - self.dst.ax = 1; - self.dst.px = 0; - } - - var ms = self.getTransitionSpeed(dst); - if (spd && spd <= 1) ms *= spd; - if (ms > 0) { - self.bzscroll = (self.bzscroll) ? self.bzscroll.update(pe, ms) : new BezierClass(pa, pe, ms, 0, 1, 0, 1); - } else { - self.bzscroll = false; - } - - if (self.timer) return; - - if ((py == self.page.maxh && y >= self.page.maxh) || (px == self.page.maxw && x >= self.page.maxw)) self.checkContentSize(); - - var sync = 1; - - function scrolling() { - if (self.cancelAnimationFrame) return true; - - self.scrollrunning = true; - - sync = 1 - sync; - if (sync) return (self.timer = setAnimationFrame(scrolling) || 1); - - var done = 0; - var sx, sy; - - var sc = sy = self.getScrollTop(); - if (self.dst.ay) { - sc = (self.bzscroll) ? self.dst.py + (self.bzscroll.getNow() * self.dst.ay) : self.newscrolly; - var dr = sc - sy; - if ((dr < 0 && sc < self.newscrolly) || (dr > 0 && sc > self.newscrolly)) sc = self.newscrolly; - self.setScrollTop(sc); - if (sc == self.newscrolly) done = 1; - } else { - done = 1; - } - - var scx = sx = self.getScrollLeft(); - if (self.dst.ax) { - scx = (self.bzscroll) ? self.dst.px + (self.bzscroll.getNow() * self.dst.ax) : self.newscrollx; - var dr = scx - sx; - if ((dr < 0 && scx < self.newscrollx) || (dr > 0 && scx > self.newscrollx)) scx = self.newscrollx; - self.setScrollLeft(scx); - if (scx == self.newscrollx) done += 1; - } else { - done += 1; - } - - if (done == 2) { - self.timer = 0; - self.cursorfreezed = false; - self.bzscroll = false; - self.scrollrunning = false; - if (sc < 0) sc = 0; - else if (sc > self.page.maxh) sc = Math.max(0, self.page.maxh); - if (scx < 0) scx = 0; - else if (scx > self.page.maxw) scx = self.page.maxw; - if ((scx != self.newscrollx) || (sc != self.newscrolly)) self.doScrollPos(scx, sc); - else { - if (self.onscrollend) { - self.triggerScrollEnd(); - } - } - } else { - self.timer = setAnimationFrame(scrolling) || 1; - } - } - self.cancelAnimationFrame = false; - self.timer = 1; - - if (self.onscrollstart && !self.scrollrunning) { - self.triggerScrollStart(px,py,x,y,ms); - } - - scrolling(); - - if ((py == self.page.maxh && y >= py) || (px == self.page.maxw && x >= px)) self.checkContentSize(); - - self.noticeCursor(); - }; - - this.cancelScroll = function () { - if (self.timer) clearAnimationFrame(self.timer); - self.timer = 0; - self.bzscroll = false; - self.scrollrunning = false; - return self; - }; - - } - - this.doScrollBy = function (stp, relative) { - var ny = 0; - - if (relative) { - ny = Math.floor((self.scroll.y - stp) * self.scrollratio.y); - } else { - var sy = (self.timer) ? self.newscrolly : self.getScrollTop(true); - ny = sy - stp; - } - if (self.bouncescroll) { - var haf = Math.round(self.view.h / 2); - if (ny < -haf) ny = -haf; - else if (ny > (self.page.maxh + haf)) ny = (self.page.maxh + haf); - } - self.cursorfreezed = false; - - var py = self.getScrollTop(true); - if (ny < 0 && py <= 0) return self.noticeCursor(); - else if (ny > self.page.maxh && py >= self.page.maxh) { - self.checkContentSize(); - return self.noticeCursor(); - } - - self.doScrollTop(ny); - }; - - this.doScrollLeftBy = function (stp, relative) { - var nx = 0; - if (relative) { - nx = Math.floor((self.scroll.x - stp) * self.scrollratio.x); - } else { - var sx = (self.timer) ? self.newscrollx : self.getScrollLeft(true); - nx = sx - stp; - } - if (self.bouncescroll) { - var haf = Math.round(self.view.w / 2); - if (nx < -haf) nx = -haf; - else if (nx > (self.page.maxw + haf)) nx = (self.page.maxw + haf); - } - self.cursorfreezed = false; - - var px = self.getScrollLeft(true); - if (nx < 0 && px <= 0) return self.noticeCursor(); - else if (nx > self.page.maxw && px >= self.page.maxw) return self.noticeCursor(); - - self.doScrollLeft(nx); - }; - - this.doScrollTo = function (pos, relative) { - var ny = (relative) ? Math.round(pos * self.scrollratio.y) : pos; - if (ny < 0) ny = 0; - else if (ny > self.page.maxh) ny = self.page.maxh; - self.cursorfreezed = false; - self.doScrollTop(pos); - }; - - this.checkContentSize = function () { - var pg = self.getContentSize(); - if ((pg.h != self.page.h) || (pg.w != self.page.w)) self.resize(false, pg); - }; - - self.onscroll = function (e) { - if (self.rail.drag) return; - if (!self.cursorfreezed) { - self.synched('scroll', function () { - self.scroll.y = Math.round(self.getScrollTop() * (1 / self.scrollratio.y)); - if (self.railh) self.scroll.x = Math.round(self.getScrollLeft() * (1 / self.scrollratio.x)); - self.noticeCursor(); - }); - } - //self.triggerScrollEnd(); - }; - self.bind(self.docscroll, "scroll", self.onscroll); - - this.doZoomIn = function (e) { - if (self.zoomactive) return; - self.zoomactive = true; - - self.zoomrestore = { - style: {} - }; - var lst = ['position', 'top', 'left', 'zIndex', 'backgroundColor', 'marginTop', 'marginBottom', 'marginLeft', 'marginRight']; - var win = self.win[0].style; - for (var a in lst) { - var pp = lst[a]; - self.zoomrestore.style[pp] = (win[pp] !== undefined) ? win[pp] : ''; - } - - self.zoomrestore.style.width = self.win.css('width'); - self.zoomrestore.style.height = self.win.css('height'); - - self.zoomrestore.padding = { - w: self.win.outerWidth() - self.win.width(), - h: self.win.outerHeight() - self.win.height() - }; - - if (cap.isios4) { - self.zoomrestore.scrollTop = $window.scrollTop(); - $window.scrollTop(0); - } - - self.win.css({ - position: (cap.isios4) ? "absolute" : "fixed", - top: 0, - left: 0, - zIndex: globalmaxzindex + 100, - margin: 0 - }); - var bkg = self.win.css("backgroundColor"); - if (bkg == "" || /transparent|rgba\(0, 0, 0, 0\)|rgba\(0,0,0,0\)/.test(bkg)) self.win.css("backgroundColor", "#fff"); - self.rail.css({ - zIndex: globalmaxzindex + 101 - }); - self.zoom.css({ - zIndex: globalmaxzindex + 102 - }); - self.zoom.css('backgroundPosition', '0 -18px'); - self.resizeZoom(); - - if (self.onzoomin) self.onzoomin.call(self); - - return self.cancelEvent(e); - }; - - this.doZoomOut = function (e) { - if (!self.zoomactive) return; - self.zoomactive = false; - - self.win.css("margin", ""); - self.win.css(self.zoomrestore.style); - - if (cap.isios4) { - $window.scrollTop(self.zoomrestore.scrollTop); - } - - self.rail.css({ - "z-index": self.zindex - }); - self.zoom.css({ - "z-index": self.zindex - }); - self.zoomrestore = false; - self.zoom.css('backgroundPosition', '0 0'); - self.onResize(); - - if (self.onzoomout) self.onzoomout.call(self); - - return self.cancelEvent(e); - }; - - this.doZoom = function (e) { - return (self.zoomactive) ? self.doZoomOut(e) : self.doZoomIn(e); - }; - - this.resizeZoom = function () { - if (!self.zoomactive) return; - - var py = self.getScrollTop(); //preserve scrolling position - self.win.css({ - width: $window.width() - self.zoomrestore.padding.w + "px", - height: $window.height() - self.zoomrestore.padding.h + "px" - }); - self.onResize(); - - self.setScrollTop(Math.min(self.page.maxh, py)); - }; - - this.init(); - - $.nicescroll.push(this); - - }; - - // Inspired by the work of Kin Blas - // http://webpro.host.adobe.com/people/jblas/momentum/includes/jquery.momentum.0.7.js - - - var ScrollMomentumClass2D = function (nc) { - var self = this; - this.nc = nc; - - 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.reset = function (px, py) { - self.stop(); - self.steptime = 0; - self.lasttime = now(); - self.speedx = 0; - self.speedy = 0; - self.lastx = px; - self.lasty = py; - self.lastscrollx = -1; - self.lastscrolly = -1; - }; - - this.update = function (px, py) { - var tm = now(); - self.steptime = tm - self.lasttime; - self.lasttime = tm; - var dy = py - self.lasty; - var dx = px - self.lastx; - var sy = self.nc.getScrollTop(); - var sx = self.nc.getScrollLeft(); - var newy = sy + dy; - var newx = sx + dx; - self.snapx = (newx < 0) || (newx > self.nc.page.maxw); - self.snapy = (newy < 0) || (newy > self.nc.page.maxh); - self.speedx = dx; - self.speedy = dy; - self.lastx = px; - self.lasty = py; - }; - - this.stop = function () { - self.nc.unsynched("domomentum2d"); - if (self.timer) clearTimeout(self.timer); - self.timer = 0; - self.lastscrollx = -1; - self.lastscrolly = -1; - }; - - this.doSnapy = function (nx, ny) { - var snap = false; - - if (ny < 0) { - ny = 0; - snap = true; - } else if (ny > self.nc.page.maxh) { - ny = self.nc.page.maxh; - snap = true; - } - - if (nx < 0) { - nx = 0; - snap = true; - } else if (nx > self.nc.page.maxw) { - nx = self.nc.page.maxw; - snap = true; - } - - (snap) ? self.nc.doScrollPos(nx, ny, self.nc.opt.snapbackspeed) : self.nc.triggerScrollEnd(); - }; - - this.doMomentum = function (gp) { - var t = now(); - var l = (gp) ? t + gp : self.lasttime; - - var sl = self.nc.getScrollLeft(); - var st = self.nc.getScrollTop(); - - var pageh = self.nc.page.maxh; - var pagew = self.nc.page.maxw; - - self.speedx = (pagew > 0) ? Math.min(60, self.speedx) : 0; - self.speedy = (pageh > 0) ? Math.min(60, self.speedy) : 0; - - var chk = l && (t - l) <= 60; - - if ((st < 0) || (st > pageh) || (sl < 0) || (sl > pagew)) chk = false; - - var sy = (self.speedy && chk) ? self.speedy : false; - var sx = (self.speedx && chk) ? self.speedx : false; - - if (sy || sx) { - var tm = Math.max(16, self.steptime); //timeout granularity - - if (tm > 50) { // do smooth - var xm = tm / 50; - self.speedx *= xm; - self.speedy *= xm; - tm = 50; - } - - self.demulxy = 0; - - self.lastscrollx = self.nc.getScrollLeft(); - self.chkx = self.lastscrollx; - self.lastscrolly = self.nc.getScrollTop(); - self.chky = self.lastscrolly; - - var nx = self.lastscrollx; - var ny = self.lastscrolly; - - var onscroll = function () { - var df = ((now() - t) > 600) ? 0.04 : 0.02; - - if (self.speedx) { - nx = Math.floor(self.lastscrollx - (self.speedx * (1 - self.demulxy))); - self.lastscrollx = nx; - if ((nx < 0) || (nx > pagew)) df = 0.10; - } - - if (self.speedy) { - ny = Math.floor(self.lastscrolly - (self.speedy * (1 - self.demulxy))); - self.lastscrolly = ny; - if ((ny < 0) || (ny > pageh)) df = 0.10; - } - - self.demulxy = Math.min(1, self.demulxy + df); - - self.nc.synched("domomentum2d", function () { - - if (self.speedx) { - var scx = self.nc.getScrollLeft(); - // if (scx != self.chkx) self.stop(); - self.chkx = nx; - self.nc.setScrollLeft(nx); - } - - if (self.speedy) { - var scy = self.nc.getScrollTop(); - // if (scy != self.chky) self.stop(); - self.chky = ny; - self.nc.setScrollTop(ny); - } - - if (!self.timer) { - self.nc.hideCursor(); - self.doSnapy(nx, ny); - } - - }); - - if (self.demulxy < 1) { - self.timer = setTimeout(onscroll, tm); - } else { - self.stop(); - self.nc.hideCursor(); - self.doSnapy(nx, ny); - } - }; - - onscroll(); - - } else { - self.doSnapy(self.nc.getScrollLeft(), self.nc.getScrollTop()); - } - - }; - - }; - - - // override jQuery scrollTop - - var _scrollTop = jQuery.fn.scrollTop; // preserve original function - - jQuery.cssHooks.pageYOffset = { - get: function (elem, computed, extra) { - var nice = $.data(elem, '__nicescroll') || false; - return (nice && nice.ishwscroll) ? nice.getScrollTop() : _scrollTop.call(elem); - }, - set: function (elem, value) { - var nice = $.data(elem, '__nicescroll') || false; - (nice && nice.ishwscroll) ? nice.setScrollTop(parseInt(value)) : _scrollTop.call(elem, value); - return this; - } - }; - - /* - $.fx.step["scrollTop"] = function(fx){ - $.cssHooks["scrollTop"].set( fx.elem, fx.now + fx.unit ); - }; -*/ - - jQuery.fn.scrollTop = function (value) { - if (value === undefined) { - var nice = (this[0]) ? $.data(this[0], '__nicescroll') || false : false; - return (nice && nice.ishwscroll) ? nice.getScrollTop() : _scrollTop.call(this); - } else { - return this.each(function () { - var nice = $.data(this, '__nicescroll') || false; - (nice && nice.ishwscroll) ? nice.setScrollTop(parseInt(value)) : _scrollTop.call($(this), value); - }); - } - }; - - // override jQuery scrollLeft - - var _scrollLeft = jQuery.fn.scrollLeft; // preserve original function - - $.cssHooks.pageXOffset = { - get: function (elem, computed, extra) { - var nice = $.data(elem, '__nicescroll') || false; - return (nice && nice.ishwscroll) ? nice.getScrollLeft() : _scrollLeft.call(elem); - }, - set: function (elem, value) { - var nice = $.data(elem, '__nicescroll') || false; - (nice && nice.ishwscroll) ? nice.setScrollLeft(parseInt(value)) : _scrollLeft.call(elem, value); - return this; - } - }; - - /* - $.fx.step["scrollLeft"] = function(fx){ - $.cssHooks["scrollLeft"].set( fx.elem, fx.now + fx.unit ); - }; -*/ - - jQuery.fn.scrollLeft = function (value) { - if (value === undefined) { - var nice = (this[0]) ? $.data(this[0], '__nicescroll') || false : false; - return (nice && nice.ishwscroll) ? nice.getScrollLeft() : _scrollLeft.call(this); - } else { - return this.each(function () { - var nice = $.data(this, '__nicescroll') || false; - (nice && nice.ishwscroll) ? nice.setScrollLeft(parseInt(value)) : _scrollLeft.call($(this), value); - }); - } - }; - - var NiceScrollArray = function (doms) { - var self = this; - this.length = 0; - this.name = "nicescrollarray"; - - this.each = function (fn) { - $.each(self, fn); - return self; - }; - - this.push = function (nice) { - self[self.length] = nice; - self.length++; - }; - - this.eq = function (idx) { - return self[idx]; - }; - - if (doms) { - for (var a = 0; a < doms.length; a++) { - var nice = $.data(doms[a], '__nicescroll') || false; - if (nice) { - this[this.length] = nice; - this.length++; - } - } - } - - return this; - }; - - function mplex(el, lst, fn) { - for (var a = 0, l = lst.length; a < l; a++) fn(el, lst[a]); - } - mplex( - NiceScrollArray.prototype, ['show', 'hide', 'toggle', 'onResize', 'resize', 'remove', 'stop', 'doScrollPos'], - function (e, n) { - e[n] = function () { - var args = arguments; - return this.each(function () { - this[n].apply(this, args); - }); - }; - } - ); - - jQuery.fn.getNiceScroll = function (index) { - if (index === undefined) { - return new NiceScrollArray(this); - } else { - return this[index] && $.data(this[index], '__nicescroll') || false; - } - }; - - jQuery.expr[':'].nicescroll = function (a) { - return $.data(a, '__nicescroll') !== undefined; - }; - - $.fn.niceScroll = function (wrapper, _opt) { - if (_opt === undefined && typeof wrapper == "object" && !("jquery" in wrapper)) { - _opt = wrapper; - wrapper = false; - } - - var ret = new NiceScrollArray(); - - this.each(function () { - var $this = $(this); - - var opt = $.extend({}, _opt); // cloning - - if (wrapper || false) { - var wrp = $(wrapper); - opt.doc = (wrp.length > 1) ? $(wrapper, $this) : wrp; - opt.win = $this; - } - var docundef = !("doc" in opt); - if (!docundef && !("win" in opt)) opt.win = $this; - - var nice = $this.data('__nicescroll') || false; - if (!nice) { - opt.doc = opt.doc || $this; - nice = new NiceScrollClass(opt, $this); - $this.data('__nicescroll', nice); - } - ret.push(nice); - }); - - return (ret.length === 1) ? ret[0] : ret; - }; - - window.NiceScroll = { - getjQuery: function () { - return jQuery; - } - }; - - if (!$.nicescroll) { - $.nicescroll = new NiceScrollArray(); - $.nicescroll.options = _globaloptions; - } - -})); - diff --git a/dist/jquery.nicescroll.min.js b/dist/jquery.nicescroll.min.js deleted file mode 100644 index b16abae..0000000 --- a/dist/jquery.nicescroll.min.js +++ /dev/null @@ -1,2 +0,0 @@ -/* nicescroll v3.7.3 InuYaksa - MIT - https://nicescroll.areaaperta.com */ -!function(e){"function"==typeof define&&define.amd?define(["jquery"],e):"object"==typeof exports?module.exports=e(require("jquery")):e(jQuery)}(function(e){"use strict";var o=!1,t=!1,r=0,i=2e3,s=0,n=e,l=document,a=n(window),c=function(){return window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||!1}(),d=function(){return window.cancelAnimationFrame||window.webkitCancelAnimationFrame||window.mozCancelAnimationFrame||!1}();if(c)window.cancelAnimationFrame||(d=function(e){});else{var u=0;c=function(e,o){var t=(new Date).getTime(),r=Math.max(0,16-(t-u)),i=window.setTimeout(function(){e(t+r)},r);return u=t+r,i},d=function(e){window.clearTimeout(e)}}var h=window.MutationObserver||window.WebKitMutationObserver||!1,p=Date.now||function(){return(new Date).getTime()},m={zindex:"auto",cursoropacitymin:0,cursoropacitymax:1,cursorcolor:"#424242",cursorwidth:"6px",cursorborder:"1px solid #fff",cursorborderradius:"5px",scrollspeed:60,mousescrollstep:24,touchbehavior:!1,emulatetouch:!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 e=l.currentScript||function(){var e=l.getElementsByTagName("script");return!!e.length&&e[e.length-1]}(),o=e?e.src.split("?")[0]:"";return o.split("/").length>0?o.split("/").slice(0,-1).join("/")+"/":""}(),preventmultitouchscrolling:!0,disablemutationobserver:!1,enableobserver:!0,scrollbarid:!1},f=!1,g=function(){if(f)return f;var e=l.createElement("DIV"),o=e.style,t=navigator.userAgent,r=navigator.platform,i={};return i.haspointerlock="pointerLockElement"in l||"webkitPointerLockElement"in l||"mozPointerLockElement"in l,i.isopera="opera"in window,i.isopera12=i.isopera&&"getUserMedia"in navigator,i.isoperamini="[object OperaMini]"===Object.prototype.toString.call(window.operamini),i.isie="all"in l&&"attachEvent"in e&&!i.isopera,i.isieold=i.isie&&!("msInterpolationMode"in o),i.isie7=i.isie&&!i.isieold&&(!("documentMode"in l)||7===l.documentMode),i.isie8=i.isie&&"documentMode"in l&&8===l.documentMode,i.isie9=i.isie&&"performance"in window&&9===l.documentMode,i.isie10=i.isie&&"performance"in window&&10===l.documentMode,i.isie11="msRequestFullscreen"in e&&l.documentMode>=11,i.ismsedge="msCredentials"in window,i.ismozilla="MozAppearance"in o,i.iswebkit=!i.ismsedge&&"WebkitAppearance"in o,i.ischrome=i.iswebkit&&"chrome"in window,i.ischrome38=i.ischrome&&"touchAction"in o,i.ischrome22=!i.ischrome38&&i.ischrome&&i.haspointerlock,i.ischrome26=!i.ischrome38&&i.ischrome&&"transition"in o,i.cantouch="ontouchstart"in l.documentElement||"ontouchstart"in window,i.hasw3ctouch=(window.PointerEvent||!1)&&(navigator.MaxTouchPoints>0||navigator.msMaxTouchPoints>0),i.hasmstouch=!i.hasw3ctouch&&(window.MSPointerEvent||!1),i.ismac=/^mac$/i.test(r),i.isios=i.cantouch&&/iphone|ipad|ipod/i.test(r),i.isios4=i.isios&&!("seal"in Object),i.isios7=i.isios&&"webkitHidden"in l,i.isios8=i.isios&&"hidden"in l,i.isios10=i.isios&&window.Proxy,i.isandroid=/android/i.test(t),i.haseventlistener="addEventListener"in e,i.trstyle=!1,i.hastransform=!1,i.hastranslate3d=!1,i.transitionstyle=!1,i.hastransition=!1,i.transitionend=!1,i.trstyle="transform",i.hastransform="transform"in o||function(){for(var e=["msTransform","webkitTransform","MozTransform","OTransform"],t=0,r=e.length;t0;){if(9==e[0].nodeType)return!1;var o=e.css("zIndex");if(!isNaN(o)&&0!=o)return parseInt(o);e=e.parent()}return!1}function b(e,o,t){var r=e.css(o),i=parseFloat(r);if(isNaN(i)){var s=3==(i=P[r]||0)?t?S.win.outerHeight()-S.win.innerHeight():S.win.outerWidth()-S.win.innerWidth():1;return S.isie8&&i&&(i+=1),s?i:0}return i}function y(e,o,t,r){S._bind(e,o,function(r){var i={original:r=r||window.event,target:r.target||r.srcElement,type:"wheel",deltaMode:"MozMousePixelScroll"==r.type?0:1,deltaX:0,deltaZ:0,preventDefault:function(){return r.preventDefault?r.preventDefault():r.returnValue=!1,!1},stopImmediatePropagation:function(){r.stopImmediatePropagation?r.stopImmediatePropagation():r.cancelBubble=!0}};return"mousewheel"==o?(r.wheelDeltaX&&(i.deltaX=-.025*r.wheelDeltaX),r.wheelDeltaY&&(i.deltaY=-.025*r.wheelDeltaY),!i.deltaY&&!i.deltaX&&(i.deltaY=-.025*r.wheelDelta)):i.deltaY=r.detail,t.call(e,i)},r)}function x(e,o,t){var r,i;if(0==e.deltaMode?(r=-Math.floor(e.deltaX*(S.opt.mousescrollstep/54)),i=-Math.floor(e.deltaY*(S.opt.mousescrollstep/54))):1==e.deltaMode&&(r=-Math.floor(e.deltaX*S.opt.mousescrollstep),i=-Math.floor(e.deltaY*S.opt.mousescrollstep)),o&&S.opt.oneaxismousemode&&0===r&&i&&(r=i,i=0,t&&(r<0?S.getScrollLeft()>=S.page.maxw:S.getScrollLeft()<=0)&&(i=r,r=0)),S.isrtlmode&&(r=-r),r){if(S.scrollmom)S.scrollmom.stop();else if(r<0){if(S.getScrollLeft()>=S.page.maxw)return!0}else if(S.getScrollLeft()<=0)return!0;S.lastdeltax+=r,S.debounced("mousewheelx",function(){var e=S.lastdeltax;S.lastdeltax=0,S.rail.drag||S.doScrollLeftBy(e)},15)}if(i){if(S.opt.nativeparentscrolling&&t&&!S.ispage&&!S.zoomactive)if(i<0){if(S.getScrollTop()>=S.page.maxh)return!0}else if(S.getScrollTop()<=0)return!0;S.scrollmom&&S.scrollmom.stop(),S.lastdeltay+=i,S.synched("mousewheely",function(){var e=S.lastdeltay;S.lastdeltay=0,S.rail.drag||S.doScrollBy(e)},15)}return e.stopImmediatePropagation(),e.preventDefault()}var S=this;this.version="3.7.3",this.name="nicescroll",this.me=u;var z=n("body");if(this.opt={doc:z,win:!1},n.extend(this.opt,m),this.opt.snapbackspeed=80,e)for(var k in S.opt)void 0!==e[k]&&(S.opt[k]=e[k]);if(S.opt.disablemutationobserver&&(h=!1),this.doc=S.opt.doc,this.iddoc=this.doc&&this.doc[0]?this.doc[0].id||"":"",this.ispage=/^BODY|HTML/.test(S.opt.win?S.opt.win[0].nodeName:this.doc[0].nodeName),this.haswrapper=!1!==S.opt.win,this.win=S.opt.win||(this.ispage?a:this.doc),this.docscroll=this.ispage&&!this.haswrapper?a:this.win,this.body=z,this.viewport=!1,this.isfixed=!1,this.iframe=!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"!=S.opt.autohidemode,this.onmousedown=!1,this.onmouseup=!1,this.onmousemove=!1,this.onmousewheel=!1,this.onkeypress=!1,this.ongesturezoom=!1,this.onclick=!1,this.onscrollstart=!1,this.onscrollend=!1,this.onscrollcancel=!1,this.onzoomin=!1,this.onzoomout=!1,this.view=!1,this.page=!1,this.scroll={x:0,y:0},this.scrollratio={x:0,y:0},this.cursorheight=20,this.scrollvaluemax=0,"auto"==this.opt.rtlmode){var T=this.win[0]==window?this.body:this.win,M=T.css("writing-mode")||T.css("-webkit-writing-mode")||T.css("-ms-writing-mode")||T.css("-moz-writing-mode");"horizontal-tb"==M||"lr-tb"==M||""==M?(this.isrtlmode="rtl"==T.css("direction"),this.isvertical=!1):(this.isrtlmode="vertical-rl"==M||"tb"==M||"tb-rl"==M||"rl-tb"==M,this.isvertical="vertical-rl"==M||"tb"==M||"tb-rl"==M)}else this.isrtlmode=!0===this.opt.rtlmode,this.isvertical=!1;if(this.scrollrunning=!1,this.scrollmom=!1,this.observer=!1,this.observerremover=!1,this.observerbody=!1,!1===S.opt.scrollbarid)do{this.id="ascrail"+i++}while(l.getElementById(this.id));else this.id=S.opt.scrollbarid;this.rail=!1,this.cursor=!1,this.cursorfreezed=!1,this.selectiondrag=!1,this.zoom=!1,this.zoomactive=!1,this.hasfocus=!1,this.hasmousefocus=!1,this.visibility=!0,this.railslocked=!1,this.locked=!1,this.hidden=!1,this.cursoractive=!0,this.wheelprevented=!1,this.overflowx=S.opt.overflowx,this.overflowy=S.opt.overflowy,this.nativescrollingarea=!1,this.checkarea=0,this.events=[],this.saved={},this.delaylist={},this.synclist={},this.lastdeltax=0,this.lastdeltay=0,this.detected=g();var E=n.extend({},this.detected);this.canhwscroll=E.hastransform&&S.opt.hwacceleration,this.ishwscroll=this.canhwscroll&&S.haswrapper,this.isrtlmode?this.isvertical?this.hasreversehr=!(E.iswebkit||E.isie||E.isie11):this.hasreversehr=!(E.iswebkit||E.isie&&!E.isie10&&!E.isie11):this.hasreversehr=!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,S.opt.enablemouselockapi||(E.hasmousecapture=!1,E.haspointerlock=!1),this.debounced=function(e,o,t){S&&(S.delaylist[e]||!1||(S.delaylist[e]={h:c(function(){S.delaylist[e].fn.call(S),S.delaylist[e]=!1},t)},o.call(S)),S.delaylist[e].fn=o)};var L=!1;this.synched=function(e,o){return S.synclist[e]=o,function(){L||(c(function(){if(S){L=!1;for(var e in S.synclist){var o=S.synclist[e];o&&o.call(S),S.synclist[e]=!1}}}),L=!0)}(),e},this.unsynched=function(e){S.synclist[e]&&(S.synclist[e]=!1)},this.css=function(e,o){for(var t in o)S.saved.css.push([e,t,e.css(t)]),e.css(t,o[t])},this.scrollTop=function(e){return void 0===e?S.getScrollTop():S.setScrollTop(e)},this.scrollLeft=function(e){return void 0===e?S.getScrollLeft():S.setScrollLeft(e)};var C=function(e,o,t,r,i,s,n){this.st=e,this.ed=o,this.spd=t,this.p1=r||0,this.p2=i||1,this.p3=s||0,this.p4=n||1,this.ts=p(),this.df=this.ed-this.st};if(C.prototype={B2:function(e){return 3*e*e*(1-e)},B3:function(e){return 3*e*(1-e)*(1-e)},B4:function(e){return(1-e)*(1-e)*(1-e)},getNow:function(){var e=1-(p()-this.ts)/this.spd,o=this.B2(e)+this.B3(e)+this.B4(e);return e<0?this.ed:this.st+Math.round(this.df*o)},update:function(e,o){return this.st=this.getNow(),this.ed=e,this.spd=o,this.ts=p(),this.df=this.ed-this.st,this}},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(e){if(!e){var o=f();if(o)return 16==o.length?-o[13]:-o[5];if(S.timerscroll&&S.timerscroll.bz)return S.timerscroll.bz.getNow()}return S.doc.translate.y},this.getScrollLeft=function(e){if(!e){var o=f();if(o)return 16==o.length?-o[12]:-o[4];if(S.timerscroll&&S.timerscroll.bh)return S.timerscroll.bh.getNow()}return S.doc.translate.x},this.notifyScrollEvent=function(e){var o=l.createEvent("UIEvents");o.initUIEvent("scroll",!1,!0,window,1),o.niceevent=!0,e.dispatchEvent(o)};var N=this.isrtlmode?1:-1;E.hastranslate3d&&S.opt.enabletranslate3d?(this.setScrollTop=function(e,o){S.doc.translate.y=e,S.doc.translate.ty=-1*e+"px",S.doc.css(E.trstyle,"translate3d("+S.doc.translate.tx+","+S.doc.translate.ty+",0)"),o||S.notifyScrollEvent(S.win[0])},this.setScrollLeft=function(e,o){S.doc.translate.x=e,S.doc.translate.tx=e*N+"px",S.doc.css(E.trstyle,"translate3d("+S.doc.translate.tx+","+S.doc.translate.ty+",0)"),o||S.notifyScrollEvent(S.win[0])}):(this.setScrollTop=function(e,o){S.doc.translate.y=e,S.doc.translate.ty=-1*e+"px",S.doc.css(E.trstyle,"translate("+S.doc.translate.tx+","+S.doc.translate.ty+")"),o||S.notifyScrollEvent(S.win[0])},this.setScrollLeft=function(e,o){S.doc.translate.x=e,S.doc.translate.tx=e*N+"px",S.doc.css(E.trstyle,"translate("+S.doc.translate.tx+","+S.doc.translate.ty+")"),o||S.notifyScrollEvent(S.win[0])})}else this.getScrollTop=function(){return S.docscroll.scrollTop()},this.setScrollTop=function(e){return setTimeout(function(){S&&S.docscroll.scrollTop(e)},1)},this.getScrollLeft=function(){return S.hasreversehr?S.detected.ismozilla?S.page.maxw-Math.abs(S.docscroll.scrollLeft()):S.page.maxw-S.docscroll.scrollLeft():S.docscroll.scrollLeft()},this.setScrollLeft=function(e){return setTimeout(function(){if(S)return S.hasreversehr&&(e=S.detected.ismozilla?-(S.page.maxw-e):S.page.maxw-e),S.docscroll.scrollLeft(e)},1)};this.getTarget=function(e){return!!e&&(e.target?e.target:!!e.srcElement&&e.srcElement)},this.hasParent=function(e,o){if(!e)return!1;for(var t=e.target||e.srcElement||e||!1;t&&t.id!=o;)t=t.parentNode||!1;return!1!==t};var P={thin:1,medium:3,thick:5};this.getDocumentScrollOffset=function(){return{top:window.pageYOffset||l.documentElement.scrollTop,left:window.pageXOffset||l.documentElement.scrollLeft}},this.getOffset=function(){if(S.isfixed){var e=S.win.offset(),o=S.getDocumentScrollOffset();return e.top-=o.top,e.left-=o.left,e}var t=S.win.offset();if(!S.viewport)return t;var r=S.viewport.offset();return{top:t.top-r.top,left:t.left-r.left}},this.updateScrollBar=function(e){var o,t;if(S.ishwscroll)S.rail.css({height:S.win.innerHeight()-(S.opt.railpadding.top+S.opt.railpadding.bottom)}),S.railh&&S.railh.css({width:S.win.innerWidth()-(S.opt.railpadding.left+S.opt.railpadding.right)});else{var r=S.getOffset();if(o={top:r.top,left:r.left-(S.opt.railpadding.left+S.opt.railpadding.right)},o.top+=b(S.win,"border-top-width",!0),o.left+=S.rail.align?S.win.outerWidth()-b(S.win,"border-right-width")-S.rail.width:b(S.win,"border-left-width"),(t=S.opt.railoffset)&&(t.top&&(o.top+=t.top),t.left&&(o.left+=t.left)),S.railslocked||S.rail.css({top:o.top,left:o.left,height:(e?e.h:S.win.innerHeight())-(S.opt.railpadding.top+S.opt.railpadding.bottom)}),S.zoom&&S.zoom.css({top:o.top+1,left:1==S.rail.align?o.left-20:o.left+S.rail.width+4}),S.railh&&!S.railslocked){o={top:r.top,left:r.left},(t=S.opt.railhoffset)&&(t.top&&(o.top+=t.top),t.left&&(o.left+=t.left));var i=S.railh.align?o.top+b(S.win,"border-top-width",!0)+S.win.innerHeight()-S.railh.height:o.top+b(S.win,"border-top-width",!0),s=o.left+b(S.win,"border-left-width");S.railh.css({top:i-(S.opt.railpadding.top+S.opt.railpadding.bottom),left:s,width:S.railh.width})}}},this.doRailClick=function(e,o,t){var r,i,s,n;S.railslocked||(S.cancelEvent(e),"pageY"in e||(e.pageX=e.clientX+l.documentElement.scrollLeft,e.pageY=e.clientY+l.documentElement.scrollTop),o?(r=t?S.doScrollLeft:S.doScrollTop)(s=t?(e.pageX-S.railh.offset().left-S.cursorwidth/2)*S.scrollratio.x:(e.pageY-S.rail.offset().top-S.cursorheight/2)*S.scrollratio.y):(r=t?S.doScrollLeftBy:S.doScrollBy,s=t?S.scroll.x:S.scroll.y,n=t?e.pageX-S.railh.offset().left:e.pageY-S.rail.offset().top,i=t?S.view.w:S.view.h,r(s>=n?i:-i)))},S.hasanimationframe="requestAnimationFrame"in window,S.hascancelanimationframe="cancelAnimationFrame"in window,this.init=function(){if(S.saved.css=[],E.isoperamini)return!0;if(E.isandroid&&!("hidden"in l))return!0;S.opt.emulatetouch=S.opt.emulatetouch||S.opt.touchbehavior;var e={"overflow-y":"hidden"};if((E.isie11||E.isie10)&&(e["-ms-overflow-style"]="none"),S.zindex="auto",S.ispage||"auto"!=S.opt.zindex?S.zindex=S.opt.zindex:S.zindex=w()||"auto",!S.ispage&&"auto"!=S.zindex&&S.zindex>s&&(s=S.zindex),S.isie&&0==S.zindex&&"auto"==S.opt.zindex&&(S.zindex="auto"),!S.ispage||!E.cantouch&&!E.isieold){var i=S.docscroll;S.ispage&&(i=S.haswrapper?S.win:S.doc),S.css(i,e),S.ispage&&(E.isie11||E.isie)&&S.css(n("html"),e),!E.isios||S.ispage||S.haswrapper||S.css(z,{"-webkit-overflow-scrolling":"touch"});var c=n(l.createElement("div"));c.css({position:"relative",top:0,float:"right",width:S.opt.cursorwidth,height:0,"background-color":S.opt.cursorcolor,border:S.opt.cursorborder,"background-clip":"padding-box","-webkit-border-radius":S.opt.cursorborderradius,"-moz-border-radius":S.opt.cursorborderradius,"border-radius":S.opt.cursorborderradius}),c.addClass("nicescroll-cursors"),S.cursor=c;var d=n(l.createElement("div"));d.attr("id",S.id),d.addClass("nicescroll-rails nicescroll-rails-vr");var u,p,m=["left","right","top","bottom"];for(var f in m)p=m[f],(u=S.opt.railpadding[p])?d.css("padding-"+p,u+"px"):S.opt.railpadding[p]=0;d.append(c),d.width=Math.max(parseFloat(S.opt.cursorwidth),c.outerWidth()),d.css({width:d.width+"px",zIndex:S.zindex,background:S.opt.background,cursor:"default"}),d.visibility=!0,d.scrollable=!0,d.align="left"==S.opt.railalign?0:1,S.rail=d,S.rail.drag=!1;var g=!1;!S.opt.boxzoom||S.ispage||E.isieold||(g=l.createElement("div"),S.bind(g,"click",S.doZoom),S.bind(g,"mouseenter",function(){S.zoom.css("opacity",S.opt.cursoropacitymax)}),S.bind(g,"mouseleave",function(){S.zoom.css("opacity",S.opt.cursoropacitymin)}),S.zoom=n(g),S.zoom.css({cursor:"pointer",zIndex:S.zindex,backgroundImage:"url("+S.opt.scriptpath+"zoomico.png)",height:18,width:18,backgroundPosition:"0 0"}),S.opt.dblclickzoom&&S.bind(S.win,"dblclick",S.doZoom),E.cantouch&&S.opt.gesturezoom&&(S.ongesturezoom=function(e){return e.scale>1.5&&S.doZoomIn(e),e.scale<.8&&S.doZoomOut(e),S.cancelEvent(e)},S.bind(S.win,"gestureend",S.ongesturezoom))),S.railh=!1;var b;if(S.opt.horizrailenabled&&(S.css(i,{overflowX:"hidden"}),(c=n(l.createElement("div"))).css({position:"absolute",top:0,height:S.opt.cursorwidth,width:0,backgroundColor:S.opt.cursorcolor,border:S.opt.cursorborder,backgroundClip:"padding-box","-webkit-border-radius":S.opt.cursorborderradius,"-moz-border-radius":S.opt.cursorborderradius,"border-radius":S.opt.cursorborderradius}),E.isieold&&c.css("overflow","hidden"),c.addClass("nicescroll-cursors"),S.cursorh=c,(b=n(l.createElement("div"))).attr("id",S.id+"-hr"),b.addClass("nicescroll-rails nicescroll-rails-hr"),b.height=Math.max(parseFloat(S.opt.cursorwidth),c.outerHeight()),b.css({height:b.height+"px",zIndex:S.zindex,background:S.opt.background}),b.append(c),b.visibility=!0,b.scrollable=!0,b.align="top"==S.opt.railvalign?0:1,S.railh=b,S.railh.drag=!1),S.ispage)d.css({position:"fixed",top:0,height:"100%"}),d.align?d.css({right:0}):d.css({left:0}),S.body.append(d),S.railh&&(b.css({position:"fixed",left:0,width:"100%"}),b.align?b.css({bottom:0}):b.css({top:0}),S.body.append(b));else{if(S.ishwscroll){"static"==S.win.css("position")&&S.css(S.win,{position:"relative"});var y="HTML"==S.win[0].nodeName?S.body:S.win;n(y).scrollTop(0).scrollLeft(0),S.zoom&&(S.zoom.css({position:"absolute",top:1,right:0,"margin-right":d.width+4}),y.append(S.zoom)),d.css({position:"absolute",top:0}),d.align?d.css({right:0}):d.css({left:0}),y.append(d),b&&(b.css({position:"absolute",left:0,bottom:0}),b.align?b.css({bottom:0}):b.css({top:0}),y.append(b))}else{S.isfixed="fixed"==S.win.css("position");var x=S.isfixed?"fixed":"absolute";S.isfixed||(S.viewport=S.getViewport(S.win[0])),S.viewport&&(S.body=S.viewport,0==/fixed|absolute/.test(S.viewport.css("position"))&&S.css(S.viewport,{position:"relative"})),d.css({position:x}),S.zoom&&S.zoom.css({position:x}),S.updateScrollBar(),S.body.append(d),S.zoom&&S.body.append(S.zoom),S.railh&&(b.css({position:x}),S.body.append(b))}E.isios&&S.css(S.win,{"-webkit-tap-highlight-color":"rgba(0,0,0,0)","-webkit-touch-callout":"none"}),E.isie&&S.opt.disableoutline&&S.win.attr("hideFocus","true"),E.iswebkit&&S.opt.disableoutline&&S.win.css("outline","none")}if(!1===S.opt.autohidemode?(S.autohidedom=!1,S.rail.css({opacity:S.opt.cursoropacitymax}),S.railh&&S.railh.css({opacity:S.opt.cursoropacitymax})):!0===S.opt.autohidemode||"leave"===S.opt.autohidemode?(S.autohidedom=n().add(S.rail),E.isie8&&(S.autohidedom=S.autohidedom.add(S.cursor)),S.railh&&(S.autohidedom=S.autohidedom.add(S.railh)),S.railh&&E.isie8&&(S.autohidedom=S.autohidedom.add(S.cursorh))):"scroll"==S.opt.autohidemode?(S.autohidedom=n().add(S.rail),S.railh&&(S.autohidedom=S.autohidedom.add(S.railh))):"cursor"==S.opt.autohidemode?(S.autohidedom=n().add(S.cursor),S.railh&&(S.autohidedom=S.autohidedom.add(S.cursorh))):"hidden"==S.opt.autohidemode&&(S.autohidedom=!1,S.hide(),S.railslocked=!1),E.cantouch||S.istouchcapable||S.opt.emulatetouch||E.hasmstouch){S.scrollmom=new v(S),S.ontouchstart=function(e){if(e.pointerType&&2!=e.pointerType&&"touch"!=e.pointerType)return!1;if(S.hasmoving=!1,!S.railslocked){var o;if(E.hasmstouch)for(o=!!e.target&&e.target;o;){var t=n(o).getNiceScroll();if(t.length>0&&t[0].me==S.me)break;if(t.length>0)return!1;if("DIV"==o.nodeName&&o.id==S.id)break;o=!!o.parentNode&&o.parentNode}if(e.stopPropagation(),S.cancelScroll(),(o=S.getTarget(e))&&/INPUT/i.test(o.nodeName)&&/range/i.test(o.type))return S.stopPropagation(e);if(!("clientX"in e)&&"changedTouches"in e&&(e.clientX=e.changedTouches[0].clientX,e.clientY=e.changedTouches[0].clientY),S.forcescreen){var r=e;(e={original:e.original?e.original:e}).clientX=r.screenX,e.clientY=r.screenY}if(S.rail.drag={x:e.clientX,y:e.clientY,sx:S.scroll.x,sy:S.scroll.y,st:S.getScrollTop(),sl:S.getScrollLeft(),pt:2,dl:!1,tg:o},S.ispage||!S.opt.directionlockdeadzone)S.rail.drag.dl="f";else{var i={w:a.width(),h:a.height()},s={w:Math.max(l.body.scrollWidth,l.documentElement.scrollWidth),h:Math.max(l.body.scrollHeight,l.documentElement.scrollHeight)},c=Math.max(0,s.h-i.h),d=Math.max(0,s.w-i.w);!S.rail.scrollable&&S.railh.scrollable?S.rail.drag.ck=c>0&&"v":S.rail.scrollable&&!S.railh.scrollable?S.rail.drag.ck=d>0&&"h":S.rail.drag.ck=!1,S.rail.drag.ck||(S.rail.drag.dl="f")}if(S.opt.emulatetouch&&S.isiframe&&E.isie){var u=S.win.position();S.rail.drag.x+=u.left,S.rail.drag.y+=u.top}if(S.hasmoving=!1,S.lastmouseup=!1,S.scrollmom.reset(e.clientX,e.clientY),!E.cantouch&&!this.istouchcapable&&!e.pointerType){if(!(!!o&&/INPUT|SELECT|BUTTON|TEXTAREA/i.test(o.nodeName)))return!S.ispage&&E.hasmousecapture&&o.setCapture(),S.opt.emulatetouch?(o.onclick&&!o._onclick&&(o._onclick=o.onclick,o.onclick=function(e){if(S.hasmoving)return!1;o._onclick.call(this,e)}),S.cancelEvent(e)):S.stopPropagation(e);/SUBMIT|CANCEL|BUTTON/i.test(n(o).attr("type"))&&(S.preventclick={tg:o,click:!1})}}},S.ontouchend=function(e){if(!S.rail.drag)return!0;if(2==S.rail.drag.pt){if(e.pointerType&&2!=e.pointerType&&"touch"!=e.pointerType)return!1;if(S.rail.drag=!1,S.hasmoving&&(S.scrollmom.doMomentum(),S.lastmouseup=!0,S.hideCursor(),E.hasmousecapture&&l.releaseCapture(),!E.cantouch))return S.cancelEvent(e)}else if(1==S.rail.drag.pt)return S.onmouseup(e)};var k=S.opt.emulatetouch&&S.isiframe&&!E.hasmousecapture;S.ontouchmove=function(e,o){if(!S.rail.drag)return!1;if(e.targetTouches&&S.opt.preventmultitouchscrolling&&e.targetTouches.length>1)return!1;if(e.pointerType&&2!=e.pointerType&&"touch"!=e.pointerType)return!1;if(2==S.rail.drag.pt){if("changedTouches"in e&&(e.clientX=e.changedTouches[0].clientX,e.clientY=e.changedTouches[0].clientY),S.rail.drag.y===e.clientY&&S.rail.drag.x===e.clientX)return!1;S.hasmoving||S.onscrollstart&&S.triggerScrollStart(e.clientX,e.clientY,0,0,0),S.hasmoving=!0,S.preventclick&&!S.preventclick.click&&(S.preventclick.click=S.preventclick.tg.onclick||!1,S.preventclick.tg.onclick=S.onpreventclick);var t,r;if(r=t=0,k&&!o){var i=S.win.position();r=-i.left,t=-i.top}var s=e.clientY+t,n=s-S.rail.drag.y,a=e.clientX+r,c=a-S.rail.drag.x,d=S.rail.drag.st-n;S.ishwscroll&&S.opt.bouncescroll?d<0?d=Math.round(d/2):d>S.page.maxh&&(d=S.page.maxh+Math.round((d-S.page.maxh)/2)):(d<0&&(d=0,s=0),d>S.page.maxh&&(d=S.page.maxh,s=0));var u;S.railh&&S.railh.scrollable&&(u=S.isrtlmode?c-S.rail.drag.sl:S.rail.drag.sl-c,S.ishwscroll&&S.opt.bouncescroll?u<0?u=Math.round(u/2):u>S.page.maxw&&(u=S.page.maxw+Math.round((u-S.page.maxw)/2)):(u<0&&(u=0,a=0),u>S.page.maxw&&(u=S.page.maxw,a=0)));var h=!1;if(S.rail.drag.dl)h=!0,"v"==S.rail.drag.dl?u=S.rail.drag.sl:"h"==S.rail.drag.dl&&(d=S.rail.drag.st);else{var p=Math.abs(n),m=Math.abs(c),f=S.opt.directionlockdeadzone;if("v"==S.rail.drag.ck){if(p>f&&m<=.3*p)return S.rail.drag=!1,!0;m>f&&(S.rail.drag.dl="f",z.scrollTop(z.scrollTop()))}else if("h"==S.rail.drag.ck){if(m>f&&p<=.3*m)return S.rail.drag=!1,!0;p>f&&(S.rail.drag.dl="f",z.scrollLeft(z.scrollLeft()))}}if(S.synched("touchmove",function(){S.rail.drag&&2==S.rail.drag.pt&&(S.prepareTransition&&S.prepareTransition(0),S.rail.scrollable&&S.setScrollTop(d),S.scrollmom.update(a,s),S.railh&&S.railh.scrollable?(S.setScrollLeft(u),S.showCursor(d,u)):S.showCursor(d),E.isie10&&l.selection.clear())}),E.ischrome&&S.istouchcapable&&(h=!1),h)return S.cancelEvent(e)}else if(1==S.rail.drag.pt)return S.onmousemove(e)},S.ontouchstartCursor=function(e,o){if(!S.rail.drag||3==S.rail.drag.pt){if(S.locked)return S.cancelEvent(e);S.cancelScroll(),S.rail.drag={x:e.touches[0].clientX,y:e.touches[0].clientY,sx:S.scroll.x,sy:S.scroll.y,pt:3,hr:!!o};var t=S.getTarget(e);return!S.ispage&&E.hasmousecapture&&t.setCapture(),S.isiframe&&!E.hasmousecapture&&(S.saved.csspointerevents=S.doc.css("pointer-events"),S.css(S.doc,{"pointer-events":"none"})),S.cancelEvent(e)}},S.ontouchendCursor=function(e){if(S.rail.drag){if(E.hasmousecapture&&l.releaseCapture(),S.isiframe&&!E.hasmousecapture&&S.doc.css("pointer-events",S.saved.csspointerevents),3!=S.rail.drag.pt)return;return S.rail.drag=!1,S.cancelEvent(e)}},S.ontouchmoveCursor=function(e){if(S.rail.drag){if(3!=S.rail.drag.pt)return;if(S.cursorfreezed=!0,S.rail.drag.hr){S.scroll.x=S.rail.drag.sx+(e.touches[0].clientX-S.rail.drag.x),S.scroll.x<0&&(S.scroll.x=0);var o=S.scrollvaluemaxw;S.scroll.x>o&&(S.scroll.x=o)}else{S.scroll.y=S.rail.drag.sy+(e.touches[0].clientY-S.rail.drag.y),S.scroll.y<0&&(S.scroll.y=0);var t=S.scrollvaluemax;S.scroll.y>t&&(S.scroll.y=t)}return S.synched("touchmove",function(){S.rail.drag&&3==S.rail.drag.pt&&(S.showCursor(),S.rail.drag.hr?S.doScrollLeft(Math.round(S.scroll.x*S.scrollratio.x),S.opt.cursordragspeed):S.doScrollTop(Math.round(S.scroll.y*S.scrollratio.y),S.opt.cursordragspeed))}),S.cancelEvent(e)}}}if(S.onmousedown=function(e,o){if(!S.rail.drag||1==S.rail.drag.pt){if(S.railslocked)return S.cancelEvent(e);S.cancelScroll(),S.rail.drag={x:e.clientX,y:e.clientY,sx:S.scroll.x,sy:S.scroll.y,pt:1,hr:o||!1};var t=S.getTarget(e);return!S.ispage&&E.hasmousecapture&&t.setCapture(),S.isiframe&&!E.hasmousecapture&&(S.saved.csspointerevents=S.doc.css("pointer-events"),S.css(S.doc,{"pointer-events":"none"})),S.hasmoving=!1,S.cancelEvent(e)}},S.onmouseup=function(e){if(S.rail.drag)return 1!=S.rail.drag.pt||(E.hasmousecapture&&l.releaseCapture(),S.isiframe&&!E.hasmousecapture&&S.doc.css("pointer-events",S.saved.csspointerevents),S.rail.drag=!1,S.hasmoving&&S.triggerScrollEnd(),S.cancelEvent(e))},S.onmousemove=function(e){if(S.rail.drag){if(1!==S.rail.drag.pt)return;if(E.ischrome&&0===e.which)return S.onmouseup(e);if(S.cursorfreezed=!0,S.hasmoving=!0,S.rail.drag.hr){S.scroll.x=S.rail.drag.sx+(e.clientX-S.rail.drag.x),S.scroll.x<0&&(S.scroll.x=0);var o=S.scrollvaluemaxw;S.scroll.x>o&&(S.scroll.x=o)}else{S.scroll.y=S.rail.drag.sy+(e.clientY-S.rail.drag.y),S.scroll.y<0&&(S.scroll.y=0);var t=S.scrollvaluemax;S.scroll.y>t&&(S.scroll.y=t)}return S.synched("mousemove",function(){S.rail.drag&&1==S.rail.drag.pt&&(S.showCursor(),S.rail.drag.hr?S.hasreversehr?S.doScrollLeft(S.scrollvaluemaxw-Math.round(S.scroll.x*S.scrollratio.x),S.opt.cursordragspeed):S.doScrollLeft(Math.round(S.scroll.x*S.scrollratio.x),S.opt.cursordragspeed):S.doScrollTop(Math.round(S.scroll.y*S.scrollratio.y),S.opt.cursordragspeed))}),S.cancelEvent(e)}S.checkarea=0},E.cantouch||S.opt.emulatetouch)S.onpreventclick=function(e){if(S.preventclick)return S.preventclick.tg.onclick=S.preventclick.click,S.preventclick=!1,S.cancelEvent(e)},S.onclick=!E.isios&&function(e){return!S.lastmouseup||(S.lastmouseup=!1,S.cancelEvent(e))},S.opt.grabcursorenabled&&E.cursorgrabvalue&&(S.css(S.ispage?S.doc:S.win,{cursor:E.cursorgrabvalue}),S.css(S.rail,{cursor:E.cursorgrabvalue}));else{var T=function(e){if(S.selectiondrag){if(e){var o=S.win.outerHeight(),t=e.pageY-S.selectiondrag.top;t>0&&t=o&&(t-=o),S.selectiondrag.df=t}if(0!=S.selectiondrag.df){var r=2*-Math.floor(S.selectiondrag.df/6);S.doScrollBy(r),S.debounced("doselectionscroll",function(){T()},50)}}};S.hasTextSelected="getSelection"in l?function(){return l.getSelection().rangeCount>0}:"selection"in l?function(){return"None"!=l.selection.type}:function(){return!1},S.onselectionstart=function(e){S.ispage||(S.selectiondrag=S.win.offset())},S.onselectionend=function(e){S.selectiondrag=!1},S.onselectiondrag=function(e){S.selectiondrag&&S.hasTextSelected()&&S.debounced("selectionscroll",function(){T(e)},250)}}if(E.hasw3ctouch?(S.css(S.ispage?n("html"):S.win,{"touch-action":"none"}),S.css(S.rail,{"touch-action":"none"}),S.css(S.cursor,{"touch-action":"none"}),S.bind(S.win,"pointerdown",S.ontouchstart),S.bind(l,"pointerup",S.ontouchend),S.bind(l,"pointermove",S.ontouchmove)):E.hasmstouch?(S.css(S.ispage?n("html"):S.win,{"-ms-touch-action":"none"}),S.css(S.rail,{"-ms-touch-action":"none"}),S.css(S.cursor,{"-ms-touch-action":"none"}),S.bind(S.win,"MSPointerDown",S.ontouchstart),S.bind(l,"MSPointerUp",S.ontouchend),S.bind(l,"MSPointerMove",S.ontouchmove),S.bind(S.cursor,"MSGestureHold",function(e){e.preventDefault()}),S.bind(S.cursor,"contextmenu",function(e){e.preventDefault()})):E.cantouch&&(S.bind(S.win,"touchstart",S.ontouchstart,!1,!0),S.bind(l,"touchend",S.ontouchend,!1,!0),S.bind(l,"touchcancel",S.ontouchend,!1,!0),S.bind(l,"touchmove",S.ontouchmove,!1,!0)),S.opt.emulatetouch&&(S.bind(S.win,"mousedown",S.ontouchstart,!1,!0),S.bind(l,"mouseup",S.ontouchend,!1,!0),S.bind(l,"mousemove",S.ontouchmove,!1,!0)),(S.opt.cursordragontouch||!E.cantouch&&!S.opt.emulatetouch)&&(S.rail.css({cursor:"default"}),S.railh&&S.railh.css({cursor:"default"}),S.jqbind(S.rail,"mouseenter",function(){if(!S.ispage&&!S.win.is(":visible"))return!1;S.canshowonmouseevent&&S.showCursor(),S.rail.active=!0}),S.jqbind(S.rail,"mouseleave",function(){S.rail.active=!1,S.rail.drag||S.hideCursor()}),S.opt.sensitiverail&&(S.bind(S.rail,"click",function(e){S.doRailClick(e,!1,!1)}),S.bind(S.rail,"dblclick",function(e){S.doRailClick(e,!0,!1)}),S.bind(S.cursor,"click",function(e){S.cancelEvent(e)}),S.bind(S.cursor,"dblclick",function(e){S.cancelEvent(e)})),S.railh&&(S.jqbind(S.railh,"mouseenter",function(){if(!S.ispage&&!S.win.is(":visible"))return!1;S.canshowonmouseevent&&S.showCursor(),S.rail.active=!0}),S.jqbind(S.railh,"mouseleave",function(){S.rail.active=!1,S.rail.drag||S.hideCursor()}),S.opt.sensitiverail&&(S.bind(S.railh,"click",function(e){S.doRailClick(e,!1,!0)}),S.bind(S.railh,"dblclick",function(e){S.doRailClick(e,!0,!0)}),S.bind(S.cursorh,"click",function(e){S.cancelEvent(e)}),S.bind(S.cursorh,"dblclick",function(e){S.cancelEvent(e)})))),S.opt.cursordragontouch&&(this.istouchcapable||E.cantouch)&&(S.bind(S.cursor,"touchstart",S.ontouchstartCursor),S.bind(S.cursor,"touchmove",S.ontouchmoveCursor),S.bind(S.cursor,"touchend",S.ontouchendCursor),S.cursorh&&S.bind(S.cursorh,"touchstart",function(e){S.ontouchstartCursor(e,!0)}),S.cursorh&&S.bind(S.cursorh,"touchmove",S.ontouchmoveCursor),S.cursorh&&S.bind(S.cursorh,"touchend",S.ontouchendCursor)),E.cantouch||S.opt.emulatetouch?(S.bind(E.hasmousecapture?S.win:l,"mouseup",S.ontouchend),S.onclick&&S.bind(l,"click",S.onclick),S.opt.cursordragontouch?(S.bind(S.cursor,"mousedown",S.onmousedown),S.bind(S.cursor,"mouseup",S.onmouseup),S.cursorh&&S.bind(S.cursorh,"mousedown",function(e){S.onmousedown(e,!0)}),S.cursorh&&S.bind(S.cursorh,"mouseup",S.onmouseup)):(S.bind(S.rail,"mousedown",function(e){e.preventDefault()}),S.railh&&S.bind(S.railh,"mousedown",function(e){e.preventDefault()}))):(S.bind(E.hasmousecapture?S.win:l,"mouseup",S.onmouseup),S.bind(l,"mousemove",S.onmousemove),S.onclick&&S.bind(l,"click",S.onclick),S.bind(S.cursor,"mousedown",S.onmousedown),S.bind(S.cursor,"mouseup",S.onmouseup),S.railh&&(S.bind(S.cursorh,"mousedown",function(e){S.onmousedown(e,!0)}),S.bind(S.cursorh,"mouseup",S.onmouseup)),!S.ispage&&S.opt.enablescrollonselection&&(S.bind(S.win[0],"mousedown",S.onselectionstart),S.bind(l,"mouseup",S.onselectionend),S.bind(S.cursor,"mouseup",S.onselectionend),S.cursorh&&S.bind(S.cursorh,"mouseup",S.onselectionend),S.bind(l,"mousemove",S.onselectiondrag)),S.zoom&&(S.jqbind(S.zoom,"mouseenter",function(){S.canshowonmouseevent&&S.showCursor(),S.rail.active=!0}),S.jqbind(S.zoom,"mouseleave",function(){S.rail.active=!1,S.rail.drag||S.hideCursor()}))),S.opt.enablemousewheel&&(S.isiframe||S.mousewheel(E.isie&&S.ispage?l:S.win,S.onmousewheel),S.mousewheel(S.rail,S.onmousewheel),S.railh&&S.mousewheel(S.railh,S.onmousewheelhr)),S.ispage||E.cantouch||/HTML|^BODY/.test(S.win[0].nodeName)||(S.win.attr("tabindex")||S.win.attr({tabindex:++r}),S.bind(S.win,"focus",function(e){o=S.getTarget(e).id||!0,S.hasfocus=!0,S.canshowonmouseevent&&S.noticeCursor()}),S.bind(S.win,"blur",function(e){o=!1,S.hasfocus=!1}),S.bind(S.win,"mouseenter",function(e){t=S.getTarget(e).id||!0,S.hasmousefocus=!0,S.canshowonmouseevent&&S.noticeCursor()}),S.bind(S.win,"mouseleave",function(e){t=!1,S.hasmousefocus=!1,S.rail.drag||S.hideCursor()})),S.onkeypress=function(e){if(S.railslocked&&0==S.page.maxh)return!0;e=e||window.e;var r=S.getTarget(e);if(r&&/INPUT|TEXTAREA|SELECT|OPTION/.test(r.nodeName)&&(!(r.getAttribute("type")||r.type||!1)||!/submit|button|cancel/i.tp))return!0;if(n(r).attr("contenteditable"))return!0;if(S.hasfocus||S.hasmousefocus&&!o||S.ispage&&!o&&!t){var i=e.keyCode;if(S.railslocked&&27!=i)return S.cancelEvent(e);var s=e.ctrlKey||!1,l=e.shiftKey||!1,a=!1;switch(i){case 38:case 63233:S.doScrollBy(72),a=!0;break;case 40:case 63235:S.doScrollBy(-72),a=!0;break;case 37:case 63232:S.railh&&(s?S.doScrollLeft(0):S.doScrollLeftBy(72),a=!0);break;case 39:case 63234:S.railh&&(s?S.doScrollLeft(S.page.maxw):S.doScrollLeftBy(-72),a=!0);break;case 33:case 63276:S.doScrollBy(S.view.h),a=!0;break;case 34:case 63277:S.doScrollBy(-S.view.h),a=!0;break;case 36:case 63273:S.railh&&s?S.doScrollPos(0,0):S.doScrollTo(0),a=!0;break;case 35:case 63275:S.railh&&s?S.doScrollPos(S.page.maxw,S.page.maxh):S.doScrollTo(S.page.maxh),a=!0;break;case 32:S.opt.spacebarenabled&&(l?S.doScrollBy(S.view.h):S.doScrollBy(-S.view.h),a=!0);break;case 27:S.zoomactive&&(S.doZoom(),a=!0)}if(a)return S.cancelEvent(e)}},S.opt.enablekeyboard&&S.bind(l,E.isopera&&!E.isopera12?"keypress":"keydown",S.onkeypress),S.bind(l,"keydown",function(e){(e.ctrlKey||!1)&&(S.wheelprevented=!0)}),S.bind(l,"keyup",function(e){e.ctrlKey||!1||(S.wheelprevented=!1)}),S.bind(window,"blur",function(e){S.wheelprevented=!1}),S.bind(window,"resize",S.lazyResize),S.bind(window,"orientationchange",S.lazyResize),S.bind(window,"load",S.lazyResize),E.ischrome&&!S.ispage&&!S.haswrapper){var M=S.win.attr("style"),L=parseFloat(S.win.css("width"))+1;S.win.css("width",L),S.synched("chromefix",function(){S.win.attr("style",M)})}S.onAttributeChange=function(e){S.lazyResize(S.isieold?250:30)},S.opt.enableobserver&&(S.isie11||!1===h||(S.observerbody=new h(function(e){if(e.forEach(function(e){if("attributes"==e.type)return z.hasClass("modal-open")&&z.hasClass("modal-dialog")&&!n.contains(n(".modal-dialog")[0],S.doc[0])?S.hide():S.show()}),S.me.clientWidth!=S.page.width||S.me.clientHeight!=S.page.height)return S.lazyResize(30)}),S.observerbody.observe(l.body,{childList:!0,subtree:!0,characterData:!1,attributes:!0,attributeFilter:["class"]})),S.ispage||S.haswrapper||(!1!==h?(S.observer=new h(function(e){e.forEach(S.onAttributeChange)}),S.observer.observe(S.win[0],{childList:!0,characterData:!1,attributes:!0,subtree:!1}),S.observerremover=new h(function(e){e.forEach(function(e){if(e.removedNodes.length>0)for(var o in e.removedNodes)if(S&&e.removedNodes[o]==S.win[0])return S.remove()})}),S.observerremover.observe(S.win[0].parentNode,{childList:!0,characterData:!1,attributes:!1,subtree:!1})):(S.bind(S.win,E.isie&&!E.isie9?"propertychange":"DOMAttrModified",S.onAttributeChange),E.isie9&&S.win[0].attachEvent("onpropertychange",S.onAttributeChange),S.bind(S.win,"DOMNodeRemoved",function(e){e.target==S.win[0]&&S.remove()})))),!S.ispage&&S.opt.boxzoom&&S.bind(window,"resize",S.resizeZoom),S.istextarea&&(S.bind(S.win,"keydown",S.lazyResize),S.bind(S.win,"mouseup",S.lazyResize)),S.lazyResize(30)}if("IFRAME"==this.doc[0].nodeName){var C=function(){S.iframexd=!1;var o;try{(o="contentDocument"in this?this.contentDocument:this.contentWindow._doc).domain}catch(e){S.iframexd=!0,o=!1}if(S.iframexd)return"console"in window&&console.log("NiceScroll error: policy restriced iframe"),!0;if(S.forcescreen=!0,S.isiframe&&(S.iframe={doc:n(o),html:S.doc.contents().find("html")[0],body:S.doc.contents().find("body")[0]},S.getContentSize=function(){return{w:Math.max(S.iframe.html.scrollWidth,S.iframe.body.scrollWidth),h:Math.max(S.iframe.html.scrollHeight,S.iframe.body.scrollHeight)}},S.docscroll=n(S.iframe.body)),!E.isios&&S.opt.iframeautoresize&&!S.isiframe){S.win.scrollTop(0),S.doc.height("");var t=Math.max(o.getElementsByTagName("html")[0].scrollHeight,o.body.scrollHeight);S.doc.height(t)}S.lazyResize(30),S.css(n(S.iframe.body),e),E.isios&&S.haswrapper&&S.css(n(o.body),{"-webkit-transform":"translate3d(0,0,0)"}),"contentWindow"in this?S.bind(this.contentWindow,"scroll",S.onscroll):S.bind(o,"scroll",S.onscroll),S.opt.enablemousewheel&&S.mousewheel(o,S.onmousewheel),S.opt.enablekeyboard&&S.bind(o,E.isopera?"keypress":"keydown",S.onkeypress),E.cantouch?(S.bind(o,"touchstart",S.ontouchstart),S.bind(o,"touchmove",S.ontouchmove)):S.opt.emulatetouch&&(S.bind(o,"mousedown",S.ontouchstart),S.bind(o,"mousemove",function(e){return S.ontouchmove(e,!0)}),S.opt.grabcursorenabled&&E.cursorgrabvalue&&S.css(n(o.body),{cursor:E.cursorgrabvalue})),S.bind(o,"mouseup",S.ontouchend),S.zoom&&(S.opt.dblclickzoom&&S.bind(o,"dblclick",S.doZoom),S.ongesturezoom&&S.bind(o,"gestureend",S.ongesturezoom))};this.doc[0].readyState&&"complete"==this.doc[0].readyState&&setTimeout(function(){C.call(S.doc[0],!1)},500),S.bind(this.doc,"load",C)}},this.showCursor=function(e,o){if(S.cursortimeout&&(clearTimeout(S.cursortimeout),S.cursortimeout=0),S.rail){if(S.autohidedom&&(S.autohidedom.stop().css({opacity:S.opt.cursoropacitymax}),S.cursoractive=!0),S.rail.drag&&1==S.rail.drag.pt||(void 0!==e&&!1!==e&&(S.scroll.y=Math.round(1*e/S.scrollratio.y)),void 0!==o&&(S.scroll.x=Math.round(1*o/S.scrollratio.x))),S.cursor.css({height:S.cursorheight,top:S.scroll.y}),S.cursorh){var t=S.hasreversehr?S.scrollvaluemaxw-S.scroll.x:S.scroll.x;!S.rail.align&&S.rail.visibility?S.cursorh.css({width:S.cursorwidth,left:t+S.rail.width}):S.cursorh.css({width:S.cursorwidth,left:t}),S.cursoractive=!0}S.zoom&&S.zoom.stop().css({opacity:S.opt.cursoropacitymax})}},this.hideCursor=function(e){S.cursortimeout||S.rail&&S.autohidedom&&(S.hasmousefocus&&"leave"==S.opt.autohidemode||(S.cursortimeout=setTimeout(function(){S.rail.active&&S.showonmouseevent||(S.autohidedom.stop().animate({opacity:S.opt.cursoropacitymin}),S.zoom&&S.zoom.stop().animate({opacity:S.opt.cursoropacitymin}),S.cursoractive=!1),S.cursortimeout=0},e||S.opt.hidecursordelay)))},this.noticeCursor=function(e,o,t){S.showCursor(o,t),S.rail.active||S.hideCursor(e)},this.getContentSize=S.ispage?function(){return{w:Math.max(l.body.scrollWidth,l.documentElement.scrollWidth),h:Math.max(l.body.scrollHeight,l.documentElement.scrollHeight)}}:S.haswrapper?function(){return{w:S.doc[0].offsetWidth,h:S.doc[0].offsetHeight}}:function(){return{w:S.docscroll[0].scrollWidth,h:S.docscroll[0].scrollHeight}},this.onResize=function(e,o){if(!S||!S.win)return!1;if(!S.haswrapper&&!S.ispage){if("none"==S.win.css("display"))return S.visibility&&S.hideRail().hideRailHr(),!1;S.hidden||S.visibility||S.showRail().showRailHr()}var t=S.page.maxh,r=S.page.maxw,i={h:S.view.h,w:S.view.w};if(S.view={w:S.ispage?S.win.width():S.win[0].clientWidth,h:S.ispage?S.win.height():S.win[0].clientHeight},S.page=o||S.getContentSize(),S.page.maxh=Math.max(0,S.page.h-S.view.h),S.page.maxw=Math.max(0,S.page.w-S.view.w),S.page.maxh==t&&S.page.maxw==r&&S.view.w==i.w&&S.view.h==i.h){if(S.ispage)return S;var s=S.win.offset();if(S.lastposition){var n=S.lastposition;if(n.top==s.top&&n.left==s.left)return S}S.lastposition=s}return 0===S.page.maxh?(S.hideRail(),S.scrollvaluemax=0,S.scroll.y=0,S.scrollratio.y=0,S.cursorheight=0,S.setScrollTop(0),S.rail&&(S.rail.scrollable=!1)):(S.page.maxh-=S.opt.railpadding.top+S.opt.railpadding.bottom,S.rail.scrollable=!0),0===S.page.maxw?(S.hideRailHr(),S.scrollvaluemaxw=0,S.scroll.x=0,S.scrollratio.x=0,S.cursorwidth=0,S.setScrollLeft(0),S.railh&&(S.railh.scrollable=!1)):(S.page.maxw-=S.opt.railpadding.left+S.opt.railpadding.right,S.railh&&(S.railh.scrollable=S.opt.horizrailenabled)),S.railslocked=S.locked||0===S.page.maxh&&0===S.page.maxw,S.railslocked?(S.ispage||S.updateScrollBar(S.view),!1):(S.hidden||S.visibility?!S.railh||S.hidden||S.railh.visibility||S.showRailHr():S.showRail().showRailHr(),S.istextarea&&S.win.css("resize")&&"none"!=S.win.css("resize")&&(S.view.h-=20),S.cursorheight=Math.min(S.view.h,Math.round(S.view.h*(S.view.h/S.page.h))),S.cursorheight=S.opt.cursorfixedheight?S.opt.cursorfixedheight:Math.max(S.opt.cursorminheight,S.cursorheight),S.cursorwidth=Math.min(S.view.w,Math.round(S.view.w*(S.view.w/S.page.w))),S.cursorwidth=S.opt.cursorfixedheight?S.opt.cursorfixedheight:Math.max(S.opt.cursorminheight,S.cursorwidth),S.scrollvaluemax=S.view.h-S.cursorheight-(S.opt.railpadding.top+S.opt.railpadding.bottom),S.railh&&(S.railh.width=S.page.maxh>0?S.view.w-S.rail.width:S.view.w,S.scrollvaluemaxw=S.railh.width-S.cursorwidth-(S.opt.railpadding.left+S.opt.railpadding.right)),S.ispage||S.updateScrollBar(S.view),S.scrollratio={x:S.page.maxw/S.scrollvaluemaxw,y:S.page.maxh/S.scrollvaluemax},S.getScrollTop()>S.page.maxh?S.doScrollTop(S.page.maxh):(S.scroll.y=Math.round(S.getScrollTop()*(1/S.scrollratio.y)),S.scroll.x=Math.round(S.getScrollLeft()*(1/S.scrollratio.x)),S.cursoractive&&S.noticeCursor()),S.scroll.y&&0==S.getScrollTop()&&S.doScrollTo(Math.floor(S.scroll.y*S.scrollratio.y)),S)},this.resize=S.onResize,this.hlazyresize=0,this.lazyResize=function(e){return S.haswrapper||S.hide(),S.hlazyresize&&clearTimeout(S.hlazyresize),S.hlazyresize=setTimeout(function(){S&&(S.resize(),S.show())},240),S},this.jqbind=function(e,o,t){S.events.push({e:e,n:o,f:t,q:!0}),n(e).bind(o,t)},this.mousewheel=function(e,o,t){var r="jquery"in e?e[0]:e;if("onwheel"in l.createElement("div"))S._bind(r,"wheel",o,t||!1);else{var i=void 0!==l.onmousewheel?"mousewheel":"DOMMouseScroll";y(r,i,o,t||!1),"DOMMouseScroll"==i&&y(r,"MozMousePixelScroll",o,t||!1)}};var R=!1;if(E.haseventlistener){try{var H=Object.defineProperty({},"passive",{get:function(){R=!0}});window.addEventListener("test",null,H)}catch(e){}this.cancelEvent=function(e){return!!e&&((e=e.original?e.original:e).cancelable&&e.preventDefault(),e.stopPropagation(),e.preventManipulation&&e.preventManipulation(),!1)},this.stopPropagation=function(e){return!!e&&((e=e.original?e.original:e).stopPropagation(),!1)}}else Event.prototype.preventDefault=function(){this.returnValue=!1},Event.prototype.stopPropagation=function(){this.cancelBubble=!0},window.constructor.prototype.addEventListener=l.constructor.prototype.addEventListener=Element.prototype.addEventListener=function(e,o,t){this.attachEvent("on"+e,o)},window.constructor.prototype.removeEventListener=l.constructor.prototype.removeEventListener=Element.prototype.removeEventListener=function(e,o,t){this.detachEvent("on"+e,o)},this.cancelEvent=function(e){return!!(e=window.event||!1)&&(e.cancelBubble=!0,e.cancel=!0,e.returnValue=!1,!1)},this.stopPropagation=function(e){return!!(e=window.event||!1)&&(e.cancelBubble=!0,!1)};this.bind=function(e,o,t,r,i){var s="jquery"in e?e[0]:e;S._bind(s,o,t,r||!1,i||!1)},this._bind=function(e,o,t,r,i){S.events.push({e:e,n:o,f:t,b:r,q:!1}),R&&i?e.addEventListener(o,t,{passive:!1,capture:r}):e.addEventListener(o,t,r||!1)},this._unbind=function(e,o,t,r){e.removeEventListener(o,t,r)},this.unbindAll=function(){for(var e=0;e0)return t;o=!!o.parentNode&&o.parentNode}return!1},this.triggerScrollStart=function(e,o,t,r,i){var s={type:"scrollstart",current:{x:e,y:o},request:{x:t,y:r},end:{x:S.newscrollx,y:S.newscrolly},speed:i};S.onscrollstart.call(S,s)},this.triggerScrollEnd=function(){if(S.onscrollend){var e=S.getScrollLeft(),o=S.getScrollTop(),t={type:"scrollend",current:{x:e,y:o},end:{x:e,y:o}};S.onscrollend.call(S,t)}},this.onmousewheel=function(e){if(!S.wheelprevented){if(S.railslocked)return S.debounced("checkunlock",S.resize,250),!0;if(S.rail.drag)return S.cancelEvent(e);if("auto"===S.opt.oneaxismousemode&&0!==e.deltaX&&(S.opt.oneaxismousemode=!1),S.opt.oneaxismousemode&&0===e.deltaX&&!S.rail.scrollable)return!S.railh||!S.railh.scrollable||S.onmousewheelhr(e);var o=p(),t=!1;if(S.opt.preservenativescrolling&&S.checkarea+60020?t:0},S.opt.smoothscroll?S.ishwscroll&&E.hastransition&&S.opt.usetransition&&S.opt.smoothscroll?(this.prepareTransition=function(e,o){var t=o?e>20?e:0:S.getTransitionSpeed(e),r=t?E.prefixstyle+"transform "+t+"ms ease-out":"";return S.lasttransitionstyle&&S.lasttransitionstyle==r||(S.lasttransitionstyle=r,S.doc.css(E.transitionstyle,r)),t},this.doScrollLeft=function(e,o){var t=S.scrollrunning?S.newscrolly:S.getScrollTop();S.doScrollPos(e,t,o)},this.doScrollTop=function(e,o){var t=S.scrollrunning?S.newscrollx:S.getScrollLeft();S.doScrollPos(t,e,o)},this.doScrollPos=function(e,o,t){var r=S.getScrollTop(),i=S.getScrollLeft();return((S.newscrolly-r)*(o-r)<0||(S.newscrollx-i)*(e-i)<0)&&S.cancelScroll(),0==S.opt.bouncescroll&&(o<0?o=0:o>S.page.maxh&&(o=S.page.maxh),e<0?e=0:e>S.page.maxw&&(e=S.page.maxw)),(!S.scrollrunning||e!=S.newscrollx||o!=S.newscrolly)&&(S.newscrolly=o,S.newscrollx=e,S.newscrollspeed=t||!1,!S.timer&&void(S.timer=setTimeout(function(){var t=S.getScrollTop(),r=S.getScrollLeft(),i={};i.x=e-r,i.y=o-t,i.px=r,i.py=t;var s=Math.round(Math.sqrt(Math.pow(i.x,2)+Math.pow(i.y,2))),n=S.newscrollspeed&&S.newscrollspeed>1?S.newscrollspeed:S.getTransitionSpeed(s);if(S.newscrollspeed&&S.newscrollspeed<=1&&(n*=S.newscrollspeed),S.prepareTransition(n,!0),S.timerscroll&&S.timerscroll.tm&&clearInterval(S.timerscroll.tm),n>0){!S.scrollrunning&&S.onscrollstart&&S.triggerScrollStart(r,t,e,o,n),E.transitionend?S.scrollendtrapped||(S.scrollendtrapped=!0,S.bind(S.doc,E.transitionend,S.onScrollTransitionEnd,!1)):(S.scrollendtrapped&&clearTimeout(S.scrollendtrapped),S.scrollendtrapped=setTimeout(S.onScrollTransitionEnd,n));var l=t,a=r;S.timerscroll={bz:new C(l,S.newscrolly,n,0,0,.58,1),bh:new C(a,S.newscrollx,n,0,0,.58,1)},S.cursorfreezed||(S.timerscroll.tm=setInterval(function(){S.showCursor(S.getScrollTop(),S.getScrollLeft())},60))}S.synched("doScroll-set",function(){S.timer=0,S.scrollendtrapped&&(S.scrollrunning=!0),S.setScrollTop(S.newscrolly),S.setScrollLeft(S.newscrollx),S.scrollendtrapped||S.onScrollTransitionEnd()})},50)))},this.cancelScroll=function(){if(!S.scrollendtrapped)return!0;var e=S.getScrollTop(),o=S.getScrollLeft();return S.scrollrunning=!1,E.transitionend||clearTimeout(E.transitionend),S.scrollendtrapped=!1,S._unbind(S.doc[0],E.transitionend,S.onScrollTransitionEnd),S.prepareTransition(0),S.setScrollTop(e),S.railh&&S.setScrollLeft(o),S.timerscroll&&S.timerscroll.tm&&clearInterval(S.timerscroll.tm),S.timerscroll=!1,S.cursorfreezed=!1,S.showCursor(e,o),S},this.onScrollTransitionEnd=function(){S.scrollendtrapped&&S._unbind(S.doc[0],E.transitionend,S.onScrollTransitionEnd),S.scrollendtrapped=!1,S.prepareTransition(0),S.timerscroll&&S.timerscroll.tm&&clearInterval(S.timerscroll.tm),S.timerscroll=!1;var e=S.getScrollTop(),o=S.getScrollLeft();if(S.setScrollTop(e),S.railh&&S.setScrollLeft(o),S.noticeCursor(!1,e,o),S.cursorfreezed=!1,e<0?e=0:e>S.page.maxh&&(e=S.page.maxh),o<0?o=0:o>S.page.maxw&&(o=S.page.maxw),e!=S.newscrolly||o!=S.newscrollx)return S.doScrollPos(o,e,S.opt.snapbackspeed);S.onscrollend&&S.scrollrunning&&S.triggerScrollEnd(),S.scrollrunning=!1}):(this.doScrollLeft=function(e,o){var t=S.scrollrunning?S.newscrolly:S.getScrollTop();S.doScrollPos(e,t,o)},this.doScrollTop=function(e,o){var t=S.scrollrunning?S.newscrollx:S.getScrollLeft();S.doScrollPos(t,e,o)},this.doScrollPos=function(e,o,t){function r(){if(S.cancelAnimationFrame)return!0;if(S.scrollrunning=!0,h=1-h)return S.timer=c(r)||1;var e,o,t=0,i=o=S.getScrollTop();S.dst.ay?(((n=(i=S.bzscroll?S.dst.py+S.bzscroll.getNow()*S.dst.ay:S.newscrolly)-o)<0&&i0&&i>S.newscrolly)&&(i=S.newscrolly),S.setScrollTop(i),i==S.newscrolly&&(t=1)):t=1;var s=e=S.getScrollLeft();if(S.dst.ax){var n=(s=S.bzscroll?S.dst.px+S.bzscroll.getNow()*S.dst.ax:S.newscrollx)-e;(n<0&&s0&&s>S.newscrollx)&&(s=S.newscrollx),S.setScrollLeft(s),s==S.newscrollx&&(t+=1)}else t+=1;2==t?(S.timer=0,S.cursorfreezed=!1,S.bzscroll=!1,S.scrollrunning=!1,i<0?i=0:i>S.page.maxh&&(i=Math.max(0,S.page.maxh)),s<0?s=0:s>S.page.maxw&&(s=S.page.maxw),s!=S.newscrollx||i!=S.newscrolly?S.doScrollPos(s,i):S.onscrollend&&S.triggerScrollEnd()):S.timer=c(r)||1}var o=void 0===o||!1===o?S.getScrollTop(!0):o;if(S.timer&&S.newscrolly==o&&S.newscrollx==e)return!0;S.timer&&d(S.timer),S.timer=0;var i=S.getScrollTop(),s=S.getScrollLeft();((S.newscrolly-i)*(o-i)<0||(S.newscrollx-s)*(e-s)<0)&&S.cancelScroll(),S.newscrolly=o,S.newscrollx=e,S.bouncescroll&&S.rail.visibility||(S.newscrolly<0?S.newscrolly=0:S.newscrolly>S.page.maxh&&(S.newscrolly=S.page.maxh)),S.bouncescroll&&S.railh.visibility||(S.newscrollx<0?S.newscrollx=0:S.newscrollx>S.page.maxw&&(S.newscrollx=S.page.maxw)),S.dst={},S.dst.x=e-s,S.dst.y=o-i,S.dst.px=s,S.dst.py=i;var n=Math.round(Math.sqrt(Math.pow(S.dst.x,2)+Math.pow(S.dst.y,2)));S.dst.ax=S.dst.x/n,S.dst.ay=S.dst.y/n;var l=0,a=n;0==S.dst.x?(l=i,a=o,S.dst.ay=1,S.dst.py=0):0==S.dst.y&&(l=s,a=e,S.dst.ax=1,S.dst.px=0);var u=S.getTransitionSpeed(n);if(t&&t<=1&&(u*=t),S.bzscroll=u>0&&(S.bzscroll?S.bzscroll.update(a,u):new C(l,a,u,0,1,0,1)),!S.timer){(i==S.page.maxh&&o>=S.page.maxh||s==S.page.maxw&&e>=S.page.maxw)&&S.checkContentSize();var h=1;S.cancelAnimationFrame=!1,S.timer=1,S.onscrollstart&&!S.scrollrunning&&S.triggerScrollStart(s,i,e,o,u),r(),(i==S.page.maxh&&o>=i||s==S.page.maxw&&e>=s)&&S.checkContentSize(),S.noticeCursor()}},this.cancelScroll=function(){return S.timer&&d(S.timer),S.timer=0,S.bzscroll=!1,S.scrollrunning=!1,S}):(this.doScrollLeft=function(e,o){var t=S.getScrollTop();S.doScrollPos(e,t,o)},this.doScrollTop=function(e,o){var t=S.getScrollLeft();S.doScrollPos(t,e,o)},this.doScrollPos=function(e,o,t){var r=e>S.page.maxw?S.page.maxw:e;r<0&&(r=0);var i=o>S.page.maxh?S.page.maxh:o;i<0&&(i=0),S.synched("scroll",function(){S.setScrollTop(i),S.setScrollLeft(r)})},this.cancelScroll=function(){}),this.doScrollBy=function(e,o){var t=0;if(t=o?Math.floor((S.scroll.y-e)*S.scrollratio.y):(S.timer?S.newscrolly:S.getScrollTop(!0))-e,S.bouncescroll){var r=Math.round(S.view.h/2);t<-r?t=-r:t>S.page.maxh+r&&(t=S.page.maxh+r)}S.cursorfreezed=!1;var i=S.getScrollTop(!0);return t<0&&i<=0?S.noticeCursor():t>S.page.maxh&&i>=S.page.maxh?(S.checkContentSize(),S.noticeCursor()):void S.doScrollTop(t)},this.doScrollLeftBy=function(e,o){var t=0;if(t=o?Math.floor((S.scroll.x-e)*S.scrollratio.x):(S.timer?S.newscrollx:S.getScrollLeft(!0))-e,S.bouncescroll){var r=Math.round(S.view.w/2);t<-r?t=-r:t>S.page.maxw+r&&(t=S.page.maxw+r)}S.cursorfreezed=!1;var i=S.getScrollLeft(!0);return t<0&&i<=0?S.noticeCursor():t>S.page.maxw&&i>=S.page.maxw?S.noticeCursor():void S.doScrollLeft(t)},this.doScrollTo=function(e,o){var t=o?Math.round(e*S.scrollratio.y):e;t<0?t=0:t>S.page.maxh&&(t=S.page.maxh),S.cursorfreezed=!1,S.doScrollTop(e)},this.checkContentSize=function(){var e=S.getContentSize();e.h==S.page.h&&e.w==S.page.w||S.resize(!1,e)},S.onscroll=function(e){S.rail.drag||S.cursorfreezed||S.synched("scroll",function(){S.scroll.y=Math.round(S.getScrollTop()*(1/S.scrollratio.y)),S.railh&&(S.scroll.x=Math.round(S.getScrollLeft()*(1/S.scrollratio.x))),S.noticeCursor()})},S.bind(S.docscroll,"scroll",S.onscroll),this.doZoomIn=function(e){if(!S.zoomactive){S.zoomactive=!0,S.zoomrestore={style:{}};var o=["position","top","left","zIndex","backgroundColor","marginTop","marginBottom","marginLeft","marginRight"],t=S.win[0].style;for(var r in o){var i=o[r];S.zoomrestore.style[i]=void 0!==t[i]?t[i]:""}S.zoomrestore.style.width=S.win.css("width"),S.zoomrestore.style.height=S.win.css("height"),S.zoomrestore.padding={w:S.win.outerWidth()-S.win.width(),h:S.win.outerHeight()-S.win.height()},E.isios4&&(S.zoomrestore.scrollTop=a.scrollTop(),a.scrollTop(0)),S.win.css({position:E.isios4?"absolute":"fixed",top:0,left:0,zIndex:s+100,margin:0});var n=S.win.css("backgroundColor");return(""==n||/transparent|rgba\(0, 0, 0, 0\)|rgba\(0,0,0,0\)/.test(n))&&S.win.css("backgroundColor","#fff"),S.rail.css({zIndex:s+101}),S.zoom.css({zIndex:s+102}),S.zoom.css("backgroundPosition","0 -18px"),S.resizeZoom(),S.onzoomin&&S.onzoomin.call(S),S.cancelEvent(e)}},this.doZoomOut=function(e){if(S.zoomactive)return S.zoomactive=!1,S.win.css("margin",""),S.win.css(S.zoomrestore.style),E.isios4&&a.scrollTop(S.zoomrestore.scrollTop),S.rail.css({"z-index":S.zindex}),S.zoom.css({"z-index":S.zindex}),S.zoomrestore=!1,S.zoom.css("backgroundPosition","0 0"),S.onResize(),S.onzoomout&&S.onzoomout.call(S),S.cancelEvent(e)},this.doZoom=function(e){return S.zoomactive?S.doZoomOut(e):S.doZoomIn(e)},this.resizeZoom=function(){if(S.zoomactive){var e=S.getScrollTop();S.win.css({width:a.width()-S.zoomrestore.padding.w+"px",height:a.height()-S.zoomrestore.padding.h+"px"}),S.onResize(),S.setScrollTop(Math.min(S.page.maxh,e))}},this.init(),n.nicescroll.push(this)},v=function(e){var o=this;this.nc=e,this.lastx=0,this.lasty=0,this.speedx=0,this.speedy=0,this.lasttime=0,this.steptime=0,this.snapx=!1,this.snapy=!1,this.demulx=0,this.demuly=0,this.lastscrollx=-1,this.lastscrolly=-1,this.chkx=0,this.chky=0,this.timer=0,this.reset=function(e,t){o.stop(),o.steptime=0,o.lasttime=p(),o.speedx=0,o.speedy=0,o.lastx=e,o.lasty=t,o.lastscrollx=-1,o.lastscrolly=-1},this.update=function(e,t){var r=p();o.steptime=r-o.lasttime,o.lasttime=r;var i=t-o.lasty,s=e-o.lastx,n=o.nc.getScrollTop()+i,l=o.nc.getScrollLeft()+s;o.snapx=l<0||l>o.nc.page.maxw,o.snapy=n<0||n>o.nc.page.maxh,o.speedx=s,o.speedy=i,o.lastx=e,o.lasty=t},this.stop=function(){o.nc.unsynched("domomentum2d"),o.timer&&clearTimeout(o.timer),o.timer=0,o.lastscrollx=-1,o.lastscrolly=-1},this.doSnapy=function(e,t){var r=!1;t<0?(t=0,r=!0):t>o.nc.page.maxh&&(t=o.nc.page.maxh,r=!0),e<0?(e=0,r=!0):e>o.nc.page.maxw&&(e=o.nc.page.maxw,r=!0),r?o.nc.doScrollPos(e,t,o.nc.opt.snapbackspeed):o.nc.triggerScrollEnd()},this.doMomentum=function(e){var t=p(),r=e?t+e:o.lasttime,i=o.nc.getScrollLeft(),s=o.nc.getScrollTop(),n=o.nc.page.maxh,l=o.nc.page.maxw;o.speedx=l>0?Math.min(60,o.speedx):0,o.speedy=n>0?Math.min(60,o.speedy):0;var a=r&&t-r<=60;(s<0||s>n||i<0||i>l)&&(a=!1);var c=!(!o.speedy||!a)&&o.speedy,d=!(!o.speedx||!a)&&o.speedx;if(c||d){var u=Math.max(16,o.steptime);if(u>50){var h=u/50;o.speedx*=h,o.speedy*=h,u=50}o.demulxy=0,o.lastscrollx=o.nc.getScrollLeft(),o.chkx=o.lastscrollx,o.lastscrolly=o.nc.getScrollTop(),o.chky=o.lastscrolly;var m=o.lastscrollx,f=o.lastscrolly,g=function(){var e=p()-t>600?.04:.02;o.speedx&&(m=Math.floor(o.lastscrollx-o.speedx*(1-o.demulxy)),o.lastscrollx=m,(m<0||m>l)&&(e=.1)),o.speedy&&(f=Math.floor(o.lastscrolly-o.speedy*(1-o.demulxy)),o.lastscrolly=f,(f<0||f>n)&&(e=.1)),o.demulxy=Math.min(1,o.demulxy+e),o.nc.synched("domomentum2d",function(){if(o.speedx){o.nc.getScrollLeft();o.chkx=m,o.nc.setScrollLeft(m)}if(o.speedy){o.nc.getScrollTop();o.chky=f,o.nc.setScrollTop(f)}o.timer||(o.nc.hideCursor(),o.doSnapy(m,f))}),o.demulxy<1?o.timer=setTimeout(g,u):(o.stop(),o.nc.hideCursor(),o.doSnapy(m,f))};g()}else o.doSnapy(o.nc.getScrollLeft(),o.nc.getScrollTop())}},b=e.fn.scrollTop;e.cssHooks.pageYOffset={get:function(e,o,t){var r=n.data(e,"__nicescroll")||!1;return r&&r.ishwscroll?r.getScrollTop():b.call(e)},set:function(e,o){var t=n.data(e,"__nicescroll")||!1;return t&&t.ishwscroll?t.setScrollTop(parseInt(o)):b.call(e,o),this}},e.fn.scrollTop=function(e){if(void 0===e){var o=!!this[0]&&(n.data(this[0],"__nicescroll")||!1);return o&&o.ishwscroll?o.getScrollTop():b.call(this)}return this.each(function(){var o=n.data(this,"__nicescroll")||!1;o&&o.ishwscroll?o.setScrollTop(parseInt(e)):b.call(n(this),e)})};var y=e.fn.scrollLeft;n.cssHooks.pageXOffset={get:function(e,o,t){var r=n.data(e,"__nicescroll")||!1;return r&&r.ishwscroll?r.getScrollLeft():y.call(e)},set:function(e,o){var t=n.data(e,"__nicescroll")||!1;return t&&t.ishwscroll?t.setScrollLeft(parseInt(o)):y.call(e,o),this}},e.fn.scrollLeft=function(e){if(void 0===e){var o=!!this[0]&&(n.data(this[0],"__nicescroll")||!1);return o&&o.ishwscroll?o.getScrollLeft():y.call(this)}return this.each(function(){var o=n.data(this,"__nicescroll")||!1;o&&o.ishwscroll?o.setScrollLeft(parseInt(e)):y.call(n(this),e)})};var x=function(e){var o=this;if(this.length=0,this.name="nicescrollarray",this.each=function(e){return n.each(o,e),o},this.push=function(e){o[o.length]=e,o.length++},this.eq=function(e){return o[e]},e)for(var t=0;t1?n(e,r):s,i.win=r}!("doc"in i)||"win"in i||(i.win=r);var l=r.data("__nicescroll")||!1;l||(i.doc=i.doc||r,l=new w(i,r),r.data("__nicescroll",l)),t.push(l)}),1===t.length?t[0]:t},window.NiceScroll={getjQuery:function(){return e}},n.nicescroll||(n.nicescroll=new x,n.nicescroll.options=m)}); \ No newline at end of file diff --git a/dist/zoomico.png b/dist/zoomico.png deleted file mode 100644 index 667ea3340ce6144f3a97e8813af29f6e07784142..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 254 zcmV{4YqWT1XJ7s!9UNhFuUm>u?3jf3kx)Q|6gFRZ&CLxFi`U z>wVnxeRw4cjiX?a@}tVs2UX^>NTmhy#7eYbOF}q(09E!Z=$*I{Bme*a07*qoM6N<$ Eg2= 11); // IE11+ - d.ismsedge = ("msCredentials" in window); // MS Edge 14+ + d.ismsedge = ("msCredentials" in _win); // MS Edge 14+ d.ismozilla = ("MozAppearance" in _style); d.iswebkit = !d.ismsedge && ("WebkitAppearance" in _style); - d.ischrome = d.iswebkit && ("chrome" in window); + d.ischrome = d.iswebkit && ("chrome" in _win); d.ischrome38 = (d.ischrome && ("touchAction" in _style)); // behavior changed in touch emulation d.ischrome22 = (!d.ischrome38) && (d.ischrome && d.haspointerlock); d.ischrome26 = (!d.ischrome38) && (d.ischrome && ("transition" in _style)); // issue with transform detection (maintain prefix) - d.cantouch = ("ontouchstart" in _doc.documentElement) || ("ontouchstart" in window); // with detection for Chrome Touch Emulation - d.hasw3ctouch = (window.PointerEvent || false) && ((navigator.MaxTouchPoints > 0) || (navigator.msMaxTouchPoints > 0)); //IE11 pointer events, following W3C Pointer Events spec - d.hasmstouch = (!d.hasw3ctouch) && (window.MSPointerEvent || false); // IE10 pointer events + d.cantouch = ("ontouchstart" in _doc.documentElement) || ("ontouchstart" in _win); // with detection for Chrome Touch Emulation + d.hasw3ctouch = (_win.PointerEvent || false) && ((navigator.MaxTouchPoints > 0) || (navigator.msMaxTouchPoints > 0)); //IE11 pointer events, following W3C Pointer Events spec + d.hasmstouch = (!d.hasw3ctouch) && (_win.MSPointerEvent || false); // IE10 pointer events d.ismac = /^mac$/i.test(_platform); @@ -175,7 +176,7 @@ d.isios4 = d.isios && !("seal" in Object); d.isios7 = d.isios && ("webkitHidden" in _doc); //iOS 7+ d.isios8 = d.isios && ("hidden" in _doc); //iOS 8+ - d.isios10 = d.isios && window.Proxy; //iOS 10+ + d.isios10 = d.isios && _win.Proxy; //iOS 10+ d.isandroid = (/android/i.test(_agent)); @@ -259,7 +260,7 @@ var self = this; - this.version = '3.7.3'; + this.version = '3.7.4-c'; this.name = 'nicescroll'; this.me = me; @@ -339,10 +340,10 @@ // http://dev.w3.org/csswg/css-writing-modes-3/#logical-to-physical // http://dev.w3.org/csswg/css-writing-modes-3/#svg-writing-mode if (this.opt.rtlmode == "auto") { - var target = this.win[0] == window ? this.body : this.win; + var target = this.win[0] == _win ? this.body : this.win; var writingMode = target.css("writing-mode") || target.css("-webkit-writing-mode") || target.css("-ms-writing-mode") || target.css("-moz-writing-mode"); - if (writingMode == "horizontal-tb" || writingMode == "lr-tb" || writingMode == "") { + if (writingMode == "horizontal-tb" || writingMode == "lr-tb" || writingMode === "") { this.isrtlmode = (target.css("direction") == "rtl"); this.isvertical = false; } else { @@ -457,27 +458,16 @@ }; - var _onsync = false; - this.synched = function (name, fn) { - - function requestSync() { - if (_onsync) return; + if (self.synclist[name]) self.synclist[name] = fn; + else { + self.synclist[name] = fn; setAnimationFrame(function () { if (!self) return; - _onsync = false; - for (var nn in self.synclist) { - var fn = self.synclist[nn]; - if (fn) fn.call(self); - self.synclist[nn] = false; - } + self.synclist[name] && self.synclist[name].call(self); + self.synclist[name] = null; }); - _onsync = true; } - - self.synclist[name] = fn; - requestSync(); - return name; }; this.unsynched = function (name) { @@ -512,7 +502,7 @@ this.p4 = p4 || 1; this.ts = now(); - this.df = this.ed - this.st; + this.df = ed - st; }; BezierClass.prototype = { B2: function (t) { @@ -524,11 +514,13 @@ B4: function (t) { return (1 - t) * (1 - t) * (1 - t); }, + getPos: function () { + return (now() - this.ts) / this.spd; + }, getNow: function () { - var nw = now(); - var pc = 1 - ((nw - this.ts) / this.spd); + var pc = 1 - ((now() - this.ts) / this.spd); var bz = this.B2(pc) + this.B3(pc) + this.B4(pc); - return (pc < 0) ? this.ed : this.st + Math.round(this.df * bz); + return (pc < 0) ? this.ed : this.st + (this.df * bz) | 0; }, update: function (ed, spd) { this.st = this.getNow(); @@ -581,7 +573,7 @@ this.notifyScrollEvent = function (el) { var e = _doc.createEvent("UIEvents"); - e.initUIEvent("scroll", false, true, window, 1); + e.initUIEvent("scroll", false, true, _win, 1); e.niceevent = true; el.dispatchEvent(e); }; @@ -621,7 +613,8 @@ return self.docscroll.scrollTop(); }; this.setScrollTop = function (val) { - return setTimeout(function () { (self) && self.docscroll.scrollTop(val) }, 1); + //return setTimeout(function () { self && self.docscroll.scrollTop(val); }, 1); + self.docscroll.scrollTop(val); }; this.getScrollLeft = function () { var val; @@ -671,7 +664,7 @@ while (dom.length > 0) { if (dom[0].nodeType == 9) return false; var zi = dom.css('zIndex'); - if (!isNaN(zi) && zi != 0) return parseInt(zi); + if (!isNaN(zi) && zi !== 0) return parseInt(zi); dom = dom.parent(); } return false; @@ -698,8 +691,8 @@ this.getDocumentScrollOffset = function () { return { - top: window.pageYOffset || _doc.documentElement.scrollTop, - left: window.pageXOffset || _doc.documentElement.scrollLeft + top: _win.pageYOffset || _doc.documentElement.scrollTop, + left: _win.pageXOffset || _doc.documentElement.scrollLeft }; }; @@ -729,7 +722,6 @@ if (self.railh) self.railh.css({ //** width: self.win.innerWidth() - (self.opt.railpadding.left + self.opt.railpadding.right) }); - } else { var wpos = self.getOffset(); pos = { @@ -805,8 +797,12 @@ }; - self.hasanimationframe = ("requestAnimationFrame" in window); - self.hascancelanimationframe = ("cancelAnimationFrame" in window); + self.newscrolly = self.newscrollx = 0; + + self.hasanimationframe = ("requestAnimationFrame" in _win); + self.hascancelanimationframe = ("cancelAnimationFrame" in _win); + + self.hasborderbox = false; this.init = function () { @@ -817,9 +813,16 @@ self.opt.emulatetouch = self.opt.emulatetouch || self.opt.touchbehavior; // mantain compatibility with "touchbehavior" + self.hasborderbox = _win.getComputedStyle && (_win.getComputedStyle(_doc.body)['box-sizing'] === "border-box"); + var _scrollyhidden = { 'overflow-y': 'hidden' }; if (cap.isie11 || cap.isie10) _scrollyhidden['-ms-overflow-style'] = 'none'; // IE 10 & 11 is always a world apart! + if (self.ishwscroll) { + this.doc.css(cap.transitionstyle, cap.prefixstyle + 'transform 0ms ease-out'); + if (cap.transitionend) self.bind(self.doc, cap.transitionend, self.onScrollTransitionEnd, false); //I have got to do something usefull!! + } + self.zindex = "auto"; if (!self.ispage && self.opt.zindex == "auto") { self.zindex = getZIndex() || "auto"; @@ -831,7 +834,7 @@ globalmaxzindex = self.zindex; } - if (self.isie && self.zindex == 0 && self.opt.zindex == "auto") { // fix IE auto == 0 + if (self.isie && self.zindex === 0 && self.opt.zindex == "auto") { // fix IE auto == 0 self.zindex = "auto"; } @@ -876,8 +879,8 @@ var v, a, kp = ["left", "right", "top", "bottom"]; //** for (var n in kp) { a = kp[n]; - v = self.opt.railpadding[a]; - (v) ? rail.css("padding-" + a, v + "px") : self.opt.railpadding[a] = 0; + v = self.opt.railpadding[a] || 0; + v && rail.css("padding-" + a, v + "px"); } rail.append(cursor); @@ -942,7 +945,7 @@ overflowX: 'hidden' }); - var cursor = $(_doc.createElement('div')); + cursor = $(_doc.createElement('div')); cursor.css({ position: "absolute", top: 0, @@ -995,11 +998,9 @@ top: 0, height: "100%" }); - (rail.align) ? rail.css({ - right: 0 - }) : rail.css({ - left: 0 - }); + + rail.css((rail.align) ? { right: 0 } : { left: 0 }); + self.body.append(rail); if (self.railh) { railh.css({ @@ -1007,18 +1008,14 @@ left: 0, width: "100%" }); - (railh.align) ? railh.css({ - bottom: 0 - }) : railh.css({ - top: 0 - }); + + railh.css((railh.align) ? { bottom: 0 } : { top: 0 }); + self.body.append(railh); } } else { if (self.ishwscroll) { - if (self.win.css('position') == 'static') self.css(self.win, { - 'position': 'relative' - }); + if (self.win.css('position') == 'static') self.css(self.win, { 'position': 'relative' }); var bd = (self.win[0].nodeName == 'HTML') ? self.body : self.win; $(bd).scrollTop(0).scrollLeft(0); // fix rail position if content already scrolled if (self.zoom) { @@ -1034,11 +1031,7 @@ position: "absolute", top: 0 }); - (rail.align) ? rail.css({ - right: 0 - }) : rail.css({ - left: 0 - }); + rail.css((rail.align) ? { right: 0 } : { left: 0 }); bd.append(rail); if (railh) { railh.css({ @@ -1046,11 +1039,7 @@ left: 0, bottom: 0 }); - (railh.align) ? railh.css({ - bottom: 0 - }) : railh.css({ - top: 0 - }); + railh.css((railh.align) ? { bottom: 0 } : { top: 0 }); bd.append(railh); } } else { @@ -1060,7 +1049,7 @@ if (!self.isfixed) self.viewport = self.getViewport(self.win[0]); if (self.viewport) { self.body = self.viewport; - if ((/fixed|absolute/.test(self.viewport.css("position"))) == false) self.css(self.viewport, { + if (!(/fixed|absolute/.test(self.viewport.css("position")))) self.css(self.viewport, { "position": "relative" }); } @@ -1123,7 +1112,8 @@ self.ontouchstart = function (e) { - if (e.pointerType && e.pointerType != 2 && e.pointerType != "touch") return false; + //if (e.pointerType && e.pointerType != 2 && e.pointerType != "touch") return false; + if (e.pointerType && (e.pointerType === 'mouse' || e.pointerType === e.MSPOINTER_TYPE_MOUSE)) return false; self.hasmoving = false; @@ -1247,7 +1237,8 @@ if (!self.rail.drag) return true; if (self.rail.drag.pt == 2) { - if (e.pointerType && e.pointerType != 2 && e.pointerType != "touch") return false; + //if (e.pointerType && e.pointerType != 2 && e.pointerType != "touch") return false; + if (e.pointerType && (e.pointerType === 'mouse' || e.pointerType === e.MSPOINTER_TYPE_MOUSE)) return false; /* if (!self.hasmoving) { @@ -1287,7 +1278,8 @@ if (e.targetTouches.length > 1) return false; // multitouch } - if (e.pointerType && e.pointerType != 2 && e.pointerType != "touch") return false; + //if (e.pointerType && e.pointerType != 2 && e.pointerType != "touch") return false; + if (e.pointerType && (e.pointerType === 'mouse' || e.pointerType === e.MSPOINTER_TYPE_MOUSE)) return false; if (self.rail.drag.pt == 2) { @@ -1298,7 +1290,7 @@ if (self.rail.drag.y === e.clientY && self.rail.drag.x === e.clientX) return false; // prevent first useless move event - if (!self.hasmoving) self.onscrollstart && self.triggerScrollStart(e.clientX,e.clientY,0,0,0); + if (!self.hasmoving) self.triggerScrollStart(e.clientX, e.clientY, 0, 0, 0); self.hasmoving = true; if (self.preventclick && !self.preventclick.click) { @@ -1392,7 +1384,7 @@ self.synched("touchmove", function () { if (self.rail.drag && (self.rail.drag.pt == 2)) { - if (self.prepareTransition) self.prepareTransition(0); + if (self.prepareTransition) self.resetTransition(); if (self.rail.scrollable) self.setScrollTop(ny); self.scrollmom.update(fx, fy); if (self.railh && self.railh.scrollable) { @@ -1491,7 +1483,8 @@ hr: hronly || false }; var tg = self.getTarget(e); - if (!self.ispage && cap.hasmousecapture) tg.setCapture(); + //if (!self.ispage && cap.hasmousecapture) tg.setCapture(); + if (cap.hasmousecapture) tg.setCapture(); if (self.isiframe && !cap.hasmousecapture) { self.saved.csspointerevents = self.doc.css("pointer-events"); self.css(self.doc, { @@ -1509,6 +1502,7 @@ if (cap.hasmousecapture) _doc.releaseCapture(); if (self.isiframe && !cap.hasmousecapture) self.doc.css("pointer-events", self.saved.csspointerevents); self.rail.drag = false; + self.cursorfreezed = false; if (self.hasmoving) self.triggerScrollEnd(); // TODO - check &&!self.scrollrunning return self.cancelEvent(e); } @@ -1521,6 +1515,9 @@ if (cap.ischrome && e.which === 0) return self.onmouseup(e); self.cursorfreezed = true; + + if (!self.hasmoving) self.triggerScrollStart(e.clientX, e.clientY, 0, 0, 0); + self.hasmoving = true; if (self.rail.drag.hr) { @@ -1536,8 +1533,10 @@ } self.synched('mousemove', function () { - if (self.rail.drag && (self.rail.drag.pt == 1)) { + + if (self.cursorfreezed) { self.showCursor(); + /* if (self.rail.drag.hr) { if (self.hasreversehr) { self.doScrollLeft(self.scrollvaluemaxw - Math.round(self.scroll.x * self.scrollratio.x), self.opt.cursordragspeed); @@ -1546,6 +1545,14 @@ } } else self.doScrollTop(Math.round(self.scroll.y * self.scrollratio.y), self.opt.cursordragspeed); + */ + + if (self.rail.drag.hr) { + self.scrollLeft(Math.round(self.scroll.x * self.scrollratio.x)); + } else { + self.scrollTop(Math.round(self.scroll.y * self.scrollratio.y)); + } + } }); @@ -1598,7 +1605,7 @@ if (df >= ww) df -= ww; self.selectiondrag.df = df; } - if (self.selectiondrag.df == 0) return; + if (self.selectiondrag.df === 0) return; var rt = -Math.floor(self.selectiondrag.df / 6) * 2; self.doScrollBy(rt); @@ -1859,9 +1866,9 @@ //Thanks to http://www.quirksmode.org !! self.onkeypress = function (e) { - if (self.railslocked && self.page.maxh == 0) return true; + if (self.railslocked && self.page.maxh === 0) return true; - e = (e) ? e : window.e; + e = e || _win.event; var tg = self.getTarget(e); if (tg && /INPUT|TEXTAREA|SELECT|OPTION/.test(tg.nodeName)) { var tp = tg.getAttribute('type') || tg.type || false; @@ -1951,14 +1958,14 @@ var ctrl = e.ctrlKey || false; if (!ctrl) self.wheelprevented = false; }); - self.bind(window, "blur", function (e) { + self.bind(_win, "blur", function (e) { self.wheelprevented = false; }); - self.bind(window, 'resize', self.lazyResize); - self.bind(window, 'orientationchange', self.lazyResize); + self.bind(_win, 'resize', self.lazyResize); + self.bind(_win, 'orientationchange', self.lazyResize); - self.bind(window, "load", self.lazyResize); + self.bind(_win, "load", self.lazyResize); if (cap.ischrome && !self.ispage && !self.haswrapper) { //chrome void scrollbar bug - it persists in version 26 var tmp = self.win.attr("style"); @@ -2036,7 +2043,7 @@ // - if (!self.ispage && self.opt.boxzoom) self.bind(window, "resize", self.resizeZoom); + if (!self.ispage && self.opt.boxzoom) self.bind(_win, "resize", self.resizeZoom); if (self.istextarea) { self.bind(self.win, "keydown", self.lazyResize); self.bind(self.win, "mouseup", self.lazyResize); @@ -2060,7 +2067,7 @@ } if (self.iframexd) { - if ("console" in window) console.log('NiceScroll error: policy restriced iframe'); + if ("console" in _win) console.log('NiceScroll error: policy restriced iframe'); return true; //cross-domain - I can't manage this } @@ -2132,7 +2139,7 @@ } }; - if (this.doc[0].readyState && this.doc[0].readyState == "complete") { + if (this.doc[0].readyState && this.doc[0].readyState === "complete") { setTimeout(function () { oniframeload.call(self.doc[0], false); }, 500); @@ -2158,10 +2165,10 @@ if (!self.rail.drag || self.rail.drag.pt != 1) { if (py !== undefined && py !== false) { - self.scroll.y = Math.round(py * 1 / self.scrollratio.y); + self.scroll.y = (py / self.scrollratio.y) | 0; } if (px !== undefined) { - self.scroll.x = Math.round(px * 1 / self.scrollratio.x); + self.scroll.x = (px / self.scrollratio.x) | 0; } } @@ -2171,12 +2178,9 @@ }); if (self.cursorh) { var lx = (self.hasreversehr) ? self.scrollvaluemaxw - self.scroll.x : self.scroll.x; - (!self.rail.align && self.rail.visibility) ? self.cursorh.css({ + self.cursorh.css({ width: self.cursorwidth, - left: lx + self.rail.width - }) : self.cursorh.css({ - width: self.cursorwidth, - left: lx + left: (!self.rail.align && self.rail.visibility) ? lx + self.rail.width : lx }); self.cursoractive = true; } @@ -2190,7 +2194,8 @@ if (self.cursortimeout) return; if (!self.rail) return; if (!self.autohidedom) return; - if (self.hasmousefocus && self.opt.autohidemode == "leave") return; + + if (self.hasmousefocus && self.opt.autohidemode === "leave") return; self.cursortimeout = setTimeout(function () { if (!self.rail.active || !self.showonmouseevent) { self.autohidedom.stop().animate({ @@ -2234,14 +2239,16 @@ if (!self || !self.win) return false; - if (!self.haswrapper && !self.ispage) { - if (self.win.css('display') == 'none') { - if (self.visibility) self.hideRail().hideRailHr(); - return false; - } else { - if (!self.hidden && !self.visibility) self.showRail().showRailHr(); - } - } + /* + if (!self.haswrapper && !self.ispage) { + if (self.win.css('display') === 'none') { + if (self.visibility) self.hideRail().hideRailHr(); + return false; + } else { + if (!self.hidden && !self.visibility) self.showRail().showRailHr(); + } + } + */ var premaxh = self.page.maxh; var premaxw = self.page.maxw; @@ -2322,7 +2329,10 @@ self.cursorwidth = Math.min(self.view.w, Math.round(self.view.w * (self.view.w / self.page.w))); self.cursorwidth = (self.opt.cursorfixedheight) ? self.opt.cursorfixedheight : Math.max(self.opt.cursorminheight, self.cursorwidth); + // self.cursorwidth -= self.railh.cursor[0].outerWidth - self.railh.cursor[0].innerWidth; + self.scrollvaluemax = self.view.h - self.cursorheight - (self.opt.railpadding.top + self.opt.railpadding.bottom); // - self.cursor.hborder //** + if (!self.hasborderbox) self.scrollvaluemax -= self.cursor[0].offsetHeight - self.cursor[0].clientHeight; if (self.railh) { self.railh.width = (self.page.maxh > 0) ? (self.view.w - self.rail.width) : self.view.w; @@ -2347,12 +2357,12 @@ if (sy > self.page.maxh) { self.doScrollTop(self.page.maxh); } else { - self.scroll.y = Math.round(self.getScrollTop() * (1 / self.scrollratio.y)); - self.scroll.x = Math.round(self.getScrollLeft() * (1 / self.scrollratio.x)); + self.scroll.y = (self.getScrollTop() / self.scrollratio.y) | 0; + self.scroll.x = (self.getScrollLeft() / self.scrollratio.x) | 0; if (self.cursoractive) self.noticeCursor(); } - if (self.scroll.y && (self.getScrollTop() == 0)) self.doScrollTo(Math.floor(self.scroll.y * self.scrollratio.y)); + if (self.scroll.y && (self.getScrollTop() === 0)) self.doScrollTo(Math.floor(self.scroll.y * self.scrollratio.y)); return self; }; @@ -2363,10 +2373,14 @@ this.lazyResize = function (tm) { // event debounce - if (!self.haswrapper) self.hide(); + if (!self.haswrapper && !self.ispage) self.hide(); + if (self.hlazyresize) clearTimeout(self.hlazyresize); self.hlazyresize = setTimeout(function () { - if (self) { self.resize(); self.show(); } // this form mandatory for uglify + if (self) { + if (!self.haswrapper && !self.ispage) self.show(); + self.resize(); + } }, 240); return self; @@ -2376,7 +2390,7 @@ // derived by MDN https://developer.mozilla.org/en-US/docs/DOM/Mozilla_event_reference/wheel function _modernWheelEvent(dom, name, fn, bubble) { self._bind(dom, name, function (e) { - var e = (e) ? e : window.event; + e = e || _win.event; var event = { original: e, target: e.target || e.srcElement, @@ -2414,7 +2428,7 @@ f: fn, q: true }); - $(dom).bind(name, fn); + $(dom).on(name, fn); }; this.mousewheel = function (dom, fn, bubble) { // bind mousewheel @@ -2433,11 +2447,11 @@ if (cap.haseventlistener) { // W3C standard event model // thanks to https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener - try { var options = Object.defineProperty({}, "passive", { get: function () { passiveSupported = !0 } }); window.addEventListener("test", null, options) } catch (err) { } + try { var options = Object.defineProperty({}, "passive", { get: function () { passiveSupported = !0; } }); _win.addEventListener("test", null, options); } catch (err) { } this.cancelEvent = function (e) { if (!e) return false; - var e = (e.original) ? e.original : e; + e = (e.original) ? e.original : e; if (e.cancelable) e.preventDefault(); e.stopPropagation(); if (e.preventManipulation) e.preventManipulation(); //IE10 @@ -2445,7 +2459,7 @@ }; this.stopPropagation = function (e) { if (!e) return false; - var e = (e.original) ? e.original : e; + e = (e.original) ? e.original : e; e.stopPropagation(); return false; }; @@ -2462,16 +2476,16 @@ this.cancelBubble = true; }; - window.constructor.prototype.addEventListener = _doc.constructor.prototype.addEventListener = Element.prototype.addEventListener = function (type, listener, useCapture) { + _win.constructor.prototype.addEventListener = _doc.constructor.prototype.addEventListener = Element.prototype.addEventListener = function (type, listener, useCapture) { this.attachEvent("on" + type, listener); - } - window.constructor.prototype.removeEventListener = _doc.constructor.prototype.removeEventListener = Element.prototype.removeEventListener = function (type, listener, useCapture) { + }; + _win.constructor.prototype.removeEventListener = _doc.constructor.prototype.removeEventListener = Element.prototype.removeEventListener = function (type, listener, useCapture) { this.detachEvent("on" + type, listener); - } + }; // Thanks to http://www.switchonthecode.com !! this.cancelEvent = function (e) { - var e = window.event || false; + e = e || _win.event; if (!e) return false; e.cancelBubble = true; e.cancel = true; @@ -2479,9 +2493,8 @@ return false; }; this.stopPropagation = function (e) { - var e = window.event || false; - if (!e) return false; - e.cancelBubble = true; + e = e || _win.event; + if (e) e.cancelBubble = true; return false; }; @@ -2517,7 +2530,7 @@ }; this.showRail = function () { - if ((self.page.maxh != 0) && (self.ispage || self.win.css('display') != 'none')) { + if ((self.page.maxh !== 0) && (self.ispage || self.win.css('display') != 'none')) { self.visibility = true; self.rail.visibility = true; self.rail.css('display', 'block'); @@ -2527,7 +2540,7 @@ this.showRailHr = function () { if (!self.railh) return self; - if ((self.page.maxw != 0) && (self.ispage || self.win.css('display') != 'none')) { + if ((self.page.maxw !== 0) && (self.ispage || self.win.css('display') != 'none')) { self.railh.visibility = true; self.railh.css('display', 'block'); } @@ -2670,122 +2683,177 @@ return false; //(dom) ? $(dom) : false; }; - this.triggerScrollStart = function (px,py,x,y,ms) { + this.triggerScrollStart = function (cx, cy, rx, ry, ms) { - var info = { - "type": "scrollstart", - "current": { - "x": px, - "y": py - }, - "request": { - "x": x, - "y": y - }, - "end": { - "x": self.newscrollx, - "y": self.newscrolly - }, - "speed": ms - }; + if (self.onscrollstart) { - self.onscrollstart.call(self, info); + var info = { + "type": "scrollstart", + "current": { + "x": cx, + "y": cy + }, + "request": { + "x": rx, + "y": ry + }, + "end": { + "x": self.newscrollx, + "y": self.newscrolly + }, + "speed": ms + }; + + self.onscrollstart.call(self, info); + + } }; this.triggerScrollEnd = function () { - if (!self.onscrollend) return; + if (self.onscrollend) { - var px = self.getScrollLeft(); - var py = self.getScrollTop(); + var px = self.getScrollLeft(); + var py = self.getScrollTop(); + + var info = { + type: "scrollend", + current: { + x: px, + y: py + }, + end: { + x: px, + y: py + } + }; + self.onscrollend.call(self, info); + + } - var info = { - type: "scrollend", - current: { - x: px, - y: py - }, - end: { - x: px, - y: py - } - }; - self.onscrollend.call(self, info); }; - function execScrollWheel(e, hr, chkscroll) { - var px, py; + var scrolldiry = 0, scrolldirx = 0, scrolltmr = 0, scrollspd = 1; - if (e.deltaMode == 0) { // PIXEL - px = -Math.floor(e.deltaX * (self.opt.mousescrollstep / (18 * 3))); - py = -Math.floor(e.deltaY * (self.opt.mousescrollstep / (18 * 3))); - } else if (e.deltaMode == 1) { // LINE - px = -Math.floor(e.deltaX * self.opt.mousescrollstep); - py = -Math.floor(e.deltaY * self.opt.mousescrollstep); - } + function doScrollRelative(px, py, chkscroll, iswheel) { - if (hr && self.opt.oneaxismousemode && (px === 0) && py) { // classic vertical-only mousewheel + browser with x/y support - px = py; - py = 0; + if (!self.scrollrunning) { + self.newscrolly = self.getScrollTop(); + self.newscrollx = self.getScrollLeft(); + scrolltmr = now(); + } - if (chkscroll) { - var hrend = (px < 0) ? (self.getScrollLeft() >= self.page.maxw) : (self.getScrollLeft() <= 0); - if (hrend) { // preserve vertical scrolling - py = px; - px = 0; - } - } + var gap = (now() - scrolltmr); + scrolltmr = now(); + if (gap > 350) { + scrollspd = 1; + } else { + scrollspd += (2 - scrollspd) / 10; } - // invert horizontal direction for rtl mode - if (self.isrtlmode) px = -px; + px = px * scrollspd | 0; + py = py * scrollspd | 0; if (px) { - if (self.scrollmom) { - self.scrollmom.stop(); - } else { - + if (iswheel) { // mouse-only if (px < 0) { // fix apple magic mouse swipe back/forward if (self.getScrollLeft() >= self.page.maxw) return true; } else { if (self.getScrollLeft() <= 0) return true; } + } + var dx = px > 0 ? 1 : -1; + + if (scrolldirx !== dx) { + if (self.scrollmom) self.scrollmom.stop(); + self.newscrollx = self.getScrollLeft(); + scrolldirx = dx; } - self.lastdeltax += px; - self.debounced("mousewheelx", function () { - var dt = self.lastdeltax; - self.lastdeltax = 0; - if (!self.rail.drag) { - self.doScrollLeftBy(dt); - } - }, 15); + self.lastdeltax -= px; + } + if (py) { - if (self.opt.nativeparentscrolling && chkscroll && !self.ispage && !self.zoomactive) { + + var chk = (function () { + var top = self.getScrollTop(); if (py < 0) { - if (self.getScrollTop() >= self.page.maxh) return true; + if (top >= self.page.maxh) return true; } else { - if (self.getScrollTop() <= 0) return true; + if (top <= 0) return true; } + })(); + + if (chk) { + if (!self.scrollrunning && self.opt.nativeparentscrolling && chkscroll && !self.ispage && !self.zoomactive) return true; + var ny = self.view.h >> 1; + if (self.newscrolly < -ny) { self.newscrolly = -ny; py = -1; } + else if (self.newscrolly > self.page.maxh + ny) { self.newscrolly = self.page.maxh + ny; py = 1; } + else py = 0; } - if (self.scrollmom) { - self.scrollmom.stop(); + + var dy = py > 0 ? 1 : -1; + + if (scrolldiry !== dy) { + if (self.scrollmom) self.scrollmom.stop(); + self.newscrolly = self.getScrollTop(); + scrolldiry = dy; } - self.lastdeltay += py; - // self.debounced("mousewheely", function() { - self.synched("mousewheely", function () { - var dt = self.lastdeltay; + + self.lastdeltay -= py; + + } + + if (py || px) { + self.synched("relativexy", function () { + + var dty = self.lastdeltay + self.newscrolly; self.lastdeltay = 0; - if (!self.rail.drag) { - self.doScrollBy(dt); + + var dtx = self.lastdeltax + self.newscrollx; + self.lastdeltax = 0; + + if (!self.rail.drag) self.doScrollPos(dtx, dty); + + }); + } + + } + + function execScrollWheel(e, hr, chkscroll) { + var px, py; + + if (e.deltaMode === 0) { // PIXEL + px = -(e.deltaX * (self.opt.mousescrollstep / (18 * 3))) | 0; + py = -(e.deltaY * (self.opt.mousescrollstep / (18 * 3))) | 0; + } else if (e.deltaMode === 1) { // LINE + px = -(e.deltaX * self.opt.mousescrollstep) | 0; + py = -(e.deltaY * self.opt.mousescrollstep) | 0; + } + + if (hr && self.opt.oneaxismousemode && (px === 0) && py) { // classic vertical-only mousewheel + browser with x/y support + px = py; + py = 0; + + if (chkscroll) { + var hrend = (px < 0) ? (self.getScrollLeft() >= self.page.maxw) : (self.getScrollLeft() <= 0); + if (hrend) { // preserve vertical scrolling + py = px; + px = 0; } - }, 15); + } + } + // invert horizontal direction for rtl mode + if (self.isrtlmode) px = -px; + + doScrollRelative(px, py, chkscroll, true); + e.stopImmediatePropagation(); return e.preventDefault(); } @@ -2851,9 +2919,9 @@ }; this.getTransitionSpeed = function (dif) { - var sp = Math.round(self.opt.scrollspeed * 10); - var ex = Math.min(sp, Math.round((dif / 20) * self.opt.scrollspeed)); - return (ex > 20) ? ex : 0; + + return 80 + (dif / 72) * self.opt.scrollspeed | 0; + }; if (!self.opt.smoothscroll) { @@ -2877,12 +2945,20 @@ }; this.cancelScroll = function () { }; // direct } else if (self.ishwscroll && cap.hastransition && self.opt.usetransition && !!self.opt.smoothscroll) { + + var lasttransitionstyle = ''; + + this.resetTransition = function() { + lasttransitionstyle = ''; + self.doc.css(cap.prefixstyle + 'transition-duration', '0ms'); + }; + this.prepareTransition = function (dif, istime) { - var ex = (istime) ? ((dif > 20) ? dif : 0) : self.getTransitionSpeed(dif); - var trans = (ex) ? cap.prefixstyle + 'transform ' + ex + 'ms ease-out' : ''; - if (!self.lasttransitionstyle || self.lasttransitionstyle != trans) { - self.lasttransitionstyle = trans; - self.doc.css(cap.transitionstyle, trans); + var ex = (istime) ? dif : self.getTransitionSpeed(dif); + var trans = ex + 'ms'; + if (lasttransitionstyle !== trans) { + lasttransitionstyle = trans; + self.doc.css(cap.prefixstyle + 'transition-duration', trans); } return ex; }; @@ -2897,6 +2973,24 @@ self.doScrollPos(x, y, spd); }; + this.cursorupdate = { + running: false, + start: function () { + if (this.running) return; + this.running = true; + + var loop = function () { + setAnimationFrame(loop); + self.showCursor(self.getScrollTop(), self.getScrollLeft()); + }; + + setAnimationFrame(loop); + }, + stop: function () { + this.running = false; + } + }; + this.doScrollPos = function (x, y, spd) { //trans var py = self.getScrollTop(); @@ -2904,11 +2998,16 @@ if (((self.newscrolly - py) * (y - py) < 0) || ((self.newscrollx - px) * (x - px) < 0)) self.cancelScroll(); //inverted movement detection - if (self.opt.bouncescroll == false) { + if (!self.opt.bouncescroll) { if (y < 0) y = 0; else if (y > self.page.maxh) y = self.page.maxh; if (x < 0) x = 0; else if (x > self.page.maxw) x = self.page.maxw; + } else { + if (y < 0) y = y / 2 | 0; + else if (y > self.page.maxh) y = self.page.maxh + (y - self.page.maxh) / 2 | 0; + if (x < 0) x = x / 2 | 0; + else if (x > self.page.maxw) x = self.page.maxw + (y - self.page.maxw) / 2 | 0; } if (self.scrollrunning && x == self.newscrollx && y == self.newscrolly) return false; @@ -2916,67 +3015,83 @@ self.newscrolly = y; self.newscrollx = x; - self.newscrollspeed = spd || false; - - if (self.timer) return false; - - self.timer = setTimeout(function () { + //self.newscrollspeed = spd || false; - var top = self.getScrollTop(); - var lft = self.getScrollLeft(); - - var dst = {}; - dst.x = x - lft; - dst.y = y - top; - dst.px = lft; - dst.py = top; + var top = self.getScrollTop(); + var lft = self.getScrollLeft(); - var dd = Math.round(Math.sqrt(Math.pow(dst.x, 2) + Math.pow(dst.y, 2))); - var ms = (self.newscrollspeed && self.newscrollspeed > 1) ? self.newscrollspeed : self.getTransitionSpeed(dd); - if (self.newscrollspeed && self.newscrollspeed <= 1) ms *= self.newscrollspeed; + var dst = {}; + dst.x = x - lft; + dst.y = y - top; + //dst.px = lft; + //dst.py = top; - self.prepareTransition(ms, true); + var dd = Math.sqrt((dst.x * dst.x) + (dst.y * dst.y)) | 0; - if (self.timerscroll && self.timerscroll.tm) clearInterval(self.timerscroll.tm); + var ms = self.prepareTransition(dd); - if (ms > 0) { - - if (!self.scrollrunning && self.onscrollstart) { - self.triggerScrollStart(lft,top,x,y,ms); - } - - if (cap.transitionend) { - if (!self.scrollendtrapped) { - self.scrollendtrapped = true; - self.bind(self.doc, cap.transitionend, self.onScrollTransitionEnd, false); //I have got to do something usefull!! - } - } else { - if (self.scrollendtrapped) clearTimeout(self.scrollendtrapped); - self.scrollendtrapped = setTimeout(self.onScrollTransitionEnd, ms); // simulate transitionend event - } - - var py = top; - var px = lft; - self.timerscroll = { - bz: new BezierClass(py, self.newscrolly, ms, 0, 0, 0.58, 1), - bh: new BezierClass(px, self.newscrollx, ms, 0, 0, 0.58, 1) - }; - if (!self.cursorfreezed) self.timerscroll.tm = setInterval(function () { - self.showCursor(self.getScrollTop(), self.getScrollLeft()); - }, 60); - - } + if (!self.scrollrunning) { + self.scrollrunning = true; + self.triggerScrollStart(lft, top, x, y, ms); + self.cursorupdate.start(); + } - self.synched("doScroll-set", function () { - self.timer = 0; - if (self.scrollendtrapped) self.scrollrunning = true; - self.setScrollTop(self.newscrolly); - self.setScrollLeft(self.newscrollx); - if (!self.scrollendtrapped) self.onScrollTransitionEnd(); - }); + self.scrollendtrapped = true; + if (!cap.transitionend) { + if (self.scrollendtrapped) clearTimeout(self.scrollendtrapped); + self.scrollendtrapped = setTimeout(self.onScrollTransitionEnd, ms); // simulate transitionend event + } - }, 50); + self.setScrollTop(self.newscrolly); + self.setScrollLeft(self.newscrollx); + + //if (ms===0) self.onScrollTransitionEnd(); + + /* + if (self.timerscroll && self.timerscroll.tm) clearInterval(self.timerscroll.tm); + + if (ms > 0) { + + if (!self.scrollrunning) self.triggerScrollStart(lft, top, x, y, ms); + + if (cap.transitionend) { + if (!self.scrollendtrapped) { + self.scrollendtrapped = true; + self.bind(self.doc, cap.transitionend, self.onScrollTransitionEnd, false); //I have got to do something usefull!! + } + } else { + if (self.scrollendtrapped) clearTimeout(self.scrollendtrapped); + self.scrollendtrapped = setTimeout(self.onScrollTransitionEnd, ms); // simulate transitionend event + } + + var py = top; + var px = lft; + self.timerscroll = { + bz: new BezierClass(py, self.newscrolly, ms, 0, 0, 0.58, 1), + bh: new BezierClass(px, self.newscrollx, ms, 0, 0, 0.58, 1) + }; + if (!self.cursorfreezed) self.timerscroll.tm = setInterval(function () { + self.showCursor(self.getScrollTop(), self.getScrollLeft()); + }, 60); + + } + + self.synched("doScroll-set", function () { + self.timer = 0; + if (self.scrollendtrapped) self.scrollrunning = true; + self.setScrollTop(self.newscrolly); + self.setScrollLeft(self.newscrollx); + if (!self.scrollendtrapped) self.onScrollTransitionEnd(); + + //console.log(ms,self.newscrolly); + + }); + + + }, 50); + + */ }; @@ -2987,8 +3102,8 @@ self.scrollrunning = false; if (!cap.transitionend) clearTimeout(cap.transitionend); self.scrollendtrapped = false; - self._unbind(self.doc[0], cap.transitionend, self.onScrollTransitionEnd); - self.prepareTransition(0); + //self._unbind(self.doc[0], cap.transitionend, self.onScrollTransitionEnd); + self.resetTransition(); self.setScrollTop(py); // fire event onscroll if (self.railh) self.setScrollLeft(px); if (self.timerscroll && self.timerscroll.tm) clearInterval(self.timerscroll.tm); @@ -2996,23 +3111,16 @@ self.cursorfreezed = false; + self.cursorupdate.stop(); self.showCursor(py, px); return self; }; this.onScrollTransitionEnd = function () { - if (self.scrollendtrapped) self._unbind(self.doc[0], cap.transitionend, self.onScrollTransitionEnd); - self.scrollendtrapped = false; - self.prepareTransition(0); - if (self.timerscroll && self.timerscroll.tm) clearInterval(self.timerscroll.tm); - self.timerscroll = false; + if (!self.scrollendtrapped) return; + //if (self.scrollendtrapped) self._unbind(self.doc[0], cap.transitionend, self.onScrollTransitionEnd); + var py = self.getScrollTop(); var px = self.getScrollLeft(); - self.setScrollTop(py); // fire event onscroll - if (self.railh) self.setScrollLeft(px); // fire event onscroll left - - self.noticeCursor(false, py, px); - - self.cursorfreezed = false; if (py < 0) py = 0; else if (py > self.page.maxh) py = self.page.maxh; @@ -3020,11 +3128,21 @@ else if (px > self.page.maxw) px = self.page.maxw; if ((py != self.newscrolly) || (px != self.newscrollx)) return self.doScrollPos(px, py, self.opt.snapbackspeed); - if (self.onscrollend && self.scrollrunning) { - self.triggerScrollEnd(); - } + if (self.scrollrunning) self.triggerScrollEnd(); self.scrollrunning = false; + self.scrollendtrapped = false; + self.resetTransition(); + //if (self.timerscroll && self.timerscroll.tm) clearInterval(self.timerscroll.tm); + self.timerscroll = false; + self.setScrollTop(py); // fire event onscroll + if (self.railh) self.setScrollLeft(px); // fire event onscroll left + + self.cursorupdate.stop(); + self.noticeCursor(false, py, px); + + self.cursorfreezed = false; + }; } else { @@ -3040,140 +3158,80 @@ }; this.doScrollPos = function (x, y, spd) { //no-trans - var y = (y === undefined || y === false) ? self.getScrollTop(true) : y; - - if ((self.timer) && (self.newscrolly == y) && (self.newscrollx == x)) return true; - - if (self.timer) clearAnimationFrame(self.timer); - self.timer = 0; + //y = y || self.getScrollTop(true); var py = self.getScrollTop(); var px = self.getScrollLeft(); if (((self.newscrolly - py) * (y - py) < 0) || ((self.newscrollx - px) * (x - px) < 0)) self.cancelScroll(); //inverted movement detection - self.newscrolly = y; - self.newscrollx = x; + var clipped = false; if (!self.bouncescroll || !self.rail.visibility) { - if (self.newscrolly < 0) { - self.newscrolly = 0; - } else if (self.newscrolly > self.page.maxh) { - self.newscrolly = self.page.maxh; + if (y < 0) { + y = 0; + clipped = true; + } else if (y > self.page.maxh) { + y = self.page.maxh; + clipped = true; } } if (!self.bouncescroll || !self.railh.visibility) { - if (self.newscrollx < 0) { - self.newscrollx = 0; - } else if (self.newscrollx > self.page.maxw) { - self.newscrollx = self.page.maxw; + if (x < 0) { + x = 0; + clipped = true; + } else if (x > self.page.maxw) { + x = self.page.maxw; + clipped = true; } } + if (self.scrollrunning && (self.newscrolly === y) && (self.newscrollx === x)) return true; + + self.newscrolly = y; + self.newscrollx = x; + self.dst = {}; self.dst.x = x - px; self.dst.y = y - py; self.dst.px = px; self.dst.py = py; - var dst = Math.round(Math.sqrt(Math.pow(self.dst.x, 2) + Math.pow(self.dst.y, 2))); - - self.dst.ax = self.dst.x / dst; - self.dst.ay = self.dst.y / dst; - - var pa = 0; - var pe = dst; + var dd = Math.sqrt((self.dst.x * self.dst.x) + (self.dst.y * self.dst.y)) | 0; + var ms = self.getTransitionSpeed(dd); - if (self.dst.x == 0) { - pa = py; - pe = y; - self.dst.ay = 1; - self.dst.py = 0; - } else if (self.dst.y == 0) { - pa = px; - pe = x; - self.dst.ax = 1; - self.dst.px = 0; - } - - var ms = self.getTransitionSpeed(dst); - if (spd && spd <= 1) ms *= spd; - if (ms > 0) { - self.bzscroll = (self.bzscroll) ? self.bzscroll.update(pe, ms) : new BezierClass(pa, pe, ms, 0, 1, 0, 1); + self.bzscroll = {}; + if (clipped) { + self.bzscroll.x = new BezierClass(px, self.newscrollx, ms, 0, 0, 1, 1); + self.bzscroll.y = new BezierClass(py, self.newscrolly, ms, 0, 0, 1, 1); } else { - self.bzscroll = false; + self.bzscroll.x = new BezierClass(px, self.newscrollx, ms, 0, 0, 0.58, 1); //0, 1, 0, 1 + self.bzscroll.y = new BezierClass(py, self.newscrolly, ms, 0, 0, 0.58, 1); } - if (self.timer) return; - - if ((py == self.page.maxh && y >= self.page.maxh) || (px == self.page.maxw && x >= self.page.maxw)) self.checkContentSize(); - - var sync = 1; - - function scrolling() { - if (self.cancelAnimationFrame) return true; - - self.scrollrunning = true; - - sync = 1 - sync; - if (sync) return (self.timer = setAnimationFrame(scrolling) || 1); + var loop = function () { + if (!self.scrollrunning) return; + var x = self.bzscroll.y.getPos(); - var done = 0; - var sx, sy; + self.setScrollLeft(self.bzscroll.x.getNow()); + self.setScrollTop(self.bzscroll.y.getNow()); - var sc = sy = self.getScrollTop(); - if (self.dst.ay) { - sc = (self.bzscroll) ? self.dst.py + (self.bzscroll.getNow() * self.dst.ay) : self.newscrolly; - var dr = sc - sy; - if ((dr < 0 && sc < self.newscrolly) || (dr > 0 && sc > self.newscrolly)) sc = self.newscrolly; - self.setScrollTop(sc); - if (sc == self.newscrolly) done = 1; + if (x <= 1) { + setAnimationFrame(loop); } else { - done = 1; - } - - var scx = sx = self.getScrollLeft(); - if (self.dst.ax) { - scx = (self.bzscroll) ? self.dst.px + (self.bzscroll.getNow() * self.dst.ax) : self.newscrollx; - var dr = scx - sx; - if ((dr < 0 && scx < self.newscrollx) || (dr > 0 && scx > self.newscrollx)) scx = self.newscrollx; - self.setScrollLeft(scx); - if (scx == self.newscrollx) done += 1; - } else { - done += 1; - } - - if (done == 2) { - self.timer = 0; - self.cursorfreezed = false; - self.bzscroll = false; self.scrollrunning = false; - if (sc < 0) sc = 0; - else if (sc > self.page.maxh) sc = Math.max(0, self.page.maxh); - if (scx < 0) scx = 0; - else if (scx > self.page.maxw) scx = self.page.maxw; - if ((scx != self.newscrollx) || (sc != self.newscrolly)) self.doScrollPos(scx, sc); - else { - if (self.onscrollend) { - self.triggerScrollEnd(); - } - } - } else { - self.timer = setAnimationFrame(scrolling) || 1; + self.timer = 0; + self.triggerScrollEnd(); } - } - self.cancelAnimationFrame = false; - self.timer = 1; - if (self.onscrollstart && !self.scrollrunning) { - self.triggerScrollStart(px,py,x,y,ms); } - scrolling(); - - if ((py == self.page.maxh && y >= py) || (px == self.page.maxw && x >= px)) self.checkContentSize(); + if (!self.scrollrunning) { + self.triggerScrollStart(px, py, x, y, ms); + self.scrollrunning = true; + self.timer = setAnimationFrame(loop); + } - self.noticeCursor(); }; this.cancelScroll = function () { @@ -3187,51 +3245,65 @@ } this.doScrollBy = function (stp, relative) { - var ny = 0; + // var ny = 0; - if (relative) { - ny = Math.floor((self.scroll.y - stp) * self.scrollratio.y); - } else { - var sy = (self.timer) ? self.newscrolly : self.getScrollTop(true); - ny = sy - stp; - } - if (self.bouncescroll) { - var haf = Math.round(self.view.h / 2); - if (ny < -haf) ny = -haf; - else if (ny > (self.page.maxh + haf)) ny = (self.page.maxh + haf); - } - self.cursorfreezed = false; + /* + if (relative) { + ny = Math.floor((self.scroll.y - stp) * self.scrollratio.y); + } else { + var sy = (self.timer) ? self.newscrolly : self.getScrollTop(true); + ny = sy - stp; + } + */ - var py = self.getScrollTop(true); - if (ny < 0 && py <= 0) return self.noticeCursor(); - else if (ny > self.page.maxh && py >= self.page.maxh) { - self.checkContentSize(); - return self.noticeCursor(); - } + /* + var haf = self.view.h << 2; + var ny = self.getScrollTop() + stp; + if (ny < -haf) stp = haf-ny; + else if (ny > (self.page.maxh + haf)) stp = (self.page.maxh + haf -ny); + */ + + // self.cursorfreezed = false; + + /* + var py = self.getScrollTop(true); + if (ny < 0 && py <= 0) return self.noticeCursor(); + else if (ny > self.page.maxh && py >= self.page.maxh) { + self.checkContentSize(); + return self.noticeCursor(); + } + */ + + //self.doScrollTop(ny); - self.doScrollTop(ny); + doScrollRelative(0, stp); }; this.doScrollLeftBy = function (stp, relative) { - var nx = 0; - if (relative) { - nx = Math.floor((self.scroll.x - stp) * self.scrollratio.x); - } else { - var sx = (self.timer) ? self.newscrollx : self.getScrollLeft(true); - nx = sx - stp; - } - if (self.bouncescroll) { - var haf = Math.round(self.view.w / 2); - if (nx < -haf) nx = -haf; - else if (nx > (self.page.maxw + haf)) nx = (self.page.maxw + haf); - } - self.cursorfreezed = false; + /* + var nx = 0; + if (relative) { + nx = Math.floor((self.scroll.x - stp) * self.scrollratio.x); + } else { + var sx = (self.timer) ? self.newscrollx : self.getScrollLeft(true); + nx = sx - stp; + } + if (self.bouncescroll) { + var haf = Math.round(self.view.w / 2); + if (nx < -haf) nx = -haf; + else if (nx > (self.page.maxw + haf)) nx = (self.page.maxw + haf); + } + self.cursorfreezed = false; + + var px = self.getScrollLeft(true); + if (nx < 0 && px <= 0) return self.noticeCursor(); + else if (nx > self.page.maxw && px >= self.page.maxw) return self.noticeCursor(); + + self.doScrollLeft(nx); + */ - var px = self.getScrollLeft(true); - if (nx < 0 && px <= 0) return self.noticeCursor(); - else if (nx > self.page.maxw && px >= self.page.maxw) return self.noticeCursor(); + doScrollRelative(stp, 0); - self.doScrollLeft(nx); }; this.doScrollTo = function (pos, relative) { @@ -3251,12 +3323,11 @@ if (self.rail.drag) return; if (!self.cursorfreezed) { self.synched('scroll', function () { - self.scroll.y = Math.round(self.getScrollTop() * (1 / self.scrollratio.y)); - if (self.railh) self.scroll.x = Math.round(self.getScrollLeft() * (1 / self.scrollratio.x)); + self.scroll.y = Math.round(self.getScrollTop() / self.scrollratio.y); + if (self.railh) self.scroll.x = Math.round(self.getScrollLeft() / self.scrollratio.x); self.noticeCursor(); }); } - //self.triggerScrollEnd(); }; self.bind(self.docscroll, "scroll", self.onscroll); @@ -3295,7 +3366,7 @@ margin: 0 }); var bkg = self.win.css("backgroundColor"); - if (bkg == "" || /transparent|rgba\(0, 0, 0, 0\)|rgba\(0,0,0,0\)/.test(bkg)) self.win.css("backgroundColor", "#fff"); + if ("" === bkg || /transparent|rgba\(0, 0, 0, 0\)|rgba\(0,0,0,0\)/.test(bkg)) self.win.css("backgroundColor", "#fff"); self.rail.css({ zIndex: globalmaxzindex + 101 }); @@ -3669,7 +3740,8 @@ } }; - jQuery.expr[':'].nicescroll = function (a) { + var pseudos = jQuery.expr.pseudos || jQuery.expr[':']; // jQuery 3 migration + pseudos.nicescroll = function (a) { return $.data(a, '__nicescroll') !== undefined; }; @@ -3706,7 +3778,7 @@ return (ret.length === 1) ? ret[0] : ret; }; - window.NiceScroll = { + _win.NiceScroll = { getjQuery: function () { return jQuery; } diff --git a/jquery.nicescroll.min.js b/jquery.nicescroll.min.js index b16abae..70b44d7 100644 --- a/jquery.nicescroll.min.js +++ b/jquery.nicescroll.min.js @@ -1,2 +1,2 @@ -/* nicescroll v3.7.3 InuYaksa - MIT - https://nicescroll.areaaperta.com */ -!function(e){"function"==typeof define&&define.amd?define(["jquery"],e):"object"==typeof exports?module.exports=e(require("jquery")):e(jQuery)}(function(e){"use strict";var o=!1,t=!1,r=0,i=2e3,s=0,n=e,l=document,a=n(window),c=function(){return window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||!1}(),d=function(){return window.cancelAnimationFrame||window.webkitCancelAnimationFrame||window.mozCancelAnimationFrame||!1}();if(c)window.cancelAnimationFrame||(d=function(e){});else{var u=0;c=function(e,o){var t=(new Date).getTime(),r=Math.max(0,16-(t-u)),i=window.setTimeout(function(){e(t+r)},r);return u=t+r,i},d=function(e){window.clearTimeout(e)}}var h=window.MutationObserver||window.WebKitMutationObserver||!1,p=Date.now||function(){return(new Date).getTime()},m={zindex:"auto",cursoropacitymin:0,cursoropacitymax:1,cursorcolor:"#424242",cursorwidth:"6px",cursorborder:"1px solid #fff",cursorborderradius:"5px",scrollspeed:60,mousescrollstep:24,touchbehavior:!1,emulatetouch:!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 e=l.currentScript||function(){var e=l.getElementsByTagName("script");return!!e.length&&e[e.length-1]}(),o=e?e.src.split("?")[0]:"";return o.split("/").length>0?o.split("/").slice(0,-1).join("/")+"/":""}(),preventmultitouchscrolling:!0,disablemutationobserver:!1,enableobserver:!0,scrollbarid:!1},f=!1,g=function(){if(f)return f;var e=l.createElement("DIV"),o=e.style,t=navigator.userAgent,r=navigator.platform,i={};return i.haspointerlock="pointerLockElement"in l||"webkitPointerLockElement"in l||"mozPointerLockElement"in l,i.isopera="opera"in window,i.isopera12=i.isopera&&"getUserMedia"in navigator,i.isoperamini="[object OperaMini]"===Object.prototype.toString.call(window.operamini),i.isie="all"in l&&"attachEvent"in e&&!i.isopera,i.isieold=i.isie&&!("msInterpolationMode"in o),i.isie7=i.isie&&!i.isieold&&(!("documentMode"in l)||7===l.documentMode),i.isie8=i.isie&&"documentMode"in l&&8===l.documentMode,i.isie9=i.isie&&"performance"in window&&9===l.documentMode,i.isie10=i.isie&&"performance"in window&&10===l.documentMode,i.isie11="msRequestFullscreen"in e&&l.documentMode>=11,i.ismsedge="msCredentials"in window,i.ismozilla="MozAppearance"in o,i.iswebkit=!i.ismsedge&&"WebkitAppearance"in o,i.ischrome=i.iswebkit&&"chrome"in window,i.ischrome38=i.ischrome&&"touchAction"in o,i.ischrome22=!i.ischrome38&&i.ischrome&&i.haspointerlock,i.ischrome26=!i.ischrome38&&i.ischrome&&"transition"in o,i.cantouch="ontouchstart"in l.documentElement||"ontouchstart"in window,i.hasw3ctouch=(window.PointerEvent||!1)&&(navigator.MaxTouchPoints>0||navigator.msMaxTouchPoints>0),i.hasmstouch=!i.hasw3ctouch&&(window.MSPointerEvent||!1),i.ismac=/^mac$/i.test(r),i.isios=i.cantouch&&/iphone|ipad|ipod/i.test(r),i.isios4=i.isios&&!("seal"in Object),i.isios7=i.isios&&"webkitHidden"in l,i.isios8=i.isios&&"hidden"in l,i.isios10=i.isios&&window.Proxy,i.isandroid=/android/i.test(t),i.haseventlistener="addEventListener"in e,i.trstyle=!1,i.hastransform=!1,i.hastranslate3d=!1,i.transitionstyle=!1,i.hastransition=!1,i.transitionend=!1,i.trstyle="transform",i.hastransform="transform"in o||function(){for(var e=["msTransform","webkitTransform","MozTransform","OTransform"],t=0,r=e.length;t0;){if(9==e[0].nodeType)return!1;var o=e.css("zIndex");if(!isNaN(o)&&0!=o)return parseInt(o);e=e.parent()}return!1}function b(e,o,t){var r=e.css(o),i=parseFloat(r);if(isNaN(i)){var s=3==(i=P[r]||0)?t?S.win.outerHeight()-S.win.innerHeight():S.win.outerWidth()-S.win.innerWidth():1;return S.isie8&&i&&(i+=1),s?i:0}return i}function y(e,o,t,r){S._bind(e,o,function(r){var i={original:r=r||window.event,target:r.target||r.srcElement,type:"wheel",deltaMode:"MozMousePixelScroll"==r.type?0:1,deltaX:0,deltaZ:0,preventDefault:function(){return r.preventDefault?r.preventDefault():r.returnValue=!1,!1},stopImmediatePropagation:function(){r.stopImmediatePropagation?r.stopImmediatePropagation():r.cancelBubble=!0}};return"mousewheel"==o?(r.wheelDeltaX&&(i.deltaX=-.025*r.wheelDeltaX),r.wheelDeltaY&&(i.deltaY=-.025*r.wheelDeltaY),!i.deltaY&&!i.deltaX&&(i.deltaY=-.025*r.wheelDelta)):i.deltaY=r.detail,t.call(e,i)},r)}function x(e,o,t){var r,i;if(0==e.deltaMode?(r=-Math.floor(e.deltaX*(S.opt.mousescrollstep/54)),i=-Math.floor(e.deltaY*(S.opt.mousescrollstep/54))):1==e.deltaMode&&(r=-Math.floor(e.deltaX*S.opt.mousescrollstep),i=-Math.floor(e.deltaY*S.opt.mousescrollstep)),o&&S.opt.oneaxismousemode&&0===r&&i&&(r=i,i=0,t&&(r<0?S.getScrollLeft()>=S.page.maxw:S.getScrollLeft()<=0)&&(i=r,r=0)),S.isrtlmode&&(r=-r),r){if(S.scrollmom)S.scrollmom.stop();else if(r<0){if(S.getScrollLeft()>=S.page.maxw)return!0}else if(S.getScrollLeft()<=0)return!0;S.lastdeltax+=r,S.debounced("mousewheelx",function(){var e=S.lastdeltax;S.lastdeltax=0,S.rail.drag||S.doScrollLeftBy(e)},15)}if(i){if(S.opt.nativeparentscrolling&&t&&!S.ispage&&!S.zoomactive)if(i<0){if(S.getScrollTop()>=S.page.maxh)return!0}else if(S.getScrollTop()<=0)return!0;S.scrollmom&&S.scrollmom.stop(),S.lastdeltay+=i,S.synched("mousewheely",function(){var e=S.lastdeltay;S.lastdeltay=0,S.rail.drag||S.doScrollBy(e)},15)}return e.stopImmediatePropagation(),e.preventDefault()}var S=this;this.version="3.7.3",this.name="nicescroll",this.me=u;var z=n("body");if(this.opt={doc:z,win:!1},n.extend(this.opt,m),this.opt.snapbackspeed=80,e)for(var k in S.opt)void 0!==e[k]&&(S.opt[k]=e[k]);if(S.opt.disablemutationobserver&&(h=!1),this.doc=S.opt.doc,this.iddoc=this.doc&&this.doc[0]?this.doc[0].id||"":"",this.ispage=/^BODY|HTML/.test(S.opt.win?S.opt.win[0].nodeName:this.doc[0].nodeName),this.haswrapper=!1!==S.opt.win,this.win=S.opt.win||(this.ispage?a:this.doc),this.docscroll=this.ispage&&!this.haswrapper?a:this.win,this.body=z,this.viewport=!1,this.isfixed=!1,this.iframe=!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"!=S.opt.autohidemode,this.onmousedown=!1,this.onmouseup=!1,this.onmousemove=!1,this.onmousewheel=!1,this.onkeypress=!1,this.ongesturezoom=!1,this.onclick=!1,this.onscrollstart=!1,this.onscrollend=!1,this.onscrollcancel=!1,this.onzoomin=!1,this.onzoomout=!1,this.view=!1,this.page=!1,this.scroll={x:0,y:0},this.scrollratio={x:0,y:0},this.cursorheight=20,this.scrollvaluemax=0,"auto"==this.opt.rtlmode){var T=this.win[0]==window?this.body:this.win,M=T.css("writing-mode")||T.css("-webkit-writing-mode")||T.css("-ms-writing-mode")||T.css("-moz-writing-mode");"horizontal-tb"==M||"lr-tb"==M||""==M?(this.isrtlmode="rtl"==T.css("direction"),this.isvertical=!1):(this.isrtlmode="vertical-rl"==M||"tb"==M||"tb-rl"==M||"rl-tb"==M,this.isvertical="vertical-rl"==M||"tb"==M||"tb-rl"==M)}else this.isrtlmode=!0===this.opt.rtlmode,this.isvertical=!1;if(this.scrollrunning=!1,this.scrollmom=!1,this.observer=!1,this.observerremover=!1,this.observerbody=!1,!1===S.opt.scrollbarid)do{this.id="ascrail"+i++}while(l.getElementById(this.id));else this.id=S.opt.scrollbarid;this.rail=!1,this.cursor=!1,this.cursorfreezed=!1,this.selectiondrag=!1,this.zoom=!1,this.zoomactive=!1,this.hasfocus=!1,this.hasmousefocus=!1,this.visibility=!0,this.railslocked=!1,this.locked=!1,this.hidden=!1,this.cursoractive=!0,this.wheelprevented=!1,this.overflowx=S.opt.overflowx,this.overflowy=S.opt.overflowy,this.nativescrollingarea=!1,this.checkarea=0,this.events=[],this.saved={},this.delaylist={},this.synclist={},this.lastdeltax=0,this.lastdeltay=0,this.detected=g();var E=n.extend({},this.detected);this.canhwscroll=E.hastransform&&S.opt.hwacceleration,this.ishwscroll=this.canhwscroll&&S.haswrapper,this.isrtlmode?this.isvertical?this.hasreversehr=!(E.iswebkit||E.isie||E.isie11):this.hasreversehr=!(E.iswebkit||E.isie&&!E.isie10&&!E.isie11):this.hasreversehr=!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,S.opt.enablemouselockapi||(E.hasmousecapture=!1,E.haspointerlock=!1),this.debounced=function(e,o,t){S&&(S.delaylist[e]||!1||(S.delaylist[e]={h:c(function(){S.delaylist[e].fn.call(S),S.delaylist[e]=!1},t)},o.call(S)),S.delaylist[e].fn=o)};var L=!1;this.synched=function(e,o){return S.synclist[e]=o,function(){L||(c(function(){if(S){L=!1;for(var e in S.synclist){var o=S.synclist[e];o&&o.call(S),S.synclist[e]=!1}}}),L=!0)}(),e},this.unsynched=function(e){S.synclist[e]&&(S.synclist[e]=!1)},this.css=function(e,o){for(var t in o)S.saved.css.push([e,t,e.css(t)]),e.css(t,o[t])},this.scrollTop=function(e){return void 0===e?S.getScrollTop():S.setScrollTop(e)},this.scrollLeft=function(e){return void 0===e?S.getScrollLeft():S.setScrollLeft(e)};var C=function(e,o,t,r,i,s,n){this.st=e,this.ed=o,this.spd=t,this.p1=r||0,this.p2=i||1,this.p3=s||0,this.p4=n||1,this.ts=p(),this.df=this.ed-this.st};if(C.prototype={B2:function(e){return 3*e*e*(1-e)},B3:function(e){return 3*e*(1-e)*(1-e)},B4:function(e){return(1-e)*(1-e)*(1-e)},getNow:function(){var e=1-(p()-this.ts)/this.spd,o=this.B2(e)+this.B3(e)+this.B4(e);return e<0?this.ed:this.st+Math.round(this.df*o)},update:function(e,o){return this.st=this.getNow(),this.ed=e,this.spd=o,this.ts=p(),this.df=this.ed-this.st,this}},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(e){if(!e){var o=f();if(o)return 16==o.length?-o[13]:-o[5];if(S.timerscroll&&S.timerscroll.bz)return S.timerscroll.bz.getNow()}return S.doc.translate.y},this.getScrollLeft=function(e){if(!e){var o=f();if(o)return 16==o.length?-o[12]:-o[4];if(S.timerscroll&&S.timerscroll.bh)return S.timerscroll.bh.getNow()}return S.doc.translate.x},this.notifyScrollEvent=function(e){var o=l.createEvent("UIEvents");o.initUIEvent("scroll",!1,!0,window,1),o.niceevent=!0,e.dispatchEvent(o)};var N=this.isrtlmode?1:-1;E.hastranslate3d&&S.opt.enabletranslate3d?(this.setScrollTop=function(e,o){S.doc.translate.y=e,S.doc.translate.ty=-1*e+"px",S.doc.css(E.trstyle,"translate3d("+S.doc.translate.tx+","+S.doc.translate.ty+",0)"),o||S.notifyScrollEvent(S.win[0])},this.setScrollLeft=function(e,o){S.doc.translate.x=e,S.doc.translate.tx=e*N+"px",S.doc.css(E.trstyle,"translate3d("+S.doc.translate.tx+","+S.doc.translate.ty+",0)"),o||S.notifyScrollEvent(S.win[0])}):(this.setScrollTop=function(e,o){S.doc.translate.y=e,S.doc.translate.ty=-1*e+"px",S.doc.css(E.trstyle,"translate("+S.doc.translate.tx+","+S.doc.translate.ty+")"),o||S.notifyScrollEvent(S.win[0])},this.setScrollLeft=function(e,o){S.doc.translate.x=e,S.doc.translate.tx=e*N+"px",S.doc.css(E.trstyle,"translate("+S.doc.translate.tx+","+S.doc.translate.ty+")"),o||S.notifyScrollEvent(S.win[0])})}else this.getScrollTop=function(){return S.docscroll.scrollTop()},this.setScrollTop=function(e){return setTimeout(function(){S&&S.docscroll.scrollTop(e)},1)},this.getScrollLeft=function(){return S.hasreversehr?S.detected.ismozilla?S.page.maxw-Math.abs(S.docscroll.scrollLeft()):S.page.maxw-S.docscroll.scrollLeft():S.docscroll.scrollLeft()},this.setScrollLeft=function(e){return setTimeout(function(){if(S)return S.hasreversehr&&(e=S.detected.ismozilla?-(S.page.maxw-e):S.page.maxw-e),S.docscroll.scrollLeft(e)},1)};this.getTarget=function(e){return!!e&&(e.target?e.target:!!e.srcElement&&e.srcElement)},this.hasParent=function(e,o){if(!e)return!1;for(var t=e.target||e.srcElement||e||!1;t&&t.id!=o;)t=t.parentNode||!1;return!1!==t};var P={thin:1,medium:3,thick:5};this.getDocumentScrollOffset=function(){return{top:window.pageYOffset||l.documentElement.scrollTop,left:window.pageXOffset||l.documentElement.scrollLeft}},this.getOffset=function(){if(S.isfixed){var e=S.win.offset(),o=S.getDocumentScrollOffset();return e.top-=o.top,e.left-=o.left,e}var t=S.win.offset();if(!S.viewport)return t;var r=S.viewport.offset();return{top:t.top-r.top,left:t.left-r.left}},this.updateScrollBar=function(e){var o,t;if(S.ishwscroll)S.rail.css({height:S.win.innerHeight()-(S.opt.railpadding.top+S.opt.railpadding.bottom)}),S.railh&&S.railh.css({width:S.win.innerWidth()-(S.opt.railpadding.left+S.opt.railpadding.right)});else{var r=S.getOffset();if(o={top:r.top,left:r.left-(S.opt.railpadding.left+S.opt.railpadding.right)},o.top+=b(S.win,"border-top-width",!0),o.left+=S.rail.align?S.win.outerWidth()-b(S.win,"border-right-width")-S.rail.width:b(S.win,"border-left-width"),(t=S.opt.railoffset)&&(t.top&&(o.top+=t.top),t.left&&(o.left+=t.left)),S.railslocked||S.rail.css({top:o.top,left:o.left,height:(e?e.h:S.win.innerHeight())-(S.opt.railpadding.top+S.opt.railpadding.bottom)}),S.zoom&&S.zoom.css({top:o.top+1,left:1==S.rail.align?o.left-20:o.left+S.rail.width+4}),S.railh&&!S.railslocked){o={top:r.top,left:r.left},(t=S.opt.railhoffset)&&(t.top&&(o.top+=t.top),t.left&&(o.left+=t.left));var i=S.railh.align?o.top+b(S.win,"border-top-width",!0)+S.win.innerHeight()-S.railh.height:o.top+b(S.win,"border-top-width",!0),s=o.left+b(S.win,"border-left-width");S.railh.css({top:i-(S.opt.railpadding.top+S.opt.railpadding.bottom),left:s,width:S.railh.width})}}},this.doRailClick=function(e,o,t){var r,i,s,n;S.railslocked||(S.cancelEvent(e),"pageY"in e||(e.pageX=e.clientX+l.documentElement.scrollLeft,e.pageY=e.clientY+l.documentElement.scrollTop),o?(r=t?S.doScrollLeft:S.doScrollTop)(s=t?(e.pageX-S.railh.offset().left-S.cursorwidth/2)*S.scrollratio.x:(e.pageY-S.rail.offset().top-S.cursorheight/2)*S.scrollratio.y):(r=t?S.doScrollLeftBy:S.doScrollBy,s=t?S.scroll.x:S.scroll.y,n=t?e.pageX-S.railh.offset().left:e.pageY-S.rail.offset().top,i=t?S.view.w:S.view.h,r(s>=n?i:-i)))},S.hasanimationframe="requestAnimationFrame"in window,S.hascancelanimationframe="cancelAnimationFrame"in window,this.init=function(){if(S.saved.css=[],E.isoperamini)return!0;if(E.isandroid&&!("hidden"in l))return!0;S.opt.emulatetouch=S.opt.emulatetouch||S.opt.touchbehavior;var e={"overflow-y":"hidden"};if((E.isie11||E.isie10)&&(e["-ms-overflow-style"]="none"),S.zindex="auto",S.ispage||"auto"!=S.opt.zindex?S.zindex=S.opt.zindex:S.zindex=w()||"auto",!S.ispage&&"auto"!=S.zindex&&S.zindex>s&&(s=S.zindex),S.isie&&0==S.zindex&&"auto"==S.opt.zindex&&(S.zindex="auto"),!S.ispage||!E.cantouch&&!E.isieold){var i=S.docscroll;S.ispage&&(i=S.haswrapper?S.win:S.doc),S.css(i,e),S.ispage&&(E.isie11||E.isie)&&S.css(n("html"),e),!E.isios||S.ispage||S.haswrapper||S.css(z,{"-webkit-overflow-scrolling":"touch"});var c=n(l.createElement("div"));c.css({position:"relative",top:0,float:"right",width:S.opt.cursorwidth,height:0,"background-color":S.opt.cursorcolor,border:S.opt.cursorborder,"background-clip":"padding-box","-webkit-border-radius":S.opt.cursorborderradius,"-moz-border-radius":S.opt.cursorborderradius,"border-radius":S.opt.cursorborderradius}),c.addClass("nicescroll-cursors"),S.cursor=c;var d=n(l.createElement("div"));d.attr("id",S.id),d.addClass("nicescroll-rails nicescroll-rails-vr");var u,p,m=["left","right","top","bottom"];for(var f in m)p=m[f],(u=S.opt.railpadding[p])?d.css("padding-"+p,u+"px"):S.opt.railpadding[p]=0;d.append(c),d.width=Math.max(parseFloat(S.opt.cursorwidth),c.outerWidth()),d.css({width:d.width+"px",zIndex:S.zindex,background:S.opt.background,cursor:"default"}),d.visibility=!0,d.scrollable=!0,d.align="left"==S.opt.railalign?0:1,S.rail=d,S.rail.drag=!1;var g=!1;!S.opt.boxzoom||S.ispage||E.isieold||(g=l.createElement("div"),S.bind(g,"click",S.doZoom),S.bind(g,"mouseenter",function(){S.zoom.css("opacity",S.opt.cursoropacitymax)}),S.bind(g,"mouseleave",function(){S.zoom.css("opacity",S.opt.cursoropacitymin)}),S.zoom=n(g),S.zoom.css({cursor:"pointer",zIndex:S.zindex,backgroundImage:"url("+S.opt.scriptpath+"zoomico.png)",height:18,width:18,backgroundPosition:"0 0"}),S.opt.dblclickzoom&&S.bind(S.win,"dblclick",S.doZoom),E.cantouch&&S.opt.gesturezoom&&(S.ongesturezoom=function(e){return e.scale>1.5&&S.doZoomIn(e),e.scale<.8&&S.doZoomOut(e),S.cancelEvent(e)},S.bind(S.win,"gestureend",S.ongesturezoom))),S.railh=!1;var b;if(S.opt.horizrailenabled&&(S.css(i,{overflowX:"hidden"}),(c=n(l.createElement("div"))).css({position:"absolute",top:0,height:S.opt.cursorwidth,width:0,backgroundColor:S.opt.cursorcolor,border:S.opt.cursorborder,backgroundClip:"padding-box","-webkit-border-radius":S.opt.cursorborderradius,"-moz-border-radius":S.opt.cursorborderradius,"border-radius":S.opt.cursorborderradius}),E.isieold&&c.css("overflow","hidden"),c.addClass("nicescroll-cursors"),S.cursorh=c,(b=n(l.createElement("div"))).attr("id",S.id+"-hr"),b.addClass("nicescroll-rails nicescroll-rails-hr"),b.height=Math.max(parseFloat(S.opt.cursorwidth),c.outerHeight()),b.css({height:b.height+"px",zIndex:S.zindex,background:S.opt.background}),b.append(c),b.visibility=!0,b.scrollable=!0,b.align="top"==S.opt.railvalign?0:1,S.railh=b,S.railh.drag=!1),S.ispage)d.css({position:"fixed",top:0,height:"100%"}),d.align?d.css({right:0}):d.css({left:0}),S.body.append(d),S.railh&&(b.css({position:"fixed",left:0,width:"100%"}),b.align?b.css({bottom:0}):b.css({top:0}),S.body.append(b));else{if(S.ishwscroll){"static"==S.win.css("position")&&S.css(S.win,{position:"relative"});var y="HTML"==S.win[0].nodeName?S.body:S.win;n(y).scrollTop(0).scrollLeft(0),S.zoom&&(S.zoom.css({position:"absolute",top:1,right:0,"margin-right":d.width+4}),y.append(S.zoom)),d.css({position:"absolute",top:0}),d.align?d.css({right:0}):d.css({left:0}),y.append(d),b&&(b.css({position:"absolute",left:0,bottom:0}),b.align?b.css({bottom:0}):b.css({top:0}),y.append(b))}else{S.isfixed="fixed"==S.win.css("position");var x=S.isfixed?"fixed":"absolute";S.isfixed||(S.viewport=S.getViewport(S.win[0])),S.viewport&&(S.body=S.viewport,0==/fixed|absolute/.test(S.viewport.css("position"))&&S.css(S.viewport,{position:"relative"})),d.css({position:x}),S.zoom&&S.zoom.css({position:x}),S.updateScrollBar(),S.body.append(d),S.zoom&&S.body.append(S.zoom),S.railh&&(b.css({position:x}),S.body.append(b))}E.isios&&S.css(S.win,{"-webkit-tap-highlight-color":"rgba(0,0,0,0)","-webkit-touch-callout":"none"}),E.isie&&S.opt.disableoutline&&S.win.attr("hideFocus","true"),E.iswebkit&&S.opt.disableoutline&&S.win.css("outline","none")}if(!1===S.opt.autohidemode?(S.autohidedom=!1,S.rail.css({opacity:S.opt.cursoropacitymax}),S.railh&&S.railh.css({opacity:S.opt.cursoropacitymax})):!0===S.opt.autohidemode||"leave"===S.opt.autohidemode?(S.autohidedom=n().add(S.rail),E.isie8&&(S.autohidedom=S.autohidedom.add(S.cursor)),S.railh&&(S.autohidedom=S.autohidedom.add(S.railh)),S.railh&&E.isie8&&(S.autohidedom=S.autohidedom.add(S.cursorh))):"scroll"==S.opt.autohidemode?(S.autohidedom=n().add(S.rail),S.railh&&(S.autohidedom=S.autohidedom.add(S.railh))):"cursor"==S.opt.autohidemode?(S.autohidedom=n().add(S.cursor),S.railh&&(S.autohidedom=S.autohidedom.add(S.cursorh))):"hidden"==S.opt.autohidemode&&(S.autohidedom=!1,S.hide(),S.railslocked=!1),E.cantouch||S.istouchcapable||S.opt.emulatetouch||E.hasmstouch){S.scrollmom=new v(S),S.ontouchstart=function(e){if(e.pointerType&&2!=e.pointerType&&"touch"!=e.pointerType)return!1;if(S.hasmoving=!1,!S.railslocked){var o;if(E.hasmstouch)for(o=!!e.target&&e.target;o;){var t=n(o).getNiceScroll();if(t.length>0&&t[0].me==S.me)break;if(t.length>0)return!1;if("DIV"==o.nodeName&&o.id==S.id)break;o=!!o.parentNode&&o.parentNode}if(e.stopPropagation(),S.cancelScroll(),(o=S.getTarget(e))&&/INPUT/i.test(o.nodeName)&&/range/i.test(o.type))return S.stopPropagation(e);if(!("clientX"in e)&&"changedTouches"in e&&(e.clientX=e.changedTouches[0].clientX,e.clientY=e.changedTouches[0].clientY),S.forcescreen){var r=e;(e={original:e.original?e.original:e}).clientX=r.screenX,e.clientY=r.screenY}if(S.rail.drag={x:e.clientX,y:e.clientY,sx:S.scroll.x,sy:S.scroll.y,st:S.getScrollTop(),sl:S.getScrollLeft(),pt:2,dl:!1,tg:o},S.ispage||!S.opt.directionlockdeadzone)S.rail.drag.dl="f";else{var i={w:a.width(),h:a.height()},s={w:Math.max(l.body.scrollWidth,l.documentElement.scrollWidth),h:Math.max(l.body.scrollHeight,l.documentElement.scrollHeight)},c=Math.max(0,s.h-i.h),d=Math.max(0,s.w-i.w);!S.rail.scrollable&&S.railh.scrollable?S.rail.drag.ck=c>0&&"v":S.rail.scrollable&&!S.railh.scrollable?S.rail.drag.ck=d>0&&"h":S.rail.drag.ck=!1,S.rail.drag.ck||(S.rail.drag.dl="f")}if(S.opt.emulatetouch&&S.isiframe&&E.isie){var u=S.win.position();S.rail.drag.x+=u.left,S.rail.drag.y+=u.top}if(S.hasmoving=!1,S.lastmouseup=!1,S.scrollmom.reset(e.clientX,e.clientY),!E.cantouch&&!this.istouchcapable&&!e.pointerType){if(!(!!o&&/INPUT|SELECT|BUTTON|TEXTAREA/i.test(o.nodeName)))return!S.ispage&&E.hasmousecapture&&o.setCapture(),S.opt.emulatetouch?(o.onclick&&!o._onclick&&(o._onclick=o.onclick,o.onclick=function(e){if(S.hasmoving)return!1;o._onclick.call(this,e)}),S.cancelEvent(e)):S.stopPropagation(e);/SUBMIT|CANCEL|BUTTON/i.test(n(o).attr("type"))&&(S.preventclick={tg:o,click:!1})}}},S.ontouchend=function(e){if(!S.rail.drag)return!0;if(2==S.rail.drag.pt){if(e.pointerType&&2!=e.pointerType&&"touch"!=e.pointerType)return!1;if(S.rail.drag=!1,S.hasmoving&&(S.scrollmom.doMomentum(),S.lastmouseup=!0,S.hideCursor(),E.hasmousecapture&&l.releaseCapture(),!E.cantouch))return S.cancelEvent(e)}else if(1==S.rail.drag.pt)return S.onmouseup(e)};var k=S.opt.emulatetouch&&S.isiframe&&!E.hasmousecapture;S.ontouchmove=function(e,o){if(!S.rail.drag)return!1;if(e.targetTouches&&S.opt.preventmultitouchscrolling&&e.targetTouches.length>1)return!1;if(e.pointerType&&2!=e.pointerType&&"touch"!=e.pointerType)return!1;if(2==S.rail.drag.pt){if("changedTouches"in e&&(e.clientX=e.changedTouches[0].clientX,e.clientY=e.changedTouches[0].clientY),S.rail.drag.y===e.clientY&&S.rail.drag.x===e.clientX)return!1;S.hasmoving||S.onscrollstart&&S.triggerScrollStart(e.clientX,e.clientY,0,0,0),S.hasmoving=!0,S.preventclick&&!S.preventclick.click&&(S.preventclick.click=S.preventclick.tg.onclick||!1,S.preventclick.tg.onclick=S.onpreventclick);var t,r;if(r=t=0,k&&!o){var i=S.win.position();r=-i.left,t=-i.top}var s=e.clientY+t,n=s-S.rail.drag.y,a=e.clientX+r,c=a-S.rail.drag.x,d=S.rail.drag.st-n;S.ishwscroll&&S.opt.bouncescroll?d<0?d=Math.round(d/2):d>S.page.maxh&&(d=S.page.maxh+Math.round((d-S.page.maxh)/2)):(d<0&&(d=0,s=0),d>S.page.maxh&&(d=S.page.maxh,s=0));var u;S.railh&&S.railh.scrollable&&(u=S.isrtlmode?c-S.rail.drag.sl:S.rail.drag.sl-c,S.ishwscroll&&S.opt.bouncescroll?u<0?u=Math.round(u/2):u>S.page.maxw&&(u=S.page.maxw+Math.round((u-S.page.maxw)/2)):(u<0&&(u=0,a=0),u>S.page.maxw&&(u=S.page.maxw,a=0)));var h=!1;if(S.rail.drag.dl)h=!0,"v"==S.rail.drag.dl?u=S.rail.drag.sl:"h"==S.rail.drag.dl&&(d=S.rail.drag.st);else{var p=Math.abs(n),m=Math.abs(c),f=S.opt.directionlockdeadzone;if("v"==S.rail.drag.ck){if(p>f&&m<=.3*p)return S.rail.drag=!1,!0;m>f&&(S.rail.drag.dl="f",z.scrollTop(z.scrollTop()))}else if("h"==S.rail.drag.ck){if(m>f&&p<=.3*m)return S.rail.drag=!1,!0;p>f&&(S.rail.drag.dl="f",z.scrollLeft(z.scrollLeft()))}}if(S.synched("touchmove",function(){S.rail.drag&&2==S.rail.drag.pt&&(S.prepareTransition&&S.prepareTransition(0),S.rail.scrollable&&S.setScrollTop(d),S.scrollmom.update(a,s),S.railh&&S.railh.scrollable?(S.setScrollLeft(u),S.showCursor(d,u)):S.showCursor(d),E.isie10&&l.selection.clear())}),E.ischrome&&S.istouchcapable&&(h=!1),h)return S.cancelEvent(e)}else if(1==S.rail.drag.pt)return S.onmousemove(e)},S.ontouchstartCursor=function(e,o){if(!S.rail.drag||3==S.rail.drag.pt){if(S.locked)return S.cancelEvent(e);S.cancelScroll(),S.rail.drag={x:e.touches[0].clientX,y:e.touches[0].clientY,sx:S.scroll.x,sy:S.scroll.y,pt:3,hr:!!o};var t=S.getTarget(e);return!S.ispage&&E.hasmousecapture&&t.setCapture(),S.isiframe&&!E.hasmousecapture&&(S.saved.csspointerevents=S.doc.css("pointer-events"),S.css(S.doc,{"pointer-events":"none"})),S.cancelEvent(e)}},S.ontouchendCursor=function(e){if(S.rail.drag){if(E.hasmousecapture&&l.releaseCapture(),S.isiframe&&!E.hasmousecapture&&S.doc.css("pointer-events",S.saved.csspointerevents),3!=S.rail.drag.pt)return;return S.rail.drag=!1,S.cancelEvent(e)}},S.ontouchmoveCursor=function(e){if(S.rail.drag){if(3!=S.rail.drag.pt)return;if(S.cursorfreezed=!0,S.rail.drag.hr){S.scroll.x=S.rail.drag.sx+(e.touches[0].clientX-S.rail.drag.x),S.scroll.x<0&&(S.scroll.x=0);var o=S.scrollvaluemaxw;S.scroll.x>o&&(S.scroll.x=o)}else{S.scroll.y=S.rail.drag.sy+(e.touches[0].clientY-S.rail.drag.y),S.scroll.y<0&&(S.scroll.y=0);var t=S.scrollvaluemax;S.scroll.y>t&&(S.scroll.y=t)}return S.synched("touchmove",function(){S.rail.drag&&3==S.rail.drag.pt&&(S.showCursor(),S.rail.drag.hr?S.doScrollLeft(Math.round(S.scroll.x*S.scrollratio.x),S.opt.cursordragspeed):S.doScrollTop(Math.round(S.scroll.y*S.scrollratio.y),S.opt.cursordragspeed))}),S.cancelEvent(e)}}}if(S.onmousedown=function(e,o){if(!S.rail.drag||1==S.rail.drag.pt){if(S.railslocked)return S.cancelEvent(e);S.cancelScroll(),S.rail.drag={x:e.clientX,y:e.clientY,sx:S.scroll.x,sy:S.scroll.y,pt:1,hr:o||!1};var t=S.getTarget(e);return!S.ispage&&E.hasmousecapture&&t.setCapture(),S.isiframe&&!E.hasmousecapture&&(S.saved.csspointerevents=S.doc.css("pointer-events"),S.css(S.doc,{"pointer-events":"none"})),S.hasmoving=!1,S.cancelEvent(e)}},S.onmouseup=function(e){if(S.rail.drag)return 1!=S.rail.drag.pt||(E.hasmousecapture&&l.releaseCapture(),S.isiframe&&!E.hasmousecapture&&S.doc.css("pointer-events",S.saved.csspointerevents),S.rail.drag=!1,S.hasmoving&&S.triggerScrollEnd(),S.cancelEvent(e))},S.onmousemove=function(e){if(S.rail.drag){if(1!==S.rail.drag.pt)return;if(E.ischrome&&0===e.which)return S.onmouseup(e);if(S.cursorfreezed=!0,S.hasmoving=!0,S.rail.drag.hr){S.scroll.x=S.rail.drag.sx+(e.clientX-S.rail.drag.x),S.scroll.x<0&&(S.scroll.x=0);var o=S.scrollvaluemaxw;S.scroll.x>o&&(S.scroll.x=o)}else{S.scroll.y=S.rail.drag.sy+(e.clientY-S.rail.drag.y),S.scroll.y<0&&(S.scroll.y=0);var t=S.scrollvaluemax;S.scroll.y>t&&(S.scroll.y=t)}return S.synched("mousemove",function(){S.rail.drag&&1==S.rail.drag.pt&&(S.showCursor(),S.rail.drag.hr?S.hasreversehr?S.doScrollLeft(S.scrollvaluemaxw-Math.round(S.scroll.x*S.scrollratio.x),S.opt.cursordragspeed):S.doScrollLeft(Math.round(S.scroll.x*S.scrollratio.x),S.opt.cursordragspeed):S.doScrollTop(Math.round(S.scroll.y*S.scrollratio.y),S.opt.cursordragspeed))}),S.cancelEvent(e)}S.checkarea=0},E.cantouch||S.opt.emulatetouch)S.onpreventclick=function(e){if(S.preventclick)return S.preventclick.tg.onclick=S.preventclick.click,S.preventclick=!1,S.cancelEvent(e)},S.onclick=!E.isios&&function(e){return!S.lastmouseup||(S.lastmouseup=!1,S.cancelEvent(e))},S.opt.grabcursorenabled&&E.cursorgrabvalue&&(S.css(S.ispage?S.doc:S.win,{cursor:E.cursorgrabvalue}),S.css(S.rail,{cursor:E.cursorgrabvalue}));else{var T=function(e){if(S.selectiondrag){if(e){var o=S.win.outerHeight(),t=e.pageY-S.selectiondrag.top;t>0&&t=o&&(t-=o),S.selectiondrag.df=t}if(0!=S.selectiondrag.df){var r=2*-Math.floor(S.selectiondrag.df/6);S.doScrollBy(r),S.debounced("doselectionscroll",function(){T()},50)}}};S.hasTextSelected="getSelection"in l?function(){return l.getSelection().rangeCount>0}:"selection"in l?function(){return"None"!=l.selection.type}:function(){return!1},S.onselectionstart=function(e){S.ispage||(S.selectiondrag=S.win.offset())},S.onselectionend=function(e){S.selectiondrag=!1},S.onselectiondrag=function(e){S.selectiondrag&&S.hasTextSelected()&&S.debounced("selectionscroll",function(){T(e)},250)}}if(E.hasw3ctouch?(S.css(S.ispage?n("html"):S.win,{"touch-action":"none"}),S.css(S.rail,{"touch-action":"none"}),S.css(S.cursor,{"touch-action":"none"}),S.bind(S.win,"pointerdown",S.ontouchstart),S.bind(l,"pointerup",S.ontouchend),S.bind(l,"pointermove",S.ontouchmove)):E.hasmstouch?(S.css(S.ispage?n("html"):S.win,{"-ms-touch-action":"none"}),S.css(S.rail,{"-ms-touch-action":"none"}),S.css(S.cursor,{"-ms-touch-action":"none"}),S.bind(S.win,"MSPointerDown",S.ontouchstart),S.bind(l,"MSPointerUp",S.ontouchend),S.bind(l,"MSPointerMove",S.ontouchmove),S.bind(S.cursor,"MSGestureHold",function(e){e.preventDefault()}),S.bind(S.cursor,"contextmenu",function(e){e.preventDefault()})):E.cantouch&&(S.bind(S.win,"touchstart",S.ontouchstart,!1,!0),S.bind(l,"touchend",S.ontouchend,!1,!0),S.bind(l,"touchcancel",S.ontouchend,!1,!0),S.bind(l,"touchmove",S.ontouchmove,!1,!0)),S.opt.emulatetouch&&(S.bind(S.win,"mousedown",S.ontouchstart,!1,!0),S.bind(l,"mouseup",S.ontouchend,!1,!0),S.bind(l,"mousemove",S.ontouchmove,!1,!0)),(S.opt.cursordragontouch||!E.cantouch&&!S.opt.emulatetouch)&&(S.rail.css({cursor:"default"}),S.railh&&S.railh.css({cursor:"default"}),S.jqbind(S.rail,"mouseenter",function(){if(!S.ispage&&!S.win.is(":visible"))return!1;S.canshowonmouseevent&&S.showCursor(),S.rail.active=!0}),S.jqbind(S.rail,"mouseleave",function(){S.rail.active=!1,S.rail.drag||S.hideCursor()}),S.opt.sensitiverail&&(S.bind(S.rail,"click",function(e){S.doRailClick(e,!1,!1)}),S.bind(S.rail,"dblclick",function(e){S.doRailClick(e,!0,!1)}),S.bind(S.cursor,"click",function(e){S.cancelEvent(e)}),S.bind(S.cursor,"dblclick",function(e){S.cancelEvent(e)})),S.railh&&(S.jqbind(S.railh,"mouseenter",function(){if(!S.ispage&&!S.win.is(":visible"))return!1;S.canshowonmouseevent&&S.showCursor(),S.rail.active=!0}),S.jqbind(S.railh,"mouseleave",function(){S.rail.active=!1,S.rail.drag||S.hideCursor()}),S.opt.sensitiverail&&(S.bind(S.railh,"click",function(e){S.doRailClick(e,!1,!0)}),S.bind(S.railh,"dblclick",function(e){S.doRailClick(e,!0,!0)}),S.bind(S.cursorh,"click",function(e){S.cancelEvent(e)}),S.bind(S.cursorh,"dblclick",function(e){S.cancelEvent(e)})))),S.opt.cursordragontouch&&(this.istouchcapable||E.cantouch)&&(S.bind(S.cursor,"touchstart",S.ontouchstartCursor),S.bind(S.cursor,"touchmove",S.ontouchmoveCursor),S.bind(S.cursor,"touchend",S.ontouchendCursor),S.cursorh&&S.bind(S.cursorh,"touchstart",function(e){S.ontouchstartCursor(e,!0)}),S.cursorh&&S.bind(S.cursorh,"touchmove",S.ontouchmoveCursor),S.cursorh&&S.bind(S.cursorh,"touchend",S.ontouchendCursor)),E.cantouch||S.opt.emulatetouch?(S.bind(E.hasmousecapture?S.win:l,"mouseup",S.ontouchend),S.onclick&&S.bind(l,"click",S.onclick),S.opt.cursordragontouch?(S.bind(S.cursor,"mousedown",S.onmousedown),S.bind(S.cursor,"mouseup",S.onmouseup),S.cursorh&&S.bind(S.cursorh,"mousedown",function(e){S.onmousedown(e,!0)}),S.cursorh&&S.bind(S.cursorh,"mouseup",S.onmouseup)):(S.bind(S.rail,"mousedown",function(e){e.preventDefault()}),S.railh&&S.bind(S.railh,"mousedown",function(e){e.preventDefault()}))):(S.bind(E.hasmousecapture?S.win:l,"mouseup",S.onmouseup),S.bind(l,"mousemove",S.onmousemove),S.onclick&&S.bind(l,"click",S.onclick),S.bind(S.cursor,"mousedown",S.onmousedown),S.bind(S.cursor,"mouseup",S.onmouseup),S.railh&&(S.bind(S.cursorh,"mousedown",function(e){S.onmousedown(e,!0)}),S.bind(S.cursorh,"mouseup",S.onmouseup)),!S.ispage&&S.opt.enablescrollonselection&&(S.bind(S.win[0],"mousedown",S.onselectionstart),S.bind(l,"mouseup",S.onselectionend),S.bind(S.cursor,"mouseup",S.onselectionend),S.cursorh&&S.bind(S.cursorh,"mouseup",S.onselectionend),S.bind(l,"mousemove",S.onselectiondrag)),S.zoom&&(S.jqbind(S.zoom,"mouseenter",function(){S.canshowonmouseevent&&S.showCursor(),S.rail.active=!0}),S.jqbind(S.zoom,"mouseleave",function(){S.rail.active=!1,S.rail.drag||S.hideCursor()}))),S.opt.enablemousewheel&&(S.isiframe||S.mousewheel(E.isie&&S.ispage?l:S.win,S.onmousewheel),S.mousewheel(S.rail,S.onmousewheel),S.railh&&S.mousewheel(S.railh,S.onmousewheelhr)),S.ispage||E.cantouch||/HTML|^BODY/.test(S.win[0].nodeName)||(S.win.attr("tabindex")||S.win.attr({tabindex:++r}),S.bind(S.win,"focus",function(e){o=S.getTarget(e).id||!0,S.hasfocus=!0,S.canshowonmouseevent&&S.noticeCursor()}),S.bind(S.win,"blur",function(e){o=!1,S.hasfocus=!1}),S.bind(S.win,"mouseenter",function(e){t=S.getTarget(e).id||!0,S.hasmousefocus=!0,S.canshowonmouseevent&&S.noticeCursor()}),S.bind(S.win,"mouseleave",function(e){t=!1,S.hasmousefocus=!1,S.rail.drag||S.hideCursor()})),S.onkeypress=function(e){if(S.railslocked&&0==S.page.maxh)return!0;e=e||window.e;var r=S.getTarget(e);if(r&&/INPUT|TEXTAREA|SELECT|OPTION/.test(r.nodeName)&&(!(r.getAttribute("type")||r.type||!1)||!/submit|button|cancel/i.tp))return!0;if(n(r).attr("contenteditable"))return!0;if(S.hasfocus||S.hasmousefocus&&!o||S.ispage&&!o&&!t){var i=e.keyCode;if(S.railslocked&&27!=i)return S.cancelEvent(e);var s=e.ctrlKey||!1,l=e.shiftKey||!1,a=!1;switch(i){case 38:case 63233:S.doScrollBy(72),a=!0;break;case 40:case 63235:S.doScrollBy(-72),a=!0;break;case 37:case 63232:S.railh&&(s?S.doScrollLeft(0):S.doScrollLeftBy(72),a=!0);break;case 39:case 63234:S.railh&&(s?S.doScrollLeft(S.page.maxw):S.doScrollLeftBy(-72),a=!0);break;case 33:case 63276:S.doScrollBy(S.view.h),a=!0;break;case 34:case 63277:S.doScrollBy(-S.view.h),a=!0;break;case 36:case 63273:S.railh&&s?S.doScrollPos(0,0):S.doScrollTo(0),a=!0;break;case 35:case 63275:S.railh&&s?S.doScrollPos(S.page.maxw,S.page.maxh):S.doScrollTo(S.page.maxh),a=!0;break;case 32:S.opt.spacebarenabled&&(l?S.doScrollBy(S.view.h):S.doScrollBy(-S.view.h),a=!0);break;case 27:S.zoomactive&&(S.doZoom(),a=!0)}if(a)return S.cancelEvent(e)}},S.opt.enablekeyboard&&S.bind(l,E.isopera&&!E.isopera12?"keypress":"keydown",S.onkeypress),S.bind(l,"keydown",function(e){(e.ctrlKey||!1)&&(S.wheelprevented=!0)}),S.bind(l,"keyup",function(e){e.ctrlKey||!1||(S.wheelprevented=!1)}),S.bind(window,"blur",function(e){S.wheelprevented=!1}),S.bind(window,"resize",S.lazyResize),S.bind(window,"orientationchange",S.lazyResize),S.bind(window,"load",S.lazyResize),E.ischrome&&!S.ispage&&!S.haswrapper){var M=S.win.attr("style"),L=parseFloat(S.win.css("width"))+1;S.win.css("width",L),S.synched("chromefix",function(){S.win.attr("style",M)})}S.onAttributeChange=function(e){S.lazyResize(S.isieold?250:30)},S.opt.enableobserver&&(S.isie11||!1===h||(S.observerbody=new h(function(e){if(e.forEach(function(e){if("attributes"==e.type)return z.hasClass("modal-open")&&z.hasClass("modal-dialog")&&!n.contains(n(".modal-dialog")[0],S.doc[0])?S.hide():S.show()}),S.me.clientWidth!=S.page.width||S.me.clientHeight!=S.page.height)return S.lazyResize(30)}),S.observerbody.observe(l.body,{childList:!0,subtree:!0,characterData:!1,attributes:!0,attributeFilter:["class"]})),S.ispage||S.haswrapper||(!1!==h?(S.observer=new h(function(e){e.forEach(S.onAttributeChange)}),S.observer.observe(S.win[0],{childList:!0,characterData:!1,attributes:!0,subtree:!1}),S.observerremover=new h(function(e){e.forEach(function(e){if(e.removedNodes.length>0)for(var o in e.removedNodes)if(S&&e.removedNodes[o]==S.win[0])return S.remove()})}),S.observerremover.observe(S.win[0].parentNode,{childList:!0,characterData:!1,attributes:!1,subtree:!1})):(S.bind(S.win,E.isie&&!E.isie9?"propertychange":"DOMAttrModified",S.onAttributeChange),E.isie9&&S.win[0].attachEvent("onpropertychange",S.onAttributeChange),S.bind(S.win,"DOMNodeRemoved",function(e){e.target==S.win[0]&&S.remove()})))),!S.ispage&&S.opt.boxzoom&&S.bind(window,"resize",S.resizeZoom),S.istextarea&&(S.bind(S.win,"keydown",S.lazyResize),S.bind(S.win,"mouseup",S.lazyResize)),S.lazyResize(30)}if("IFRAME"==this.doc[0].nodeName){var C=function(){S.iframexd=!1;var o;try{(o="contentDocument"in this?this.contentDocument:this.contentWindow._doc).domain}catch(e){S.iframexd=!0,o=!1}if(S.iframexd)return"console"in window&&console.log("NiceScroll error: policy restriced iframe"),!0;if(S.forcescreen=!0,S.isiframe&&(S.iframe={doc:n(o),html:S.doc.contents().find("html")[0],body:S.doc.contents().find("body")[0]},S.getContentSize=function(){return{w:Math.max(S.iframe.html.scrollWidth,S.iframe.body.scrollWidth),h:Math.max(S.iframe.html.scrollHeight,S.iframe.body.scrollHeight)}},S.docscroll=n(S.iframe.body)),!E.isios&&S.opt.iframeautoresize&&!S.isiframe){S.win.scrollTop(0),S.doc.height("");var t=Math.max(o.getElementsByTagName("html")[0].scrollHeight,o.body.scrollHeight);S.doc.height(t)}S.lazyResize(30),S.css(n(S.iframe.body),e),E.isios&&S.haswrapper&&S.css(n(o.body),{"-webkit-transform":"translate3d(0,0,0)"}),"contentWindow"in this?S.bind(this.contentWindow,"scroll",S.onscroll):S.bind(o,"scroll",S.onscroll),S.opt.enablemousewheel&&S.mousewheel(o,S.onmousewheel),S.opt.enablekeyboard&&S.bind(o,E.isopera?"keypress":"keydown",S.onkeypress),E.cantouch?(S.bind(o,"touchstart",S.ontouchstart),S.bind(o,"touchmove",S.ontouchmove)):S.opt.emulatetouch&&(S.bind(o,"mousedown",S.ontouchstart),S.bind(o,"mousemove",function(e){return S.ontouchmove(e,!0)}),S.opt.grabcursorenabled&&E.cursorgrabvalue&&S.css(n(o.body),{cursor:E.cursorgrabvalue})),S.bind(o,"mouseup",S.ontouchend),S.zoom&&(S.opt.dblclickzoom&&S.bind(o,"dblclick",S.doZoom),S.ongesturezoom&&S.bind(o,"gestureend",S.ongesturezoom))};this.doc[0].readyState&&"complete"==this.doc[0].readyState&&setTimeout(function(){C.call(S.doc[0],!1)},500),S.bind(this.doc,"load",C)}},this.showCursor=function(e,o){if(S.cursortimeout&&(clearTimeout(S.cursortimeout),S.cursortimeout=0),S.rail){if(S.autohidedom&&(S.autohidedom.stop().css({opacity:S.opt.cursoropacitymax}),S.cursoractive=!0),S.rail.drag&&1==S.rail.drag.pt||(void 0!==e&&!1!==e&&(S.scroll.y=Math.round(1*e/S.scrollratio.y)),void 0!==o&&(S.scroll.x=Math.round(1*o/S.scrollratio.x))),S.cursor.css({height:S.cursorheight,top:S.scroll.y}),S.cursorh){var t=S.hasreversehr?S.scrollvaluemaxw-S.scroll.x:S.scroll.x;!S.rail.align&&S.rail.visibility?S.cursorh.css({width:S.cursorwidth,left:t+S.rail.width}):S.cursorh.css({width:S.cursorwidth,left:t}),S.cursoractive=!0}S.zoom&&S.zoom.stop().css({opacity:S.opt.cursoropacitymax})}},this.hideCursor=function(e){S.cursortimeout||S.rail&&S.autohidedom&&(S.hasmousefocus&&"leave"==S.opt.autohidemode||(S.cursortimeout=setTimeout(function(){S.rail.active&&S.showonmouseevent||(S.autohidedom.stop().animate({opacity:S.opt.cursoropacitymin}),S.zoom&&S.zoom.stop().animate({opacity:S.opt.cursoropacitymin}),S.cursoractive=!1),S.cursortimeout=0},e||S.opt.hidecursordelay)))},this.noticeCursor=function(e,o,t){S.showCursor(o,t),S.rail.active||S.hideCursor(e)},this.getContentSize=S.ispage?function(){return{w:Math.max(l.body.scrollWidth,l.documentElement.scrollWidth),h:Math.max(l.body.scrollHeight,l.documentElement.scrollHeight)}}:S.haswrapper?function(){return{w:S.doc[0].offsetWidth,h:S.doc[0].offsetHeight}}:function(){return{w:S.docscroll[0].scrollWidth,h:S.docscroll[0].scrollHeight}},this.onResize=function(e,o){if(!S||!S.win)return!1;if(!S.haswrapper&&!S.ispage){if("none"==S.win.css("display"))return S.visibility&&S.hideRail().hideRailHr(),!1;S.hidden||S.visibility||S.showRail().showRailHr()}var t=S.page.maxh,r=S.page.maxw,i={h:S.view.h,w:S.view.w};if(S.view={w:S.ispage?S.win.width():S.win[0].clientWidth,h:S.ispage?S.win.height():S.win[0].clientHeight},S.page=o||S.getContentSize(),S.page.maxh=Math.max(0,S.page.h-S.view.h),S.page.maxw=Math.max(0,S.page.w-S.view.w),S.page.maxh==t&&S.page.maxw==r&&S.view.w==i.w&&S.view.h==i.h){if(S.ispage)return S;var s=S.win.offset();if(S.lastposition){var n=S.lastposition;if(n.top==s.top&&n.left==s.left)return S}S.lastposition=s}return 0===S.page.maxh?(S.hideRail(),S.scrollvaluemax=0,S.scroll.y=0,S.scrollratio.y=0,S.cursorheight=0,S.setScrollTop(0),S.rail&&(S.rail.scrollable=!1)):(S.page.maxh-=S.opt.railpadding.top+S.opt.railpadding.bottom,S.rail.scrollable=!0),0===S.page.maxw?(S.hideRailHr(),S.scrollvaluemaxw=0,S.scroll.x=0,S.scrollratio.x=0,S.cursorwidth=0,S.setScrollLeft(0),S.railh&&(S.railh.scrollable=!1)):(S.page.maxw-=S.opt.railpadding.left+S.opt.railpadding.right,S.railh&&(S.railh.scrollable=S.opt.horizrailenabled)),S.railslocked=S.locked||0===S.page.maxh&&0===S.page.maxw,S.railslocked?(S.ispage||S.updateScrollBar(S.view),!1):(S.hidden||S.visibility?!S.railh||S.hidden||S.railh.visibility||S.showRailHr():S.showRail().showRailHr(),S.istextarea&&S.win.css("resize")&&"none"!=S.win.css("resize")&&(S.view.h-=20),S.cursorheight=Math.min(S.view.h,Math.round(S.view.h*(S.view.h/S.page.h))),S.cursorheight=S.opt.cursorfixedheight?S.opt.cursorfixedheight:Math.max(S.opt.cursorminheight,S.cursorheight),S.cursorwidth=Math.min(S.view.w,Math.round(S.view.w*(S.view.w/S.page.w))),S.cursorwidth=S.opt.cursorfixedheight?S.opt.cursorfixedheight:Math.max(S.opt.cursorminheight,S.cursorwidth),S.scrollvaluemax=S.view.h-S.cursorheight-(S.opt.railpadding.top+S.opt.railpadding.bottom),S.railh&&(S.railh.width=S.page.maxh>0?S.view.w-S.rail.width:S.view.w,S.scrollvaluemaxw=S.railh.width-S.cursorwidth-(S.opt.railpadding.left+S.opt.railpadding.right)),S.ispage||S.updateScrollBar(S.view),S.scrollratio={x:S.page.maxw/S.scrollvaluemaxw,y:S.page.maxh/S.scrollvaluemax},S.getScrollTop()>S.page.maxh?S.doScrollTop(S.page.maxh):(S.scroll.y=Math.round(S.getScrollTop()*(1/S.scrollratio.y)),S.scroll.x=Math.round(S.getScrollLeft()*(1/S.scrollratio.x)),S.cursoractive&&S.noticeCursor()),S.scroll.y&&0==S.getScrollTop()&&S.doScrollTo(Math.floor(S.scroll.y*S.scrollratio.y)),S)},this.resize=S.onResize,this.hlazyresize=0,this.lazyResize=function(e){return S.haswrapper||S.hide(),S.hlazyresize&&clearTimeout(S.hlazyresize),S.hlazyresize=setTimeout(function(){S&&(S.resize(),S.show())},240),S},this.jqbind=function(e,o,t){S.events.push({e:e,n:o,f:t,q:!0}),n(e).bind(o,t)},this.mousewheel=function(e,o,t){var r="jquery"in e?e[0]:e;if("onwheel"in l.createElement("div"))S._bind(r,"wheel",o,t||!1);else{var i=void 0!==l.onmousewheel?"mousewheel":"DOMMouseScroll";y(r,i,o,t||!1),"DOMMouseScroll"==i&&y(r,"MozMousePixelScroll",o,t||!1)}};var R=!1;if(E.haseventlistener){try{var H=Object.defineProperty({},"passive",{get:function(){R=!0}});window.addEventListener("test",null,H)}catch(e){}this.cancelEvent=function(e){return!!e&&((e=e.original?e.original:e).cancelable&&e.preventDefault(),e.stopPropagation(),e.preventManipulation&&e.preventManipulation(),!1)},this.stopPropagation=function(e){return!!e&&((e=e.original?e.original:e).stopPropagation(),!1)}}else Event.prototype.preventDefault=function(){this.returnValue=!1},Event.prototype.stopPropagation=function(){this.cancelBubble=!0},window.constructor.prototype.addEventListener=l.constructor.prototype.addEventListener=Element.prototype.addEventListener=function(e,o,t){this.attachEvent("on"+e,o)},window.constructor.prototype.removeEventListener=l.constructor.prototype.removeEventListener=Element.prototype.removeEventListener=function(e,o,t){this.detachEvent("on"+e,o)},this.cancelEvent=function(e){return!!(e=window.event||!1)&&(e.cancelBubble=!0,e.cancel=!0,e.returnValue=!1,!1)},this.stopPropagation=function(e){return!!(e=window.event||!1)&&(e.cancelBubble=!0,!1)};this.bind=function(e,o,t,r,i){var s="jquery"in e?e[0]:e;S._bind(s,o,t,r||!1,i||!1)},this._bind=function(e,o,t,r,i){S.events.push({e:e,n:o,f:t,b:r,q:!1}),R&&i?e.addEventListener(o,t,{passive:!1,capture:r}):e.addEventListener(o,t,r||!1)},this._unbind=function(e,o,t,r){e.removeEventListener(o,t,r)},this.unbindAll=function(){for(var e=0;e0)return t;o=!!o.parentNode&&o.parentNode}return!1},this.triggerScrollStart=function(e,o,t,r,i){var s={type:"scrollstart",current:{x:e,y:o},request:{x:t,y:r},end:{x:S.newscrollx,y:S.newscrolly},speed:i};S.onscrollstart.call(S,s)},this.triggerScrollEnd=function(){if(S.onscrollend){var e=S.getScrollLeft(),o=S.getScrollTop(),t={type:"scrollend",current:{x:e,y:o},end:{x:e,y:o}};S.onscrollend.call(S,t)}},this.onmousewheel=function(e){if(!S.wheelprevented){if(S.railslocked)return S.debounced("checkunlock",S.resize,250),!0;if(S.rail.drag)return S.cancelEvent(e);if("auto"===S.opt.oneaxismousemode&&0!==e.deltaX&&(S.opt.oneaxismousemode=!1),S.opt.oneaxismousemode&&0===e.deltaX&&!S.rail.scrollable)return!S.railh||!S.railh.scrollable||S.onmousewheelhr(e);var o=p(),t=!1;if(S.opt.preservenativescrolling&&S.checkarea+60020?t:0},S.opt.smoothscroll?S.ishwscroll&&E.hastransition&&S.opt.usetransition&&S.opt.smoothscroll?(this.prepareTransition=function(e,o){var t=o?e>20?e:0:S.getTransitionSpeed(e),r=t?E.prefixstyle+"transform "+t+"ms ease-out":"";return S.lasttransitionstyle&&S.lasttransitionstyle==r||(S.lasttransitionstyle=r,S.doc.css(E.transitionstyle,r)),t},this.doScrollLeft=function(e,o){var t=S.scrollrunning?S.newscrolly:S.getScrollTop();S.doScrollPos(e,t,o)},this.doScrollTop=function(e,o){var t=S.scrollrunning?S.newscrollx:S.getScrollLeft();S.doScrollPos(t,e,o)},this.doScrollPos=function(e,o,t){var r=S.getScrollTop(),i=S.getScrollLeft();return((S.newscrolly-r)*(o-r)<0||(S.newscrollx-i)*(e-i)<0)&&S.cancelScroll(),0==S.opt.bouncescroll&&(o<0?o=0:o>S.page.maxh&&(o=S.page.maxh),e<0?e=0:e>S.page.maxw&&(e=S.page.maxw)),(!S.scrollrunning||e!=S.newscrollx||o!=S.newscrolly)&&(S.newscrolly=o,S.newscrollx=e,S.newscrollspeed=t||!1,!S.timer&&void(S.timer=setTimeout(function(){var t=S.getScrollTop(),r=S.getScrollLeft(),i={};i.x=e-r,i.y=o-t,i.px=r,i.py=t;var s=Math.round(Math.sqrt(Math.pow(i.x,2)+Math.pow(i.y,2))),n=S.newscrollspeed&&S.newscrollspeed>1?S.newscrollspeed:S.getTransitionSpeed(s);if(S.newscrollspeed&&S.newscrollspeed<=1&&(n*=S.newscrollspeed),S.prepareTransition(n,!0),S.timerscroll&&S.timerscroll.tm&&clearInterval(S.timerscroll.tm),n>0){!S.scrollrunning&&S.onscrollstart&&S.triggerScrollStart(r,t,e,o,n),E.transitionend?S.scrollendtrapped||(S.scrollendtrapped=!0,S.bind(S.doc,E.transitionend,S.onScrollTransitionEnd,!1)):(S.scrollendtrapped&&clearTimeout(S.scrollendtrapped),S.scrollendtrapped=setTimeout(S.onScrollTransitionEnd,n));var l=t,a=r;S.timerscroll={bz:new C(l,S.newscrolly,n,0,0,.58,1),bh:new C(a,S.newscrollx,n,0,0,.58,1)},S.cursorfreezed||(S.timerscroll.tm=setInterval(function(){S.showCursor(S.getScrollTop(),S.getScrollLeft())},60))}S.synched("doScroll-set",function(){S.timer=0,S.scrollendtrapped&&(S.scrollrunning=!0),S.setScrollTop(S.newscrolly),S.setScrollLeft(S.newscrollx),S.scrollendtrapped||S.onScrollTransitionEnd()})},50)))},this.cancelScroll=function(){if(!S.scrollendtrapped)return!0;var e=S.getScrollTop(),o=S.getScrollLeft();return S.scrollrunning=!1,E.transitionend||clearTimeout(E.transitionend),S.scrollendtrapped=!1,S._unbind(S.doc[0],E.transitionend,S.onScrollTransitionEnd),S.prepareTransition(0),S.setScrollTop(e),S.railh&&S.setScrollLeft(o),S.timerscroll&&S.timerscroll.tm&&clearInterval(S.timerscroll.tm),S.timerscroll=!1,S.cursorfreezed=!1,S.showCursor(e,o),S},this.onScrollTransitionEnd=function(){S.scrollendtrapped&&S._unbind(S.doc[0],E.transitionend,S.onScrollTransitionEnd),S.scrollendtrapped=!1,S.prepareTransition(0),S.timerscroll&&S.timerscroll.tm&&clearInterval(S.timerscroll.tm),S.timerscroll=!1;var e=S.getScrollTop(),o=S.getScrollLeft();if(S.setScrollTop(e),S.railh&&S.setScrollLeft(o),S.noticeCursor(!1,e,o),S.cursorfreezed=!1,e<0?e=0:e>S.page.maxh&&(e=S.page.maxh),o<0?o=0:o>S.page.maxw&&(o=S.page.maxw),e!=S.newscrolly||o!=S.newscrollx)return S.doScrollPos(o,e,S.opt.snapbackspeed);S.onscrollend&&S.scrollrunning&&S.triggerScrollEnd(),S.scrollrunning=!1}):(this.doScrollLeft=function(e,o){var t=S.scrollrunning?S.newscrolly:S.getScrollTop();S.doScrollPos(e,t,o)},this.doScrollTop=function(e,o){var t=S.scrollrunning?S.newscrollx:S.getScrollLeft();S.doScrollPos(t,e,o)},this.doScrollPos=function(e,o,t){function r(){if(S.cancelAnimationFrame)return!0;if(S.scrollrunning=!0,h=1-h)return S.timer=c(r)||1;var e,o,t=0,i=o=S.getScrollTop();S.dst.ay?(((n=(i=S.bzscroll?S.dst.py+S.bzscroll.getNow()*S.dst.ay:S.newscrolly)-o)<0&&i0&&i>S.newscrolly)&&(i=S.newscrolly),S.setScrollTop(i),i==S.newscrolly&&(t=1)):t=1;var s=e=S.getScrollLeft();if(S.dst.ax){var n=(s=S.bzscroll?S.dst.px+S.bzscroll.getNow()*S.dst.ax:S.newscrollx)-e;(n<0&&s0&&s>S.newscrollx)&&(s=S.newscrollx),S.setScrollLeft(s),s==S.newscrollx&&(t+=1)}else t+=1;2==t?(S.timer=0,S.cursorfreezed=!1,S.bzscroll=!1,S.scrollrunning=!1,i<0?i=0:i>S.page.maxh&&(i=Math.max(0,S.page.maxh)),s<0?s=0:s>S.page.maxw&&(s=S.page.maxw),s!=S.newscrollx||i!=S.newscrolly?S.doScrollPos(s,i):S.onscrollend&&S.triggerScrollEnd()):S.timer=c(r)||1}var o=void 0===o||!1===o?S.getScrollTop(!0):o;if(S.timer&&S.newscrolly==o&&S.newscrollx==e)return!0;S.timer&&d(S.timer),S.timer=0;var i=S.getScrollTop(),s=S.getScrollLeft();((S.newscrolly-i)*(o-i)<0||(S.newscrollx-s)*(e-s)<0)&&S.cancelScroll(),S.newscrolly=o,S.newscrollx=e,S.bouncescroll&&S.rail.visibility||(S.newscrolly<0?S.newscrolly=0:S.newscrolly>S.page.maxh&&(S.newscrolly=S.page.maxh)),S.bouncescroll&&S.railh.visibility||(S.newscrollx<0?S.newscrollx=0:S.newscrollx>S.page.maxw&&(S.newscrollx=S.page.maxw)),S.dst={},S.dst.x=e-s,S.dst.y=o-i,S.dst.px=s,S.dst.py=i;var n=Math.round(Math.sqrt(Math.pow(S.dst.x,2)+Math.pow(S.dst.y,2)));S.dst.ax=S.dst.x/n,S.dst.ay=S.dst.y/n;var l=0,a=n;0==S.dst.x?(l=i,a=o,S.dst.ay=1,S.dst.py=0):0==S.dst.y&&(l=s,a=e,S.dst.ax=1,S.dst.px=0);var u=S.getTransitionSpeed(n);if(t&&t<=1&&(u*=t),S.bzscroll=u>0&&(S.bzscroll?S.bzscroll.update(a,u):new C(l,a,u,0,1,0,1)),!S.timer){(i==S.page.maxh&&o>=S.page.maxh||s==S.page.maxw&&e>=S.page.maxw)&&S.checkContentSize();var h=1;S.cancelAnimationFrame=!1,S.timer=1,S.onscrollstart&&!S.scrollrunning&&S.triggerScrollStart(s,i,e,o,u),r(),(i==S.page.maxh&&o>=i||s==S.page.maxw&&e>=s)&&S.checkContentSize(),S.noticeCursor()}},this.cancelScroll=function(){return S.timer&&d(S.timer),S.timer=0,S.bzscroll=!1,S.scrollrunning=!1,S}):(this.doScrollLeft=function(e,o){var t=S.getScrollTop();S.doScrollPos(e,t,o)},this.doScrollTop=function(e,o){var t=S.getScrollLeft();S.doScrollPos(t,e,o)},this.doScrollPos=function(e,o,t){var r=e>S.page.maxw?S.page.maxw:e;r<0&&(r=0);var i=o>S.page.maxh?S.page.maxh:o;i<0&&(i=0),S.synched("scroll",function(){S.setScrollTop(i),S.setScrollLeft(r)})},this.cancelScroll=function(){}),this.doScrollBy=function(e,o){var t=0;if(t=o?Math.floor((S.scroll.y-e)*S.scrollratio.y):(S.timer?S.newscrolly:S.getScrollTop(!0))-e,S.bouncescroll){var r=Math.round(S.view.h/2);t<-r?t=-r:t>S.page.maxh+r&&(t=S.page.maxh+r)}S.cursorfreezed=!1;var i=S.getScrollTop(!0);return t<0&&i<=0?S.noticeCursor():t>S.page.maxh&&i>=S.page.maxh?(S.checkContentSize(),S.noticeCursor()):void S.doScrollTop(t)},this.doScrollLeftBy=function(e,o){var t=0;if(t=o?Math.floor((S.scroll.x-e)*S.scrollratio.x):(S.timer?S.newscrollx:S.getScrollLeft(!0))-e,S.bouncescroll){var r=Math.round(S.view.w/2);t<-r?t=-r:t>S.page.maxw+r&&(t=S.page.maxw+r)}S.cursorfreezed=!1;var i=S.getScrollLeft(!0);return t<0&&i<=0?S.noticeCursor():t>S.page.maxw&&i>=S.page.maxw?S.noticeCursor():void S.doScrollLeft(t)},this.doScrollTo=function(e,o){var t=o?Math.round(e*S.scrollratio.y):e;t<0?t=0:t>S.page.maxh&&(t=S.page.maxh),S.cursorfreezed=!1,S.doScrollTop(e)},this.checkContentSize=function(){var e=S.getContentSize();e.h==S.page.h&&e.w==S.page.w||S.resize(!1,e)},S.onscroll=function(e){S.rail.drag||S.cursorfreezed||S.synched("scroll",function(){S.scroll.y=Math.round(S.getScrollTop()*(1/S.scrollratio.y)),S.railh&&(S.scroll.x=Math.round(S.getScrollLeft()*(1/S.scrollratio.x))),S.noticeCursor()})},S.bind(S.docscroll,"scroll",S.onscroll),this.doZoomIn=function(e){if(!S.zoomactive){S.zoomactive=!0,S.zoomrestore={style:{}};var o=["position","top","left","zIndex","backgroundColor","marginTop","marginBottom","marginLeft","marginRight"],t=S.win[0].style;for(var r in o){var i=o[r];S.zoomrestore.style[i]=void 0!==t[i]?t[i]:""}S.zoomrestore.style.width=S.win.css("width"),S.zoomrestore.style.height=S.win.css("height"),S.zoomrestore.padding={w:S.win.outerWidth()-S.win.width(),h:S.win.outerHeight()-S.win.height()},E.isios4&&(S.zoomrestore.scrollTop=a.scrollTop(),a.scrollTop(0)),S.win.css({position:E.isios4?"absolute":"fixed",top:0,left:0,zIndex:s+100,margin:0});var n=S.win.css("backgroundColor");return(""==n||/transparent|rgba\(0, 0, 0, 0\)|rgba\(0,0,0,0\)/.test(n))&&S.win.css("backgroundColor","#fff"),S.rail.css({zIndex:s+101}),S.zoom.css({zIndex:s+102}),S.zoom.css("backgroundPosition","0 -18px"),S.resizeZoom(),S.onzoomin&&S.onzoomin.call(S),S.cancelEvent(e)}},this.doZoomOut=function(e){if(S.zoomactive)return S.zoomactive=!1,S.win.css("margin",""),S.win.css(S.zoomrestore.style),E.isios4&&a.scrollTop(S.zoomrestore.scrollTop),S.rail.css({"z-index":S.zindex}),S.zoom.css({"z-index":S.zindex}),S.zoomrestore=!1,S.zoom.css("backgroundPosition","0 0"),S.onResize(),S.onzoomout&&S.onzoomout.call(S),S.cancelEvent(e)},this.doZoom=function(e){return S.zoomactive?S.doZoomOut(e):S.doZoomIn(e)},this.resizeZoom=function(){if(S.zoomactive){var e=S.getScrollTop();S.win.css({width:a.width()-S.zoomrestore.padding.w+"px",height:a.height()-S.zoomrestore.padding.h+"px"}),S.onResize(),S.setScrollTop(Math.min(S.page.maxh,e))}},this.init(),n.nicescroll.push(this)},v=function(e){var o=this;this.nc=e,this.lastx=0,this.lasty=0,this.speedx=0,this.speedy=0,this.lasttime=0,this.steptime=0,this.snapx=!1,this.snapy=!1,this.demulx=0,this.demuly=0,this.lastscrollx=-1,this.lastscrolly=-1,this.chkx=0,this.chky=0,this.timer=0,this.reset=function(e,t){o.stop(),o.steptime=0,o.lasttime=p(),o.speedx=0,o.speedy=0,o.lastx=e,o.lasty=t,o.lastscrollx=-1,o.lastscrolly=-1},this.update=function(e,t){var r=p();o.steptime=r-o.lasttime,o.lasttime=r;var i=t-o.lasty,s=e-o.lastx,n=o.nc.getScrollTop()+i,l=o.nc.getScrollLeft()+s;o.snapx=l<0||l>o.nc.page.maxw,o.snapy=n<0||n>o.nc.page.maxh,o.speedx=s,o.speedy=i,o.lastx=e,o.lasty=t},this.stop=function(){o.nc.unsynched("domomentum2d"),o.timer&&clearTimeout(o.timer),o.timer=0,o.lastscrollx=-1,o.lastscrolly=-1},this.doSnapy=function(e,t){var r=!1;t<0?(t=0,r=!0):t>o.nc.page.maxh&&(t=o.nc.page.maxh,r=!0),e<0?(e=0,r=!0):e>o.nc.page.maxw&&(e=o.nc.page.maxw,r=!0),r?o.nc.doScrollPos(e,t,o.nc.opt.snapbackspeed):o.nc.triggerScrollEnd()},this.doMomentum=function(e){var t=p(),r=e?t+e:o.lasttime,i=o.nc.getScrollLeft(),s=o.nc.getScrollTop(),n=o.nc.page.maxh,l=o.nc.page.maxw;o.speedx=l>0?Math.min(60,o.speedx):0,o.speedy=n>0?Math.min(60,o.speedy):0;var a=r&&t-r<=60;(s<0||s>n||i<0||i>l)&&(a=!1);var c=!(!o.speedy||!a)&&o.speedy,d=!(!o.speedx||!a)&&o.speedx;if(c||d){var u=Math.max(16,o.steptime);if(u>50){var h=u/50;o.speedx*=h,o.speedy*=h,u=50}o.demulxy=0,o.lastscrollx=o.nc.getScrollLeft(),o.chkx=o.lastscrollx,o.lastscrolly=o.nc.getScrollTop(),o.chky=o.lastscrolly;var m=o.lastscrollx,f=o.lastscrolly,g=function(){var e=p()-t>600?.04:.02;o.speedx&&(m=Math.floor(o.lastscrollx-o.speedx*(1-o.demulxy)),o.lastscrollx=m,(m<0||m>l)&&(e=.1)),o.speedy&&(f=Math.floor(o.lastscrolly-o.speedy*(1-o.demulxy)),o.lastscrolly=f,(f<0||f>n)&&(e=.1)),o.demulxy=Math.min(1,o.demulxy+e),o.nc.synched("domomentum2d",function(){if(o.speedx){o.nc.getScrollLeft();o.chkx=m,o.nc.setScrollLeft(m)}if(o.speedy){o.nc.getScrollTop();o.chky=f,o.nc.setScrollTop(f)}o.timer||(o.nc.hideCursor(),o.doSnapy(m,f))}),o.demulxy<1?o.timer=setTimeout(g,u):(o.stop(),o.nc.hideCursor(),o.doSnapy(m,f))};g()}else o.doSnapy(o.nc.getScrollLeft(),o.nc.getScrollTop())}},b=e.fn.scrollTop;e.cssHooks.pageYOffset={get:function(e,o,t){var r=n.data(e,"__nicescroll")||!1;return r&&r.ishwscroll?r.getScrollTop():b.call(e)},set:function(e,o){var t=n.data(e,"__nicescroll")||!1;return t&&t.ishwscroll?t.setScrollTop(parseInt(o)):b.call(e,o),this}},e.fn.scrollTop=function(e){if(void 0===e){var o=!!this[0]&&(n.data(this[0],"__nicescroll")||!1);return o&&o.ishwscroll?o.getScrollTop():b.call(this)}return this.each(function(){var o=n.data(this,"__nicescroll")||!1;o&&o.ishwscroll?o.setScrollTop(parseInt(e)):b.call(n(this),e)})};var y=e.fn.scrollLeft;n.cssHooks.pageXOffset={get:function(e,o,t){var r=n.data(e,"__nicescroll")||!1;return r&&r.ishwscroll?r.getScrollLeft():y.call(e)},set:function(e,o){var t=n.data(e,"__nicescroll")||!1;return t&&t.ishwscroll?t.setScrollLeft(parseInt(o)):y.call(e,o),this}},e.fn.scrollLeft=function(e){if(void 0===e){var o=!!this[0]&&(n.data(this[0],"__nicescroll")||!1);return o&&o.ishwscroll?o.getScrollLeft():y.call(this)}return this.each(function(){var o=n.data(this,"__nicescroll")||!1;o&&o.ishwscroll?o.setScrollLeft(parseInt(e)):y.call(n(this),e)})};var x=function(e){var o=this;if(this.length=0,this.name="nicescrollarray",this.each=function(e){return n.each(o,e),o},this.push=function(e){o[o.length]=e,o.length++},this.eq=function(e){return o[e]},e)for(var t=0;t1?n(e,r):s,i.win=r}!("doc"in i)||"win"in i||(i.win=r);var l=r.data("__nicescroll")||!1;l||(i.doc=i.doc||r,l=new w(i,r),r.data("__nicescroll",l)),t.push(l)}),1===t.length?t[0]:t},window.NiceScroll={getjQuery:function(){return e}},n.nicescroll||(n.nicescroll=new x,n.nicescroll.options=m)}); \ No newline at end of file +/* nicescroll v3.7.4 InuYaksa - MIT - https://nicescroll.areaaperta.com */ +!function(e){"function"==typeof define&&define.amd?define(["jquery"],e):"object"==typeof exports?module.exports=e(require("jquery")):e(jQuery)}(function(e){"use strict";var o=!1,t=!1,r=0,i=2e3,s=0,n=e,l=document,a=window,c=n(a),d=a.requestAnimationFrame||a.webkitRequestAnimationFrame||a.mozRequestAnimationFrame||!1,u=a.cancelAnimationFrame||a.webkitCancelAnimationFrame||a.mozCancelAnimationFrame||!1;if(d)a.cancelAnimationFrame||(u=function(e){});else{var h=0;d=function(e,o){var t=(new Date).getTime(),r=Math.max(0,16-(t-h)),i=a.setTimeout(function(){e(t+r)},r);return h=t+r,i},u=function(e){a.clearTimeout(e)}}var p=a.MutationObserver||a.WebKitMutationObserver||!1,m=Date.now||function(){return(new Date).getTime()},f={zindex:"auto",cursoropacitymin:0,cursoropacitymax:1,cursorcolor:"#424242",cursorwidth:"6px",cursorborder:"1px solid #fff",cursorborderradius:"5px",scrollspeed:40,mousescrollstep:24,touchbehavior:!1,emulatetouch:!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 e=l.currentScript||function(){var e=l.getElementsByTagName("script");return!!e.length&&e[e.length-1]}(),o=e?e.src.split("?")[0]:"";return o.split("/").length>0?o.split("/").slice(0,-1).join("/")+"/":""}(),preventmultitouchscrolling:!0,disablemutationobserver:!1,enableobserver:!0,scrollbarid:!1},g=!1,v=function(){if(g)return g;var e=l.createElement("DIV"),o=e.style,t=navigator.userAgent,r=navigator.platform,i={};return i.haspointerlock="pointerLockElement"in l||"webkitPointerLockElement"in l||"mozPointerLockElement"in l,i.isopera="opera"in a,i.isopera12=i.isopera&&"getUserMedia"in navigator,i.isoperamini="[object OperaMini]"===Object.prototype.toString.call(a.operamini),i.isie="all"in l&&"attachEvent"in e&&!i.isopera,i.isieold=i.isie&&!("msInterpolationMode"in o),i.isie7=i.isie&&!i.isieold&&(!("documentMode"in l)||7===l.documentMode),i.isie8=i.isie&&"documentMode"in l&&8===l.documentMode,i.isie9=i.isie&&"performance"in a&&9===l.documentMode,i.isie10=i.isie&&"performance"in a&&10===l.documentMode,i.isie11="msRequestFullscreen"in e&&l.documentMode>=11,i.ismsedge="msCredentials"in a,i.ismozilla="MozAppearance"in o,i.iswebkit=!i.ismsedge&&"WebkitAppearance"in o,i.ischrome=i.iswebkit&&"chrome"in a,i.ischrome38=i.ischrome&&"touchAction"in o,i.ischrome22=!i.ischrome38&&i.ischrome&&i.haspointerlock,i.ischrome26=!i.ischrome38&&i.ischrome&&"transition"in o,i.cantouch="ontouchstart"in l.documentElement||"ontouchstart"in a,i.hasw3ctouch=(a.PointerEvent||!1)&&(navigator.MaxTouchPoints>0||navigator.msMaxTouchPoints>0),i.hasmstouch=!i.hasw3ctouch&&(a.MSPointerEvent||!1),i.ismac=/^mac$/i.test(r),i.isios=i.cantouch&&/iphone|ipad|ipod/i.test(r),i.isios4=i.isios&&!("seal"in Object),i.isios7=i.isios&&"webkitHidden"in l,i.isios8=i.isios&&"hidden"in l,i.isios10=i.isios&&a.Proxy,i.isandroid=/android/i.test(t),i.haseventlistener="addEventListener"in e,i.trstyle=!1,i.hastransform=!1,i.hastranslate3d=!1,i.transitionstyle=!1,i.hastransition=!1,i.transitionend=!1,i.trstyle="transform",i.hastransform="transform"in o||function(){for(var e=["msTransform","webkitTransform","MozTransform","OTransform"],t=0,r=e.length;t0;){if(9==e[0].nodeType)return!1;var o=e.css("zIndex");if(!isNaN(o)&&0!==o)return parseInt(o);e=e.parent()}return!1}function y(e,o,t){var r=e.css(o),i=parseFloat(r);if(isNaN(i)){var s=3==(i=R[r]||0)?t?k.win.outerHeight()-k.win.innerHeight():k.win.outerWidth()-k.win.innerWidth():1;return k.isie8&&i&&(i+=1),s?i:0}return i}function x(e,o,t,r){k._bind(e,o,function(r){var i={original:r=r||a.event,target:r.target||r.srcElement,type:"wheel",deltaMode:"MozMousePixelScroll"==r.type?0:1,deltaX:0,deltaZ:0,preventDefault:function(){return r.preventDefault?r.preventDefault():r.returnValue=!1,!1},stopImmediatePropagation:function(){r.stopImmediatePropagation?r.stopImmediatePropagation():r.cancelBubble=!0}};return"mousewheel"==o?(r.wheelDeltaX&&(i.deltaX=-.025*r.wheelDeltaX),r.wheelDeltaY&&(i.deltaY=-.025*r.wheelDeltaY),!i.deltaY&&!i.deltaX&&(i.deltaY=-.025*r.wheelDelta)):i.deltaY=r.detail,t.call(e,i)},r)}function S(e,o,t,r){k.scrollrunning||(k.newscrolly=k.getScrollTop(),k.newscrollx=k.getScrollLeft(),Y=m());var i=m()-Y;if(Y=m(),i>350?B=1:B+=(2-B)/10,e=e*B|0,o=o*B|0,e){if(r)if(e<0){if(k.getScrollLeft()>=k.page.maxw)return!0}else if(k.getScrollLeft()<=0)return!0;var s=e>0?1:-1;O!==s&&(k.scrollmom&&k.scrollmom.stop(),k.newscrollx=k.getScrollLeft(),O=s),k.lastdeltax-=e}if(o){if(function(){var e=k.getScrollTop();if(o<0){if(e>=k.page.maxh)return!0}else if(e<=0)return!0}()){if(!k.scrollrunning&&k.opt.nativeparentscrolling&&t&&!k.ispage&&!k.zoomactive)return!0;var n=k.view.h>>1;k.newscrolly<-n?(k.newscrolly=-n,o=-1):k.newscrolly>k.page.maxh+n?(k.newscrolly=k.page.maxh+n,o=1):o=0}var l=o>0?1:-1;I!==l&&(k.scrollmom&&k.scrollmom.stop(),k.newscrolly=k.getScrollTop(),I=l),k.lastdeltay-=o}(o||e)&&k.synched("relativexy",function(){var e=k.lastdeltay+k.newscrolly;k.lastdeltay=0;var o=k.lastdeltax+k.newscrollx;k.lastdeltax=0,k.rail.drag||k.doScrollPos(o,e)})}function z(e,o,t){var r,i;return 0===e.deltaMode?(r=-e.deltaX*(k.opt.mousescrollstep/54)|0,i=-e.deltaY*(k.opt.mousescrollstep/54)|0):1===e.deltaMode&&(r=-e.deltaX*k.opt.mousescrollstep|0,i=-e.deltaY*k.opt.mousescrollstep|0),o&&k.opt.oneaxismousemode&&0===r&&i&&(r=i,i=0,t&&(r<0?k.getScrollLeft()>=k.page.maxw:k.getScrollLeft()<=0)&&(i=r,r=0)),k.isrtlmode&&(r=-r),S(r,i,t,!0),e.stopImmediatePropagation(),e.preventDefault()}var k=this;this.version="3.7.4-c",this.name="nicescroll",this.me=h;var T=n("body");if(this.opt={doc:T,win:!1},n.extend(this.opt,f),this.opt.snapbackspeed=80,e)for(var E in k.opt)void 0!==e[E]&&(k.opt[E]=e[E]);if(k.opt.disablemutationobserver&&(p=!1),this.doc=k.opt.doc,this.iddoc=this.doc&&this.doc[0]?this.doc[0].id||"":"",this.ispage=/^BODY|HTML/.test(k.opt.win?k.opt.win[0].nodeName:this.doc[0].nodeName),this.haswrapper=!1!==k.opt.win,this.win=k.opt.win||(this.ispage?c:this.doc),this.docscroll=this.ispage&&!this.haswrapper?c:this.win,this.body=T,this.viewport=!1,this.isfixed=!1,this.iframe=!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"!=k.opt.autohidemode,this.onmousedown=!1,this.onmouseup=!1,this.onmousemove=!1,this.onmousewheel=!1,this.onkeypress=!1,this.ongesturezoom=!1,this.onclick=!1,this.onscrollstart=!1,this.onscrollend=!1,this.onscrollcancel=!1,this.onzoomin=!1,this.onzoomout=!1,this.view=!1,this.page=!1,this.scroll={x:0,y:0},this.scrollratio={x:0,y:0},this.cursorheight=20,this.scrollvaluemax=0,"auto"==this.opt.rtlmode){var M=this.win[0]==a?this.body:this.win,L=M.css("writing-mode")||M.css("-webkit-writing-mode")||M.css("-ms-writing-mode")||M.css("-moz-writing-mode");"horizontal-tb"==L||"lr-tb"==L||""===L?(this.isrtlmode="rtl"==M.css("direction"),this.isvertical=!1):(this.isrtlmode="vertical-rl"==L||"tb"==L||"tb-rl"==L||"rl-tb"==L,this.isvertical="vertical-rl"==L||"tb"==L||"tb-rl"==L)}else this.isrtlmode=!0===this.opt.rtlmode,this.isvertical=!1;if(this.scrollrunning=!1,this.scrollmom=!1,this.observer=!1,this.observerremover=!1,this.observerbody=!1,!1===k.opt.scrollbarid)do{this.id="ascrail"+i++}while(l.getElementById(this.id));else this.id=k.opt.scrollbarid;this.rail=!1,this.cursor=!1,this.cursorfreezed=!1,this.selectiondrag=!1,this.zoom=!1,this.zoomactive=!1,this.hasfocus=!1,this.hasmousefocus=!1,this.visibility=!0,this.railslocked=!1,this.locked=!1,this.hidden=!1,this.cursoractive=!0,this.wheelprevented=!1,this.overflowx=k.opt.overflowx,this.overflowy=k.opt.overflowy,this.nativescrollingarea=!1,this.checkarea=0,this.events=[],this.saved={},this.delaylist={},this.synclist={},this.lastdeltax=0,this.lastdeltay=0,this.detected=v();var C=n.extend({},this.detected);this.canhwscroll=C.hastransform&&k.opt.hwacceleration,this.ishwscroll=this.canhwscroll&&k.haswrapper,this.isrtlmode?this.isvertical?this.hasreversehr=!(C.iswebkit||C.isie||C.isie11):this.hasreversehr=!(C.iswebkit||C.isie&&!C.isie10&&!C.isie11):this.hasreversehr=!1,this.istouchcapable=!1,C.cantouch||!C.hasw3ctouch&&!C.hasmstouch?!C.cantouch||C.isios||C.isandroid||!C.iswebkit&&!C.ismozilla||(this.istouchcapable=!0):this.istouchcapable=!0,k.opt.enablemouselockapi||(C.hasmousecapture=!1,C.haspointerlock=!1),this.debounced=function(e,o,t){k&&(k.delaylist[e]||!1||(k.delaylist[e]={h:d(function(){k.delaylist[e].fn.call(k),k.delaylist[e]=!1},t)},o.call(k)),k.delaylist[e].fn=o)},this.synched=function(e,o){k.synclist[e]?k.synclist[e]=o:(k.synclist[e]=o,d(function(){k&&(k.synclist[e]&&k.synclist[e].call(k),k.synclist[e]=null)}))},this.unsynched=function(e){k.synclist[e]&&(k.synclist[e]=!1)},this.css=function(e,o){for(var t in o)k.saved.css.push([e,t,e.css(t)]),e.css(t,o[t])},this.scrollTop=function(e){return void 0===e?k.getScrollTop():k.setScrollTop(e)},this.scrollLeft=function(e){return void 0===e?k.getScrollLeft():k.setScrollLeft(e)};var N=function(e,o,t,r,i,s,n){this.st=e,this.ed=o,this.spd=t,this.p1=r||0,this.p2=i||1,this.p3=s||0,this.p4=n||1,this.ts=m(),this.df=o-e};if(N.prototype={B2:function(e){return 3*e*e*(1-e)},B3:function(e){return 3*e*(1-e)*(1-e)},B4:function(e){return(1-e)*(1-e)*(1-e)},getPos:function(){return(m()-this.ts)/this.spd},getNow:function(){var e=1-(m()-this.ts)/this.spd,o=this.B2(e)+this.B3(e)+this.B4(e);return e<0?this.ed:this.st+this.df*o|0},update:function(e,o){return this.st=this.getNow(),this.ed=e,this.spd=o,this.ts=m(),this.df=this.ed-this.st,this}},this.ishwscroll){this.doc.translate={x:0,y:0,tx:"0px",ty:"0px"},C.hastranslate3d&&C.isios&&this.doc.css("-webkit-backface-visibility","hidden"),this.getScrollTop=function(e){if(!e){var o=g();if(o)return 16==o.length?-o[13]:-o[5];if(k.timerscroll&&k.timerscroll.bz)return k.timerscroll.bz.getNow()}return k.doc.translate.y},this.getScrollLeft=function(e){if(!e){var o=g();if(o)return 16==o.length?-o[12]:-o[4];if(k.timerscroll&&k.timerscroll.bh)return k.timerscroll.bh.getNow()}return k.doc.translate.x},this.notifyScrollEvent=function(e){var o=l.createEvent("UIEvents");o.initUIEvent("scroll",!1,!0,a,1),o.niceevent=!0,e.dispatchEvent(o)};var P=this.isrtlmode?1:-1;C.hastranslate3d&&k.opt.enabletranslate3d?(this.setScrollTop=function(e,o){k.doc.translate.y=e,k.doc.translate.ty=-1*e+"px",k.doc.css(C.trstyle,"translate3d("+k.doc.translate.tx+","+k.doc.translate.ty+",0)"),o||k.notifyScrollEvent(k.win[0])},this.setScrollLeft=function(e,o){k.doc.translate.x=e,k.doc.translate.tx=e*P+"px",k.doc.css(C.trstyle,"translate3d("+k.doc.translate.tx+","+k.doc.translate.ty+",0)"),o||k.notifyScrollEvent(k.win[0])}):(this.setScrollTop=function(e,o){k.doc.translate.y=e,k.doc.translate.ty=-1*e+"px",k.doc.css(C.trstyle,"translate("+k.doc.translate.tx+","+k.doc.translate.ty+")"),o||k.notifyScrollEvent(k.win[0])},this.setScrollLeft=function(e,o){k.doc.translate.x=e,k.doc.translate.tx=e*P+"px",k.doc.css(C.trstyle,"translate("+k.doc.translate.tx+","+k.doc.translate.ty+")"),o||k.notifyScrollEvent(k.win[0])})}else this.getScrollTop=function(){return k.docscroll.scrollTop()},this.setScrollTop=function(e){k.docscroll.scrollTop(e)},this.getScrollLeft=function(){return k.hasreversehr?k.detected.ismozilla?k.page.maxw-Math.abs(k.docscroll.scrollLeft()):k.page.maxw-k.docscroll.scrollLeft():k.docscroll.scrollLeft()},this.setScrollLeft=function(e){return setTimeout(function(){if(k)return k.hasreversehr&&(e=k.detected.ismozilla?-(k.page.maxw-e):k.page.maxw-e),k.docscroll.scrollLeft(e)},1)};this.getTarget=function(e){return!!e&&(e.target?e.target:!!e.srcElement&&e.srcElement)},this.hasParent=function(e,o){if(!e)return!1;for(var t=e.target||e.srcElement||e||!1;t&&t.id!=o;)t=t.parentNode||!1;return!1!==t};var R={thin:1,medium:3,thick:5};this.getDocumentScrollOffset=function(){return{top:a.pageYOffset||l.documentElement.scrollTop,left:a.pageXOffset||l.documentElement.scrollLeft}},this.getOffset=function(){if(k.isfixed){var e=k.win.offset(),o=k.getDocumentScrollOffset();return e.top-=o.top,e.left-=o.left,e}var t=k.win.offset();if(!k.viewport)return t;var r=k.viewport.offset();return{top:t.top-r.top,left:t.left-r.left}},this.updateScrollBar=function(e){var o,t;if(k.ishwscroll)k.rail.css({height:k.win.innerHeight()-(k.opt.railpadding.top+k.opt.railpadding.bottom)}),k.railh&&k.railh.css({width:k.win.innerWidth()-(k.opt.railpadding.left+k.opt.railpadding.right)});else{var r=k.getOffset();if(o={top:r.top,left:r.left-(k.opt.railpadding.left+k.opt.railpadding.right)},o.top+=y(k.win,"border-top-width",!0),o.left+=k.rail.align?k.win.outerWidth()-y(k.win,"border-right-width")-k.rail.width:y(k.win,"border-left-width"),(t=k.opt.railoffset)&&(t.top&&(o.top+=t.top),t.left&&(o.left+=t.left)),k.railslocked||k.rail.css({top:o.top,left:o.left,height:(e?e.h:k.win.innerHeight())-(k.opt.railpadding.top+k.opt.railpadding.bottom)}),k.zoom&&k.zoom.css({top:o.top+1,left:1==k.rail.align?o.left-20:o.left+k.rail.width+4}),k.railh&&!k.railslocked){o={top:r.top,left:r.left},(t=k.opt.railhoffset)&&(t.top&&(o.top+=t.top),t.left&&(o.left+=t.left));var i=k.railh.align?o.top+y(k.win,"border-top-width",!0)+k.win.innerHeight()-k.railh.height:o.top+y(k.win,"border-top-width",!0),s=o.left+y(k.win,"border-left-width");k.railh.css({top:i-(k.opt.railpadding.top+k.opt.railpadding.bottom),left:s,width:k.railh.width})}}},this.doRailClick=function(e,o,t){var r,i,s,n;k.railslocked||(k.cancelEvent(e),"pageY"in e||(e.pageX=e.clientX+l.documentElement.scrollLeft,e.pageY=e.clientY+l.documentElement.scrollTop),o?(r=t?k.doScrollLeft:k.doScrollTop)(s=t?(e.pageX-k.railh.offset().left-k.cursorwidth/2)*k.scrollratio.x:(e.pageY-k.rail.offset().top-k.cursorheight/2)*k.scrollratio.y):(r=t?k.doScrollLeftBy:k.doScrollBy,s=t?k.scroll.x:k.scroll.y,n=t?e.pageX-k.railh.offset().left:e.pageY-k.rail.offset().top,i=t?k.view.w:k.view.h,r(s>=n?i:-i)))},k.newscrolly=k.newscrollx=0,k.hasanimationframe="requestAnimationFrame"in a,k.hascancelanimationframe="cancelAnimationFrame"in a,k.hasborderbox=!1,this.init=function(){if(k.saved.css=[],C.isoperamini)return!0;if(C.isandroid&&!("hidden"in l))return!0;k.opt.emulatetouch=k.opt.emulatetouch||k.opt.touchbehavior,k.hasborderbox=a.getComputedStyle&&"border-box"===a.getComputedStyle(l.body)["box-sizing"];var e={"overflow-y":"hidden"};if((C.isie11||C.isie10)&&(e["-ms-overflow-style"]="none"),k.ishwscroll&&(this.doc.css(C.transitionstyle,C.prefixstyle+"transform 0ms ease-out"),C.transitionend&&k.bind(k.doc,C.transitionend,k.onScrollTransitionEnd,!1)),k.zindex="auto",k.ispage||"auto"!=k.opt.zindex?k.zindex=k.opt.zindex:k.zindex=w()||"auto",!k.ispage&&"auto"!=k.zindex&&k.zindex>s&&(s=k.zindex),k.isie&&0===k.zindex&&"auto"==k.opt.zindex&&(k.zindex="auto"),!k.ispage||!C.cantouch&&!C.isieold){var i=k.docscroll;k.ispage&&(i=k.haswrapper?k.win:k.doc),k.css(i,e),k.ispage&&(C.isie11||C.isie)&&k.css(n("html"),e),!C.isios||k.ispage||k.haswrapper||k.css(T,{"-webkit-overflow-scrolling":"touch"});var d=n(l.createElement("div"));d.css({position:"relative",top:0,float:"right",width:k.opt.cursorwidth,height:0,"background-color":k.opt.cursorcolor,border:k.opt.cursorborder,"background-clip":"padding-box","-webkit-border-radius":k.opt.cursorborderradius,"-moz-border-radius":k.opt.cursorborderradius,"border-radius":k.opt.cursorborderradius}),d.addClass("nicescroll-cursors"),k.cursor=d;var u=n(l.createElement("div"));u.attr("id",k.id),u.addClass("nicescroll-rails nicescroll-rails-vr");var h,m,f=["left","right","top","bottom"];for(var g in f)m=f[g],(h=k.opt.railpadding[m]||0)&&u.css("padding-"+m,h+"px");u.append(d),u.width=Math.max(parseFloat(k.opt.cursorwidth),d.outerWidth()),u.css({width:u.width+"px",zIndex:k.zindex,background:k.opt.background,cursor:"default"}),u.visibility=!0,u.scrollable=!0,u.align="left"==k.opt.railalign?0:1,k.rail=u,k.rail.drag=!1;var v=!1;!k.opt.boxzoom||k.ispage||C.isieold||(v=l.createElement("div"),k.bind(v,"click",k.doZoom),k.bind(v,"mouseenter",function(){k.zoom.css("opacity",k.opt.cursoropacitymax)}),k.bind(v,"mouseleave",function(){k.zoom.css("opacity",k.opt.cursoropacitymin)}),k.zoom=n(v),k.zoom.css({cursor:"pointer",zIndex:k.zindex,backgroundImage:"url("+k.opt.scriptpath+"zoomico.png)",height:18,width:18,backgroundPosition:"0 0"}),k.opt.dblclickzoom&&k.bind(k.win,"dblclick",k.doZoom),C.cantouch&&k.opt.gesturezoom&&(k.ongesturezoom=function(e){return e.scale>1.5&&k.doZoomIn(e),e.scale<.8&&k.doZoomOut(e),k.cancelEvent(e)},k.bind(k.win,"gestureend",k.ongesturezoom))),k.railh=!1;var y;if(k.opt.horizrailenabled&&(k.css(i,{overflowX:"hidden"}),(d=n(l.createElement("div"))).css({position:"absolute",top:0,height:k.opt.cursorwidth,width:0,backgroundColor:k.opt.cursorcolor,border:k.opt.cursorborder,backgroundClip:"padding-box","-webkit-border-radius":k.opt.cursorborderradius,"-moz-border-radius":k.opt.cursorborderradius,"border-radius":k.opt.cursorborderradius}),C.isieold&&d.css("overflow","hidden"),d.addClass("nicescroll-cursors"),k.cursorh=d,(y=n(l.createElement("div"))).attr("id",k.id+"-hr"),y.addClass("nicescroll-rails nicescroll-rails-hr"),y.height=Math.max(parseFloat(k.opt.cursorwidth),d.outerHeight()),y.css({height:y.height+"px",zIndex:k.zindex,background:k.opt.background}),y.append(d),y.visibility=!0,y.scrollable=!0,y.align="top"==k.opt.railvalign?0:1,k.railh=y,k.railh.drag=!1),k.ispage)u.css({position:"fixed",top:0,height:"100%"}),u.css(u.align?{right:0}:{left:0}),k.body.append(u),k.railh&&(y.css({position:"fixed",left:0,width:"100%"}),y.css(y.align?{bottom:0}:{top:0}),k.body.append(y));else{if(k.ishwscroll){"static"==k.win.css("position")&&k.css(k.win,{position:"relative"});var x="HTML"==k.win[0].nodeName?k.body:k.win;n(x).scrollTop(0).scrollLeft(0),k.zoom&&(k.zoom.css({position:"absolute",top:1,right:0,"margin-right":u.width+4}),x.append(k.zoom)),u.css({position:"absolute",top:0}),u.css(u.align?{right:0}:{left:0}),x.append(u),y&&(y.css({position:"absolute",left:0,bottom:0}),y.css(y.align?{bottom:0}:{top:0}),x.append(y))}else{k.isfixed="fixed"==k.win.css("position");var S=k.isfixed?"fixed":"absolute";k.isfixed||(k.viewport=k.getViewport(k.win[0])),k.viewport&&(k.body=k.viewport,/fixed|absolute/.test(k.viewport.css("position"))||k.css(k.viewport,{position:"relative"})),u.css({position:S}),k.zoom&&k.zoom.css({position:S}),k.updateScrollBar(),k.body.append(u),k.zoom&&k.body.append(k.zoom),k.railh&&(y.css({position:S}),k.body.append(y))}C.isios&&k.css(k.win,{"-webkit-tap-highlight-color":"rgba(0,0,0,0)","-webkit-touch-callout":"none"}),C.isie&&k.opt.disableoutline&&k.win.attr("hideFocus","true"),C.iswebkit&&k.opt.disableoutline&&k.win.css("outline","none")}if(!1===k.opt.autohidemode?(k.autohidedom=!1,k.rail.css({opacity:k.opt.cursoropacitymax}),k.railh&&k.railh.css({opacity:k.opt.cursoropacitymax})):!0===k.opt.autohidemode||"leave"===k.opt.autohidemode?(k.autohidedom=n().add(k.rail),C.isie8&&(k.autohidedom=k.autohidedom.add(k.cursor)),k.railh&&(k.autohidedom=k.autohidedom.add(k.railh)),k.railh&&C.isie8&&(k.autohidedom=k.autohidedom.add(k.cursorh))):"scroll"==k.opt.autohidemode?(k.autohidedom=n().add(k.rail),k.railh&&(k.autohidedom=k.autohidedom.add(k.railh))):"cursor"==k.opt.autohidemode?(k.autohidedom=n().add(k.cursor),k.railh&&(k.autohidedom=k.autohidedom.add(k.cursorh))):"hidden"==k.opt.autohidemode&&(k.autohidedom=!1,k.hide(),k.railslocked=!1),C.cantouch||k.istouchcapable||k.opt.emulatetouch||C.hasmstouch){k.scrollmom=new b(k),k.ontouchstart=function(e){if(e.pointerType&&("mouse"===e.pointerType||e.pointerType===e.MSPOINTER_TYPE_MOUSE))return!1;if(k.hasmoving=!1,!k.railslocked){var o;if(C.hasmstouch)for(o=!!e.target&&e.target;o;){var t=n(o).getNiceScroll();if(t.length>0&&t[0].me==k.me)break;if(t.length>0)return!1;if("DIV"==o.nodeName&&o.id==k.id)break;o=!!o.parentNode&&o.parentNode}if(e.stopPropagation(),k.cancelScroll(),(o=k.getTarget(e))&&/INPUT/i.test(o.nodeName)&&/range/i.test(o.type))return k.stopPropagation(e);if(!("clientX"in e)&&"changedTouches"in e&&(e.clientX=e.changedTouches[0].clientX,e.clientY=e.changedTouches[0].clientY),k.forcescreen){var r=e;(e={original:e.original?e.original:e}).clientX=r.screenX,e.clientY=r.screenY}if(k.rail.drag={x:e.clientX,y:e.clientY,sx:k.scroll.x,sy:k.scroll.y,st:k.getScrollTop(),sl:k.getScrollLeft(),pt:2,dl:!1,tg:o},k.ispage||!k.opt.directionlockdeadzone)k.rail.drag.dl="f";else{var i={w:c.width(),h:c.height()},s={w:Math.max(l.body.scrollWidth,l.documentElement.scrollWidth),h:Math.max(l.body.scrollHeight,l.documentElement.scrollHeight)},a=Math.max(0,s.h-i.h),d=Math.max(0,s.w-i.w);!k.rail.scrollable&&k.railh.scrollable?k.rail.drag.ck=a>0&&"v":k.rail.scrollable&&!k.railh.scrollable?k.rail.drag.ck=d>0&&"h":k.rail.drag.ck=!1,k.rail.drag.ck||(k.rail.drag.dl="f")}if(k.opt.emulatetouch&&k.isiframe&&C.isie){var u=k.win.position();k.rail.drag.x+=u.left,k.rail.drag.y+=u.top}if(k.hasmoving=!1,k.lastmouseup=!1,k.scrollmom.reset(e.clientX,e.clientY),!C.cantouch&&!this.istouchcapable&&!e.pointerType){if(!(!!o&&/INPUT|SELECT|BUTTON|TEXTAREA/i.test(o.nodeName)))return!k.ispage&&C.hasmousecapture&&o.setCapture(),k.opt.emulatetouch?(o.onclick&&!o._onclick&&(o._onclick=o.onclick,o.onclick=function(e){if(k.hasmoving)return!1;o._onclick.call(this,e)}),k.cancelEvent(e)):k.stopPropagation(e);/SUBMIT|CANCEL|BUTTON/i.test(n(o).attr("type"))&&(k.preventclick={tg:o,click:!1})}}},k.ontouchend=function(e){if(!k.rail.drag)return!0;if(2==k.rail.drag.pt){if(e.pointerType&&("mouse"===e.pointerType||e.pointerType===e.MSPOINTER_TYPE_MOUSE))return!1;if(k.rail.drag=!1,k.hasmoving&&(k.scrollmom.doMomentum(),k.lastmouseup=!0,k.hideCursor(),C.hasmousecapture&&l.releaseCapture(),!C.cantouch))return k.cancelEvent(e)}else if(1==k.rail.drag.pt)return k.onmouseup(e)};var z=k.opt.emulatetouch&&k.isiframe&&!C.hasmousecapture;k.ontouchmove=function(e,o){if(!k.rail.drag)return!1;if(e.targetTouches&&k.opt.preventmultitouchscrolling&&e.targetTouches.length>1)return!1;if(e.pointerType&&("mouse"===e.pointerType||e.pointerType===e.MSPOINTER_TYPE_MOUSE))return!1;if(2==k.rail.drag.pt){if("changedTouches"in e&&(e.clientX=e.changedTouches[0].clientX,e.clientY=e.changedTouches[0].clientY),k.rail.drag.y===e.clientY&&k.rail.drag.x===e.clientX)return!1;k.hasmoving||k.triggerScrollStart(e.clientX,e.clientY,0,0,0),k.hasmoving=!0,k.preventclick&&!k.preventclick.click&&(k.preventclick.click=k.preventclick.tg.onclick||!1,k.preventclick.tg.onclick=k.onpreventclick);var t,r;if(r=t=0,z&&!o){var i=k.win.position();r=-i.left,t=-i.top}var s=e.clientY+t,n=s-k.rail.drag.y,a=e.clientX+r,c=a-k.rail.drag.x,d=k.rail.drag.st-n;k.ishwscroll&&k.opt.bouncescroll?d<0?d=Math.round(d/2):d>k.page.maxh&&(d=k.page.maxh+Math.round((d-k.page.maxh)/2)):(d<0&&(d=0,s=0),d>k.page.maxh&&(d=k.page.maxh,s=0));var u;k.railh&&k.railh.scrollable&&(u=k.isrtlmode?c-k.rail.drag.sl:k.rail.drag.sl-c,k.ishwscroll&&k.opt.bouncescroll?u<0?u=Math.round(u/2):u>k.page.maxw&&(u=k.page.maxw+Math.round((u-k.page.maxw)/2)):(u<0&&(u=0,a=0),u>k.page.maxw&&(u=k.page.maxw,a=0)));var h=!1;if(k.rail.drag.dl)h=!0,"v"==k.rail.drag.dl?u=k.rail.drag.sl:"h"==k.rail.drag.dl&&(d=k.rail.drag.st);else{var p=Math.abs(n),m=Math.abs(c),f=k.opt.directionlockdeadzone;if("v"==k.rail.drag.ck){if(p>f&&m<=.3*p)return k.rail.drag=!1,!0;m>f&&(k.rail.drag.dl="f",T.scrollTop(T.scrollTop()))}else if("h"==k.rail.drag.ck){if(m>f&&p<=.3*m)return k.rail.drag=!1,!0;p>f&&(k.rail.drag.dl="f",T.scrollLeft(T.scrollLeft()))}}if(k.synched("touchmove",function(){k.rail.drag&&2==k.rail.drag.pt&&(k.prepareTransition&&k.resetTransition(),k.rail.scrollable&&k.setScrollTop(d),k.scrollmom.update(a,s),k.railh&&k.railh.scrollable?(k.setScrollLeft(u),k.showCursor(d,u)):k.showCursor(d),C.isie10&&l.selection.clear())}),C.ischrome&&k.istouchcapable&&(h=!1),h)return k.cancelEvent(e)}else if(1==k.rail.drag.pt)return k.onmousemove(e)},k.ontouchstartCursor=function(e,o){if(!k.rail.drag||3==k.rail.drag.pt){if(k.locked)return k.cancelEvent(e);k.cancelScroll(),k.rail.drag={x:e.touches[0].clientX,y:e.touches[0].clientY,sx:k.scroll.x,sy:k.scroll.y,pt:3,hr:!!o};var t=k.getTarget(e);return!k.ispage&&C.hasmousecapture&&t.setCapture(),k.isiframe&&!C.hasmousecapture&&(k.saved.csspointerevents=k.doc.css("pointer-events"),k.css(k.doc,{"pointer-events":"none"})),k.cancelEvent(e)}},k.ontouchendCursor=function(e){if(k.rail.drag){if(C.hasmousecapture&&l.releaseCapture(),k.isiframe&&!C.hasmousecapture&&k.doc.css("pointer-events",k.saved.csspointerevents),3!=k.rail.drag.pt)return;return k.rail.drag=!1,k.cancelEvent(e)}},k.ontouchmoveCursor=function(e){if(k.rail.drag){if(3!=k.rail.drag.pt)return;if(k.cursorfreezed=!0,k.rail.drag.hr){k.scroll.x=k.rail.drag.sx+(e.touches[0].clientX-k.rail.drag.x),k.scroll.x<0&&(k.scroll.x=0);var o=k.scrollvaluemaxw;k.scroll.x>o&&(k.scroll.x=o)}else{k.scroll.y=k.rail.drag.sy+(e.touches[0].clientY-k.rail.drag.y),k.scroll.y<0&&(k.scroll.y=0);var t=k.scrollvaluemax;k.scroll.y>t&&(k.scroll.y=t)}return k.synched("touchmove",function(){k.rail.drag&&3==k.rail.drag.pt&&(k.showCursor(),k.rail.drag.hr?k.doScrollLeft(Math.round(k.scroll.x*k.scrollratio.x),k.opt.cursordragspeed):k.doScrollTop(Math.round(k.scroll.y*k.scrollratio.y),k.opt.cursordragspeed))}),k.cancelEvent(e)}}}if(k.onmousedown=function(e,o){if(!k.rail.drag||1==k.rail.drag.pt){if(k.railslocked)return k.cancelEvent(e);k.cancelScroll(),k.rail.drag={x:e.clientX,y:e.clientY,sx:k.scroll.x,sy:k.scroll.y,pt:1,hr:o||!1};var t=k.getTarget(e);return C.hasmousecapture&&t.setCapture(),k.isiframe&&!C.hasmousecapture&&(k.saved.csspointerevents=k.doc.css("pointer-events"),k.css(k.doc,{"pointer-events":"none"})),k.hasmoving=!1,k.cancelEvent(e)}},k.onmouseup=function(e){if(k.rail.drag)return 1!=k.rail.drag.pt||(C.hasmousecapture&&l.releaseCapture(),k.isiframe&&!C.hasmousecapture&&k.doc.css("pointer-events",k.saved.csspointerevents),k.rail.drag=!1,k.cursorfreezed=!1,k.hasmoving&&k.triggerScrollEnd(),k.cancelEvent(e))},k.onmousemove=function(e){if(k.rail.drag){if(1!==k.rail.drag.pt)return;if(C.ischrome&&0===e.which)return k.onmouseup(e);if(k.cursorfreezed=!0,k.hasmoving||k.triggerScrollStart(e.clientX,e.clientY,0,0,0),k.hasmoving=!0,k.rail.drag.hr){k.scroll.x=k.rail.drag.sx+(e.clientX-k.rail.drag.x),k.scroll.x<0&&(k.scroll.x=0);var o=k.scrollvaluemaxw;k.scroll.x>o&&(k.scroll.x=o)}else{k.scroll.y=k.rail.drag.sy+(e.clientY-k.rail.drag.y),k.scroll.y<0&&(k.scroll.y=0);var t=k.scrollvaluemax;k.scroll.y>t&&(k.scroll.y=t)}return k.synched("mousemove",function(){k.cursorfreezed&&(k.showCursor(),k.rail.drag.hr?k.scrollLeft(Math.round(k.scroll.x*k.scrollratio.x)):k.scrollTop(Math.round(k.scroll.y*k.scrollratio.y)))}),k.cancelEvent(e)}k.checkarea=0},C.cantouch||k.opt.emulatetouch)k.onpreventclick=function(e){if(k.preventclick)return k.preventclick.tg.onclick=k.preventclick.click,k.preventclick=!1,k.cancelEvent(e)},k.onclick=!C.isios&&function(e){return!k.lastmouseup||(k.lastmouseup=!1,k.cancelEvent(e))},k.opt.grabcursorenabled&&C.cursorgrabvalue&&(k.css(k.ispage?k.doc:k.win,{cursor:C.cursorgrabvalue}),k.css(k.rail,{cursor:C.cursorgrabvalue}));else{var E=function(e){if(k.selectiondrag){if(e){var o=k.win.outerHeight(),t=e.pageY-k.selectiondrag.top;t>0&&t=o&&(t-=o),k.selectiondrag.df=t}if(0!==k.selectiondrag.df){var r=2*-Math.floor(k.selectiondrag.df/6);k.doScrollBy(r),k.debounced("doselectionscroll",function(){E()},50)}}};k.hasTextSelected="getSelection"in l?function(){return l.getSelection().rangeCount>0}:"selection"in l?function(){return"None"!=l.selection.type}:function(){return!1},k.onselectionstart=function(e){k.ispage||(k.selectiondrag=k.win.offset())},k.onselectionend=function(e){k.selectiondrag=!1},k.onselectiondrag=function(e){k.selectiondrag&&k.hasTextSelected()&&k.debounced("selectionscroll",function(){E(e)},250)}}if(C.hasw3ctouch?(k.css(k.ispage?n("html"):k.win,{"touch-action":"none"}),k.css(k.rail,{"touch-action":"none"}),k.css(k.cursor,{"touch-action":"none"}),k.bind(k.win,"pointerdown",k.ontouchstart),k.bind(l,"pointerup",k.ontouchend),k.bind(l,"pointermove",k.ontouchmove)):C.hasmstouch?(k.css(k.ispage?n("html"):k.win,{"-ms-touch-action":"none"}),k.css(k.rail,{"-ms-touch-action":"none"}),k.css(k.cursor,{"-ms-touch-action":"none"}),k.bind(k.win,"MSPointerDown",k.ontouchstart),k.bind(l,"MSPointerUp",k.ontouchend),k.bind(l,"MSPointerMove",k.ontouchmove),k.bind(k.cursor,"MSGestureHold",function(e){e.preventDefault()}),k.bind(k.cursor,"contextmenu",function(e){e.preventDefault()})):C.cantouch&&(k.bind(k.win,"touchstart",k.ontouchstart,!1,!0),k.bind(l,"touchend",k.ontouchend,!1,!0),k.bind(l,"touchcancel",k.ontouchend,!1,!0),k.bind(l,"touchmove",k.ontouchmove,!1,!0)),k.opt.emulatetouch&&(k.bind(k.win,"mousedown",k.ontouchstart,!1,!0),k.bind(l,"mouseup",k.ontouchend,!1,!0),k.bind(l,"mousemove",k.ontouchmove,!1,!0)),(k.opt.cursordragontouch||!C.cantouch&&!k.opt.emulatetouch)&&(k.rail.css({cursor:"default"}),k.railh&&k.railh.css({cursor:"default"}),k.jqbind(k.rail,"mouseenter",function(){if(!k.ispage&&!k.win.is(":visible"))return!1;k.canshowonmouseevent&&k.showCursor(),k.rail.active=!0}),k.jqbind(k.rail,"mouseleave",function(){k.rail.active=!1,k.rail.drag||k.hideCursor()}),k.opt.sensitiverail&&(k.bind(k.rail,"click",function(e){k.doRailClick(e,!1,!1)}),k.bind(k.rail,"dblclick",function(e){k.doRailClick(e,!0,!1)}),k.bind(k.cursor,"click",function(e){k.cancelEvent(e)}),k.bind(k.cursor,"dblclick",function(e){k.cancelEvent(e)})),k.railh&&(k.jqbind(k.railh,"mouseenter",function(){if(!k.ispage&&!k.win.is(":visible"))return!1;k.canshowonmouseevent&&k.showCursor(),k.rail.active=!0}),k.jqbind(k.railh,"mouseleave",function(){k.rail.active=!1,k.rail.drag||k.hideCursor()}),k.opt.sensitiverail&&(k.bind(k.railh,"click",function(e){k.doRailClick(e,!1,!0)}),k.bind(k.railh,"dblclick",function(e){k.doRailClick(e,!0,!0)}),k.bind(k.cursorh,"click",function(e){k.cancelEvent(e)}),k.bind(k.cursorh,"dblclick",function(e){k.cancelEvent(e)})))),k.opt.cursordragontouch&&(this.istouchcapable||C.cantouch)&&(k.bind(k.cursor,"touchstart",k.ontouchstartCursor),k.bind(k.cursor,"touchmove",k.ontouchmoveCursor),k.bind(k.cursor,"touchend",k.ontouchendCursor),k.cursorh&&k.bind(k.cursorh,"touchstart",function(e){k.ontouchstartCursor(e,!0)}),k.cursorh&&k.bind(k.cursorh,"touchmove",k.ontouchmoveCursor),k.cursorh&&k.bind(k.cursorh,"touchend",k.ontouchendCursor)),C.cantouch||k.opt.emulatetouch?(k.bind(C.hasmousecapture?k.win:l,"mouseup",k.ontouchend),k.onclick&&k.bind(l,"click",k.onclick),k.opt.cursordragontouch?(k.bind(k.cursor,"mousedown",k.onmousedown),k.bind(k.cursor,"mouseup",k.onmouseup),k.cursorh&&k.bind(k.cursorh,"mousedown",function(e){k.onmousedown(e,!0)}),k.cursorh&&k.bind(k.cursorh,"mouseup",k.onmouseup)):(k.bind(k.rail,"mousedown",function(e){e.preventDefault()}),k.railh&&k.bind(k.railh,"mousedown",function(e){e.preventDefault()}))):(k.bind(C.hasmousecapture?k.win:l,"mouseup",k.onmouseup),k.bind(l,"mousemove",k.onmousemove),k.onclick&&k.bind(l,"click",k.onclick),k.bind(k.cursor,"mousedown",k.onmousedown),k.bind(k.cursor,"mouseup",k.onmouseup),k.railh&&(k.bind(k.cursorh,"mousedown",function(e){k.onmousedown(e,!0)}),k.bind(k.cursorh,"mouseup",k.onmouseup)),!k.ispage&&k.opt.enablescrollonselection&&(k.bind(k.win[0],"mousedown",k.onselectionstart),k.bind(l,"mouseup",k.onselectionend),k.bind(k.cursor,"mouseup",k.onselectionend),k.cursorh&&k.bind(k.cursorh,"mouseup",k.onselectionend),k.bind(l,"mousemove",k.onselectiondrag)),k.zoom&&(k.jqbind(k.zoom,"mouseenter",function(){k.canshowonmouseevent&&k.showCursor(),k.rail.active=!0}),k.jqbind(k.zoom,"mouseleave",function(){k.rail.active=!1,k.rail.drag||k.hideCursor()}))),k.opt.enablemousewheel&&(k.isiframe||k.mousewheel(C.isie&&k.ispage?l:k.win,k.onmousewheel),k.mousewheel(k.rail,k.onmousewheel),k.railh&&k.mousewheel(k.railh,k.onmousewheelhr)),k.ispage||C.cantouch||/HTML|^BODY/.test(k.win[0].nodeName)||(k.win.attr("tabindex")||k.win.attr({tabindex:++r}),k.bind(k.win,"focus",function(e){o=k.getTarget(e).id||!0,k.hasfocus=!0,k.canshowonmouseevent&&k.noticeCursor()}),k.bind(k.win,"blur",function(e){o=!1,k.hasfocus=!1}),k.bind(k.win,"mouseenter",function(e){t=k.getTarget(e).id||!0,k.hasmousefocus=!0,k.canshowonmouseevent&&k.noticeCursor()}),k.bind(k.win,"mouseleave",function(e){t=!1,k.hasmousefocus=!1,k.rail.drag||k.hideCursor()})),k.onkeypress=function(e){if(k.railslocked&&0===k.page.maxh)return!0;e=e||a.event;var r=k.getTarget(e);if(r&&/INPUT|TEXTAREA|SELECT|OPTION/.test(r.nodeName)&&(!(r.getAttribute("type")||r.type||!1)||!/submit|button|cancel/i.tp))return!0;if(n(r).attr("contenteditable"))return!0;if(k.hasfocus||k.hasmousefocus&&!o||k.ispage&&!o&&!t){var i=e.keyCode;if(k.railslocked&&27!=i)return k.cancelEvent(e);var s=e.ctrlKey||!1,l=e.shiftKey||!1,c=!1;switch(i){case 38:case 63233:k.doScrollBy(72),c=!0;break;case 40:case 63235:k.doScrollBy(-72),c=!0;break;case 37:case 63232:k.railh&&(s?k.doScrollLeft(0):k.doScrollLeftBy(72),c=!0);break;case 39:case 63234:k.railh&&(s?k.doScrollLeft(k.page.maxw):k.doScrollLeftBy(-72),c=!0);break;case 33:case 63276:k.doScrollBy(k.view.h),c=!0;break;case 34:case 63277:k.doScrollBy(-k.view.h),c=!0;break;case 36:case 63273:k.railh&&s?k.doScrollPos(0,0):k.doScrollTo(0),c=!0;break;case 35:case 63275:k.railh&&s?k.doScrollPos(k.page.maxw,k.page.maxh):k.doScrollTo(k.page.maxh),c=!0;break;case 32:k.opt.spacebarenabled&&(l?k.doScrollBy(k.view.h):k.doScrollBy(-k.view.h),c=!0);break;case 27:k.zoomactive&&(k.doZoom(),c=!0)}if(c)return k.cancelEvent(e)}},k.opt.enablekeyboard&&k.bind(l,C.isopera&&!C.isopera12?"keypress":"keydown",k.onkeypress),k.bind(l,"keydown",function(e){(e.ctrlKey||!1)&&(k.wheelprevented=!0)}),k.bind(l,"keyup",function(e){e.ctrlKey||!1||(k.wheelprevented=!1)}),k.bind(a,"blur",function(e){k.wheelprevented=!1}),k.bind(a,"resize",k.lazyResize),k.bind(a,"orientationchange",k.lazyResize),k.bind(a,"load",k.lazyResize),C.ischrome&&!k.ispage&&!k.haswrapper){var M=k.win.attr("style"),L=parseFloat(k.win.css("width"))+1;k.win.css("width",L),k.synched("chromefix",function(){k.win.attr("style",M)})}k.onAttributeChange=function(e){k.lazyResize(k.isieold?250:30)},k.opt.enableobserver&&(k.isie11||!1===p||(k.observerbody=new p(function(e){if(e.forEach(function(e){if("attributes"==e.type)return T.hasClass("modal-open")&&T.hasClass("modal-dialog")&&!n.contains(n(".modal-dialog")[0],k.doc[0])?k.hide():k.show()}),k.me.clientWidth!=k.page.width||k.me.clientHeight!=k.page.height)return k.lazyResize(30)}),k.observerbody.observe(l.body,{childList:!0,subtree:!0,characterData:!1,attributes:!0,attributeFilter:["class"]})),k.ispage||k.haswrapper||(!1!==p?(k.observer=new p(function(e){e.forEach(k.onAttributeChange)}),k.observer.observe(k.win[0],{childList:!0,characterData:!1,attributes:!0,subtree:!1}),k.observerremover=new p(function(e){e.forEach(function(e){if(e.removedNodes.length>0)for(var o in e.removedNodes)if(k&&e.removedNodes[o]==k.win[0])return k.remove()})}),k.observerremover.observe(k.win[0].parentNode,{childList:!0,characterData:!1,attributes:!1,subtree:!1})):(k.bind(k.win,C.isie&&!C.isie9?"propertychange":"DOMAttrModified",k.onAttributeChange),C.isie9&&k.win[0].attachEvent("onpropertychange",k.onAttributeChange),k.bind(k.win,"DOMNodeRemoved",function(e){e.target==k.win[0]&&k.remove()})))),!k.ispage&&k.opt.boxzoom&&k.bind(a,"resize",k.resizeZoom),k.istextarea&&(k.bind(k.win,"keydown",k.lazyResize),k.bind(k.win,"mouseup",k.lazyResize)),k.lazyResize(30)}if("IFRAME"==this.doc[0].nodeName){var N=function(){k.iframexd=!1;var o;try{(o="contentDocument"in this?this.contentDocument:this.contentWindow._doc).domain}catch(e){k.iframexd=!0,o=!1}if(k.iframexd)return"console"in a&&console.log("NiceScroll error: policy restriced iframe"),!0;if(k.forcescreen=!0,k.isiframe&&(k.iframe={doc:n(o),html:k.doc.contents().find("html")[0],body:k.doc.contents().find("body")[0]},k.getContentSize=function(){return{w:Math.max(k.iframe.html.scrollWidth,k.iframe.body.scrollWidth),h:Math.max(k.iframe.html.scrollHeight,k.iframe.body.scrollHeight)}},k.docscroll=n(k.iframe.body)),!C.isios&&k.opt.iframeautoresize&&!k.isiframe){k.win.scrollTop(0),k.doc.height("");var t=Math.max(o.getElementsByTagName("html")[0].scrollHeight,o.body.scrollHeight);k.doc.height(t)}k.lazyResize(30),k.css(n(k.iframe.body),e),C.isios&&k.haswrapper&&k.css(n(o.body),{"-webkit-transform":"translate3d(0,0,0)"}),"contentWindow"in this?k.bind(this.contentWindow,"scroll",k.onscroll):k.bind(o,"scroll",k.onscroll),k.opt.enablemousewheel&&k.mousewheel(o,k.onmousewheel),k.opt.enablekeyboard&&k.bind(o,C.isopera?"keypress":"keydown",k.onkeypress),C.cantouch?(k.bind(o,"touchstart",k.ontouchstart),k.bind(o,"touchmove",k.ontouchmove)):k.opt.emulatetouch&&(k.bind(o,"mousedown",k.ontouchstart),k.bind(o,"mousemove",function(e){return k.ontouchmove(e,!0)}),k.opt.grabcursorenabled&&C.cursorgrabvalue&&k.css(n(o.body),{cursor:C.cursorgrabvalue})),k.bind(o,"mouseup",k.ontouchend),k.zoom&&(k.opt.dblclickzoom&&k.bind(o,"dblclick",k.doZoom),k.ongesturezoom&&k.bind(o,"gestureend",k.ongesturezoom))};this.doc[0].readyState&&"complete"===this.doc[0].readyState&&setTimeout(function(){N.call(k.doc[0],!1)},500),k.bind(this.doc,"load",N)}},this.showCursor=function(e,o){if(k.cursortimeout&&(clearTimeout(k.cursortimeout),k.cursortimeout=0),k.rail){if(k.autohidedom&&(k.autohidedom.stop().css({opacity:k.opt.cursoropacitymax}),k.cursoractive=!0),k.rail.drag&&1==k.rail.drag.pt||(void 0!==e&&!1!==e&&(k.scroll.y=e/k.scrollratio.y|0),void 0!==o&&(k.scroll.x=o/k.scrollratio.x|0)),k.cursor.css({height:k.cursorheight,top:k.scroll.y}),k.cursorh){var t=k.hasreversehr?k.scrollvaluemaxw-k.scroll.x:k.scroll.x;k.cursorh.css({width:k.cursorwidth,left:!k.rail.align&&k.rail.visibility?t+k.rail.width:t}),k.cursoractive=!0}k.zoom&&k.zoom.stop().css({opacity:k.opt.cursoropacitymax})}},this.hideCursor=function(e){k.cursortimeout||k.rail&&k.autohidedom&&(k.hasmousefocus&&"leave"===k.opt.autohidemode||(k.cursortimeout=setTimeout(function(){k.rail.active&&k.showonmouseevent||(k.autohidedom.stop().animate({opacity:k.opt.cursoropacitymin}),k.zoom&&k.zoom.stop().animate({opacity:k.opt.cursoropacitymin}),k.cursoractive=!1),k.cursortimeout=0},e||k.opt.hidecursordelay)))},this.noticeCursor=function(e,o,t){k.showCursor(o,t),k.rail.active||k.hideCursor(e)},this.getContentSize=k.ispage?function(){return{w:Math.max(l.body.scrollWidth,l.documentElement.scrollWidth),h:Math.max(l.body.scrollHeight,l.documentElement.scrollHeight)}}:k.haswrapper?function(){return{w:k.doc[0].offsetWidth,h:k.doc[0].offsetHeight}}:function(){return{w:k.docscroll[0].scrollWidth,h:k.docscroll[0].scrollHeight}},this.onResize=function(e,o){if(!k||!k.win)return!1;var t=k.page.maxh,r=k.page.maxw,i={h:k.view.h,w:k.view.w};if(k.view={w:k.ispage?k.win.width():k.win[0].clientWidth,h:k.ispage?k.win.height():k.win[0].clientHeight},k.page=o||k.getContentSize(),k.page.maxh=Math.max(0,k.page.h-k.view.h),k.page.maxw=Math.max(0,k.page.w-k.view.w),k.page.maxh==t&&k.page.maxw==r&&k.view.w==i.w&&k.view.h==i.h){if(k.ispage)return k;var s=k.win.offset();if(k.lastposition){var n=k.lastposition;if(n.top==s.top&&n.left==s.left)return k}k.lastposition=s}return 0===k.page.maxh?(k.hideRail(),k.scrollvaluemax=0,k.scroll.y=0,k.scrollratio.y=0,k.cursorheight=0,k.setScrollTop(0),k.rail&&(k.rail.scrollable=!1)):(k.page.maxh-=k.opt.railpadding.top+k.opt.railpadding.bottom,k.rail.scrollable=!0),0===k.page.maxw?(k.hideRailHr(),k.scrollvaluemaxw=0,k.scroll.x=0,k.scrollratio.x=0,k.cursorwidth=0,k.setScrollLeft(0),k.railh&&(k.railh.scrollable=!1)):(k.page.maxw-=k.opt.railpadding.left+k.opt.railpadding.right,k.railh&&(k.railh.scrollable=k.opt.horizrailenabled)),k.railslocked=k.locked||0===k.page.maxh&&0===k.page.maxw,k.railslocked?(k.ispage||k.updateScrollBar(k.view),!1):(k.hidden||k.visibility?!k.railh||k.hidden||k.railh.visibility||k.showRailHr():k.showRail().showRailHr(),k.istextarea&&k.win.css("resize")&&"none"!=k.win.css("resize")&&(k.view.h-=20),k.cursorheight=Math.min(k.view.h,Math.round(k.view.h*(k.view.h/k.page.h))),k.cursorheight=k.opt.cursorfixedheight?k.opt.cursorfixedheight:Math.max(k.opt.cursorminheight,k.cursorheight),k.cursorwidth=Math.min(k.view.w,Math.round(k.view.w*(k.view.w/k.page.w))),k.cursorwidth=k.opt.cursorfixedheight?k.opt.cursorfixedheight:Math.max(k.opt.cursorminheight,k.cursorwidth),k.scrollvaluemax=k.view.h-k.cursorheight-(k.opt.railpadding.top+k.opt.railpadding.bottom),k.hasborderbox||(k.scrollvaluemax-=k.cursor[0].offsetHeight-k.cursor[0].clientHeight),k.railh&&(k.railh.width=k.page.maxh>0?k.view.w-k.rail.width:k.view.w,k.scrollvaluemaxw=k.railh.width-k.cursorwidth-(k.opt.railpadding.left+k.opt.railpadding.right)),k.ispage||k.updateScrollBar(k.view),k.scrollratio={x:k.page.maxw/k.scrollvaluemaxw,y:k.page.maxh/k.scrollvaluemax},k.getScrollTop()>k.page.maxh?k.doScrollTop(k.page.maxh):(k.scroll.y=k.getScrollTop()/k.scrollratio.y|0,k.scroll.x=k.getScrollLeft()/k.scrollratio.x|0,k.cursoractive&&k.noticeCursor()),k.scroll.y&&0===k.getScrollTop()&&k.doScrollTo(Math.floor(k.scroll.y*k.scrollratio.y)),k)},this.resize=k.onResize,this.hlazyresize=0,this.lazyResize=function(e){return k.haswrapper||k.ispage||k.hide(),k.hlazyresize&&clearTimeout(k.hlazyresize),k.hlazyresize=setTimeout(function(){k&&(k.haswrapper||k.ispage||k.show(),k.resize())},240),k},this.jqbind=function(e,o,t){k.events.push({e:e,n:o,f:t,q:!0}),n(e).on(o,t)},this.mousewheel=function(e,o,t){var r="jquery"in e?e[0]:e;if("onwheel"in l.createElement("div"))k._bind(r,"wheel",o,t||!1);else{var i=void 0!==l.onmousewheel?"mousewheel":"DOMMouseScroll";x(r,i,o,t||!1),"DOMMouseScroll"==i&&x(r,"MozMousePixelScroll",o,t||!1)}};var _=!1;if(C.haseventlistener){try{var H=Object.defineProperty({},"passive",{get:function(){_=!0}});a.addEventListener("test",null,H)}catch(e){}this.cancelEvent=function(e){return!!e&&((e=e.original?e.original:e).cancelable&&e.preventDefault(),e.stopPropagation(),e.preventManipulation&&e.preventManipulation(),!1)},this.stopPropagation=function(e){return!!e&&((e=e.original?e.original:e).stopPropagation(),!1)}}else Event.prototype.preventDefault=function(){this.returnValue=!1},Event.prototype.stopPropagation=function(){this.cancelBubble=!0},a.constructor.prototype.addEventListener=l.constructor.prototype.addEventListener=Element.prototype.addEventListener=function(e,o,t){this.attachEvent("on"+e,o)},a.constructor.prototype.removeEventListener=l.constructor.prototype.removeEventListener=Element.prototype.removeEventListener=function(e,o,t){this.detachEvent("on"+e,o)},this.cancelEvent=function(e){return!!(e=e||a.event)&&(e.cancelBubble=!0,e.cancel=!0,e.returnValue=!1,!1)},this.stopPropagation=function(e){return(e=e||a.event)&&(e.cancelBubble=!0),!1};this.bind=function(e,o,t,r,i){var s="jquery"in e?e[0]:e;k._bind(s,o,t,r||!1,i||!1)},this._bind=function(e,o,t,r,i){k.events.push({e:e,n:o,f:t,b:r,q:!1}),_&&i?e.addEventListener(o,t,{passive:!1,capture:r}):e.addEventListener(o,t,r||!1)},this._unbind=function(e,o,t,r){e.removeEventListener(o,t,r)},this.unbindAll=function(){for(var e=0;e0)return t;o=!!o.parentNode&&o.parentNode}return!1},this.triggerScrollStart=function(e,o,t,r,i){if(k.onscrollstart){var s={type:"scrollstart",current:{x:e,y:o},request:{x:t,y:r},end:{x:k.newscrollx,y:k.newscrolly},speed:i};k.onscrollstart.call(k,s)}},this.triggerScrollEnd=function(){if(k.onscrollend){var e=k.getScrollLeft(),o=k.getScrollTop(),t={type:"scrollend",current:{x:e,y:o},end:{x:e,y:o}};k.onscrollend.call(k,t)}};var I=0,O=0,Y=0,B=1;if(this.onmousewheel=function(e){if(!k.wheelprevented){if(k.railslocked)return k.debounced("checkunlock",k.resize,250),!0;if(k.rail.drag)return k.cancelEvent(e);if("auto"===k.opt.oneaxismousemode&&0!==e.deltaX&&(k.opt.oneaxismousemode=!1),k.opt.oneaxismousemode&&0===e.deltaX&&!k.rail.scrollable)return!k.railh||!k.railh.scrollable||k.onmousewheelhr(e);var o=m(),t=!1;if(k.opt.preservenativescrolling&&k.checkarea+600k.page.maxh&&(o=k.page.maxh+(o-k.page.maxh)/2|0),e<0?e=e/2|0:e>k.page.maxw&&(e=k.page.maxw+(o-k.page.maxw)/2|0)):(o<0?o=0:o>k.page.maxh&&(o=k.page.maxh),e<0?e=0:e>k.page.maxw&&(e=k.page.maxw)),k.scrollrunning&&e==k.newscrollx&&o==k.newscrolly)return!1;k.newscrolly=o,k.newscrollx=e;var s=k.getScrollTop(),n=k.getScrollLeft(),l={};l.x=e-n,l.y=o-s;var a=0|Math.sqrt(l.x*l.x+l.y*l.y),c=k.prepareTransition(a);k.scrollrunning||(k.scrollrunning=!0,k.triggerScrollStart(n,s,e,o,c),k.cursorupdate.start()),k.scrollendtrapped=!0,C.transitionend||(k.scrollendtrapped&&clearTimeout(k.scrollendtrapped),k.scrollendtrapped=setTimeout(k.onScrollTransitionEnd,c)),k.setScrollTop(k.newscrolly),k.setScrollLeft(k.newscrollx)},this.cancelScroll=function(){if(!k.scrollendtrapped)return!0;var e=k.getScrollTop(),o=k.getScrollLeft();return k.scrollrunning=!1,C.transitionend||clearTimeout(C.transitionend),k.scrollendtrapped=!1,k.resetTransition(),k.setScrollTop(e),k.railh&&k.setScrollLeft(o),k.timerscroll&&k.timerscroll.tm&&clearInterval(k.timerscroll.tm),k.timerscroll=!1,k.cursorfreezed=!1,k.cursorupdate.stop(),k.showCursor(e,o),k},this.onScrollTransitionEnd=function(){if(k.scrollendtrapped){var e=k.getScrollTop(),o=k.getScrollLeft();if(e<0?e=0:e>k.page.maxh&&(e=k.page.maxh),o<0?o=0:o>k.page.maxw&&(o=k.page.maxw),e!=k.newscrolly||o!=k.newscrollx)return k.doScrollPos(o,e,k.opt.snapbackspeed);k.scrollrunning&&k.triggerScrollEnd(),k.scrollrunning=!1,k.scrollendtrapped=!1,k.resetTransition(),k.timerscroll=!1,k.setScrollTop(e),k.railh&&k.setScrollLeft(o),k.cursorupdate.stop(),k.noticeCursor(!1,e,o),k.cursorfreezed=!1}}}else this.doScrollLeft=function(e,o){var t=k.scrollrunning?k.newscrolly:k.getScrollTop();k.doScrollPos(e,t,o)},this.doScrollTop=function(e,o){var t=k.scrollrunning?k.newscrollx:k.getScrollLeft();k.doScrollPos(t,e,o)},this.doScrollPos=function(e,o,t){var r=k.getScrollTop(),i=k.getScrollLeft();((k.newscrolly-r)*(o-r)<0||(k.newscrollx-i)*(e-i)<0)&&k.cancelScroll();var s=!1;if(k.bouncescroll&&k.rail.visibility||(o<0?(o=0,s=!0):o>k.page.maxh&&(o=k.page.maxh,s=!0)),k.bouncescroll&&k.railh.visibility||(e<0?(e=0,s=!0):e>k.page.maxw&&(e=k.page.maxw,s=!0)),k.scrollrunning&&k.newscrolly===o&&k.newscrollx===e)return!0;k.newscrolly=o,k.newscrollx=e,k.dst={},k.dst.x=e-i,k.dst.y=o-r,k.dst.px=i,k.dst.py=r;var n=0|Math.sqrt(k.dst.x*k.dst.x+k.dst.y*k.dst.y),l=k.getTransitionSpeed(n);k.bzscroll={},s?(k.bzscroll.x=new N(i,k.newscrollx,l,0,0,1,1),k.bzscroll.y=new N(r,k.newscrolly,l,0,0,1,1)):(k.bzscroll.x=new N(i,k.newscrollx,l,0,0,.58,1),k.bzscroll.y=new N(r,k.newscrolly,l,0,0,.58,1));var a=function(){if(k.scrollrunning){var e=k.bzscroll.y.getPos();k.setScrollLeft(k.bzscroll.x.getNow()),k.setScrollTop(k.bzscroll.y.getNow()),e<=1?d(a):(k.scrollrunning=!1,k.timer=0,k.triggerScrollEnd())}};k.scrollrunning||(k.triggerScrollStart(i,r,e,o,l),k.scrollrunning=!0,k.timer=d(a))},this.cancelScroll=function(){return k.timer&&u(k.timer),k.timer=0,k.bzscroll=!1,k.scrollrunning=!1,k};else this.doScrollLeft=function(e,o){var t=k.getScrollTop();k.doScrollPos(e,t,o)},this.doScrollTop=function(e,o){var t=k.getScrollLeft();k.doScrollPos(t,e,o)},this.doScrollPos=function(e,o,t){var r=e>k.page.maxw?k.page.maxw:e;r<0&&(r=0);var i=o>k.page.maxh?k.page.maxh:o;i<0&&(i=0),k.synched("scroll",function(){k.setScrollTop(i),k.setScrollLeft(r)})},this.cancelScroll=function(){};this.doScrollBy=function(e,o){S(0,e)},this.doScrollLeftBy=function(e,o){S(e,0)},this.doScrollTo=function(e,o){var t=o?Math.round(e*k.scrollratio.y):e;t<0?t=0:t>k.page.maxh&&(t=k.page.maxh),k.cursorfreezed=!1,k.doScrollTop(e)},this.checkContentSize=function(){var e=k.getContentSize();e.h==k.page.h&&e.w==k.page.w||k.resize(!1,e)},k.onscroll=function(e){k.rail.drag||k.cursorfreezed||k.synched("scroll",function(){k.scroll.y=Math.round(k.getScrollTop()/k.scrollratio.y),k.railh&&(k.scroll.x=Math.round(k.getScrollLeft()/k.scrollratio.x)),k.noticeCursor()})},k.bind(k.docscroll,"scroll",k.onscroll),this.doZoomIn=function(e){if(!k.zoomactive){k.zoomactive=!0,k.zoomrestore={style:{}};var o=["position","top","left","zIndex","backgroundColor","marginTop","marginBottom","marginLeft","marginRight"],t=k.win[0].style;for(var r in o){var i=o[r];k.zoomrestore.style[i]=void 0!==t[i]?t[i]:""}k.zoomrestore.style.width=k.win.css("width"),k.zoomrestore.style.height=k.win.css("height"),k.zoomrestore.padding={w:k.win.outerWidth()-k.win.width(),h:k.win.outerHeight()-k.win.height()},C.isios4&&(k.zoomrestore.scrollTop=c.scrollTop(),c.scrollTop(0)),k.win.css({position:C.isios4?"absolute":"fixed",top:0,left:0,zIndex:s+100,margin:0});var n=k.win.css("backgroundColor");return(""===n||/transparent|rgba\(0, 0, 0, 0\)|rgba\(0,0,0,0\)/.test(n))&&k.win.css("backgroundColor","#fff"),k.rail.css({zIndex:s+101}),k.zoom.css({zIndex:s+102}),k.zoom.css("backgroundPosition","0 -18px"),k.resizeZoom(),k.onzoomin&&k.onzoomin.call(k),k.cancelEvent(e)}},this.doZoomOut=function(e){if(k.zoomactive)return k.zoomactive=!1,k.win.css("margin",""),k.win.css(k.zoomrestore.style),C.isios4&&c.scrollTop(k.zoomrestore.scrollTop),k.rail.css({"z-index":k.zindex}),k.zoom.css({"z-index":k.zindex}),k.zoomrestore=!1,k.zoom.css("backgroundPosition","0 0"),k.onResize(),k.onzoomout&&k.onzoomout.call(k),k.cancelEvent(e)},this.doZoom=function(e){return k.zoomactive?k.doZoomOut(e):k.doZoomIn(e)},this.resizeZoom=function(){if(k.zoomactive){var e=k.getScrollTop();k.win.css({width:c.width()-k.zoomrestore.padding.w+"px",height:c.height()-k.zoomrestore.padding.h+"px"}),k.onResize(),k.setScrollTop(Math.min(k.page.maxh,e))}},this.init(),n.nicescroll.push(this)},b=function(e){var o=this;this.nc=e,this.lastx=0,this.lasty=0,this.speedx=0,this.speedy=0,this.lasttime=0,this.steptime=0,this.snapx=!1,this.snapy=!1,this.demulx=0,this.demuly=0,this.lastscrollx=-1,this.lastscrolly=-1,this.chkx=0,this.chky=0,this.timer=0,this.reset=function(e,t){o.stop(),o.steptime=0,o.lasttime=m(),o.speedx=0,o.speedy=0,o.lastx=e,o.lasty=t,o.lastscrollx=-1,o.lastscrolly=-1},this.update=function(e,t){var r=m();o.steptime=r-o.lasttime,o.lasttime=r;var i=t-o.lasty,s=e-o.lastx,n=o.nc.getScrollTop()+i,l=o.nc.getScrollLeft()+s;o.snapx=l<0||l>o.nc.page.maxw,o.snapy=n<0||n>o.nc.page.maxh,o.speedx=s,o.speedy=i,o.lastx=e,o.lasty=t},this.stop=function(){o.nc.unsynched("domomentum2d"),o.timer&&clearTimeout(o.timer),o.timer=0,o.lastscrollx=-1,o.lastscrolly=-1},this.doSnapy=function(e,t){var r=!1;t<0?(t=0,r=!0):t>o.nc.page.maxh&&(t=o.nc.page.maxh,r=!0),e<0?(e=0,r=!0):e>o.nc.page.maxw&&(e=o.nc.page.maxw,r=!0),r?o.nc.doScrollPos(e,t,o.nc.opt.snapbackspeed):o.nc.triggerScrollEnd()},this.doMomentum=function(e){var t=m(),r=e?t+e:o.lasttime,i=o.nc.getScrollLeft(),s=o.nc.getScrollTop(),n=o.nc.page.maxh,l=o.nc.page.maxw;o.speedx=l>0?Math.min(60,o.speedx):0,o.speedy=n>0?Math.min(60,o.speedy):0;var a=r&&t-r<=60;(s<0||s>n||i<0||i>l)&&(a=!1);var c=!(!o.speedy||!a)&&o.speedy,d=!(!o.speedx||!a)&&o.speedx;if(c||d){var u=Math.max(16,o.steptime);if(u>50){var h=u/50;o.speedx*=h,o.speedy*=h,u=50}o.demulxy=0,o.lastscrollx=o.nc.getScrollLeft(),o.chkx=o.lastscrollx,o.lastscrolly=o.nc.getScrollTop(),o.chky=o.lastscrolly;var p=o.lastscrollx,f=o.lastscrolly,g=function(){var e=m()-t>600?.04:.02;o.speedx&&(p=Math.floor(o.lastscrollx-o.speedx*(1-o.demulxy)),o.lastscrollx=p,(p<0||p>l)&&(e=.1)),o.speedy&&(f=Math.floor(o.lastscrolly-o.speedy*(1-o.demulxy)),o.lastscrolly=f,(f<0||f>n)&&(e=.1)),o.demulxy=Math.min(1,o.demulxy+e),o.nc.synched("domomentum2d",function(){if(o.speedx){o.nc.getScrollLeft();o.chkx=p,o.nc.setScrollLeft(p)}if(o.speedy){o.nc.getScrollTop();o.chky=f,o.nc.setScrollTop(f)}o.timer||(o.nc.hideCursor(),o.doSnapy(p,f))}),o.demulxy<1?o.timer=setTimeout(g,u):(o.stop(),o.nc.hideCursor(),o.doSnapy(p,f))};g()}else o.doSnapy(o.nc.getScrollLeft(),o.nc.getScrollTop())}},y=e.fn.scrollTop;e.cssHooks.pageYOffset={get:function(e,o,t){var r=n.data(e,"__nicescroll")||!1;return r&&r.ishwscroll?r.getScrollTop():y.call(e)},set:function(e,o){var t=n.data(e,"__nicescroll")||!1;return t&&t.ishwscroll?t.setScrollTop(parseInt(o)):y.call(e,o),this}},e.fn.scrollTop=function(e){if(void 0===e){var o=!!this[0]&&(n.data(this[0],"__nicescroll")||!1);return o&&o.ishwscroll?o.getScrollTop():y.call(this)}return this.each(function(){var o=n.data(this,"__nicescroll")||!1;o&&o.ishwscroll?o.setScrollTop(parseInt(e)):y.call(n(this),e)})};var x=e.fn.scrollLeft;n.cssHooks.pageXOffset={get:function(e,o,t){var r=n.data(e,"__nicescroll")||!1;return r&&r.ishwscroll?r.getScrollLeft():x.call(e)},set:function(e,o){var t=n.data(e,"__nicescroll")||!1;return t&&t.ishwscroll?t.setScrollLeft(parseInt(o)):x.call(e,o),this}},e.fn.scrollLeft=function(e){if(void 0===e){var o=!!this[0]&&(n.data(this[0],"__nicescroll")||!1);return o&&o.ishwscroll?o.getScrollLeft():x.call(this)}return this.each(function(){var o=n.data(this,"__nicescroll")||!1;o&&o.ishwscroll?o.setScrollLeft(parseInt(e)):x.call(n(this),e)})};var S=function(e){var o=this;if(this.length=0,this.name="nicescrollarray",this.each=function(e){return n.each(o,e),o},this.push=function(e){o[o.length]=e,o.length++},this.eq=function(e){return o[e]},e)for(var t=0;t1?n(e,r):s,i.win=r}!("doc"in i)||"win"in i||(i.win=r);var l=r.data("__nicescroll")||!1;l||(i.doc=i.doc||r,l=new w(i,r),r.data("__nicescroll",l)),t.push(l)}),1===t.length?t[0]:t},a.NiceScroll={getjQuery:function(){return e}},n.nicescroll||(n.nicescroll=new S,n.nicescroll.options=f)}); \ No newline at end of file diff --git a/package.json b/package.json deleted file mode 100644 index f186c6d..0000000 --- a/package.json +++ /dev/null @@ -1,82 +0,0 @@ -{ - "name": "nicescroll", - "version": "3.7.3", - "bugs": "https://github.com/inuyaksa/jquery.nicescroll/issues", - "repository": { - "type": "git", - "url": "git@github.com:inuyaksa/jquery.nicescroll.git" - }, - "title": "jQuery.NiceScroll", - "author": { - "name": "InuYaksa", - "url": "https://github.com/inuyaksa" - }, - "license": "MIT", - "autoupdate": { - "source": "git", - "target": "git://github.com/inuyaksa/jquery.nicescroll.git", - "basePath": "dist", - "files": [ - "**/*" - ] - }, - "description": "Nicescroll is a jquery plugin, for nice customizabled scrollbars with a very similar ios/mobile style. It supports DIVs, IFrames and document page (body) scrollbars. Compatible with modern browsers Chrome/Firefox/Edge/Safari/Opera for smartphone ios/android and desktop pc/mac: iphone/ipad/ipod, android, surface, pc (chrome/firefox) mac (safari/chrome). Compatibile with older browers too, such as IE11/10/9, some limitations could exists.", - "keywords": [ - "nicescroll", - "jquery", - "jquery-plugin", - "ecosystem:jquery", - "interface", - "window", - "dom", - "div", - "scroll", - "ios", - "mobile", - "desktop", - "scrollbar", - "touch", - "android", - "chrome", - "firefox", - "safari", - "surface", - "edge" - ], - "homepage": "https://github.com/inuyaksa/jquery.nicescroll", - "contributors": [ - "inuyaksa", - "GianlucaGuarini", - "nkovacs", - "zcourts", - "philleepflorence", - "gustavnikolaj", - "laychopy", - "barraq", - "efoxbr", - "hypesystem", - "schweighart", - "ephigabay", - "shinnn", - "TNKSoftware" - ], - "files": [ - "dist/jquery.nicescroll.js", - "dist/jquery.nicescroll.min.js", - "dist/zoomico.png" - ], - "main": "jquery.nicescroll.js", - "dependencies": { - "jquery": ">=1.8.3" - }, - "npmName": "nicescroll", - "npmFileMap": [ - { - "basePath": "/dist/", - "files": [ - "*.js", - "zoomico.png" - ] - } - ] -} From 2b5bc037db6d0afb96791fc572198d4c9caa74bf Mon Sep 17 00:00:00 2001 From: InuYaksa Date: Tue, 27 Jun 2017 22:59:27 +0200 Subject: [PATCH 02/14] RC1 scrolling routines rewritten, extremely smooth and responsive scrolling ever, please test on your testing environments --- ONLY_FOR_DEVELOPERS.md | 4 ++++ README.md | 9 +++++++++ changelog_3.7.4.txt | 2 +- jquery.nicescroll.iframehelper.min.js | 2 +- jquery.nicescroll.js | 2 +- jquery.nicescroll.min.js | 2 +- 6 files changed, 17 insertions(+), 4 deletions(-) create mode 100644 ONLY_FOR_DEVELOPERS.md diff --git a/ONLY_FOR_DEVELOPERS.md b/ONLY_FOR_DEVELOPERS.md new file mode 100644 index 0000000..8af4140 --- /dev/null +++ b/ONLY_FOR_DEVELOPERS.md @@ -0,0 +1,4 @@ +# jQuery.NiceScroll +THIS RELEASE IS FOR DEVELOPERS ONLY + +For stable releases go to https://github.com/inuyaksa/jquery.nicescroll diff --git a/README.md b/README.md index 6845f16..57655a4 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,15 @@ v. 3.7.4 [[ DEVELOPER RELEASE ]] == this is a testing releasing, not suitable for production == + + +>Notes for testers: + - scrolling routines rewritten, extremely smooth and responsive scrolling ever, please test on your testing environments + - Surface touchpad experiment, please let me know if works + + + + - [Web Site: nicescroll.areaaperta.com](https://nicescroll.areaaperta.com) - [Repo: github.com/inuyaksa/jquery.nicescroll](https://github.com/inuyaksa/jquery.nicescroll) - [Twitter: @nicescroll](https://twitter.com/nicescroll) diff --git a/changelog_3.7.4.txt b/changelog_3.7.4.txt index 54ef7e5..5ecc1cd 100644 --- a/changelog_3.7.4.txt +++ b/changelog_3.7.4.txt @@ -1,4 +1,4 @@ -Changelog nicescroll release 3.7.4 +Changelog nicescroll release 3.7.4 [[ DEVELOPER RELEASE ]] https://nicescroll.areaaperta.com/ https://github.com/inuyaksa/jquery.nicescroll diff --git a/jquery.nicescroll.iframehelper.min.js b/jquery.nicescroll.iframehelper.min.js index 89e3b74..ba0d9de 100644 --- a/jquery.nicescroll.iframehelper.min.js +++ b/jquery.nicescroll.iframehelper.min.js @@ -1,2 +1,2 @@ -/* iframe helper for nicescroll v3.7.4 InuYaksa - MIT - https://nicescroll.areaaperta.com */ +/* iframe helper for nicescroll v3.7.4-c [DEV REL] InuYaksa - MIT - https://nicescroll.areaaperta.com */ !function(e,t){function n(t){var n=e.createEvent("MouseEvents");n.initEvent("wheel",!0,!0),n.deltaMode=t.deltaMode,n.deltaX=t.deltaX,n.deltaY=t.deltaY,n.deltaZ=t.deltaZ,n.wheelDelta=t.wheelDelta,n.wheelDeltaX=t.wheelDeltaX,n.wheelDeltaY=t.wheelDeltaY,o.dispatchEvent(n)}function l(e){do{if(void 0!==$.data(e,"__nicescroll"))return e;e=e.parentNode||!1}while(e);return!1}var a=e.body,o=t.parent;if(o&&"createEvent"in e){a.addEventListener("wheel",n)}if(t.addEventListener){var r=function(){var t=e.createElement("style");return t.appendChild(e.createTextNode("")),e.head.appendChild(t),t.sheet}(),d=null,i=null,c=[];t.addEventListener("scroll",function(e){i&&t.scrollTo(c[0],c[1])}),t.addEventListener("load",function(){var e=!1;$.nicescroll.each(function(){var t=this;t.scrollstart(function(){console.log("start"),e||r.insertRule("iframe { pointer-events: none !important; }",0),e=!0}),t.scrollend(function(){console.log("end"),e&&r.deleteRule(0),e=!1})}),$("iframe").each(function(){this.addEventListener("mouseenter",function(e){var n=l(d=e.target);i=n,c=[t.scrollX,t.scrollY]}),this.addEventListener("mouseleave",function(e){d=i=null})})})}}(document,window); \ No newline at end of file diff --git a/jquery.nicescroll.js b/jquery.nicescroll.js index d048c52..59a4e62 100644 --- a/jquery.nicescroll.js +++ b/jquery.nicescroll.js @@ -1,5 +1,5 @@ /* jquery.nicescroll --- version 3.7.4-c +-- version 3.7.4-c [DEV REL] -- copyright 2017-06-18 InuYaksa*2017 -- licensed under the MIT -- diff --git a/jquery.nicescroll.min.js b/jquery.nicescroll.min.js index 70b44d7..ed405ed 100644 --- a/jquery.nicescroll.min.js +++ b/jquery.nicescroll.min.js @@ -1,2 +1,2 @@ -/* nicescroll v3.7.4 InuYaksa - MIT - https://nicescroll.areaaperta.com */ +/* nicescroll v3.7.4-c [DEV REL] InuYaksa - MIT - https://nicescroll.areaaperta.com */ !function(e){"function"==typeof define&&define.amd?define(["jquery"],e):"object"==typeof exports?module.exports=e(require("jquery")):e(jQuery)}(function(e){"use strict";var o=!1,t=!1,r=0,i=2e3,s=0,n=e,l=document,a=window,c=n(a),d=a.requestAnimationFrame||a.webkitRequestAnimationFrame||a.mozRequestAnimationFrame||!1,u=a.cancelAnimationFrame||a.webkitCancelAnimationFrame||a.mozCancelAnimationFrame||!1;if(d)a.cancelAnimationFrame||(u=function(e){});else{var h=0;d=function(e,o){var t=(new Date).getTime(),r=Math.max(0,16-(t-h)),i=a.setTimeout(function(){e(t+r)},r);return h=t+r,i},u=function(e){a.clearTimeout(e)}}var p=a.MutationObserver||a.WebKitMutationObserver||!1,m=Date.now||function(){return(new Date).getTime()},f={zindex:"auto",cursoropacitymin:0,cursoropacitymax:1,cursorcolor:"#424242",cursorwidth:"6px",cursorborder:"1px solid #fff",cursorborderradius:"5px",scrollspeed:40,mousescrollstep:24,touchbehavior:!1,emulatetouch:!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 e=l.currentScript||function(){var e=l.getElementsByTagName("script");return!!e.length&&e[e.length-1]}(),o=e?e.src.split("?")[0]:"";return o.split("/").length>0?o.split("/").slice(0,-1).join("/")+"/":""}(),preventmultitouchscrolling:!0,disablemutationobserver:!1,enableobserver:!0,scrollbarid:!1},g=!1,v=function(){if(g)return g;var e=l.createElement("DIV"),o=e.style,t=navigator.userAgent,r=navigator.platform,i={};return i.haspointerlock="pointerLockElement"in l||"webkitPointerLockElement"in l||"mozPointerLockElement"in l,i.isopera="opera"in a,i.isopera12=i.isopera&&"getUserMedia"in navigator,i.isoperamini="[object OperaMini]"===Object.prototype.toString.call(a.operamini),i.isie="all"in l&&"attachEvent"in e&&!i.isopera,i.isieold=i.isie&&!("msInterpolationMode"in o),i.isie7=i.isie&&!i.isieold&&(!("documentMode"in l)||7===l.documentMode),i.isie8=i.isie&&"documentMode"in l&&8===l.documentMode,i.isie9=i.isie&&"performance"in a&&9===l.documentMode,i.isie10=i.isie&&"performance"in a&&10===l.documentMode,i.isie11="msRequestFullscreen"in e&&l.documentMode>=11,i.ismsedge="msCredentials"in a,i.ismozilla="MozAppearance"in o,i.iswebkit=!i.ismsedge&&"WebkitAppearance"in o,i.ischrome=i.iswebkit&&"chrome"in a,i.ischrome38=i.ischrome&&"touchAction"in o,i.ischrome22=!i.ischrome38&&i.ischrome&&i.haspointerlock,i.ischrome26=!i.ischrome38&&i.ischrome&&"transition"in o,i.cantouch="ontouchstart"in l.documentElement||"ontouchstart"in a,i.hasw3ctouch=(a.PointerEvent||!1)&&(navigator.MaxTouchPoints>0||navigator.msMaxTouchPoints>0),i.hasmstouch=!i.hasw3ctouch&&(a.MSPointerEvent||!1),i.ismac=/^mac$/i.test(r),i.isios=i.cantouch&&/iphone|ipad|ipod/i.test(r),i.isios4=i.isios&&!("seal"in Object),i.isios7=i.isios&&"webkitHidden"in l,i.isios8=i.isios&&"hidden"in l,i.isios10=i.isios&&a.Proxy,i.isandroid=/android/i.test(t),i.haseventlistener="addEventListener"in e,i.trstyle=!1,i.hastransform=!1,i.hastranslate3d=!1,i.transitionstyle=!1,i.hastransition=!1,i.transitionend=!1,i.trstyle="transform",i.hastransform="transform"in o||function(){for(var e=["msTransform","webkitTransform","MozTransform","OTransform"],t=0,r=e.length;t0;){if(9==e[0].nodeType)return!1;var o=e.css("zIndex");if(!isNaN(o)&&0!==o)return parseInt(o);e=e.parent()}return!1}function y(e,o,t){var r=e.css(o),i=parseFloat(r);if(isNaN(i)){var s=3==(i=R[r]||0)?t?k.win.outerHeight()-k.win.innerHeight():k.win.outerWidth()-k.win.innerWidth():1;return k.isie8&&i&&(i+=1),s?i:0}return i}function x(e,o,t,r){k._bind(e,o,function(r){var i={original:r=r||a.event,target:r.target||r.srcElement,type:"wheel",deltaMode:"MozMousePixelScroll"==r.type?0:1,deltaX:0,deltaZ:0,preventDefault:function(){return r.preventDefault?r.preventDefault():r.returnValue=!1,!1},stopImmediatePropagation:function(){r.stopImmediatePropagation?r.stopImmediatePropagation():r.cancelBubble=!0}};return"mousewheel"==o?(r.wheelDeltaX&&(i.deltaX=-.025*r.wheelDeltaX),r.wheelDeltaY&&(i.deltaY=-.025*r.wheelDeltaY),!i.deltaY&&!i.deltaX&&(i.deltaY=-.025*r.wheelDelta)):i.deltaY=r.detail,t.call(e,i)},r)}function S(e,o,t,r){k.scrollrunning||(k.newscrolly=k.getScrollTop(),k.newscrollx=k.getScrollLeft(),Y=m());var i=m()-Y;if(Y=m(),i>350?B=1:B+=(2-B)/10,e=e*B|0,o=o*B|0,e){if(r)if(e<0){if(k.getScrollLeft()>=k.page.maxw)return!0}else if(k.getScrollLeft()<=0)return!0;var s=e>0?1:-1;O!==s&&(k.scrollmom&&k.scrollmom.stop(),k.newscrollx=k.getScrollLeft(),O=s),k.lastdeltax-=e}if(o){if(function(){var e=k.getScrollTop();if(o<0){if(e>=k.page.maxh)return!0}else if(e<=0)return!0}()){if(!k.scrollrunning&&k.opt.nativeparentscrolling&&t&&!k.ispage&&!k.zoomactive)return!0;var n=k.view.h>>1;k.newscrolly<-n?(k.newscrolly=-n,o=-1):k.newscrolly>k.page.maxh+n?(k.newscrolly=k.page.maxh+n,o=1):o=0}var l=o>0?1:-1;I!==l&&(k.scrollmom&&k.scrollmom.stop(),k.newscrolly=k.getScrollTop(),I=l),k.lastdeltay-=o}(o||e)&&k.synched("relativexy",function(){var e=k.lastdeltay+k.newscrolly;k.lastdeltay=0;var o=k.lastdeltax+k.newscrollx;k.lastdeltax=0,k.rail.drag||k.doScrollPos(o,e)})}function z(e,o,t){var r,i;return 0===e.deltaMode?(r=-e.deltaX*(k.opt.mousescrollstep/54)|0,i=-e.deltaY*(k.opt.mousescrollstep/54)|0):1===e.deltaMode&&(r=-e.deltaX*k.opt.mousescrollstep|0,i=-e.deltaY*k.opt.mousescrollstep|0),o&&k.opt.oneaxismousemode&&0===r&&i&&(r=i,i=0,t&&(r<0?k.getScrollLeft()>=k.page.maxw:k.getScrollLeft()<=0)&&(i=r,r=0)),k.isrtlmode&&(r=-r),S(r,i,t,!0),e.stopImmediatePropagation(),e.preventDefault()}var k=this;this.version="3.7.4-c",this.name="nicescroll",this.me=h;var T=n("body");if(this.opt={doc:T,win:!1},n.extend(this.opt,f),this.opt.snapbackspeed=80,e)for(var E in k.opt)void 0!==e[E]&&(k.opt[E]=e[E]);if(k.opt.disablemutationobserver&&(p=!1),this.doc=k.opt.doc,this.iddoc=this.doc&&this.doc[0]?this.doc[0].id||"":"",this.ispage=/^BODY|HTML/.test(k.opt.win?k.opt.win[0].nodeName:this.doc[0].nodeName),this.haswrapper=!1!==k.opt.win,this.win=k.opt.win||(this.ispage?c:this.doc),this.docscroll=this.ispage&&!this.haswrapper?c:this.win,this.body=T,this.viewport=!1,this.isfixed=!1,this.iframe=!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"!=k.opt.autohidemode,this.onmousedown=!1,this.onmouseup=!1,this.onmousemove=!1,this.onmousewheel=!1,this.onkeypress=!1,this.ongesturezoom=!1,this.onclick=!1,this.onscrollstart=!1,this.onscrollend=!1,this.onscrollcancel=!1,this.onzoomin=!1,this.onzoomout=!1,this.view=!1,this.page=!1,this.scroll={x:0,y:0},this.scrollratio={x:0,y:0},this.cursorheight=20,this.scrollvaluemax=0,"auto"==this.opt.rtlmode){var M=this.win[0]==a?this.body:this.win,L=M.css("writing-mode")||M.css("-webkit-writing-mode")||M.css("-ms-writing-mode")||M.css("-moz-writing-mode");"horizontal-tb"==L||"lr-tb"==L||""===L?(this.isrtlmode="rtl"==M.css("direction"),this.isvertical=!1):(this.isrtlmode="vertical-rl"==L||"tb"==L||"tb-rl"==L||"rl-tb"==L,this.isvertical="vertical-rl"==L||"tb"==L||"tb-rl"==L)}else this.isrtlmode=!0===this.opt.rtlmode,this.isvertical=!1;if(this.scrollrunning=!1,this.scrollmom=!1,this.observer=!1,this.observerremover=!1,this.observerbody=!1,!1===k.opt.scrollbarid)do{this.id="ascrail"+i++}while(l.getElementById(this.id));else this.id=k.opt.scrollbarid;this.rail=!1,this.cursor=!1,this.cursorfreezed=!1,this.selectiondrag=!1,this.zoom=!1,this.zoomactive=!1,this.hasfocus=!1,this.hasmousefocus=!1,this.visibility=!0,this.railslocked=!1,this.locked=!1,this.hidden=!1,this.cursoractive=!0,this.wheelprevented=!1,this.overflowx=k.opt.overflowx,this.overflowy=k.opt.overflowy,this.nativescrollingarea=!1,this.checkarea=0,this.events=[],this.saved={},this.delaylist={},this.synclist={},this.lastdeltax=0,this.lastdeltay=0,this.detected=v();var C=n.extend({},this.detected);this.canhwscroll=C.hastransform&&k.opt.hwacceleration,this.ishwscroll=this.canhwscroll&&k.haswrapper,this.isrtlmode?this.isvertical?this.hasreversehr=!(C.iswebkit||C.isie||C.isie11):this.hasreversehr=!(C.iswebkit||C.isie&&!C.isie10&&!C.isie11):this.hasreversehr=!1,this.istouchcapable=!1,C.cantouch||!C.hasw3ctouch&&!C.hasmstouch?!C.cantouch||C.isios||C.isandroid||!C.iswebkit&&!C.ismozilla||(this.istouchcapable=!0):this.istouchcapable=!0,k.opt.enablemouselockapi||(C.hasmousecapture=!1,C.haspointerlock=!1),this.debounced=function(e,o,t){k&&(k.delaylist[e]||!1||(k.delaylist[e]={h:d(function(){k.delaylist[e].fn.call(k),k.delaylist[e]=!1},t)},o.call(k)),k.delaylist[e].fn=o)},this.synched=function(e,o){k.synclist[e]?k.synclist[e]=o:(k.synclist[e]=o,d(function(){k&&(k.synclist[e]&&k.synclist[e].call(k),k.synclist[e]=null)}))},this.unsynched=function(e){k.synclist[e]&&(k.synclist[e]=!1)},this.css=function(e,o){for(var t in o)k.saved.css.push([e,t,e.css(t)]),e.css(t,o[t])},this.scrollTop=function(e){return void 0===e?k.getScrollTop():k.setScrollTop(e)},this.scrollLeft=function(e){return void 0===e?k.getScrollLeft():k.setScrollLeft(e)};var N=function(e,o,t,r,i,s,n){this.st=e,this.ed=o,this.spd=t,this.p1=r||0,this.p2=i||1,this.p3=s||0,this.p4=n||1,this.ts=m(),this.df=o-e};if(N.prototype={B2:function(e){return 3*e*e*(1-e)},B3:function(e){return 3*e*(1-e)*(1-e)},B4:function(e){return(1-e)*(1-e)*(1-e)},getPos:function(){return(m()-this.ts)/this.spd},getNow:function(){var e=1-(m()-this.ts)/this.spd,o=this.B2(e)+this.B3(e)+this.B4(e);return e<0?this.ed:this.st+this.df*o|0},update:function(e,o){return this.st=this.getNow(),this.ed=e,this.spd=o,this.ts=m(),this.df=this.ed-this.st,this}},this.ishwscroll){this.doc.translate={x:0,y:0,tx:"0px",ty:"0px"},C.hastranslate3d&&C.isios&&this.doc.css("-webkit-backface-visibility","hidden"),this.getScrollTop=function(e){if(!e){var o=g();if(o)return 16==o.length?-o[13]:-o[5];if(k.timerscroll&&k.timerscroll.bz)return k.timerscroll.bz.getNow()}return k.doc.translate.y},this.getScrollLeft=function(e){if(!e){var o=g();if(o)return 16==o.length?-o[12]:-o[4];if(k.timerscroll&&k.timerscroll.bh)return k.timerscroll.bh.getNow()}return k.doc.translate.x},this.notifyScrollEvent=function(e){var o=l.createEvent("UIEvents");o.initUIEvent("scroll",!1,!0,a,1),o.niceevent=!0,e.dispatchEvent(o)};var P=this.isrtlmode?1:-1;C.hastranslate3d&&k.opt.enabletranslate3d?(this.setScrollTop=function(e,o){k.doc.translate.y=e,k.doc.translate.ty=-1*e+"px",k.doc.css(C.trstyle,"translate3d("+k.doc.translate.tx+","+k.doc.translate.ty+",0)"),o||k.notifyScrollEvent(k.win[0])},this.setScrollLeft=function(e,o){k.doc.translate.x=e,k.doc.translate.tx=e*P+"px",k.doc.css(C.trstyle,"translate3d("+k.doc.translate.tx+","+k.doc.translate.ty+",0)"),o||k.notifyScrollEvent(k.win[0])}):(this.setScrollTop=function(e,o){k.doc.translate.y=e,k.doc.translate.ty=-1*e+"px",k.doc.css(C.trstyle,"translate("+k.doc.translate.tx+","+k.doc.translate.ty+")"),o||k.notifyScrollEvent(k.win[0])},this.setScrollLeft=function(e,o){k.doc.translate.x=e,k.doc.translate.tx=e*P+"px",k.doc.css(C.trstyle,"translate("+k.doc.translate.tx+","+k.doc.translate.ty+")"),o||k.notifyScrollEvent(k.win[0])})}else this.getScrollTop=function(){return k.docscroll.scrollTop()},this.setScrollTop=function(e){k.docscroll.scrollTop(e)},this.getScrollLeft=function(){return k.hasreversehr?k.detected.ismozilla?k.page.maxw-Math.abs(k.docscroll.scrollLeft()):k.page.maxw-k.docscroll.scrollLeft():k.docscroll.scrollLeft()},this.setScrollLeft=function(e){return setTimeout(function(){if(k)return k.hasreversehr&&(e=k.detected.ismozilla?-(k.page.maxw-e):k.page.maxw-e),k.docscroll.scrollLeft(e)},1)};this.getTarget=function(e){return!!e&&(e.target?e.target:!!e.srcElement&&e.srcElement)},this.hasParent=function(e,o){if(!e)return!1;for(var t=e.target||e.srcElement||e||!1;t&&t.id!=o;)t=t.parentNode||!1;return!1!==t};var R={thin:1,medium:3,thick:5};this.getDocumentScrollOffset=function(){return{top:a.pageYOffset||l.documentElement.scrollTop,left:a.pageXOffset||l.documentElement.scrollLeft}},this.getOffset=function(){if(k.isfixed){var e=k.win.offset(),o=k.getDocumentScrollOffset();return e.top-=o.top,e.left-=o.left,e}var t=k.win.offset();if(!k.viewport)return t;var r=k.viewport.offset();return{top:t.top-r.top,left:t.left-r.left}},this.updateScrollBar=function(e){var o,t;if(k.ishwscroll)k.rail.css({height:k.win.innerHeight()-(k.opt.railpadding.top+k.opt.railpadding.bottom)}),k.railh&&k.railh.css({width:k.win.innerWidth()-(k.opt.railpadding.left+k.opt.railpadding.right)});else{var r=k.getOffset();if(o={top:r.top,left:r.left-(k.opt.railpadding.left+k.opt.railpadding.right)},o.top+=y(k.win,"border-top-width",!0),o.left+=k.rail.align?k.win.outerWidth()-y(k.win,"border-right-width")-k.rail.width:y(k.win,"border-left-width"),(t=k.opt.railoffset)&&(t.top&&(o.top+=t.top),t.left&&(o.left+=t.left)),k.railslocked||k.rail.css({top:o.top,left:o.left,height:(e?e.h:k.win.innerHeight())-(k.opt.railpadding.top+k.opt.railpadding.bottom)}),k.zoom&&k.zoom.css({top:o.top+1,left:1==k.rail.align?o.left-20:o.left+k.rail.width+4}),k.railh&&!k.railslocked){o={top:r.top,left:r.left},(t=k.opt.railhoffset)&&(t.top&&(o.top+=t.top),t.left&&(o.left+=t.left));var i=k.railh.align?o.top+y(k.win,"border-top-width",!0)+k.win.innerHeight()-k.railh.height:o.top+y(k.win,"border-top-width",!0),s=o.left+y(k.win,"border-left-width");k.railh.css({top:i-(k.opt.railpadding.top+k.opt.railpadding.bottom),left:s,width:k.railh.width})}}},this.doRailClick=function(e,o,t){var r,i,s,n;k.railslocked||(k.cancelEvent(e),"pageY"in e||(e.pageX=e.clientX+l.documentElement.scrollLeft,e.pageY=e.clientY+l.documentElement.scrollTop),o?(r=t?k.doScrollLeft:k.doScrollTop)(s=t?(e.pageX-k.railh.offset().left-k.cursorwidth/2)*k.scrollratio.x:(e.pageY-k.rail.offset().top-k.cursorheight/2)*k.scrollratio.y):(r=t?k.doScrollLeftBy:k.doScrollBy,s=t?k.scroll.x:k.scroll.y,n=t?e.pageX-k.railh.offset().left:e.pageY-k.rail.offset().top,i=t?k.view.w:k.view.h,r(s>=n?i:-i)))},k.newscrolly=k.newscrollx=0,k.hasanimationframe="requestAnimationFrame"in a,k.hascancelanimationframe="cancelAnimationFrame"in a,k.hasborderbox=!1,this.init=function(){if(k.saved.css=[],C.isoperamini)return!0;if(C.isandroid&&!("hidden"in l))return!0;k.opt.emulatetouch=k.opt.emulatetouch||k.opt.touchbehavior,k.hasborderbox=a.getComputedStyle&&"border-box"===a.getComputedStyle(l.body)["box-sizing"];var e={"overflow-y":"hidden"};if((C.isie11||C.isie10)&&(e["-ms-overflow-style"]="none"),k.ishwscroll&&(this.doc.css(C.transitionstyle,C.prefixstyle+"transform 0ms ease-out"),C.transitionend&&k.bind(k.doc,C.transitionend,k.onScrollTransitionEnd,!1)),k.zindex="auto",k.ispage||"auto"!=k.opt.zindex?k.zindex=k.opt.zindex:k.zindex=w()||"auto",!k.ispage&&"auto"!=k.zindex&&k.zindex>s&&(s=k.zindex),k.isie&&0===k.zindex&&"auto"==k.opt.zindex&&(k.zindex="auto"),!k.ispage||!C.cantouch&&!C.isieold){var i=k.docscroll;k.ispage&&(i=k.haswrapper?k.win:k.doc),k.css(i,e),k.ispage&&(C.isie11||C.isie)&&k.css(n("html"),e),!C.isios||k.ispage||k.haswrapper||k.css(T,{"-webkit-overflow-scrolling":"touch"});var d=n(l.createElement("div"));d.css({position:"relative",top:0,float:"right",width:k.opt.cursorwidth,height:0,"background-color":k.opt.cursorcolor,border:k.opt.cursorborder,"background-clip":"padding-box","-webkit-border-radius":k.opt.cursorborderradius,"-moz-border-radius":k.opt.cursorborderradius,"border-radius":k.opt.cursorborderradius}),d.addClass("nicescroll-cursors"),k.cursor=d;var u=n(l.createElement("div"));u.attr("id",k.id),u.addClass("nicescroll-rails nicescroll-rails-vr");var h,m,f=["left","right","top","bottom"];for(var g in f)m=f[g],(h=k.opt.railpadding[m]||0)&&u.css("padding-"+m,h+"px");u.append(d),u.width=Math.max(parseFloat(k.opt.cursorwidth),d.outerWidth()),u.css({width:u.width+"px",zIndex:k.zindex,background:k.opt.background,cursor:"default"}),u.visibility=!0,u.scrollable=!0,u.align="left"==k.opt.railalign?0:1,k.rail=u,k.rail.drag=!1;var v=!1;!k.opt.boxzoom||k.ispage||C.isieold||(v=l.createElement("div"),k.bind(v,"click",k.doZoom),k.bind(v,"mouseenter",function(){k.zoom.css("opacity",k.opt.cursoropacitymax)}),k.bind(v,"mouseleave",function(){k.zoom.css("opacity",k.opt.cursoropacitymin)}),k.zoom=n(v),k.zoom.css({cursor:"pointer",zIndex:k.zindex,backgroundImage:"url("+k.opt.scriptpath+"zoomico.png)",height:18,width:18,backgroundPosition:"0 0"}),k.opt.dblclickzoom&&k.bind(k.win,"dblclick",k.doZoom),C.cantouch&&k.opt.gesturezoom&&(k.ongesturezoom=function(e){return e.scale>1.5&&k.doZoomIn(e),e.scale<.8&&k.doZoomOut(e),k.cancelEvent(e)},k.bind(k.win,"gestureend",k.ongesturezoom))),k.railh=!1;var y;if(k.opt.horizrailenabled&&(k.css(i,{overflowX:"hidden"}),(d=n(l.createElement("div"))).css({position:"absolute",top:0,height:k.opt.cursorwidth,width:0,backgroundColor:k.opt.cursorcolor,border:k.opt.cursorborder,backgroundClip:"padding-box","-webkit-border-radius":k.opt.cursorborderradius,"-moz-border-radius":k.opt.cursorborderradius,"border-radius":k.opt.cursorborderradius}),C.isieold&&d.css("overflow","hidden"),d.addClass("nicescroll-cursors"),k.cursorh=d,(y=n(l.createElement("div"))).attr("id",k.id+"-hr"),y.addClass("nicescroll-rails nicescroll-rails-hr"),y.height=Math.max(parseFloat(k.opt.cursorwidth),d.outerHeight()),y.css({height:y.height+"px",zIndex:k.zindex,background:k.opt.background}),y.append(d),y.visibility=!0,y.scrollable=!0,y.align="top"==k.opt.railvalign?0:1,k.railh=y,k.railh.drag=!1),k.ispage)u.css({position:"fixed",top:0,height:"100%"}),u.css(u.align?{right:0}:{left:0}),k.body.append(u),k.railh&&(y.css({position:"fixed",left:0,width:"100%"}),y.css(y.align?{bottom:0}:{top:0}),k.body.append(y));else{if(k.ishwscroll){"static"==k.win.css("position")&&k.css(k.win,{position:"relative"});var x="HTML"==k.win[0].nodeName?k.body:k.win;n(x).scrollTop(0).scrollLeft(0),k.zoom&&(k.zoom.css({position:"absolute",top:1,right:0,"margin-right":u.width+4}),x.append(k.zoom)),u.css({position:"absolute",top:0}),u.css(u.align?{right:0}:{left:0}),x.append(u),y&&(y.css({position:"absolute",left:0,bottom:0}),y.css(y.align?{bottom:0}:{top:0}),x.append(y))}else{k.isfixed="fixed"==k.win.css("position");var S=k.isfixed?"fixed":"absolute";k.isfixed||(k.viewport=k.getViewport(k.win[0])),k.viewport&&(k.body=k.viewport,/fixed|absolute/.test(k.viewport.css("position"))||k.css(k.viewport,{position:"relative"})),u.css({position:S}),k.zoom&&k.zoom.css({position:S}),k.updateScrollBar(),k.body.append(u),k.zoom&&k.body.append(k.zoom),k.railh&&(y.css({position:S}),k.body.append(y))}C.isios&&k.css(k.win,{"-webkit-tap-highlight-color":"rgba(0,0,0,0)","-webkit-touch-callout":"none"}),C.isie&&k.opt.disableoutline&&k.win.attr("hideFocus","true"),C.iswebkit&&k.opt.disableoutline&&k.win.css("outline","none")}if(!1===k.opt.autohidemode?(k.autohidedom=!1,k.rail.css({opacity:k.opt.cursoropacitymax}),k.railh&&k.railh.css({opacity:k.opt.cursoropacitymax})):!0===k.opt.autohidemode||"leave"===k.opt.autohidemode?(k.autohidedom=n().add(k.rail),C.isie8&&(k.autohidedom=k.autohidedom.add(k.cursor)),k.railh&&(k.autohidedom=k.autohidedom.add(k.railh)),k.railh&&C.isie8&&(k.autohidedom=k.autohidedom.add(k.cursorh))):"scroll"==k.opt.autohidemode?(k.autohidedom=n().add(k.rail),k.railh&&(k.autohidedom=k.autohidedom.add(k.railh))):"cursor"==k.opt.autohidemode?(k.autohidedom=n().add(k.cursor),k.railh&&(k.autohidedom=k.autohidedom.add(k.cursorh))):"hidden"==k.opt.autohidemode&&(k.autohidedom=!1,k.hide(),k.railslocked=!1),C.cantouch||k.istouchcapable||k.opt.emulatetouch||C.hasmstouch){k.scrollmom=new b(k),k.ontouchstart=function(e){if(e.pointerType&&("mouse"===e.pointerType||e.pointerType===e.MSPOINTER_TYPE_MOUSE))return!1;if(k.hasmoving=!1,!k.railslocked){var o;if(C.hasmstouch)for(o=!!e.target&&e.target;o;){var t=n(o).getNiceScroll();if(t.length>0&&t[0].me==k.me)break;if(t.length>0)return!1;if("DIV"==o.nodeName&&o.id==k.id)break;o=!!o.parentNode&&o.parentNode}if(e.stopPropagation(),k.cancelScroll(),(o=k.getTarget(e))&&/INPUT/i.test(o.nodeName)&&/range/i.test(o.type))return k.stopPropagation(e);if(!("clientX"in e)&&"changedTouches"in e&&(e.clientX=e.changedTouches[0].clientX,e.clientY=e.changedTouches[0].clientY),k.forcescreen){var r=e;(e={original:e.original?e.original:e}).clientX=r.screenX,e.clientY=r.screenY}if(k.rail.drag={x:e.clientX,y:e.clientY,sx:k.scroll.x,sy:k.scroll.y,st:k.getScrollTop(),sl:k.getScrollLeft(),pt:2,dl:!1,tg:o},k.ispage||!k.opt.directionlockdeadzone)k.rail.drag.dl="f";else{var i={w:c.width(),h:c.height()},s={w:Math.max(l.body.scrollWidth,l.documentElement.scrollWidth),h:Math.max(l.body.scrollHeight,l.documentElement.scrollHeight)},a=Math.max(0,s.h-i.h),d=Math.max(0,s.w-i.w);!k.rail.scrollable&&k.railh.scrollable?k.rail.drag.ck=a>0&&"v":k.rail.scrollable&&!k.railh.scrollable?k.rail.drag.ck=d>0&&"h":k.rail.drag.ck=!1,k.rail.drag.ck||(k.rail.drag.dl="f")}if(k.opt.emulatetouch&&k.isiframe&&C.isie){var u=k.win.position();k.rail.drag.x+=u.left,k.rail.drag.y+=u.top}if(k.hasmoving=!1,k.lastmouseup=!1,k.scrollmom.reset(e.clientX,e.clientY),!C.cantouch&&!this.istouchcapable&&!e.pointerType){if(!(!!o&&/INPUT|SELECT|BUTTON|TEXTAREA/i.test(o.nodeName)))return!k.ispage&&C.hasmousecapture&&o.setCapture(),k.opt.emulatetouch?(o.onclick&&!o._onclick&&(o._onclick=o.onclick,o.onclick=function(e){if(k.hasmoving)return!1;o._onclick.call(this,e)}),k.cancelEvent(e)):k.stopPropagation(e);/SUBMIT|CANCEL|BUTTON/i.test(n(o).attr("type"))&&(k.preventclick={tg:o,click:!1})}}},k.ontouchend=function(e){if(!k.rail.drag)return!0;if(2==k.rail.drag.pt){if(e.pointerType&&("mouse"===e.pointerType||e.pointerType===e.MSPOINTER_TYPE_MOUSE))return!1;if(k.rail.drag=!1,k.hasmoving&&(k.scrollmom.doMomentum(),k.lastmouseup=!0,k.hideCursor(),C.hasmousecapture&&l.releaseCapture(),!C.cantouch))return k.cancelEvent(e)}else if(1==k.rail.drag.pt)return k.onmouseup(e)};var z=k.opt.emulatetouch&&k.isiframe&&!C.hasmousecapture;k.ontouchmove=function(e,o){if(!k.rail.drag)return!1;if(e.targetTouches&&k.opt.preventmultitouchscrolling&&e.targetTouches.length>1)return!1;if(e.pointerType&&("mouse"===e.pointerType||e.pointerType===e.MSPOINTER_TYPE_MOUSE))return!1;if(2==k.rail.drag.pt){if("changedTouches"in e&&(e.clientX=e.changedTouches[0].clientX,e.clientY=e.changedTouches[0].clientY),k.rail.drag.y===e.clientY&&k.rail.drag.x===e.clientX)return!1;k.hasmoving||k.triggerScrollStart(e.clientX,e.clientY,0,0,0),k.hasmoving=!0,k.preventclick&&!k.preventclick.click&&(k.preventclick.click=k.preventclick.tg.onclick||!1,k.preventclick.tg.onclick=k.onpreventclick);var t,r;if(r=t=0,z&&!o){var i=k.win.position();r=-i.left,t=-i.top}var s=e.clientY+t,n=s-k.rail.drag.y,a=e.clientX+r,c=a-k.rail.drag.x,d=k.rail.drag.st-n;k.ishwscroll&&k.opt.bouncescroll?d<0?d=Math.round(d/2):d>k.page.maxh&&(d=k.page.maxh+Math.round((d-k.page.maxh)/2)):(d<0&&(d=0,s=0),d>k.page.maxh&&(d=k.page.maxh,s=0));var u;k.railh&&k.railh.scrollable&&(u=k.isrtlmode?c-k.rail.drag.sl:k.rail.drag.sl-c,k.ishwscroll&&k.opt.bouncescroll?u<0?u=Math.round(u/2):u>k.page.maxw&&(u=k.page.maxw+Math.round((u-k.page.maxw)/2)):(u<0&&(u=0,a=0),u>k.page.maxw&&(u=k.page.maxw,a=0)));var h=!1;if(k.rail.drag.dl)h=!0,"v"==k.rail.drag.dl?u=k.rail.drag.sl:"h"==k.rail.drag.dl&&(d=k.rail.drag.st);else{var p=Math.abs(n),m=Math.abs(c),f=k.opt.directionlockdeadzone;if("v"==k.rail.drag.ck){if(p>f&&m<=.3*p)return k.rail.drag=!1,!0;m>f&&(k.rail.drag.dl="f",T.scrollTop(T.scrollTop()))}else if("h"==k.rail.drag.ck){if(m>f&&p<=.3*m)return k.rail.drag=!1,!0;p>f&&(k.rail.drag.dl="f",T.scrollLeft(T.scrollLeft()))}}if(k.synched("touchmove",function(){k.rail.drag&&2==k.rail.drag.pt&&(k.prepareTransition&&k.resetTransition(),k.rail.scrollable&&k.setScrollTop(d),k.scrollmom.update(a,s),k.railh&&k.railh.scrollable?(k.setScrollLeft(u),k.showCursor(d,u)):k.showCursor(d),C.isie10&&l.selection.clear())}),C.ischrome&&k.istouchcapable&&(h=!1),h)return k.cancelEvent(e)}else if(1==k.rail.drag.pt)return k.onmousemove(e)},k.ontouchstartCursor=function(e,o){if(!k.rail.drag||3==k.rail.drag.pt){if(k.locked)return k.cancelEvent(e);k.cancelScroll(),k.rail.drag={x:e.touches[0].clientX,y:e.touches[0].clientY,sx:k.scroll.x,sy:k.scroll.y,pt:3,hr:!!o};var t=k.getTarget(e);return!k.ispage&&C.hasmousecapture&&t.setCapture(),k.isiframe&&!C.hasmousecapture&&(k.saved.csspointerevents=k.doc.css("pointer-events"),k.css(k.doc,{"pointer-events":"none"})),k.cancelEvent(e)}},k.ontouchendCursor=function(e){if(k.rail.drag){if(C.hasmousecapture&&l.releaseCapture(),k.isiframe&&!C.hasmousecapture&&k.doc.css("pointer-events",k.saved.csspointerevents),3!=k.rail.drag.pt)return;return k.rail.drag=!1,k.cancelEvent(e)}},k.ontouchmoveCursor=function(e){if(k.rail.drag){if(3!=k.rail.drag.pt)return;if(k.cursorfreezed=!0,k.rail.drag.hr){k.scroll.x=k.rail.drag.sx+(e.touches[0].clientX-k.rail.drag.x),k.scroll.x<0&&(k.scroll.x=0);var o=k.scrollvaluemaxw;k.scroll.x>o&&(k.scroll.x=o)}else{k.scroll.y=k.rail.drag.sy+(e.touches[0].clientY-k.rail.drag.y),k.scroll.y<0&&(k.scroll.y=0);var t=k.scrollvaluemax;k.scroll.y>t&&(k.scroll.y=t)}return k.synched("touchmove",function(){k.rail.drag&&3==k.rail.drag.pt&&(k.showCursor(),k.rail.drag.hr?k.doScrollLeft(Math.round(k.scroll.x*k.scrollratio.x),k.opt.cursordragspeed):k.doScrollTop(Math.round(k.scroll.y*k.scrollratio.y),k.opt.cursordragspeed))}),k.cancelEvent(e)}}}if(k.onmousedown=function(e,o){if(!k.rail.drag||1==k.rail.drag.pt){if(k.railslocked)return k.cancelEvent(e);k.cancelScroll(),k.rail.drag={x:e.clientX,y:e.clientY,sx:k.scroll.x,sy:k.scroll.y,pt:1,hr:o||!1};var t=k.getTarget(e);return C.hasmousecapture&&t.setCapture(),k.isiframe&&!C.hasmousecapture&&(k.saved.csspointerevents=k.doc.css("pointer-events"),k.css(k.doc,{"pointer-events":"none"})),k.hasmoving=!1,k.cancelEvent(e)}},k.onmouseup=function(e){if(k.rail.drag)return 1!=k.rail.drag.pt||(C.hasmousecapture&&l.releaseCapture(),k.isiframe&&!C.hasmousecapture&&k.doc.css("pointer-events",k.saved.csspointerevents),k.rail.drag=!1,k.cursorfreezed=!1,k.hasmoving&&k.triggerScrollEnd(),k.cancelEvent(e))},k.onmousemove=function(e){if(k.rail.drag){if(1!==k.rail.drag.pt)return;if(C.ischrome&&0===e.which)return k.onmouseup(e);if(k.cursorfreezed=!0,k.hasmoving||k.triggerScrollStart(e.clientX,e.clientY,0,0,0),k.hasmoving=!0,k.rail.drag.hr){k.scroll.x=k.rail.drag.sx+(e.clientX-k.rail.drag.x),k.scroll.x<0&&(k.scroll.x=0);var o=k.scrollvaluemaxw;k.scroll.x>o&&(k.scroll.x=o)}else{k.scroll.y=k.rail.drag.sy+(e.clientY-k.rail.drag.y),k.scroll.y<0&&(k.scroll.y=0);var t=k.scrollvaluemax;k.scroll.y>t&&(k.scroll.y=t)}return k.synched("mousemove",function(){k.cursorfreezed&&(k.showCursor(),k.rail.drag.hr?k.scrollLeft(Math.round(k.scroll.x*k.scrollratio.x)):k.scrollTop(Math.round(k.scroll.y*k.scrollratio.y)))}),k.cancelEvent(e)}k.checkarea=0},C.cantouch||k.opt.emulatetouch)k.onpreventclick=function(e){if(k.preventclick)return k.preventclick.tg.onclick=k.preventclick.click,k.preventclick=!1,k.cancelEvent(e)},k.onclick=!C.isios&&function(e){return!k.lastmouseup||(k.lastmouseup=!1,k.cancelEvent(e))},k.opt.grabcursorenabled&&C.cursorgrabvalue&&(k.css(k.ispage?k.doc:k.win,{cursor:C.cursorgrabvalue}),k.css(k.rail,{cursor:C.cursorgrabvalue}));else{var E=function(e){if(k.selectiondrag){if(e){var o=k.win.outerHeight(),t=e.pageY-k.selectiondrag.top;t>0&&t=o&&(t-=o),k.selectiondrag.df=t}if(0!==k.selectiondrag.df){var r=2*-Math.floor(k.selectiondrag.df/6);k.doScrollBy(r),k.debounced("doselectionscroll",function(){E()},50)}}};k.hasTextSelected="getSelection"in l?function(){return l.getSelection().rangeCount>0}:"selection"in l?function(){return"None"!=l.selection.type}:function(){return!1},k.onselectionstart=function(e){k.ispage||(k.selectiondrag=k.win.offset())},k.onselectionend=function(e){k.selectiondrag=!1},k.onselectiondrag=function(e){k.selectiondrag&&k.hasTextSelected()&&k.debounced("selectionscroll",function(){E(e)},250)}}if(C.hasw3ctouch?(k.css(k.ispage?n("html"):k.win,{"touch-action":"none"}),k.css(k.rail,{"touch-action":"none"}),k.css(k.cursor,{"touch-action":"none"}),k.bind(k.win,"pointerdown",k.ontouchstart),k.bind(l,"pointerup",k.ontouchend),k.bind(l,"pointermove",k.ontouchmove)):C.hasmstouch?(k.css(k.ispage?n("html"):k.win,{"-ms-touch-action":"none"}),k.css(k.rail,{"-ms-touch-action":"none"}),k.css(k.cursor,{"-ms-touch-action":"none"}),k.bind(k.win,"MSPointerDown",k.ontouchstart),k.bind(l,"MSPointerUp",k.ontouchend),k.bind(l,"MSPointerMove",k.ontouchmove),k.bind(k.cursor,"MSGestureHold",function(e){e.preventDefault()}),k.bind(k.cursor,"contextmenu",function(e){e.preventDefault()})):C.cantouch&&(k.bind(k.win,"touchstart",k.ontouchstart,!1,!0),k.bind(l,"touchend",k.ontouchend,!1,!0),k.bind(l,"touchcancel",k.ontouchend,!1,!0),k.bind(l,"touchmove",k.ontouchmove,!1,!0)),k.opt.emulatetouch&&(k.bind(k.win,"mousedown",k.ontouchstart,!1,!0),k.bind(l,"mouseup",k.ontouchend,!1,!0),k.bind(l,"mousemove",k.ontouchmove,!1,!0)),(k.opt.cursordragontouch||!C.cantouch&&!k.opt.emulatetouch)&&(k.rail.css({cursor:"default"}),k.railh&&k.railh.css({cursor:"default"}),k.jqbind(k.rail,"mouseenter",function(){if(!k.ispage&&!k.win.is(":visible"))return!1;k.canshowonmouseevent&&k.showCursor(),k.rail.active=!0}),k.jqbind(k.rail,"mouseleave",function(){k.rail.active=!1,k.rail.drag||k.hideCursor()}),k.opt.sensitiverail&&(k.bind(k.rail,"click",function(e){k.doRailClick(e,!1,!1)}),k.bind(k.rail,"dblclick",function(e){k.doRailClick(e,!0,!1)}),k.bind(k.cursor,"click",function(e){k.cancelEvent(e)}),k.bind(k.cursor,"dblclick",function(e){k.cancelEvent(e)})),k.railh&&(k.jqbind(k.railh,"mouseenter",function(){if(!k.ispage&&!k.win.is(":visible"))return!1;k.canshowonmouseevent&&k.showCursor(),k.rail.active=!0}),k.jqbind(k.railh,"mouseleave",function(){k.rail.active=!1,k.rail.drag||k.hideCursor()}),k.opt.sensitiverail&&(k.bind(k.railh,"click",function(e){k.doRailClick(e,!1,!0)}),k.bind(k.railh,"dblclick",function(e){k.doRailClick(e,!0,!0)}),k.bind(k.cursorh,"click",function(e){k.cancelEvent(e)}),k.bind(k.cursorh,"dblclick",function(e){k.cancelEvent(e)})))),k.opt.cursordragontouch&&(this.istouchcapable||C.cantouch)&&(k.bind(k.cursor,"touchstart",k.ontouchstartCursor),k.bind(k.cursor,"touchmove",k.ontouchmoveCursor),k.bind(k.cursor,"touchend",k.ontouchendCursor),k.cursorh&&k.bind(k.cursorh,"touchstart",function(e){k.ontouchstartCursor(e,!0)}),k.cursorh&&k.bind(k.cursorh,"touchmove",k.ontouchmoveCursor),k.cursorh&&k.bind(k.cursorh,"touchend",k.ontouchendCursor)),C.cantouch||k.opt.emulatetouch?(k.bind(C.hasmousecapture?k.win:l,"mouseup",k.ontouchend),k.onclick&&k.bind(l,"click",k.onclick),k.opt.cursordragontouch?(k.bind(k.cursor,"mousedown",k.onmousedown),k.bind(k.cursor,"mouseup",k.onmouseup),k.cursorh&&k.bind(k.cursorh,"mousedown",function(e){k.onmousedown(e,!0)}),k.cursorh&&k.bind(k.cursorh,"mouseup",k.onmouseup)):(k.bind(k.rail,"mousedown",function(e){e.preventDefault()}),k.railh&&k.bind(k.railh,"mousedown",function(e){e.preventDefault()}))):(k.bind(C.hasmousecapture?k.win:l,"mouseup",k.onmouseup),k.bind(l,"mousemove",k.onmousemove),k.onclick&&k.bind(l,"click",k.onclick),k.bind(k.cursor,"mousedown",k.onmousedown),k.bind(k.cursor,"mouseup",k.onmouseup),k.railh&&(k.bind(k.cursorh,"mousedown",function(e){k.onmousedown(e,!0)}),k.bind(k.cursorh,"mouseup",k.onmouseup)),!k.ispage&&k.opt.enablescrollonselection&&(k.bind(k.win[0],"mousedown",k.onselectionstart),k.bind(l,"mouseup",k.onselectionend),k.bind(k.cursor,"mouseup",k.onselectionend),k.cursorh&&k.bind(k.cursorh,"mouseup",k.onselectionend),k.bind(l,"mousemove",k.onselectiondrag)),k.zoom&&(k.jqbind(k.zoom,"mouseenter",function(){k.canshowonmouseevent&&k.showCursor(),k.rail.active=!0}),k.jqbind(k.zoom,"mouseleave",function(){k.rail.active=!1,k.rail.drag||k.hideCursor()}))),k.opt.enablemousewheel&&(k.isiframe||k.mousewheel(C.isie&&k.ispage?l:k.win,k.onmousewheel),k.mousewheel(k.rail,k.onmousewheel),k.railh&&k.mousewheel(k.railh,k.onmousewheelhr)),k.ispage||C.cantouch||/HTML|^BODY/.test(k.win[0].nodeName)||(k.win.attr("tabindex")||k.win.attr({tabindex:++r}),k.bind(k.win,"focus",function(e){o=k.getTarget(e).id||!0,k.hasfocus=!0,k.canshowonmouseevent&&k.noticeCursor()}),k.bind(k.win,"blur",function(e){o=!1,k.hasfocus=!1}),k.bind(k.win,"mouseenter",function(e){t=k.getTarget(e).id||!0,k.hasmousefocus=!0,k.canshowonmouseevent&&k.noticeCursor()}),k.bind(k.win,"mouseleave",function(e){t=!1,k.hasmousefocus=!1,k.rail.drag||k.hideCursor()})),k.onkeypress=function(e){if(k.railslocked&&0===k.page.maxh)return!0;e=e||a.event;var r=k.getTarget(e);if(r&&/INPUT|TEXTAREA|SELECT|OPTION/.test(r.nodeName)&&(!(r.getAttribute("type")||r.type||!1)||!/submit|button|cancel/i.tp))return!0;if(n(r).attr("contenteditable"))return!0;if(k.hasfocus||k.hasmousefocus&&!o||k.ispage&&!o&&!t){var i=e.keyCode;if(k.railslocked&&27!=i)return k.cancelEvent(e);var s=e.ctrlKey||!1,l=e.shiftKey||!1,c=!1;switch(i){case 38:case 63233:k.doScrollBy(72),c=!0;break;case 40:case 63235:k.doScrollBy(-72),c=!0;break;case 37:case 63232:k.railh&&(s?k.doScrollLeft(0):k.doScrollLeftBy(72),c=!0);break;case 39:case 63234:k.railh&&(s?k.doScrollLeft(k.page.maxw):k.doScrollLeftBy(-72),c=!0);break;case 33:case 63276:k.doScrollBy(k.view.h),c=!0;break;case 34:case 63277:k.doScrollBy(-k.view.h),c=!0;break;case 36:case 63273:k.railh&&s?k.doScrollPos(0,0):k.doScrollTo(0),c=!0;break;case 35:case 63275:k.railh&&s?k.doScrollPos(k.page.maxw,k.page.maxh):k.doScrollTo(k.page.maxh),c=!0;break;case 32:k.opt.spacebarenabled&&(l?k.doScrollBy(k.view.h):k.doScrollBy(-k.view.h),c=!0);break;case 27:k.zoomactive&&(k.doZoom(),c=!0)}if(c)return k.cancelEvent(e)}},k.opt.enablekeyboard&&k.bind(l,C.isopera&&!C.isopera12?"keypress":"keydown",k.onkeypress),k.bind(l,"keydown",function(e){(e.ctrlKey||!1)&&(k.wheelprevented=!0)}),k.bind(l,"keyup",function(e){e.ctrlKey||!1||(k.wheelprevented=!1)}),k.bind(a,"blur",function(e){k.wheelprevented=!1}),k.bind(a,"resize",k.lazyResize),k.bind(a,"orientationchange",k.lazyResize),k.bind(a,"load",k.lazyResize),C.ischrome&&!k.ispage&&!k.haswrapper){var M=k.win.attr("style"),L=parseFloat(k.win.css("width"))+1;k.win.css("width",L),k.synched("chromefix",function(){k.win.attr("style",M)})}k.onAttributeChange=function(e){k.lazyResize(k.isieold?250:30)},k.opt.enableobserver&&(k.isie11||!1===p||(k.observerbody=new p(function(e){if(e.forEach(function(e){if("attributes"==e.type)return T.hasClass("modal-open")&&T.hasClass("modal-dialog")&&!n.contains(n(".modal-dialog")[0],k.doc[0])?k.hide():k.show()}),k.me.clientWidth!=k.page.width||k.me.clientHeight!=k.page.height)return k.lazyResize(30)}),k.observerbody.observe(l.body,{childList:!0,subtree:!0,characterData:!1,attributes:!0,attributeFilter:["class"]})),k.ispage||k.haswrapper||(!1!==p?(k.observer=new p(function(e){e.forEach(k.onAttributeChange)}),k.observer.observe(k.win[0],{childList:!0,characterData:!1,attributes:!0,subtree:!1}),k.observerremover=new p(function(e){e.forEach(function(e){if(e.removedNodes.length>0)for(var o in e.removedNodes)if(k&&e.removedNodes[o]==k.win[0])return k.remove()})}),k.observerremover.observe(k.win[0].parentNode,{childList:!0,characterData:!1,attributes:!1,subtree:!1})):(k.bind(k.win,C.isie&&!C.isie9?"propertychange":"DOMAttrModified",k.onAttributeChange),C.isie9&&k.win[0].attachEvent("onpropertychange",k.onAttributeChange),k.bind(k.win,"DOMNodeRemoved",function(e){e.target==k.win[0]&&k.remove()})))),!k.ispage&&k.opt.boxzoom&&k.bind(a,"resize",k.resizeZoom),k.istextarea&&(k.bind(k.win,"keydown",k.lazyResize),k.bind(k.win,"mouseup",k.lazyResize)),k.lazyResize(30)}if("IFRAME"==this.doc[0].nodeName){var N=function(){k.iframexd=!1;var o;try{(o="contentDocument"in this?this.contentDocument:this.contentWindow._doc).domain}catch(e){k.iframexd=!0,o=!1}if(k.iframexd)return"console"in a&&console.log("NiceScroll error: policy restriced iframe"),!0;if(k.forcescreen=!0,k.isiframe&&(k.iframe={doc:n(o),html:k.doc.contents().find("html")[0],body:k.doc.contents().find("body")[0]},k.getContentSize=function(){return{w:Math.max(k.iframe.html.scrollWidth,k.iframe.body.scrollWidth),h:Math.max(k.iframe.html.scrollHeight,k.iframe.body.scrollHeight)}},k.docscroll=n(k.iframe.body)),!C.isios&&k.opt.iframeautoresize&&!k.isiframe){k.win.scrollTop(0),k.doc.height("");var t=Math.max(o.getElementsByTagName("html")[0].scrollHeight,o.body.scrollHeight);k.doc.height(t)}k.lazyResize(30),k.css(n(k.iframe.body),e),C.isios&&k.haswrapper&&k.css(n(o.body),{"-webkit-transform":"translate3d(0,0,0)"}),"contentWindow"in this?k.bind(this.contentWindow,"scroll",k.onscroll):k.bind(o,"scroll",k.onscroll),k.opt.enablemousewheel&&k.mousewheel(o,k.onmousewheel),k.opt.enablekeyboard&&k.bind(o,C.isopera?"keypress":"keydown",k.onkeypress),C.cantouch?(k.bind(o,"touchstart",k.ontouchstart),k.bind(o,"touchmove",k.ontouchmove)):k.opt.emulatetouch&&(k.bind(o,"mousedown",k.ontouchstart),k.bind(o,"mousemove",function(e){return k.ontouchmove(e,!0)}),k.opt.grabcursorenabled&&C.cursorgrabvalue&&k.css(n(o.body),{cursor:C.cursorgrabvalue})),k.bind(o,"mouseup",k.ontouchend),k.zoom&&(k.opt.dblclickzoom&&k.bind(o,"dblclick",k.doZoom),k.ongesturezoom&&k.bind(o,"gestureend",k.ongesturezoom))};this.doc[0].readyState&&"complete"===this.doc[0].readyState&&setTimeout(function(){N.call(k.doc[0],!1)},500),k.bind(this.doc,"load",N)}},this.showCursor=function(e,o){if(k.cursortimeout&&(clearTimeout(k.cursortimeout),k.cursortimeout=0),k.rail){if(k.autohidedom&&(k.autohidedom.stop().css({opacity:k.opt.cursoropacitymax}),k.cursoractive=!0),k.rail.drag&&1==k.rail.drag.pt||(void 0!==e&&!1!==e&&(k.scroll.y=e/k.scrollratio.y|0),void 0!==o&&(k.scroll.x=o/k.scrollratio.x|0)),k.cursor.css({height:k.cursorheight,top:k.scroll.y}),k.cursorh){var t=k.hasreversehr?k.scrollvaluemaxw-k.scroll.x:k.scroll.x;k.cursorh.css({width:k.cursorwidth,left:!k.rail.align&&k.rail.visibility?t+k.rail.width:t}),k.cursoractive=!0}k.zoom&&k.zoom.stop().css({opacity:k.opt.cursoropacitymax})}},this.hideCursor=function(e){k.cursortimeout||k.rail&&k.autohidedom&&(k.hasmousefocus&&"leave"===k.opt.autohidemode||(k.cursortimeout=setTimeout(function(){k.rail.active&&k.showonmouseevent||(k.autohidedom.stop().animate({opacity:k.opt.cursoropacitymin}),k.zoom&&k.zoom.stop().animate({opacity:k.opt.cursoropacitymin}),k.cursoractive=!1),k.cursortimeout=0},e||k.opt.hidecursordelay)))},this.noticeCursor=function(e,o,t){k.showCursor(o,t),k.rail.active||k.hideCursor(e)},this.getContentSize=k.ispage?function(){return{w:Math.max(l.body.scrollWidth,l.documentElement.scrollWidth),h:Math.max(l.body.scrollHeight,l.documentElement.scrollHeight)}}:k.haswrapper?function(){return{w:k.doc[0].offsetWidth,h:k.doc[0].offsetHeight}}:function(){return{w:k.docscroll[0].scrollWidth,h:k.docscroll[0].scrollHeight}},this.onResize=function(e,o){if(!k||!k.win)return!1;var t=k.page.maxh,r=k.page.maxw,i={h:k.view.h,w:k.view.w};if(k.view={w:k.ispage?k.win.width():k.win[0].clientWidth,h:k.ispage?k.win.height():k.win[0].clientHeight},k.page=o||k.getContentSize(),k.page.maxh=Math.max(0,k.page.h-k.view.h),k.page.maxw=Math.max(0,k.page.w-k.view.w),k.page.maxh==t&&k.page.maxw==r&&k.view.w==i.w&&k.view.h==i.h){if(k.ispage)return k;var s=k.win.offset();if(k.lastposition){var n=k.lastposition;if(n.top==s.top&&n.left==s.left)return k}k.lastposition=s}return 0===k.page.maxh?(k.hideRail(),k.scrollvaluemax=0,k.scroll.y=0,k.scrollratio.y=0,k.cursorheight=0,k.setScrollTop(0),k.rail&&(k.rail.scrollable=!1)):(k.page.maxh-=k.opt.railpadding.top+k.opt.railpadding.bottom,k.rail.scrollable=!0),0===k.page.maxw?(k.hideRailHr(),k.scrollvaluemaxw=0,k.scroll.x=0,k.scrollratio.x=0,k.cursorwidth=0,k.setScrollLeft(0),k.railh&&(k.railh.scrollable=!1)):(k.page.maxw-=k.opt.railpadding.left+k.opt.railpadding.right,k.railh&&(k.railh.scrollable=k.opt.horizrailenabled)),k.railslocked=k.locked||0===k.page.maxh&&0===k.page.maxw,k.railslocked?(k.ispage||k.updateScrollBar(k.view),!1):(k.hidden||k.visibility?!k.railh||k.hidden||k.railh.visibility||k.showRailHr():k.showRail().showRailHr(),k.istextarea&&k.win.css("resize")&&"none"!=k.win.css("resize")&&(k.view.h-=20),k.cursorheight=Math.min(k.view.h,Math.round(k.view.h*(k.view.h/k.page.h))),k.cursorheight=k.opt.cursorfixedheight?k.opt.cursorfixedheight:Math.max(k.opt.cursorminheight,k.cursorheight),k.cursorwidth=Math.min(k.view.w,Math.round(k.view.w*(k.view.w/k.page.w))),k.cursorwidth=k.opt.cursorfixedheight?k.opt.cursorfixedheight:Math.max(k.opt.cursorminheight,k.cursorwidth),k.scrollvaluemax=k.view.h-k.cursorheight-(k.opt.railpadding.top+k.opt.railpadding.bottom),k.hasborderbox||(k.scrollvaluemax-=k.cursor[0].offsetHeight-k.cursor[0].clientHeight),k.railh&&(k.railh.width=k.page.maxh>0?k.view.w-k.rail.width:k.view.w,k.scrollvaluemaxw=k.railh.width-k.cursorwidth-(k.opt.railpadding.left+k.opt.railpadding.right)),k.ispage||k.updateScrollBar(k.view),k.scrollratio={x:k.page.maxw/k.scrollvaluemaxw,y:k.page.maxh/k.scrollvaluemax},k.getScrollTop()>k.page.maxh?k.doScrollTop(k.page.maxh):(k.scroll.y=k.getScrollTop()/k.scrollratio.y|0,k.scroll.x=k.getScrollLeft()/k.scrollratio.x|0,k.cursoractive&&k.noticeCursor()),k.scroll.y&&0===k.getScrollTop()&&k.doScrollTo(Math.floor(k.scroll.y*k.scrollratio.y)),k)},this.resize=k.onResize,this.hlazyresize=0,this.lazyResize=function(e){return k.haswrapper||k.ispage||k.hide(),k.hlazyresize&&clearTimeout(k.hlazyresize),k.hlazyresize=setTimeout(function(){k&&(k.haswrapper||k.ispage||k.show(),k.resize())},240),k},this.jqbind=function(e,o,t){k.events.push({e:e,n:o,f:t,q:!0}),n(e).on(o,t)},this.mousewheel=function(e,o,t){var r="jquery"in e?e[0]:e;if("onwheel"in l.createElement("div"))k._bind(r,"wheel",o,t||!1);else{var i=void 0!==l.onmousewheel?"mousewheel":"DOMMouseScroll";x(r,i,o,t||!1),"DOMMouseScroll"==i&&x(r,"MozMousePixelScroll",o,t||!1)}};var _=!1;if(C.haseventlistener){try{var H=Object.defineProperty({},"passive",{get:function(){_=!0}});a.addEventListener("test",null,H)}catch(e){}this.cancelEvent=function(e){return!!e&&((e=e.original?e.original:e).cancelable&&e.preventDefault(),e.stopPropagation(),e.preventManipulation&&e.preventManipulation(),!1)},this.stopPropagation=function(e){return!!e&&((e=e.original?e.original:e).stopPropagation(),!1)}}else Event.prototype.preventDefault=function(){this.returnValue=!1},Event.prototype.stopPropagation=function(){this.cancelBubble=!0},a.constructor.prototype.addEventListener=l.constructor.prototype.addEventListener=Element.prototype.addEventListener=function(e,o,t){this.attachEvent("on"+e,o)},a.constructor.prototype.removeEventListener=l.constructor.prototype.removeEventListener=Element.prototype.removeEventListener=function(e,o,t){this.detachEvent("on"+e,o)},this.cancelEvent=function(e){return!!(e=e||a.event)&&(e.cancelBubble=!0,e.cancel=!0,e.returnValue=!1,!1)},this.stopPropagation=function(e){return(e=e||a.event)&&(e.cancelBubble=!0),!1};this.bind=function(e,o,t,r,i){var s="jquery"in e?e[0]:e;k._bind(s,o,t,r||!1,i||!1)},this._bind=function(e,o,t,r,i){k.events.push({e:e,n:o,f:t,b:r,q:!1}),_&&i?e.addEventListener(o,t,{passive:!1,capture:r}):e.addEventListener(o,t,r||!1)},this._unbind=function(e,o,t,r){e.removeEventListener(o,t,r)},this.unbindAll=function(){for(var e=0;e0)return t;o=!!o.parentNode&&o.parentNode}return!1},this.triggerScrollStart=function(e,o,t,r,i){if(k.onscrollstart){var s={type:"scrollstart",current:{x:e,y:o},request:{x:t,y:r},end:{x:k.newscrollx,y:k.newscrolly},speed:i};k.onscrollstart.call(k,s)}},this.triggerScrollEnd=function(){if(k.onscrollend){var e=k.getScrollLeft(),o=k.getScrollTop(),t={type:"scrollend",current:{x:e,y:o},end:{x:e,y:o}};k.onscrollend.call(k,t)}};var I=0,O=0,Y=0,B=1;if(this.onmousewheel=function(e){if(!k.wheelprevented){if(k.railslocked)return k.debounced("checkunlock",k.resize,250),!0;if(k.rail.drag)return k.cancelEvent(e);if("auto"===k.opt.oneaxismousemode&&0!==e.deltaX&&(k.opt.oneaxismousemode=!1),k.opt.oneaxismousemode&&0===e.deltaX&&!k.rail.scrollable)return!k.railh||!k.railh.scrollable||k.onmousewheelhr(e);var o=m(),t=!1;if(k.opt.preservenativescrolling&&k.checkarea+600k.page.maxh&&(o=k.page.maxh+(o-k.page.maxh)/2|0),e<0?e=e/2|0:e>k.page.maxw&&(e=k.page.maxw+(o-k.page.maxw)/2|0)):(o<0?o=0:o>k.page.maxh&&(o=k.page.maxh),e<0?e=0:e>k.page.maxw&&(e=k.page.maxw)),k.scrollrunning&&e==k.newscrollx&&o==k.newscrolly)return!1;k.newscrolly=o,k.newscrollx=e;var s=k.getScrollTop(),n=k.getScrollLeft(),l={};l.x=e-n,l.y=o-s;var a=0|Math.sqrt(l.x*l.x+l.y*l.y),c=k.prepareTransition(a);k.scrollrunning||(k.scrollrunning=!0,k.triggerScrollStart(n,s,e,o,c),k.cursorupdate.start()),k.scrollendtrapped=!0,C.transitionend||(k.scrollendtrapped&&clearTimeout(k.scrollendtrapped),k.scrollendtrapped=setTimeout(k.onScrollTransitionEnd,c)),k.setScrollTop(k.newscrolly),k.setScrollLeft(k.newscrollx)},this.cancelScroll=function(){if(!k.scrollendtrapped)return!0;var e=k.getScrollTop(),o=k.getScrollLeft();return k.scrollrunning=!1,C.transitionend||clearTimeout(C.transitionend),k.scrollendtrapped=!1,k.resetTransition(),k.setScrollTop(e),k.railh&&k.setScrollLeft(o),k.timerscroll&&k.timerscroll.tm&&clearInterval(k.timerscroll.tm),k.timerscroll=!1,k.cursorfreezed=!1,k.cursorupdate.stop(),k.showCursor(e,o),k},this.onScrollTransitionEnd=function(){if(k.scrollendtrapped){var e=k.getScrollTop(),o=k.getScrollLeft();if(e<0?e=0:e>k.page.maxh&&(e=k.page.maxh),o<0?o=0:o>k.page.maxw&&(o=k.page.maxw),e!=k.newscrolly||o!=k.newscrollx)return k.doScrollPos(o,e,k.opt.snapbackspeed);k.scrollrunning&&k.triggerScrollEnd(),k.scrollrunning=!1,k.scrollendtrapped=!1,k.resetTransition(),k.timerscroll=!1,k.setScrollTop(e),k.railh&&k.setScrollLeft(o),k.cursorupdate.stop(),k.noticeCursor(!1,e,o),k.cursorfreezed=!1}}}else this.doScrollLeft=function(e,o){var t=k.scrollrunning?k.newscrolly:k.getScrollTop();k.doScrollPos(e,t,o)},this.doScrollTop=function(e,o){var t=k.scrollrunning?k.newscrollx:k.getScrollLeft();k.doScrollPos(t,e,o)},this.doScrollPos=function(e,o,t){var r=k.getScrollTop(),i=k.getScrollLeft();((k.newscrolly-r)*(o-r)<0||(k.newscrollx-i)*(e-i)<0)&&k.cancelScroll();var s=!1;if(k.bouncescroll&&k.rail.visibility||(o<0?(o=0,s=!0):o>k.page.maxh&&(o=k.page.maxh,s=!0)),k.bouncescroll&&k.railh.visibility||(e<0?(e=0,s=!0):e>k.page.maxw&&(e=k.page.maxw,s=!0)),k.scrollrunning&&k.newscrolly===o&&k.newscrollx===e)return!0;k.newscrolly=o,k.newscrollx=e,k.dst={},k.dst.x=e-i,k.dst.y=o-r,k.dst.px=i,k.dst.py=r;var n=0|Math.sqrt(k.dst.x*k.dst.x+k.dst.y*k.dst.y),l=k.getTransitionSpeed(n);k.bzscroll={},s?(k.bzscroll.x=new N(i,k.newscrollx,l,0,0,1,1),k.bzscroll.y=new N(r,k.newscrolly,l,0,0,1,1)):(k.bzscroll.x=new N(i,k.newscrollx,l,0,0,.58,1),k.bzscroll.y=new N(r,k.newscrolly,l,0,0,.58,1));var a=function(){if(k.scrollrunning){var e=k.bzscroll.y.getPos();k.setScrollLeft(k.bzscroll.x.getNow()),k.setScrollTop(k.bzscroll.y.getNow()),e<=1?d(a):(k.scrollrunning=!1,k.timer=0,k.triggerScrollEnd())}};k.scrollrunning||(k.triggerScrollStart(i,r,e,o,l),k.scrollrunning=!0,k.timer=d(a))},this.cancelScroll=function(){return k.timer&&u(k.timer),k.timer=0,k.bzscroll=!1,k.scrollrunning=!1,k};else this.doScrollLeft=function(e,o){var t=k.getScrollTop();k.doScrollPos(e,t,o)},this.doScrollTop=function(e,o){var t=k.getScrollLeft();k.doScrollPos(t,e,o)},this.doScrollPos=function(e,o,t){var r=e>k.page.maxw?k.page.maxw:e;r<0&&(r=0);var i=o>k.page.maxh?k.page.maxh:o;i<0&&(i=0),k.synched("scroll",function(){k.setScrollTop(i),k.setScrollLeft(r)})},this.cancelScroll=function(){};this.doScrollBy=function(e,o){S(0,e)},this.doScrollLeftBy=function(e,o){S(e,0)},this.doScrollTo=function(e,o){var t=o?Math.round(e*k.scrollratio.y):e;t<0?t=0:t>k.page.maxh&&(t=k.page.maxh),k.cursorfreezed=!1,k.doScrollTop(e)},this.checkContentSize=function(){var e=k.getContentSize();e.h==k.page.h&&e.w==k.page.w||k.resize(!1,e)},k.onscroll=function(e){k.rail.drag||k.cursorfreezed||k.synched("scroll",function(){k.scroll.y=Math.round(k.getScrollTop()/k.scrollratio.y),k.railh&&(k.scroll.x=Math.round(k.getScrollLeft()/k.scrollratio.x)),k.noticeCursor()})},k.bind(k.docscroll,"scroll",k.onscroll),this.doZoomIn=function(e){if(!k.zoomactive){k.zoomactive=!0,k.zoomrestore={style:{}};var o=["position","top","left","zIndex","backgroundColor","marginTop","marginBottom","marginLeft","marginRight"],t=k.win[0].style;for(var r in o){var i=o[r];k.zoomrestore.style[i]=void 0!==t[i]?t[i]:""}k.zoomrestore.style.width=k.win.css("width"),k.zoomrestore.style.height=k.win.css("height"),k.zoomrestore.padding={w:k.win.outerWidth()-k.win.width(),h:k.win.outerHeight()-k.win.height()},C.isios4&&(k.zoomrestore.scrollTop=c.scrollTop(),c.scrollTop(0)),k.win.css({position:C.isios4?"absolute":"fixed",top:0,left:0,zIndex:s+100,margin:0});var n=k.win.css("backgroundColor");return(""===n||/transparent|rgba\(0, 0, 0, 0\)|rgba\(0,0,0,0\)/.test(n))&&k.win.css("backgroundColor","#fff"),k.rail.css({zIndex:s+101}),k.zoom.css({zIndex:s+102}),k.zoom.css("backgroundPosition","0 -18px"),k.resizeZoom(),k.onzoomin&&k.onzoomin.call(k),k.cancelEvent(e)}},this.doZoomOut=function(e){if(k.zoomactive)return k.zoomactive=!1,k.win.css("margin",""),k.win.css(k.zoomrestore.style),C.isios4&&c.scrollTop(k.zoomrestore.scrollTop),k.rail.css({"z-index":k.zindex}),k.zoom.css({"z-index":k.zindex}),k.zoomrestore=!1,k.zoom.css("backgroundPosition","0 0"),k.onResize(),k.onzoomout&&k.onzoomout.call(k),k.cancelEvent(e)},this.doZoom=function(e){return k.zoomactive?k.doZoomOut(e):k.doZoomIn(e)},this.resizeZoom=function(){if(k.zoomactive){var e=k.getScrollTop();k.win.css({width:c.width()-k.zoomrestore.padding.w+"px",height:c.height()-k.zoomrestore.padding.h+"px"}),k.onResize(),k.setScrollTop(Math.min(k.page.maxh,e))}},this.init(),n.nicescroll.push(this)},b=function(e){var o=this;this.nc=e,this.lastx=0,this.lasty=0,this.speedx=0,this.speedy=0,this.lasttime=0,this.steptime=0,this.snapx=!1,this.snapy=!1,this.demulx=0,this.demuly=0,this.lastscrollx=-1,this.lastscrolly=-1,this.chkx=0,this.chky=0,this.timer=0,this.reset=function(e,t){o.stop(),o.steptime=0,o.lasttime=m(),o.speedx=0,o.speedy=0,o.lastx=e,o.lasty=t,o.lastscrollx=-1,o.lastscrolly=-1},this.update=function(e,t){var r=m();o.steptime=r-o.lasttime,o.lasttime=r;var i=t-o.lasty,s=e-o.lastx,n=o.nc.getScrollTop()+i,l=o.nc.getScrollLeft()+s;o.snapx=l<0||l>o.nc.page.maxw,o.snapy=n<0||n>o.nc.page.maxh,o.speedx=s,o.speedy=i,o.lastx=e,o.lasty=t},this.stop=function(){o.nc.unsynched("domomentum2d"),o.timer&&clearTimeout(o.timer),o.timer=0,o.lastscrollx=-1,o.lastscrolly=-1},this.doSnapy=function(e,t){var r=!1;t<0?(t=0,r=!0):t>o.nc.page.maxh&&(t=o.nc.page.maxh,r=!0),e<0?(e=0,r=!0):e>o.nc.page.maxw&&(e=o.nc.page.maxw,r=!0),r?o.nc.doScrollPos(e,t,o.nc.opt.snapbackspeed):o.nc.triggerScrollEnd()},this.doMomentum=function(e){var t=m(),r=e?t+e:o.lasttime,i=o.nc.getScrollLeft(),s=o.nc.getScrollTop(),n=o.nc.page.maxh,l=o.nc.page.maxw;o.speedx=l>0?Math.min(60,o.speedx):0,o.speedy=n>0?Math.min(60,o.speedy):0;var a=r&&t-r<=60;(s<0||s>n||i<0||i>l)&&(a=!1);var c=!(!o.speedy||!a)&&o.speedy,d=!(!o.speedx||!a)&&o.speedx;if(c||d){var u=Math.max(16,o.steptime);if(u>50){var h=u/50;o.speedx*=h,o.speedy*=h,u=50}o.demulxy=0,o.lastscrollx=o.nc.getScrollLeft(),o.chkx=o.lastscrollx,o.lastscrolly=o.nc.getScrollTop(),o.chky=o.lastscrolly;var p=o.lastscrollx,f=o.lastscrolly,g=function(){var e=m()-t>600?.04:.02;o.speedx&&(p=Math.floor(o.lastscrollx-o.speedx*(1-o.demulxy)),o.lastscrollx=p,(p<0||p>l)&&(e=.1)),o.speedy&&(f=Math.floor(o.lastscrolly-o.speedy*(1-o.demulxy)),o.lastscrolly=f,(f<0||f>n)&&(e=.1)),o.demulxy=Math.min(1,o.demulxy+e),o.nc.synched("domomentum2d",function(){if(o.speedx){o.nc.getScrollLeft();o.chkx=p,o.nc.setScrollLeft(p)}if(o.speedy){o.nc.getScrollTop();o.chky=f,o.nc.setScrollTop(f)}o.timer||(o.nc.hideCursor(),o.doSnapy(p,f))}),o.demulxy<1?o.timer=setTimeout(g,u):(o.stop(),o.nc.hideCursor(),o.doSnapy(p,f))};g()}else o.doSnapy(o.nc.getScrollLeft(),o.nc.getScrollTop())}},y=e.fn.scrollTop;e.cssHooks.pageYOffset={get:function(e,o,t){var r=n.data(e,"__nicescroll")||!1;return r&&r.ishwscroll?r.getScrollTop():y.call(e)},set:function(e,o){var t=n.data(e,"__nicescroll")||!1;return t&&t.ishwscroll?t.setScrollTop(parseInt(o)):y.call(e,o),this}},e.fn.scrollTop=function(e){if(void 0===e){var o=!!this[0]&&(n.data(this[0],"__nicescroll")||!1);return o&&o.ishwscroll?o.getScrollTop():y.call(this)}return this.each(function(){var o=n.data(this,"__nicescroll")||!1;o&&o.ishwscroll?o.setScrollTop(parseInt(e)):y.call(n(this),e)})};var x=e.fn.scrollLeft;n.cssHooks.pageXOffset={get:function(e,o,t){var r=n.data(e,"__nicescroll")||!1;return r&&r.ishwscroll?r.getScrollLeft():x.call(e)},set:function(e,o){var t=n.data(e,"__nicescroll")||!1;return t&&t.ishwscroll?t.setScrollLeft(parseInt(o)):x.call(e,o),this}},e.fn.scrollLeft=function(e){if(void 0===e){var o=!!this[0]&&(n.data(this[0],"__nicescroll")||!1);return o&&o.ishwscroll?o.getScrollLeft():x.call(this)}return this.each(function(){var o=n.data(this,"__nicescroll")||!1;o&&o.ishwscroll?o.setScrollLeft(parseInt(e)):x.call(n(this),e)})};var S=function(e){var o=this;if(this.length=0,this.name="nicescrollarray",this.each=function(e){return n.each(o,e),o},this.push=function(e){o[o.length]=e,o.length++},this.eq=function(e){return o[e]},e)for(var t=0;t1?n(e,r):s,i.win=r}!("doc"in i)||"win"in i||(i.win=r);var l=r.data("__nicescroll")||!1;l||(i.doc=i.doc||r,l=new w(i,r),r.data("__nicescroll",l)),t.push(l)}),1===t.length?t[0]:t},a.NiceScroll={getjQuery:function(){return e}},n.nicescroll||(n.nicescroll=new S,n.nicescroll.options=f)}); \ No newline at end of file From 7862a2d5f381cb63e988d46802b93ff1ac81111a Mon Sep 17 00:00:00 2001 From: Andrea Tosone Date: Wed, 28 Jun 2017 12:42:13 +0200 Subject: [PATCH 03/14] RC2 - changed scrollbarid setting procedure because uglify mades uncompatible code for IE8 aka use nicescroll in IE8 #672 - preserve scrol chain --- changelog_3.7.4.txt | 6 ++-- jquery.nicescroll.js | 67 +++++++++++++++++++++++----------------- jquery.nicescroll.min.js | 4 +-- 3 files changed, 44 insertions(+), 33 deletions(-) diff --git a/changelog_3.7.4.txt b/changelog_3.7.4.txt index 5ecc1cd..2db2419 100644 --- a/changelog_3.7.4.txt +++ b/changelog_3.7.4.txt @@ -6,11 +6,13 @@ https://github.com/inuyaksa/jquery.nicescroll Fixes - touchpad scrolling support for MS Surface aka FYI - Browser test results on Surface Pro touchscreen and touchpad #668 - +- changed scrollbarid setting procedure because uglify mades uncompatible code for IE8 aka use nicescroll in IE8 #672 +- preserve scrol chain Changes - more responsive direct scrolling from bars +- more consistence scrolling speed on many browsers (Chrome, Firefox, Edge) - minor code optimizations and jshint check - jQuery "bind" event function changed to "on", migration to jQuery 3 (still jQuery 1 compatible) #361 - Using jQuery.expr.pseudos, migration to jQuery 3 (still jQuery 1 compatible) #361 -- changed arguments for doScrollBy and doScrollLeftBy +- changed arguments for doScrollBy and doScrollLeftBy \ No newline at end of file diff --git a/jquery.nicescroll.js b/jquery.nicescroll.js index 59a4e62..645cbb6 100644 --- a/jquery.nicescroll.js +++ b/jquery.nicescroll.js @@ -1,5 +1,5 @@ /* jquery.nicescroll --- version 3.7.4-c [DEV REL] +-- version 3.7.4-d [DEV REL] -- copyright 2017-06-18 InuYaksa*2017 -- licensed under the MIT -- @@ -76,7 +76,7 @@ cursorborder: "1px solid #fff", cursorborderradius: "5px", scrollspeed: 40, - mousescrollstep: 8 * 3, + mousescrollstep: 9 * 3, touchbehavior: false, // deprecated emulatetouch: false, // replacing touchbehavior hwacceleration: true, @@ -260,7 +260,7 @@ var self = this; - this.version = '3.7.4-c'; + this.version = '3.7.4-d'; this.name = 'nicescroll'; this.me = me; @@ -364,12 +364,12 @@ this.observerremover = false; // observer on parent for remove detection this.observerbody = false; // observer on body for position change - if (self.opt.scrollbarid === false) { + if (self.opt.scrollbarid !== false) { + this.id = self.opt.scrollbarid; + } else { do { this.id = "ascrail" + (ascrailcounter++); } while (_doc.getElementById(this.id)); - } else { - this.id = self.opt.scrollbarid; } this.rail = false; @@ -506,21 +506,22 @@ }; BezierClass.prototype = { B2: function (t) { - return 3 * t * t * (1 - t); + //return 3 * t * t * (1 - t); + return 3 * (1 - t) * (1 - t) * t; }, B3: function (t) { - return 3 * t * (1 - t) * (1 - t); + return 3 * (1 - t) * t * t; }, B4: function (t) { - return (1 - t) * (1 - t) * (1 - t); + return t * t * t; }, getPos: function () { return (now() - this.ts) / this.spd; }, getNow: function () { - var pc = 1 - ((now() - this.ts) / this.spd); + var pc = (now() - this.ts) / this.spd; var bz = this.B2(pc) + this.B3(pc) + this.B4(pc); - return (pc < 0) ? this.ed : this.st + (this.df * bz) | 0; + return (pc >= 1) ? this.ed : this.st + (this.df * bz) | 0; }, update: function (ed, spd) { this.st = this.getNow(); @@ -541,8 +542,8 @@ return false; } - if (this.ishwscroll) { - // hw accelerated scroll + if (this.ishwscroll) { // hw accelerated scroll + this.doc.translate = { x: 0, y: 0, @@ -607,15 +608,15 @@ if (!silent) self.notifyScrollEvent(self.win[0]); }; } - } else { - // native scroll + } else { // native scroll + this.getScrollTop = function () { return self.docscroll.scrollTop(); }; this.setScrollTop = function (val) { - //return setTimeout(function () { self && self.docscroll.scrollTop(val); }, 1); self.docscroll.scrollTop(val); }; + this.getScrollLeft = function () { var val; if (!self.hasreversehr) { @@ -2789,7 +2790,7 @@ })(); if (chk) { - if (!self.scrollrunning && self.opt.nativeparentscrolling && chkscroll && !self.ispage && !self.zoomactive) return true; + if (self.opt.nativeparentscrolling && chkscroll && !self.ispage && !self.zoomactive) return true; var ny = self.view.h >> 1; if (self.newscrolly < -ny) { self.newscrolly = -ny; py = -1; } else if (self.newscrolly > self.page.maxh + ny) { self.newscrolly = self.page.maxh + ny; py = 1; } @@ -2824,15 +2825,19 @@ } + var hasparentscrollingphase = false; + function execScrollWheel(e, hr, chkscroll) { var px, py; + if (!chkscroll && hasparentscrollingphase) return true; + if (e.deltaMode === 0) { // PIXEL px = -(e.deltaX * (self.opt.mousescrollstep / (18 * 3))) | 0; py = -(e.deltaY * (self.opt.mousescrollstep / (18 * 3))) | 0; } else if (e.deltaMode === 1) { // LINE - px = -(e.deltaX * self.opt.mousescrollstep) | 0; - py = -(e.deltaY * self.opt.mousescrollstep) | 0; + px = -(e.deltaX * self.opt.mousescrollstep * 50 / 80) | 0; + py = -(e.deltaY * self.opt.mousescrollstep * 50 / 80) | 0; } if (hr && self.opt.oneaxismousemode && (px === 0) && py) { // classic vertical-only mousewheel + browser with x/y support @@ -2852,10 +2857,16 @@ // invert horizontal direction for rtl mode if (self.isrtlmode) px = -px; - doScrollRelative(px, py, chkscroll, true); + var chk = doScrollRelative(px, py, chkscroll, true); + + if (chk) { + if (chkscroll) hasparentscrollingphase = true; + } else { + hasparentscrollingphase = false; + e.stopImmediatePropagation(); + return e.preventDefault(); + } - e.stopImmediatePropagation(); - return e.preventDefault(); } this.onmousewheel = function (e) { @@ -3201,15 +3212,13 @@ var ms = self.getTransitionSpeed(dd); self.bzscroll = {}; - if (clipped) { - self.bzscroll.x = new BezierClass(px, self.newscrollx, ms, 0, 0, 1, 1); - self.bzscroll.y = new BezierClass(py, self.newscrolly, ms, 0, 0, 1, 1); - } else { - self.bzscroll.x = new BezierClass(px, self.newscrollx, ms, 0, 0, 0.58, 1); //0, 1, 0, 1 - self.bzscroll.y = new BezierClass(py, self.newscrolly, ms, 0, 0, 0.58, 1); - } + + var p3 = (clipped) ? 1 : 0.58; + self.bzscroll.x = new BezierClass(px, self.newscrollx, ms, 0, 0, p3, 1); + self.bzscroll.y = new BezierClass(py, self.newscrolly, ms, 0, 0, p3, 1); var loop = function () { + if (!self.scrollrunning) return; var x = self.bzscroll.y.getPos(); diff --git a/jquery.nicescroll.min.js b/jquery.nicescroll.min.js index ed405ed..f5efb2e 100644 --- a/jquery.nicescroll.min.js +++ b/jquery.nicescroll.min.js @@ -1,2 +1,2 @@ -/* nicescroll v3.7.4-c [DEV REL] InuYaksa - MIT - https://nicescroll.areaaperta.com */ -!function(e){"function"==typeof define&&define.amd?define(["jquery"],e):"object"==typeof exports?module.exports=e(require("jquery")):e(jQuery)}(function(e){"use strict";var o=!1,t=!1,r=0,i=2e3,s=0,n=e,l=document,a=window,c=n(a),d=a.requestAnimationFrame||a.webkitRequestAnimationFrame||a.mozRequestAnimationFrame||!1,u=a.cancelAnimationFrame||a.webkitCancelAnimationFrame||a.mozCancelAnimationFrame||!1;if(d)a.cancelAnimationFrame||(u=function(e){});else{var h=0;d=function(e,o){var t=(new Date).getTime(),r=Math.max(0,16-(t-h)),i=a.setTimeout(function(){e(t+r)},r);return h=t+r,i},u=function(e){a.clearTimeout(e)}}var p=a.MutationObserver||a.WebKitMutationObserver||!1,m=Date.now||function(){return(new Date).getTime()},f={zindex:"auto",cursoropacitymin:0,cursoropacitymax:1,cursorcolor:"#424242",cursorwidth:"6px",cursorborder:"1px solid #fff",cursorborderradius:"5px",scrollspeed:40,mousescrollstep:24,touchbehavior:!1,emulatetouch:!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 e=l.currentScript||function(){var e=l.getElementsByTagName("script");return!!e.length&&e[e.length-1]}(),o=e?e.src.split("?")[0]:"";return o.split("/").length>0?o.split("/").slice(0,-1).join("/")+"/":""}(),preventmultitouchscrolling:!0,disablemutationobserver:!1,enableobserver:!0,scrollbarid:!1},g=!1,v=function(){if(g)return g;var e=l.createElement("DIV"),o=e.style,t=navigator.userAgent,r=navigator.platform,i={};return i.haspointerlock="pointerLockElement"in l||"webkitPointerLockElement"in l||"mozPointerLockElement"in l,i.isopera="opera"in a,i.isopera12=i.isopera&&"getUserMedia"in navigator,i.isoperamini="[object OperaMini]"===Object.prototype.toString.call(a.operamini),i.isie="all"in l&&"attachEvent"in e&&!i.isopera,i.isieold=i.isie&&!("msInterpolationMode"in o),i.isie7=i.isie&&!i.isieold&&(!("documentMode"in l)||7===l.documentMode),i.isie8=i.isie&&"documentMode"in l&&8===l.documentMode,i.isie9=i.isie&&"performance"in a&&9===l.documentMode,i.isie10=i.isie&&"performance"in a&&10===l.documentMode,i.isie11="msRequestFullscreen"in e&&l.documentMode>=11,i.ismsedge="msCredentials"in a,i.ismozilla="MozAppearance"in o,i.iswebkit=!i.ismsedge&&"WebkitAppearance"in o,i.ischrome=i.iswebkit&&"chrome"in a,i.ischrome38=i.ischrome&&"touchAction"in o,i.ischrome22=!i.ischrome38&&i.ischrome&&i.haspointerlock,i.ischrome26=!i.ischrome38&&i.ischrome&&"transition"in o,i.cantouch="ontouchstart"in l.documentElement||"ontouchstart"in a,i.hasw3ctouch=(a.PointerEvent||!1)&&(navigator.MaxTouchPoints>0||navigator.msMaxTouchPoints>0),i.hasmstouch=!i.hasw3ctouch&&(a.MSPointerEvent||!1),i.ismac=/^mac$/i.test(r),i.isios=i.cantouch&&/iphone|ipad|ipod/i.test(r),i.isios4=i.isios&&!("seal"in Object),i.isios7=i.isios&&"webkitHidden"in l,i.isios8=i.isios&&"hidden"in l,i.isios10=i.isios&&a.Proxy,i.isandroid=/android/i.test(t),i.haseventlistener="addEventListener"in e,i.trstyle=!1,i.hastransform=!1,i.hastranslate3d=!1,i.transitionstyle=!1,i.hastransition=!1,i.transitionend=!1,i.trstyle="transform",i.hastransform="transform"in o||function(){for(var e=["msTransform","webkitTransform","MozTransform","OTransform"],t=0,r=e.length;t0;){if(9==e[0].nodeType)return!1;var o=e.css("zIndex");if(!isNaN(o)&&0!==o)return parseInt(o);e=e.parent()}return!1}function y(e,o,t){var r=e.css(o),i=parseFloat(r);if(isNaN(i)){var s=3==(i=R[r]||0)?t?k.win.outerHeight()-k.win.innerHeight():k.win.outerWidth()-k.win.innerWidth():1;return k.isie8&&i&&(i+=1),s?i:0}return i}function x(e,o,t,r){k._bind(e,o,function(r){var i={original:r=r||a.event,target:r.target||r.srcElement,type:"wheel",deltaMode:"MozMousePixelScroll"==r.type?0:1,deltaX:0,deltaZ:0,preventDefault:function(){return r.preventDefault?r.preventDefault():r.returnValue=!1,!1},stopImmediatePropagation:function(){r.stopImmediatePropagation?r.stopImmediatePropagation():r.cancelBubble=!0}};return"mousewheel"==o?(r.wheelDeltaX&&(i.deltaX=-.025*r.wheelDeltaX),r.wheelDeltaY&&(i.deltaY=-.025*r.wheelDeltaY),!i.deltaY&&!i.deltaX&&(i.deltaY=-.025*r.wheelDelta)):i.deltaY=r.detail,t.call(e,i)},r)}function S(e,o,t,r){k.scrollrunning||(k.newscrolly=k.getScrollTop(),k.newscrollx=k.getScrollLeft(),Y=m());var i=m()-Y;if(Y=m(),i>350?B=1:B+=(2-B)/10,e=e*B|0,o=o*B|0,e){if(r)if(e<0){if(k.getScrollLeft()>=k.page.maxw)return!0}else if(k.getScrollLeft()<=0)return!0;var s=e>0?1:-1;O!==s&&(k.scrollmom&&k.scrollmom.stop(),k.newscrollx=k.getScrollLeft(),O=s),k.lastdeltax-=e}if(o){if(function(){var e=k.getScrollTop();if(o<0){if(e>=k.page.maxh)return!0}else if(e<=0)return!0}()){if(!k.scrollrunning&&k.opt.nativeparentscrolling&&t&&!k.ispage&&!k.zoomactive)return!0;var n=k.view.h>>1;k.newscrolly<-n?(k.newscrolly=-n,o=-1):k.newscrolly>k.page.maxh+n?(k.newscrolly=k.page.maxh+n,o=1):o=0}var l=o>0?1:-1;I!==l&&(k.scrollmom&&k.scrollmom.stop(),k.newscrolly=k.getScrollTop(),I=l),k.lastdeltay-=o}(o||e)&&k.synched("relativexy",function(){var e=k.lastdeltay+k.newscrolly;k.lastdeltay=0;var o=k.lastdeltax+k.newscrollx;k.lastdeltax=0,k.rail.drag||k.doScrollPos(o,e)})}function z(e,o,t){var r,i;return 0===e.deltaMode?(r=-e.deltaX*(k.opt.mousescrollstep/54)|0,i=-e.deltaY*(k.opt.mousescrollstep/54)|0):1===e.deltaMode&&(r=-e.deltaX*k.opt.mousescrollstep|0,i=-e.deltaY*k.opt.mousescrollstep|0),o&&k.opt.oneaxismousemode&&0===r&&i&&(r=i,i=0,t&&(r<0?k.getScrollLeft()>=k.page.maxw:k.getScrollLeft()<=0)&&(i=r,r=0)),k.isrtlmode&&(r=-r),S(r,i,t,!0),e.stopImmediatePropagation(),e.preventDefault()}var k=this;this.version="3.7.4-c",this.name="nicescroll",this.me=h;var T=n("body");if(this.opt={doc:T,win:!1},n.extend(this.opt,f),this.opt.snapbackspeed=80,e)for(var E in k.opt)void 0!==e[E]&&(k.opt[E]=e[E]);if(k.opt.disablemutationobserver&&(p=!1),this.doc=k.opt.doc,this.iddoc=this.doc&&this.doc[0]?this.doc[0].id||"":"",this.ispage=/^BODY|HTML/.test(k.opt.win?k.opt.win[0].nodeName:this.doc[0].nodeName),this.haswrapper=!1!==k.opt.win,this.win=k.opt.win||(this.ispage?c:this.doc),this.docscroll=this.ispage&&!this.haswrapper?c:this.win,this.body=T,this.viewport=!1,this.isfixed=!1,this.iframe=!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"!=k.opt.autohidemode,this.onmousedown=!1,this.onmouseup=!1,this.onmousemove=!1,this.onmousewheel=!1,this.onkeypress=!1,this.ongesturezoom=!1,this.onclick=!1,this.onscrollstart=!1,this.onscrollend=!1,this.onscrollcancel=!1,this.onzoomin=!1,this.onzoomout=!1,this.view=!1,this.page=!1,this.scroll={x:0,y:0},this.scrollratio={x:0,y:0},this.cursorheight=20,this.scrollvaluemax=0,"auto"==this.opt.rtlmode){var M=this.win[0]==a?this.body:this.win,L=M.css("writing-mode")||M.css("-webkit-writing-mode")||M.css("-ms-writing-mode")||M.css("-moz-writing-mode");"horizontal-tb"==L||"lr-tb"==L||""===L?(this.isrtlmode="rtl"==M.css("direction"),this.isvertical=!1):(this.isrtlmode="vertical-rl"==L||"tb"==L||"tb-rl"==L||"rl-tb"==L,this.isvertical="vertical-rl"==L||"tb"==L||"tb-rl"==L)}else this.isrtlmode=!0===this.opt.rtlmode,this.isvertical=!1;if(this.scrollrunning=!1,this.scrollmom=!1,this.observer=!1,this.observerremover=!1,this.observerbody=!1,!1===k.opt.scrollbarid)do{this.id="ascrail"+i++}while(l.getElementById(this.id));else this.id=k.opt.scrollbarid;this.rail=!1,this.cursor=!1,this.cursorfreezed=!1,this.selectiondrag=!1,this.zoom=!1,this.zoomactive=!1,this.hasfocus=!1,this.hasmousefocus=!1,this.visibility=!0,this.railslocked=!1,this.locked=!1,this.hidden=!1,this.cursoractive=!0,this.wheelprevented=!1,this.overflowx=k.opt.overflowx,this.overflowy=k.opt.overflowy,this.nativescrollingarea=!1,this.checkarea=0,this.events=[],this.saved={},this.delaylist={},this.synclist={},this.lastdeltax=0,this.lastdeltay=0,this.detected=v();var C=n.extend({},this.detected);this.canhwscroll=C.hastransform&&k.opt.hwacceleration,this.ishwscroll=this.canhwscroll&&k.haswrapper,this.isrtlmode?this.isvertical?this.hasreversehr=!(C.iswebkit||C.isie||C.isie11):this.hasreversehr=!(C.iswebkit||C.isie&&!C.isie10&&!C.isie11):this.hasreversehr=!1,this.istouchcapable=!1,C.cantouch||!C.hasw3ctouch&&!C.hasmstouch?!C.cantouch||C.isios||C.isandroid||!C.iswebkit&&!C.ismozilla||(this.istouchcapable=!0):this.istouchcapable=!0,k.opt.enablemouselockapi||(C.hasmousecapture=!1,C.haspointerlock=!1),this.debounced=function(e,o,t){k&&(k.delaylist[e]||!1||(k.delaylist[e]={h:d(function(){k.delaylist[e].fn.call(k),k.delaylist[e]=!1},t)},o.call(k)),k.delaylist[e].fn=o)},this.synched=function(e,o){k.synclist[e]?k.synclist[e]=o:(k.synclist[e]=o,d(function(){k&&(k.synclist[e]&&k.synclist[e].call(k),k.synclist[e]=null)}))},this.unsynched=function(e){k.synclist[e]&&(k.synclist[e]=!1)},this.css=function(e,o){for(var t in o)k.saved.css.push([e,t,e.css(t)]),e.css(t,o[t])},this.scrollTop=function(e){return void 0===e?k.getScrollTop():k.setScrollTop(e)},this.scrollLeft=function(e){return void 0===e?k.getScrollLeft():k.setScrollLeft(e)};var N=function(e,o,t,r,i,s,n){this.st=e,this.ed=o,this.spd=t,this.p1=r||0,this.p2=i||1,this.p3=s||0,this.p4=n||1,this.ts=m(),this.df=o-e};if(N.prototype={B2:function(e){return 3*e*e*(1-e)},B3:function(e){return 3*e*(1-e)*(1-e)},B4:function(e){return(1-e)*(1-e)*(1-e)},getPos:function(){return(m()-this.ts)/this.spd},getNow:function(){var e=1-(m()-this.ts)/this.spd,o=this.B2(e)+this.B3(e)+this.B4(e);return e<0?this.ed:this.st+this.df*o|0},update:function(e,o){return this.st=this.getNow(),this.ed=e,this.spd=o,this.ts=m(),this.df=this.ed-this.st,this}},this.ishwscroll){this.doc.translate={x:0,y:0,tx:"0px",ty:"0px"},C.hastranslate3d&&C.isios&&this.doc.css("-webkit-backface-visibility","hidden"),this.getScrollTop=function(e){if(!e){var o=g();if(o)return 16==o.length?-o[13]:-o[5];if(k.timerscroll&&k.timerscroll.bz)return k.timerscroll.bz.getNow()}return k.doc.translate.y},this.getScrollLeft=function(e){if(!e){var o=g();if(o)return 16==o.length?-o[12]:-o[4];if(k.timerscroll&&k.timerscroll.bh)return k.timerscroll.bh.getNow()}return k.doc.translate.x},this.notifyScrollEvent=function(e){var o=l.createEvent("UIEvents");o.initUIEvent("scroll",!1,!0,a,1),o.niceevent=!0,e.dispatchEvent(o)};var P=this.isrtlmode?1:-1;C.hastranslate3d&&k.opt.enabletranslate3d?(this.setScrollTop=function(e,o){k.doc.translate.y=e,k.doc.translate.ty=-1*e+"px",k.doc.css(C.trstyle,"translate3d("+k.doc.translate.tx+","+k.doc.translate.ty+",0)"),o||k.notifyScrollEvent(k.win[0])},this.setScrollLeft=function(e,o){k.doc.translate.x=e,k.doc.translate.tx=e*P+"px",k.doc.css(C.trstyle,"translate3d("+k.doc.translate.tx+","+k.doc.translate.ty+",0)"),o||k.notifyScrollEvent(k.win[0])}):(this.setScrollTop=function(e,o){k.doc.translate.y=e,k.doc.translate.ty=-1*e+"px",k.doc.css(C.trstyle,"translate("+k.doc.translate.tx+","+k.doc.translate.ty+")"),o||k.notifyScrollEvent(k.win[0])},this.setScrollLeft=function(e,o){k.doc.translate.x=e,k.doc.translate.tx=e*P+"px",k.doc.css(C.trstyle,"translate("+k.doc.translate.tx+","+k.doc.translate.ty+")"),o||k.notifyScrollEvent(k.win[0])})}else this.getScrollTop=function(){return k.docscroll.scrollTop()},this.setScrollTop=function(e){k.docscroll.scrollTop(e)},this.getScrollLeft=function(){return k.hasreversehr?k.detected.ismozilla?k.page.maxw-Math.abs(k.docscroll.scrollLeft()):k.page.maxw-k.docscroll.scrollLeft():k.docscroll.scrollLeft()},this.setScrollLeft=function(e){return setTimeout(function(){if(k)return k.hasreversehr&&(e=k.detected.ismozilla?-(k.page.maxw-e):k.page.maxw-e),k.docscroll.scrollLeft(e)},1)};this.getTarget=function(e){return!!e&&(e.target?e.target:!!e.srcElement&&e.srcElement)},this.hasParent=function(e,o){if(!e)return!1;for(var t=e.target||e.srcElement||e||!1;t&&t.id!=o;)t=t.parentNode||!1;return!1!==t};var R={thin:1,medium:3,thick:5};this.getDocumentScrollOffset=function(){return{top:a.pageYOffset||l.documentElement.scrollTop,left:a.pageXOffset||l.documentElement.scrollLeft}},this.getOffset=function(){if(k.isfixed){var e=k.win.offset(),o=k.getDocumentScrollOffset();return e.top-=o.top,e.left-=o.left,e}var t=k.win.offset();if(!k.viewport)return t;var r=k.viewport.offset();return{top:t.top-r.top,left:t.left-r.left}},this.updateScrollBar=function(e){var o,t;if(k.ishwscroll)k.rail.css({height:k.win.innerHeight()-(k.opt.railpadding.top+k.opt.railpadding.bottom)}),k.railh&&k.railh.css({width:k.win.innerWidth()-(k.opt.railpadding.left+k.opt.railpadding.right)});else{var r=k.getOffset();if(o={top:r.top,left:r.left-(k.opt.railpadding.left+k.opt.railpadding.right)},o.top+=y(k.win,"border-top-width",!0),o.left+=k.rail.align?k.win.outerWidth()-y(k.win,"border-right-width")-k.rail.width:y(k.win,"border-left-width"),(t=k.opt.railoffset)&&(t.top&&(o.top+=t.top),t.left&&(o.left+=t.left)),k.railslocked||k.rail.css({top:o.top,left:o.left,height:(e?e.h:k.win.innerHeight())-(k.opt.railpadding.top+k.opt.railpadding.bottom)}),k.zoom&&k.zoom.css({top:o.top+1,left:1==k.rail.align?o.left-20:o.left+k.rail.width+4}),k.railh&&!k.railslocked){o={top:r.top,left:r.left},(t=k.opt.railhoffset)&&(t.top&&(o.top+=t.top),t.left&&(o.left+=t.left));var i=k.railh.align?o.top+y(k.win,"border-top-width",!0)+k.win.innerHeight()-k.railh.height:o.top+y(k.win,"border-top-width",!0),s=o.left+y(k.win,"border-left-width");k.railh.css({top:i-(k.opt.railpadding.top+k.opt.railpadding.bottom),left:s,width:k.railh.width})}}},this.doRailClick=function(e,o,t){var r,i,s,n;k.railslocked||(k.cancelEvent(e),"pageY"in e||(e.pageX=e.clientX+l.documentElement.scrollLeft,e.pageY=e.clientY+l.documentElement.scrollTop),o?(r=t?k.doScrollLeft:k.doScrollTop)(s=t?(e.pageX-k.railh.offset().left-k.cursorwidth/2)*k.scrollratio.x:(e.pageY-k.rail.offset().top-k.cursorheight/2)*k.scrollratio.y):(r=t?k.doScrollLeftBy:k.doScrollBy,s=t?k.scroll.x:k.scroll.y,n=t?e.pageX-k.railh.offset().left:e.pageY-k.rail.offset().top,i=t?k.view.w:k.view.h,r(s>=n?i:-i)))},k.newscrolly=k.newscrollx=0,k.hasanimationframe="requestAnimationFrame"in a,k.hascancelanimationframe="cancelAnimationFrame"in a,k.hasborderbox=!1,this.init=function(){if(k.saved.css=[],C.isoperamini)return!0;if(C.isandroid&&!("hidden"in l))return!0;k.opt.emulatetouch=k.opt.emulatetouch||k.opt.touchbehavior,k.hasborderbox=a.getComputedStyle&&"border-box"===a.getComputedStyle(l.body)["box-sizing"];var e={"overflow-y":"hidden"};if((C.isie11||C.isie10)&&(e["-ms-overflow-style"]="none"),k.ishwscroll&&(this.doc.css(C.transitionstyle,C.prefixstyle+"transform 0ms ease-out"),C.transitionend&&k.bind(k.doc,C.transitionend,k.onScrollTransitionEnd,!1)),k.zindex="auto",k.ispage||"auto"!=k.opt.zindex?k.zindex=k.opt.zindex:k.zindex=w()||"auto",!k.ispage&&"auto"!=k.zindex&&k.zindex>s&&(s=k.zindex),k.isie&&0===k.zindex&&"auto"==k.opt.zindex&&(k.zindex="auto"),!k.ispage||!C.cantouch&&!C.isieold){var i=k.docscroll;k.ispage&&(i=k.haswrapper?k.win:k.doc),k.css(i,e),k.ispage&&(C.isie11||C.isie)&&k.css(n("html"),e),!C.isios||k.ispage||k.haswrapper||k.css(T,{"-webkit-overflow-scrolling":"touch"});var d=n(l.createElement("div"));d.css({position:"relative",top:0,float:"right",width:k.opt.cursorwidth,height:0,"background-color":k.opt.cursorcolor,border:k.opt.cursorborder,"background-clip":"padding-box","-webkit-border-radius":k.opt.cursorborderradius,"-moz-border-radius":k.opt.cursorborderradius,"border-radius":k.opt.cursorborderradius}),d.addClass("nicescroll-cursors"),k.cursor=d;var u=n(l.createElement("div"));u.attr("id",k.id),u.addClass("nicescroll-rails nicescroll-rails-vr");var h,m,f=["left","right","top","bottom"];for(var g in f)m=f[g],(h=k.opt.railpadding[m]||0)&&u.css("padding-"+m,h+"px");u.append(d),u.width=Math.max(parseFloat(k.opt.cursorwidth),d.outerWidth()),u.css({width:u.width+"px",zIndex:k.zindex,background:k.opt.background,cursor:"default"}),u.visibility=!0,u.scrollable=!0,u.align="left"==k.opt.railalign?0:1,k.rail=u,k.rail.drag=!1;var v=!1;!k.opt.boxzoom||k.ispage||C.isieold||(v=l.createElement("div"),k.bind(v,"click",k.doZoom),k.bind(v,"mouseenter",function(){k.zoom.css("opacity",k.opt.cursoropacitymax)}),k.bind(v,"mouseleave",function(){k.zoom.css("opacity",k.opt.cursoropacitymin)}),k.zoom=n(v),k.zoom.css({cursor:"pointer",zIndex:k.zindex,backgroundImage:"url("+k.opt.scriptpath+"zoomico.png)",height:18,width:18,backgroundPosition:"0 0"}),k.opt.dblclickzoom&&k.bind(k.win,"dblclick",k.doZoom),C.cantouch&&k.opt.gesturezoom&&(k.ongesturezoom=function(e){return e.scale>1.5&&k.doZoomIn(e),e.scale<.8&&k.doZoomOut(e),k.cancelEvent(e)},k.bind(k.win,"gestureend",k.ongesturezoom))),k.railh=!1;var y;if(k.opt.horizrailenabled&&(k.css(i,{overflowX:"hidden"}),(d=n(l.createElement("div"))).css({position:"absolute",top:0,height:k.opt.cursorwidth,width:0,backgroundColor:k.opt.cursorcolor,border:k.opt.cursorborder,backgroundClip:"padding-box","-webkit-border-radius":k.opt.cursorborderradius,"-moz-border-radius":k.opt.cursorborderradius,"border-radius":k.opt.cursorborderradius}),C.isieold&&d.css("overflow","hidden"),d.addClass("nicescroll-cursors"),k.cursorh=d,(y=n(l.createElement("div"))).attr("id",k.id+"-hr"),y.addClass("nicescroll-rails nicescroll-rails-hr"),y.height=Math.max(parseFloat(k.opt.cursorwidth),d.outerHeight()),y.css({height:y.height+"px",zIndex:k.zindex,background:k.opt.background}),y.append(d),y.visibility=!0,y.scrollable=!0,y.align="top"==k.opt.railvalign?0:1,k.railh=y,k.railh.drag=!1),k.ispage)u.css({position:"fixed",top:0,height:"100%"}),u.css(u.align?{right:0}:{left:0}),k.body.append(u),k.railh&&(y.css({position:"fixed",left:0,width:"100%"}),y.css(y.align?{bottom:0}:{top:0}),k.body.append(y));else{if(k.ishwscroll){"static"==k.win.css("position")&&k.css(k.win,{position:"relative"});var x="HTML"==k.win[0].nodeName?k.body:k.win;n(x).scrollTop(0).scrollLeft(0),k.zoom&&(k.zoom.css({position:"absolute",top:1,right:0,"margin-right":u.width+4}),x.append(k.zoom)),u.css({position:"absolute",top:0}),u.css(u.align?{right:0}:{left:0}),x.append(u),y&&(y.css({position:"absolute",left:0,bottom:0}),y.css(y.align?{bottom:0}:{top:0}),x.append(y))}else{k.isfixed="fixed"==k.win.css("position");var S=k.isfixed?"fixed":"absolute";k.isfixed||(k.viewport=k.getViewport(k.win[0])),k.viewport&&(k.body=k.viewport,/fixed|absolute/.test(k.viewport.css("position"))||k.css(k.viewport,{position:"relative"})),u.css({position:S}),k.zoom&&k.zoom.css({position:S}),k.updateScrollBar(),k.body.append(u),k.zoom&&k.body.append(k.zoom),k.railh&&(y.css({position:S}),k.body.append(y))}C.isios&&k.css(k.win,{"-webkit-tap-highlight-color":"rgba(0,0,0,0)","-webkit-touch-callout":"none"}),C.isie&&k.opt.disableoutline&&k.win.attr("hideFocus","true"),C.iswebkit&&k.opt.disableoutline&&k.win.css("outline","none")}if(!1===k.opt.autohidemode?(k.autohidedom=!1,k.rail.css({opacity:k.opt.cursoropacitymax}),k.railh&&k.railh.css({opacity:k.opt.cursoropacitymax})):!0===k.opt.autohidemode||"leave"===k.opt.autohidemode?(k.autohidedom=n().add(k.rail),C.isie8&&(k.autohidedom=k.autohidedom.add(k.cursor)),k.railh&&(k.autohidedom=k.autohidedom.add(k.railh)),k.railh&&C.isie8&&(k.autohidedom=k.autohidedom.add(k.cursorh))):"scroll"==k.opt.autohidemode?(k.autohidedom=n().add(k.rail),k.railh&&(k.autohidedom=k.autohidedom.add(k.railh))):"cursor"==k.opt.autohidemode?(k.autohidedom=n().add(k.cursor),k.railh&&(k.autohidedom=k.autohidedom.add(k.cursorh))):"hidden"==k.opt.autohidemode&&(k.autohidedom=!1,k.hide(),k.railslocked=!1),C.cantouch||k.istouchcapable||k.opt.emulatetouch||C.hasmstouch){k.scrollmom=new b(k),k.ontouchstart=function(e){if(e.pointerType&&("mouse"===e.pointerType||e.pointerType===e.MSPOINTER_TYPE_MOUSE))return!1;if(k.hasmoving=!1,!k.railslocked){var o;if(C.hasmstouch)for(o=!!e.target&&e.target;o;){var t=n(o).getNiceScroll();if(t.length>0&&t[0].me==k.me)break;if(t.length>0)return!1;if("DIV"==o.nodeName&&o.id==k.id)break;o=!!o.parentNode&&o.parentNode}if(e.stopPropagation(),k.cancelScroll(),(o=k.getTarget(e))&&/INPUT/i.test(o.nodeName)&&/range/i.test(o.type))return k.stopPropagation(e);if(!("clientX"in e)&&"changedTouches"in e&&(e.clientX=e.changedTouches[0].clientX,e.clientY=e.changedTouches[0].clientY),k.forcescreen){var r=e;(e={original:e.original?e.original:e}).clientX=r.screenX,e.clientY=r.screenY}if(k.rail.drag={x:e.clientX,y:e.clientY,sx:k.scroll.x,sy:k.scroll.y,st:k.getScrollTop(),sl:k.getScrollLeft(),pt:2,dl:!1,tg:o},k.ispage||!k.opt.directionlockdeadzone)k.rail.drag.dl="f";else{var i={w:c.width(),h:c.height()},s={w:Math.max(l.body.scrollWidth,l.documentElement.scrollWidth),h:Math.max(l.body.scrollHeight,l.documentElement.scrollHeight)},a=Math.max(0,s.h-i.h),d=Math.max(0,s.w-i.w);!k.rail.scrollable&&k.railh.scrollable?k.rail.drag.ck=a>0&&"v":k.rail.scrollable&&!k.railh.scrollable?k.rail.drag.ck=d>0&&"h":k.rail.drag.ck=!1,k.rail.drag.ck||(k.rail.drag.dl="f")}if(k.opt.emulatetouch&&k.isiframe&&C.isie){var u=k.win.position();k.rail.drag.x+=u.left,k.rail.drag.y+=u.top}if(k.hasmoving=!1,k.lastmouseup=!1,k.scrollmom.reset(e.clientX,e.clientY),!C.cantouch&&!this.istouchcapable&&!e.pointerType){if(!(!!o&&/INPUT|SELECT|BUTTON|TEXTAREA/i.test(o.nodeName)))return!k.ispage&&C.hasmousecapture&&o.setCapture(),k.opt.emulatetouch?(o.onclick&&!o._onclick&&(o._onclick=o.onclick,o.onclick=function(e){if(k.hasmoving)return!1;o._onclick.call(this,e)}),k.cancelEvent(e)):k.stopPropagation(e);/SUBMIT|CANCEL|BUTTON/i.test(n(o).attr("type"))&&(k.preventclick={tg:o,click:!1})}}},k.ontouchend=function(e){if(!k.rail.drag)return!0;if(2==k.rail.drag.pt){if(e.pointerType&&("mouse"===e.pointerType||e.pointerType===e.MSPOINTER_TYPE_MOUSE))return!1;if(k.rail.drag=!1,k.hasmoving&&(k.scrollmom.doMomentum(),k.lastmouseup=!0,k.hideCursor(),C.hasmousecapture&&l.releaseCapture(),!C.cantouch))return k.cancelEvent(e)}else if(1==k.rail.drag.pt)return k.onmouseup(e)};var z=k.opt.emulatetouch&&k.isiframe&&!C.hasmousecapture;k.ontouchmove=function(e,o){if(!k.rail.drag)return!1;if(e.targetTouches&&k.opt.preventmultitouchscrolling&&e.targetTouches.length>1)return!1;if(e.pointerType&&("mouse"===e.pointerType||e.pointerType===e.MSPOINTER_TYPE_MOUSE))return!1;if(2==k.rail.drag.pt){if("changedTouches"in e&&(e.clientX=e.changedTouches[0].clientX,e.clientY=e.changedTouches[0].clientY),k.rail.drag.y===e.clientY&&k.rail.drag.x===e.clientX)return!1;k.hasmoving||k.triggerScrollStart(e.clientX,e.clientY,0,0,0),k.hasmoving=!0,k.preventclick&&!k.preventclick.click&&(k.preventclick.click=k.preventclick.tg.onclick||!1,k.preventclick.tg.onclick=k.onpreventclick);var t,r;if(r=t=0,z&&!o){var i=k.win.position();r=-i.left,t=-i.top}var s=e.clientY+t,n=s-k.rail.drag.y,a=e.clientX+r,c=a-k.rail.drag.x,d=k.rail.drag.st-n;k.ishwscroll&&k.opt.bouncescroll?d<0?d=Math.round(d/2):d>k.page.maxh&&(d=k.page.maxh+Math.round((d-k.page.maxh)/2)):(d<0&&(d=0,s=0),d>k.page.maxh&&(d=k.page.maxh,s=0));var u;k.railh&&k.railh.scrollable&&(u=k.isrtlmode?c-k.rail.drag.sl:k.rail.drag.sl-c,k.ishwscroll&&k.opt.bouncescroll?u<0?u=Math.round(u/2):u>k.page.maxw&&(u=k.page.maxw+Math.round((u-k.page.maxw)/2)):(u<0&&(u=0,a=0),u>k.page.maxw&&(u=k.page.maxw,a=0)));var h=!1;if(k.rail.drag.dl)h=!0,"v"==k.rail.drag.dl?u=k.rail.drag.sl:"h"==k.rail.drag.dl&&(d=k.rail.drag.st);else{var p=Math.abs(n),m=Math.abs(c),f=k.opt.directionlockdeadzone;if("v"==k.rail.drag.ck){if(p>f&&m<=.3*p)return k.rail.drag=!1,!0;m>f&&(k.rail.drag.dl="f",T.scrollTop(T.scrollTop()))}else if("h"==k.rail.drag.ck){if(m>f&&p<=.3*m)return k.rail.drag=!1,!0;p>f&&(k.rail.drag.dl="f",T.scrollLeft(T.scrollLeft()))}}if(k.synched("touchmove",function(){k.rail.drag&&2==k.rail.drag.pt&&(k.prepareTransition&&k.resetTransition(),k.rail.scrollable&&k.setScrollTop(d),k.scrollmom.update(a,s),k.railh&&k.railh.scrollable?(k.setScrollLeft(u),k.showCursor(d,u)):k.showCursor(d),C.isie10&&l.selection.clear())}),C.ischrome&&k.istouchcapable&&(h=!1),h)return k.cancelEvent(e)}else if(1==k.rail.drag.pt)return k.onmousemove(e)},k.ontouchstartCursor=function(e,o){if(!k.rail.drag||3==k.rail.drag.pt){if(k.locked)return k.cancelEvent(e);k.cancelScroll(),k.rail.drag={x:e.touches[0].clientX,y:e.touches[0].clientY,sx:k.scroll.x,sy:k.scroll.y,pt:3,hr:!!o};var t=k.getTarget(e);return!k.ispage&&C.hasmousecapture&&t.setCapture(),k.isiframe&&!C.hasmousecapture&&(k.saved.csspointerevents=k.doc.css("pointer-events"),k.css(k.doc,{"pointer-events":"none"})),k.cancelEvent(e)}},k.ontouchendCursor=function(e){if(k.rail.drag){if(C.hasmousecapture&&l.releaseCapture(),k.isiframe&&!C.hasmousecapture&&k.doc.css("pointer-events",k.saved.csspointerevents),3!=k.rail.drag.pt)return;return k.rail.drag=!1,k.cancelEvent(e)}},k.ontouchmoveCursor=function(e){if(k.rail.drag){if(3!=k.rail.drag.pt)return;if(k.cursorfreezed=!0,k.rail.drag.hr){k.scroll.x=k.rail.drag.sx+(e.touches[0].clientX-k.rail.drag.x),k.scroll.x<0&&(k.scroll.x=0);var o=k.scrollvaluemaxw;k.scroll.x>o&&(k.scroll.x=o)}else{k.scroll.y=k.rail.drag.sy+(e.touches[0].clientY-k.rail.drag.y),k.scroll.y<0&&(k.scroll.y=0);var t=k.scrollvaluemax;k.scroll.y>t&&(k.scroll.y=t)}return k.synched("touchmove",function(){k.rail.drag&&3==k.rail.drag.pt&&(k.showCursor(),k.rail.drag.hr?k.doScrollLeft(Math.round(k.scroll.x*k.scrollratio.x),k.opt.cursordragspeed):k.doScrollTop(Math.round(k.scroll.y*k.scrollratio.y),k.opt.cursordragspeed))}),k.cancelEvent(e)}}}if(k.onmousedown=function(e,o){if(!k.rail.drag||1==k.rail.drag.pt){if(k.railslocked)return k.cancelEvent(e);k.cancelScroll(),k.rail.drag={x:e.clientX,y:e.clientY,sx:k.scroll.x,sy:k.scroll.y,pt:1,hr:o||!1};var t=k.getTarget(e);return C.hasmousecapture&&t.setCapture(),k.isiframe&&!C.hasmousecapture&&(k.saved.csspointerevents=k.doc.css("pointer-events"),k.css(k.doc,{"pointer-events":"none"})),k.hasmoving=!1,k.cancelEvent(e)}},k.onmouseup=function(e){if(k.rail.drag)return 1!=k.rail.drag.pt||(C.hasmousecapture&&l.releaseCapture(),k.isiframe&&!C.hasmousecapture&&k.doc.css("pointer-events",k.saved.csspointerevents),k.rail.drag=!1,k.cursorfreezed=!1,k.hasmoving&&k.triggerScrollEnd(),k.cancelEvent(e))},k.onmousemove=function(e){if(k.rail.drag){if(1!==k.rail.drag.pt)return;if(C.ischrome&&0===e.which)return k.onmouseup(e);if(k.cursorfreezed=!0,k.hasmoving||k.triggerScrollStart(e.clientX,e.clientY,0,0,0),k.hasmoving=!0,k.rail.drag.hr){k.scroll.x=k.rail.drag.sx+(e.clientX-k.rail.drag.x),k.scroll.x<0&&(k.scroll.x=0);var o=k.scrollvaluemaxw;k.scroll.x>o&&(k.scroll.x=o)}else{k.scroll.y=k.rail.drag.sy+(e.clientY-k.rail.drag.y),k.scroll.y<0&&(k.scroll.y=0);var t=k.scrollvaluemax;k.scroll.y>t&&(k.scroll.y=t)}return k.synched("mousemove",function(){k.cursorfreezed&&(k.showCursor(),k.rail.drag.hr?k.scrollLeft(Math.round(k.scroll.x*k.scrollratio.x)):k.scrollTop(Math.round(k.scroll.y*k.scrollratio.y)))}),k.cancelEvent(e)}k.checkarea=0},C.cantouch||k.opt.emulatetouch)k.onpreventclick=function(e){if(k.preventclick)return k.preventclick.tg.onclick=k.preventclick.click,k.preventclick=!1,k.cancelEvent(e)},k.onclick=!C.isios&&function(e){return!k.lastmouseup||(k.lastmouseup=!1,k.cancelEvent(e))},k.opt.grabcursorenabled&&C.cursorgrabvalue&&(k.css(k.ispage?k.doc:k.win,{cursor:C.cursorgrabvalue}),k.css(k.rail,{cursor:C.cursorgrabvalue}));else{var E=function(e){if(k.selectiondrag){if(e){var o=k.win.outerHeight(),t=e.pageY-k.selectiondrag.top;t>0&&t=o&&(t-=o),k.selectiondrag.df=t}if(0!==k.selectiondrag.df){var r=2*-Math.floor(k.selectiondrag.df/6);k.doScrollBy(r),k.debounced("doselectionscroll",function(){E()},50)}}};k.hasTextSelected="getSelection"in l?function(){return l.getSelection().rangeCount>0}:"selection"in l?function(){return"None"!=l.selection.type}:function(){return!1},k.onselectionstart=function(e){k.ispage||(k.selectiondrag=k.win.offset())},k.onselectionend=function(e){k.selectiondrag=!1},k.onselectiondrag=function(e){k.selectiondrag&&k.hasTextSelected()&&k.debounced("selectionscroll",function(){E(e)},250)}}if(C.hasw3ctouch?(k.css(k.ispage?n("html"):k.win,{"touch-action":"none"}),k.css(k.rail,{"touch-action":"none"}),k.css(k.cursor,{"touch-action":"none"}),k.bind(k.win,"pointerdown",k.ontouchstart),k.bind(l,"pointerup",k.ontouchend),k.bind(l,"pointermove",k.ontouchmove)):C.hasmstouch?(k.css(k.ispage?n("html"):k.win,{"-ms-touch-action":"none"}),k.css(k.rail,{"-ms-touch-action":"none"}),k.css(k.cursor,{"-ms-touch-action":"none"}),k.bind(k.win,"MSPointerDown",k.ontouchstart),k.bind(l,"MSPointerUp",k.ontouchend),k.bind(l,"MSPointerMove",k.ontouchmove),k.bind(k.cursor,"MSGestureHold",function(e){e.preventDefault()}),k.bind(k.cursor,"contextmenu",function(e){e.preventDefault()})):C.cantouch&&(k.bind(k.win,"touchstart",k.ontouchstart,!1,!0),k.bind(l,"touchend",k.ontouchend,!1,!0),k.bind(l,"touchcancel",k.ontouchend,!1,!0),k.bind(l,"touchmove",k.ontouchmove,!1,!0)),k.opt.emulatetouch&&(k.bind(k.win,"mousedown",k.ontouchstart,!1,!0),k.bind(l,"mouseup",k.ontouchend,!1,!0),k.bind(l,"mousemove",k.ontouchmove,!1,!0)),(k.opt.cursordragontouch||!C.cantouch&&!k.opt.emulatetouch)&&(k.rail.css({cursor:"default"}),k.railh&&k.railh.css({cursor:"default"}),k.jqbind(k.rail,"mouseenter",function(){if(!k.ispage&&!k.win.is(":visible"))return!1;k.canshowonmouseevent&&k.showCursor(),k.rail.active=!0}),k.jqbind(k.rail,"mouseleave",function(){k.rail.active=!1,k.rail.drag||k.hideCursor()}),k.opt.sensitiverail&&(k.bind(k.rail,"click",function(e){k.doRailClick(e,!1,!1)}),k.bind(k.rail,"dblclick",function(e){k.doRailClick(e,!0,!1)}),k.bind(k.cursor,"click",function(e){k.cancelEvent(e)}),k.bind(k.cursor,"dblclick",function(e){k.cancelEvent(e)})),k.railh&&(k.jqbind(k.railh,"mouseenter",function(){if(!k.ispage&&!k.win.is(":visible"))return!1;k.canshowonmouseevent&&k.showCursor(),k.rail.active=!0}),k.jqbind(k.railh,"mouseleave",function(){k.rail.active=!1,k.rail.drag||k.hideCursor()}),k.opt.sensitiverail&&(k.bind(k.railh,"click",function(e){k.doRailClick(e,!1,!0)}),k.bind(k.railh,"dblclick",function(e){k.doRailClick(e,!0,!0)}),k.bind(k.cursorh,"click",function(e){k.cancelEvent(e)}),k.bind(k.cursorh,"dblclick",function(e){k.cancelEvent(e)})))),k.opt.cursordragontouch&&(this.istouchcapable||C.cantouch)&&(k.bind(k.cursor,"touchstart",k.ontouchstartCursor),k.bind(k.cursor,"touchmove",k.ontouchmoveCursor),k.bind(k.cursor,"touchend",k.ontouchendCursor),k.cursorh&&k.bind(k.cursorh,"touchstart",function(e){k.ontouchstartCursor(e,!0)}),k.cursorh&&k.bind(k.cursorh,"touchmove",k.ontouchmoveCursor),k.cursorh&&k.bind(k.cursorh,"touchend",k.ontouchendCursor)),C.cantouch||k.opt.emulatetouch?(k.bind(C.hasmousecapture?k.win:l,"mouseup",k.ontouchend),k.onclick&&k.bind(l,"click",k.onclick),k.opt.cursordragontouch?(k.bind(k.cursor,"mousedown",k.onmousedown),k.bind(k.cursor,"mouseup",k.onmouseup),k.cursorh&&k.bind(k.cursorh,"mousedown",function(e){k.onmousedown(e,!0)}),k.cursorh&&k.bind(k.cursorh,"mouseup",k.onmouseup)):(k.bind(k.rail,"mousedown",function(e){e.preventDefault()}),k.railh&&k.bind(k.railh,"mousedown",function(e){e.preventDefault()}))):(k.bind(C.hasmousecapture?k.win:l,"mouseup",k.onmouseup),k.bind(l,"mousemove",k.onmousemove),k.onclick&&k.bind(l,"click",k.onclick),k.bind(k.cursor,"mousedown",k.onmousedown),k.bind(k.cursor,"mouseup",k.onmouseup),k.railh&&(k.bind(k.cursorh,"mousedown",function(e){k.onmousedown(e,!0)}),k.bind(k.cursorh,"mouseup",k.onmouseup)),!k.ispage&&k.opt.enablescrollonselection&&(k.bind(k.win[0],"mousedown",k.onselectionstart),k.bind(l,"mouseup",k.onselectionend),k.bind(k.cursor,"mouseup",k.onselectionend),k.cursorh&&k.bind(k.cursorh,"mouseup",k.onselectionend),k.bind(l,"mousemove",k.onselectiondrag)),k.zoom&&(k.jqbind(k.zoom,"mouseenter",function(){k.canshowonmouseevent&&k.showCursor(),k.rail.active=!0}),k.jqbind(k.zoom,"mouseleave",function(){k.rail.active=!1,k.rail.drag||k.hideCursor()}))),k.opt.enablemousewheel&&(k.isiframe||k.mousewheel(C.isie&&k.ispage?l:k.win,k.onmousewheel),k.mousewheel(k.rail,k.onmousewheel),k.railh&&k.mousewheel(k.railh,k.onmousewheelhr)),k.ispage||C.cantouch||/HTML|^BODY/.test(k.win[0].nodeName)||(k.win.attr("tabindex")||k.win.attr({tabindex:++r}),k.bind(k.win,"focus",function(e){o=k.getTarget(e).id||!0,k.hasfocus=!0,k.canshowonmouseevent&&k.noticeCursor()}),k.bind(k.win,"blur",function(e){o=!1,k.hasfocus=!1}),k.bind(k.win,"mouseenter",function(e){t=k.getTarget(e).id||!0,k.hasmousefocus=!0,k.canshowonmouseevent&&k.noticeCursor()}),k.bind(k.win,"mouseleave",function(e){t=!1,k.hasmousefocus=!1,k.rail.drag||k.hideCursor()})),k.onkeypress=function(e){if(k.railslocked&&0===k.page.maxh)return!0;e=e||a.event;var r=k.getTarget(e);if(r&&/INPUT|TEXTAREA|SELECT|OPTION/.test(r.nodeName)&&(!(r.getAttribute("type")||r.type||!1)||!/submit|button|cancel/i.tp))return!0;if(n(r).attr("contenteditable"))return!0;if(k.hasfocus||k.hasmousefocus&&!o||k.ispage&&!o&&!t){var i=e.keyCode;if(k.railslocked&&27!=i)return k.cancelEvent(e);var s=e.ctrlKey||!1,l=e.shiftKey||!1,c=!1;switch(i){case 38:case 63233:k.doScrollBy(72),c=!0;break;case 40:case 63235:k.doScrollBy(-72),c=!0;break;case 37:case 63232:k.railh&&(s?k.doScrollLeft(0):k.doScrollLeftBy(72),c=!0);break;case 39:case 63234:k.railh&&(s?k.doScrollLeft(k.page.maxw):k.doScrollLeftBy(-72),c=!0);break;case 33:case 63276:k.doScrollBy(k.view.h),c=!0;break;case 34:case 63277:k.doScrollBy(-k.view.h),c=!0;break;case 36:case 63273:k.railh&&s?k.doScrollPos(0,0):k.doScrollTo(0),c=!0;break;case 35:case 63275:k.railh&&s?k.doScrollPos(k.page.maxw,k.page.maxh):k.doScrollTo(k.page.maxh),c=!0;break;case 32:k.opt.spacebarenabled&&(l?k.doScrollBy(k.view.h):k.doScrollBy(-k.view.h),c=!0);break;case 27:k.zoomactive&&(k.doZoom(),c=!0)}if(c)return k.cancelEvent(e)}},k.opt.enablekeyboard&&k.bind(l,C.isopera&&!C.isopera12?"keypress":"keydown",k.onkeypress),k.bind(l,"keydown",function(e){(e.ctrlKey||!1)&&(k.wheelprevented=!0)}),k.bind(l,"keyup",function(e){e.ctrlKey||!1||(k.wheelprevented=!1)}),k.bind(a,"blur",function(e){k.wheelprevented=!1}),k.bind(a,"resize",k.lazyResize),k.bind(a,"orientationchange",k.lazyResize),k.bind(a,"load",k.lazyResize),C.ischrome&&!k.ispage&&!k.haswrapper){var M=k.win.attr("style"),L=parseFloat(k.win.css("width"))+1;k.win.css("width",L),k.synched("chromefix",function(){k.win.attr("style",M)})}k.onAttributeChange=function(e){k.lazyResize(k.isieold?250:30)},k.opt.enableobserver&&(k.isie11||!1===p||(k.observerbody=new p(function(e){if(e.forEach(function(e){if("attributes"==e.type)return T.hasClass("modal-open")&&T.hasClass("modal-dialog")&&!n.contains(n(".modal-dialog")[0],k.doc[0])?k.hide():k.show()}),k.me.clientWidth!=k.page.width||k.me.clientHeight!=k.page.height)return k.lazyResize(30)}),k.observerbody.observe(l.body,{childList:!0,subtree:!0,characterData:!1,attributes:!0,attributeFilter:["class"]})),k.ispage||k.haswrapper||(!1!==p?(k.observer=new p(function(e){e.forEach(k.onAttributeChange)}),k.observer.observe(k.win[0],{childList:!0,characterData:!1,attributes:!0,subtree:!1}),k.observerremover=new p(function(e){e.forEach(function(e){if(e.removedNodes.length>0)for(var o in e.removedNodes)if(k&&e.removedNodes[o]==k.win[0])return k.remove()})}),k.observerremover.observe(k.win[0].parentNode,{childList:!0,characterData:!1,attributes:!1,subtree:!1})):(k.bind(k.win,C.isie&&!C.isie9?"propertychange":"DOMAttrModified",k.onAttributeChange),C.isie9&&k.win[0].attachEvent("onpropertychange",k.onAttributeChange),k.bind(k.win,"DOMNodeRemoved",function(e){e.target==k.win[0]&&k.remove()})))),!k.ispage&&k.opt.boxzoom&&k.bind(a,"resize",k.resizeZoom),k.istextarea&&(k.bind(k.win,"keydown",k.lazyResize),k.bind(k.win,"mouseup",k.lazyResize)),k.lazyResize(30)}if("IFRAME"==this.doc[0].nodeName){var N=function(){k.iframexd=!1;var o;try{(o="contentDocument"in this?this.contentDocument:this.contentWindow._doc).domain}catch(e){k.iframexd=!0,o=!1}if(k.iframexd)return"console"in a&&console.log("NiceScroll error: policy restriced iframe"),!0;if(k.forcescreen=!0,k.isiframe&&(k.iframe={doc:n(o),html:k.doc.contents().find("html")[0],body:k.doc.contents().find("body")[0]},k.getContentSize=function(){return{w:Math.max(k.iframe.html.scrollWidth,k.iframe.body.scrollWidth),h:Math.max(k.iframe.html.scrollHeight,k.iframe.body.scrollHeight)}},k.docscroll=n(k.iframe.body)),!C.isios&&k.opt.iframeautoresize&&!k.isiframe){k.win.scrollTop(0),k.doc.height("");var t=Math.max(o.getElementsByTagName("html")[0].scrollHeight,o.body.scrollHeight);k.doc.height(t)}k.lazyResize(30),k.css(n(k.iframe.body),e),C.isios&&k.haswrapper&&k.css(n(o.body),{"-webkit-transform":"translate3d(0,0,0)"}),"contentWindow"in this?k.bind(this.contentWindow,"scroll",k.onscroll):k.bind(o,"scroll",k.onscroll),k.opt.enablemousewheel&&k.mousewheel(o,k.onmousewheel),k.opt.enablekeyboard&&k.bind(o,C.isopera?"keypress":"keydown",k.onkeypress),C.cantouch?(k.bind(o,"touchstart",k.ontouchstart),k.bind(o,"touchmove",k.ontouchmove)):k.opt.emulatetouch&&(k.bind(o,"mousedown",k.ontouchstart),k.bind(o,"mousemove",function(e){return k.ontouchmove(e,!0)}),k.opt.grabcursorenabled&&C.cursorgrabvalue&&k.css(n(o.body),{cursor:C.cursorgrabvalue})),k.bind(o,"mouseup",k.ontouchend),k.zoom&&(k.opt.dblclickzoom&&k.bind(o,"dblclick",k.doZoom),k.ongesturezoom&&k.bind(o,"gestureend",k.ongesturezoom))};this.doc[0].readyState&&"complete"===this.doc[0].readyState&&setTimeout(function(){N.call(k.doc[0],!1)},500),k.bind(this.doc,"load",N)}},this.showCursor=function(e,o){if(k.cursortimeout&&(clearTimeout(k.cursortimeout),k.cursortimeout=0),k.rail){if(k.autohidedom&&(k.autohidedom.stop().css({opacity:k.opt.cursoropacitymax}),k.cursoractive=!0),k.rail.drag&&1==k.rail.drag.pt||(void 0!==e&&!1!==e&&(k.scroll.y=e/k.scrollratio.y|0),void 0!==o&&(k.scroll.x=o/k.scrollratio.x|0)),k.cursor.css({height:k.cursorheight,top:k.scroll.y}),k.cursorh){var t=k.hasreversehr?k.scrollvaluemaxw-k.scroll.x:k.scroll.x;k.cursorh.css({width:k.cursorwidth,left:!k.rail.align&&k.rail.visibility?t+k.rail.width:t}),k.cursoractive=!0}k.zoom&&k.zoom.stop().css({opacity:k.opt.cursoropacitymax})}},this.hideCursor=function(e){k.cursortimeout||k.rail&&k.autohidedom&&(k.hasmousefocus&&"leave"===k.opt.autohidemode||(k.cursortimeout=setTimeout(function(){k.rail.active&&k.showonmouseevent||(k.autohidedom.stop().animate({opacity:k.opt.cursoropacitymin}),k.zoom&&k.zoom.stop().animate({opacity:k.opt.cursoropacitymin}),k.cursoractive=!1),k.cursortimeout=0},e||k.opt.hidecursordelay)))},this.noticeCursor=function(e,o,t){k.showCursor(o,t),k.rail.active||k.hideCursor(e)},this.getContentSize=k.ispage?function(){return{w:Math.max(l.body.scrollWidth,l.documentElement.scrollWidth),h:Math.max(l.body.scrollHeight,l.documentElement.scrollHeight)}}:k.haswrapper?function(){return{w:k.doc[0].offsetWidth,h:k.doc[0].offsetHeight}}:function(){return{w:k.docscroll[0].scrollWidth,h:k.docscroll[0].scrollHeight}},this.onResize=function(e,o){if(!k||!k.win)return!1;var t=k.page.maxh,r=k.page.maxw,i={h:k.view.h,w:k.view.w};if(k.view={w:k.ispage?k.win.width():k.win[0].clientWidth,h:k.ispage?k.win.height():k.win[0].clientHeight},k.page=o||k.getContentSize(),k.page.maxh=Math.max(0,k.page.h-k.view.h),k.page.maxw=Math.max(0,k.page.w-k.view.w),k.page.maxh==t&&k.page.maxw==r&&k.view.w==i.w&&k.view.h==i.h){if(k.ispage)return k;var s=k.win.offset();if(k.lastposition){var n=k.lastposition;if(n.top==s.top&&n.left==s.left)return k}k.lastposition=s}return 0===k.page.maxh?(k.hideRail(),k.scrollvaluemax=0,k.scroll.y=0,k.scrollratio.y=0,k.cursorheight=0,k.setScrollTop(0),k.rail&&(k.rail.scrollable=!1)):(k.page.maxh-=k.opt.railpadding.top+k.opt.railpadding.bottom,k.rail.scrollable=!0),0===k.page.maxw?(k.hideRailHr(),k.scrollvaluemaxw=0,k.scroll.x=0,k.scrollratio.x=0,k.cursorwidth=0,k.setScrollLeft(0),k.railh&&(k.railh.scrollable=!1)):(k.page.maxw-=k.opt.railpadding.left+k.opt.railpadding.right,k.railh&&(k.railh.scrollable=k.opt.horizrailenabled)),k.railslocked=k.locked||0===k.page.maxh&&0===k.page.maxw,k.railslocked?(k.ispage||k.updateScrollBar(k.view),!1):(k.hidden||k.visibility?!k.railh||k.hidden||k.railh.visibility||k.showRailHr():k.showRail().showRailHr(),k.istextarea&&k.win.css("resize")&&"none"!=k.win.css("resize")&&(k.view.h-=20),k.cursorheight=Math.min(k.view.h,Math.round(k.view.h*(k.view.h/k.page.h))),k.cursorheight=k.opt.cursorfixedheight?k.opt.cursorfixedheight:Math.max(k.opt.cursorminheight,k.cursorheight),k.cursorwidth=Math.min(k.view.w,Math.round(k.view.w*(k.view.w/k.page.w))),k.cursorwidth=k.opt.cursorfixedheight?k.opt.cursorfixedheight:Math.max(k.opt.cursorminheight,k.cursorwidth),k.scrollvaluemax=k.view.h-k.cursorheight-(k.opt.railpadding.top+k.opt.railpadding.bottom),k.hasborderbox||(k.scrollvaluemax-=k.cursor[0].offsetHeight-k.cursor[0].clientHeight),k.railh&&(k.railh.width=k.page.maxh>0?k.view.w-k.rail.width:k.view.w,k.scrollvaluemaxw=k.railh.width-k.cursorwidth-(k.opt.railpadding.left+k.opt.railpadding.right)),k.ispage||k.updateScrollBar(k.view),k.scrollratio={x:k.page.maxw/k.scrollvaluemaxw,y:k.page.maxh/k.scrollvaluemax},k.getScrollTop()>k.page.maxh?k.doScrollTop(k.page.maxh):(k.scroll.y=k.getScrollTop()/k.scrollratio.y|0,k.scroll.x=k.getScrollLeft()/k.scrollratio.x|0,k.cursoractive&&k.noticeCursor()),k.scroll.y&&0===k.getScrollTop()&&k.doScrollTo(Math.floor(k.scroll.y*k.scrollratio.y)),k)},this.resize=k.onResize,this.hlazyresize=0,this.lazyResize=function(e){return k.haswrapper||k.ispage||k.hide(),k.hlazyresize&&clearTimeout(k.hlazyresize),k.hlazyresize=setTimeout(function(){k&&(k.haswrapper||k.ispage||k.show(),k.resize())},240),k},this.jqbind=function(e,o,t){k.events.push({e:e,n:o,f:t,q:!0}),n(e).on(o,t)},this.mousewheel=function(e,o,t){var r="jquery"in e?e[0]:e;if("onwheel"in l.createElement("div"))k._bind(r,"wheel",o,t||!1);else{var i=void 0!==l.onmousewheel?"mousewheel":"DOMMouseScroll";x(r,i,o,t||!1),"DOMMouseScroll"==i&&x(r,"MozMousePixelScroll",o,t||!1)}};var _=!1;if(C.haseventlistener){try{var H=Object.defineProperty({},"passive",{get:function(){_=!0}});a.addEventListener("test",null,H)}catch(e){}this.cancelEvent=function(e){return!!e&&((e=e.original?e.original:e).cancelable&&e.preventDefault(),e.stopPropagation(),e.preventManipulation&&e.preventManipulation(),!1)},this.stopPropagation=function(e){return!!e&&((e=e.original?e.original:e).stopPropagation(),!1)}}else Event.prototype.preventDefault=function(){this.returnValue=!1},Event.prototype.stopPropagation=function(){this.cancelBubble=!0},a.constructor.prototype.addEventListener=l.constructor.prototype.addEventListener=Element.prototype.addEventListener=function(e,o,t){this.attachEvent("on"+e,o)},a.constructor.prototype.removeEventListener=l.constructor.prototype.removeEventListener=Element.prototype.removeEventListener=function(e,o,t){this.detachEvent("on"+e,o)},this.cancelEvent=function(e){return!!(e=e||a.event)&&(e.cancelBubble=!0,e.cancel=!0,e.returnValue=!1,!1)},this.stopPropagation=function(e){return(e=e||a.event)&&(e.cancelBubble=!0),!1};this.bind=function(e,o,t,r,i){var s="jquery"in e?e[0]:e;k._bind(s,o,t,r||!1,i||!1)},this._bind=function(e,o,t,r,i){k.events.push({e:e,n:o,f:t,b:r,q:!1}),_&&i?e.addEventListener(o,t,{passive:!1,capture:r}):e.addEventListener(o,t,r||!1)},this._unbind=function(e,o,t,r){e.removeEventListener(o,t,r)},this.unbindAll=function(){for(var e=0;e0)return t;o=!!o.parentNode&&o.parentNode}return!1},this.triggerScrollStart=function(e,o,t,r,i){if(k.onscrollstart){var s={type:"scrollstart",current:{x:e,y:o},request:{x:t,y:r},end:{x:k.newscrollx,y:k.newscrolly},speed:i};k.onscrollstart.call(k,s)}},this.triggerScrollEnd=function(){if(k.onscrollend){var e=k.getScrollLeft(),o=k.getScrollTop(),t={type:"scrollend",current:{x:e,y:o},end:{x:e,y:o}};k.onscrollend.call(k,t)}};var I=0,O=0,Y=0,B=1;if(this.onmousewheel=function(e){if(!k.wheelprevented){if(k.railslocked)return k.debounced("checkunlock",k.resize,250),!0;if(k.rail.drag)return k.cancelEvent(e);if("auto"===k.opt.oneaxismousemode&&0!==e.deltaX&&(k.opt.oneaxismousemode=!1),k.opt.oneaxismousemode&&0===e.deltaX&&!k.rail.scrollable)return!k.railh||!k.railh.scrollable||k.onmousewheelhr(e);var o=m(),t=!1;if(k.opt.preservenativescrolling&&k.checkarea+600k.page.maxh&&(o=k.page.maxh+(o-k.page.maxh)/2|0),e<0?e=e/2|0:e>k.page.maxw&&(e=k.page.maxw+(o-k.page.maxw)/2|0)):(o<0?o=0:o>k.page.maxh&&(o=k.page.maxh),e<0?e=0:e>k.page.maxw&&(e=k.page.maxw)),k.scrollrunning&&e==k.newscrollx&&o==k.newscrolly)return!1;k.newscrolly=o,k.newscrollx=e;var s=k.getScrollTop(),n=k.getScrollLeft(),l={};l.x=e-n,l.y=o-s;var a=0|Math.sqrt(l.x*l.x+l.y*l.y),c=k.prepareTransition(a);k.scrollrunning||(k.scrollrunning=!0,k.triggerScrollStart(n,s,e,o,c),k.cursorupdate.start()),k.scrollendtrapped=!0,C.transitionend||(k.scrollendtrapped&&clearTimeout(k.scrollendtrapped),k.scrollendtrapped=setTimeout(k.onScrollTransitionEnd,c)),k.setScrollTop(k.newscrolly),k.setScrollLeft(k.newscrollx)},this.cancelScroll=function(){if(!k.scrollendtrapped)return!0;var e=k.getScrollTop(),o=k.getScrollLeft();return k.scrollrunning=!1,C.transitionend||clearTimeout(C.transitionend),k.scrollendtrapped=!1,k.resetTransition(),k.setScrollTop(e),k.railh&&k.setScrollLeft(o),k.timerscroll&&k.timerscroll.tm&&clearInterval(k.timerscroll.tm),k.timerscroll=!1,k.cursorfreezed=!1,k.cursorupdate.stop(),k.showCursor(e,o),k},this.onScrollTransitionEnd=function(){if(k.scrollendtrapped){var e=k.getScrollTop(),o=k.getScrollLeft();if(e<0?e=0:e>k.page.maxh&&(e=k.page.maxh),o<0?o=0:o>k.page.maxw&&(o=k.page.maxw),e!=k.newscrolly||o!=k.newscrollx)return k.doScrollPos(o,e,k.opt.snapbackspeed);k.scrollrunning&&k.triggerScrollEnd(),k.scrollrunning=!1,k.scrollendtrapped=!1,k.resetTransition(),k.timerscroll=!1,k.setScrollTop(e),k.railh&&k.setScrollLeft(o),k.cursorupdate.stop(),k.noticeCursor(!1,e,o),k.cursorfreezed=!1}}}else this.doScrollLeft=function(e,o){var t=k.scrollrunning?k.newscrolly:k.getScrollTop();k.doScrollPos(e,t,o)},this.doScrollTop=function(e,o){var t=k.scrollrunning?k.newscrollx:k.getScrollLeft();k.doScrollPos(t,e,o)},this.doScrollPos=function(e,o,t){var r=k.getScrollTop(),i=k.getScrollLeft();((k.newscrolly-r)*(o-r)<0||(k.newscrollx-i)*(e-i)<0)&&k.cancelScroll();var s=!1;if(k.bouncescroll&&k.rail.visibility||(o<0?(o=0,s=!0):o>k.page.maxh&&(o=k.page.maxh,s=!0)),k.bouncescroll&&k.railh.visibility||(e<0?(e=0,s=!0):e>k.page.maxw&&(e=k.page.maxw,s=!0)),k.scrollrunning&&k.newscrolly===o&&k.newscrollx===e)return!0;k.newscrolly=o,k.newscrollx=e,k.dst={},k.dst.x=e-i,k.dst.y=o-r,k.dst.px=i,k.dst.py=r;var n=0|Math.sqrt(k.dst.x*k.dst.x+k.dst.y*k.dst.y),l=k.getTransitionSpeed(n);k.bzscroll={},s?(k.bzscroll.x=new N(i,k.newscrollx,l,0,0,1,1),k.bzscroll.y=new N(r,k.newscrolly,l,0,0,1,1)):(k.bzscroll.x=new N(i,k.newscrollx,l,0,0,.58,1),k.bzscroll.y=new N(r,k.newscrolly,l,0,0,.58,1));var a=function(){if(k.scrollrunning){var e=k.bzscroll.y.getPos();k.setScrollLeft(k.bzscroll.x.getNow()),k.setScrollTop(k.bzscroll.y.getNow()),e<=1?d(a):(k.scrollrunning=!1,k.timer=0,k.triggerScrollEnd())}};k.scrollrunning||(k.triggerScrollStart(i,r,e,o,l),k.scrollrunning=!0,k.timer=d(a))},this.cancelScroll=function(){return k.timer&&u(k.timer),k.timer=0,k.bzscroll=!1,k.scrollrunning=!1,k};else this.doScrollLeft=function(e,o){var t=k.getScrollTop();k.doScrollPos(e,t,o)},this.doScrollTop=function(e,o){var t=k.getScrollLeft();k.doScrollPos(t,e,o)},this.doScrollPos=function(e,o,t){var r=e>k.page.maxw?k.page.maxw:e;r<0&&(r=0);var i=o>k.page.maxh?k.page.maxh:o;i<0&&(i=0),k.synched("scroll",function(){k.setScrollTop(i),k.setScrollLeft(r)})},this.cancelScroll=function(){};this.doScrollBy=function(e,o){S(0,e)},this.doScrollLeftBy=function(e,o){S(e,0)},this.doScrollTo=function(e,o){var t=o?Math.round(e*k.scrollratio.y):e;t<0?t=0:t>k.page.maxh&&(t=k.page.maxh),k.cursorfreezed=!1,k.doScrollTop(e)},this.checkContentSize=function(){var e=k.getContentSize();e.h==k.page.h&&e.w==k.page.w||k.resize(!1,e)},k.onscroll=function(e){k.rail.drag||k.cursorfreezed||k.synched("scroll",function(){k.scroll.y=Math.round(k.getScrollTop()/k.scrollratio.y),k.railh&&(k.scroll.x=Math.round(k.getScrollLeft()/k.scrollratio.x)),k.noticeCursor()})},k.bind(k.docscroll,"scroll",k.onscroll),this.doZoomIn=function(e){if(!k.zoomactive){k.zoomactive=!0,k.zoomrestore={style:{}};var o=["position","top","left","zIndex","backgroundColor","marginTop","marginBottom","marginLeft","marginRight"],t=k.win[0].style;for(var r in o){var i=o[r];k.zoomrestore.style[i]=void 0!==t[i]?t[i]:""}k.zoomrestore.style.width=k.win.css("width"),k.zoomrestore.style.height=k.win.css("height"),k.zoomrestore.padding={w:k.win.outerWidth()-k.win.width(),h:k.win.outerHeight()-k.win.height()},C.isios4&&(k.zoomrestore.scrollTop=c.scrollTop(),c.scrollTop(0)),k.win.css({position:C.isios4?"absolute":"fixed",top:0,left:0,zIndex:s+100,margin:0});var n=k.win.css("backgroundColor");return(""===n||/transparent|rgba\(0, 0, 0, 0\)|rgba\(0,0,0,0\)/.test(n))&&k.win.css("backgroundColor","#fff"),k.rail.css({zIndex:s+101}),k.zoom.css({zIndex:s+102}),k.zoom.css("backgroundPosition","0 -18px"),k.resizeZoom(),k.onzoomin&&k.onzoomin.call(k),k.cancelEvent(e)}},this.doZoomOut=function(e){if(k.zoomactive)return k.zoomactive=!1,k.win.css("margin",""),k.win.css(k.zoomrestore.style),C.isios4&&c.scrollTop(k.zoomrestore.scrollTop),k.rail.css({"z-index":k.zindex}),k.zoom.css({"z-index":k.zindex}),k.zoomrestore=!1,k.zoom.css("backgroundPosition","0 0"),k.onResize(),k.onzoomout&&k.onzoomout.call(k),k.cancelEvent(e)},this.doZoom=function(e){return k.zoomactive?k.doZoomOut(e):k.doZoomIn(e)},this.resizeZoom=function(){if(k.zoomactive){var e=k.getScrollTop();k.win.css({width:c.width()-k.zoomrestore.padding.w+"px",height:c.height()-k.zoomrestore.padding.h+"px"}),k.onResize(),k.setScrollTop(Math.min(k.page.maxh,e))}},this.init(),n.nicescroll.push(this)},b=function(e){var o=this;this.nc=e,this.lastx=0,this.lasty=0,this.speedx=0,this.speedy=0,this.lasttime=0,this.steptime=0,this.snapx=!1,this.snapy=!1,this.demulx=0,this.demuly=0,this.lastscrollx=-1,this.lastscrolly=-1,this.chkx=0,this.chky=0,this.timer=0,this.reset=function(e,t){o.stop(),o.steptime=0,o.lasttime=m(),o.speedx=0,o.speedy=0,o.lastx=e,o.lasty=t,o.lastscrollx=-1,o.lastscrolly=-1},this.update=function(e,t){var r=m();o.steptime=r-o.lasttime,o.lasttime=r;var i=t-o.lasty,s=e-o.lastx,n=o.nc.getScrollTop()+i,l=o.nc.getScrollLeft()+s;o.snapx=l<0||l>o.nc.page.maxw,o.snapy=n<0||n>o.nc.page.maxh,o.speedx=s,o.speedy=i,o.lastx=e,o.lasty=t},this.stop=function(){o.nc.unsynched("domomentum2d"),o.timer&&clearTimeout(o.timer),o.timer=0,o.lastscrollx=-1,o.lastscrolly=-1},this.doSnapy=function(e,t){var r=!1;t<0?(t=0,r=!0):t>o.nc.page.maxh&&(t=o.nc.page.maxh,r=!0),e<0?(e=0,r=!0):e>o.nc.page.maxw&&(e=o.nc.page.maxw,r=!0),r?o.nc.doScrollPos(e,t,o.nc.opt.snapbackspeed):o.nc.triggerScrollEnd()},this.doMomentum=function(e){var t=m(),r=e?t+e:o.lasttime,i=o.nc.getScrollLeft(),s=o.nc.getScrollTop(),n=o.nc.page.maxh,l=o.nc.page.maxw;o.speedx=l>0?Math.min(60,o.speedx):0,o.speedy=n>0?Math.min(60,o.speedy):0;var a=r&&t-r<=60;(s<0||s>n||i<0||i>l)&&(a=!1);var c=!(!o.speedy||!a)&&o.speedy,d=!(!o.speedx||!a)&&o.speedx;if(c||d){var u=Math.max(16,o.steptime);if(u>50){var h=u/50;o.speedx*=h,o.speedy*=h,u=50}o.demulxy=0,o.lastscrollx=o.nc.getScrollLeft(),o.chkx=o.lastscrollx,o.lastscrolly=o.nc.getScrollTop(),o.chky=o.lastscrolly;var p=o.lastscrollx,f=o.lastscrolly,g=function(){var e=m()-t>600?.04:.02;o.speedx&&(p=Math.floor(o.lastscrollx-o.speedx*(1-o.demulxy)),o.lastscrollx=p,(p<0||p>l)&&(e=.1)),o.speedy&&(f=Math.floor(o.lastscrolly-o.speedy*(1-o.demulxy)),o.lastscrolly=f,(f<0||f>n)&&(e=.1)),o.demulxy=Math.min(1,o.demulxy+e),o.nc.synched("domomentum2d",function(){if(o.speedx){o.nc.getScrollLeft();o.chkx=p,o.nc.setScrollLeft(p)}if(o.speedy){o.nc.getScrollTop();o.chky=f,o.nc.setScrollTop(f)}o.timer||(o.nc.hideCursor(),o.doSnapy(p,f))}),o.demulxy<1?o.timer=setTimeout(g,u):(o.stop(),o.nc.hideCursor(),o.doSnapy(p,f))};g()}else o.doSnapy(o.nc.getScrollLeft(),o.nc.getScrollTop())}},y=e.fn.scrollTop;e.cssHooks.pageYOffset={get:function(e,o,t){var r=n.data(e,"__nicescroll")||!1;return r&&r.ishwscroll?r.getScrollTop():y.call(e)},set:function(e,o){var t=n.data(e,"__nicescroll")||!1;return t&&t.ishwscroll?t.setScrollTop(parseInt(o)):y.call(e,o),this}},e.fn.scrollTop=function(e){if(void 0===e){var o=!!this[0]&&(n.data(this[0],"__nicescroll")||!1);return o&&o.ishwscroll?o.getScrollTop():y.call(this)}return this.each(function(){var o=n.data(this,"__nicescroll")||!1;o&&o.ishwscroll?o.setScrollTop(parseInt(e)):y.call(n(this),e)})};var x=e.fn.scrollLeft;n.cssHooks.pageXOffset={get:function(e,o,t){var r=n.data(e,"__nicescroll")||!1;return r&&r.ishwscroll?r.getScrollLeft():x.call(e)},set:function(e,o){var t=n.data(e,"__nicescroll")||!1;return t&&t.ishwscroll?t.setScrollLeft(parseInt(o)):x.call(e,o),this}},e.fn.scrollLeft=function(e){if(void 0===e){var o=!!this[0]&&(n.data(this[0],"__nicescroll")||!1);return o&&o.ishwscroll?o.getScrollLeft():x.call(this)}return this.each(function(){var o=n.data(this,"__nicescroll")||!1;o&&o.ishwscroll?o.setScrollLeft(parseInt(e)):x.call(n(this),e)})};var S=function(e){var o=this;if(this.length=0,this.name="nicescrollarray",this.each=function(e){return n.each(o,e),o},this.push=function(e){o[o.length]=e,o.length++},this.eq=function(e){return o[e]},e)for(var t=0;t1?n(e,r):s,i.win=r}!("doc"in i)||"win"in i||(i.win=r);var l=r.data("__nicescroll")||!1;l||(i.doc=i.doc||r,l=new w(i,r),r.data("__nicescroll",l)),t.push(l)}),1===t.length?t[0]:t},a.NiceScroll={getjQuery:function(){return e}},n.nicescroll||(n.nicescroll=new S,n.nicescroll.options=f)}); \ No newline at end of file +/* jquery.nicescroll v 3.7.4-d [DEV REL] - InuYaksa*2017 - MIT - https://nicescroll.areaaperta.com/ */ +!function(e){"function"==typeof define&&define.amd?define(["jquery"],e):"object"==typeof exports?module.exports=e(require("jquery")):e(jQuery)}(function(e){"use strict";var o=!1,t=!1,r=0,i=2e3,s=0,n=e,l=document,a=window,c=n(a),d=a.requestAnimationFrame||a.webkitRequestAnimationFrame||a.mozRequestAnimationFrame||!1,u=a.cancelAnimationFrame||a.webkitCancelAnimationFrame||a.mozCancelAnimationFrame||!1;if(d)a.cancelAnimationFrame||(u=function(e){});else{var h=0;d=function(e,o){var t=(new Date).getTime(),r=Math.max(0,16-(t-h)),i=a.setTimeout(function(){e(t+r)},r);return h=t+r,i},u=function(e){a.clearTimeout(e)}}var p=a.MutationObserver||a.WebKitMutationObserver||!1,m=Date.now||function(){return(new Date).getTime()},f={zindex:"auto",cursoropacitymin:0,cursoropacitymax:1,cursorcolor:"#424242",cursorwidth:"6px",cursorborder:"1px solid #fff",cursorborderradius:"5px",scrollspeed:40,mousescrollstep:27,touchbehavior:!1,emulatetouch:!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 e=l.currentScript||function(){var e=l.getElementsByTagName("script");return!!e.length&&e[e.length-1]}(),o=e?e.src.split("?")[0]:"";return o.split("/").length>0?o.split("/").slice(0,-1).join("/")+"/":""}(),preventmultitouchscrolling:!0,disablemutationobserver:!1,enableobserver:!0,scrollbarid:!1},g=!1,v=function(){if(g)return g;var e=l.createElement("DIV"),o=e.style,t=navigator.userAgent,r=navigator.platform,i={};return i.haspointerlock="pointerLockElement"in l||"webkitPointerLockElement"in l||"mozPointerLockElement"in l,i.isopera="opera"in a,i.isopera12=i.isopera&&"getUserMedia"in navigator,i.isoperamini="[object OperaMini]"===Object.prototype.toString.call(a.operamini),i.isie="all"in l&&"attachEvent"in e&&!i.isopera,i.isieold=i.isie&&!("msInterpolationMode"in o),i.isie7=i.isie&&!i.isieold&&(!("documentMode"in l)||7===l.documentMode),i.isie8=i.isie&&"documentMode"in l&&8===l.documentMode,i.isie9=i.isie&&"performance"in a&&9===l.documentMode,i.isie10=i.isie&&"performance"in a&&10===l.documentMode,i.isie11="msRequestFullscreen"in e&&l.documentMode>=11,i.ismsedge="msCredentials"in a,i.ismozilla="MozAppearance"in o,i.iswebkit=!i.ismsedge&&"WebkitAppearance"in o,i.ischrome=i.iswebkit&&"chrome"in a,i.ischrome38=i.ischrome&&"touchAction"in o,i.ischrome22=!i.ischrome38&&i.ischrome&&i.haspointerlock,i.ischrome26=!i.ischrome38&&i.ischrome&&"transition"in o,i.cantouch="ontouchstart"in l.documentElement||"ontouchstart"in a,i.hasw3ctouch=(a.PointerEvent||!1)&&(navigator.MaxTouchPoints>0||navigator.msMaxTouchPoints>0),i.hasmstouch=!i.hasw3ctouch&&(a.MSPointerEvent||!1),i.ismac=/^mac$/i.test(r),i.isios=i.cantouch&&/iphone|ipad|ipod/i.test(r),i.isios4=i.isios&&!("seal"in Object),i.isios7=i.isios&&"webkitHidden"in l,i.isios8=i.isios&&"hidden"in l,i.isios10=i.isios&&a.Proxy,i.isandroid=/android/i.test(t),i.haseventlistener="addEventListener"in e,i.trstyle=!1,i.hastransform=!1,i.hastranslate3d=!1,i.transitionstyle=!1,i.hastransition=!1,i.transitionend=!1,i.trstyle="transform",i.hastransform="transform"in o||function(){for(var e=["msTransform","webkitTransform","MozTransform","OTransform"],t=0,r=e.length;t0;){if(9==e[0].nodeType)return!1;var o=e.css("zIndex");if(!isNaN(o)&&0!==o)return parseInt(o);e=e.parent()}return!1}function y(e,o,t){var r=e.css(o),i=parseFloat(r);if(isNaN(i)){var s=3==(i=R[r]||0)?t?k.win.outerHeight()-k.win.innerHeight():k.win.outerWidth()-k.win.innerWidth():1;return k.isie8&&i&&(i+=1),s?i:0}return i}function x(e,o,t,r){k._bind(e,o,function(r){var i={original:r=r||a.event,target:r.target||r.srcElement,type:"wheel",deltaMode:"MozMousePixelScroll"==r.type?0:1,deltaX:0,deltaZ:0,preventDefault:function(){return r.preventDefault?r.preventDefault():r.returnValue=!1,!1},stopImmediatePropagation:function(){r.stopImmediatePropagation?r.stopImmediatePropagation():r.cancelBubble=!0}};return"mousewheel"==o?(r.wheelDeltaX&&(i.deltaX=-.025*r.wheelDeltaX),r.wheelDeltaY&&(i.deltaY=-.025*r.wheelDeltaY),!i.deltaY&&!i.deltaX&&(i.deltaY=-.025*r.wheelDelta)):i.deltaY=r.detail,t.call(e,i)},r)}function S(e,o,t,r){k.scrollrunning||(k.newscrolly=k.getScrollTop(),k.newscrollx=k.getScrollLeft(),Y=m());var i=m()-Y;if(Y=m(),i>350?B=1:B+=(2-B)/10,e=e*B|0,o=o*B|0,e){if(r)if(e<0){if(k.getScrollLeft()>=k.page.maxw)return!0}else if(k.getScrollLeft()<=0)return!0;var s=e>0?1:-1;O!==s&&(k.scrollmom&&k.scrollmom.stop(),k.newscrollx=k.getScrollLeft(),O=s),k.lastdeltax-=e}if(o){if(function(){var e=k.getScrollTop();if(o<0){if(e>=k.page.maxh)return!0}else if(e<=0)return!0}()){if(k.opt.nativeparentscrolling&&t&&!k.ispage&&!k.zoomactive)return!0;var n=k.view.h>>1;k.newscrolly<-n?(k.newscrolly=-n,o=-1):k.newscrolly>k.page.maxh+n?(k.newscrolly=k.page.maxh+n,o=1):o=0}var l=o>0?1:-1;I!==l&&(k.scrollmom&&k.scrollmom.stop(),k.newscrolly=k.getScrollTop(),I=l),k.lastdeltay-=o}(o||e)&&k.synched("relativexy",function(){var e=k.lastdeltay+k.newscrolly;k.lastdeltay=0;var o=k.lastdeltax+k.newscrollx;k.lastdeltax=0,k.rail.drag||k.doScrollPos(o,e)})}function z(e,o,t){var r,i;return!(t||!X)||(0===e.deltaMode?(r=-e.deltaX*(k.opt.mousescrollstep/54)|0,i=-e.deltaY*(k.opt.mousescrollstep/54)|0):1===e.deltaMode&&(r=-e.deltaX*k.opt.mousescrollstep*50/80|0,i=-e.deltaY*k.opt.mousescrollstep*50/80|0),o&&k.opt.oneaxismousemode&&0===r&&i&&(r=i,i=0,t&&(r<0?k.getScrollLeft()>=k.page.maxw:k.getScrollLeft()<=0)&&(i=r,r=0)),k.isrtlmode&&(r=-r),S(r,i,t,!0)?void(t&&(X=!0)):(X=!1,e.stopImmediatePropagation(),e.preventDefault()))}var k=this;this.version="3.7.4-d",this.name="nicescroll",this.me=h;var T=n("body");if(this.opt={doc:T,win:!1},n.extend(this.opt,f),this.opt.snapbackspeed=80,e)for(var E in k.opt)void 0!==e[E]&&(k.opt[E]=e[E]);if(k.opt.disablemutationobserver&&(p=!1),this.doc=k.opt.doc,this.iddoc=this.doc&&this.doc[0]?this.doc[0].id||"":"",this.ispage=/^BODY|HTML/.test(k.opt.win?k.opt.win[0].nodeName:this.doc[0].nodeName),this.haswrapper=!1!==k.opt.win,this.win=k.opt.win||(this.ispage?c:this.doc),this.docscroll=this.ispage&&!this.haswrapper?c:this.win,this.body=T,this.viewport=!1,this.isfixed=!1,this.iframe=!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"!=k.opt.autohidemode,this.onmousedown=!1,this.onmouseup=!1,this.onmousemove=!1,this.onmousewheel=!1,this.onkeypress=!1,this.ongesturezoom=!1,this.onclick=!1,this.onscrollstart=!1,this.onscrollend=!1,this.onscrollcancel=!1,this.onzoomin=!1,this.onzoomout=!1,this.view=!1,this.page=!1,this.scroll={x:0,y:0},this.scrollratio={x:0,y:0},this.cursorheight=20,this.scrollvaluemax=0,"auto"==this.opt.rtlmode){var M=this.win[0]==a?this.body:this.win,L=M.css("writing-mode")||M.css("-webkit-writing-mode")||M.css("-ms-writing-mode")||M.css("-moz-writing-mode");"horizontal-tb"==L||"lr-tb"==L||""===L?(this.isrtlmode="rtl"==M.css("direction"),this.isvertical=!1):(this.isrtlmode="vertical-rl"==L||"tb"==L||"tb-rl"==L||"rl-tb"==L,this.isvertical="vertical-rl"==L||"tb"==L||"tb-rl"==L)}else this.isrtlmode=!0===this.opt.rtlmode,this.isvertical=!1;if(this.scrollrunning=!1,this.scrollmom=!1,this.observer=!1,this.observerremover=!1,this.observerbody=!1,!1!==k.opt.scrollbarid)this.id=k.opt.scrollbarid;else do{this.id="ascrail"+i++}while(l.getElementById(this.id));this.rail=!1,this.cursor=!1,this.cursorfreezed=!1,this.selectiondrag=!1,this.zoom=!1,this.zoomactive=!1,this.hasfocus=!1,this.hasmousefocus=!1,this.visibility=!0,this.railslocked=!1,this.locked=!1,this.hidden=!1,this.cursoractive=!0,this.wheelprevented=!1,this.overflowx=k.opt.overflowx,this.overflowy=k.opt.overflowy,this.nativescrollingarea=!1,this.checkarea=0,this.events=[],this.saved={},this.delaylist={},this.synclist={},this.lastdeltax=0,this.lastdeltay=0,this.detected=v();var C=n.extend({},this.detected);this.canhwscroll=C.hastransform&&k.opt.hwacceleration,this.ishwscroll=this.canhwscroll&&k.haswrapper,this.isrtlmode?this.isvertical?this.hasreversehr=!(C.iswebkit||C.isie||C.isie11):this.hasreversehr=!(C.iswebkit||C.isie&&!C.isie10&&!C.isie11):this.hasreversehr=!1,this.istouchcapable=!1,C.cantouch||!C.hasw3ctouch&&!C.hasmstouch?!C.cantouch||C.isios||C.isandroid||!C.iswebkit&&!C.ismozilla||(this.istouchcapable=!0):this.istouchcapable=!0,k.opt.enablemouselockapi||(C.hasmousecapture=!1,C.haspointerlock=!1),this.debounced=function(e,o,t){k&&(k.delaylist[e]||!1||(k.delaylist[e]={h:d(function(){k.delaylist[e].fn.call(k),k.delaylist[e]=!1},t)},o.call(k)),k.delaylist[e].fn=o)},this.synched=function(e,o){k.synclist[e]?k.synclist[e]=o:(k.synclist[e]=o,d(function(){k&&(k.synclist[e]&&k.synclist[e].call(k),k.synclist[e]=null)}))},this.unsynched=function(e){k.synclist[e]&&(k.synclist[e]=!1)},this.css=function(e,o){for(var t in o)k.saved.css.push([e,t,e.css(t)]),e.css(t,o[t])},this.scrollTop=function(e){return void 0===e?k.getScrollTop():k.setScrollTop(e)},this.scrollLeft=function(e){return void 0===e?k.getScrollLeft():k.setScrollLeft(e)};var N=function(e,o,t,r,i,s,n){this.st=e,this.ed=o,this.spd=t,this.p1=r||0,this.p2=i||1,this.p3=s||0,this.p4=n||1,this.ts=m(),this.df=o-e};if(N.prototype={B2:function(e){return 3*(1-e)*(1-e)*e},B3:function(e){return 3*(1-e)*e*e},B4:function(e){return e*e*e},getPos:function(){return(m()-this.ts)/this.spd},getNow:function(){var e=(m()-this.ts)/this.spd,o=this.B2(e)+this.B3(e)+this.B4(e);return e>=1?this.ed:this.st+this.df*o|0},update:function(e,o){return this.st=this.getNow(),this.ed=e,this.spd=o,this.ts=m(),this.df=this.ed-this.st,this}},this.ishwscroll){this.doc.translate={x:0,y:0,tx:"0px",ty:"0px"},C.hastranslate3d&&C.isios&&this.doc.css("-webkit-backface-visibility","hidden"),this.getScrollTop=function(e){if(!e){var o=g();if(o)return 16==o.length?-o[13]:-o[5];if(k.timerscroll&&k.timerscroll.bz)return k.timerscroll.bz.getNow()}return k.doc.translate.y},this.getScrollLeft=function(e){if(!e){var o=g();if(o)return 16==o.length?-o[12]:-o[4];if(k.timerscroll&&k.timerscroll.bh)return k.timerscroll.bh.getNow()}return k.doc.translate.x},this.notifyScrollEvent=function(e){var o=l.createEvent("UIEvents");o.initUIEvent("scroll",!1,!0,a,1),o.niceevent=!0,e.dispatchEvent(o)};var P=this.isrtlmode?1:-1;C.hastranslate3d&&k.opt.enabletranslate3d?(this.setScrollTop=function(e,o){k.doc.translate.y=e,k.doc.translate.ty=-1*e+"px",k.doc.css(C.trstyle,"translate3d("+k.doc.translate.tx+","+k.doc.translate.ty+",0)"),o||k.notifyScrollEvent(k.win[0])},this.setScrollLeft=function(e,o){k.doc.translate.x=e,k.doc.translate.tx=e*P+"px",k.doc.css(C.trstyle,"translate3d("+k.doc.translate.tx+","+k.doc.translate.ty+",0)"),o||k.notifyScrollEvent(k.win[0])}):(this.setScrollTop=function(e,o){k.doc.translate.y=e,k.doc.translate.ty=-1*e+"px",k.doc.css(C.trstyle,"translate("+k.doc.translate.tx+","+k.doc.translate.ty+")"),o||k.notifyScrollEvent(k.win[0])},this.setScrollLeft=function(e,o){k.doc.translate.x=e,k.doc.translate.tx=e*P+"px",k.doc.css(C.trstyle,"translate("+k.doc.translate.tx+","+k.doc.translate.ty+")"),o||k.notifyScrollEvent(k.win[0])})}else this.getScrollTop=function(){return k.docscroll.scrollTop()},this.setScrollTop=function(e){k.docscroll.scrollTop(e)},this.getScrollLeft=function(){return k.hasreversehr?k.detected.ismozilla?k.page.maxw-Math.abs(k.docscroll.scrollLeft()):k.page.maxw-k.docscroll.scrollLeft():k.docscroll.scrollLeft()},this.setScrollLeft=function(e){return setTimeout(function(){if(k)return k.hasreversehr&&(e=k.detected.ismozilla?-(k.page.maxw-e):k.page.maxw-e),k.docscroll.scrollLeft(e)},1)};this.getTarget=function(e){return!!e&&(e.target?e.target:!!e.srcElement&&e.srcElement)},this.hasParent=function(e,o){if(!e)return!1;for(var t=e.target||e.srcElement||e||!1;t&&t.id!=o;)t=t.parentNode||!1;return!1!==t};var R={thin:1,medium:3,thick:5};this.getDocumentScrollOffset=function(){return{top:a.pageYOffset||l.documentElement.scrollTop,left:a.pageXOffset||l.documentElement.scrollLeft}},this.getOffset=function(){if(k.isfixed){var e=k.win.offset(),o=k.getDocumentScrollOffset();return e.top-=o.top,e.left-=o.left,e}var t=k.win.offset();if(!k.viewport)return t;var r=k.viewport.offset();return{top:t.top-r.top,left:t.left-r.left}},this.updateScrollBar=function(e){var o,t;if(k.ishwscroll)k.rail.css({height:k.win.innerHeight()-(k.opt.railpadding.top+k.opt.railpadding.bottom)}),k.railh&&k.railh.css({width:k.win.innerWidth()-(k.opt.railpadding.left+k.opt.railpadding.right)});else{var r=k.getOffset();if(o={top:r.top,left:r.left-(k.opt.railpadding.left+k.opt.railpadding.right)},o.top+=y(k.win,"border-top-width",!0),o.left+=k.rail.align?k.win.outerWidth()-y(k.win,"border-right-width")-k.rail.width:y(k.win,"border-left-width"),(t=k.opt.railoffset)&&(t.top&&(o.top+=t.top),t.left&&(o.left+=t.left)),k.railslocked||k.rail.css({top:o.top,left:o.left,height:(e?e.h:k.win.innerHeight())-(k.opt.railpadding.top+k.opt.railpadding.bottom)}),k.zoom&&k.zoom.css({top:o.top+1,left:1==k.rail.align?o.left-20:o.left+k.rail.width+4}),k.railh&&!k.railslocked){o={top:r.top,left:r.left},(t=k.opt.railhoffset)&&(t.top&&(o.top+=t.top),t.left&&(o.left+=t.left));var i=k.railh.align?o.top+y(k.win,"border-top-width",!0)+k.win.innerHeight()-k.railh.height:o.top+y(k.win,"border-top-width",!0),s=o.left+y(k.win,"border-left-width");k.railh.css({top:i-(k.opt.railpadding.top+k.opt.railpadding.bottom),left:s,width:k.railh.width})}}},this.doRailClick=function(e,o,t){var r,i,s,n;k.railslocked||(k.cancelEvent(e),"pageY"in e||(e.pageX=e.clientX+l.documentElement.scrollLeft,e.pageY=e.clientY+l.documentElement.scrollTop),o?(r=t?k.doScrollLeft:k.doScrollTop)(s=t?(e.pageX-k.railh.offset().left-k.cursorwidth/2)*k.scrollratio.x:(e.pageY-k.rail.offset().top-k.cursorheight/2)*k.scrollratio.y):(r=t?k.doScrollLeftBy:k.doScrollBy,s=t?k.scroll.x:k.scroll.y,n=t?e.pageX-k.railh.offset().left:e.pageY-k.rail.offset().top,i=t?k.view.w:k.view.h,r(s>=n?i:-i)))},k.newscrolly=k.newscrollx=0,k.hasanimationframe="requestAnimationFrame"in a,k.hascancelanimationframe="cancelAnimationFrame"in a,k.hasborderbox=!1,this.init=function(){if(k.saved.css=[],C.isoperamini)return!0;if(C.isandroid&&!("hidden"in l))return!0;k.opt.emulatetouch=k.opt.emulatetouch||k.opt.touchbehavior,k.hasborderbox=a.getComputedStyle&&"border-box"===a.getComputedStyle(l.body)["box-sizing"];var e={"overflow-y":"hidden"};if((C.isie11||C.isie10)&&(e["-ms-overflow-style"]="none"),k.ishwscroll&&(this.doc.css(C.transitionstyle,C.prefixstyle+"transform 0ms ease-out"),C.transitionend&&k.bind(k.doc,C.transitionend,k.onScrollTransitionEnd,!1)),k.zindex="auto",k.ispage||"auto"!=k.opt.zindex?k.zindex=k.opt.zindex:k.zindex=w()||"auto",!k.ispage&&"auto"!=k.zindex&&k.zindex>s&&(s=k.zindex),k.isie&&0===k.zindex&&"auto"==k.opt.zindex&&(k.zindex="auto"),!k.ispage||!C.cantouch&&!C.isieold){var i=k.docscroll;k.ispage&&(i=k.haswrapper?k.win:k.doc),k.css(i,e),k.ispage&&(C.isie11||C.isie)&&k.css(n("html"),e),!C.isios||k.ispage||k.haswrapper||k.css(T,{"-webkit-overflow-scrolling":"touch"});var d=n(l.createElement("div"));d.css({position:"relative",top:0,float:"right",width:k.opt.cursorwidth,height:0,"background-color":k.opt.cursorcolor,border:k.opt.cursorborder,"background-clip":"padding-box","-webkit-border-radius":k.opt.cursorborderradius,"-moz-border-radius":k.opt.cursorborderradius,"border-radius":k.opt.cursorborderradius}),d.addClass("nicescroll-cursors"),k.cursor=d;var u=n(l.createElement("div"));u.attr("id",k.id),u.addClass("nicescroll-rails nicescroll-rails-vr");var h,m,f=["left","right","top","bottom"];for(var g in f)m=f[g],(h=k.opt.railpadding[m]||0)&&u.css("padding-"+m,h+"px");u.append(d),u.width=Math.max(parseFloat(k.opt.cursorwidth),d.outerWidth()),u.css({width:u.width+"px",zIndex:k.zindex,background:k.opt.background,cursor:"default"}),u.visibility=!0,u.scrollable=!0,u.align="left"==k.opt.railalign?0:1,k.rail=u,k.rail.drag=!1;var v=!1;!k.opt.boxzoom||k.ispage||C.isieold||(v=l.createElement("div"),k.bind(v,"click",k.doZoom),k.bind(v,"mouseenter",function(){k.zoom.css("opacity",k.opt.cursoropacitymax)}),k.bind(v,"mouseleave",function(){k.zoom.css("opacity",k.opt.cursoropacitymin)}),k.zoom=n(v),k.zoom.css({cursor:"pointer",zIndex:k.zindex,backgroundImage:"url("+k.opt.scriptpath+"zoomico.png)",height:18,width:18,backgroundPosition:"0 0"}),k.opt.dblclickzoom&&k.bind(k.win,"dblclick",k.doZoom),C.cantouch&&k.opt.gesturezoom&&(k.ongesturezoom=function(e){return e.scale>1.5&&k.doZoomIn(e),e.scale<.8&&k.doZoomOut(e),k.cancelEvent(e)},k.bind(k.win,"gestureend",k.ongesturezoom))),k.railh=!1;var y;if(k.opt.horizrailenabled&&(k.css(i,{overflowX:"hidden"}),(d=n(l.createElement("div"))).css({position:"absolute",top:0,height:k.opt.cursorwidth,width:0,backgroundColor:k.opt.cursorcolor,border:k.opt.cursorborder,backgroundClip:"padding-box","-webkit-border-radius":k.opt.cursorborderradius,"-moz-border-radius":k.opt.cursorborderradius,"border-radius":k.opt.cursorborderradius}),C.isieold&&d.css("overflow","hidden"),d.addClass("nicescroll-cursors"),k.cursorh=d,(y=n(l.createElement("div"))).attr("id",k.id+"-hr"),y.addClass("nicescroll-rails nicescroll-rails-hr"),y.height=Math.max(parseFloat(k.opt.cursorwidth),d.outerHeight()),y.css({height:y.height+"px",zIndex:k.zindex,background:k.opt.background}),y.append(d),y.visibility=!0,y.scrollable=!0,y.align="top"==k.opt.railvalign?0:1,k.railh=y,k.railh.drag=!1),k.ispage)u.css({position:"fixed",top:0,height:"100%"}),u.css(u.align?{right:0}:{left:0}),k.body.append(u),k.railh&&(y.css({position:"fixed",left:0,width:"100%"}),y.css(y.align?{bottom:0}:{top:0}),k.body.append(y));else{if(k.ishwscroll){"static"==k.win.css("position")&&k.css(k.win,{position:"relative"});var x="HTML"==k.win[0].nodeName?k.body:k.win;n(x).scrollTop(0).scrollLeft(0),k.zoom&&(k.zoom.css({position:"absolute",top:1,right:0,"margin-right":u.width+4}),x.append(k.zoom)),u.css({position:"absolute",top:0}),u.css(u.align?{right:0}:{left:0}),x.append(u),y&&(y.css({position:"absolute",left:0,bottom:0}),y.css(y.align?{bottom:0}:{top:0}),x.append(y))}else{k.isfixed="fixed"==k.win.css("position");var S=k.isfixed?"fixed":"absolute";k.isfixed||(k.viewport=k.getViewport(k.win[0])),k.viewport&&(k.body=k.viewport,/fixed|absolute/.test(k.viewport.css("position"))||k.css(k.viewport,{position:"relative"})),u.css({position:S}),k.zoom&&k.zoom.css({position:S}),k.updateScrollBar(),k.body.append(u),k.zoom&&k.body.append(k.zoom),k.railh&&(y.css({position:S}),k.body.append(y))}C.isios&&k.css(k.win,{"-webkit-tap-highlight-color":"rgba(0,0,0,0)","-webkit-touch-callout":"none"}),C.isie&&k.opt.disableoutline&&k.win.attr("hideFocus","true"),C.iswebkit&&k.opt.disableoutline&&k.win.css("outline","none")}if(!1===k.opt.autohidemode?(k.autohidedom=!1,k.rail.css({opacity:k.opt.cursoropacitymax}),k.railh&&k.railh.css({opacity:k.opt.cursoropacitymax})):!0===k.opt.autohidemode||"leave"===k.opt.autohidemode?(k.autohidedom=n().add(k.rail),C.isie8&&(k.autohidedom=k.autohidedom.add(k.cursor)),k.railh&&(k.autohidedom=k.autohidedom.add(k.railh)),k.railh&&C.isie8&&(k.autohidedom=k.autohidedom.add(k.cursorh))):"scroll"==k.opt.autohidemode?(k.autohidedom=n().add(k.rail),k.railh&&(k.autohidedom=k.autohidedom.add(k.railh))):"cursor"==k.opt.autohidemode?(k.autohidedom=n().add(k.cursor),k.railh&&(k.autohidedom=k.autohidedom.add(k.cursorh))):"hidden"==k.opt.autohidemode&&(k.autohidedom=!1,k.hide(),k.railslocked=!1),C.cantouch||k.istouchcapable||k.opt.emulatetouch||C.hasmstouch){k.scrollmom=new b(k),k.ontouchstart=function(e){if(e.pointerType&&("mouse"===e.pointerType||e.pointerType===e.MSPOINTER_TYPE_MOUSE))return!1;if(k.hasmoving=!1,!k.railslocked){var o;if(C.hasmstouch)for(o=!!e.target&&e.target;o;){var t=n(o).getNiceScroll();if(t.length>0&&t[0].me==k.me)break;if(t.length>0)return!1;if("DIV"==o.nodeName&&o.id==k.id)break;o=!!o.parentNode&&o.parentNode}if(e.stopPropagation(),k.cancelScroll(),(o=k.getTarget(e))&&/INPUT/i.test(o.nodeName)&&/range/i.test(o.type))return k.stopPropagation(e);if(!("clientX"in e)&&"changedTouches"in e&&(e.clientX=e.changedTouches[0].clientX,e.clientY=e.changedTouches[0].clientY),k.forcescreen){var r=e;(e={original:e.original?e.original:e}).clientX=r.screenX,e.clientY=r.screenY}if(k.rail.drag={x:e.clientX,y:e.clientY,sx:k.scroll.x,sy:k.scroll.y,st:k.getScrollTop(),sl:k.getScrollLeft(),pt:2,dl:!1,tg:o},k.ispage||!k.opt.directionlockdeadzone)k.rail.drag.dl="f";else{var i={w:c.width(),h:c.height()},s={w:Math.max(l.body.scrollWidth,l.documentElement.scrollWidth),h:Math.max(l.body.scrollHeight,l.documentElement.scrollHeight)},a=Math.max(0,s.h-i.h),d=Math.max(0,s.w-i.w);!k.rail.scrollable&&k.railh.scrollable?k.rail.drag.ck=a>0&&"v":k.rail.scrollable&&!k.railh.scrollable?k.rail.drag.ck=d>0&&"h":k.rail.drag.ck=!1,k.rail.drag.ck||(k.rail.drag.dl="f")}if(k.opt.emulatetouch&&k.isiframe&&C.isie){var u=k.win.position();k.rail.drag.x+=u.left,k.rail.drag.y+=u.top}if(k.hasmoving=!1,k.lastmouseup=!1,k.scrollmom.reset(e.clientX,e.clientY),!C.cantouch&&!this.istouchcapable&&!e.pointerType){if(!(!!o&&/INPUT|SELECT|BUTTON|TEXTAREA/i.test(o.nodeName)))return!k.ispage&&C.hasmousecapture&&o.setCapture(),k.opt.emulatetouch?(o.onclick&&!o._onclick&&(o._onclick=o.onclick,o.onclick=function(e){if(k.hasmoving)return!1;o._onclick.call(this,e)}),k.cancelEvent(e)):k.stopPropagation(e);/SUBMIT|CANCEL|BUTTON/i.test(n(o).attr("type"))&&(k.preventclick={tg:o,click:!1})}}},k.ontouchend=function(e){if(!k.rail.drag)return!0;if(2==k.rail.drag.pt){if(e.pointerType&&("mouse"===e.pointerType||e.pointerType===e.MSPOINTER_TYPE_MOUSE))return!1;if(k.rail.drag=!1,k.hasmoving&&(k.scrollmom.doMomentum(),k.lastmouseup=!0,k.hideCursor(),C.hasmousecapture&&l.releaseCapture(),!C.cantouch))return k.cancelEvent(e)}else if(1==k.rail.drag.pt)return k.onmouseup(e)};var z=k.opt.emulatetouch&&k.isiframe&&!C.hasmousecapture;k.ontouchmove=function(e,o){if(!k.rail.drag)return!1;if(e.targetTouches&&k.opt.preventmultitouchscrolling&&e.targetTouches.length>1)return!1;if(e.pointerType&&("mouse"===e.pointerType||e.pointerType===e.MSPOINTER_TYPE_MOUSE))return!1;if(2==k.rail.drag.pt){if("changedTouches"in e&&(e.clientX=e.changedTouches[0].clientX,e.clientY=e.changedTouches[0].clientY),k.rail.drag.y===e.clientY&&k.rail.drag.x===e.clientX)return!1;k.hasmoving||k.triggerScrollStart(e.clientX,e.clientY,0,0,0),k.hasmoving=!0,k.preventclick&&!k.preventclick.click&&(k.preventclick.click=k.preventclick.tg.onclick||!1,k.preventclick.tg.onclick=k.onpreventclick);var t,r;if(r=t=0,z&&!o){var i=k.win.position();r=-i.left,t=-i.top}var s=e.clientY+t,n=s-k.rail.drag.y,a=e.clientX+r,c=a-k.rail.drag.x,d=k.rail.drag.st-n;k.ishwscroll&&k.opt.bouncescroll?d<0?d=Math.round(d/2):d>k.page.maxh&&(d=k.page.maxh+Math.round((d-k.page.maxh)/2)):(d<0&&(d=0,s=0),d>k.page.maxh&&(d=k.page.maxh,s=0));var u;k.railh&&k.railh.scrollable&&(u=k.isrtlmode?c-k.rail.drag.sl:k.rail.drag.sl-c,k.ishwscroll&&k.opt.bouncescroll?u<0?u=Math.round(u/2):u>k.page.maxw&&(u=k.page.maxw+Math.round((u-k.page.maxw)/2)):(u<0&&(u=0,a=0),u>k.page.maxw&&(u=k.page.maxw,a=0)));var h=!1;if(k.rail.drag.dl)h=!0,"v"==k.rail.drag.dl?u=k.rail.drag.sl:"h"==k.rail.drag.dl&&(d=k.rail.drag.st);else{var p=Math.abs(n),m=Math.abs(c),f=k.opt.directionlockdeadzone;if("v"==k.rail.drag.ck){if(p>f&&m<=.3*p)return k.rail.drag=!1,!0;m>f&&(k.rail.drag.dl="f",T.scrollTop(T.scrollTop()))}else if("h"==k.rail.drag.ck){if(m>f&&p<=.3*m)return k.rail.drag=!1,!0;p>f&&(k.rail.drag.dl="f",T.scrollLeft(T.scrollLeft()))}}if(k.synched("touchmove",function(){k.rail.drag&&2==k.rail.drag.pt&&(k.prepareTransition&&k.resetTransition(),k.rail.scrollable&&k.setScrollTop(d),k.scrollmom.update(a,s),k.railh&&k.railh.scrollable?(k.setScrollLeft(u),k.showCursor(d,u)):k.showCursor(d),C.isie10&&l.selection.clear())}),C.ischrome&&k.istouchcapable&&(h=!1),h)return k.cancelEvent(e)}else if(1==k.rail.drag.pt)return k.onmousemove(e)},k.ontouchstartCursor=function(e,o){if(!k.rail.drag||3==k.rail.drag.pt){if(k.locked)return k.cancelEvent(e);k.cancelScroll(),k.rail.drag={x:e.touches[0].clientX,y:e.touches[0].clientY,sx:k.scroll.x,sy:k.scroll.y,pt:3,hr:!!o};var t=k.getTarget(e);return!k.ispage&&C.hasmousecapture&&t.setCapture(),k.isiframe&&!C.hasmousecapture&&(k.saved.csspointerevents=k.doc.css("pointer-events"),k.css(k.doc,{"pointer-events":"none"})),k.cancelEvent(e)}},k.ontouchendCursor=function(e){if(k.rail.drag){if(C.hasmousecapture&&l.releaseCapture(),k.isiframe&&!C.hasmousecapture&&k.doc.css("pointer-events",k.saved.csspointerevents),3!=k.rail.drag.pt)return;return k.rail.drag=!1,k.cancelEvent(e)}},k.ontouchmoveCursor=function(e){if(k.rail.drag){if(3!=k.rail.drag.pt)return;if(k.cursorfreezed=!0,k.rail.drag.hr){k.scroll.x=k.rail.drag.sx+(e.touches[0].clientX-k.rail.drag.x),k.scroll.x<0&&(k.scroll.x=0);var o=k.scrollvaluemaxw;k.scroll.x>o&&(k.scroll.x=o)}else{k.scroll.y=k.rail.drag.sy+(e.touches[0].clientY-k.rail.drag.y),k.scroll.y<0&&(k.scroll.y=0);var t=k.scrollvaluemax;k.scroll.y>t&&(k.scroll.y=t)}return k.synched("touchmove",function(){k.rail.drag&&3==k.rail.drag.pt&&(k.showCursor(),k.rail.drag.hr?k.doScrollLeft(Math.round(k.scroll.x*k.scrollratio.x),k.opt.cursordragspeed):k.doScrollTop(Math.round(k.scroll.y*k.scrollratio.y),k.opt.cursordragspeed))}),k.cancelEvent(e)}}}if(k.onmousedown=function(e,o){if(!k.rail.drag||1==k.rail.drag.pt){if(k.railslocked)return k.cancelEvent(e);k.cancelScroll(),k.rail.drag={x:e.clientX,y:e.clientY,sx:k.scroll.x,sy:k.scroll.y,pt:1,hr:o||!1};var t=k.getTarget(e);return C.hasmousecapture&&t.setCapture(),k.isiframe&&!C.hasmousecapture&&(k.saved.csspointerevents=k.doc.css("pointer-events"),k.css(k.doc,{"pointer-events":"none"})),k.hasmoving=!1,k.cancelEvent(e)}},k.onmouseup=function(e){if(k.rail.drag)return 1!=k.rail.drag.pt||(C.hasmousecapture&&l.releaseCapture(),k.isiframe&&!C.hasmousecapture&&k.doc.css("pointer-events",k.saved.csspointerevents),k.rail.drag=!1,k.cursorfreezed=!1,k.hasmoving&&k.triggerScrollEnd(),k.cancelEvent(e))},k.onmousemove=function(e){if(k.rail.drag){if(1!==k.rail.drag.pt)return;if(C.ischrome&&0===e.which)return k.onmouseup(e);if(k.cursorfreezed=!0,k.hasmoving||k.triggerScrollStart(e.clientX,e.clientY,0,0,0),k.hasmoving=!0,k.rail.drag.hr){k.scroll.x=k.rail.drag.sx+(e.clientX-k.rail.drag.x),k.scroll.x<0&&(k.scroll.x=0);var o=k.scrollvaluemaxw;k.scroll.x>o&&(k.scroll.x=o)}else{k.scroll.y=k.rail.drag.sy+(e.clientY-k.rail.drag.y),k.scroll.y<0&&(k.scroll.y=0);var t=k.scrollvaluemax;k.scroll.y>t&&(k.scroll.y=t)}return k.synched("mousemove",function(){k.cursorfreezed&&(k.showCursor(),k.rail.drag.hr?k.scrollLeft(Math.round(k.scroll.x*k.scrollratio.x)):k.scrollTop(Math.round(k.scroll.y*k.scrollratio.y)))}),k.cancelEvent(e)}k.checkarea=0},C.cantouch||k.opt.emulatetouch)k.onpreventclick=function(e){if(k.preventclick)return k.preventclick.tg.onclick=k.preventclick.click,k.preventclick=!1,k.cancelEvent(e)},k.onclick=!C.isios&&function(e){return!k.lastmouseup||(k.lastmouseup=!1,k.cancelEvent(e))},k.opt.grabcursorenabled&&C.cursorgrabvalue&&(k.css(k.ispage?k.doc:k.win,{cursor:C.cursorgrabvalue}),k.css(k.rail,{cursor:C.cursorgrabvalue}));else{var E=function(e){if(k.selectiondrag){if(e){var o=k.win.outerHeight(),t=e.pageY-k.selectiondrag.top;t>0&&t=o&&(t-=o),k.selectiondrag.df=t}if(0!==k.selectiondrag.df){var r=2*-Math.floor(k.selectiondrag.df/6);k.doScrollBy(r),k.debounced("doselectionscroll",function(){E()},50)}}};k.hasTextSelected="getSelection"in l?function(){return l.getSelection().rangeCount>0}:"selection"in l?function(){return"None"!=l.selection.type}:function(){return!1},k.onselectionstart=function(e){k.ispage||(k.selectiondrag=k.win.offset())},k.onselectionend=function(e){k.selectiondrag=!1},k.onselectiondrag=function(e){k.selectiondrag&&k.hasTextSelected()&&k.debounced("selectionscroll",function(){E(e)},250)}}if(C.hasw3ctouch?(k.css(k.ispage?n("html"):k.win,{"touch-action":"none"}),k.css(k.rail,{"touch-action":"none"}),k.css(k.cursor,{"touch-action":"none"}),k.bind(k.win,"pointerdown",k.ontouchstart),k.bind(l,"pointerup",k.ontouchend),k.bind(l,"pointermove",k.ontouchmove)):C.hasmstouch?(k.css(k.ispage?n("html"):k.win,{"-ms-touch-action":"none"}),k.css(k.rail,{"-ms-touch-action":"none"}),k.css(k.cursor,{"-ms-touch-action":"none"}),k.bind(k.win,"MSPointerDown",k.ontouchstart),k.bind(l,"MSPointerUp",k.ontouchend),k.bind(l,"MSPointerMove",k.ontouchmove),k.bind(k.cursor,"MSGestureHold",function(e){e.preventDefault()}),k.bind(k.cursor,"contextmenu",function(e){e.preventDefault()})):C.cantouch&&(k.bind(k.win,"touchstart",k.ontouchstart,!1,!0),k.bind(l,"touchend",k.ontouchend,!1,!0),k.bind(l,"touchcancel",k.ontouchend,!1,!0),k.bind(l,"touchmove",k.ontouchmove,!1,!0)),k.opt.emulatetouch&&(k.bind(k.win,"mousedown",k.ontouchstart,!1,!0),k.bind(l,"mouseup",k.ontouchend,!1,!0),k.bind(l,"mousemove",k.ontouchmove,!1,!0)),(k.opt.cursordragontouch||!C.cantouch&&!k.opt.emulatetouch)&&(k.rail.css({cursor:"default"}),k.railh&&k.railh.css({cursor:"default"}),k.jqbind(k.rail,"mouseenter",function(){if(!k.ispage&&!k.win.is(":visible"))return!1;k.canshowonmouseevent&&k.showCursor(),k.rail.active=!0}),k.jqbind(k.rail,"mouseleave",function(){k.rail.active=!1,k.rail.drag||k.hideCursor()}),k.opt.sensitiverail&&(k.bind(k.rail,"click",function(e){k.doRailClick(e,!1,!1)}),k.bind(k.rail,"dblclick",function(e){k.doRailClick(e,!0,!1)}),k.bind(k.cursor,"click",function(e){k.cancelEvent(e)}),k.bind(k.cursor,"dblclick",function(e){k.cancelEvent(e)})),k.railh&&(k.jqbind(k.railh,"mouseenter",function(){if(!k.ispage&&!k.win.is(":visible"))return!1;k.canshowonmouseevent&&k.showCursor(),k.rail.active=!0}),k.jqbind(k.railh,"mouseleave",function(){k.rail.active=!1,k.rail.drag||k.hideCursor()}),k.opt.sensitiverail&&(k.bind(k.railh,"click",function(e){k.doRailClick(e,!1,!0)}),k.bind(k.railh,"dblclick",function(e){k.doRailClick(e,!0,!0)}),k.bind(k.cursorh,"click",function(e){k.cancelEvent(e)}),k.bind(k.cursorh,"dblclick",function(e){k.cancelEvent(e)})))),k.opt.cursordragontouch&&(this.istouchcapable||C.cantouch)&&(k.bind(k.cursor,"touchstart",k.ontouchstartCursor),k.bind(k.cursor,"touchmove",k.ontouchmoveCursor),k.bind(k.cursor,"touchend",k.ontouchendCursor),k.cursorh&&k.bind(k.cursorh,"touchstart",function(e){k.ontouchstartCursor(e,!0)}),k.cursorh&&k.bind(k.cursorh,"touchmove",k.ontouchmoveCursor),k.cursorh&&k.bind(k.cursorh,"touchend",k.ontouchendCursor)),C.cantouch||k.opt.emulatetouch?(k.bind(C.hasmousecapture?k.win:l,"mouseup",k.ontouchend),k.onclick&&k.bind(l,"click",k.onclick),k.opt.cursordragontouch?(k.bind(k.cursor,"mousedown",k.onmousedown),k.bind(k.cursor,"mouseup",k.onmouseup),k.cursorh&&k.bind(k.cursorh,"mousedown",function(e){k.onmousedown(e,!0)}),k.cursorh&&k.bind(k.cursorh,"mouseup",k.onmouseup)):(k.bind(k.rail,"mousedown",function(e){e.preventDefault()}),k.railh&&k.bind(k.railh,"mousedown",function(e){e.preventDefault()}))):(k.bind(C.hasmousecapture?k.win:l,"mouseup",k.onmouseup),k.bind(l,"mousemove",k.onmousemove),k.onclick&&k.bind(l,"click",k.onclick),k.bind(k.cursor,"mousedown",k.onmousedown),k.bind(k.cursor,"mouseup",k.onmouseup),k.railh&&(k.bind(k.cursorh,"mousedown",function(e){k.onmousedown(e,!0)}),k.bind(k.cursorh,"mouseup",k.onmouseup)),!k.ispage&&k.opt.enablescrollonselection&&(k.bind(k.win[0],"mousedown",k.onselectionstart),k.bind(l,"mouseup",k.onselectionend),k.bind(k.cursor,"mouseup",k.onselectionend),k.cursorh&&k.bind(k.cursorh,"mouseup",k.onselectionend),k.bind(l,"mousemove",k.onselectiondrag)),k.zoom&&(k.jqbind(k.zoom,"mouseenter",function(){k.canshowonmouseevent&&k.showCursor(),k.rail.active=!0}),k.jqbind(k.zoom,"mouseleave",function(){k.rail.active=!1,k.rail.drag||k.hideCursor()}))),k.opt.enablemousewheel&&(k.isiframe||k.mousewheel(C.isie&&k.ispage?l:k.win,k.onmousewheel),k.mousewheel(k.rail,k.onmousewheel),k.railh&&k.mousewheel(k.railh,k.onmousewheelhr)),k.ispage||C.cantouch||/HTML|^BODY/.test(k.win[0].nodeName)||(k.win.attr("tabindex")||k.win.attr({tabindex:++r}),k.bind(k.win,"focus",function(e){o=k.getTarget(e).id||!0,k.hasfocus=!0,k.canshowonmouseevent&&k.noticeCursor()}),k.bind(k.win,"blur",function(e){o=!1,k.hasfocus=!1}),k.bind(k.win,"mouseenter",function(e){t=k.getTarget(e).id||!0,k.hasmousefocus=!0,k.canshowonmouseevent&&k.noticeCursor()}),k.bind(k.win,"mouseleave",function(e){t=!1,k.hasmousefocus=!1,k.rail.drag||k.hideCursor()})),k.onkeypress=function(e){if(k.railslocked&&0===k.page.maxh)return!0;e=e||a.event;var r=k.getTarget(e);if(r&&/INPUT|TEXTAREA|SELECT|OPTION/.test(r.nodeName)&&(!(r.getAttribute("type")||r.type||!1)||!/submit|button|cancel/i.tp))return!0;if(n(r).attr("contenteditable"))return!0;if(k.hasfocus||k.hasmousefocus&&!o||k.ispage&&!o&&!t){var i=e.keyCode;if(k.railslocked&&27!=i)return k.cancelEvent(e);var s=e.ctrlKey||!1,l=e.shiftKey||!1,c=!1;switch(i){case 38:case 63233:k.doScrollBy(72),c=!0;break;case 40:case 63235:k.doScrollBy(-72),c=!0;break;case 37:case 63232:k.railh&&(s?k.doScrollLeft(0):k.doScrollLeftBy(72),c=!0);break;case 39:case 63234:k.railh&&(s?k.doScrollLeft(k.page.maxw):k.doScrollLeftBy(-72),c=!0);break;case 33:case 63276:k.doScrollBy(k.view.h),c=!0;break;case 34:case 63277:k.doScrollBy(-k.view.h),c=!0;break;case 36:case 63273:k.railh&&s?k.doScrollPos(0,0):k.doScrollTo(0),c=!0;break;case 35:case 63275:k.railh&&s?k.doScrollPos(k.page.maxw,k.page.maxh):k.doScrollTo(k.page.maxh),c=!0;break;case 32:k.opt.spacebarenabled&&(l?k.doScrollBy(k.view.h):k.doScrollBy(-k.view.h),c=!0);break;case 27:k.zoomactive&&(k.doZoom(),c=!0)}if(c)return k.cancelEvent(e)}},k.opt.enablekeyboard&&k.bind(l,C.isopera&&!C.isopera12?"keypress":"keydown",k.onkeypress),k.bind(l,"keydown",function(e){(e.ctrlKey||!1)&&(k.wheelprevented=!0)}),k.bind(l,"keyup",function(e){e.ctrlKey||!1||(k.wheelprevented=!1)}),k.bind(a,"blur",function(e){k.wheelprevented=!1}),k.bind(a,"resize",k.lazyResize),k.bind(a,"orientationchange",k.lazyResize),k.bind(a,"load",k.lazyResize),C.ischrome&&!k.ispage&&!k.haswrapper){var M=k.win.attr("style"),L=parseFloat(k.win.css("width"))+1;k.win.css("width",L),k.synched("chromefix",function(){k.win.attr("style",M)})}k.onAttributeChange=function(e){k.lazyResize(k.isieold?250:30)},k.opt.enableobserver&&(k.isie11||!1===p||(k.observerbody=new p(function(e){if(e.forEach(function(e){if("attributes"==e.type)return T.hasClass("modal-open")&&T.hasClass("modal-dialog")&&!n.contains(n(".modal-dialog")[0],k.doc[0])?k.hide():k.show()}),k.me.clientWidth!=k.page.width||k.me.clientHeight!=k.page.height)return k.lazyResize(30)}),k.observerbody.observe(l.body,{childList:!0,subtree:!0,characterData:!1,attributes:!0,attributeFilter:["class"]})),k.ispage||k.haswrapper||(!1!==p?(k.observer=new p(function(e){e.forEach(k.onAttributeChange)}),k.observer.observe(k.win[0],{childList:!0,characterData:!1,attributes:!0,subtree:!1}),k.observerremover=new p(function(e){e.forEach(function(e){if(e.removedNodes.length>0)for(var o in e.removedNodes)if(k&&e.removedNodes[o]==k.win[0])return k.remove()})}),k.observerremover.observe(k.win[0].parentNode,{childList:!0,characterData:!1,attributes:!1,subtree:!1})):(k.bind(k.win,C.isie&&!C.isie9?"propertychange":"DOMAttrModified",k.onAttributeChange),C.isie9&&k.win[0].attachEvent("onpropertychange",k.onAttributeChange),k.bind(k.win,"DOMNodeRemoved",function(e){e.target==k.win[0]&&k.remove()})))),!k.ispage&&k.opt.boxzoom&&k.bind(a,"resize",k.resizeZoom),k.istextarea&&(k.bind(k.win,"keydown",k.lazyResize),k.bind(k.win,"mouseup",k.lazyResize)),k.lazyResize(30)}if("IFRAME"==this.doc[0].nodeName){var N=function(){k.iframexd=!1;var o;try{(o="contentDocument"in this?this.contentDocument:this.contentWindow._doc).domain}catch(e){k.iframexd=!0,o=!1}if(k.iframexd)return"console"in a&&console.log("NiceScroll error: policy restriced iframe"),!0;if(k.forcescreen=!0,k.isiframe&&(k.iframe={doc:n(o),html:k.doc.contents().find("html")[0],body:k.doc.contents().find("body")[0]},k.getContentSize=function(){return{w:Math.max(k.iframe.html.scrollWidth,k.iframe.body.scrollWidth),h:Math.max(k.iframe.html.scrollHeight,k.iframe.body.scrollHeight)}},k.docscroll=n(k.iframe.body)),!C.isios&&k.opt.iframeautoresize&&!k.isiframe){k.win.scrollTop(0),k.doc.height("");var t=Math.max(o.getElementsByTagName("html")[0].scrollHeight,o.body.scrollHeight);k.doc.height(t)}k.lazyResize(30),k.css(n(k.iframe.body),e),C.isios&&k.haswrapper&&k.css(n(o.body),{"-webkit-transform":"translate3d(0,0,0)"}),"contentWindow"in this?k.bind(this.contentWindow,"scroll",k.onscroll):k.bind(o,"scroll",k.onscroll),k.opt.enablemousewheel&&k.mousewheel(o,k.onmousewheel),k.opt.enablekeyboard&&k.bind(o,C.isopera?"keypress":"keydown",k.onkeypress),C.cantouch?(k.bind(o,"touchstart",k.ontouchstart),k.bind(o,"touchmove",k.ontouchmove)):k.opt.emulatetouch&&(k.bind(o,"mousedown",k.ontouchstart),k.bind(o,"mousemove",function(e){return k.ontouchmove(e,!0)}),k.opt.grabcursorenabled&&C.cursorgrabvalue&&k.css(n(o.body),{cursor:C.cursorgrabvalue})),k.bind(o,"mouseup",k.ontouchend),k.zoom&&(k.opt.dblclickzoom&&k.bind(o,"dblclick",k.doZoom),k.ongesturezoom&&k.bind(o,"gestureend",k.ongesturezoom))};this.doc[0].readyState&&"complete"===this.doc[0].readyState&&setTimeout(function(){N.call(k.doc[0],!1)},500),k.bind(this.doc,"load",N)}},this.showCursor=function(e,o){if(k.cursortimeout&&(clearTimeout(k.cursortimeout),k.cursortimeout=0),k.rail){if(k.autohidedom&&(k.autohidedom.stop().css({opacity:k.opt.cursoropacitymax}),k.cursoractive=!0),k.rail.drag&&1==k.rail.drag.pt||(void 0!==e&&!1!==e&&(k.scroll.y=e/k.scrollratio.y|0),void 0!==o&&(k.scroll.x=o/k.scrollratio.x|0)),k.cursor.css({height:k.cursorheight,top:k.scroll.y}),k.cursorh){var t=k.hasreversehr?k.scrollvaluemaxw-k.scroll.x:k.scroll.x;k.cursorh.css({width:k.cursorwidth,left:!k.rail.align&&k.rail.visibility?t+k.rail.width:t}),k.cursoractive=!0}k.zoom&&k.zoom.stop().css({opacity:k.opt.cursoropacitymax})}},this.hideCursor=function(e){k.cursortimeout||k.rail&&k.autohidedom&&(k.hasmousefocus&&"leave"===k.opt.autohidemode||(k.cursortimeout=setTimeout(function(){k.rail.active&&k.showonmouseevent||(k.autohidedom.stop().animate({opacity:k.opt.cursoropacitymin}),k.zoom&&k.zoom.stop().animate({opacity:k.opt.cursoropacitymin}),k.cursoractive=!1),k.cursortimeout=0},e||k.opt.hidecursordelay)))},this.noticeCursor=function(e,o,t){k.showCursor(o,t),k.rail.active||k.hideCursor(e)},this.getContentSize=k.ispage?function(){return{w:Math.max(l.body.scrollWidth,l.documentElement.scrollWidth),h:Math.max(l.body.scrollHeight,l.documentElement.scrollHeight)}}:k.haswrapper?function(){return{w:k.doc[0].offsetWidth,h:k.doc[0].offsetHeight}}:function(){return{w:k.docscroll[0].scrollWidth,h:k.docscroll[0].scrollHeight}},this.onResize=function(e,o){if(!k||!k.win)return!1;var t=k.page.maxh,r=k.page.maxw,i={h:k.view.h,w:k.view.w};if(k.view={w:k.ispage?k.win.width():k.win[0].clientWidth,h:k.ispage?k.win.height():k.win[0].clientHeight},k.page=o||k.getContentSize(),k.page.maxh=Math.max(0,k.page.h-k.view.h),k.page.maxw=Math.max(0,k.page.w-k.view.w),k.page.maxh==t&&k.page.maxw==r&&k.view.w==i.w&&k.view.h==i.h){if(k.ispage)return k;var s=k.win.offset();if(k.lastposition){var n=k.lastposition;if(n.top==s.top&&n.left==s.left)return k}k.lastposition=s}return 0===k.page.maxh?(k.hideRail(),k.scrollvaluemax=0,k.scroll.y=0,k.scrollratio.y=0,k.cursorheight=0,k.setScrollTop(0),k.rail&&(k.rail.scrollable=!1)):(k.page.maxh-=k.opt.railpadding.top+k.opt.railpadding.bottom,k.rail.scrollable=!0),0===k.page.maxw?(k.hideRailHr(),k.scrollvaluemaxw=0,k.scroll.x=0,k.scrollratio.x=0,k.cursorwidth=0,k.setScrollLeft(0),k.railh&&(k.railh.scrollable=!1)):(k.page.maxw-=k.opt.railpadding.left+k.opt.railpadding.right,k.railh&&(k.railh.scrollable=k.opt.horizrailenabled)),k.railslocked=k.locked||0===k.page.maxh&&0===k.page.maxw,k.railslocked?(k.ispage||k.updateScrollBar(k.view),!1):(k.hidden||k.visibility?!k.railh||k.hidden||k.railh.visibility||k.showRailHr():k.showRail().showRailHr(),k.istextarea&&k.win.css("resize")&&"none"!=k.win.css("resize")&&(k.view.h-=20),k.cursorheight=Math.min(k.view.h,Math.round(k.view.h*(k.view.h/k.page.h))),k.cursorheight=k.opt.cursorfixedheight?k.opt.cursorfixedheight:Math.max(k.opt.cursorminheight,k.cursorheight),k.cursorwidth=Math.min(k.view.w,Math.round(k.view.w*(k.view.w/k.page.w))),k.cursorwidth=k.opt.cursorfixedheight?k.opt.cursorfixedheight:Math.max(k.opt.cursorminheight,k.cursorwidth),k.scrollvaluemax=k.view.h-k.cursorheight-(k.opt.railpadding.top+k.opt.railpadding.bottom),k.hasborderbox||(k.scrollvaluemax-=k.cursor[0].offsetHeight-k.cursor[0].clientHeight),k.railh&&(k.railh.width=k.page.maxh>0?k.view.w-k.rail.width:k.view.w,k.scrollvaluemaxw=k.railh.width-k.cursorwidth-(k.opt.railpadding.left+k.opt.railpadding.right)),k.ispage||k.updateScrollBar(k.view),k.scrollratio={x:k.page.maxw/k.scrollvaluemaxw,y:k.page.maxh/k.scrollvaluemax},k.getScrollTop()>k.page.maxh?k.doScrollTop(k.page.maxh):(k.scroll.y=k.getScrollTop()/k.scrollratio.y|0,k.scroll.x=k.getScrollLeft()/k.scrollratio.x|0,k.cursoractive&&k.noticeCursor()),k.scroll.y&&0===k.getScrollTop()&&k.doScrollTo(Math.floor(k.scroll.y*k.scrollratio.y)),k)},this.resize=k.onResize,this.hlazyresize=0,this.lazyResize=function(e){return k.haswrapper||k.ispage||k.hide(),k.hlazyresize&&clearTimeout(k.hlazyresize),k.hlazyresize=setTimeout(function(){k&&(k.haswrapper||k.ispage||k.show(),k.resize())},240),k},this.jqbind=function(e,o,t){k.events.push({e:e,n:o,f:t,q:!0}),n(e).on(o,t)},this.mousewheel=function(e,o,t){var r="jquery"in e?e[0]:e;if("onwheel"in l.createElement("div"))k._bind(r,"wheel",o,t||!1);else{var i=void 0!==l.onmousewheel?"mousewheel":"DOMMouseScroll";x(r,i,o,t||!1),"DOMMouseScroll"==i&&x(r,"MozMousePixelScroll",o,t||!1)}};var _=!1;if(C.haseventlistener){try{var H=Object.defineProperty({},"passive",{get:function(){_=!0}});a.addEventListener("test",null,H)}catch(e){}this.cancelEvent=function(e){return!!e&&((e=e.original?e.original:e).cancelable&&e.preventDefault(),e.stopPropagation(),e.preventManipulation&&e.preventManipulation(),!1)},this.stopPropagation=function(e){return!!e&&((e=e.original?e.original:e).stopPropagation(),!1)}}else Event.prototype.preventDefault=function(){this.returnValue=!1},Event.prototype.stopPropagation=function(){this.cancelBubble=!0},a.constructor.prototype.addEventListener=l.constructor.prototype.addEventListener=Element.prototype.addEventListener=function(e,o,t){this.attachEvent("on"+e,o)},a.constructor.prototype.removeEventListener=l.constructor.prototype.removeEventListener=Element.prototype.removeEventListener=function(e,o,t){this.detachEvent("on"+e,o)},this.cancelEvent=function(e){return!!(e=e||a.event)&&(e.cancelBubble=!0,e.cancel=!0,e.returnValue=!1,!1)},this.stopPropagation=function(e){return(e=e||a.event)&&(e.cancelBubble=!0),!1};this.bind=function(e,o,t,r,i){var s="jquery"in e?e[0]:e;k._bind(s,o,t,r||!1,i||!1)},this._bind=function(e,o,t,r,i){k.events.push({e:e,n:o,f:t,b:r,q:!1}),_&&i?e.addEventListener(o,t,{passive:!1,capture:r}):e.addEventListener(o,t,r||!1)},this._unbind=function(e,o,t,r){e.removeEventListener(o,t,r)},this.unbindAll=function(){for(var e=0;e0)return t;o=!!o.parentNode&&o.parentNode}return!1},this.triggerScrollStart=function(e,o,t,r,i){if(k.onscrollstart){var s={type:"scrollstart",current:{x:e,y:o},request:{x:t,y:r},end:{x:k.newscrollx,y:k.newscrolly},speed:i};k.onscrollstart.call(k,s)}},this.triggerScrollEnd=function(){if(k.onscrollend){var e=k.getScrollLeft(),o=k.getScrollTop(),t={type:"scrollend",current:{x:e,y:o},end:{x:e,y:o}};k.onscrollend.call(k,t)}};var I=0,O=0,Y=0,B=1,X=!1;if(this.onmousewheel=function(e){if(!k.wheelprevented){if(k.railslocked)return k.debounced("checkunlock",k.resize,250),!0;if(k.rail.drag)return k.cancelEvent(e);if("auto"===k.opt.oneaxismousemode&&0!==e.deltaX&&(k.opt.oneaxismousemode=!1),k.opt.oneaxismousemode&&0===e.deltaX&&!k.rail.scrollable)return!k.railh||!k.railh.scrollable||k.onmousewheelhr(e);var o=m(),t=!1;if(k.opt.preservenativescrolling&&k.checkarea+600k.page.maxh&&(o=k.page.maxh+(o-k.page.maxh)/2|0),e<0?e=e/2|0:e>k.page.maxw&&(e=k.page.maxw+(o-k.page.maxw)/2|0)):(o<0?o=0:o>k.page.maxh&&(o=k.page.maxh),e<0?e=0:e>k.page.maxw&&(e=k.page.maxw)),k.scrollrunning&&e==k.newscrollx&&o==k.newscrolly)return!1;k.newscrolly=o,k.newscrollx=e;var s=k.getScrollTop(),n=k.getScrollLeft(),l={};l.x=e-n,l.y=o-s;var a=0|Math.sqrt(l.x*l.x+l.y*l.y),c=k.prepareTransition(a);k.scrollrunning||(k.scrollrunning=!0,k.triggerScrollStart(n,s,e,o,c),k.cursorupdate.start()),k.scrollendtrapped=!0,C.transitionend||(k.scrollendtrapped&&clearTimeout(k.scrollendtrapped),k.scrollendtrapped=setTimeout(k.onScrollTransitionEnd,c)),k.setScrollTop(k.newscrolly),k.setScrollLeft(k.newscrollx)},this.cancelScroll=function(){if(!k.scrollendtrapped)return!0;var e=k.getScrollTop(),o=k.getScrollLeft();return k.scrollrunning=!1,C.transitionend||clearTimeout(C.transitionend),k.scrollendtrapped=!1,k.resetTransition(),k.setScrollTop(e),k.railh&&k.setScrollLeft(o),k.timerscroll&&k.timerscroll.tm&&clearInterval(k.timerscroll.tm),k.timerscroll=!1,k.cursorfreezed=!1,k.cursorupdate.stop(),k.showCursor(e,o),k},this.onScrollTransitionEnd=function(){if(k.scrollendtrapped){var e=k.getScrollTop(),o=k.getScrollLeft();if(e<0?e=0:e>k.page.maxh&&(e=k.page.maxh),o<0?o=0:o>k.page.maxw&&(o=k.page.maxw),e!=k.newscrolly||o!=k.newscrollx)return k.doScrollPos(o,e,k.opt.snapbackspeed);k.scrollrunning&&k.triggerScrollEnd(),k.scrollrunning=!1,k.scrollendtrapped=!1,k.resetTransition(),k.timerscroll=!1,k.setScrollTop(e),k.railh&&k.setScrollLeft(o),k.cursorupdate.stop(),k.noticeCursor(!1,e,o),k.cursorfreezed=!1}}}else this.doScrollLeft=function(e,o){var t=k.scrollrunning?k.newscrolly:k.getScrollTop();k.doScrollPos(e,t,o)},this.doScrollTop=function(e,o){var t=k.scrollrunning?k.newscrollx:k.getScrollLeft();k.doScrollPos(t,e,o)},this.doScrollPos=function(e,o,t){var r=k.getScrollTop(),i=k.getScrollLeft();((k.newscrolly-r)*(o-r)<0||(k.newscrollx-i)*(e-i)<0)&&k.cancelScroll();var s=!1;if(k.bouncescroll&&k.rail.visibility||(o<0?(o=0,s=!0):o>k.page.maxh&&(o=k.page.maxh,s=!0)),k.bouncescroll&&k.railh.visibility||(e<0?(e=0,s=!0):e>k.page.maxw&&(e=k.page.maxw,s=!0)),k.scrollrunning&&k.newscrolly===o&&k.newscrollx===e)return!0;k.newscrolly=o,k.newscrollx=e,k.dst={},k.dst.x=e-i,k.dst.y=o-r,k.dst.px=i,k.dst.py=r;var n=0|Math.sqrt(k.dst.x*k.dst.x+k.dst.y*k.dst.y),l=k.getTransitionSpeed(n);k.bzscroll={};var a=s?1:.58;k.bzscroll.x=new N(i,k.newscrollx,l,0,0,a,1),k.bzscroll.y=new N(r,k.newscrolly,l,0,0,a,1);var c=function(){if(k.scrollrunning){var e=k.bzscroll.y.getPos();k.setScrollLeft(k.bzscroll.x.getNow()),k.setScrollTop(k.bzscroll.y.getNow()),e<=1?d(c):(k.scrollrunning=!1,k.timer=0,k.triggerScrollEnd())}};k.scrollrunning||(k.triggerScrollStart(i,r,e,o,l),k.scrollrunning=!0,k.timer=d(c))},this.cancelScroll=function(){return k.timer&&u(k.timer),k.timer=0,k.bzscroll=!1,k.scrollrunning=!1,k};else this.doScrollLeft=function(e,o){var t=k.getScrollTop();k.doScrollPos(e,t,o)},this.doScrollTop=function(e,o){var t=k.getScrollLeft();k.doScrollPos(t,e,o)},this.doScrollPos=function(e,o,t){var r=e>k.page.maxw?k.page.maxw:e;r<0&&(r=0);var i=o>k.page.maxh?k.page.maxh:o;i<0&&(i=0),k.synched("scroll",function(){k.setScrollTop(i),k.setScrollLeft(r)})},this.cancelScroll=function(){};this.doScrollBy=function(e,o){S(0,e)},this.doScrollLeftBy=function(e,o){S(e,0)},this.doScrollTo=function(e,o){var t=o?Math.round(e*k.scrollratio.y):e;t<0?t=0:t>k.page.maxh&&(t=k.page.maxh),k.cursorfreezed=!1,k.doScrollTop(e)},this.checkContentSize=function(){var e=k.getContentSize();e.h==k.page.h&&e.w==k.page.w||k.resize(!1,e)},k.onscroll=function(e){k.rail.drag||k.cursorfreezed||k.synched("scroll",function(){k.scroll.y=Math.round(k.getScrollTop()/k.scrollratio.y),k.railh&&(k.scroll.x=Math.round(k.getScrollLeft()/k.scrollratio.x)),k.noticeCursor()})},k.bind(k.docscroll,"scroll",k.onscroll),this.doZoomIn=function(e){if(!k.zoomactive){k.zoomactive=!0,k.zoomrestore={style:{}};var o=["position","top","left","zIndex","backgroundColor","marginTop","marginBottom","marginLeft","marginRight"],t=k.win[0].style;for(var r in o){var i=o[r];k.zoomrestore.style[i]=void 0!==t[i]?t[i]:""}k.zoomrestore.style.width=k.win.css("width"),k.zoomrestore.style.height=k.win.css("height"),k.zoomrestore.padding={w:k.win.outerWidth()-k.win.width(),h:k.win.outerHeight()-k.win.height()},C.isios4&&(k.zoomrestore.scrollTop=c.scrollTop(),c.scrollTop(0)),k.win.css({position:C.isios4?"absolute":"fixed",top:0,left:0,zIndex:s+100,margin:0});var n=k.win.css("backgroundColor");return(""===n||/transparent|rgba\(0, 0, 0, 0\)|rgba\(0,0,0,0\)/.test(n))&&k.win.css("backgroundColor","#fff"),k.rail.css({zIndex:s+101}),k.zoom.css({zIndex:s+102}),k.zoom.css("backgroundPosition","0 -18px"),k.resizeZoom(),k.onzoomin&&k.onzoomin.call(k),k.cancelEvent(e)}},this.doZoomOut=function(e){if(k.zoomactive)return k.zoomactive=!1,k.win.css("margin",""),k.win.css(k.zoomrestore.style),C.isios4&&c.scrollTop(k.zoomrestore.scrollTop),k.rail.css({"z-index":k.zindex}),k.zoom.css({"z-index":k.zindex}),k.zoomrestore=!1,k.zoom.css("backgroundPosition","0 0"),k.onResize(),k.onzoomout&&k.onzoomout.call(k),k.cancelEvent(e)},this.doZoom=function(e){return k.zoomactive?k.doZoomOut(e):k.doZoomIn(e)},this.resizeZoom=function(){if(k.zoomactive){var e=k.getScrollTop();k.win.css({width:c.width()-k.zoomrestore.padding.w+"px",height:c.height()-k.zoomrestore.padding.h+"px"}),k.onResize(),k.setScrollTop(Math.min(k.page.maxh,e))}},this.init(),n.nicescroll.push(this)},b=function(e){var o=this;this.nc=e,this.lastx=0,this.lasty=0,this.speedx=0,this.speedy=0,this.lasttime=0,this.steptime=0,this.snapx=!1,this.snapy=!1,this.demulx=0,this.demuly=0,this.lastscrollx=-1,this.lastscrolly=-1,this.chkx=0,this.chky=0,this.timer=0,this.reset=function(e,t){o.stop(),o.steptime=0,o.lasttime=m(),o.speedx=0,o.speedy=0,o.lastx=e,o.lasty=t,o.lastscrollx=-1,o.lastscrolly=-1},this.update=function(e,t){var r=m();o.steptime=r-o.lasttime,o.lasttime=r;var i=t-o.lasty,s=e-o.lastx,n=o.nc.getScrollTop()+i,l=o.nc.getScrollLeft()+s;o.snapx=l<0||l>o.nc.page.maxw,o.snapy=n<0||n>o.nc.page.maxh,o.speedx=s,o.speedy=i,o.lastx=e,o.lasty=t},this.stop=function(){o.nc.unsynched("domomentum2d"),o.timer&&clearTimeout(o.timer),o.timer=0,o.lastscrollx=-1,o.lastscrolly=-1},this.doSnapy=function(e,t){var r=!1;t<0?(t=0,r=!0):t>o.nc.page.maxh&&(t=o.nc.page.maxh,r=!0),e<0?(e=0,r=!0):e>o.nc.page.maxw&&(e=o.nc.page.maxw,r=!0),r?o.nc.doScrollPos(e,t,o.nc.opt.snapbackspeed):o.nc.triggerScrollEnd()},this.doMomentum=function(e){var t=m(),r=e?t+e:o.lasttime,i=o.nc.getScrollLeft(),s=o.nc.getScrollTop(),n=o.nc.page.maxh,l=o.nc.page.maxw;o.speedx=l>0?Math.min(60,o.speedx):0,o.speedy=n>0?Math.min(60,o.speedy):0;var a=r&&t-r<=60;(s<0||s>n||i<0||i>l)&&(a=!1);var c=!(!o.speedy||!a)&&o.speedy,d=!(!o.speedx||!a)&&o.speedx;if(c||d){var u=Math.max(16,o.steptime);if(u>50){var h=u/50;o.speedx*=h,o.speedy*=h,u=50}o.demulxy=0,o.lastscrollx=o.nc.getScrollLeft(),o.chkx=o.lastscrollx,o.lastscrolly=o.nc.getScrollTop(),o.chky=o.lastscrolly;var p=o.lastscrollx,f=o.lastscrolly,g=function(){var e=m()-t>600?.04:.02;o.speedx&&(p=Math.floor(o.lastscrollx-o.speedx*(1-o.demulxy)),o.lastscrollx=p,(p<0||p>l)&&(e=.1)),o.speedy&&(f=Math.floor(o.lastscrolly-o.speedy*(1-o.demulxy)),o.lastscrolly=f,(f<0||f>n)&&(e=.1)),o.demulxy=Math.min(1,o.demulxy+e),o.nc.synched("domomentum2d",function(){if(o.speedx){o.nc.getScrollLeft();o.chkx=p,o.nc.setScrollLeft(p)}if(o.speedy){o.nc.getScrollTop();o.chky=f,o.nc.setScrollTop(f)}o.timer||(o.nc.hideCursor(),o.doSnapy(p,f))}),o.demulxy<1?o.timer=setTimeout(g,u):(o.stop(),o.nc.hideCursor(),o.doSnapy(p,f))};g()}else o.doSnapy(o.nc.getScrollLeft(),o.nc.getScrollTop())}},y=e.fn.scrollTop;e.cssHooks.pageYOffset={get:function(e,o,t){var r=n.data(e,"__nicescroll")||!1;return r&&r.ishwscroll?r.getScrollTop():y.call(e)},set:function(e,o){var t=n.data(e,"__nicescroll")||!1;return t&&t.ishwscroll?t.setScrollTop(parseInt(o)):y.call(e,o),this}},e.fn.scrollTop=function(e){if(void 0===e){var o=!!this[0]&&(n.data(this[0],"__nicescroll")||!1);return o&&o.ishwscroll?o.getScrollTop():y.call(this)}return this.each(function(){var o=n.data(this,"__nicescroll")||!1;o&&o.ishwscroll?o.setScrollTop(parseInt(e)):y.call(n(this),e)})};var x=e.fn.scrollLeft;n.cssHooks.pageXOffset={get:function(e,o,t){var r=n.data(e,"__nicescroll")||!1;return r&&r.ishwscroll?r.getScrollLeft():x.call(e)},set:function(e,o){var t=n.data(e,"__nicescroll")||!1;return t&&t.ishwscroll?t.setScrollLeft(parseInt(o)):x.call(e,o),this}},e.fn.scrollLeft=function(e){if(void 0===e){var o=!!this[0]&&(n.data(this[0],"__nicescroll")||!1);return o&&o.ishwscroll?o.getScrollLeft():x.call(this)}return this.each(function(){var o=n.data(this,"__nicescroll")||!1;o&&o.ishwscroll?o.setScrollLeft(parseInt(e)):x.call(n(this),e)})};var S=function(e){var o=this;if(this.length=0,this.name="nicescrollarray",this.each=function(e){return n.each(o,e),o},this.push=function(e){o[o.length]=e,o.length++},this.eq=function(e){return o[e]},e)for(var t=0;t1?n(e,r):s,i.win=r}!("doc"in i)||"win"in i||(i.win=r);var l=r.data("__nicescroll")||!1;l||(i.doc=i.doc||r,l=new w(i,r),r.data("__nicescroll",l)),t.push(l)}),1===t.length?t[0]:t},a.NiceScroll={getjQuery:function(){return e}},n.nicescroll||(n.nicescroll=new S,n.nicescroll.options=f)}); \ No newline at end of file From e09bbb8a319e2536eb5af418012523278286e4e0 Mon Sep 17 00:00:00 2001 From: Andrea Tosone Date: Wed, 28 Jun 2017 15:10:36 +0200 Subject: [PATCH 04/14] RC3 fixed cursoranimate loop --- jquery.nicescroll.js | 13 ++++++++----- jquery.nicescroll.min.js | 2 +- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/jquery.nicescroll.js b/jquery.nicescroll.js index 645cbb6..df86b94 100644 --- a/jquery.nicescroll.js +++ b/jquery.nicescroll.js @@ -1839,7 +1839,7 @@ // self.jqbind(self.win, "focus", function (e) { self.bind(self.win, "focus", function (e) { // better using native events - domfocus = (self.getTarget(e)).id || true; + domfocus = (self.getTarget(e)).id || self.getTarget(e) || false; self.hasfocus = true; if (self.canshowonmouseevent) self.noticeCursor(); }); @@ -1851,7 +1851,7 @@ // self.jqbind(self.win, "mouseenter", function (e) { self.bind(self.win, "mouseenter", function (e) { // * - mousefocus = (self.getTarget(e)).id || true; + mousefocus = (self.getTarget(e)).id || self.getTarget(e) || false; self.hasmousefocus = true; if (self.canshowonmouseevent) self.noticeCursor(); }); @@ -2987,11 +2987,13 @@ this.cursorupdate = { running: false, start: function () { - if (this.running) return; - this.running = true; + var m = this; + + if (m.running) return; + m.running = true; var loop = function () { - setAnimationFrame(loop); + if (m.running) setAnimationFrame(loop); self.showCursor(self.getScrollTop(), self.getScrollLeft()); }; @@ -3127,6 +3129,7 @@ return self; }; this.onScrollTransitionEnd = function () { + if (!self.scrollendtrapped) return; //if (self.scrollendtrapped) self._unbind(self.doc[0], cap.transitionend, self.onScrollTransitionEnd); diff --git a/jquery.nicescroll.min.js b/jquery.nicescroll.min.js index f5efb2e..af76f70 100644 --- a/jquery.nicescroll.min.js +++ b/jquery.nicescroll.min.js @@ -1,2 +1,2 @@ /* jquery.nicescroll v 3.7.4-d [DEV REL] - InuYaksa*2017 - MIT - https://nicescroll.areaaperta.com/ */ -!function(e){"function"==typeof define&&define.amd?define(["jquery"],e):"object"==typeof exports?module.exports=e(require("jquery")):e(jQuery)}(function(e){"use strict";var o=!1,t=!1,r=0,i=2e3,s=0,n=e,l=document,a=window,c=n(a),d=a.requestAnimationFrame||a.webkitRequestAnimationFrame||a.mozRequestAnimationFrame||!1,u=a.cancelAnimationFrame||a.webkitCancelAnimationFrame||a.mozCancelAnimationFrame||!1;if(d)a.cancelAnimationFrame||(u=function(e){});else{var h=0;d=function(e,o){var t=(new Date).getTime(),r=Math.max(0,16-(t-h)),i=a.setTimeout(function(){e(t+r)},r);return h=t+r,i},u=function(e){a.clearTimeout(e)}}var p=a.MutationObserver||a.WebKitMutationObserver||!1,m=Date.now||function(){return(new Date).getTime()},f={zindex:"auto",cursoropacitymin:0,cursoropacitymax:1,cursorcolor:"#424242",cursorwidth:"6px",cursorborder:"1px solid #fff",cursorborderradius:"5px",scrollspeed:40,mousescrollstep:27,touchbehavior:!1,emulatetouch:!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 e=l.currentScript||function(){var e=l.getElementsByTagName("script");return!!e.length&&e[e.length-1]}(),o=e?e.src.split("?")[0]:"";return o.split("/").length>0?o.split("/").slice(0,-1).join("/")+"/":""}(),preventmultitouchscrolling:!0,disablemutationobserver:!1,enableobserver:!0,scrollbarid:!1},g=!1,v=function(){if(g)return g;var e=l.createElement("DIV"),o=e.style,t=navigator.userAgent,r=navigator.platform,i={};return i.haspointerlock="pointerLockElement"in l||"webkitPointerLockElement"in l||"mozPointerLockElement"in l,i.isopera="opera"in a,i.isopera12=i.isopera&&"getUserMedia"in navigator,i.isoperamini="[object OperaMini]"===Object.prototype.toString.call(a.operamini),i.isie="all"in l&&"attachEvent"in e&&!i.isopera,i.isieold=i.isie&&!("msInterpolationMode"in o),i.isie7=i.isie&&!i.isieold&&(!("documentMode"in l)||7===l.documentMode),i.isie8=i.isie&&"documentMode"in l&&8===l.documentMode,i.isie9=i.isie&&"performance"in a&&9===l.documentMode,i.isie10=i.isie&&"performance"in a&&10===l.documentMode,i.isie11="msRequestFullscreen"in e&&l.documentMode>=11,i.ismsedge="msCredentials"in a,i.ismozilla="MozAppearance"in o,i.iswebkit=!i.ismsedge&&"WebkitAppearance"in o,i.ischrome=i.iswebkit&&"chrome"in a,i.ischrome38=i.ischrome&&"touchAction"in o,i.ischrome22=!i.ischrome38&&i.ischrome&&i.haspointerlock,i.ischrome26=!i.ischrome38&&i.ischrome&&"transition"in o,i.cantouch="ontouchstart"in l.documentElement||"ontouchstart"in a,i.hasw3ctouch=(a.PointerEvent||!1)&&(navigator.MaxTouchPoints>0||navigator.msMaxTouchPoints>0),i.hasmstouch=!i.hasw3ctouch&&(a.MSPointerEvent||!1),i.ismac=/^mac$/i.test(r),i.isios=i.cantouch&&/iphone|ipad|ipod/i.test(r),i.isios4=i.isios&&!("seal"in Object),i.isios7=i.isios&&"webkitHidden"in l,i.isios8=i.isios&&"hidden"in l,i.isios10=i.isios&&a.Proxy,i.isandroid=/android/i.test(t),i.haseventlistener="addEventListener"in e,i.trstyle=!1,i.hastransform=!1,i.hastranslate3d=!1,i.transitionstyle=!1,i.hastransition=!1,i.transitionend=!1,i.trstyle="transform",i.hastransform="transform"in o||function(){for(var e=["msTransform","webkitTransform","MozTransform","OTransform"],t=0,r=e.length;t0;){if(9==e[0].nodeType)return!1;var o=e.css("zIndex");if(!isNaN(o)&&0!==o)return parseInt(o);e=e.parent()}return!1}function y(e,o,t){var r=e.css(o),i=parseFloat(r);if(isNaN(i)){var s=3==(i=R[r]||0)?t?k.win.outerHeight()-k.win.innerHeight():k.win.outerWidth()-k.win.innerWidth():1;return k.isie8&&i&&(i+=1),s?i:0}return i}function x(e,o,t,r){k._bind(e,o,function(r){var i={original:r=r||a.event,target:r.target||r.srcElement,type:"wheel",deltaMode:"MozMousePixelScroll"==r.type?0:1,deltaX:0,deltaZ:0,preventDefault:function(){return r.preventDefault?r.preventDefault():r.returnValue=!1,!1},stopImmediatePropagation:function(){r.stopImmediatePropagation?r.stopImmediatePropagation():r.cancelBubble=!0}};return"mousewheel"==o?(r.wheelDeltaX&&(i.deltaX=-.025*r.wheelDeltaX),r.wheelDeltaY&&(i.deltaY=-.025*r.wheelDeltaY),!i.deltaY&&!i.deltaX&&(i.deltaY=-.025*r.wheelDelta)):i.deltaY=r.detail,t.call(e,i)},r)}function S(e,o,t,r){k.scrollrunning||(k.newscrolly=k.getScrollTop(),k.newscrollx=k.getScrollLeft(),Y=m());var i=m()-Y;if(Y=m(),i>350?B=1:B+=(2-B)/10,e=e*B|0,o=o*B|0,e){if(r)if(e<0){if(k.getScrollLeft()>=k.page.maxw)return!0}else if(k.getScrollLeft()<=0)return!0;var s=e>0?1:-1;O!==s&&(k.scrollmom&&k.scrollmom.stop(),k.newscrollx=k.getScrollLeft(),O=s),k.lastdeltax-=e}if(o){if(function(){var e=k.getScrollTop();if(o<0){if(e>=k.page.maxh)return!0}else if(e<=0)return!0}()){if(k.opt.nativeparentscrolling&&t&&!k.ispage&&!k.zoomactive)return!0;var n=k.view.h>>1;k.newscrolly<-n?(k.newscrolly=-n,o=-1):k.newscrolly>k.page.maxh+n?(k.newscrolly=k.page.maxh+n,o=1):o=0}var l=o>0?1:-1;I!==l&&(k.scrollmom&&k.scrollmom.stop(),k.newscrolly=k.getScrollTop(),I=l),k.lastdeltay-=o}(o||e)&&k.synched("relativexy",function(){var e=k.lastdeltay+k.newscrolly;k.lastdeltay=0;var o=k.lastdeltax+k.newscrollx;k.lastdeltax=0,k.rail.drag||k.doScrollPos(o,e)})}function z(e,o,t){var r,i;return!(t||!X)||(0===e.deltaMode?(r=-e.deltaX*(k.opt.mousescrollstep/54)|0,i=-e.deltaY*(k.opt.mousescrollstep/54)|0):1===e.deltaMode&&(r=-e.deltaX*k.opt.mousescrollstep*50/80|0,i=-e.deltaY*k.opt.mousescrollstep*50/80|0),o&&k.opt.oneaxismousemode&&0===r&&i&&(r=i,i=0,t&&(r<0?k.getScrollLeft()>=k.page.maxw:k.getScrollLeft()<=0)&&(i=r,r=0)),k.isrtlmode&&(r=-r),S(r,i,t,!0)?void(t&&(X=!0)):(X=!1,e.stopImmediatePropagation(),e.preventDefault()))}var k=this;this.version="3.7.4-d",this.name="nicescroll",this.me=h;var T=n("body");if(this.opt={doc:T,win:!1},n.extend(this.opt,f),this.opt.snapbackspeed=80,e)for(var E in k.opt)void 0!==e[E]&&(k.opt[E]=e[E]);if(k.opt.disablemutationobserver&&(p=!1),this.doc=k.opt.doc,this.iddoc=this.doc&&this.doc[0]?this.doc[0].id||"":"",this.ispage=/^BODY|HTML/.test(k.opt.win?k.opt.win[0].nodeName:this.doc[0].nodeName),this.haswrapper=!1!==k.opt.win,this.win=k.opt.win||(this.ispage?c:this.doc),this.docscroll=this.ispage&&!this.haswrapper?c:this.win,this.body=T,this.viewport=!1,this.isfixed=!1,this.iframe=!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"!=k.opt.autohidemode,this.onmousedown=!1,this.onmouseup=!1,this.onmousemove=!1,this.onmousewheel=!1,this.onkeypress=!1,this.ongesturezoom=!1,this.onclick=!1,this.onscrollstart=!1,this.onscrollend=!1,this.onscrollcancel=!1,this.onzoomin=!1,this.onzoomout=!1,this.view=!1,this.page=!1,this.scroll={x:0,y:0},this.scrollratio={x:0,y:0},this.cursorheight=20,this.scrollvaluemax=0,"auto"==this.opt.rtlmode){var M=this.win[0]==a?this.body:this.win,L=M.css("writing-mode")||M.css("-webkit-writing-mode")||M.css("-ms-writing-mode")||M.css("-moz-writing-mode");"horizontal-tb"==L||"lr-tb"==L||""===L?(this.isrtlmode="rtl"==M.css("direction"),this.isvertical=!1):(this.isrtlmode="vertical-rl"==L||"tb"==L||"tb-rl"==L||"rl-tb"==L,this.isvertical="vertical-rl"==L||"tb"==L||"tb-rl"==L)}else this.isrtlmode=!0===this.opt.rtlmode,this.isvertical=!1;if(this.scrollrunning=!1,this.scrollmom=!1,this.observer=!1,this.observerremover=!1,this.observerbody=!1,!1!==k.opt.scrollbarid)this.id=k.opt.scrollbarid;else do{this.id="ascrail"+i++}while(l.getElementById(this.id));this.rail=!1,this.cursor=!1,this.cursorfreezed=!1,this.selectiondrag=!1,this.zoom=!1,this.zoomactive=!1,this.hasfocus=!1,this.hasmousefocus=!1,this.visibility=!0,this.railslocked=!1,this.locked=!1,this.hidden=!1,this.cursoractive=!0,this.wheelprevented=!1,this.overflowx=k.opt.overflowx,this.overflowy=k.opt.overflowy,this.nativescrollingarea=!1,this.checkarea=0,this.events=[],this.saved={},this.delaylist={},this.synclist={},this.lastdeltax=0,this.lastdeltay=0,this.detected=v();var C=n.extend({},this.detected);this.canhwscroll=C.hastransform&&k.opt.hwacceleration,this.ishwscroll=this.canhwscroll&&k.haswrapper,this.isrtlmode?this.isvertical?this.hasreversehr=!(C.iswebkit||C.isie||C.isie11):this.hasreversehr=!(C.iswebkit||C.isie&&!C.isie10&&!C.isie11):this.hasreversehr=!1,this.istouchcapable=!1,C.cantouch||!C.hasw3ctouch&&!C.hasmstouch?!C.cantouch||C.isios||C.isandroid||!C.iswebkit&&!C.ismozilla||(this.istouchcapable=!0):this.istouchcapable=!0,k.opt.enablemouselockapi||(C.hasmousecapture=!1,C.haspointerlock=!1),this.debounced=function(e,o,t){k&&(k.delaylist[e]||!1||(k.delaylist[e]={h:d(function(){k.delaylist[e].fn.call(k),k.delaylist[e]=!1},t)},o.call(k)),k.delaylist[e].fn=o)},this.synched=function(e,o){k.synclist[e]?k.synclist[e]=o:(k.synclist[e]=o,d(function(){k&&(k.synclist[e]&&k.synclist[e].call(k),k.synclist[e]=null)}))},this.unsynched=function(e){k.synclist[e]&&(k.synclist[e]=!1)},this.css=function(e,o){for(var t in o)k.saved.css.push([e,t,e.css(t)]),e.css(t,o[t])},this.scrollTop=function(e){return void 0===e?k.getScrollTop():k.setScrollTop(e)},this.scrollLeft=function(e){return void 0===e?k.getScrollLeft():k.setScrollLeft(e)};var N=function(e,o,t,r,i,s,n){this.st=e,this.ed=o,this.spd=t,this.p1=r||0,this.p2=i||1,this.p3=s||0,this.p4=n||1,this.ts=m(),this.df=o-e};if(N.prototype={B2:function(e){return 3*(1-e)*(1-e)*e},B3:function(e){return 3*(1-e)*e*e},B4:function(e){return e*e*e},getPos:function(){return(m()-this.ts)/this.spd},getNow:function(){var e=(m()-this.ts)/this.spd,o=this.B2(e)+this.B3(e)+this.B4(e);return e>=1?this.ed:this.st+this.df*o|0},update:function(e,o){return this.st=this.getNow(),this.ed=e,this.spd=o,this.ts=m(),this.df=this.ed-this.st,this}},this.ishwscroll){this.doc.translate={x:0,y:0,tx:"0px",ty:"0px"},C.hastranslate3d&&C.isios&&this.doc.css("-webkit-backface-visibility","hidden"),this.getScrollTop=function(e){if(!e){var o=g();if(o)return 16==o.length?-o[13]:-o[5];if(k.timerscroll&&k.timerscroll.bz)return k.timerscroll.bz.getNow()}return k.doc.translate.y},this.getScrollLeft=function(e){if(!e){var o=g();if(o)return 16==o.length?-o[12]:-o[4];if(k.timerscroll&&k.timerscroll.bh)return k.timerscroll.bh.getNow()}return k.doc.translate.x},this.notifyScrollEvent=function(e){var o=l.createEvent("UIEvents");o.initUIEvent("scroll",!1,!0,a,1),o.niceevent=!0,e.dispatchEvent(o)};var P=this.isrtlmode?1:-1;C.hastranslate3d&&k.opt.enabletranslate3d?(this.setScrollTop=function(e,o){k.doc.translate.y=e,k.doc.translate.ty=-1*e+"px",k.doc.css(C.trstyle,"translate3d("+k.doc.translate.tx+","+k.doc.translate.ty+",0)"),o||k.notifyScrollEvent(k.win[0])},this.setScrollLeft=function(e,o){k.doc.translate.x=e,k.doc.translate.tx=e*P+"px",k.doc.css(C.trstyle,"translate3d("+k.doc.translate.tx+","+k.doc.translate.ty+",0)"),o||k.notifyScrollEvent(k.win[0])}):(this.setScrollTop=function(e,o){k.doc.translate.y=e,k.doc.translate.ty=-1*e+"px",k.doc.css(C.trstyle,"translate("+k.doc.translate.tx+","+k.doc.translate.ty+")"),o||k.notifyScrollEvent(k.win[0])},this.setScrollLeft=function(e,o){k.doc.translate.x=e,k.doc.translate.tx=e*P+"px",k.doc.css(C.trstyle,"translate("+k.doc.translate.tx+","+k.doc.translate.ty+")"),o||k.notifyScrollEvent(k.win[0])})}else this.getScrollTop=function(){return k.docscroll.scrollTop()},this.setScrollTop=function(e){k.docscroll.scrollTop(e)},this.getScrollLeft=function(){return k.hasreversehr?k.detected.ismozilla?k.page.maxw-Math.abs(k.docscroll.scrollLeft()):k.page.maxw-k.docscroll.scrollLeft():k.docscroll.scrollLeft()},this.setScrollLeft=function(e){return setTimeout(function(){if(k)return k.hasreversehr&&(e=k.detected.ismozilla?-(k.page.maxw-e):k.page.maxw-e),k.docscroll.scrollLeft(e)},1)};this.getTarget=function(e){return!!e&&(e.target?e.target:!!e.srcElement&&e.srcElement)},this.hasParent=function(e,o){if(!e)return!1;for(var t=e.target||e.srcElement||e||!1;t&&t.id!=o;)t=t.parentNode||!1;return!1!==t};var R={thin:1,medium:3,thick:5};this.getDocumentScrollOffset=function(){return{top:a.pageYOffset||l.documentElement.scrollTop,left:a.pageXOffset||l.documentElement.scrollLeft}},this.getOffset=function(){if(k.isfixed){var e=k.win.offset(),o=k.getDocumentScrollOffset();return e.top-=o.top,e.left-=o.left,e}var t=k.win.offset();if(!k.viewport)return t;var r=k.viewport.offset();return{top:t.top-r.top,left:t.left-r.left}},this.updateScrollBar=function(e){var o,t;if(k.ishwscroll)k.rail.css({height:k.win.innerHeight()-(k.opt.railpadding.top+k.opt.railpadding.bottom)}),k.railh&&k.railh.css({width:k.win.innerWidth()-(k.opt.railpadding.left+k.opt.railpadding.right)});else{var r=k.getOffset();if(o={top:r.top,left:r.left-(k.opt.railpadding.left+k.opt.railpadding.right)},o.top+=y(k.win,"border-top-width",!0),o.left+=k.rail.align?k.win.outerWidth()-y(k.win,"border-right-width")-k.rail.width:y(k.win,"border-left-width"),(t=k.opt.railoffset)&&(t.top&&(o.top+=t.top),t.left&&(o.left+=t.left)),k.railslocked||k.rail.css({top:o.top,left:o.left,height:(e?e.h:k.win.innerHeight())-(k.opt.railpadding.top+k.opt.railpadding.bottom)}),k.zoom&&k.zoom.css({top:o.top+1,left:1==k.rail.align?o.left-20:o.left+k.rail.width+4}),k.railh&&!k.railslocked){o={top:r.top,left:r.left},(t=k.opt.railhoffset)&&(t.top&&(o.top+=t.top),t.left&&(o.left+=t.left));var i=k.railh.align?o.top+y(k.win,"border-top-width",!0)+k.win.innerHeight()-k.railh.height:o.top+y(k.win,"border-top-width",!0),s=o.left+y(k.win,"border-left-width");k.railh.css({top:i-(k.opt.railpadding.top+k.opt.railpadding.bottom),left:s,width:k.railh.width})}}},this.doRailClick=function(e,o,t){var r,i,s,n;k.railslocked||(k.cancelEvent(e),"pageY"in e||(e.pageX=e.clientX+l.documentElement.scrollLeft,e.pageY=e.clientY+l.documentElement.scrollTop),o?(r=t?k.doScrollLeft:k.doScrollTop)(s=t?(e.pageX-k.railh.offset().left-k.cursorwidth/2)*k.scrollratio.x:(e.pageY-k.rail.offset().top-k.cursorheight/2)*k.scrollratio.y):(r=t?k.doScrollLeftBy:k.doScrollBy,s=t?k.scroll.x:k.scroll.y,n=t?e.pageX-k.railh.offset().left:e.pageY-k.rail.offset().top,i=t?k.view.w:k.view.h,r(s>=n?i:-i)))},k.newscrolly=k.newscrollx=0,k.hasanimationframe="requestAnimationFrame"in a,k.hascancelanimationframe="cancelAnimationFrame"in a,k.hasborderbox=!1,this.init=function(){if(k.saved.css=[],C.isoperamini)return!0;if(C.isandroid&&!("hidden"in l))return!0;k.opt.emulatetouch=k.opt.emulatetouch||k.opt.touchbehavior,k.hasborderbox=a.getComputedStyle&&"border-box"===a.getComputedStyle(l.body)["box-sizing"];var e={"overflow-y":"hidden"};if((C.isie11||C.isie10)&&(e["-ms-overflow-style"]="none"),k.ishwscroll&&(this.doc.css(C.transitionstyle,C.prefixstyle+"transform 0ms ease-out"),C.transitionend&&k.bind(k.doc,C.transitionend,k.onScrollTransitionEnd,!1)),k.zindex="auto",k.ispage||"auto"!=k.opt.zindex?k.zindex=k.opt.zindex:k.zindex=w()||"auto",!k.ispage&&"auto"!=k.zindex&&k.zindex>s&&(s=k.zindex),k.isie&&0===k.zindex&&"auto"==k.opt.zindex&&(k.zindex="auto"),!k.ispage||!C.cantouch&&!C.isieold){var i=k.docscroll;k.ispage&&(i=k.haswrapper?k.win:k.doc),k.css(i,e),k.ispage&&(C.isie11||C.isie)&&k.css(n("html"),e),!C.isios||k.ispage||k.haswrapper||k.css(T,{"-webkit-overflow-scrolling":"touch"});var d=n(l.createElement("div"));d.css({position:"relative",top:0,float:"right",width:k.opt.cursorwidth,height:0,"background-color":k.opt.cursorcolor,border:k.opt.cursorborder,"background-clip":"padding-box","-webkit-border-radius":k.opt.cursorborderradius,"-moz-border-radius":k.opt.cursorborderradius,"border-radius":k.opt.cursorborderradius}),d.addClass("nicescroll-cursors"),k.cursor=d;var u=n(l.createElement("div"));u.attr("id",k.id),u.addClass("nicescroll-rails nicescroll-rails-vr");var h,m,f=["left","right","top","bottom"];for(var g in f)m=f[g],(h=k.opt.railpadding[m]||0)&&u.css("padding-"+m,h+"px");u.append(d),u.width=Math.max(parseFloat(k.opt.cursorwidth),d.outerWidth()),u.css({width:u.width+"px",zIndex:k.zindex,background:k.opt.background,cursor:"default"}),u.visibility=!0,u.scrollable=!0,u.align="left"==k.opt.railalign?0:1,k.rail=u,k.rail.drag=!1;var v=!1;!k.opt.boxzoom||k.ispage||C.isieold||(v=l.createElement("div"),k.bind(v,"click",k.doZoom),k.bind(v,"mouseenter",function(){k.zoom.css("opacity",k.opt.cursoropacitymax)}),k.bind(v,"mouseleave",function(){k.zoom.css("opacity",k.opt.cursoropacitymin)}),k.zoom=n(v),k.zoom.css({cursor:"pointer",zIndex:k.zindex,backgroundImage:"url("+k.opt.scriptpath+"zoomico.png)",height:18,width:18,backgroundPosition:"0 0"}),k.opt.dblclickzoom&&k.bind(k.win,"dblclick",k.doZoom),C.cantouch&&k.opt.gesturezoom&&(k.ongesturezoom=function(e){return e.scale>1.5&&k.doZoomIn(e),e.scale<.8&&k.doZoomOut(e),k.cancelEvent(e)},k.bind(k.win,"gestureend",k.ongesturezoom))),k.railh=!1;var y;if(k.opt.horizrailenabled&&(k.css(i,{overflowX:"hidden"}),(d=n(l.createElement("div"))).css({position:"absolute",top:0,height:k.opt.cursorwidth,width:0,backgroundColor:k.opt.cursorcolor,border:k.opt.cursorborder,backgroundClip:"padding-box","-webkit-border-radius":k.opt.cursorborderradius,"-moz-border-radius":k.opt.cursorborderradius,"border-radius":k.opt.cursorborderradius}),C.isieold&&d.css("overflow","hidden"),d.addClass("nicescroll-cursors"),k.cursorh=d,(y=n(l.createElement("div"))).attr("id",k.id+"-hr"),y.addClass("nicescroll-rails nicescroll-rails-hr"),y.height=Math.max(parseFloat(k.opt.cursorwidth),d.outerHeight()),y.css({height:y.height+"px",zIndex:k.zindex,background:k.opt.background}),y.append(d),y.visibility=!0,y.scrollable=!0,y.align="top"==k.opt.railvalign?0:1,k.railh=y,k.railh.drag=!1),k.ispage)u.css({position:"fixed",top:0,height:"100%"}),u.css(u.align?{right:0}:{left:0}),k.body.append(u),k.railh&&(y.css({position:"fixed",left:0,width:"100%"}),y.css(y.align?{bottom:0}:{top:0}),k.body.append(y));else{if(k.ishwscroll){"static"==k.win.css("position")&&k.css(k.win,{position:"relative"});var x="HTML"==k.win[0].nodeName?k.body:k.win;n(x).scrollTop(0).scrollLeft(0),k.zoom&&(k.zoom.css({position:"absolute",top:1,right:0,"margin-right":u.width+4}),x.append(k.zoom)),u.css({position:"absolute",top:0}),u.css(u.align?{right:0}:{left:0}),x.append(u),y&&(y.css({position:"absolute",left:0,bottom:0}),y.css(y.align?{bottom:0}:{top:0}),x.append(y))}else{k.isfixed="fixed"==k.win.css("position");var S=k.isfixed?"fixed":"absolute";k.isfixed||(k.viewport=k.getViewport(k.win[0])),k.viewport&&(k.body=k.viewport,/fixed|absolute/.test(k.viewport.css("position"))||k.css(k.viewport,{position:"relative"})),u.css({position:S}),k.zoom&&k.zoom.css({position:S}),k.updateScrollBar(),k.body.append(u),k.zoom&&k.body.append(k.zoom),k.railh&&(y.css({position:S}),k.body.append(y))}C.isios&&k.css(k.win,{"-webkit-tap-highlight-color":"rgba(0,0,0,0)","-webkit-touch-callout":"none"}),C.isie&&k.opt.disableoutline&&k.win.attr("hideFocus","true"),C.iswebkit&&k.opt.disableoutline&&k.win.css("outline","none")}if(!1===k.opt.autohidemode?(k.autohidedom=!1,k.rail.css({opacity:k.opt.cursoropacitymax}),k.railh&&k.railh.css({opacity:k.opt.cursoropacitymax})):!0===k.opt.autohidemode||"leave"===k.opt.autohidemode?(k.autohidedom=n().add(k.rail),C.isie8&&(k.autohidedom=k.autohidedom.add(k.cursor)),k.railh&&(k.autohidedom=k.autohidedom.add(k.railh)),k.railh&&C.isie8&&(k.autohidedom=k.autohidedom.add(k.cursorh))):"scroll"==k.opt.autohidemode?(k.autohidedom=n().add(k.rail),k.railh&&(k.autohidedom=k.autohidedom.add(k.railh))):"cursor"==k.opt.autohidemode?(k.autohidedom=n().add(k.cursor),k.railh&&(k.autohidedom=k.autohidedom.add(k.cursorh))):"hidden"==k.opt.autohidemode&&(k.autohidedom=!1,k.hide(),k.railslocked=!1),C.cantouch||k.istouchcapable||k.opt.emulatetouch||C.hasmstouch){k.scrollmom=new b(k),k.ontouchstart=function(e){if(e.pointerType&&("mouse"===e.pointerType||e.pointerType===e.MSPOINTER_TYPE_MOUSE))return!1;if(k.hasmoving=!1,!k.railslocked){var o;if(C.hasmstouch)for(o=!!e.target&&e.target;o;){var t=n(o).getNiceScroll();if(t.length>0&&t[0].me==k.me)break;if(t.length>0)return!1;if("DIV"==o.nodeName&&o.id==k.id)break;o=!!o.parentNode&&o.parentNode}if(e.stopPropagation(),k.cancelScroll(),(o=k.getTarget(e))&&/INPUT/i.test(o.nodeName)&&/range/i.test(o.type))return k.stopPropagation(e);if(!("clientX"in e)&&"changedTouches"in e&&(e.clientX=e.changedTouches[0].clientX,e.clientY=e.changedTouches[0].clientY),k.forcescreen){var r=e;(e={original:e.original?e.original:e}).clientX=r.screenX,e.clientY=r.screenY}if(k.rail.drag={x:e.clientX,y:e.clientY,sx:k.scroll.x,sy:k.scroll.y,st:k.getScrollTop(),sl:k.getScrollLeft(),pt:2,dl:!1,tg:o},k.ispage||!k.opt.directionlockdeadzone)k.rail.drag.dl="f";else{var i={w:c.width(),h:c.height()},s={w:Math.max(l.body.scrollWidth,l.documentElement.scrollWidth),h:Math.max(l.body.scrollHeight,l.documentElement.scrollHeight)},a=Math.max(0,s.h-i.h),d=Math.max(0,s.w-i.w);!k.rail.scrollable&&k.railh.scrollable?k.rail.drag.ck=a>0&&"v":k.rail.scrollable&&!k.railh.scrollable?k.rail.drag.ck=d>0&&"h":k.rail.drag.ck=!1,k.rail.drag.ck||(k.rail.drag.dl="f")}if(k.opt.emulatetouch&&k.isiframe&&C.isie){var u=k.win.position();k.rail.drag.x+=u.left,k.rail.drag.y+=u.top}if(k.hasmoving=!1,k.lastmouseup=!1,k.scrollmom.reset(e.clientX,e.clientY),!C.cantouch&&!this.istouchcapable&&!e.pointerType){if(!(!!o&&/INPUT|SELECT|BUTTON|TEXTAREA/i.test(o.nodeName)))return!k.ispage&&C.hasmousecapture&&o.setCapture(),k.opt.emulatetouch?(o.onclick&&!o._onclick&&(o._onclick=o.onclick,o.onclick=function(e){if(k.hasmoving)return!1;o._onclick.call(this,e)}),k.cancelEvent(e)):k.stopPropagation(e);/SUBMIT|CANCEL|BUTTON/i.test(n(o).attr("type"))&&(k.preventclick={tg:o,click:!1})}}},k.ontouchend=function(e){if(!k.rail.drag)return!0;if(2==k.rail.drag.pt){if(e.pointerType&&("mouse"===e.pointerType||e.pointerType===e.MSPOINTER_TYPE_MOUSE))return!1;if(k.rail.drag=!1,k.hasmoving&&(k.scrollmom.doMomentum(),k.lastmouseup=!0,k.hideCursor(),C.hasmousecapture&&l.releaseCapture(),!C.cantouch))return k.cancelEvent(e)}else if(1==k.rail.drag.pt)return k.onmouseup(e)};var z=k.opt.emulatetouch&&k.isiframe&&!C.hasmousecapture;k.ontouchmove=function(e,o){if(!k.rail.drag)return!1;if(e.targetTouches&&k.opt.preventmultitouchscrolling&&e.targetTouches.length>1)return!1;if(e.pointerType&&("mouse"===e.pointerType||e.pointerType===e.MSPOINTER_TYPE_MOUSE))return!1;if(2==k.rail.drag.pt){if("changedTouches"in e&&(e.clientX=e.changedTouches[0].clientX,e.clientY=e.changedTouches[0].clientY),k.rail.drag.y===e.clientY&&k.rail.drag.x===e.clientX)return!1;k.hasmoving||k.triggerScrollStart(e.clientX,e.clientY,0,0,0),k.hasmoving=!0,k.preventclick&&!k.preventclick.click&&(k.preventclick.click=k.preventclick.tg.onclick||!1,k.preventclick.tg.onclick=k.onpreventclick);var t,r;if(r=t=0,z&&!o){var i=k.win.position();r=-i.left,t=-i.top}var s=e.clientY+t,n=s-k.rail.drag.y,a=e.clientX+r,c=a-k.rail.drag.x,d=k.rail.drag.st-n;k.ishwscroll&&k.opt.bouncescroll?d<0?d=Math.round(d/2):d>k.page.maxh&&(d=k.page.maxh+Math.round((d-k.page.maxh)/2)):(d<0&&(d=0,s=0),d>k.page.maxh&&(d=k.page.maxh,s=0));var u;k.railh&&k.railh.scrollable&&(u=k.isrtlmode?c-k.rail.drag.sl:k.rail.drag.sl-c,k.ishwscroll&&k.opt.bouncescroll?u<0?u=Math.round(u/2):u>k.page.maxw&&(u=k.page.maxw+Math.round((u-k.page.maxw)/2)):(u<0&&(u=0,a=0),u>k.page.maxw&&(u=k.page.maxw,a=0)));var h=!1;if(k.rail.drag.dl)h=!0,"v"==k.rail.drag.dl?u=k.rail.drag.sl:"h"==k.rail.drag.dl&&(d=k.rail.drag.st);else{var p=Math.abs(n),m=Math.abs(c),f=k.opt.directionlockdeadzone;if("v"==k.rail.drag.ck){if(p>f&&m<=.3*p)return k.rail.drag=!1,!0;m>f&&(k.rail.drag.dl="f",T.scrollTop(T.scrollTop()))}else if("h"==k.rail.drag.ck){if(m>f&&p<=.3*m)return k.rail.drag=!1,!0;p>f&&(k.rail.drag.dl="f",T.scrollLeft(T.scrollLeft()))}}if(k.synched("touchmove",function(){k.rail.drag&&2==k.rail.drag.pt&&(k.prepareTransition&&k.resetTransition(),k.rail.scrollable&&k.setScrollTop(d),k.scrollmom.update(a,s),k.railh&&k.railh.scrollable?(k.setScrollLeft(u),k.showCursor(d,u)):k.showCursor(d),C.isie10&&l.selection.clear())}),C.ischrome&&k.istouchcapable&&(h=!1),h)return k.cancelEvent(e)}else if(1==k.rail.drag.pt)return k.onmousemove(e)},k.ontouchstartCursor=function(e,o){if(!k.rail.drag||3==k.rail.drag.pt){if(k.locked)return k.cancelEvent(e);k.cancelScroll(),k.rail.drag={x:e.touches[0].clientX,y:e.touches[0].clientY,sx:k.scroll.x,sy:k.scroll.y,pt:3,hr:!!o};var t=k.getTarget(e);return!k.ispage&&C.hasmousecapture&&t.setCapture(),k.isiframe&&!C.hasmousecapture&&(k.saved.csspointerevents=k.doc.css("pointer-events"),k.css(k.doc,{"pointer-events":"none"})),k.cancelEvent(e)}},k.ontouchendCursor=function(e){if(k.rail.drag){if(C.hasmousecapture&&l.releaseCapture(),k.isiframe&&!C.hasmousecapture&&k.doc.css("pointer-events",k.saved.csspointerevents),3!=k.rail.drag.pt)return;return k.rail.drag=!1,k.cancelEvent(e)}},k.ontouchmoveCursor=function(e){if(k.rail.drag){if(3!=k.rail.drag.pt)return;if(k.cursorfreezed=!0,k.rail.drag.hr){k.scroll.x=k.rail.drag.sx+(e.touches[0].clientX-k.rail.drag.x),k.scroll.x<0&&(k.scroll.x=0);var o=k.scrollvaluemaxw;k.scroll.x>o&&(k.scroll.x=o)}else{k.scroll.y=k.rail.drag.sy+(e.touches[0].clientY-k.rail.drag.y),k.scroll.y<0&&(k.scroll.y=0);var t=k.scrollvaluemax;k.scroll.y>t&&(k.scroll.y=t)}return k.synched("touchmove",function(){k.rail.drag&&3==k.rail.drag.pt&&(k.showCursor(),k.rail.drag.hr?k.doScrollLeft(Math.round(k.scroll.x*k.scrollratio.x),k.opt.cursordragspeed):k.doScrollTop(Math.round(k.scroll.y*k.scrollratio.y),k.opt.cursordragspeed))}),k.cancelEvent(e)}}}if(k.onmousedown=function(e,o){if(!k.rail.drag||1==k.rail.drag.pt){if(k.railslocked)return k.cancelEvent(e);k.cancelScroll(),k.rail.drag={x:e.clientX,y:e.clientY,sx:k.scroll.x,sy:k.scroll.y,pt:1,hr:o||!1};var t=k.getTarget(e);return C.hasmousecapture&&t.setCapture(),k.isiframe&&!C.hasmousecapture&&(k.saved.csspointerevents=k.doc.css("pointer-events"),k.css(k.doc,{"pointer-events":"none"})),k.hasmoving=!1,k.cancelEvent(e)}},k.onmouseup=function(e){if(k.rail.drag)return 1!=k.rail.drag.pt||(C.hasmousecapture&&l.releaseCapture(),k.isiframe&&!C.hasmousecapture&&k.doc.css("pointer-events",k.saved.csspointerevents),k.rail.drag=!1,k.cursorfreezed=!1,k.hasmoving&&k.triggerScrollEnd(),k.cancelEvent(e))},k.onmousemove=function(e){if(k.rail.drag){if(1!==k.rail.drag.pt)return;if(C.ischrome&&0===e.which)return k.onmouseup(e);if(k.cursorfreezed=!0,k.hasmoving||k.triggerScrollStart(e.clientX,e.clientY,0,0,0),k.hasmoving=!0,k.rail.drag.hr){k.scroll.x=k.rail.drag.sx+(e.clientX-k.rail.drag.x),k.scroll.x<0&&(k.scroll.x=0);var o=k.scrollvaluemaxw;k.scroll.x>o&&(k.scroll.x=o)}else{k.scroll.y=k.rail.drag.sy+(e.clientY-k.rail.drag.y),k.scroll.y<0&&(k.scroll.y=0);var t=k.scrollvaluemax;k.scroll.y>t&&(k.scroll.y=t)}return k.synched("mousemove",function(){k.cursorfreezed&&(k.showCursor(),k.rail.drag.hr?k.scrollLeft(Math.round(k.scroll.x*k.scrollratio.x)):k.scrollTop(Math.round(k.scroll.y*k.scrollratio.y)))}),k.cancelEvent(e)}k.checkarea=0},C.cantouch||k.opt.emulatetouch)k.onpreventclick=function(e){if(k.preventclick)return k.preventclick.tg.onclick=k.preventclick.click,k.preventclick=!1,k.cancelEvent(e)},k.onclick=!C.isios&&function(e){return!k.lastmouseup||(k.lastmouseup=!1,k.cancelEvent(e))},k.opt.grabcursorenabled&&C.cursorgrabvalue&&(k.css(k.ispage?k.doc:k.win,{cursor:C.cursorgrabvalue}),k.css(k.rail,{cursor:C.cursorgrabvalue}));else{var E=function(e){if(k.selectiondrag){if(e){var o=k.win.outerHeight(),t=e.pageY-k.selectiondrag.top;t>0&&t=o&&(t-=o),k.selectiondrag.df=t}if(0!==k.selectiondrag.df){var r=2*-Math.floor(k.selectiondrag.df/6);k.doScrollBy(r),k.debounced("doselectionscroll",function(){E()},50)}}};k.hasTextSelected="getSelection"in l?function(){return l.getSelection().rangeCount>0}:"selection"in l?function(){return"None"!=l.selection.type}:function(){return!1},k.onselectionstart=function(e){k.ispage||(k.selectiondrag=k.win.offset())},k.onselectionend=function(e){k.selectiondrag=!1},k.onselectiondrag=function(e){k.selectiondrag&&k.hasTextSelected()&&k.debounced("selectionscroll",function(){E(e)},250)}}if(C.hasw3ctouch?(k.css(k.ispage?n("html"):k.win,{"touch-action":"none"}),k.css(k.rail,{"touch-action":"none"}),k.css(k.cursor,{"touch-action":"none"}),k.bind(k.win,"pointerdown",k.ontouchstart),k.bind(l,"pointerup",k.ontouchend),k.bind(l,"pointermove",k.ontouchmove)):C.hasmstouch?(k.css(k.ispage?n("html"):k.win,{"-ms-touch-action":"none"}),k.css(k.rail,{"-ms-touch-action":"none"}),k.css(k.cursor,{"-ms-touch-action":"none"}),k.bind(k.win,"MSPointerDown",k.ontouchstart),k.bind(l,"MSPointerUp",k.ontouchend),k.bind(l,"MSPointerMove",k.ontouchmove),k.bind(k.cursor,"MSGestureHold",function(e){e.preventDefault()}),k.bind(k.cursor,"contextmenu",function(e){e.preventDefault()})):C.cantouch&&(k.bind(k.win,"touchstart",k.ontouchstart,!1,!0),k.bind(l,"touchend",k.ontouchend,!1,!0),k.bind(l,"touchcancel",k.ontouchend,!1,!0),k.bind(l,"touchmove",k.ontouchmove,!1,!0)),k.opt.emulatetouch&&(k.bind(k.win,"mousedown",k.ontouchstart,!1,!0),k.bind(l,"mouseup",k.ontouchend,!1,!0),k.bind(l,"mousemove",k.ontouchmove,!1,!0)),(k.opt.cursordragontouch||!C.cantouch&&!k.opt.emulatetouch)&&(k.rail.css({cursor:"default"}),k.railh&&k.railh.css({cursor:"default"}),k.jqbind(k.rail,"mouseenter",function(){if(!k.ispage&&!k.win.is(":visible"))return!1;k.canshowonmouseevent&&k.showCursor(),k.rail.active=!0}),k.jqbind(k.rail,"mouseleave",function(){k.rail.active=!1,k.rail.drag||k.hideCursor()}),k.opt.sensitiverail&&(k.bind(k.rail,"click",function(e){k.doRailClick(e,!1,!1)}),k.bind(k.rail,"dblclick",function(e){k.doRailClick(e,!0,!1)}),k.bind(k.cursor,"click",function(e){k.cancelEvent(e)}),k.bind(k.cursor,"dblclick",function(e){k.cancelEvent(e)})),k.railh&&(k.jqbind(k.railh,"mouseenter",function(){if(!k.ispage&&!k.win.is(":visible"))return!1;k.canshowonmouseevent&&k.showCursor(),k.rail.active=!0}),k.jqbind(k.railh,"mouseleave",function(){k.rail.active=!1,k.rail.drag||k.hideCursor()}),k.opt.sensitiverail&&(k.bind(k.railh,"click",function(e){k.doRailClick(e,!1,!0)}),k.bind(k.railh,"dblclick",function(e){k.doRailClick(e,!0,!0)}),k.bind(k.cursorh,"click",function(e){k.cancelEvent(e)}),k.bind(k.cursorh,"dblclick",function(e){k.cancelEvent(e)})))),k.opt.cursordragontouch&&(this.istouchcapable||C.cantouch)&&(k.bind(k.cursor,"touchstart",k.ontouchstartCursor),k.bind(k.cursor,"touchmove",k.ontouchmoveCursor),k.bind(k.cursor,"touchend",k.ontouchendCursor),k.cursorh&&k.bind(k.cursorh,"touchstart",function(e){k.ontouchstartCursor(e,!0)}),k.cursorh&&k.bind(k.cursorh,"touchmove",k.ontouchmoveCursor),k.cursorh&&k.bind(k.cursorh,"touchend",k.ontouchendCursor)),C.cantouch||k.opt.emulatetouch?(k.bind(C.hasmousecapture?k.win:l,"mouseup",k.ontouchend),k.onclick&&k.bind(l,"click",k.onclick),k.opt.cursordragontouch?(k.bind(k.cursor,"mousedown",k.onmousedown),k.bind(k.cursor,"mouseup",k.onmouseup),k.cursorh&&k.bind(k.cursorh,"mousedown",function(e){k.onmousedown(e,!0)}),k.cursorh&&k.bind(k.cursorh,"mouseup",k.onmouseup)):(k.bind(k.rail,"mousedown",function(e){e.preventDefault()}),k.railh&&k.bind(k.railh,"mousedown",function(e){e.preventDefault()}))):(k.bind(C.hasmousecapture?k.win:l,"mouseup",k.onmouseup),k.bind(l,"mousemove",k.onmousemove),k.onclick&&k.bind(l,"click",k.onclick),k.bind(k.cursor,"mousedown",k.onmousedown),k.bind(k.cursor,"mouseup",k.onmouseup),k.railh&&(k.bind(k.cursorh,"mousedown",function(e){k.onmousedown(e,!0)}),k.bind(k.cursorh,"mouseup",k.onmouseup)),!k.ispage&&k.opt.enablescrollonselection&&(k.bind(k.win[0],"mousedown",k.onselectionstart),k.bind(l,"mouseup",k.onselectionend),k.bind(k.cursor,"mouseup",k.onselectionend),k.cursorh&&k.bind(k.cursorh,"mouseup",k.onselectionend),k.bind(l,"mousemove",k.onselectiondrag)),k.zoom&&(k.jqbind(k.zoom,"mouseenter",function(){k.canshowonmouseevent&&k.showCursor(),k.rail.active=!0}),k.jqbind(k.zoom,"mouseleave",function(){k.rail.active=!1,k.rail.drag||k.hideCursor()}))),k.opt.enablemousewheel&&(k.isiframe||k.mousewheel(C.isie&&k.ispage?l:k.win,k.onmousewheel),k.mousewheel(k.rail,k.onmousewheel),k.railh&&k.mousewheel(k.railh,k.onmousewheelhr)),k.ispage||C.cantouch||/HTML|^BODY/.test(k.win[0].nodeName)||(k.win.attr("tabindex")||k.win.attr({tabindex:++r}),k.bind(k.win,"focus",function(e){o=k.getTarget(e).id||!0,k.hasfocus=!0,k.canshowonmouseevent&&k.noticeCursor()}),k.bind(k.win,"blur",function(e){o=!1,k.hasfocus=!1}),k.bind(k.win,"mouseenter",function(e){t=k.getTarget(e).id||!0,k.hasmousefocus=!0,k.canshowonmouseevent&&k.noticeCursor()}),k.bind(k.win,"mouseleave",function(e){t=!1,k.hasmousefocus=!1,k.rail.drag||k.hideCursor()})),k.onkeypress=function(e){if(k.railslocked&&0===k.page.maxh)return!0;e=e||a.event;var r=k.getTarget(e);if(r&&/INPUT|TEXTAREA|SELECT|OPTION/.test(r.nodeName)&&(!(r.getAttribute("type")||r.type||!1)||!/submit|button|cancel/i.tp))return!0;if(n(r).attr("contenteditable"))return!0;if(k.hasfocus||k.hasmousefocus&&!o||k.ispage&&!o&&!t){var i=e.keyCode;if(k.railslocked&&27!=i)return k.cancelEvent(e);var s=e.ctrlKey||!1,l=e.shiftKey||!1,c=!1;switch(i){case 38:case 63233:k.doScrollBy(72),c=!0;break;case 40:case 63235:k.doScrollBy(-72),c=!0;break;case 37:case 63232:k.railh&&(s?k.doScrollLeft(0):k.doScrollLeftBy(72),c=!0);break;case 39:case 63234:k.railh&&(s?k.doScrollLeft(k.page.maxw):k.doScrollLeftBy(-72),c=!0);break;case 33:case 63276:k.doScrollBy(k.view.h),c=!0;break;case 34:case 63277:k.doScrollBy(-k.view.h),c=!0;break;case 36:case 63273:k.railh&&s?k.doScrollPos(0,0):k.doScrollTo(0),c=!0;break;case 35:case 63275:k.railh&&s?k.doScrollPos(k.page.maxw,k.page.maxh):k.doScrollTo(k.page.maxh),c=!0;break;case 32:k.opt.spacebarenabled&&(l?k.doScrollBy(k.view.h):k.doScrollBy(-k.view.h),c=!0);break;case 27:k.zoomactive&&(k.doZoom(),c=!0)}if(c)return k.cancelEvent(e)}},k.opt.enablekeyboard&&k.bind(l,C.isopera&&!C.isopera12?"keypress":"keydown",k.onkeypress),k.bind(l,"keydown",function(e){(e.ctrlKey||!1)&&(k.wheelprevented=!0)}),k.bind(l,"keyup",function(e){e.ctrlKey||!1||(k.wheelprevented=!1)}),k.bind(a,"blur",function(e){k.wheelprevented=!1}),k.bind(a,"resize",k.lazyResize),k.bind(a,"orientationchange",k.lazyResize),k.bind(a,"load",k.lazyResize),C.ischrome&&!k.ispage&&!k.haswrapper){var M=k.win.attr("style"),L=parseFloat(k.win.css("width"))+1;k.win.css("width",L),k.synched("chromefix",function(){k.win.attr("style",M)})}k.onAttributeChange=function(e){k.lazyResize(k.isieold?250:30)},k.opt.enableobserver&&(k.isie11||!1===p||(k.observerbody=new p(function(e){if(e.forEach(function(e){if("attributes"==e.type)return T.hasClass("modal-open")&&T.hasClass("modal-dialog")&&!n.contains(n(".modal-dialog")[0],k.doc[0])?k.hide():k.show()}),k.me.clientWidth!=k.page.width||k.me.clientHeight!=k.page.height)return k.lazyResize(30)}),k.observerbody.observe(l.body,{childList:!0,subtree:!0,characterData:!1,attributes:!0,attributeFilter:["class"]})),k.ispage||k.haswrapper||(!1!==p?(k.observer=new p(function(e){e.forEach(k.onAttributeChange)}),k.observer.observe(k.win[0],{childList:!0,characterData:!1,attributes:!0,subtree:!1}),k.observerremover=new p(function(e){e.forEach(function(e){if(e.removedNodes.length>0)for(var o in e.removedNodes)if(k&&e.removedNodes[o]==k.win[0])return k.remove()})}),k.observerremover.observe(k.win[0].parentNode,{childList:!0,characterData:!1,attributes:!1,subtree:!1})):(k.bind(k.win,C.isie&&!C.isie9?"propertychange":"DOMAttrModified",k.onAttributeChange),C.isie9&&k.win[0].attachEvent("onpropertychange",k.onAttributeChange),k.bind(k.win,"DOMNodeRemoved",function(e){e.target==k.win[0]&&k.remove()})))),!k.ispage&&k.opt.boxzoom&&k.bind(a,"resize",k.resizeZoom),k.istextarea&&(k.bind(k.win,"keydown",k.lazyResize),k.bind(k.win,"mouseup",k.lazyResize)),k.lazyResize(30)}if("IFRAME"==this.doc[0].nodeName){var N=function(){k.iframexd=!1;var o;try{(o="contentDocument"in this?this.contentDocument:this.contentWindow._doc).domain}catch(e){k.iframexd=!0,o=!1}if(k.iframexd)return"console"in a&&console.log("NiceScroll error: policy restriced iframe"),!0;if(k.forcescreen=!0,k.isiframe&&(k.iframe={doc:n(o),html:k.doc.contents().find("html")[0],body:k.doc.contents().find("body")[0]},k.getContentSize=function(){return{w:Math.max(k.iframe.html.scrollWidth,k.iframe.body.scrollWidth),h:Math.max(k.iframe.html.scrollHeight,k.iframe.body.scrollHeight)}},k.docscroll=n(k.iframe.body)),!C.isios&&k.opt.iframeautoresize&&!k.isiframe){k.win.scrollTop(0),k.doc.height("");var t=Math.max(o.getElementsByTagName("html")[0].scrollHeight,o.body.scrollHeight);k.doc.height(t)}k.lazyResize(30),k.css(n(k.iframe.body),e),C.isios&&k.haswrapper&&k.css(n(o.body),{"-webkit-transform":"translate3d(0,0,0)"}),"contentWindow"in this?k.bind(this.contentWindow,"scroll",k.onscroll):k.bind(o,"scroll",k.onscroll),k.opt.enablemousewheel&&k.mousewheel(o,k.onmousewheel),k.opt.enablekeyboard&&k.bind(o,C.isopera?"keypress":"keydown",k.onkeypress),C.cantouch?(k.bind(o,"touchstart",k.ontouchstart),k.bind(o,"touchmove",k.ontouchmove)):k.opt.emulatetouch&&(k.bind(o,"mousedown",k.ontouchstart),k.bind(o,"mousemove",function(e){return k.ontouchmove(e,!0)}),k.opt.grabcursorenabled&&C.cursorgrabvalue&&k.css(n(o.body),{cursor:C.cursorgrabvalue})),k.bind(o,"mouseup",k.ontouchend),k.zoom&&(k.opt.dblclickzoom&&k.bind(o,"dblclick",k.doZoom),k.ongesturezoom&&k.bind(o,"gestureend",k.ongesturezoom))};this.doc[0].readyState&&"complete"===this.doc[0].readyState&&setTimeout(function(){N.call(k.doc[0],!1)},500),k.bind(this.doc,"load",N)}},this.showCursor=function(e,o){if(k.cursortimeout&&(clearTimeout(k.cursortimeout),k.cursortimeout=0),k.rail){if(k.autohidedom&&(k.autohidedom.stop().css({opacity:k.opt.cursoropacitymax}),k.cursoractive=!0),k.rail.drag&&1==k.rail.drag.pt||(void 0!==e&&!1!==e&&(k.scroll.y=e/k.scrollratio.y|0),void 0!==o&&(k.scroll.x=o/k.scrollratio.x|0)),k.cursor.css({height:k.cursorheight,top:k.scroll.y}),k.cursorh){var t=k.hasreversehr?k.scrollvaluemaxw-k.scroll.x:k.scroll.x;k.cursorh.css({width:k.cursorwidth,left:!k.rail.align&&k.rail.visibility?t+k.rail.width:t}),k.cursoractive=!0}k.zoom&&k.zoom.stop().css({opacity:k.opt.cursoropacitymax})}},this.hideCursor=function(e){k.cursortimeout||k.rail&&k.autohidedom&&(k.hasmousefocus&&"leave"===k.opt.autohidemode||(k.cursortimeout=setTimeout(function(){k.rail.active&&k.showonmouseevent||(k.autohidedom.stop().animate({opacity:k.opt.cursoropacitymin}),k.zoom&&k.zoom.stop().animate({opacity:k.opt.cursoropacitymin}),k.cursoractive=!1),k.cursortimeout=0},e||k.opt.hidecursordelay)))},this.noticeCursor=function(e,o,t){k.showCursor(o,t),k.rail.active||k.hideCursor(e)},this.getContentSize=k.ispage?function(){return{w:Math.max(l.body.scrollWidth,l.documentElement.scrollWidth),h:Math.max(l.body.scrollHeight,l.documentElement.scrollHeight)}}:k.haswrapper?function(){return{w:k.doc[0].offsetWidth,h:k.doc[0].offsetHeight}}:function(){return{w:k.docscroll[0].scrollWidth,h:k.docscroll[0].scrollHeight}},this.onResize=function(e,o){if(!k||!k.win)return!1;var t=k.page.maxh,r=k.page.maxw,i={h:k.view.h,w:k.view.w};if(k.view={w:k.ispage?k.win.width():k.win[0].clientWidth,h:k.ispage?k.win.height():k.win[0].clientHeight},k.page=o||k.getContentSize(),k.page.maxh=Math.max(0,k.page.h-k.view.h),k.page.maxw=Math.max(0,k.page.w-k.view.w),k.page.maxh==t&&k.page.maxw==r&&k.view.w==i.w&&k.view.h==i.h){if(k.ispage)return k;var s=k.win.offset();if(k.lastposition){var n=k.lastposition;if(n.top==s.top&&n.left==s.left)return k}k.lastposition=s}return 0===k.page.maxh?(k.hideRail(),k.scrollvaluemax=0,k.scroll.y=0,k.scrollratio.y=0,k.cursorheight=0,k.setScrollTop(0),k.rail&&(k.rail.scrollable=!1)):(k.page.maxh-=k.opt.railpadding.top+k.opt.railpadding.bottom,k.rail.scrollable=!0),0===k.page.maxw?(k.hideRailHr(),k.scrollvaluemaxw=0,k.scroll.x=0,k.scrollratio.x=0,k.cursorwidth=0,k.setScrollLeft(0),k.railh&&(k.railh.scrollable=!1)):(k.page.maxw-=k.opt.railpadding.left+k.opt.railpadding.right,k.railh&&(k.railh.scrollable=k.opt.horizrailenabled)),k.railslocked=k.locked||0===k.page.maxh&&0===k.page.maxw,k.railslocked?(k.ispage||k.updateScrollBar(k.view),!1):(k.hidden||k.visibility?!k.railh||k.hidden||k.railh.visibility||k.showRailHr():k.showRail().showRailHr(),k.istextarea&&k.win.css("resize")&&"none"!=k.win.css("resize")&&(k.view.h-=20),k.cursorheight=Math.min(k.view.h,Math.round(k.view.h*(k.view.h/k.page.h))),k.cursorheight=k.opt.cursorfixedheight?k.opt.cursorfixedheight:Math.max(k.opt.cursorminheight,k.cursorheight),k.cursorwidth=Math.min(k.view.w,Math.round(k.view.w*(k.view.w/k.page.w))),k.cursorwidth=k.opt.cursorfixedheight?k.opt.cursorfixedheight:Math.max(k.opt.cursorminheight,k.cursorwidth),k.scrollvaluemax=k.view.h-k.cursorheight-(k.opt.railpadding.top+k.opt.railpadding.bottom),k.hasborderbox||(k.scrollvaluemax-=k.cursor[0].offsetHeight-k.cursor[0].clientHeight),k.railh&&(k.railh.width=k.page.maxh>0?k.view.w-k.rail.width:k.view.w,k.scrollvaluemaxw=k.railh.width-k.cursorwidth-(k.opt.railpadding.left+k.opt.railpadding.right)),k.ispage||k.updateScrollBar(k.view),k.scrollratio={x:k.page.maxw/k.scrollvaluemaxw,y:k.page.maxh/k.scrollvaluemax},k.getScrollTop()>k.page.maxh?k.doScrollTop(k.page.maxh):(k.scroll.y=k.getScrollTop()/k.scrollratio.y|0,k.scroll.x=k.getScrollLeft()/k.scrollratio.x|0,k.cursoractive&&k.noticeCursor()),k.scroll.y&&0===k.getScrollTop()&&k.doScrollTo(Math.floor(k.scroll.y*k.scrollratio.y)),k)},this.resize=k.onResize,this.hlazyresize=0,this.lazyResize=function(e){return k.haswrapper||k.ispage||k.hide(),k.hlazyresize&&clearTimeout(k.hlazyresize),k.hlazyresize=setTimeout(function(){k&&(k.haswrapper||k.ispage||k.show(),k.resize())},240),k},this.jqbind=function(e,o,t){k.events.push({e:e,n:o,f:t,q:!0}),n(e).on(o,t)},this.mousewheel=function(e,o,t){var r="jquery"in e?e[0]:e;if("onwheel"in l.createElement("div"))k._bind(r,"wheel",o,t||!1);else{var i=void 0!==l.onmousewheel?"mousewheel":"DOMMouseScroll";x(r,i,o,t||!1),"DOMMouseScroll"==i&&x(r,"MozMousePixelScroll",o,t||!1)}};var _=!1;if(C.haseventlistener){try{var H=Object.defineProperty({},"passive",{get:function(){_=!0}});a.addEventListener("test",null,H)}catch(e){}this.cancelEvent=function(e){return!!e&&((e=e.original?e.original:e).cancelable&&e.preventDefault(),e.stopPropagation(),e.preventManipulation&&e.preventManipulation(),!1)},this.stopPropagation=function(e){return!!e&&((e=e.original?e.original:e).stopPropagation(),!1)}}else Event.prototype.preventDefault=function(){this.returnValue=!1},Event.prototype.stopPropagation=function(){this.cancelBubble=!0},a.constructor.prototype.addEventListener=l.constructor.prototype.addEventListener=Element.prototype.addEventListener=function(e,o,t){this.attachEvent("on"+e,o)},a.constructor.prototype.removeEventListener=l.constructor.prototype.removeEventListener=Element.prototype.removeEventListener=function(e,o,t){this.detachEvent("on"+e,o)},this.cancelEvent=function(e){return!!(e=e||a.event)&&(e.cancelBubble=!0,e.cancel=!0,e.returnValue=!1,!1)},this.stopPropagation=function(e){return(e=e||a.event)&&(e.cancelBubble=!0),!1};this.bind=function(e,o,t,r,i){var s="jquery"in e?e[0]:e;k._bind(s,o,t,r||!1,i||!1)},this._bind=function(e,o,t,r,i){k.events.push({e:e,n:o,f:t,b:r,q:!1}),_&&i?e.addEventListener(o,t,{passive:!1,capture:r}):e.addEventListener(o,t,r||!1)},this._unbind=function(e,o,t,r){e.removeEventListener(o,t,r)},this.unbindAll=function(){for(var e=0;e0)return t;o=!!o.parentNode&&o.parentNode}return!1},this.triggerScrollStart=function(e,o,t,r,i){if(k.onscrollstart){var s={type:"scrollstart",current:{x:e,y:o},request:{x:t,y:r},end:{x:k.newscrollx,y:k.newscrolly},speed:i};k.onscrollstart.call(k,s)}},this.triggerScrollEnd=function(){if(k.onscrollend){var e=k.getScrollLeft(),o=k.getScrollTop(),t={type:"scrollend",current:{x:e,y:o},end:{x:e,y:o}};k.onscrollend.call(k,t)}};var I=0,O=0,Y=0,B=1,X=!1;if(this.onmousewheel=function(e){if(!k.wheelprevented){if(k.railslocked)return k.debounced("checkunlock",k.resize,250),!0;if(k.rail.drag)return k.cancelEvent(e);if("auto"===k.opt.oneaxismousemode&&0!==e.deltaX&&(k.opt.oneaxismousemode=!1),k.opt.oneaxismousemode&&0===e.deltaX&&!k.rail.scrollable)return!k.railh||!k.railh.scrollable||k.onmousewheelhr(e);var o=m(),t=!1;if(k.opt.preservenativescrolling&&k.checkarea+600k.page.maxh&&(o=k.page.maxh+(o-k.page.maxh)/2|0),e<0?e=e/2|0:e>k.page.maxw&&(e=k.page.maxw+(o-k.page.maxw)/2|0)):(o<0?o=0:o>k.page.maxh&&(o=k.page.maxh),e<0?e=0:e>k.page.maxw&&(e=k.page.maxw)),k.scrollrunning&&e==k.newscrollx&&o==k.newscrolly)return!1;k.newscrolly=o,k.newscrollx=e;var s=k.getScrollTop(),n=k.getScrollLeft(),l={};l.x=e-n,l.y=o-s;var a=0|Math.sqrt(l.x*l.x+l.y*l.y),c=k.prepareTransition(a);k.scrollrunning||(k.scrollrunning=!0,k.triggerScrollStart(n,s,e,o,c),k.cursorupdate.start()),k.scrollendtrapped=!0,C.transitionend||(k.scrollendtrapped&&clearTimeout(k.scrollendtrapped),k.scrollendtrapped=setTimeout(k.onScrollTransitionEnd,c)),k.setScrollTop(k.newscrolly),k.setScrollLeft(k.newscrollx)},this.cancelScroll=function(){if(!k.scrollendtrapped)return!0;var e=k.getScrollTop(),o=k.getScrollLeft();return k.scrollrunning=!1,C.transitionend||clearTimeout(C.transitionend),k.scrollendtrapped=!1,k.resetTransition(),k.setScrollTop(e),k.railh&&k.setScrollLeft(o),k.timerscroll&&k.timerscroll.tm&&clearInterval(k.timerscroll.tm),k.timerscroll=!1,k.cursorfreezed=!1,k.cursorupdate.stop(),k.showCursor(e,o),k},this.onScrollTransitionEnd=function(){if(k.scrollendtrapped){var e=k.getScrollTop(),o=k.getScrollLeft();if(e<0?e=0:e>k.page.maxh&&(e=k.page.maxh),o<0?o=0:o>k.page.maxw&&(o=k.page.maxw),e!=k.newscrolly||o!=k.newscrollx)return k.doScrollPos(o,e,k.opt.snapbackspeed);k.scrollrunning&&k.triggerScrollEnd(),k.scrollrunning=!1,k.scrollendtrapped=!1,k.resetTransition(),k.timerscroll=!1,k.setScrollTop(e),k.railh&&k.setScrollLeft(o),k.cursorupdate.stop(),k.noticeCursor(!1,e,o),k.cursorfreezed=!1}}}else this.doScrollLeft=function(e,o){var t=k.scrollrunning?k.newscrolly:k.getScrollTop();k.doScrollPos(e,t,o)},this.doScrollTop=function(e,o){var t=k.scrollrunning?k.newscrollx:k.getScrollLeft();k.doScrollPos(t,e,o)},this.doScrollPos=function(e,o,t){var r=k.getScrollTop(),i=k.getScrollLeft();((k.newscrolly-r)*(o-r)<0||(k.newscrollx-i)*(e-i)<0)&&k.cancelScroll();var s=!1;if(k.bouncescroll&&k.rail.visibility||(o<0?(o=0,s=!0):o>k.page.maxh&&(o=k.page.maxh,s=!0)),k.bouncescroll&&k.railh.visibility||(e<0?(e=0,s=!0):e>k.page.maxw&&(e=k.page.maxw,s=!0)),k.scrollrunning&&k.newscrolly===o&&k.newscrollx===e)return!0;k.newscrolly=o,k.newscrollx=e,k.dst={},k.dst.x=e-i,k.dst.y=o-r,k.dst.px=i,k.dst.py=r;var n=0|Math.sqrt(k.dst.x*k.dst.x+k.dst.y*k.dst.y),l=k.getTransitionSpeed(n);k.bzscroll={};var a=s?1:.58;k.bzscroll.x=new N(i,k.newscrollx,l,0,0,a,1),k.bzscroll.y=new N(r,k.newscrolly,l,0,0,a,1);var c=function(){if(k.scrollrunning){var e=k.bzscroll.y.getPos();k.setScrollLeft(k.bzscroll.x.getNow()),k.setScrollTop(k.bzscroll.y.getNow()),e<=1?d(c):(k.scrollrunning=!1,k.timer=0,k.triggerScrollEnd())}};k.scrollrunning||(k.triggerScrollStart(i,r,e,o,l),k.scrollrunning=!0,k.timer=d(c))},this.cancelScroll=function(){return k.timer&&u(k.timer),k.timer=0,k.bzscroll=!1,k.scrollrunning=!1,k};else this.doScrollLeft=function(e,o){var t=k.getScrollTop();k.doScrollPos(e,t,o)},this.doScrollTop=function(e,o){var t=k.getScrollLeft();k.doScrollPos(t,e,o)},this.doScrollPos=function(e,o,t){var r=e>k.page.maxw?k.page.maxw:e;r<0&&(r=0);var i=o>k.page.maxh?k.page.maxh:o;i<0&&(i=0),k.synched("scroll",function(){k.setScrollTop(i),k.setScrollLeft(r)})},this.cancelScroll=function(){};this.doScrollBy=function(e,o){S(0,e)},this.doScrollLeftBy=function(e,o){S(e,0)},this.doScrollTo=function(e,o){var t=o?Math.round(e*k.scrollratio.y):e;t<0?t=0:t>k.page.maxh&&(t=k.page.maxh),k.cursorfreezed=!1,k.doScrollTop(e)},this.checkContentSize=function(){var e=k.getContentSize();e.h==k.page.h&&e.w==k.page.w||k.resize(!1,e)},k.onscroll=function(e){k.rail.drag||k.cursorfreezed||k.synched("scroll",function(){k.scroll.y=Math.round(k.getScrollTop()/k.scrollratio.y),k.railh&&(k.scroll.x=Math.round(k.getScrollLeft()/k.scrollratio.x)),k.noticeCursor()})},k.bind(k.docscroll,"scroll",k.onscroll),this.doZoomIn=function(e){if(!k.zoomactive){k.zoomactive=!0,k.zoomrestore={style:{}};var o=["position","top","left","zIndex","backgroundColor","marginTop","marginBottom","marginLeft","marginRight"],t=k.win[0].style;for(var r in o){var i=o[r];k.zoomrestore.style[i]=void 0!==t[i]?t[i]:""}k.zoomrestore.style.width=k.win.css("width"),k.zoomrestore.style.height=k.win.css("height"),k.zoomrestore.padding={w:k.win.outerWidth()-k.win.width(),h:k.win.outerHeight()-k.win.height()},C.isios4&&(k.zoomrestore.scrollTop=c.scrollTop(),c.scrollTop(0)),k.win.css({position:C.isios4?"absolute":"fixed",top:0,left:0,zIndex:s+100,margin:0});var n=k.win.css("backgroundColor");return(""===n||/transparent|rgba\(0, 0, 0, 0\)|rgba\(0,0,0,0\)/.test(n))&&k.win.css("backgroundColor","#fff"),k.rail.css({zIndex:s+101}),k.zoom.css({zIndex:s+102}),k.zoom.css("backgroundPosition","0 -18px"),k.resizeZoom(),k.onzoomin&&k.onzoomin.call(k),k.cancelEvent(e)}},this.doZoomOut=function(e){if(k.zoomactive)return k.zoomactive=!1,k.win.css("margin",""),k.win.css(k.zoomrestore.style),C.isios4&&c.scrollTop(k.zoomrestore.scrollTop),k.rail.css({"z-index":k.zindex}),k.zoom.css({"z-index":k.zindex}),k.zoomrestore=!1,k.zoom.css("backgroundPosition","0 0"),k.onResize(),k.onzoomout&&k.onzoomout.call(k),k.cancelEvent(e)},this.doZoom=function(e){return k.zoomactive?k.doZoomOut(e):k.doZoomIn(e)},this.resizeZoom=function(){if(k.zoomactive){var e=k.getScrollTop();k.win.css({width:c.width()-k.zoomrestore.padding.w+"px",height:c.height()-k.zoomrestore.padding.h+"px"}),k.onResize(),k.setScrollTop(Math.min(k.page.maxh,e))}},this.init(),n.nicescroll.push(this)},b=function(e){var o=this;this.nc=e,this.lastx=0,this.lasty=0,this.speedx=0,this.speedy=0,this.lasttime=0,this.steptime=0,this.snapx=!1,this.snapy=!1,this.demulx=0,this.demuly=0,this.lastscrollx=-1,this.lastscrolly=-1,this.chkx=0,this.chky=0,this.timer=0,this.reset=function(e,t){o.stop(),o.steptime=0,o.lasttime=m(),o.speedx=0,o.speedy=0,o.lastx=e,o.lasty=t,o.lastscrollx=-1,o.lastscrolly=-1},this.update=function(e,t){var r=m();o.steptime=r-o.lasttime,o.lasttime=r;var i=t-o.lasty,s=e-o.lastx,n=o.nc.getScrollTop()+i,l=o.nc.getScrollLeft()+s;o.snapx=l<0||l>o.nc.page.maxw,o.snapy=n<0||n>o.nc.page.maxh,o.speedx=s,o.speedy=i,o.lastx=e,o.lasty=t},this.stop=function(){o.nc.unsynched("domomentum2d"),o.timer&&clearTimeout(o.timer),o.timer=0,o.lastscrollx=-1,o.lastscrolly=-1},this.doSnapy=function(e,t){var r=!1;t<0?(t=0,r=!0):t>o.nc.page.maxh&&(t=o.nc.page.maxh,r=!0),e<0?(e=0,r=!0):e>o.nc.page.maxw&&(e=o.nc.page.maxw,r=!0),r?o.nc.doScrollPos(e,t,o.nc.opt.snapbackspeed):o.nc.triggerScrollEnd()},this.doMomentum=function(e){var t=m(),r=e?t+e:o.lasttime,i=o.nc.getScrollLeft(),s=o.nc.getScrollTop(),n=o.nc.page.maxh,l=o.nc.page.maxw;o.speedx=l>0?Math.min(60,o.speedx):0,o.speedy=n>0?Math.min(60,o.speedy):0;var a=r&&t-r<=60;(s<0||s>n||i<0||i>l)&&(a=!1);var c=!(!o.speedy||!a)&&o.speedy,d=!(!o.speedx||!a)&&o.speedx;if(c||d){var u=Math.max(16,o.steptime);if(u>50){var h=u/50;o.speedx*=h,o.speedy*=h,u=50}o.demulxy=0,o.lastscrollx=o.nc.getScrollLeft(),o.chkx=o.lastscrollx,o.lastscrolly=o.nc.getScrollTop(),o.chky=o.lastscrolly;var p=o.lastscrollx,f=o.lastscrolly,g=function(){var e=m()-t>600?.04:.02;o.speedx&&(p=Math.floor(o.lastscrollx-o.speedx*(1-o.demulxy)),o.lastscrollx=p,(p<0||p>l)&&(e=.1)),o.speedy&&(f=Math.floor(o.lastscrolly-o.speedy*(1-o.demulxy)),o.lastscrolly=f,(f<0||f>n)&&(e=.1)),o.demulxy=Math.min(1,o.demulxy+e),o.nc.synched("domomentum2d",function(){if(o.speedx){o.nc.getScrollLeft();o.chkx=p,o.nc.setScrollLeft(p)}if(o.speedy){o.nc.getScrollTop();o.chky=f,o.nc.setScrollTop(f)}o.timer||(o.nc.hideCursor(),o.doSnapy(p,f))}),o.demulxy<1?o.timer=setTimeout(g,u):(o.stop(),o.nc.hideCursor(),o.doSnapy(p,f))};g()}else o.doSnapy(o.nc.getScrollLeft(),o.nc.getScrollTop())}},y=e.fn.scrollTop;e.cssHooks.pageYOffset={get:function(e,o,t){var r=n.data(e,"__nicescroll")||!1;return r&&r.ishwscroll?r.getScrollTop():y.call(e)},set:function(e,o){var t=n.data(e,"__nicescroll")||!1;return t&&t.ishwscroll?t.setScrollTop(parseInt(o)):y.call(e,o),this}},e.fn.scrollTop=function(e){if(void 0===e){var o=!!this[0]&&(n.data(this[0],"__nicescroll")||!1);return o&&o.ishwscroll?o.getScrollTop():y.call(this)}return this.each(function(){var o=n.data(this,"__nicescroll")||!1;o&&o.ishwscroll?o.setScrollTop(parseInt(e)):y.call(n(this),e)})};var x=e.fn.scrollLeft;n.cssHooks.pageXOffset={get:function(e,o,t){var r=n.data(e,"__nicescroll")||!1;return r&&r.ishwscroll?r.getScrollLeft():x.call(e)},set:function(e,o){var t=n.data(e,"__nicescroll")||!1;return t&&t.ishwscroll?t.setScrollLeft(parseInt(o)):x.call(e,o),this}},e.fn.scrollLeft=function(e){if(void 0===e){var o=!!this[0]&&(n.data(this[0],"__nicescroll")||!1);return o&&o.ishwscroll?o.getScrollLeft():x.call(this)}return this.each(function(){var o=n.data(this,"__nicescroll")||!1;o&&o.ishwscroll?o.setScrollLeft(parseInt(e)):x.call(n(this),e)})};var S=function(e){var o=this;if(this.length=0,this.name="nicescrollarray",this.each=function(e){return n.each(o,e),o},this.push=function(e){o[o.length]=e,o.length++},this.eq=function(e){return o[e]},e)for(var t=0;t1?n(e,r):s,i.win=r}!("doc"in i)||"win"in i||(i.win=r);var l=r.data("__nicescroll")||!1;l||(i.doc=i.doc||r,l=new w(i,r),r.data("__nicescroll",l)),t.push(l)}),1===t.length?t[0]:t},a.NiceScroll={getjQuery:function(){return e}},n.nicescroll||(n.nicescroll=new S,n.nicescroll.options=f)}); \ No newline at end of file +!function(e){"function"==typeof define&&define.amd?define(["jquery"],e):"object"==typeof exports?module.exports=e(require("jquery")):e(jQuery)}(function(e){"use strict";var o=!1,t=!1,r=0,i=2e3,s=0,n=e,l=document,a=window,c=n(a),d=a.requestAnimationFrame||a.webkitRequestAnimationFrame||a.mozRequestAnimationFrame||!1,u=a.cancelAnimationFrame||a.webkitCancelAnimationFrame||a.mozCancelAnimationFrame||!1;if(d)a.cancelAnimationFrame||(u=function(e){});else{var h=0;d=function(e,o){var t=(new Date).getTime(),r=Math.max(0,16-(t-h)),i=a.setTimeout(function(){e(t+r)},r);return h=t+r,i},u=function(e){a.clearTimeout(e)}}var p=a.MutationObserver||a.WebKitMutationObserver||!1,m=Date.now||function(){return(new Date).getTime()},f={zindex:"auto",cursoropacitymin:0,cursoropacitymax:1,cursorcolor:"#424242",cursorwidth:"6px",cursorborder:"1px solid #fff",cursorborderradius:"5px",scrollspeed:40,mousescrollstep:27,touchbehavior:!1,emulatetouch:!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 e=l.currentScript||function(){var e=l.getElementsByTagName("script");return!!e.length&&e[e.length-1]}(),o=e?e.src.split("?")[0]:"";return o.split("/").length>0?o.split("/").slice(0,-1).join("/")+"/":""}(),preventmultitouchscrolling:!0,disablemutationobserver:!1,enableobserver:!0,scrollbarid:!1},g=!1,v=function(){if(g)return g;var e=l.createElement("DIV"),o=e.style,t=navigator.userAgent,r=navigator.platform,i={};return i.haspointerlock="pointerLockElement"in l||"webkitPointerLockElement"in l||"mozPointerLockElement"in l,i.isopera="opera"in a,i.isopera12=i.isopera&&"getUserMedia"in navigator,i.isoperamini="[object OperaMini]"===Object.prototype.toString.call(a.operamini),i.isie="all"in l&&"attachEvent"in e&&!i.isopera,i.isieold=i.isie&&!("msInterpolationMode"in o),i.isie7=i.isie&&!i.isieold&&(!("documentMode"in l)||7===l.documentMode),i.isie8=i.isie&&"documentMode"in l&&8===l.documentMode,i.isie9=i.isie&&"performance"in a&&9===l.documentMode,i.isie10=i.isie&&"performance"in a&&10===l.documentMode,i.isie11="msRequestFullscreen"in e&&l.documentMode>=11,i.ismsedge="msCredentials"in a,i.ismozilla="MozAppearance"in o,i.iswebkit=!i.ismsedge&&"WebkitAppearance"in o,i.ischrome=i.iswebkit&&"chrome"in a,i.ischrome38=i.ischrome&&"touchAction"in o,i.ischrome22=!i.ischrome38&&i.ischrome&&i.haspointerlock,i.ischrome26=!i.ischrome38&&i.ischrome&&"transition"in o,i.cantouch="ontouchstart"in l.documentElement||"ontouchstart"in a,i.hasw3ctouch=(a.PointerEvent||!1)&&(navigator.MaxTouchPoints>0||navigator.msMaxTouchPoints>0),i.hasmstouch=!i.hasw3ctouch&&(a.MSPointerEvent||!1),i.ismac=/^mac$/i.test(r),i.isios=i.cantouch&&/iphone|ipad|ipod/i.test(r),i.isios4=i.isios&&!("seal"in Object),i.isios7=i.isios&&"webkitHidden"in l,i.isios8=i.isios&&"hidden"in l,i.isios10=i.isios&&a.Proxy,i.isandroid=/android/i.test(t),i.haseventlistener="addEventListener"in e,i.trstyle=!1,i.hastransform=!1,i.hastranslate3d=!1,i.transitionstyle=!1,i.hastransition=!1,i.transitionend=!1,i.trstyle="transform",i.hastransform="transform"in o||function(){for(var e=["msTransform","webkitTransform","MozTransform","OTransform"],t=0,r=e.length;t0;){if(9==e[0].nodeType)return!1;var o=e.css("zIndex");if(!isNaN(o)&&0!==o)return parseInt(o);e=e.parent()}return!1}function y(e,o,t){var r=e.css(o),i=parseFloat(r);if(isNaN(i)){var s=3==(i=R[r]||0)?t?k.win.outerHeight()-k.win.innerHeight():k.win.outerWidth()-k.win.innerWidth():1;return k.isie8&&i&&(i+=1),s?i:0}return i}function x(e,o,t,r){k._bind(e,o,function(r){var i={original:r=r||a.event,target:r.target||r.srcElement,type:"wheel",deltaMode:"MozMousePixelScroll"==r.type?0:1,deltaX:0,deltaZ:0,preventDefault:function(){return r.preventDefault?r.preventDefault():r.returnValue=!1,!1},stopImmediatePropagation:function(){r.stopImmediatePropagation?r.stopImmediatePropagation():r.cancelBubble=!0}};return"mousewheel"==o?(r.wheelDeltaX&&(i.deltaX=-.025*r.wheelDeltaX),r.wheelDeltaY&&(i.deltaY=-.025*r.wheelDeltaY),!i.deltaY&&!i.deltaX&&(i.deltaY=-.025*r.wheelDelta)):i.deltaY=r.detail,t.call(e,i)},r)}function S(e,o,t,r){k.scrollrunning||(k.newscrolly=k.getScrollTop(),k.newscrollx=k.getScrollLeft(),Y=m());var i=m()-Y;if(Y=m(),i>350?B=1:B+=(2-B)/10,e=e*B|0,o=o*B|0,e){if(r)if(e<0){if(k.getScrollLeft()>=k.page.maxw)return!0}else if(k.getScrollLeft()<=0)return!0;var s=e>0?1:-1;O!==s&&(k.scrollmom&&k.scrollmom.stop(),k.newscrollx=k.getScrollLeft(),O=s),k.lastdeltax-=e}if(o){if(function(){var e=k.getScrollTop();if(o<0){if(e>=k.page.maxh)return!0}else if(e<=0)return!0}()){if(k.opt.nativeparentscrolling&&t&&!k.ispage&&!k.zoomactive)return!0;var n=k.view.h>>1;k.newscrolly<-n?(k.newscrolly=-n,o=-1):k.newscrolly>k.page.maxh+n?(k.newscrolly=k.page.maxh+n,o=1):o=0}var l=o>0?1:-1;I!==l&&(k.scrollmom&&k.scrollmom.stop(),k.newscrolly=k.getScrollTop(),I=l),k.lastdeltay-=o}(o||e)&&k.synched("relativexy",function(){var e=k.lastdeltay+k.newscrolly;k.lastdeltay=0;var o=k.lastdeltax+k.newscrollx;k.lastdeltax=0,k.rail.drag||k.doScrollPos(o,e)})}function z(e,o,t){var r,i;return!(t||!X)||(0===e.deltaMode?(r=-e.deltaX*(k.opt.mousescrollstep/54)|0,i=-e.deltaY*(k.opt.mousescrollstep/54)|0):1===e.deltaMode&&(r=-e.deltaX*k.opt.mousescrollstep*50/80|0,i=-e.deltaY*k.opt.mousescrollstep*50/80|0),o&&k.opt.oneaxismousemode&&0===r&&i&&(r=i,i=0,t&&(r<0?k.getScrollLeft()>=k.page.maxw:k.getScrollLeft()<=0)&&(i=r,r=0)),k.isrtlmode&&(r=-r),S(r,i,t,!0)?void(t&&(X=!0)):(X=!1,e.stopImmediatePropagation(),e.preventDefault()))}var k=this;this.version="3.7.4-d",this.name="nicescroll",this.me=h;var T=n("body");if(this.opt={doc:T,win:!1},n.extend(this.opt,f),this.opt.snapbackspeed=80,e)for(var E in k.opt)void 0!==e[E]&&(k.opt[E]=e[E]);if(k.opt.disablemutationobserver&&(p=!1),this.doc=k.opt.doc,this.iddoc=this.doc&&this.doc[0]?this.doc[0].id||"":"",this.ispage=/^BODY|HTML/.test(k.opt.win?k.opt.win[0].nodeName:this.doc[0].nodeName),this.haswrapper=!1!==k.opt.win,this.win=k.opt.win||(this.ispage?c:this.doc),this.docscroll=this.ispage&&!this.haswrapper?c:this.win,this.body=T,this.viewport=!1,this.isfixed=!1,this.iframe=!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"!=k.opt.autohidemode,this.onmousedown=!1,this.onmouseup=!1,this.onmousemove=!1,this.onmousewheel=!1,this.onkeypress=!1,this.ongesturezoom=!1,this.onclick=!1,this.onscrollstart=!1,this.onscrollend=!1,this.onscrollcancel=!1,this.onzoomin=!1,this.onzoomout=!1,this.view=!1,this.page=!1,this.scroll={x:0,y:0},this.scrollratio={x:0,y:0},this.cursorheight=20,this.scrollvaluemax=0,"auto"==this.opt.rtlmode){var M=this.win[0]==a?this.body:this.win,L=M.css("writing-mode")||M.css("-webkit-writing-mode")||M.css("-ms-writing-mode")||M.css("-moz-writing-mode");"horizontal-tb"==L||"lr-tb"==L||""===L?(this.isrtlmode="rtl"==M.css("direction"),this.isvertical=!1):(this.isrtlmode="vertical-rl"==L||"tb"==L||"tb-rl"==L||"rl-tb"==L,this.isvertical="vertical-rl"==L||"tb"==L||"tb-rl"==L)}else this.isrtlmode=!0===this.opt.rtlmode,this.isvertical=!1;if(this.scrollrunning=!1,this.scrollmom=!1,this.observer=!1,this.observerremover=!1,this.observerbody=!1,!1!==k.opt.scrollbarid)this.id=k.opt.scrollbarid;else do{this.id="ascrail"+i++}while(l.getElementById(this.id));this.rail=!1,this.cursor=!1,this.cursorfreezed=!1,this.selectiondrag=!1,this.zoom=!1,this.zoomactive=!1,this.hasfocus=!1,this.hasmousefocus=!1,this.visibility=!0,this.railslocked=!1,this.locked=!1,this.hidden=!1,this.cursoractive=!0,this.wheelprevented=!1,this.overflowx=k.opt.overflowx,this.overflowy=k.opt.overflowy,this.nativescrollingarea=!1,this.checkarea=0,this.events=[],this.saved={},this.delaylist={},this.synclist={},this.lastdeltax=0,this.lastdeltay=0,this.detected=v();var C=n.extend({},this.detected);this.canhwscroll=C.hastransform&&k.opt.hwacceleration,this.ishwscroll=this.canhwscroll&&k.haswrapper,this.isrtlmode?this.isvertical?this.hasreversehr=!(C.iswebkit||C.isie||C.isie11):this.hasreversehr=!(C.iswebkit||C.isie&&!C.isie10&&!C.isie11):this.hasreversehr=!1,this.istouchcapable=!1,C.cantouch||!C.hasw3ctouch&&!C.hasmstouch?!C.cantouch||C.isios||C.isandroid||!C.iswebkit&&!C.ismozilla||(this.istouchcapable=!0):this.istouchcapable=!0,k.opt.enablemouselockapi||(C.hasmousecapture=!1,C.haspointerlock=!1),this.debounced=function(e,o,t){k&&(k.delaylist[e]||!1||(k.delaylist[e]={h:d(function(){k.delaylist[e].fn.call(k),k.delaylist[e]=!1},t)},o.call(k)),k.delaylist[e].fn=o)},this.synched=function(e,o){k.synclist[e]?k.synclist[e]=o:(k.synclist[e]=o,d(function(){k&&(k.synclist[e]&&k.synclist[e].call(k),k.synclist[e]=null)}))},this.unsynched=function(e){k.synclist[e]&&(k.synclist[e]=!1)},this.css=function(e,o){for(var t in o)k.saved.css.push([e,t,e.css(t)]),e.css(t,o[t])},this.scrollTop=function(e){return void 0===e?k.getScrollTop():k.setScrollTop(e)},this.scrollLeft=function(e){return void 0===e?k.getScrollLeft():k.setScrollLeft(e)};var N=function(e,o,t,r,i,s,n){this.st=e,this.ed=o,this.spd=t,this.p1=r||0,this.p2=i||1,this.p3=s||0,this.p4=n||1,this.ts=m(),this.df=o-e};if(N.prototype={B2:function(e){return 3*(1-e)*(1-e)*e},B3:function(e){return 3*(1-e)*e*e},B4:function(e){return e*e*e},getPos:function(){return(m()-this.ts)/this.spd},getNow:function(){var e=(m()-this.ts)/this.spd,o=this.B2(e)+this.B3(e)+this.B4(e);return e>=1?this.ed:this.st+this.df*o|0},update:function(e,o){return this.st=this.getNow(),this.ed=e,this.spd=o,this.ts=m(),this.df=this.ed-this.st,this}},this.ishwscroll){this.doc.translate={x:0,y:0,tx:"0px",ty:"0px"},C.hastranslate3d&&C.isios&&this.doc.css("-webkit-backface-visibility","hidden"),this.getScrollTop=function(e){if(!e){var o=g();if(o)return 16==o.length?-o[13]:-o[5];if(k.timerscroll&&k.timerscroll.bz)return k.timerscroll.bz.getNow()}return k.doc.translate.y},this.getScrollLeft=function(e){if(!e){var o=g();if(o)return 16==o.length?-o[12]:-o[4];if(k.timerscroll&&k.timerscroll.bh)return k.timerscroll.bh.getNow()}return k.doc.translate.x},this.notifyScrollEvent=function(e){var o=l.createEvent("UIEvents");o.initUIEvent("scroll",!1,!0,a,1),o.niceevent=!0,e.dispatchEvent(o)};var P=this.isrtlmode?1:-1;C.hastranslate3d&&k.opt.enabletranslate3d?(this.setScrollTop=function(e,o){k.doc.translate.y=e,k.doc.translate.ty=-1*e+"px",k.doc.css(C.trstyle,"translate3d("+k.doc.translate.tx+","+k.doc.translate.ty+",0)"),o||k.notifyScrollEvent(k.win[0])},this.setScrollLeft=function(e,o){k.doc.translate.x=e,k.doc.translate.tx=e*P+"px",k.doc.css(C.trstyle,"translate3d("+k.doc.translate.tx+","+k.doc.translate.ty+",0)"),o||k.notifyScrollEvent(k.win[0])}):(this.setScrollTop=function(e,o){k.doc.translate.y=e,k.doc.translate.ty=-1*e+"px",k.doc.css(C.trstyle,"translate("+k.doc.translate.tx+","+k.doc.translate.ty+")"),o||k.notifyScrollEvent(k.win[0])},this.setScrollLeft=function(e,o){k.doc.translate.x=e,k.doc.translate.tx=e*P+"px",k.doc.css(C.trstyle,"translate("+k.doc.translate.tx+","+k.doc.translate.ty+")"),o||k.notifyScrollEvent(k.win[0])})}else this.getScrollTop=function(){return k.docscroll.scrollTop()},this.setScrollTop=function(e){k.docscroll.scrollTop(e)},this.getScrollLeft=function(){return k.hasreversehr?k.detected.ismozilla?k.page.maxw-Math.abs(k.docscroll.scrollLeft()):k.page.maxw-k.docscroll.scrollLeft():k.docscroll.scrollLeft()},this.setScrollLeft=function(e){return setTimeout(function(){if(k)return k.hasreversehr&&(e=k.detected.ismozilla?-(k.page.maxw-e):k.page.maxw-e),k.docscroll.scrollLeft(e)},1)};this.getTarget=function(e){return!!e&&(e.target?e.target:!!e.srcElement&&e.srcElement)},this.hasParent=function(e,o){if(!e)return!1;for(var t=e.target||e.srcElement||e||!1;t&&t.id!=o;)t=t.parentNode||!1;return!1!==t};var R={thin:1,medium:3,thick:5};this.getDocumentScrollOffset=function(){return{top:a.pageYOffset||l.documentElement.scrollTop,left:a.pageXOffset||l.documentElement.scrollLeft}},this.getOffset=function(){if(k.isfixed){var e=k.win.offset(),o=k.getDocumentScrollOffset();return e.top-=o.top,e.left-=o.left,e}var t=k.win.offset();if(!k.viewport)return t;var r=k.viewport.offset();return{top:t.top-r.top,left:t.left-r.left}},this.updateScrollBar=function(e){var o,t;if(k.ishwscroll)k.rail.css({height:k.win.innerHeight()-(k.opt.railpadding.top+k.opt.railpadding.bottom)}),k.railh&&k.railh.css({width:k.win.innerWidth()-(k.opt.railpadding.left+k.opt.railpadding.right)});else{var r=k.getOffset();if(o={top:r.top,left:r.left-(k.opt.railpadding.left+k.opt.railpadding.right)},o.top+=y(k.win,"border-top-width",!0),o.left+=k.rail.align?k.win.outerWidth()-y(k.win,"border-right-width")-k.rail.width:y(k.win,"border-left-width"),(t=k.opt.railoffset)&&(t.top&&(o.top+=t.top),t.left&&(o.left+=t.left)),k.railslocked||k.rail.css({top:o.top,left:o.left,height:(e?e.h:k.win.innerHeight())-(k.opt.railpadding.top+k.opt.railpadding.bottom)}),k.zoom&&k.zoom.css({top:o.top+1,left:1==k.rail.align?o.left-20:o.left+k.rail.width+4}),k.railh&&!k.railslocked){o={top:r.top,left:r.left},(t=k.opt.railhoffset)&&(t.top&&(o.top+=t.top),t.left&&(o.left+=t.left));var i=k.railh.align?o.top+y(k.win,"border-top-width",!0)+k.win.innerHeight()-k.railh.height:o.top+y(k.win,"border-top-width",!0),s=o.left+y(k.win,"border-left-width");k.railh.css({top:i-(k.opt.railpadding.top+k.opt.railpadding.bottom),left:s,width:k.railh.width})}}},this.doRailClick=function(e,o,t){var r,i,s,n;k.railslocked||(k.cancelEvent(e),"pageY"in e||(e.pageX=e.clientX+l.documentElement.scrollLeft,e.pageY=e.clientY+l.documentElement.scrollTop),o?(r=t?k.doScrollLeft:k.doScrollTop)(s=t?(e.pageX-k.railh.offset().left-k.cursorwidth/2)*k.scrollratio.x:(e.pageY-k.rail.offset().top-k.cursorheight/2)*k.scrollratio.y):(r=t?k.doScrollLeftBy:k.doScrollBy,s=t?k.scroll.x:k.scroll.y,n=t?e.pageX-k.railh.offset().left:e.pageY-k.rail.offset().top,i=t?k.view.w:k.view.h,r(s>=n?i:-i)))},k.newscrolly=k.newscrollx=0,k.hasanimationframe="requestAnimationFrame"in a,k.hascancelanimationframe="cancelAnimationFrame"in a,k.hasborderbox=!1,this.init=function(){if(k.saved.css=[],C.isoperamini)return!0;if(C.isandroid&&!("hidden"in l))return!0;k.opt.emulatetouch=k.opt.emulatetouch||k.opt.touchbehavior,k.hasborderbox=a.getComputedStyle&&"border-box"===a.getComputedStyle(l.body)["box-sizing"];var e={"overflow-y":"hidden"};if((C.isie11||C.isie10)&&(e["-ms-overflow-style"]="none"),k.ishwscroll&&(this.doc.css(C.transitionstyle,C.prefixstyle+"transform 0ms ease-out"),C.transitionend&&k.bind(k.doc,C.transitionend,k.onScrollTransitionEnd,!1)),k.zindex="auto",k.ispage||"auto"!=k.opt.zindex?k.zindex=k.opt.zindex:k.zindex=w()||"auto",!k.ispage&&"auto"!=k.zindex&&k.zindex>s&&(s=k.zindex),k.isie&&0===k.zindex&&"auto"==k.opt.zindex&&(k.zindex="auto"),!k.ispage||!C.cantouch&&!C.isieold){var i=k.docscroll;k.ispage&&(i=k.haswrapper?k.win:k.doc),k.css(i,e),k.ispage&&(C.isie11||C.isie)&&k.css(n("html"),e),!C.isios||k.ispage||k.haswrapper||k.css(T,{"-webkit-overflow-scrolling":"touch"});var d=n(l.createElement("div"));d.css({position:"relative",top:0,float:"right",width:k.opt.cursorwidth,height:0,"background-color":k.opt.cursorcolor,border:k.opt.cursorborder,"background-clip":"padding-box","-webkit-border-radius":k.opt.cursorborderradius,"-moz-border-radius":k.opt.cursorborderradius,"border-radius":k.opt.cursorborderradius}),d.addClass("nicescroll-cursors"),k.cursor=d;var u=n(l.createElement("div"));u.attr("id",k.id),u.addClass("nicescroll-rails nicescroll-rails-vr");var h,m,f=["left","right","top","bottom"];for(var g in f)m=f[g],(h=k.opt.railpadding[m]||0)&&u.css("padding-"+m,h+"px");u.append(d),u.width=Math.max(parseFloat(k.opt.cursorwidth),d.outerWidth()),u.css({width:u.width+"px",zIndex:k.zindex,background:k.opt.background,cursor:"default"}),u.visibility=!0,u.scrollable=!0,u.align="left"==k.opt.railalign?0:1,k.rail=u,k.rail.drag=!1;var v=!1;!k.opt.boxzoom||k.ispage||C.isieold||(v=l.createElement("div"),k.bind(v,"click",k.doZoom),k.bind(v,"mouseenter",function(){k.zoom.css("opacity",k.opt.cursoropacitymax)}),k.bind(v,"mouseleave",function(){k.zoom.css("opacity",k.opt.cursoropacitymin)}),k.zoom=n(v),k.zoom.css({cursor:"pointer",zIndex:k.zindex,backgroundImage:"url("+k.opt.scriptpath+"zoomico.png)",height:18,width:18,backgroundPosition:"0 0"}),k.opt.dblclickzoom&&k.bind(k.win,"dblclick",k.doZoom),C.cantouch&&k.opt.gesturezoom&&(k.ongesturezoom=function(e){return e.scale>1.5&&k.doZoomIn(e),e.scale<.8&&k.doZoomOut(e),k.cancelEvent(e)},k.bind(k.win,"gestureend",k.ongesturezoom))),k.railh=!1;var y;if(k.opt.horizrailenabled&&(k.css(i,{overflowX:"hidden"}),(d=n(l.createElement("div"))).css({position:"absolute",top:0,height:k.opt.cursorwidth,width:0,backgroundColor:k.opt.cursorcolor,border:k.opt.cursorborder,backgroundClip:"padding-box","-webkit-border-radius":k.opt.cursorborderradius,"-moz-border-radius":k.opt.cursorborderradius,"border-radius":k.opt.cursorborderradius}),C.isieold&&d.css("overflow","hidden"),d.addClass("nicescroll-cursors"),k.cursorh=d,(y=n(l.createElement("div"))).attr("id",k.id+"-hr"),y.addClass("nicescroll-rails nicescroll-rails-hr"),y.height=Math.max(parseFloat(k.opt.cursorwidth),d.outerHeight()),y.css({height:y.height+"px",zIndex:k.zindex,background:k.opt.background}),y.append(d),y.visibility=!0,y.scrollable=!0,y.align="top"==k.opt.railvalign?0:1,k.railh=y,k.railh.drag=!1),k.ispage)u.css({position:"fixed",top:0,height:"100%"}),u.css(u.align?{right:0}:{left:0}),k.body.append(u),k.railh&&(y.css({position:"fixed",left:0,width:"100%"}),y.css(y.align?{bottom:0}:{top:0}),k.body.append(y));else{if(k.ishwscroll){"static"==k.win.css("position")&&k.css(k.win,{position:"relative"});var x="HTML"==k.win[0].nodeName?k.body:k.win;n(x).scrollTop(0).scrollLeft(0),k.zoom&&(k.zoom.css({position:"absolute",top:1,right:0,"margin-right":u.width+4}),x.append(k.zoom)),u.css({position:"absolute",top:0}),u.css(u.align?{right:0}:{left:0}),x.append(u),y&&(y.css({position:"absolute",left:0,bottom:0}),y.css(y.align?{bottom:0}:{top:0}),x.append(y))}else{k.isfixed="fixed"==k.win.css("position");var S=k.isfixed?"fixed":"absolute";k.isfixed||(k.viewport=k.getViewport(k.win[0])),k.viewport&&(k.body=k.viewport,/fixed|absolute/.test(k.viewport.css("position"))||k.css(k.viewport,{position:"relative"})),u.css({position:S}),k.zoom&&k.zoom.css({position:S}),k.updateScrollBar(),k.body.append(u),k.zoom&&k.body.append(k.zoom),k.railh&&(y.css({position:S}),k.body.append(y))}C.isios&&k.css(k.win,{"-webkit-tap-highlight-color":"rgba(0,0,0,0)","-webkit-touch-callout":"none"}),C.isie&&k.opt.disableoutline&&k.win.attr("hideFocus","true"),C.iswebkit&&k.opt.disableoutline&&k.win.css("outline","none")}if(!1===k.opt.autohidemode?(k.autohidedom=!1,k.rail.css({opacity:k.opt.cursoropacitymax}),k.railh&&k.railh.css({opacity:k.opt.cursoropacitymax})):!0===k.opt.autohidemode||"leave"===k.opt.autohidemode?(k.autohidedom=n().add(k.rail),C.isie8&&(k.autohidedom=k.autohidedom.add(k.cursor)),k.railh&&(k.autohidedom=k.autohidedom.add(k.railh)),k.railh&&C.isie8&&(k.autohidedom=k.autohidedom.add(k.cursorh))):"scroll"==k.opt.autohidemode?(k.autohidedom=n().add(k.rail),k.railh&&(k.autohidedom=k.autohidedom.add(k.railh))):"cursor"==k.opt.autohidemode?(k.autohidedom=n().add(k.cursor),k.railh&&(k.autohidedom=k.autohidedom.add(k.cursorh))):"hidden"==k.opt.autohidemode&&(k.autohidedom=!1,k.hide(),k.railslocked=!1),C.cantouch||k.istouchcapable||k.opt.emulatetouch||C.hasmstouch){k.scrollmom=new b(k),k.ontouchstart=function(e){if(e.pointerType&&("mouse"===e.pointerType||e.pointerType===e.MSPOINTER_TYPE_MOUSE))return!1;if(k.hasmoving=!1,!k.railslocked){var o;if(C.hasmstouch)for(o=!!e.target&&e.target;o;){var t=n(o).getNiceScroll();if(t.length>0&&t[0].me==k.me)break;if(t.length>0)return!1;if("DIV"==o.nodeName&&o.id==k.id)break;o=!!o.parentNode&&o.parentNode}if(e.stopPropagation(),k.cancelScroll(),(o=k.getTarget(e))&&/INPUT/i.test(o.nodeName)&&/range/i.test(o.type))return k.stopPropagation(e);if(!("clientX"in e)&&"changedTouches"in e&&(e.clientX=e.changedTouches[0].clientX,e.clientY=e.changedTouches[0].clientY),k.forcescreen){var r=e;(e={original:e.original?e.original:e}).clientX=r.screenX,e.clientY=r.screenY}if(k.rail.drag={x:e.clientX,y:e.clientY,sx:k.scroll.x,sy:k.scroll.y,st:k.getScrollTop(),sl:k.getScrollLeft(),pt:2,dl:!1,tg:o},k.ispage||!k.opt.directionlockdeadzone)k.rail.drag.dl="f";else{var i={w:c.width(),h:c.height()},s={w:Math.max(l.body.scrollWidth,l.documentElement.scrollWidth),h:Math.max(l.body.scrollHeight,l.documentElement.scrollHeight)},a=Math.max(0,s.h-i.h),d=Math.max(0,s.w-i.w);!k.rail.scrollable&&k.railh.scrollable?k.rail.drag.ck=a>0&&"v":k.rail.scrollable&&!k.railh.scrollable?k.rail.drag.ck=d>0&&"h":k.rail.drag.ck=!1,k.rail.drag.ck||(k.rail.drag.dl="f")}if(k.opt.emulatetouch&&k.isiframe&&C.isie){var u=k.win.position();k.rail.drag.x+=u.left,k.rail.drag.y+=u.top}if(k.hasmoving=!1,k.lastmouseup=!1,k.scrollmom.reset(e.clientX,e.clientY),!C.cantouch&&!this.istouchcapable&&!e.pointerType){if(!(!!o&&/INPUT|SELECT|BUTTON|TEXTAREA/i.test(o.nodeName)))return!k.ispage&&C.hasmousecapture&&o.setCapture(),k.opt.emulatetouch?(o.onclick&&!o._onclick&&(o._onclick=o.onclick,o.onclick=function(e){if(k.hasmoving)return!1;o._onclick.call(this,e)}),k.cancelEvent(e)):k.stopPropagation(e);/SUBMIT|CANCEL|BUTTON/i.test(n(o).attr("type"))&&(k.preventclick={tg:o,click:!1})}}},k.ontouchend=function(e){if(!k.rail.drag)return!0;if(2==k.rail.drag.pt){if(e.pointerType&&("mouse"===e.pointerType||e.pointerType===e.MSPOINTER_TYPE_MOUSE))return!1;if(k.rail.drag=!1,k.hasmoving&&(k.scrollmom.doMomentum(),k.lastmouseup=!0,k.hideCursor(),C.hasmousecapture&&l.releaseCapture(),!C.cantouch))return k.cancelEvent(e)}else if(1==k.rail.drag.pt)return k.onmouseup(e)};var z=k.opt.emulatetouch&&k.isiframe&&!C.hasmousecapture;k.ontouchmove=function(e,o){if(!k.rail.drag)return!1;if(e.targetTouches&&k.opt.preventmultitouchscrolling&&e.targetTouches.length>1)return!1;if(e.pointerType&&("mouse"===e.pointerType||e.pointerType===e.MSPOINTER_TYPE_MOUSE))return!1;if(2==k.rail.drag.pt){if("changedTouches"in e&&(e.clientX=e.changedTouches[0].clientX,e.clientY=e.changedTouches[0].clientY),k.rail.drag.y===e.clientY&&k.rail.drag.x===e.clientX)return!1;k.hasmoving||k.triggerScrollStart(e.clientX,e.clientY,0,0,0),k.hasmoving=!0,k.preventclick&&!k.preventclick.click&&(k.preventclick.click=k.preventclick.tg.onclick||!1,k.preventclick.tg.onclick=k.onpreventclick);var t,r;if(r=t=0,z&&!o){var i=k.win.position();r=-i.left,t=-i.top}var s=e.clientY+t,n=s-k.rail.drag.y,a=e.clientX+r,c=a-k.rail.drag.x,d=k.rail.drag.st-n;k.ishwscroll&&k.opt.bouncescroll?d<0?d=Math.round(d/2):d>k.page.maxh&&(d=k.page.maxh+Math.round((d-k.page.maxh)/2)):(d<0&&(d=0,s=0),d>k.page.maxh&&(d=k.page.maxh,s=0));var u;k.railh&&k.railh.scrollable&&(u=k.isrtlmode?c-k.rail.drag.sl:k.rail.drag.sl-c,k.ishwscroll&&k.opt.bouncescroll?u<0?u=Math.round(u/2):u>k.page.maxw&&(u=k.page.maxw+Math.round((u-k.page.maxw)/2)):(u<0&&(u=0,a=0),u>k.page.maxw&&(u=k.page.maxw,a=0)));var h=!1;if(k.rail.drag.dl)h=!0,"v"==k.rail.drag.dl?u=k.rail.drag.sl:"h"==k.rail.drag.dl&&(d=k.rail.drag.st);else{var p=Math.abs(n),m=Math.abs(c),f=k.opt.directionlockdeadzone;if("v"==k.rail.drag.ck){if(p>f&&m<=.3*p)return k.rail.drag=!1,!0;m>f&&(k.rail.drag.dl="f",T.scrollTop(T.scrollTop()))}else if("h"==k.rail.drag.ck){if(m>f&&p<=.3*m)return k.rail.drag=!1,!0;p>f&&(k.rail.drag.dl="f",T.scrollLeft(T.scrollLeft()))}}if(k.synched("touchmove",function(){k.rail.drag&&2==k.rail.drag.pt&&(k.prepareTransition&&k.resetTransition(),k.rail.scrollable&&k.setScrollTop(d),k.scrollmom.update(a,s),k.railh&&k.railh.scrollable?(k.setScrollLeft(u),k.showCursor(d,u)):k.showCursor(d),C.isie10&&l.selection.clear())}),C.ischrome&&k.istouchcapable&&(h=!1),h)return k.cancelEvent(e)}else if(1==k.rail.drag.pt)return k.onmousemove(e)},k.ontouchstartCursor=function(e,o){if(!k.rail.drag||3==k.rail.drag.pt){if(k.locked)return k.cancelEvent(e);k.cancelScroll(),k.rail.drag={x:e.touches[0].clientX,y:e.touches[0].clientY,sx:k.scroll.x,sy:k.scroll.y,pt:3,hr:!!o};var t=k.getTarget(e);return!k.ispage&&C.hasmousecapture&&t.setCapture(),k.isiframe&&!C.hasmousecapture&&(k.saved.csspointerevents=k.doc.css("pointer-events"),k.css(k.doc,{"pointer-events":"none"})),k.cancelEvent(e)}},k.ontouchendCursor=function(e){if(k.rail.drag){if(C.hasmousecapture&&l.releaseCapture(),k.isiframe&&!C.hasmousecapture&&k.doc.css("pointer-events",k.saved.csspointerevents),3!=k.rail.drag.pt)return;return k.rail.drag=!1,k.cancelEvent(e)}},k.ontouchmoveCursor=function(e){if(k.rail.drag){if(3!=k.rail.drag.pt)return;if(k.cursorfreezed=!0,k.rail.drag.hr){k.scroll.x=k.rail.drag.sx+(e.touches[0].clientX-k.rail.drag.x),k.scroll.x<0&&(k.scroll.x=0);var o=k.scrollvaluemaxw;k.scroll.x>o&&(k.scroll.x=o)}else{k.scroll.y=k.rail.drag.sy+(e.touches[0].clientY-k.rail.drag.y),k.scroll.y<0&&(k.scroll.y=0);var t=k.scrollvaluemax;k.scroll.y>t&&(k.scroll.y=t)}return k.synched("touchmove",function(){k.rail.drag&&3==k.rail.drag.pt&&(k.showCursor(),k.rail.drag.hr?k.doScrollLeft(Math.round(k.scroll.x*k.scrollratio.x),k.opt.cursordragspeed):k.doScrollTop(Math.round(k.scroll.y*k.scrollratio.y),k.opt.cursordragspeed))}),k.cancelEvent(e)}}}if(k.onmousedown=function(e,o){if(!k.rail.drag||1==k.rail.drag.pt){if(k.railslocked)return k.cancelEvent(e);k.cancelScroll(),k.rail.drag={x:e.clientX,y:e.clientY,sx:k.scroll.x,sy:k.scroll.y,pt:1,hr:o||!1};var t=k.getTarget(e);return C.hasmousecapture&&t.setCapture(),k.isiframe&&!C.hasmousecapture&&(k.saved.csspointerevents=k.doc.css("pointer-events"),k.css(k.doc,{"pointer-events":"none"})),k.hasmoving=!1,k.cancelEvent(e)}},k.onmouseup=function(e){if(k.rail.drag)return 1!=k.rail.drag.pt||(C.hasmousecapture&&l.releaseCapture(),k.isiframe&&!C.hasmousecapture&&k.doc.css("pointer-events",k.saved.csspointerevents),k.rail.drag=!1,k.cursorfreezed=!1,k.hasmoving&&k.triggerScrollEnd(),k.cancelEvent(e))},k.onmousemove=function(e){if(k.rail.drag){if(1!==k.rail.drag.pt)return;if(C.ischrome&&0===e.which)return k.onmouseup(e);if(k.cursorfreezed=!0,k.hasmoving||k.triggerScrollStart(e.clientX,e.clientY,0,0,0),k.hasmoving=!0,k.rail.drag.hr){k.scroll.x=k.rail.drag.sx+(e.clientX-k.rail.drag.x),k.scroll.x<0&&(k.scroll.x=0);var o=k.scrollvaluemaxw;k.scroll.x>o&&(k.scroll.x=o)}else{k.scroll.y=k.rail.drag.sy+(e.clientY-k.rail.drag.y),k.scroll.y<0&&(k.scroll.y=0);var t=k.scrollvaluemax;k.scroll.y>t&&(k.scroll.y=t)}return k.synched("mousemove",function(){k.cursorfreezed&&(k.showCursor(),k.rail.drag.hr?k.scrollLeft(Math.round(k.scroll.x*k.scrollratio.x)):k.scrollTop(Math.round(k.scroll.y*k.scrollratio.y)))}),k.cancelEvent(e)}k.checkarea=0},C.cantouch||k.opt.emulatetouch)k.onpreventclick=function(e){if(k.preventclick)return k.preventclick.tg.onclick=k.preventclick.click,k.preventclick=!1,k.cancelEvent(e)},k.onclick=!C.isios&&function(e){return!k.lastmouseup||(k.lastmouseup=!1,k.cancelEvent(e))},k.opt.grabcursorenabled&&C.cursorgrabvalue&&(k.css(k.ispage?k.doc:k.win,{cursor:C.cursorgrabvalue}),k.css(k.rail,{cursor:C.cursorgrabvalue}));else{var E=function(e){if(k.selectiondrag){if(e){var o=k.win.outerHeight(),t=e.pageY-k.selectiondrag.top;t>0&&t=o&&(t-=o),k.selectiondrag.df=t}if(0!==k.selectiondrag.df){var r=2*-Math.floor(k.selectiondrag.df/6);k.doScrollBy(r),k.debounced("doselectionscroll",function(){E()},50)}}};k.hasTextSelected="getSelection"in l?function(){return l.getSelection().rangeCount>0}:"selection"in l?function(){return"None"!=l.selection.type}:function(){return!1},k.onselectionstart=function(e){k.ispage||(k.selectiondrag=k.win.offset())},k.onselectionend=function(e){k.selectiondrag=!1},k.onselectiondrag=function(e){k.selectiondrag&&k.hasTextSelected()&&k.debounced("selectionscroll",function(){E(e)},250)}}if(C.hasw3ctouch?(k.css(k.ispage?n("html"):k.win,{"touch-action":"none"}),k.css(k.rail,{"touch-action":"none"}),k.css(k.cursor,{"touch-action":"none"}),k.bind(k.win,"pointerdown",k.ontouchstart),k.bind(l,"pointerup",k.ontouchend),k.bind(l,"pointermove",k.ontouchmove)):C.hasmstouch?(k.css(k.ispage?n("html"):k.win,{"-ms-touch-action":"none"}),k.css(k.rail,{"-ms-touch-action":"none"}),k.css(k.cursor,{"-ms-touch-action":"none"}),k.bind(k.win,"MSPointerDown",k.ontouchstart),k.bind(l,"MSPointerUp",k.ontouchend),k.bind(l,"MSPointerMove",k.ontouchmove),k.bind(k.cursor,"MSGestureHold",function(e){e.preventDefault()}),k.bind(k.cursor,"contextmenu",function(e){e.preventDefault()})):C.cantouch&&(k.bind(k.win,"touchstart",k.ontouchstart,!1,!0),k.bind(l,"touchend",k.ontouchend,!1,!0),k.bind(l,"touchcancel",k.ontouchend,!1,!0),k.bind(l,"touchmove",k.ontouchmove,!1,!0)),k.opt.emulatetouch&&(k.bind(k.win,"mousedown",k.ontouchstart,!1,!0),k.bind(l,"mouseup",k.ontouchend,!1,!0),k.bind(l,"mousemove",k.ontouchmove,!1,!0)),(k.opt.cursordragontouch||!C.cantouch&&!k.opt.emulatetouch)&&(k.rail.css({cursor:"default"}),k.railh&&k.railh.css({cursor:"default"}),k.jqbind(k.rail,"mouseenter",function(){if(!k.ispage&&!k.win.is(":visible"))return!1;k.canshowonmouseevent&&k.showCursor(),k.rail.active=!0}),k.jqbind(k.rail,"mouseleave",function(){k.rail.active=!1,k.rail.drag||k.hideCursor()}),k.opt.sensitiverail&&(k.bind(k.rail,"click",function(e){k.doRailClick(e,!1,!1)}),k.bind(k.rail,"dblclick",function(e){k.doRailClick(e,!0,!1)}),k.bind(k.cursor,"click",function(e){k.cancelEvent(e)}),k.bind(k.cursor,"dblclick",function(e){k.cancelEvent(e)})),k.railh&&(k.jqbind(k.railh,"mouseenter",function(){if(!k.ispage&&!k.win.is(":visible"))return!1;k.canshowonmouseevent&&k.showCursor(),k.rail.active=!0}),k.jqbind(k.railh,"mouseleave",function(){k.rail.active=!1,k.rail.drag||k.hideCursor()}),k.opt.sensitiverail&&(k.bind(k.railh,"click",function(e){k.doRailClick(e,!1,!0)}),k.bind(k.railh,"dblclick",function(e){k.doRailClick(e,!0,!0)}),k.bind(k.cursorh,"click",function(e){k.cancelEvent(e)}),k.bind(k.cursorh,"dblclick",function(e){k.cancelEvent(e)})))),k.opt.cursordragontouch&&(this.istouchcapable||C.cantouch)&&(k.bind(k.cursor,"touchstart",k.ontouchstartCursor),k.bind(k.cursor,"touchmove",k.ontouchmoveCursor),k.bind(k.cursor,"touchend",k.ontouchendCursor),k.cursorh&&k.bind(k.cursorh,"touchstart",function(e){k.ontouchstartCursor(e,!0)}),k.cursorh&&k.bind(k.cursorh,"touchmove",k.ontouchmoveCursor),k.cursorh&&k.bind(k.cursorh,"touchend",k.ontouchendCursor)),C.cantouch||k.opt.emulatetouch?(k.bind(C.hasmousecapture?k.win:l,"mouseup",k.ontouchend),k.onclick&&k.bind(l,"click",k.onclick),k.opt.cursordragontouch?(k.bind(k.cursor,"mousedown",k.onmousedown),k.bind(k.cursor,"mouseup",k.onmouseup),k.cursorh&&k.bind(k.cursorh,"mousedown",function(e){k.onmousedown(e,!0)}),k.cursorh&&k.bind(k.cursorh,"mouseup",k.onmouseup)):(k.bind(k.rail,"mousedown",function(e){e.preventDefault()}),k.railh&&k.bind(k.railh,"mousedown",function(e){e.preventDefault()}))):(k.bind(C.hasmousecapture?k.win:l,"mouseup",k.onmouseup),k.bind(l,"mousemove",k.onmousemove),k.onclick&&k.bind(l,"click",k.onclick),k.bind(k.cursor,"mousedown",k.onmousedown),k.bind(k.cursor,"mouseup",k.onmouseup),k.railh&&(k.bind(k.cursorh,"mousedown",function(e){k.onmousedown(e,!0)}),k.bind(k.cursorh,"mouseup",k.onmouseup)),!k.ispage&&k.opt.enablescrollonselection&&(k.bind(k.win[0],"mousedown",k.onselectionstart),k.bind(l,"mouseup",k.onselectionend),k.bind(k.cursor,"mouseup",k.onselectionend),k.cursorh&&k.bind(k.cursorh,"mouseup",k.onselectionend),k.bind(l,"mousemove",k.onselectiondrag)),k.zoom&&(k.jqbind(k.zoom,"mouseenter",function(){k.canshowonmouseevent&&k.showCursor(),k.rail.active=!0}),k.jqbind(k.zoom,"mouseleave",function(){k.rail.active=!1,k.rail.drag||k.hideCursor()}))),k.opt.enablemousewheel&&(k.isiframe||k.mousewheel(C.isie&&k.ispage?l:k.win,k.onmousewheel),k.mousewheel(k.rail,k.onmousewheel),k.railh&&k.mousewheel(k.railh,k.onmousewheelhr)),k.ispage||C.cantouch||/HTML|^BODY/.test(k.win[0].nodeName)||(k.win.attr("tabindex")||k.win.attr({tabindex:++r}),k.bind(k.win,"focus",function(e){o=k.getTarget(e).id||k.getTarget(e)||!1,k.hasfocus=!0,k.canshowonmouseevent&&k.noticeCursor()}),k.bind(k.win,"blur",function(e){o=!1,k.hasfocus=!1}),k.bind(k.win,"mouseenter",function(e){t=k.getTarget(e).id||k.getTarget(e)||!1,k.hasmousefocus=!0,k.canshowonmouseevent&&k.noticeCursor()}),k.bind(k.win,"mouseleave",function(e){t=!1,k.hasmousefocus=!1,k.rail.drag||k.hideCursor()})),k.onkeypress=function(e){if(k.railslocked&&0===k.page.maxh)return!0;e=e||a.event;var r=k.getTarget(e);if(r&&/INPUT|TEXTAREA|SELECT|OPTION/.test(r.nodeName)&&(!(r.getAttribute("type")||r.type||!1)||!/submit|button|cancel/i.tp))return!0;if(n(r).attr("contenteditable"))return!0;if(k.hasfocus||k.hasmousefocus&&!o||k.ispage&&!o&&!t){var i=e.keyCode;if(k.railslocked&&27!=i)return k.cancelEvent(e);var s=e.ctrlKey||!1,l=e.shiftKey||!1,c=!1;switch(i){case 38:case 63233:k.doScrollBy(72),c=!0;break;case 40:case 63235:k.doScrollBy(-72),c=!0;break;case 37:case 63232:k.railh&&(s?k.doScrollLeft(0):k.doScrollLeftBy(72),c=!0);break;case 39:case 63234:k.railh&&(s?k.doScrollLeft(k.page.maxw):k.doScrollLeftBy(-72),c=!0);break;case 33:case 63276:k.doScrollBy(k.view.h),c=!0;break;case 34:case 63277:k.doScrollBy(-k.view.h),c=!0;break;case 36:case 63273:k.railh&&s?k.doScrollPos(0,0):k.doScrollTo(0),c=!0;break;case 35:case 63275:k.railh&&s?k.doScrollPos(k.page.maxw,k.page.maxh):k.doScrollTo(k.page.maxh),c=!0;break;case 32:k.opt.spacebarenabled&&(l?k.doScrollBy(k.view.h):k.doScrollBy(-k.view.h),c=!0);break;case 27:k.zoomactive&&(k.doZoom(),c=!0)}if(c)return k.cancelEvent(e)}},k.opt.enablekeyboard&&k.bind(l,C.isopera&&!C.isopera12?"keypress":"keydown",k.onkeypress),k.bind(l,"keydown",function(e){(e.ctrlKey||!1)&&(k.wheelprevented=!0)}),k.bind(l,"keyup",function(e){e.ctrlKey||!1||(k.wheelprevented=!1)}),k.bind(a,"blur",function(e){k.wheelprevented=!1}),k.bind(a,"resize",k.lazyResize),k.bind(a,"orientationchange",k.lazyResize),k.bind(a,"load",k.lazyResize),C.ischrome&&!k.ispage&&!k.haswrapper){var M=k.win.attr("style"),L=parseFloat(k.win.css("width"))+1;k.win.css("width",L),k.synched("chromefix",function(){k.win.attr("style",M)})}k.onAttributeChange=function(e){k.lazyResize(k.isieold?250:30)},k.opt.enableobserver&&(k.isie11||!1===p||(k.observerbody=new p(function(e){if(e.forEach(function(e){if("attributes"==e.type)return T.hasClass("modal-open")&&T.hasClass("modal-dialog")&&!n.contains(n(".modal-dialog")[0],k.doc[0])?k.hide():k.show()}),k.me.clientWidth!=k.page.width||k.me.clientHeight!=k.page.height)return k.lazyResize(30)}),k.observerbody.observe(l.body,{childList:!0,subtree:!0,characterData:!1,attributes:!0,attributeFilter:["class"]})),k.ispage||k.haswrapper||(!1!==p?(k.observer=new p(function(e){e.forEach(k.onAttributeChange)}),k.observer.observe(k.win[0],{childList:!0,characterData:!1,attributes:!0,subtree:!1}),k.observerremover=new p(function(e){e.forEach(function(e){if(e.removedNodes.length>0)for(var o in e.removedNodes)if(k&&e.removedNodes[o]==k.win[0])return k.remove()})}),k.observerremover.observe(k.win[0].parentNode,{childList:!0,characterData:!1,attributes:!1,subtree:!1})):(k.bind(k.win,C.isie&&!C.isie9?"propertychange":"DOMAttrModified",k.onAttributeChange),C.isie9&&k.win[0].attachEvent("onpropertychange",k.onAttributeChange),k.bind(k.win,"DOMNodeRemoved",function(e){e.target==k.win[0]&&k.remove()})))),!k.ispage&&k.opt.boxzoom&&k.bind(a,"resize",k.resizeZoom),k.istextarea&&(k.bind(k.win,"keydown",k.lazyResize),k.bind(k.win,"mouseup",k.lazyResize)),k.lazyResize(30)}if("IFRAME"==this.doc[0].nodeName){var N=function(){k.iframexd=!1;var o;try{(o="contentDocument"in this?this.contentDocument:this.contentWindow._doc).domain}catch(e){k.iframexd=!0,o=!1}if(k.iframexd)return"console"in a&&console.log("NiceScroll error: policy restriced iframe"),!0;if(k.forcescreen=!0,k.isiframe&&(k.iframe={doc:n(o),html:k.doc.contents().find("html")[0],body:k.doc.contents().find("body")[0]},k.getContentSize=function(){return{w:Math.max(k.iframe.html.scrollWidth,k.iframe.body.scrollWidth),h:Math.max(k.iframe.html.scrollHeight,k.iframe.body.scrollHeight)}},k.docscroll=n(k.iframe.body)),!C.isios&&k.opt.iframeautoresize&&!k.isiframe){k.win.scrollTop(0),k.doc.height("");var t=Math.max(o.getElementsByTagName("html")[0].scrollHeight,o.body.scrollHeight);k.doc.height(t)}k.lazyResize(30),k.css(n(k.iframe.body),e),C.isios&&k.haswrapper&&k.css(n(o.body),{"-webkit-transform":"translate3d(0,0,0)"}),"contentWindow"in this?k.bind(this.contentWindow,"scroll",k.onscroll):k.bind(o,"scroll",k.onscroll),k.opt.enablemousewheel&&k.mousewheel(o,k.onmousewheel),k.opt.enablekeyboard&&k.bind(o,C.isopera?"keypress":"keydown",k.onkeypress),C.cantouch?(k.bind(o,"touchstart",k.ontouchstart),k.bind(o,"touchmove",k.ontouchmove)):k.opt.emulatetouch&&(k.bind(o,"mousedown",k.ontouchstart),k.bind(o,"mousemove",function(e){return k.ontouchmove(e,!0)}),k.opt.grabcursorenabled&&C.cursorgrabvalue&&k.css(n(o.body),{cursor:C.cursorgrabvalue})),k.bind(o,"mouseup",k.ontouchend),k.zoom&&(k.opt.dblclickzoom&&k.bind(o,"dblclick",k.doZoom),k.ongesturezoom&&k.bind(o,"gestureend",k.ongesturezoom))};this.doc[0].readyState&&"complete"===this.doc[0].readyState&&setTimeout(function(){N.call(k.doc[0],!1)},500),k.bind(this.doc,"load",N)}},this.showCursor=function(e,o){if(k.cursortimeout&&(clearTimeout(k.cursortimeout),k.cursortimeout=0),k.rail){if(k.autohidedom&&(k.autohidedom.stop().css({opacity:k.opt.cursoropacitymax}),k.cursoractive=!0),k.rail.drag&&1==k.rail.drag.pt||(void 0!==e&&!1!==e&&(k.scroll.y=e/k.scrollratio.y|0),void 0!==o&&(k.scroll.x=o/k.scrollratio.x|0)),k.cursor.css({height:k.cursorheight,top:k.scroll.y}),k.cursorh){var t=k.hasreversehr?k.scrollvaluemaxw-k.scroll.x:k.scroll.x;k.cursorh.css({width:k.cursorwidth,left:!k.rail.align&&k.rail.visibility?t+k.rail.width:t}),k.cursoractive=!0}k.zoom&&k.zoom.stop().css({opacity:k.opt.cursoropacitymax})}},this.hideCursor=function(e){k.cursortimeout||k.rail&&k.autohidedom&&(k.hasmousefocus&&"leave"===k.opt.autohidemode||(k.cursortimeout=setTimeout(function(){k.rail.active&&k.showonmouseevent||(k.autohidedom.stop().animate({opacity:k.opt.cursoropacitymin}),k.zoom&&k.zoom.stop().animate({opacity:k.opt.cursoropacitymin}),k.cursoractive=!1),k.cursortimeout=0},e||k.opt.hidecursordelay)))},this.noticeCursor=function(e,o,t){k.showCursor(o,t),k.rail.active||k.hideCursor(e)},this.getContentSize=k.ispage?function(){return{w:Math.max(l.body.scrollWidth,l.documentElement.scrollWidth),h:Math.max(l.body.scrollHeight,l.documentElement.scrollHeight)}}:k.haswrapper?function(){return{w:k.doc[0].offsetWidth,h:k.doc[0].offsetHeight}}:function(){return{w:k.docscroll[0].scrollWidth,h:k.docscroll[0].scrollHeight}},this.onResize=function(e,o){if(!k||!k.win)return!1;var t=k.page.maxh,r=k.page.maxw,i={h:k.view.h,w:k.view.w};if(k.view={w:k.ispage?k.win.width():k.win[0].clientWidth,h:k.ispage?k.win.height():k.win[0].clientHeight},k.page=o||k.getContentSize(),k.page.maxh=Math.max(0,k.page.h-k.view.h),k.page.maxw=Math.max(0,k.page.w-k.view.w),k.page.maxh==t&&k.page.maxw==r&&k.view.w==i.w&&k.view.h==i.h){if(k.ispage)return k;var s=k.win.offset();if(k.lastposition){var n=k.lastposition;if(n.top==s.top&&n.left==s.left)return k}k.lastposition=s}return 0===k.page.maxh?(k.hideRail(),k.scrollvaluemax=0,k.scroll.y=0,k.scrollratio.y=0,k.cursorheight=0,k.setScrollTop(0),k.rail&&(k.rail.scrollable=!1)):(k.page.maxh-=k.opt.railpadding.top+k.opt.railpadding.bottom,k.rail.scrollable=!0),0===k.page.maxw?(k.hideRailHr(),k.scrollvaluemaxw=0,k.scroll.x=0,k.scrollratio.x=0,k.cursorwidth=0,k.setScrollLeft(0),k.railh&&(k.railh.scrollable=!1)):(k.page.maxw-=k.opt.railpadding.left+k.opt.railpadding.right,k.railh&&(k.railh.scrollable=k.opt.horizrailenabled)),k.railslocked=k.locked||0===k.page.maxh&&0===k.page.maxw,k.railslocked?(k.ispage||k.updateScrollBar(k.view),!1):(k.hidden||k.visibility?!k.railh||k.hidden||k.railh.visibility||k.showRailHr():k.showRail().showRailHr(),k.istextarea&&k.win.css("resize")&&"none"!=k.win.css("resize")&&(k.view.h-=20),k.cursorheight=Math.min(k.view.h,Math.round(k.view.h*(k.view.h/k.page.h))),k.cursorheight=k.opt.cursorfixedheight?k.opt.cursorfixedheight:Math.max(k.opt.cursorminheight,k.cursorheight),k.cursorwidth=Math.min(k.view.w,Math.round(k.view.w*(k.view.w/k.page.w))),k.cursorwidth=k.opt.cursorfixedheight?k.opt.cursorfixedheight:Math.max(k.opt.cursorminheight,k.cursorwidth),k.scrollvaluemax=k.view.h-k.cursorheight-(k.opt.railpadding.top+k.opt.railpadding.bottom),k.hasborderbox||(k.scrollvaluemax-=k.cursor[0].offsetHeight-k.cursor[0].clientHeight),k.railh&&(k.railh.width=k.page.maxh>0?k.view.w-k.rail.width:k.view.w,k.scrollvaluemaxw=k.railh.width-k.cursorwidth-(k.opt.railpadding.left+k.opt.railpadding.right)),k.ispage||k.updateScrollBar(k.view),k.scrollratio={x:k.page.maxw/k.scrollvaluemaxw,y:k.page.maxh/k.scrollvaluemax},k.getScrollTop()>k.page.maxh?k.doScrollTop(k.page.maxh):(k.scroll.y=k.getScrollTop()/k.scrollratio.y|0,k.scroll.x=k.getScrollLeft()/k.scrollratio.x|0,k.cursoractive&&k.noticeCursor()),k.scroll.y&&0===k.getScrollTop()&&k.doScrollTo(Math.floor(k.scroll.y*k.scrollratio.y)),k)},this.resize=k.onResize,this.hlazyresize=0,this.lazyResize=function(e){return k.haswrapper||k.ispage||k.hide(),k.hlazyresize&&clearTimeout(k.hlazyresize),k.hlazyresize=setTimeout(function(){k&&(k.haswrapper||k.ispage||k.show(),k.resize())},240),k},this.jqbind=function(e,o,t){k.events.push({e:e,n:o,f:t,q:!0}),n(e).on(o,t)},this.mousewheel=function(e,o,t){var r="jquery"in e?e[0]:e;if("onwheel"in l.createElement("div"))k._bind(r,"wheel",o,t||!1);else{var i=void 0!==l.onmousewheel?"mousewheel":"DOMMouseScroll";x(r,i,o,t||!1),"DOMMouseScroll"==i&&x(r,"MozMousePixelScroll",o,t||!1)}};var _=!1;if(C.haseventlistener){try{var H=Object.defineProperty({},"passive",{get:function(){_=!0}});a.addEventListener("test",null,H)}catch(e){}this.cancelEvent=function(e){return!!e&&((e=e.original?e.original:e).cancelable&&e.preventDefault(),e.stopPropagation(),e.preventManipulation&&e.preventManipulation(),!1)},this.stopPropagation=function(e){return!!e&&((e=e.original?e.original:e).stopPropagation(),!1)}}else Event.prototype.preventDefault=function(){this.returnValue=!1},Event.prototype.stopPropagation=function(){this.cancelBubble=!0},a.constructor.prototype.addEventListener=l.constructor.prototype.addEventListener=Element.prototype.addEventListener=function(e,o,t){this.attachEvent("on"+e,o)},a.constructor.prototype.removeEventListener=l.constructor.prototype.removeEventListener=Element.prototype.removeEventListener=function(e,o,t){this.detachEvent("on"+e,o)},this.cancelEvent=function(e){return!!(e=e||a.event)&&(e.cancelBubble=!0,e.cancel=!0,e.returnValue=!1,!1)},this.stopPropagation=function(e){return(e=e||a.event)&&(e.cancelBubble=!0),!1};this.bind=function(e,o,t,r,i){var s="jquery"in e?e[0]:e;k._bind(s,o,t,r||!1,i||!1)},this._bind=function(e,o,t,r,i){k.events.push({e:e,n:o,f:t,b:r,q:!1}),_&&i?e.addEventListener(o,t,{passive:!1,capture:r}):e.addEventListener(o,t,r||!1)},this._unbind=function(e,o,t,r){e.removeEventListener(o,t,r)},this.unbindAll=function(){for(var e=0;e0)return t;o=!!o.parentNode&&o.parentNode}return!1},this.triggerScrollStart=function(e,o,t,r,i){if(k.onscrollstart){var s={type:"scrollstart",current:{x:e,y:o},request:{x:t,y:r},end:{x:k.newscrollx,y:k.newscrolly},speed:i};k.onscrollstart.call(k,s)}},this.triggerScrollEnd=function(){if(k.onscrollend){var e=k.getScrollLeft(),o=k.getScrollTop(),t={type:"scrollend",current:{x:e,y:o},end:{x:e,y:o}};k.onscrollend.call(k,t)}};var I=0,O=0,Y=0,B=1,X=!1;if(this.onmousewheel=function(e){if(!k.wheelprevented){if(k.railslocked)return k.debounced("checkunlock",k.resize,250),!0;if(k.rail.drag)return k.cancelEvent(e);if("auto"===k.opt.oneaxismousemode&&0!==e.deltaX&&(k.opt.oneaxismousemode=!1),k.opt.oneaxismousemode&&0===e.deltaX&&!k.rail.scrollable)return!k.railh||!k.railh.scrollable||k.onmousewheelhr(e);var o=m(),t=!1;if(k.opt.preservenativescrolling&&k.checkarea+600k.page.maxh&&(o=k.page.maxh+(o-k.page.maxh)/2|0),e<0?e=e/2|0:e>k.page.maxw&&(e=k.page.maxw+(o-k.page.maxw)/2|0)):(o<0?o=0:o>k.page.maxh&&(o=k.page.maxh),e<0?e=0:e>k.page.maxw&&(e=k.page.maxw)),k.scrollrunning&&e==k.newscrollx&&o==k.newscrolly)return!1;k.newscrolly=o,k.newscrollx=e;var s=k.getScrollTop(),n=k.getScrollLeft(),l={};l.x=e-n,l.y=o-s;var a=0|Math.sqrt(l.x*l.x+l.y*l.y),c=k.prepareTransition(a);k.scrollrunning||(k.scrollrunning=!0,k.triggerScrollStart(n,s,e,o,c),k.cursorupdate.start()),k.scrollendtrapped=!0,C.transitionend||(k.scrollendtrapped&&clearTimeout(k.scrollendtrapped),k.scrollendtrapped=setTimeout(k.onScrollTransitionEnd,c)),k.setScrollTop(k.newscrolly),k.setScrollLeft(k.newscrollx)},this.cancelScroll=function(){if(!k.scrollendtrapped)return!0;var e=k.getScrollTop(),o=k.getScrollLeft();return k.scrollrunning=!1,C.transitionend||clearTimeout(C.transitionend),k.scrollendtrapped=!1,k.resetTransition(),k.setScrollTop(e),k.railh&&k.setScrollLeft(o),k.timerscroll&&k.timerscroll.tm&&clearInterval(k.timerscroll.tm),k.timerscroll=!1,k.cursorfreezed=!1,k.cursorupdate.stop(),k.showCursor(e,o),k},this.onScrollTransitionEnd=function(){if(k.scrollendtrapped){var e=k.getScrollTop(),o=k.getScrollLeft();if(e<0?e=0:e>k.page.maxh&&(e=k.page.maxh),o<0?o=0:o>k.page.maxw&&(o=k.page.maxw),e!=k.newscrolly||o!=k.newscrollx)return k.doScrollPos(o,e,k.opt.snapbackspeed);k.scrollrunning&&k.triggerScrollEnd(),k.scrollrunning=!1,k.scrollendtrapped=!1,k.resetTransition(),k.timerscroll=!1,k.setScrollTop(e),k.railh&&k.setScrollLeft(o),k.cursorupdate.stop(),k.noticeCursor(!1,e,o),k.cursorfreezed=!1}}}else this.doScrollLeft=function(e,o){var t=k.scrollrunning?k.newscrolly:k.getScrollTop();k.doScrollPos(e,t,o)},this.doScrollTop=function(e,o){var t=k.scrollrunning?k.newscrollx:k.getScrollLeft();k.doScrollPos(t,e,o)},this.doScrollPos=function(e,o,t){var r=k.getScrollTop(),i=k.getScrollLeft();((k.newscrolly-r)*(o-r)<0||(k.newscrollx-i)*(e-i)<0)&&k.cancelScroll();var s=!1;if(k.bouncescroll&&k.rail.visibility||(o<0?(o=0,s=!0):o>k.page.maxh&&(o=k.page.maxh,s=!0)),k.bouncescroll&&k.railh.visibility||(e<0?(e=0,s=!0):e>k.page.maxw&&(e=k.page.maxw,s=!0)),k.scrollrunning&&k.newscrolly===o&&k.newscrollx===e)return!0;k.newscrolly=o,k.newscrollx=e,k.dst={},k.dst.x=e-i,k.dst.y=o-r,k.dst.px=i,k.dst.py=r;var n=0|Math.sqrt(k.dst.x*k.dst.x+k.dst.y*k.dst.y),l=k.getTransitionSpeed(n);k.bzscroll={};var a=s?1:.58;k.bzscroll.x=new N(i,k.newscrollx,l,0,0,a,1),k.bzscroll.y=new N(r,k.newscrolly,l,0,0,a,1);var c=function(){if(k.scrollrunning){var e=k.bzscroll.y.getPos();k.setScrollLeft(k.bzscroll.x.getNow()),k.setScrollTop(k.bzscroll.y.getNow()),e<=1?d(c):(k.scrollrunning=!1,k.timer=0,k.triggerScrollEnd())}};k.scrollrunning||(k.triggerScrollStart(i,r,e,o,l),k.scrollrunning=!0,k.timer=d(c))},this.cancelScroll=function(){return k.timer&&u(k.timer),k.timer=0,k.bzscroll=!1,k.scrollrunning=!1,k};else this.doScrollLeft=function(e,o){var t=k.getScrollTop();k.doScrollPos(e,t,o)},this.doScrollTop=function(e,o){var t=k.getScrollLeft();k.doScrollPos(t,e,o)},this.doScrollPos=function(e,o,t){var r=e>k.page.maxw?k.page.maxw:e;r<0&&(r=0);var i=o>k.page.maxh?k.page.maxh:o;i<0&&(i=0),k.synched("scroll",function(){k.setScrollTop(i),k.setScrollLeft(r)})},this.cancelScroll=function(){};this.doScrollBy=function(e,o){S(0,e)},this.doScrollLeftBy=function(e,o){S(e,0)},this.doScrollTo=function(e,o){var t=o?Math.round(e*k.scrollratio.y):e;t<0?t=0:t>k.page.maxh&&(t=k.page.maxh),k.cursorfreezed=!1,k.doScrollTop(e)},this.checkContentSize=function(){var e=k.getContentSize();e.h==k.page.h&&e.w==k.page.w||k.resize(!1,e)},k.onscroll=function(e){k.rail.drag||k.cursorfreezed||k.synched("scroll",function(){k.scroll.y=Math.round(k.getScrollTop()/k.scrollratio.y),k.railh&&(k.scroll.x=Math.round(k.getScrollLeft()/k.scrollratio.x)),k.noticeCursor()})},k.bind(k.docscroll,"scroll",k.onscroll),this.doZoomIn=function(e){if(!k.zoomactive){k.zoomactive=!0,k.zoomrestore={style:{}};var o=["position","top","left","zIndex","backgroundColor","marginTop","marginBottom","marginLeft","marginRight"],t=k.win[0].style;for(var r in o){var i=o[r];k.zoomrestore.style[i]=void 0!==t[i]?t[i]:""}k.zoomrestore.style.width=k.win.css("width"),k.zoomrestore.style.height=k.win.css("height"),k.zoomrestore.padding={w:k.win.outerWidth()-k.win.width(),h:k.win.outerHeight()-k.win.height()},C.isios4&&(k.zoomrestore.scrollTop=c.scrollTop(),c.scrollTop(0)),k.win.css({position:C.isios4?"absolute":"fixed",top:0,left:0,zIndex:s+100,margin:0});var n=k.win.css("backgroundColor");return(""===n||/transparent|rgba\(0, 0, 0, 0\)|rgba\(0,0,0,0\)/.test(n))&&k.win.css("backgroundColor","#fff"),k.rail.css({zIndex:s+101}),k.zoom.css({zIndex:s+102}),k.zoom.css("backgroundPosition","0 -18px"),k.resizeZoom(),k.onzoomin&&k.onzoomin.call(k),k.cancelEvent(e)}},this.doZoomOut=function(e){if(k.zoomactive)return k.zoomactive=!1,k.win.css("margin",""),k.win.css(k.zoomrestore.style),C.isios4&&c.scrollTop(k.zoomrestore.scrollTop),k.rail.css({"z-index":k.zindex}),k.zoom.css({"z-index":k.zindex}),k.zoomrestore=!1,k.zoom.css("backgroundPosition","0 0"),k.onResize(),k.onzoomout&&k.onzoomout.call(k),k.cancelEvent(e)},this.doZoom=function(e){return k.zoomactive?k.doZoomOut(e):k.doZoomIn(e)},this.resizeZoom=function(){if(k.zoomactive){var e=k.getScrollTop();k.win.css({width:c.width()-k.zoomrestore.padding.w+"px",height:c.height()-k.zoomrestore.padding.h+"px"}),k.onResize(),k.setScrollTop(Math.min(k.page.maxh,e))}},this.init(),n.nicescroll.push(this)},b=function(e){var o=this;this.nc=e,this.lastx=0,this.lasty=0,this.speedx=0,this.speedy=0,this.lasttime=0,this.steptime=0,this.snapx=!1,this.snapy=!1,this.demulx=0,this.demuly=0,this.lastscrollx=-1,this.lastscrolly=-1,this.chkx=0,this.chky=0,this.timer=0,this.reset=function(e,t){o.stop(),o.steptime=0,o.lasttime=m(),o.speedx=0,o.speedy=0,o.lastx=e,o.lasty=t,o.lastscrollx=-1,o.lastscrolly=-1},this.update=function(e,t){var r=m();o.steptime=r-o.lasttime,o.lasttime=r;var i=t-o.lasty,s=e-o.lastx,n=o.nc.getScrollTop()+i,l=o.nc.getScrollLeft()+s;o.snapx=l<0||l>o.nc.page.maxw,o.snapy=n<0||n>o.nc.page.maxh,o.speedx=s,o.speedy=i,o.lastx=e,o.lasty=t},this.stop=function(){o.nc.unsynched("domomentum2d"),o.timer&&clearTimeout(o.timer),o.timer=0,o.lastscrollx=-1,o.lastscrolly=-1},this.doSnapy=function(e,t){var r=!1;t<0?(t=0,r=!0):t>o.nc.page.maxh&&(t=o.nc.page.maxh,r=!0),e<0?(e=0,r=!0):e>o.nc.page.maxw&&(e=o.nc.page.maxw,r=!0),r?o.nc.doScrollPos(e,t,o.nc.opt.snapbackspeed):o.nc.triggerScrollEnd()},this.doMomentum=function(e){var t=m(),r=e?t+e:o.lasttime,i=o.nc.getScrollLeft(),s=o.nc.getScrollTop(),n=o.nc.page.maxh,l=o.nc.page.maxw;o.speedx=l>0?Math.min(60,o.speedx):0,o.speedy=n>0?Math.min(60,o.speedy):0;var a=r&&t-r<=60;(s<0||s>n||i<0||i>l)&&(a=!1);var c=!(!o.speedy||!a)&&o.speedy,d=!(!o.speedx||!a)&&o.speedx;if(c||d){var u=Math.max(16,o.steptime);if(u>50){var h=u/50;o.speedx*=h,o.speedy*=h,u=50}o.demulxy=0,o.lastscrollx=o.nc.getScrollLeft(),o.chkx=o.lastscrollx,o.lastscrolly=o.nc.getScrollTop(),o.chky=o.lastscrolly;var p=o.lastscrollx,f=o.lastscrolly,g=function(){var e=m()-t>600?.04:.02;o.speedx&&(p=Math.floor(o.lastscrollx-o.speedx*(1-o.demulxy)),o.lastscrollx=p,(p<0||p>l)&&(e=.1)),o.speedy&&(f=Math.floor(o.lastscrolly-o.speedy*(1-o.demulxy)),o.lastscrolly=f,(f<0||f>n)&&(e=.1)),o.demulxy=Math.min(1,o.demulxy+e),o.nc.synched("domomentum2d",function(){if(o.speedx){o.nc.getScrollLeft();o.chkx=p,o.nc.setScrollLeft(p)}if(o.speedy){o.nc.getScrollTop();o.chky=f,o.nc.setScrollTop(f)}o.timer||(o.nc.hideCursor(),o.doSnapy(p,f))}),o.demulxy<1?o.timer=setTimeout(g,u):(o.stop(),o.nc.hideCursor(),o.doSnapy(p,f))};g()}else o.doSnapy(o.nc.getScrollLeft(),o.nc.getScrollTop())}},y=e.fn.scrollTop;e.cssHooks.pageYOffset={get:function(e,o,t){var r=n.data(e,"__nicescroll")||!1;return r&&r.ishwscroll?r.getScrollTop():y.call(e)},set:function(e,o){var t=n.data(e,"__nicescroll")||!1;return t&&t.ishwscroll?t.setScrollTop(parseInt(o)):y.call(e,o),this}},e.fn.scrollTop=function(e){if(void 0===e){var o=!!this[0]&&(n.data(this[0],"__nicescroll")||!1);return o&&o.ishwscroll?o.getScrollTop():y.call(this)}return this.each(function(){var o=n.data(this,"__nicescroll")||!1;o&&o.ishwscroll?o.setScrollTop(parseInt(e)):y.call(n(this),e)})};var x=e.fn.scrollLeft;n.cssHooks.pageXOffset={get:function(e,o,t){var r=n.data(e,"__nicescroll")||!1;return r&&r.ishwscroll?r.getScrollLeft():x.call(e)},set:function(e,o){var t=n.data(e,"__nicescroll")||!1;return t&&t.ishwscroll?t.setScrollLeft(parseInt(o)):x.call(e,o),this}},e.fn.scrollLeft=function(e){if(void 0===e){var o=!!this[0]&&(n.data(this[0],"__nicescroll")||!1);return o&&o.ishwscroll?o.getScrollLeft():x.call(this)}return this.each(function(){var o=n.data(this,"__nicescroll")||!1;o&&o.ishwscroll?o.setScrollLeft(parseInt(e)):x.call(n(this),e)})};var S=function(e){var o=this;if(this.length=0,this.name="nicescrollarray",this.each=function(e){return n.each(o,e),o},this.push=function(e){o[o.length]=e,o.length++},this.eq=function(e){return o[e]},e)for(var t=0;t1?n(e,r):s,i.win=r}!("doc"in i)||"win"in i||(i.win=r);var l=r.data("__nicescroll")||!1;l||(i.doc=i.doc||r,l=new w(i,r),r.data("__nicescroll",l)),t.push(l)}),1===t.length?t[0]:t},a.NiceScroll={getjQuery:function(){return e}},n.nicescroll||(n.nicescroll=new S,n.nicescroll.options=f)}); \ No newline at end of file From 74920312374e8c102972c57779265a0149312758 Mon Sep 17 00:00:00 2001 From: Andrea Tosone Date: Thu, 29 Jun 2017 17:26:20 +0200 Subject: [PATCH 05/14] RC4 Minor code optimizations --- jquery.nicescroll.js | 83 +++++++++++++++++++++++++--------------- jquery.nicescroll.min.js | 2 +- 2 files changed, 54 insertions(+), 31 deletions(-) diff --git a/jquery.nicescroll.js b/jquery.nicescroll.js index df86b94..1b92bb9 100644 --- a/jquery.nicescroll.js +++ b/jquery.nicescroll.js @@ -1,5 +1,5 @@ /* jquery.nicescroll --- version 3.7.4-d [DEV REL] +-- version 3.7.4-e [DEV REL] -- copyright 2017-06-18 InuYaksa*2017 -- licensed under the MIT -- @@ -231,8 +231,6 @@ })(); - - function detectCursorGrab() { var lst = ['grab', '-webkit-grab', '-moz-grab']; if ((d.ischrome && !d.ischrome38) || d.isie) lst = []; // force setting for IE returns false positive and chrome cursor bug @@ -260,7 +258,7 @@ var self = this; - this.version = '3.7.4-d'; + this.version = '3.7.4-e'; this.name = 'nicescroll'; this.me = me; @@ -543,7 +541,7 @@ } if (this.ishwscroll) { // hw accelerated scroll - + this.doc.translate = { x: 0, y: 0, @@ -609,7 +607,7 @@ }; } } else { // native scroll - + this.getScrollTop = function () { return self.docscroll.scrollTop(); }; @@ -1190,7 +1188,7 @@ if (!self.rail.scrollable && self.railh.scrollable) self.rail.drag.ck = (maxh > 0) ? "v" : false; else if (self.rail.scrollable && !self.railh.scrollable) self.rail.drag.ck = (maxw > 0) ? "h" : false; else self.rail.drag.ck = false; - if (!self.rail.drag.ck) self.rail.drag.dl = "f"; + //if (!self.rail.drag.ck) self.rail.drag.dl = "f"; } if (self.opt.emulatetouch && self.isiframe && cap.isie) { @@ -1289,10 +1287,12 @@ e.clientY = e.changedTouches[0].clientY; } - if (self.rail.drag.y === e.clientY && self.rail.drag.x === e.clientX) return false; // prevent first useless move event + if (!self.hasmoving) { + if (self.rail.drag.y === e.clientY && self.rail.drag.x === e.clientX) return false; // prevent first useless move event - if (!self.hasmoving) self.triggerScrollStart(e.clientX, e.clientY, 0, 0, 0); - self.hasmoving = true; + self.triggerScrollStart(e.clientX, e.clientY, 0, 0, 0); + self.hasmoving = true; + } if (self.preventclick && !self.preventclick.click) { self.preventclick.click = self.preventclick.tg.onclick || false; @@ -1364,7 +1364,13 @@ var ay = Math.abs(my); var ax = Math.abs(mx); var dz = self.opt.directionlockdeadzone; - if (self.rail.drag.ck == "v") { + + if (!self.rail.drag.ck) { + if (ay > dz && ax > dz) self.rail.drag.dl = "f"; + else if (ay > dz) self.rail.drag.dl = (ax) ? "f" : "v"; + else if (ax > dz) self.rail.drag.dl = (ay) ? "f" : "h"; + } + else if (self.rail.drag.ck == "v") { if (ay > dz && (ax <= (ay * 0.3))) { self.rail.drag = false; return true; @@ -1372,15 +1378,17 @@ self.rail.drag.dl = "f"; $body.scrollTop($body.scrollTop()); // stop iOS native scrolling (when active javascript has blocked) } - } else if (self.rail.drag.ck == "h") { + } + else if (self.rail.drag.ck == "h") { if (ax > dz && (ay <= (ax * 0.3))) { self.rail.drag = false; return true; - } else if (ay > dz) { + } else { self.rail.drag.dl = "f"; - $body.scrollLeft($body.scrollLeft()); // stop iOS native scrolling (when active javascript has blocked) + $body.scrollTop($body.scrollTop()); // stop iOS native scrolling (when active javascript has blocked) } } + return false; } self.synched("touchmove", function () { @@ -2374,12 +2382,15 @@ this.lazyResize = function (tm) { // event debounce - if (!self.haswrapper && !self.ispage) self.hide(); - if (self.hlazyresize) clearTimeout(self.hlazyresize); + + var hiderails = (!self.ispage && !self.haswrapper); + + if (hiderails) self.hideRails(); + self.hlazyresize = setTimeout(function () { if (self) { - if (!self.haswrapper && !self.ispage) self.show(); + if (hiderails) self.showRails(); self.resize(); } }, 240); @@ -2458,6 +2469,7 @@ if (e.preventManipulation) e.preventManipulation(); //IE10 return false; }; + this.stopPropagation = function (e) { if (!e) return false; e = (e.original) ? e.original : e; @@ -2493,6 +2505,7 @@ e.returnValue = false; return false; }; + this.stopPropagation = function (e) { e = e || _win.event; if (e) e.cancelBubble = true; @@ -2501,7 +2514,7 @@ } - this.bind = function (dom, name, fn, bubble, active) { // W3C + this.bind = function (dom, name, fn, bubble, active) { var el = ("jquery" in dom) ? dom[0] : dom; self._bind(el, name, fn, bubble || false, active || false); }; @@ -2530,6 +2543,10 @@ } }; + this.showRails = function () { + return self.showRail().showRailHr(); + }; + this.showRail = function () { if ((self.page.maxh !== 0) && (self.ispage || self.win.css('display') != 'none')) { self.visibility = true; @@ -2540,14 +2557,19 @@ }; this.showRailHr = function () { - if (!self.railh) return self; - if ((self.page.maxw !== 0) && (self.ispage || self.win.css('display') != 'none')) { - self.railh.visibility = true; - self.railh.css('display', 'block'); + if (self.railh) { + if ((self.page.maxw !== 0) && (self.ispage || self.win.css('display') != 'none')) { + self.railh.visibility = true; + self.railh.css('display', 'block'); + } } return self; }; + this.hideRails = function () { + return self.hideRail().hideRailHr(); + } + this.hideRail = function () { self.visibility = false; self.rail.visibility = false; @@ -2556,22 +2578,23 @@ }; this.hideRailHr = function () { - if (!self.railh) return self; - self.railh.visibility = false; - self.railh.css('display', 'none'); + if (self.railh) { + self.railh.visibility = false; + self.railh.css('display', 'none'); + } return self; }; this.show = function () { self.hidden = false; self.railslocked = false; - return self.showRail().showRailHr(); + return self.showRails(); }; this.hide = function () { self.hidden = true; self.railslocked = true; - return self.hideRail().hideRailHr(); + return self.hideRails(); }; this.toggle = function () { @@ -2861,7 +2884,7 @@ if (chk) { if (chkscroll) hasparentscrollingphase = true; - } else { + } else { hasparentscrollingphase = false; e.stopImmediatePropagation(); return e.preventDefault(); @@ -2959,7 +2982,7 @@ var lasttransitionstyle = ''; - this.resetTransition = function() { + this.resetTransition = function () { lasttransitionstyle = ''; self.doc.css(cap.prefixstyle + 'transition-duration', '0ms'); }; @@ -3221,7 +3244,7 @@ self.bzscroll.y = new BezierClass(py, self.newscrolly, ms, 0, 0, p3, 1); var loop = function () { - + if (!self.scrollrunning) return; var x = self.bzscroll.y.getPos(); diff --git a/jquery.nicescroll.min.js b/jquery.nicescroll.min.js index af76f70..cdb1988 100644 --- a/jquery.nicescroll.min.js +++ b/jquery.nicescroll.min.js @@ -1,2 +1,2 @@ /* jquery.nicescroll v 3.7.4-d [DEV REL] - InuYaksa*2017 - MIT - https://nicescroll.areaaperta.com/ */ -!function(e){"function"==typeof define&&define.amd?define(["jquery"],e):"object"==typeof exports?module.exports=e(require("jquery")):e(jQuery)}(function(e){"use strict";var o=!1,t=!1,r=0,i=2e3,s=0,n=e,l=document,a=window,c=n(a),d=a.requestAnimationFrame||a.webkitRequestAnimationFrame||a.mozRequestAnimationFrame||!1,u=a.cancelAnimationFrame||a.webkitCancelAnimationFrame||a.mozCancelAnimationFrame||!1;if(d)a.cancelAnimationFrame||(u=function(e){});else{var h=0;d=function(e,o){var t=(new Date).getTime(),r=Math.max(0,16-(t-h)),i=a.setTimeout(function(){e(t+r)},r);return h=t+r,i},u=function(e){a.clearTimeout(e)}}var p=a.MutationObserver||a.WebKitMutationObserver||!1,m=Date.now||function(){return(new Date).getTime()},f={zindex:"auto",cursoropacitymin:0,cursoropacitymax:1,cursorcolor:"#424242",cursorwidth:"6px",cursorborder:"1px solid #fff",cursorborderradius:"5px",scrollspeed:40,mousescrollstep:27,touchbehavior:!1,emulatetouch:!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 e=l.currentScript||function(){var e=l.getElementsByTagName("script");return!!e.length&&e[e.length-1]}(),o=e?e.src.split("?")[0]:"";return o.split("/").length>0?o.split("/").slice(0,-1).join("/")+"/":""}(),preventmultitouchscrolling:!0,disablemutationobserver:!1,enableobserver:!0,scrollbarid:!1},g=!1,v=function(){if(g)return g;var e=l.createElement("DIV"),o=e.style,t=navigator.userAgent,r=navigator.platform,i={};return i.haspointerlock="pointerLockElement"in l||"webkitPointerLockElement"in l||"mozPointerLockElement"in l,i.isopera="opera"in a,i.isopera12=i.isopera&&"getUserMedia"in navigator,i.isoperamini="[object OperaMini]"===Object.prototype.toString.call(a.operamini),i.isie="all"in l&&"attachEvent"in e&&!i.isopera,i.isieold=i.isie&&!("msInterpolationMode"in o),i.isie7=i.isie&&!i.isieold&&(!("documentMode"in l)||7===l.documentMode),i.isie8=i.isie&&"documentMode"in l&&8===l.documentMode,i.isie9=i.isie&&"performance"in a&&9===l.documentMode,i.isie10=i.isie&&"performance"in a&&10===l.documentMode,i.isie11="msRequestFullscreen"in e&&l.documentMode>=11,i.ismsedge="msCredentials"in a,i.ismozilla="MozAppearance"in o,i.iswebkit=!i.ismsedge&&"WebkitAppearance"in o,i.ischrome=i.iswebkit&&"chrome"in a,i.ischrome38=i.ischrome&&"touchAction"in o,i.ischrome22=!i.ischrome38&&i.ischrome&&i.haspointerlock,i.ischrome26=!i.ischrome38&&i.ischrome&&"transition"in o,i.cantouch="ontouchstart"in l.documentElement||"ontouchstart"in a,i.hasw3ctouch=(a.PointerEvent||!1)&&(navigator.MaxTouchPoints>0||navigator.msMaxTouchPoints>0),i.hasmstouch=!i.hasw3ctouch&&(a.MSPointerEvent||!1),i.ismac=/^mac$/i.test(r),i.isios=i.cantouch&&/iphone|ipad|ipod/i.test(r),i.isios4=i.isios&&!("seal"in Object),i.isios7=i.isios&&"webkitHidden"in l,i.isios8=i.isios&&"hidden"in l,i.isios10=i.isios&&a.Proxy,i.isandroid=/android/i.test(t),i.haseventlistener="addEventListener"in e,i.trstyle=!1,i.hastransform=!1,i.hastranslate3d=!1,i.transitionstyle=!1,i.hastransition=!1,i.transitionend=!1,i.trstyle="transform",i.hastransform="transform"in o||function(){for(var e=["msTransform","webkitTransform","MozTransform","OTransform"],t=0,r=e.length;t0;){if(9==e[0].nodeType)return!1;var o=e.css("zIndex");if(!isNaN(o)&&0!==o)return parseInt(o);e=e.parent()}return!1}function y(e,o,t){var r=e.css(o),i=parseFloat(r);if(isNaN(i)){var s=3==(i=R[r]||0)?t?k.win.outerHeight()-k.win.innerHeight():k.win.outerWidth()-k.win.innerWidth():1;return k.isie8&&i&&(i+=1),s?i:0}return i}function x(e,o,t,r){k._bind(e,o,function(r){var i={original:r=r||a.event,target:r.target||r.srcElement,type:"wheel",deltaMode:"MozMousePixelScroll"==r.type?0:1,deltaX:0,deltaZ:0,preventDefault:function(){return r.preventDefault?r.preventDefault():r.returnValue=!1,!1},stopImmediatePropagation:function(){r.stopImmediatePropagation?r.stopImmediatePropagation():r.cancelBubble=!0}};return"mousewheel"==o?(r.wheelDeltaX&&(i.deltaX=-.025*r.wheelDeltaX),r.wheelDeltaY&&(i.deltaY=-.025*r.wheelDeltaY),!i.deltaY&&!i.deltaX&&(i.deltaY=-.025*r.wheelDelta)):i.deltaY=r.detail,t.call(e,i)},r)}function S(e,o,t,r){k.scrollrunning||(k.newscrolly=k.getScrollTop(),k.newscrollx=k.getScrollLeft(),Y=m());var i=m()-Y;if(Y=m(),i>350?B=1:B+=(2-B)/10,e=e*B|0,o=o*B|0,e){if(r)if(e<0){if(k.getScrollLeft()>=k.page.maxw)return!0}else if(k.getScrollLeft()<=0)return!0;var s=e>0?1:-1;O!==s&&(k.scrollmom&&k.scrollmom.stop(),k.newscrollx=k.getScrollLeft(),O=s),k.lastdeltax-=e}if(o){if(function(){var e=k.getScrollTop();if(o<0){if(e>=k.page.maxh)return!0}else if(e<=0)return!0}()){if(k.opt.nativeparentscrolling&&t&&!k.ispage&&!k.zoomactive)return!0;var n=k.view.h>>1;k.newscrolly<-n?(k.newscrolly=-n,o=-1):k.newscrolly>k.page.maxh+n?(k.newscrolly=k.page.maxh+n,o=1):o=0}var l=o>0?1:-1;I!==l&&(k.scrollmom&&k.scrollmom.stop(),k.newscrolly=k.getScrollTop(),I=l),k.lastdeltay-=o}(o||e)&&k.synched("relativexy",function(){var e=k.lastdeltay+k.newscrolly;k.lastdeltay=0;var o=k.lastdeltax+k.newscrollx;k.lastdeltax=0,k.rail.drag||k.doScrollPos(o,e)})}function z(e,o,t){var r,i;return!(t||!X)||(0===e.deltaMode?(r=-e.deltaX*(k.opt.mousescrollstep/54)|0,i=-e.deltaY*(k.opt.mousescrollstep/54)|0):1===e.deltaMode&&(r=-e.deltaX*k.opt.mousescrollstep*50/80|0,i=-e.deltaY*k.opt.mousescrollstep*50/80|0),o&&k.opt.oneaxismousemode&&0===r&&i&&(r=i,i=0,t&&(r<0?k.getScrollLeft()>=k.page.maxw:k.getScrollLeft()<=0)&&(i=r,r=0)),k.isrtlmode&&(r=-r),S(r,i,t,!0)?void(t&&(X=!0)):(X=!1,e.stopImmediatePropagation(),e.preventDefault()))}var k=this;this.version="3.7.4-d",this.name="nicescroll",this.me=h;var T=n("body");if(this.opt={doc:T,win:!1},n.extend(this.opt,f),this.opt.snapbackspeed=80,e)for(var E in k.opt)void 0!==e[E]&&(k.opt[E]=e[E]);if(k.opt.disablemutationobserver&&(p=!1),this.doc=k.opt.doc,this.iddoc=this.doc&&this.doc[0]?this.doc[0].id||"":"",this.ispage=/^BODY|HTML/.test(k.opt.win?k.opt.win[0].nodeName:this.doc[0].nodeName),this.haswrapper=!1!==k.opt.win,this.win=k.opt.win||(this.ispage?c:this.doc),this.docscroll=this.ispage&&!this.haswrapper?c:this.win,this.body=T,this.viewport=!1,this.isfixed=!1,this.iframe=!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"!=k.opt.autohidemode,this.onmousedown=!1,this.onmouseup=!1,this.onmousemove=!1,this.onmousewheel=!1,this.onkeypress=!1,this.ongesturezoom=!1,this.onclick=!1,this.onscrollstart=!1,this.onscrollend=!1,this.onscrollcancel=!1,this.onzoomin=!1,this.onzoomout=!1,this.view=!1,this.page=!1,this.scroll={x:0,y:0},this.scrollratio={x:0,y:0},this.cursorheight=20,this.scrollvaluemax=0,"auto"==this.opt.rtlmode){var M=this.win[0]==a?this.body:this.win,L=M.css("writing-mode")||M.css("-webkit-writing-mode")||M.css("-ms-writing-mode")||M.css("-moz-writing-mode");"horizontal-tb"==L||"lr-tb"==L||""===L?(this.isrtlmode="rtl"==M.css("direction"),this.isvertical=!1):(this.isrtlmode="vertical-rl"==L||"tb"==L||"tb-rl"==L||"rl-tb"==L,this.isvertical="vertical-rl"==L||"tb"==L||"tb-rl"==L)}else this.isrtlmode=!0===this.opt.rtlmode,this.isvertical=!1;if(this.scrollrunning=!1,this.scrollmom=!1,this.observer=!1,this.observerremover=!1,this.observerbody=!1,!1!==k.opt.scrollbarid)this.id=k.opt.scrollbarid;else do{this.id="ascrail"+i++}while(l.getElementById(this.id));this.rail=!1,this.cursor=!1,this.cursorfreezed=!1,this.selectiondrag=!1,this.zoom=!1,this.zoomactive=!1,this.hasfocus=!1,this.hasmousefocus=!1,this.visibility=!0,this.railslocked=!1,this.locked=!1,this.hidden=!1,this.cursoractive=!0,this.wheelprevented=!1,this.overflowx=k.opt.overflowx,this.overflowy=k.opt.overflowy,this.nativescrollingarea=!1,this.checkarea=0,this.events=[],this.saved={},this.delaylist={},this.synclist={},this.lastdeltax=0,this.lastdeltay=0,this.detected=v();var C=n.extend({},this.detected);this.canhwscroll=C.hastransform&&k.opt.hwacceleration,this.ishwscroll=this.canhwscroll&&k.haswrapper,this.isrtlmode?this.isvertical?this.hasreversehr=!(C.iswebkit||C.isie||C.isie11):this.hasreversehr=!(C.iswebkit||C.isie&&!C.isie10&&!C.isie11):this.hasreversehr=!1,this.istouchcapable=!1,C.cantouch||!C.hasw3ctouch&&!C.hasmstouch?!C.cantouch||C.isios||C.isandroid||!C.iswebkit&&!C.ismozilla||(this.istouchcapable=!0):this.istouchcapable=!0,k.opt.enablemouselockapi||(C.hasmousecapture=!1,C.haspointerlock=!1),this.debounced=function(e,o,t){k&&(k.delaylist[e]||!1||(k.delaylist[e]={h:d(function(){k.delaylist[e].fn.call(k),k.delaylist[e]=!1},t)},o.call(k)),k.delaylist[e].fn=o)},this.synched=function(e,o){k.synclist[e]?k.synclist[e]=o:(k.synclist[e]=o,d(function(){k&&(k.synclist[e]&&k.synclist[e].call(k),k.synclist[e]=null)}))},this.unsynched=function(e){k.synclist[e]&&(k.synclist[e]=!1)},this.css=function(e,o){for(var t in o)k.saved.css.push([e,t,e.css(t)]),e.css(t,o[t])},this.scrollTop=function(e){return void 0===e?k.getScrollTop():k.setScrollTop(e)},this.scrollLeft=function(e){return void 0===e?k.getScrollLeft():k.setScrollLeft(e)};var N=function(e,o,t,r,i,s,n){this.st=e,this.ed=o,this.spd=t,this.p1=r||0,this.p2=i||1,this.p3=s||0,this.p4=n||1,this.ts=m(),this.df=o-e};if(N.prototype={B2:function(e){return 3*(1-e)*(1-e)*e},B3:function(e){return 3*(1-e)*e*e},B4:function(e){return e*e*e},getPos:function(){return(m()-this.ts)/this.spd},getNow:function(){var e=(m()-this.ts)/this.spd,o=this.B2(e)+this.B3(e)+this.B4(e);return e>=1?this.ed:this.st+this.df*o|0},update:function(e,o){return this.st=this.getNow(),this.ed=e,this.spd=o,this.ts=m(),this.df=this.ed-this.st,this}},this.ishwscroll){this.doc.translate={x:0,y:0,tx:"0px",ty:"0px"},C.hastranslate3d&&C.isios&&this.doc.css("-webkit-backface-visibility","hidden"),this.getScrollTop=function(e){if(!e){var o=g();if(o)return 16==o.length?-o[13]:-o[5];if(k.timerscroll&&k.timerscroll.bz)return k.timerscroll.bz.getNow()}return k.doc.translate.y},this.getScrollLeft=function(e){if(!e){var o=g();if(o)return 16==o.length?-o[12]:-o[4];if(k.timerscroll&&k.timerscroll.bh)return k.timerscroll.bh.getNow()}return k.doc.translate.x},this.notifyScrollEvent=function(e){var o=l.createEvent("UIEvents");o.initUIEvent("scroll",!1,!0,a,1),o.niceevent=!0,e.dispatchEvent(o)};var P=this.isrtlmode?1:-1;C.hastranslate3d&&k.opt.enabletranslate3d?(this.setScrollTop=function(e,o){k.doc.translate.y=e,k.doc.translate.ty=-1*e+"px",k.doc.css(C.trstyle,"translate3d("+k.doc.translate.tx+","+k.doc.translate.ty+",0)"),o||k.notifyScrollEvent(k.win[0])},this.setScrollLeft=function(e,o){k.doc.translate.x=e,k.doc.translate.tx=e*P+"px",k.doc.css(C.trstyle,"translate3d("+k.doc.translate.tx+","+k.doc.translate.ty+",0)"),o||k.notifyScrollEvent(k.win[0])}):(this.setScrollTop=function(e,o){k.doc.translate.y=e,k.doc.translate.ty=-1*e+"px",k.doc.css(C.trstyle,"translate("+k.doc.translate.tx+","+k.doc.translate.ty+")"),o||k.notifyScrollEvent(k.win[0])},this.setScrollLeft=function(e,o){k.doc.translate.x=e,k.doc.translate.tx=e*P+"px",k.doc.css(C.trstyle,"translate("+k.doc.translate.tx+","+k.doc.translate.ty+")"),o||k.notifyScrollEvent(k.win[0])})}else this.getScrollTop=function(){return k.docscroll.scrollTop()},this.setScrollTop=function(e){k.docscroll.scrollTop(e)},this.getScrollLeft=function(){return k.hasreversehr?k.detected.ismozilla?k.page.maxw-Math.abs(k.docscroll.scrollLeft()):k.page.maxw-k.docscroll.scrollLeft():k.docscroll.scrollLeft()},this.setScrollLeft=function(e){return setTimeout(function(){if(k)return k.hasreversehr&&(e=k.detected.ismozilla?-(k.page.maxw-e):k.page.maxw-e),k.docscroll.scrollLeft(e)},1)};this.getTarget=function(e){return!!e&&(e.target?e.target:!!e.srcElement&&e.srcElement)},this.hasParent=function(e,o){if(!e)return!1;for(var t=e.target||e.srcElement||e||!1;t&&t.id!=o;)t=t.parentNode||!1;return!1!==t};var R={thin:1,medium:3,thick:5};this.getDocumentScrollOffset=function(){return{top:a.pageYOffset||l.documentElement.scrollTop,left:a.pageXOffset||l.documentElement.scrollLeft}},this.getOffset=function(){if(k.isfixed){var e=k.win.offset(),o=k.getDocumentScrollOffset();return e.top-=o.top,e.left-=o.left,e}var t=k.win.offset();if(!k.viewport)return t;var r=k.viewport.offset();return{top:t.top-r.top,left:t.left-r.left}},this.updateScrollBar=function(e){var o,t;if(k.ishwscroll)k.rail.css({height:k.win.innerHeight()-(k.opt.railpadding.top+k.opt.railpadding.bottom)}),k.railh&&k.railh.css({width:k.win.innerWidth()-(k.opt.railpadding.left+k.opt.railpadding.right)});else{var r=k.getOffset();if(o={top:r.top,left:r.left-(k.opt.railpadding.left+k.opt.railpadding.right)},o.top+=y(k.win,"border-top-width",!0),o.left+=k.rail.align?k.win.outerWidth()-y(k.win,"border-right-width")-k.rail.width:y(k.win,"border-left-width"),(t=k.opt.railoffset)&&(t.top&&(o.top+=t.top),t.left&&(o.left+=t.left)),k.railslocked||k.rail.css({top:o.top,left:o.left,height:(e?e.h:k.win.innerHeight())-(k.opt.railpadding.top+k.opt.railpadding.bottom)}),k.zoom&&k.zoom.css({top:o.top+1,left:1==k.rail.align?o.left-20:o.left+k.rail.width+4}),k.railh&&!k.railslocked){o={top:r.top,left:r.left},(t=k.opt.railhoffset)&&(t.top&&(o.top+=t.top),t.left&&(o.left+=t.left));var i=k.railh.align?o.top+y(k.win,"border-top-width",!0)+k.win.innerHeight()-k.railh.height:o.top+y(k.win,"border-top-width",!0),s=o.left+y(k.win,"border-left-width");k.railh.css({top:i-(k.opt.railpadding.top+k.opt.railpadding.bottom),left:s,width:k.railh.width})}}},this.doRailClick=function(e,o,t){var r,i,s,n;k.railslocked||(k.cancelEvent(e),"pageY"in e||(e.pageX=e.clientX+l.documentElement.scrollLeft,e.pageY=e.clientY+l.documentElement.scrollTop),o?(r=t?k.doScrollLeft:k.doScrollTop)(s=t?(e.pageX-k.railh.offset().left-k.cursorwidth/2)*k.scrollratio.x:(e.pageY-k.rail.offset().top-k.cursorheight/2)*k.scrollratio.y):(r=t?k.doScrollLeftBy:k.doScrollBy,s=t?k.scroll.x:k.scroll.y,n=t?e.pageX-k.railh.offset().left:e.pageY-k.rail.offset().top,i=t?k.view.w:k.view.h,r(s>=n?i:-i)))},k.newscrolly=k.newscrollx=0,k.hasanimationframe="requestAnimationFrame"in a,k.hascancelanimationframe="cancelAnimationFrame"in a,k.hasborderbox=!1,this.init=function(){if(k.saved.css=[],C.isoperamini)return!0;if(C.isandroid&&!("hidden"in l))return!0;k.opt.emulatetouch=k.opt.emulatetouch||k.opt.touchbehavior,k.hasborderbox=a.getComputedStyle&&"border-box"===a.getComputedStyle(l.body)["box-sizing"];var e={"overflow-y":"hidden"};if((C.isie11||C.isie10)&&(e["-ms-overflow-style"]="none"),k.ishwscroll&&(this.doc.css(C.transitionstyle,C.prefixstyle+"transform 0ms ease-out"),C.transitionend&&k.bind(k.doc,C.transitionend,k.onScrollTransitionEnd,!1)),k.zindex="auto",k.ispage||"auto"!=k.opt.zindex?k.zindex=k.opt.zindex:k.zindex=w()||"auto",!k.ispage&&"auto"!=k.zindex&&k.zindex>s&&(s=k.zindex),k.isie&&0===k.zindex&&"auto"==k.opt.zindex&&(k.zindex="auto"),!k.ispage||!C.cantouch&&!C.isieold){var i=k.docscroll;k.ispage&&(i=k.haswrapper?k.win:k.doc),k.css(i,e),k.ispage&&(C.isie11||C.isie)&&k.css(n("html"),e),!C.isios||k.ispage||k.haswrapper||k.css(T,{"-webkit-overflow-scrolling":"touch"});var d=n(l.createElement("div"));d.css({position:"relative",top:0,float:"right",width:k.opt.cursorwidth,height:0,"background-color":k.opt.cursorcolor,border:k.opt.cursorborder,"background-clip":"padding-box","-webkit-border-radius":k.opt.cursorborderradius,"-moz-border-radius":k.opt.cursorborderradius,"border-radius":k.opt.cursorborderradius}),d.addClass("nicescroll-cursors"),k.cursor=d;var u=n(l.createElement("div"));u.attr("id",k.id),u.addClass("nicescroll-rails nicescroll-rails-vr");var h,m,f=["left","right","top","bottom"];for(var g in f)m=f[g],(h=k.opt.railpadding[m]||0)&&u.css("padding-"+m,h+"px");u.append(d),u.width=Math.max(parseFloat(k.opt.cursorwidth),d.outerWidth()),u.css({width:u.width+"px",zIndex:k.zindex,background:k.opt.background,cursor:"default"}),u.visibility=!0,u.scrollable=!0,u.align="left"==k.opt.railalign?0:1,k.rail=u,k.rail.drag=!1;var v=!1;!k.opt.boxzoom||k.ispage||C.isieold||(v=l.createElement("div"),k.bind(v,"click",k.doZoom),k.bind(v,"mouseenter",function(){k.zoom.css("opacity",k.opt.cursoropacitymax)}),k.bind(v,"mouseleave",function(){k.zoom.css("opacity",k.opt.cursoropacitymin)}),k.zoom=n(v),k.zoom.css({cursor:"pointer",zIndex:k.zindex,backgroundImage:"url("+k.opt.scriptpath+"zoomico.png)",height:18,width:18,backgroundPosition:"0 0"}),k.opt.dblclickzoom&&k.bind(k.win,"dblclick",k.doZoom),C.cantouch&&k.opt.gesturezoom&&(k.ongesturezoom=function(e){return e.scale>1.5&&k.doZoomIn(e),e.scale<.8&&k.doZoomOut(e),k.cancelEvent(e)},k.bind(k.win,"gestureend",k.ongesturezoom))),k.railh=!1;var y;if(k.opt.horizrailenabled&&(k.css(i,{overflowX:"hidden"}),(d=n(l.createElement("div"))).css({position:"absolute",top:0,height:k.opt.cursorwidth,width:0,backgroundColor:k.opt.cursorcolor,border:k.opt.cursorborder,backgroundClip:"padding-box","-webkit-border-radius":k.opt.cursorborderradius,"-moz-border-radius":k.opt.cursorborderradius,"border-radius":k.opt.cursorborderradius}),C.isieold&&d.css("overflow","hidden"),d.addClass("nicescroll-cursors"),k.cursorh=d,(y=n(l.createElement("div"))).attr("id",k.id+"-hr"),y.addClass("nicescroll-rails nicescroll-rails-hr"),y.height=Math.max(parseFloat(k.opt.cursorwidth),d.outerHeight()),y.css({height:y.height+"px",zIndex:k.zindex,background:k.opt.background}),y.append(d),y.visibility=!0,y.scrollable=!0,y.align="top"==k.opt.railvalign?0:1,k.railh=y,k.railh.drag=!1),k.ispage)u.css({position:"fixed",top:0,height:"100%"}),u.css(u.align?{right:0}:{left:0}),k.body.append(u),k.railh&&(y.css({position:"fixed",left:0,width:"100%"}),y.css(y.align?{bottom:0}:{top:0}),k.body.append(y));else{if(k.ishwscroll){"static"==k.win.css("position")&&k.css(k.win,{position:"relative"});var x="HTML"==k.win[0].nodeName?k.body:k.win;n(x).scrollTop(0).scrollLeft(0),k.zoom&&(k.zoom.css({position:"absolute",top:1,right:0,"margin-right":u.width+4}),x.append(k.zoom)),u.css({position:"absolute",top:0}),u.css(u.align?{right:0}:{left:0}),x.append(u),y&&(y.css({position:"absolute",left:0,bottom:0}),y.css(y.align?{bottom:0}:{top:0}),x.append(y))}else{k.isfixed="fixed"==k.win.css("position");var S=k.isfixed?"fixed":"absolute";k.isfixed||(k.viewport=k.getViewport(k.win[0])),k.viewport&&(k.body=k.viewport,/fixed|absolute/.test(k.viewport.css("position"))||k.css(k.viewport,{position:"relative"})),u.css({position:S}),k.zoom&&k.zoom.css({position:S}),k.updateScrollBar(),k.body.append(u),k.zoom&&k.body.append(k.zoom),k.railh&&(y.css({position:S}),k.body.append(y))}C.isios&&k.css(k.win,{"-webkit-tap-highlight-color":"rgba(0,0,0,0)","-webkit-touch-callout":"none"}),C.isie&&k.opt.disableoutline&&k.win.attr("hideFocus","true"),C.iswebkit&&k.opt.disableoutline&&k.win.css("outline","none")}if(!1===k.opt.autohidemode?(k.autohidedom=!1,k.rail.css({opacity:k.opt.cursoropacitymax}),k.railh&&k.railh.css({opacity:k.opt.cursoropacitymax})):!0===k.opt.autohidemode||"leave"===k.opt.autohidemode?(k.autohidedom=n().add(k.rail),C.isie8&&(k.autohidedom=k.autohidedom.add(k.cursor)),k.railh&&(k.autohidedom=k.autohidedom.add(k.railh)),k.railh&&C.isie8&&(k.autohidedom=k.autohidedom.add(k.cursorh))):"scroll"==k.opt.autohidemode?(k.autohidedom=n().add(k.rail),k.railh&&(k.autohidedom=k.autohidedom.add(k.railh))):"cursor"==k.opt.autohidemode?(k.autohidedom=n().add(k.cursor),k.railh&&(k.autohidedom=k.autohidedom.add(k.cursorh))):"hidden"==k.opt.autohidemode&&(k.autohidedom=!1,k.hide(),k.railslocked=!1),C.cantouch||k.istouchcapable||k.opt.emulatetouch||C.hasmstouch){k.scrollmom=new b(k),k.ontouchstart=function(e){if(e.pointerType&&("mouse"===e.pointerType||e.pointerType===e.MSPOINTER_TYPE_MOUSE))return!1;if(k.hasmoving=!1,!k.railslocked){var o;if(C.hasmstouch)for(o=!!e.target&&e.target;o;){var t=n(o).getNiceScroll();if(t.length>0&&t[0].me==k.me)break;if(t.length>0)return!1;if("DIV"==o.nodeName&&o.id==k.id)break;o=!!o.parentNode&&o.parentNode}if(e.stopPropagation(),k.cancelScroll(),(o=k.getTarget(e))&&/INPUT/i.test(o.nodeName)&&/range/i.test(o.type))return k.stopPropagation(e);if(!("clientX"in e)&&"changedTouches"in e&&(e.clientX=e.changedTouches[0].clientX,e.clientY=e.changedTouches[0].clientY),k.forcescreen){var r=e;(e={original:e.original?e.original:e}).clientX=r.screenX,e.clientY=r.screenY}if(k.rail.drag={x:e.clientX,y:e.clientY,sx:k.scroll.x,sy:k.scroll.y,st:k.getScrollTop(),sl:k.getScrollLeft(),pt:2,dl:!1,tg:o},k.ispage||!k.opt.directionlockdeadzone)k.rail.drag.dl="f";else{var i={w:c.width(),h:c.height()},s={w:Math.max(l.body.scrollWidth,l.documentElement.scrollWidth),h:Math.max(l.body.scrollHeight,l.documentElement.scrollHeight)},a=Math.max(0,s.h-i.h),d=Math.max(0,s.w-i.w);!k.rail.scrollable&&k.railh.scrollable?k.rail.drag.ck=a>0&&"v":k.rail.scrollable&&!k.railh.scrollable?k.rail.drag.ck=d>0&&"h":k.rail.drag.ck=!1,k.rail.drag.ck||(k.rail.drag.dl="f")}if(k.opt.emulatetouch&&k.isiframe&&C.isie){var u=k.win.position();k.rail.drag.x+=u.left,k.rail.drag.y+=u.top}if(k.hasmoving=!1,k.lastmouseup=!1,k.scrollmom.reset(e.clientX,e.clientY),!C.cantouch&&!this.istouchcapable&&!e.pointerType){if(!(!!o&&/INPUT|SELECT|BUTTON|TEXTAREA/i.test(o.nodeName)))return!k.ispage&&C.hasmousecapture&&o.setCapture(),k.opt.emulatetouch?(o.onclick&&!o._onclick&&(o._onclick=o.onclick,o.onclick=function(e){if(k.hasmoving)return!1;o._onclick.call(this,e)}),k.cancelEvent(e)):k.stopPropagation(e);/SUBMIT|CANCEL|BUTTON/i.test(n(o).attr("type"))&&(k.preventclick={tg:o,click:!1})}}},k.ontouchend=function(e){if(!k.rail.drag)return!0;if(2==k.rail.drag.pt){if(e.pointerType&&("mouse"===e.pointerType||e.pointerType===e.MSPOINTER_TYPE_MOUSE))return!1;if(k.rail.drag=!1,k.hasmoving&&(k.scrollmom.doMomentum(),k.lastmouseup=!0,k.hideCursor(),C.hasmousecapture&&l.releaseCapture(),!C.cantouch))return k.cancelEvent(e)}else if(1==k.rail.drag.pt)return k.onmouseup(e)};var z=k.opt.emulatetouch&&k.isiframe&&!C.hasmousecapture;k.ontouchmove=function(e,o){if(!k.rail.drag)return!1;if(e.targetTouches&&k.opt.preventmultitouchscrolling&&e.targetTouches.length>1)return!1;if(e.pointerType&&("mouse"===e.pointerType||e.pointerType===e.MSPOINTER_TYPE_MOUSE))return!1;if(2==k.rail.drag.pt){if("changedTouches"in e&&(e.clientX=e.changedTouches[0].clientX,e.clientY=e.changedTouches[0].clientY),k.rail.drag.y===e.clientY&&k.rail.drag.x===e.clientX)return!1;k.hasmoving||k.triggerScrollStart(e.clientX,e.clientY,0,0,0),k.hasmoving=!0,k.preventclick&&!k.preventclick.click&&(k.preventclick.click=k.preventclick.tg.onclick||!1,k.preventclick.tg.onclick=k.onpreventclick);var t,r;if(r=t=0,z&&!o){var i=k.win.position();r=-i.left,t=-i.top}var s=e.clientY+t,n=s-k.rail.drag.y,a=e.clientX+r,c=a-k.rail.drag.x,d=k.rail.drag.st-n;k.ishwscroll&&k.opt.bouncescroll?d<0?d=Math.round(d/2):d>k.page.maxh&&(d=k.page.maxh+Math.round((d-k.page.maxh)/2)):(d<0&&(d=0,s=0),d>k.page.maxh&&(d=k.page.maxh,s=0));var u;k.railh&&k.railh.scrollable&&(u=k.isrtlmode?c-k.rail.drag.sl:k.rail.drag.sl-c,k.ishwscroll&&k.opt.bouncescroll?u<0?u=Math.round(u/2):u>k.page.maxw&&(u=k.page.maxw+Math.round((u-k.page.maxw)/2)):(u<0&&(u=0,a=0),u>k.page.maxw&&(u=k.page.maxw,a=0)));var h=!1;if(k.rail.drag.dl)h=!0,"v"==k.rail.drag.dl?u=k.rail.drag.sl:"h"==k.rail.drag.dl&&(d=k.rail.drag.st);else{var p=Math.abs(n),m=Math.abs(c),f=k.opt.directionlockdeadzone;if("v"==k.rail.drag.ck){if(p>f&&m<=.3*p)return k.rail.drag=!1,!0;m>f&&(k.rail.drag.dl="f",T.scrollTop(T.scrollTop()))}else if("h"==k.rail.drag.ck){if(m>f&&p<=.3*m)return k.rail.drag=!1,!0;p>f&&(k.rail.drag.dl="f",T.scrollLeft(T.scrollLeft()))}}if(k.synched("touchmove",function(){k.rail.drag&&2==k.rail.drag.pt&&(k.prepareTransition&&k.resetTransition(),k.rail.scrollable&&k.setScrollTop(d),k.scrollmom.update(a,s),k.railh&&k.railh.scrollable?(k.setScrollLeft(u),k.showCursor(d,u)):k.showCursor(d),C.isie10&&l.selection.clear())}),C.ischrome&&k.istouchcapable&&(h=!1),h)return k.cancelEvent(e)}else if(1==k.rail.drag.pt)return k.onmousemove(e)},k.ontouchstartCursor=function(e,o){if(!k.rail.drag||3==k.rail.drag.pt){if(k.locked)return k.cancelEvent(e);k.cancelScroll(),k.rail.drag={x:e.touches[0].clientX,y:e.touches[0].clientY,sx:k.scroll.x,sy:k.scroll.y,pt:3,hr:!!o};var t=k.getTarget(e);return!k.ispage&&C.hasmousecapture&&t.setCapture(),k.isiframe&&!C.hasmousecapture&&(k.saved.csspointerevents=k.doc.css("pointer-events"),k.css(k.doc,{"pointer-events":"none"})),k.cancelEvent(e)}},k.ontouchendCursor=function(e){if(k.rail.drag){if(C.hasmousecapture&&l.releaseCapture(),k.isiframe&&!C.hasmousecapture&&k.doc.css("pointer-events",k.saved.csspointerevents),3!=k.rail.drag.pt)return;return k.rail.drag=!1,k.cancelEvent(e)}},k.ontouchmoveCursor=function(e){if(k.rail.drag){if(3!=k.rail.drag.pt)return;if(k.cursorfreezed=!0,k.rail.drag.hr){k.scroll.x=k.rail.drag.sx+(e.touches[0].clientX-k.rail.drag.x),k.scroll.x<0&&(k.scroll.x=0);var o=k.scrollvaluemaxw;k.scroll.x>o&&(k.scroll.x=o)}else{k.scroll.y=k.rail.drag.sy+(e.touches[0].clientY-k.rail.drag.y),k.scroll.y<0&&(k.scroll.y=0);var t=k.scrollvaluemax;k.scroll.y>t&&(k.scroll.y=t)}return k.synched("touchmove",function(){k.rail.drag&&3==k.rail.drag.pt&&(k.showCursor(),k.rail.drag.hr?k.doScrollLeft(Math.round(k.scroll.x*k.scrollratio.x),k.opt.cursordragspeed):k.doScrollTop(Math.round(k.scroll.y*k.scrollratio.y),k.opt.cursordragspeed))}),k.cancelEvent(e)}}}if(k.onmousedown=function(e,o){if(!k.rail.drag||1==k.rail.drag.pt){if(k.railslocked)return k.cancelEvent(e);k.cancelScroll(),k.rail.drag={x:e.clientX,y:e.clientY,sx:k.scroll.x,sy:k.scroll.y,pt:1,hr:o||!1};var t=k.getTarget(e);return C.hasmousecapture&&t.setCapture(),k.isiframe&&!C.hasmousecapture&&(k.saved.csspointerevents=k.doc.css("pointer-events"),k.css(k.doc,{"pointer-events":"none"})),k.hasmoving=!1,k.cancelEvent(e)}},k.onmouseup=function(e){if(k.rail.drag)return 1!=k.rail.drag.pt||(C.hasmousecapture&&l.releaseCapture(),k.isiframe&&!C.hasmousecapture&&k.doc.css("pointer-events",k.saved.csspointerevents),k.rail.drag=!1,k.cursorfreezed=!1,k.hasmoving&&k.triggerScrollEnd(),k.cancelEvent(e))},k.onmousemove=function(e){if(k.rail.drag){if(1!==k.rail.drag.pt)return;if(C.ischrome&&0===e.which)return k.onmouseup(e);if(k.cursorfreezed=!0,k.hasmoving||k.triggerScrollStart(e.clientX,e.clientY,0,0,0),k.hasmoving=!0,k.rail.drag.hr){k.scroll.x=k.rail.drag.sx+(e.clientX-k.rail.drag.x),k.scroll.x<0&&(k.scroll.x=0);var o=k.scrollvaluemaxw;k.scroll.x>o&&(k.scroll.x=o)}else{k.scroll.y=k.rail.drag.sy+(e.clientY-k.rail.drag.y),k.scroll.y<0&&(k.scroll.y=0);var t=k.scrollvaluemax;k.scroll.y>t&&(k.scroll.y=t)}return k.synched("mousemove",function(){k.cursorfreezed&&(k.showCursor(),k.rail.drag.hr?k.scrollLeft(Math.round(k.scroll.x*k.scrollratio.x)):k.scrollTop(Math.round(k.scroll.y*k.scrollratio.y)))}),k.cancelEvent(e)}k.checkarea=0},C.cantouch||k.opt.emulatetouch)k.onpreventclick=function(e){if(k.preventclick)return k.preventclick.tg.onclick=k.preventclick.click,k.preventclick=!1,k.cancelEvent(e)},k.onclick=!C.isios&&function(e){return!k.lastmouseup||(k.lastmouseup=!1,k.cancelEvent(e))},k.opt.grabcursorenabled&&C.cursorgrabvalue&&(k.css(k.ispage?k.doc:k.win,{cursor:C.cursorgrabvalue}),k.css(k.rail,{cursor:C.cursorgrabvalue}));else{var E=function(e){if(k.selectiondrag){if(e){var o=k.win.outerHeight(),t=e.pageY-k.selectiondrag.top;t>0&&t=o&&(t-=o),k.selectiondrag.df=t}if(0!==k.selectiondrag.df){var r=2*-Math.floor(k.selectiondrag.df/6);k.doScrollBy(r),k.debounced("doselectionscroll",function(){E()},50)}}};k.hasTextSelected="getSelection"in l?function(){return l.getSelection().rangeCount>0}:"selection"in l?function(){return"None"!=l.selection.type}:function(){return!1},k.onselectionstart=function(e){k.ispage||(k.selectiondrag=k.win.offset())},k.onselectionend=function(e){k.selectiondrag=!1},k.onselectiondrag=function(e){k.selectiondrag&&k.hasTextSelected()&&k.debounced("selectionscroll",function(){E(e)},250)}}if(C.hasw3ctouch?(k.css(k.ispage?n("html"):k.win,{"touch-action":"none"}),k.css(k.rail,{"touch-action":"none"}),k.css(k.cursor,{"touch-action":"none"}),k.bind(k.win,"pointerdown",k.ontouchstart),k.bind(l,"pointerup",k.ontouchend),k.bind(l,"pointermove",k.ontouchmove)):C.hasmstouch?(k.css(k.ispage?n("html"):k.win,{"-ms-touch-action":"none"}),k.css(k.rail,{"-ms-touch-action":"none"}),k.css(k.cursor,{"-ms-touch-action":"none"}),k.bind(k.win,"MSPointerDown",k.ontouchstart),k.bind(l,"MSPointerUp",k.ontouchend),k.bind(l,"MSPointerMove",k.ontouchmove),k.bind(k.cursor,"MSGestureHold",function(e){e.preventDefault()}),k.bind(k.cursor,"contextmenu",function(e){e.preventDefault()})):C.cantouch&&(k.bind(k.win,"touchstart",k.ontouchstart,!1,!0),k.bind(l,"touchend",k.ontouchend,!1,!0),k.bind(l,"touchcancel",k.ontouchend,!1,!0),k.bind(l,"touchmove",k.ontouchmove,!1,!0)),k.opt.emulatetouch&&(k.bind(k.win,"mousedown",k.ontouchstart,!1,!0),k.bind(l,"mouseup",k.ontouchend,!1,!0),k.bind(l,"mousemove",k.ontouchmove,!1,!0)),(k.opt.cursordragontouch||!C.cantouch&&!k.opt.emulatetouch)&&(k.rail.css({cursor:"default"}),k.railh&&k.railh.css({cursor:"default"}),k.jqbind(k.rail,"mouseenter",function(){if(!k.ispage&&!k.win.is(":visible"))return!1;k.canshowonmouseevent&&k.showCursor(),k.rail.active=!0}),k.jqbind(k.rail,"mouseleave",function(){k.rail.active=!1,k.rail.drag||k.hideCursor()}),k.opt.sensitiverail&&(k.bind(k.rail,"click",function(e){k.doRailClick(e,!1,!1)}),k.bind(k.rail,"dblclick",function(e){k.doRailClick(e,!0,!1)}),k.bind(k.cursor,"click",function(e){k.cancelEvent(e)}),k.bind(k.cursor,"dblclick",function(e){k.cancelEvent(e)})),k.railh&&(k.jqbind(k.railh,"mouseenter",function(){if(!k.ispage&&!k.win.is(":visible"))return!1;k.canshowonmouseevent&&k.showCursor(),k.rail.active=!0}),k.jqbind(k.railh,"mouseleave",function(){k.rail.active=!1,k.rail.drag||k.hideCursor()}),k.opt.sensitiverail&&(k.bind(k.railh,"click",function(e){k.doRailClick(e,!1,!0)}),k.bind(k.railh,"dblclick",function(e){k.doRailClick(e,!0,!0)}),k.bind(k.cursorh,"click",function(e){k.cancelEvent(e)}),k.bind(k.cursorh,"dblclick",function(e){k.cancelEvent(e)})))),k.opt.cursordragontouch&&(this.istouchcapable||C.cantouch)&&(k.bind(k.cursor,"touchstart",k.ontouchstartCursor),k.bind(k.cursor,"touchmove",k.ontouchmoveCursor),k.bind(k.cursor,"touchend",k.ontouchendCursor),k.cursorh&&k.bind(k.cursorh,"touchstart",function(e){k.ontouchstartCursor(e,!0)}),k.cursorh&&k.bind(k.cursorh,"touchmove",k.ontouchmoveCursor),k.cursorh&&k.bind(k.cursorh,"touchend",k.ontouchendCursor)),C.cantouch||k.opt.emulatetouch?(k.bind(C.hasmousecapture?k.win:l,"mouseup",k.ontouchend),k.onclick&&k.bind(l,"click",k.onclick),k.opt.cursordragontouch?(k.bind(k.cursor,"mousedown",k.onmousedown),k.bind(k.cursor,"mouseup",k.onmouseup),k.cursorh&&k.bind(k.cursorh,"mousedown",function(e){k.onmousedown(e,!0)}),k.cursorh&&k.bind(k.cursorh,"mouseup",k.onmouseup)):(k.bind(k.rail,"mousedown",function(e){e.preventDefault()}),k.railh&&k.bind(k.railh,"mousedown",function(e){e.preventDefault()}))):(k.bind(C.hasmousecapture?k.win:l,"mouseup",k.onmouseup),k.bind(l,"mousemove",k.onmousemove),k.onclick&&k.bind(l,"click",k.onclick),k.bind(k.cursor,"mousedown",k.onmousedown),k.bind(k.cursor,"mouseup",k.onmouseup),k.railh&&(k.bind(k.cursorh,"mousedown",function(e){k.onmousedown(e,!0)}),k.bind(k.cursorh,"mouseup",k.onmouseup)),!k.ispage&&k.opt.enablescrollonselection&&(k.bind(k.win[0],"mousedown",k.onselectionstart),k.bind(l,"mouseup",k.onselectionend),k.bind(k.cursor,"mouseup",k.onselectionend),k.cursorh&&k.bind(k.cursorh,"mouseup",k.onselectionend),k.bind(l,"mousemove",k.onselectiondrag)),k.zoom&&(k.jqbind(k.zoom,"mouseenter",function(){k.canshowonmouseevent&&k.showCursor(),k.rail.active=!0}),k.jqbind(k.zoom,"mouseleave",function(){k.rail.active=!1,k.rail.drag||k.hideCursor()}))),k.opt.enablemousewheel&&(k.isiframe||k.mousewheel(C.isie&&k.ispage?l:k.win,k.onmousewheel),k.mousewheel(k.rail,k.onmousewheel),k.railh&&k.mousewheel(k.railh,k.onmousewheelhr)),k.ispage||C.cantouch||/HTML|^BODY/.test(k.win[0].nodeName)||(k.win.attr("tabindex")||k.win.attr({tabindex:++r}),k.bind(k.win,"focus",function(e){o=k.getTarget(e).id||k.getTarget(e)||!1,k.hasfocus=!0,k.canshowonmouseevent&&k.noticeCursor()}),k.bind(k.win,"blur",function(e){o=!1,k.hasfocus=!1}),k.bind(k.win,"mouseenter",function(e){t=k.getTarget(e).id||k.getTarget(e)||!1,k.hasmousefocus=!0,k.canshowonmouseevent&&k.noticeCursor()}),k.bind(k.win,"mouseleave",function(e){t=!1,k.hasmousefocus=!1,k.rail.drag||k.hideCursor()})),k.onkeypress=function(e){if(k.railslocked&&0===k.page.maxh)return!0;e=e||a.event;var r=k.getTarget(e);if(r&&/INPUT|TEXTAREA|SELECT|OPTION/.test(r.nodeName)&&(!(r.getAttribute("type")||r.type||!1)||!/submit|button|cancel/i.tp))return!0;if(n(r).attr("contenteditable"))return!0;if(k.hasfocus||k.hasmousefocus&&!o||k.ispage&&!o&&!t){var i=e.keyCode;if(k.railslocked&&27!=i)return k.cancelEvent(e);var s=e.ctrlKey||!1,l=e.shiftKey||!1,c=!1;switch(i){case 38:case 63233:k.doScrollBy(72),c=!0;break;case 40:case 63235:k.doScrollBy(-72),c=!0;break;case 37:case 63232:k.railh&&(s?k.doScrollLeft(0):k.doScrollLeftBy(72),c=!0);break;case 39:case 63234:k.railh&&(s?k.doScrollLeft(k.page.maxw):k.doScrollLeftBy(-72),c=!0);break;case 33:case 63276:k.doScrollBy(k.view.h),c=!0;break;case 34:case 63277:k.doScrollBy(-k.view.h),c=!0;break;case 36:case 63273:k.railh&&s?k.doScrollPos(0,0):k.doScrollTo(0),c=!0;break;case 35:case 63275:k.railh&&s?k.doScrollPos(k.page.maxw,k.page.maxh):k.doScrollTo(k.page.maxh),c=!0;break;case 32:k.opt.spacebarenabled&&(l?k.doScrollBy(k.view.h):k.doScrollBy(-k.view.h),c=!0);break;case 27:k.zoomactive&&(k.doZoom(),c=!0)}if(c)return k.cancelEvent(e)}},k.opt.enablekeyboard&&k.bind(l,C.isopera&&!C.isopera12?"keypress":"keydown",k.onkeypress),k.bind(l,"keydown",function(e){(e.ctrlKey||!1)&&(k.wheelprevented=!0)}),k.bind(l,"keyup",function(e){e.ctrlKey||!1||(k.wheelprevented=!1)}),k.bind(a,"blur",function(e){k.wheelprevented=!1}),k.bind(a,"resize",k.lazyResize),k.bind(a,"orientationchange",k.lazyResize),k.bind(a,"load",k.lazyResize),C.ischrome&&!k.ispage&&!k.haswrapper){var M=k.win.attr("style"),L=parseFloat(k.win.css("width"))+1;k.win.css("width",L),k.synched("chromefix",function(){k.win.attr("style",M)})}k.onAttributeChange=function(e){k.lazyResize(k.isieold?250:30)},k.opt.enableobserver&&(k.isie11||!1===p||(k.observerbody=new p(function(e){if(e.forEach(function(e){if("attributes"==e.type)return T.hasClass("modal-open")&&T.hasClass("modal-dialog")&&!n.contains(n(".modal-dialog")[0],k.doc[0])?k.hide():k.show()}),k.me.clientWidth!=k.page.width||k.me.clientHeight!=k.page.height)return k.lazyResize(30)}),k.observerbody.observe(l.body,{childList:!0,subtree:!0,characterData:!1,attributes:!0,attributeFilter:["class"]})),k.ispage||k.haswrapper||(!1!==p?(k.observer=new p(function(e){e.forEach(k.onAttributeChange)}),k.observer.observe(k.win[0],{childList:!0,characterData:!1,attributes:!0,subtree:!1}),k.observerremover=new p(function(e){e.forEach(function(e){if(e.removedNodes.length>0)for(var o in e.removedNodes)if(k&&e.removedNodes[o]==k.win[0])return k.remove()})}),k.observerremover.observe(k.win[0].parentNode,{childList:!0,characterData:!1,attributes:!1,subtree:!1})):(k.bind(k.win,C.isie&&!C.isie9?"propertychange":"DOMAttrModified",k.onAttributeChange),C.isie9&&k.win[0].attachEvent("onpropertychange",k.onAttributeChange),k.bind(k.win,"DOMNodeRemoved",function(e){e.target==k.win[0]&&k.remove()})))),!k.ispage&&k.opt.boxzoom&&k.bind(a,"resize",k.resizeZoom),k.istextarea&&(k.bind(k.win,"keydown",k.lazyResize),k.bind(k.win,"mouseup",k.lazyResize)),k.lazyResize(30)}if("IFRAME"==this.doc[0].nodeName){var N=function(){k.iframexd=!1;var o;try{(o="contentDocument"in this?this.contentDocument:this.contentWindow._doc).domain}catch(e){k.iframexd=!0,o=!1}if(k.iframexd)return"console"in a&&console.log("NiceScroll error: policy restriced iframe"),!0;if(k.forcescreen=!0,k.isiframe&&(k.iframe={doc:n(o),html:k.doc.contents().find("html")[0],body:k.doc.contents().find("body")[0]},k.getContentSize=function(){return{w:Math.max(k.iframe.html.scrollWidth,k.iframe.body.scrollWidth),h:Math.max(k.iframe.html.scrollHeight,k.iframe.body.scrollHeight)}},k.docscroll=n(k.iframe.body)),!C.isios&&k.opt.iframeautoresize&&!k.isiframe){k.win.scrollTop(0),k.doc.height("");var t=Math.max(o.getElementsByTagName("html")[0].scrollHeight,o.body.scrollHeight);k.doc.height(t)}k.lazyResize(30),k.css(n(k.iframe.body),e),C.isios&&k.haswrapper&&k.css(n(o.body),{"-webkit-transform":"translate3d(0,0,0)"}),"contentWindow"in this?k.bind(this.contentWindow,"scroll",k.onscroll):k.bind(o,"scroll",k.onscroll),k.opt.enablemousewheel&&k.mousewheel(o,k.onmousewheel),k.opt.enablekeyboard&&k.bind(o,C.isopera?"keypress":"keydown",k.onkeypress),C.cantouch?(k.bind(o,"touchstart",k.ontouchstart),k.bind(o,"touchmove",k.ontouchmove)):k.opt.emulatetouch&&(k.bind(o,"mousedown",k.ontouchstart),k.bind(o,"mousemove",function(e){return k.ontouchmove(e,!0)}),k.opt.grabcursorenabled&&C.cursorgrabvalue&&k.css(n(o.body),{cursor:C.cursorgrabvalue})),k.bind(o,"mouseup",k.ontouchend),k.zoom&&(k.opt.dblclickzoom&&k.bind(o,"dblclick",k.doZoom),k.ongesturezoom&&k.bind(o,"gestureend",k.ongesturezoom))};this.doc[0].readyState&&"complete"===this.doc[0].readyState&&setTimeout(function(){N.call(k.doc[0],!1)},500),k.bind(this.doc,"load",N)}},this.showCursor=function(e,o){if(k.cursortimeout&&(clearTimeout(k.cursortimeout),k.cursortimeout=0),k.rail){if(k.autohidedom&&(k.autohidedom.stop().css({opacity:k.opt.cursoropacitymax}),k.cursoractive=!0),k.rail.drag&&1==k.rail.drag.pt||(void 0!==e&&!1!==e&&(k.scroll.y=e/k.scrollratio.y|0),void 0!==o&&(k.scroll.x=o/k.scrollratio.x|0)),k.cursor.css({height:k.cursorheight,top:k.scroll.y}),k.cursorh){var t=k.hasreversehr?k.scrollvaluemaxw-k.scroll.x:k.scroll.x;k.cursorh.css({width:k.cursorwidth,left:!k.rail.align&&k.rail.visibility?t+k.rail.width:t}),k.cursoractive=!0}k.zoom&&k.zoom.stop().css({opacity:k.opt.cursoropacitymax})}},this.hideCursor=function(e){k.cursortimeout||k.rail&&k.autohidedom&&(k.hasmousefocus&&"leave"===k.opt.autohidemode||(k.cursortimeout=setTimeout(function(){k.rail.active&&k.showonmouseevent||(k.autohidedom.stop().animate({opacity:k.opt.cursoropacitymin}),k.zoom&&k.zoom.stop().animate({opacity:k.opt.cursoropacitymin}),k.cursoractive=!1),k.cursortimeout=0},e||k.opt.hidecursordelay)))},this.noticeCursor=function(e,o,t){k.showCursor(o,t),k.rail.active||k.hideCursor(e)},this.getContentSize=k.ispage?function(){return{w:Math.max(l.body.scrollWidth,l.documentElement.scrollWidth),h:Math.max(l.body.scrollHeight,l.documentElement.scrollHeight)}}:k.haswrapper?function(){return{w:k.doc[0].offsetWidth,h:k.doc[0].offsetHeight}}:function(){return{w:k.docscroll[0].scrollWidth,h:k.docscroll[0].scrollHeight}},this.onResize=function(e,o){if(!k||!k.win)return!1;var t=k.page.maxh,r=k.page.maxw,i={h:k.view.h,w:k.view.w};if(k.view={w:k.ispage?k.win.width():k.win[0].clientWidth,h:k.ispage?k.win.height():k.win[0].clientHeight},k.page=o||k.getContentSize(),k.page.maxh=Math.max(0,k.page.h-k.view.h),k.page.maxw=Math.max(0,k.page.w-k.view.w),k.page.maxh==t&&k.page.maxw==r&&k.view.w==i.w&&k.view.h==i.h){if(k.ispage)return k;var s=k.win.offset();if(k.lastposition){var n=k.lastposition;if(n.top==s.top&&n.left==s.left)return k}k.lastposition=s}return 0===k.page.maxh?(k.hideRail(),k.scrollvaluemax=0,k.scroll.y=0,k.scrollratio.y=0,k.cursorheight=0,k.setScrollTop(0),k.rail&&(k.rail.scrollable=!1)):(k.page.maxh-=k.opt.railpadding.top+k.opt.railpadding.bottom,k.rail.scrollable=!0),0===k.page.maxw?(k.hideRailHr(),k.scrollvaluemaxw=0,k.scroll.x=0,k.scrollratio.x=0,k.cursorwidth=0,k.setScrollLeft(0),k.railh&&(k.railh.scrollable=!1)):(k.page.maxw-=k.opt.railpadding.left+k.opt.railpadding.right,k.railh&&(k.railh.scrollable=k.opt.horizrailenabled)),k.railslocked=k.locked||0===k.page.maxh&&0===k.page.maxw,k.railslocked?(k.ispage||k.updateScrollBar(k.view),!1):(k.hidden||k.visibility?!k.railh||k.hidden||k.railh.visibility||k.showRailHr():k.showRail().showRailHr(),k.istextarea&&k.win.css("resize")&&"none"!=k.win.css("resize")&&(k.view.h-=20),k.cursorheight=Math.min(k.view.h,Math.round(k.view.h*(k.view.h/k.page.h))),k.cursorheight=k.opt.cursorfixedheight?k.opt.cursorfixedheight:Math.max(k.opt.cursorminheight,k.cursorheight),k.cursorwidth=Math.min(k.view.w,Math.round(k.view.w*(k.view.w/k.page.w))),k.cursorwidth=k.opt.cursorfixedheight?k.opt.cursorfixedheight:Math.max(k.opt.cursorminheight,k.cursorwidth),k.scrollvaluemax=k.view.h-k.cursorheight-(k.opt.railpadding.top+k.opt.railpadding.bottom),k.hasborderbox||(k.scrollvaluemax-=k.cursor[0].offsetHeight-k.cursor[0].clientHeight),k.railh&&(k.railh.width=k.page.maxh>0?k.view.w-k.rail.width:k.view.w,k.scrollvaluemaxw=k.railh.width-k.cursorwidth-(k.opt.railpadding.left+k.opt.railpadding.right)),k.ispage||k.updateScrollBar(k.view),k.scrollratio={x:k.page.maxw/k.scrollvaluemaxw,y:k.page.maxh/k.scrollvaluemax},k.getScrollTop()>k.page.maxh?k.doScrollTop(k.page.maxh):(k.scroll.y=k.getScrollTop()/k.scrollratio.y|0,k.scroll.x=k.getScrollLeft()/k.scrollratio.x|0,k.cursoractive&&k.noticeCursor()),k.scroll.y&&0===k.getScrollTop()&&k.doScrollTo(Math.floor(k.scroll.y*k.scrollratio.y)),k)},this.resize=k.onResize,this.hlazyresize=0,this.lazyResize=function(e){return k.haswrapper||k.ispage||k.hide(),k.hlazyresize&&clearTimeout(k.hlazyresize),k.hlazyresize=setTimeout(function(){k&&(k.haswrapper||k.ispage||k.show(),k.resize())},240),k},this.jqbind=function(e,o,t){k.events.push({e:e,n:o,f:t,q:!0}),n(e).on(o,t)},this.mousewheel=function(e,o,t){var r="jquery"in e?e[0]:e;if("onwheel"in l.createElement("div"))k._bind(r,"wheel",o,t||!1);else{var i=void 0!==l.onmousewheel?"mousewheel":"DOMMouseScroll";x(r,i,o,t||!1),"DOMMouseScroll"==i&&x(r,"MozMousePixelScroll",o,t||!1)}};var _=!1;if(C.haseventlistener){try{var H=Object.defineProperty({},"passive",{get:function(){_=!0}});a.addEventListener("test",null,H)}catch(e){}this.cancelEvent=function(e){return!!e&&((e=e.original?e.original:e).cancelable&&e.preventDefault(),e.stopPropagation(),e.preventManipulation&&e.preventManipulation(),!1)},this.stopPropagation=function(e){return!!e&&((e=e.original?e.original:e).stopPropagation(),!1)}}else Event.prototype.preventDefault=function(){this.returnValue=!1},Event.prototype.stopPropagation=function(){this.cancelBubble=!0},a.constructor.prototype.addEventListener=l.constructor.prototype.addEventListener=Element.prototype.addEventListener=function(e,o,t){this.attachEvent("on"+e,o)},a.constructor.prototype.removeEventListener=l.constructor.prototype.removeEventListener=Element.prototype.removeEventListener=function(e,o,t){this.detachEvent("on"+e,o)},this.cancelEvent=function(e){return!!(e=e||a.event)&&(e.cancelBubble=!0,e.cancel=!0,e.returnValue=!1,!1)},this.stopPropagation=function(e){return(e=e||a.event)&&(e.cancelBubble=!0),!1};this.bind=function(e,o,t,r,i){var s="jquery"in e?e[0]:e;k._bind(s,o,t,r||!1,i||!1)},this._bind=function(e,o,t,r,i){k.events.push({e:e,n:o,f:t,b:r,q:!1}),_&&i?e.addEventListener(o,t,{passive:!1,capture:r}):e.addEventListener(o,t,r||!1)},this._unbind=function(e,o,t,r){e.removeEventListener(o,t,r)},this.unbindAll=function(){for(var e=0;e0)return t;o=!!o.parentNode&&o.parentNode}return!1},this.triggerScrollStart=function(e,o,t,r,i){if(k.onscrollstart){var s={type:"scrollstart",current:{x:e,y:o},request:{x:t,y:r},end:{x:k.newscrollx,y:k.newscrolly},speed:i};k.onscrollstart.call(k,s)}},this.triggerScrollEnd=function(){if(k.onscrollend){var e=k.getScrollLeft(),o=k.getScrollTop(),t={type:"scrollend",current:{x:e,y:o},end:{x:e,y:o}};k.onscrollend.call(k,t)}};var I=0,O=0,Y=0,B=1,X=!1;if(this.onmousewheel=function(e){if(!k.wheelprevented){if(k.railslocked)return k.debounced("checkunlock",k.resize,250),!0;if(k.rail.drag)return k.cancelEvent(e);if("auto"===k.opt.oneaxismousemode&&0!==e.deltaX&&(k.opt.oneaxismousemode=!1),k.opt.oneaxismousemode&&0===e.deltaX&&!k.rail.scrollable)return!k.railh||!k.railh.scrollable||k.onmousewheelhr(e);var o=m(),t=!1;if(k.opt.preservenativescrolling&&k.checkarea+600k.page.maxh&&(o=k.page.maxh+(o-k.page.maxh)/2|0),e<0?e=e/2|0:e>k.page.maxw&&(e=k.page.maxw+(o-k.page.maxw)/2|0)):(o<0?o=0:o>k.page.maxh&&(o=k.page.maxh),e<0?e=0:e>k.page.maxw&&(e=k.page.maxw)),k.scrollrunning&&e==k.newscrollx&&o==k.newscrolly)return!1;k.newscrolly=o,k.newscrollx=e;var s=k.getScrollTop(),n=k.getScrollLeft(),l={};l.x=e-n,l.y=o-s;var a=0|Math.sqrt(l.x*l.x+l.y*l.y),c=k.prepareTransition(a);k.scrollrunning||(k.scrollrunning=!0,k.triggerScrollStart(n,s,e,o,c),k.cursorupdate.start()),k.scrollendtrapped=!0,C.transitionend||(k.scrollendtrapped&&clearTimeout(k.scrollendtrapped),k.scrollendtrapped=setTimeout(k.onScrollTransitionEnd,c)),k.setScrollTop(k.newscrolly),k.setScrollLeft(k.newscrollx)},this.cancelScroll=function(){if(!k.scrollendtrapped)return!0;var e=k.getScrollTop(),o=k.getScrollLeft();return k.scrollrunning=!1,C.transitionend||clearTimeout(C.transitionend),k.scrollendtrapped=!1,k.resetTransition(),k.setScrollTop(e),k.railh&&k.setScrollLeft(o),k.timerscroll&&k.timerscroll.tm&&clearInterval(k.timerscroll.tm),k.timerscroll=!1,k.cursorfreezed=!1,k.cursorupdate.stop(),k.showCursor(e,o),k},this.onScrollTransitionEnd=function(){if(k.scrollendtrapped){var e=k.getScrollTop(),o=k.getScrollLeft();if(e<0?e=0:e>k.page.maxh&&(e=k.page.maxh),o<0?o=0:o>k.page.maxw&&(o=k.page.maxw),e!=k.newscrolly||o!=k.newscrollx)return k.doScrollPos(o,e,k.opt.snapbackspeed);k.scrollrunning&&k.triggerScrollEnd(),k.scrollrunning=!1,k.scrollendtrapped=!1,k.resetTransition(),k.timerscroll=!1,k.setScrollTop(e),k.railh&&k.setScrollLeft(o),k.cursorupdate.stop(),k.noticeCursor(!1,e,o),k.cursorfreezed=!1}}}else this.doScrollLeft=function(e,o){var t=k.scrollrunning?k.newscrolly:k.getScrollTop();k.doScrollPos(e,t,o)},this.doScrollTop=function(e,o){var t=k.scrollrunning?k.newscrollx:k.getScrollLeft();k.doScrollPos(t,e,o)},this.doScrollPos=function(e,o,t){var r=k.getScrollTop(),i=k.getScrollLeft();((k.newscrolly-r)*(o-r)<0||(k.newscrollx-i)*(e-i)<0)&&k.cancelScroll();var s=!1;if(k.bouncescroll&&k.rail.visibility||(o<0?(o=0,s=!0):o>k.page.maxh&&(o=k.page.maxh,s=!0)),k.bouncescroll&&k.railh.visibility||(e<0?(e=0,s=!0):e>k.page.maxw&&(e=k.page.maxw,s=!0)),k.scrollrunning&&k.newscrolly===o&&k.newscrollx===e)return!0;k.newscrolly=o,k.newscrollx=e,k.dst={},k.dst.x=e-i,k.dst.y=o-r,k.dst.px=i,k.dst.py=r;var n=0|Math.sqrt(k.dst.x*k.dst.x+k.dst.y*k.dst.y),l=k.getTransitionSpeed(n);k.bzscroll={};var a=s?1:.58;k.bzscroll.x=new N(i,k.newscrollx,l,0,0,a,1),k.bzscroll.y=new N(r,k.newscrolly,l,0,0,a,1);var c=function(){if(k.scrollrunning){var e=k.bzscroll.y.getPos();k.setScrollLeft(k.bzscroll.x.getNow()),k.setScrollTop(k.bzscroll.y.getNow()),e<=1?d(c):(k.scrollrunning=!1,k.timer=0,k.triggerScrollEnd())}};k.scrollrunning||(k.triggerScrollStart(i,r,e,o,l),k.scrollrunning=!0,k.timer=d(c))},this.cancelScroll=function(){return k.timer&&u(k.timer),k.timer=0,k.bzscroll=!1,k.scrollrunning=!1,k};else this.doScrollLeft=function(e,o){var t=k.getScrollTop();k.doScrollPos(e,t,o)},this.doScrollTop=function(e,o){var t=k.getScrollLeft();k.doScrollPos(t,e,o)},this.doScrollPos=function(e,o,t){var r=e>k.page.maxw?k.page.maxw:e;r<0&&(r=0);var i=o>k.page.maxh?k.page.maxh:o;i<0&&(i=0),k.synched("scroll",function(){k.setScrollTop(i),k.setScrollLeft(r)})},this.cancelScroll=function(){};this.doScrollBy=function(e,o){S(0,e)},this.doScrollLeftBy=function(e,o){S(e,0)},this.doScrollTo=function(e,o){var t=o?Math.round(e*k.scrollratio.y):e;t<0?t=0:t>k.page.maxh&&(t=k.page.maxh),k.cursorfreezed=!1,k.doScrollTop(e)},this.checkContentSize=function(){var e=k.getContentSize();e.h==k.page.h&&e.w==k.page.w||k.resize(!1,e)},k.onscroll=function(e){k.rail.drag||k.cursorfreezed||k.synched("scroll",function(){k.scroll.y=Math.round(k.getScrollTop()/k.scrollratio.y),k.railh&&(k.scroll.x=Math.round(k.getScrollLeft()/k.scrollratio.x)),k.noticeCursor()})},k.bind(k.docscroll,"scroll",k.onscroll),this.doZoomIn=function(e){if(!k.zoomactive){k.zoomactive=!0,k.zoomrestore={style:{}};var o=["position","top","left","zIndex","backgroundColor","marginTop","marginBottom","marginLeft","marginRight"],t=k.win[0].style;for(var r in o){var i=o[r];k.zoomrestore.style[i]=void 0!==t[i]?t[i]:""}k.zoomrestore.style.width=k.win.css("width"),k.zoomrestore.style.height=k.win.css("height"),k.zoomrestore.padding={w:k.win.outerWidth()-k.win.width(),h:k.win.outerHeight()-k.win.height()},C.isios4&&(k.zoomrestore.scrollTop=c.scrollTop(),c.scrollTop(0)),k.win.css({position:C.isios4?"absolute":"fixed",top:0,left:0,zIndex:s+100,margin:0});var n=k.win.css("backgroundColor");return(""===n||/transparent|rgba\(0, 0, 0, 0\)|rgba\(0,0,0,0\)/.test(n))&&k.win.css("backgroundColor","#fff"),k.rail.css({zIndex:s+101}),k.zoom.css({zIndex:s+102}),k.zoom.css("backgroundPosition","0 -18px"),k.resizeZoom(),k.onzoomin&&k.onzoomin.call(k),k.cancelEvent(e)}},this.doZoomOut=function(e){if(k.zoomactive)return k.zoomactive=!1,k.win.css("margin",""),k.win.css(k.zoomrestore.style),C.isios4&&c.scrollTop(k.zoomrestore.scrollTop),k.rail.css({"z-index":k.zindex}),k.zoom.css({"z-index":k.zindex}),k.zoomrestore=!1,k.zoom.css("backgroundPosition","0 0"),k.onResize(),k.onzoomout&&k.onzoomout.call(k),k.cancelEvent(e)},this.doZoom=function(e){return k.zoomactive?k.doZoomOut(e):k.doZoomIn(e)},this.resizeZoom=function(){if(k.zoomactive){var e=k.getScrollTop();k.win.css({width:c.width()-k.zoomrestore.padding.w+"px",height:c.height()-k.zoomrestore.padding.h+"px"}),k.onResize(),k.setScrollTop(Math.min(k.page.maxh,e))}},this.init(),n.nicescroll.push(this)},b=function(e){var o=this;this.nc=e,this.lastx=0,this.lasty=0,this.speedx=0,this.speedy=0,this.lasttime=0,this.steptime=0,this.snapx=!1,this.snapy=!1,this.demulx=0,this.demuly=0,this.lastscrollx=-1,this.lastscrolly=-1,this.chkx=0,this.chky=0,this.timer=0,this.reset=function(e,t){o.stop(),o.steptime=0,o.lasttime=m(),o.speedx=0,o.speedy=0,o.lastx=e,o.lasty=t,o.lastscrollx=-1,o.lastscrolly=-1},this.update=function(e,t){var r=m();o.steptime=r-o.lasttime,o.lasttime=r;var i=t-o.lasty,s=e-o.lastx,n=o.nc.getScrollTop()+i,l=o.nc.getScrollLeft()+s;o.snapx=l<0||l>o.nc.page.maxw,o.snapy=n<0||n>o.nc.page.maxh,o.speedx=s,o.speedy=i,o.lastx=e,o.lasty=t},this.stop=function(){o.nc.unsynched("domomentum2d"),o.timer&&clearTimeout(o.timer),o.timer=0,o.lastscrollx=-1,o.lastscrolly=-1},this.doSnapy=function(e,t){var r=!1;t<0?(t=0,r=!0):t>o.nc.page.maxh&&(t=o.nc.page.maxh,r=!0),e<0?(e=0,r=!0):e>o.nc.page.maxw&&(e=o.nc.page.maxw,r=!0),r?o.nc.doScrollPos(e,t,o.nc.opt.snapbackspeed):o.nc.triggerScrollEnd()},this.doMomentum=function(e){var t=m(),r=e?t+e:o.lasttime,i=o.nc.getScrollLeft(),s=o.nc.getScrollTop(),n=o.nc.page.maxh,l=o.nc.page.maxw;o.speedx=l>0?Math.min(60,o.speedx):0,o.speedy=n>0?Math.min(60,o.speedy):0;var a=r&&t-r<=60;(s<0||s>n||i<0||i>l)&&(a=!1);var c=!(!o.speedy||!a)&&o.speedy,d=!(!o.speedx||!a)&&o.speedx;if(c||d){var u=Math.max(16,o.steptime);if(u>50){var h=u/50;o.speedx*=h,o.speedy*=h,u=50}o.demulxy=0,o.lastscrollx=o.nc.getScrollLeft(),o.chkx=o.lastscrollx,o.lastscrolly=o.nc.getScrollTop(),o.chky=o.lastscrolly;var p=o.lastscrollx,f=o.lastscrolly,g=function(){var e=m()-t>600?.04:.02;o.speedx&&(p=Math.floor(o.lastscrollx-o.speedx*(1-o.demulxy)),o.lastscrollx=p,(p<0||p>l)&&(e=.1)),o.speedy&&(f=Math.floor(o.lastscrolly-o.speedy*(1-o.demulxy)),o.lastscrolly=f,(f<0||f>n)&&(e=.1)),o.demulxy=Math.min(1,o.demulxy+e),o.nc.synched("domomentum2d",function(){if(o.speedx){o.nc.getScrollLeft();o.chkx=p,o.nc.setScrollLeft(p)}if(o.speedy){o.nc.getScrollTop();o.chky=f,o.nc.setScrollTop(f)}o.timer||(o.nc.hideCursor(),o.doSnapy(p,f))}),o.demulxy<1?o.timer=setTimeout(g,u):(o.stop(),o.nc.hideCursor(),o.doSnapy(p,f))};g()}else o.doSnapy(o.nc.getScrollLeft(),o.nc.getScrollTop())}},y=e.fn.scrollTop;e.cssHooks.pageYOffset={get:function(e,o,t){var r=n.data(e,"__nicescroll")||!1;return r&&r.ishwscroll?r.getScrollTop():y.call(e)},set:function(e,o){var t=n.data(e,"__nicescroll")||!1;return t&&t.ishwscroll?t.setScrollTop(parseInt(o)):y.call(e,o),this}},e.fn.scrollTop=function(e){if(void 0===e){var o=!!this[0]&&(n.data(this[0],"__nicescroll")||!1);return o&&o.ishwscroll?o.getScrollTop():y.call(this)}return this.each(function(){var o=n.data(this,"__nicescroll")||!1;o&&o.ishwscroll?o.setScrollTop(parseInt(e)):y.call(n(this),e)})};var x=e.fn.scrollLeft;n.cssHooks.pageXOffset={get:function(e,o,t){var r=n.data(e,"__nicescroll")||!1;return r&&r.ishwscroll?r.getScrollLeft():x.call(e)},set:function(e,o){var t=n.data(e,"__nicescroll")||!1;return t&&t.ishwscroll?t.setScrollLeft(parseInt(o)):x.call(e,o),this}},e.fn.scrollLeft=function(e){if(void 0===e){var o=!!this[0]&&(n.data(this[0],"__nicescroll")||!1);return o&&o.ishwscroll?o.getScrollLeft():x.call(this)}return this.each(function(){var o=n.data(this,"__nicescroll")||!1;o&&o.ishwscroll?o.setScrollLeft(parseInt(e)):x.call(n(this),e)})};var S=function(e){var o=this;if(this.length=0,this.name="nicescrollarray",this.each=function(e){return n.each(o,e),o},this.push=function(e){o[o.length]=e,o.length++},this.eq=function(e){return o[e]},e)for(var t=0;t1?n(e,r):s,i.win=r}!("doc"in i)||"win"in i||(i.win=r);var l=r.data("__nicescroll")||!1;l||(i.doc=i.doc||r,l=new w(i,r),r.data("__nicescroll",l)),t.push(l)}),1===t.length?t[0]:t},a.NiceScroll={getjQuery:function(){return e}},n.nicescroll||(n.nicescroll=new S,n.nicescroll.options=f)}); \ No newline at end of file +!function(e){"function"==typeof define&&define.amd?define(["jquery"],e):"object"==typeof exports?module.exports=e(require("jquery")):e(jQuery)}(function(e){"use strict";var o=!1,t=!1,r=0,i=2e3,s=0,n=e,l=document,a=window,c=n(a),d=a.requestAnimationFrame||a.webkitRequestAnimationFrame||a.mozRequestAnimationFrame||!1,u=a.cancelAnimationFrame||a.webkitCancelAnimationFrame||a.mozCancelAnimationFrame||!1;if(d)a.cancelAnimationFrame||(u=function(e){});else{var h=0;d=function(e,o){var t=(new Date).getTime(),r=Math.max(0,16-(t-h)),i=a.setTimeout(function(){e(t+r)},r);return h=t+r,i},u=function(e){a.clearTimeout(e)}}var p=a.MutationObserver||a.WebKitMutationObserver||!1,m=Date.now||function(){return(new Date).getTime()},f={zindex:"auto",cursoropacitymin:0,cursoropacitymax:1,cursorcolor:"#424242",cursorwidth:"6px",cursorborder:"1px solid #fff",cursorborderradius:"5px",scrollspeed:40,mousescrollstep:27,touchbehavior:!1,emulatetouch:!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 e=l.currentScript||function(){var e=l.getElementsByTagName("script");return!!e.length&&e[e.length-1]}(),o=e?e.src.split("?")[0]:"";return o.split("/").length>0?o.split("/").slice(0,-1).join("/")+"/":""}(),preventmultitouchscrolling:!0,disablemutationobserver:!1,enableobserver:!0,scrollbarid:!1},g=!1,v=function(){if(g)return g;var e=l.createElement("DIV"),o=e.style,t=navigator.userAgent,r=navigator.platform,i={};return i.haspointerlock="pointerLockElement"in l||"webkitPointerLockElement"in l||"mozPointerLockElement"in l,i.isopera="opera"in a,i.isopera12=i.isopera&&"getUserMedia"in navigator,i.isoperamini="[object OperaMini]"===Object.prototype.toString.call(a.operamini),i.isie="all"in l&&"attachEvent"in e&&!i.isopera,i.isieold=i.isie&&!("msInterpolationMode"in o),i.isie7=i.isie&&!i.isieold&&(!("documentMode"in l)||7===l.documentMode),i.isie8=i.isie&&"documentMode"in l&&8===l.documentMode,i.isie9=i.isie&&"performance"in a&&9===l.documentMode,i.isie10=i.isie&&"performance"in a&&10===l.documentMode,i.isie11="msRequestFullscreen"in e&&l.documentMode>=11,i.ismsedge="msCredentials"in a,i.ismozilla="MozAppearance"in o,i.iswebkit=!i.ismsedge&&"WebkitAppearance"in o,i.ischrome=i.iswebkit&&"chrome"in a,i.ischrome38=i.ischrome&&"touchAction"in o,i.ischrome22=!i.ischrome38&&i.ischrome&&i.haspointerlock,i.ischrome26=!i.ischrome38&&i.ischrome&&"transition"in o,i.cantouch="ontouchstart"in l.documentElement||"ontouchstart"in a,i.hasw3ctouch=(a.PointerEvent||!1)&&(navigator.MaxTouchPoints>0||navigator.msMaxTouchPoints>0),i.hasmstouch=!i.hasw3ctouch&&(a.MSPointerEvent||!1),i.ismac=/^mac$/i.test(r),i.isios=i.cantouch&&/iphone|ipad|ipod/i.test(r),i.isios4=i.isios&&!("seal"in Object),i.isios7=i.isios&&"webkitHidden"in l,i.isios8=i.isios&&"hidden"in l,i.isios10=i.isios&&a.Proxy,i.isandroid=/android/i.test(t),i.haseventlistener="addEventListener"in e,i.trstyle=!1,i.hastransform=!1,i.hastranslate3d=!1,i.transitionstyle=!1,i.hastransition=!1,i.transitionend=!1,i.trstyle="transform",i.hastransform="transform"in o||function(){for(var e=["msTransform","webkitTransform","MozTransform","OTransform"],t=0,r=e.length;t0;){if(9==e[0].nodeType)return!1;var o=e.css("zIndex");if(!isNaN(o)&&0!==o)return parseInt(o);e=e.parent()}return!1}function y(e,o,t){var r=e.css(o),i=parseFloat(r);if(isNaN(i)){var s=3==(i=R[r]||0)?t?T.win.outerHeight()-T.win.innerHeight():T.win.outerWidth()-T.win.innerWidth():1;return T.isie8&&i&&(i+=1),s?i:0}return i}function x(e,o,t,r){T._bind(e,o,function(r){var i={original:r=r||a.event,target:r.target||r.srcElement,type:"wheel",deltaMode:"MozMousePixelScroll"==r.type?0:1,deltaX:0,deltaZ:0,preventDefault:function(){return r.preventDefault?r.preventDefault():r.returnValue=!1,!1},stopImmediatePropagation:function(){r.stopImmediatePropagation?r.stopImmediatePropagation():r.cancelBubble=!0}};return"mousewheel"==o?(r.wheelDeltaX&&(i.deltaX=-.025*r.wheelDeltaX),r.wheelDeltaY&&(i.deltaY=-.025*r.wheelDeltaY),!i.deltaY&&!i.deltaX&&(i.deltaY=-.025*r.wheelDelta)):i.deltaY=r.detail,t.call(e,i)},r)}function S(e,o,t,r){T.scrollrunning||(T.newscrolly=T.getScrollTop(),T.newscrollx=T.getScrollLeft(),Y=m());var i=m()-Y;if(Y=m(),i>350?B=1:B+=(2-B)/10,e=e*B|0,o=o*B|0,e){if(r)if(e<0){if(T.getScrollLeft()>=T.page.maxw)return!0}else if(T.getScrollLeft()<=0)return!0;var s=e>0?1:-1;O!==s&&(T.scrollmom&&T.scrollmom.stop(),T.newscrollx=T.getScrollLeft(),O=s),T.lastdeltax-=e}if(o){if(function(){var e=T.getScrollTop();if(o<0){if(e>=T.page.maxh)return!0}else if(e<=0)return!0}()){if(T.opt.nativeparentscrolling&&t&&!T.ispage&&!T.zoomactive)return!0;var n=T.view.h>>1;T.newscrolly<-n?(T.newscrolly=-n,o=-1):T.newscrolly>T.page.maxh+n?(T.newscrolly=T.page.maxh+n,o=1):o=0}var l=o>0?1:-1;I!==l&&(T.scrollmom&&T.scrollmom.stop(),T.newscrolly=T.getScrollTop(),I=l),T.lastdeltay-=o}(o||e)&&T.synched("relativexy",function(){var e=T.lastdeltay+T.newscrolly;T.lastdeltay=0;var o=T.lastdeltax+T.newscrollx;T.lastdeltax=0,T.rail.drag||T.doScrollPos(o,e)})}function z(e,o,t){var r,i;return!(t||!X)||(0===e.deltaMode?(r=-e.deltaX*(T.opt.mousescrollstep/54)|0,i=-e.deltaY*(T.opt.mousescrollstep/54)|0):1===e.deltaMode&&(r=-e.deltaX*T.opt.mousescrollstep*50/80|0,i=-e.deltaY*T.opt.mousescrollstep*50/80|0),o&&T.opt.oneaxismousemode&&0===r&&i&&(r=i,i=0,t&&(r<0?T.getScrollLeft()>=T.page.maxw:T.getScrollLeft()<=0)&&(i=r,r=0)),T.isrtlmode&&(r=-r),S(r,i,t,!0)?void(t&&(X=!0)):(X=!1,e.stopImmediatePropagation(),e.preventDefault()))}var T=this;this.version="3.7.4-e",this.name="nicescroll",this.me=h;var k=n("body");if(this.opt={doc:k,win:!1},n.extend(this.opt,f),this.opt.snapbackspeed=80,e)for(var E in T.opt)void 0!==e[E]&&(T.opt[E]=e[E]);if(T.opt.disablemutationobserver&&(p=!1),this.doc=T.opt.doc,this.iddoc=this.doc&&this.doc[0]?this.doc[0].id||"":"",this.ispage=/^BODY|HTML/.test(T.opt.win?T.opt.win[0].nodeName:this.doc[0].nodeName),this.haswrapper=!1!==T.opt.win,this.win=T.opt.win||(this.ispage?c:this.doc),this.docscroll=this.ispage&&!this.haswrapper?c:this.win,this.body=k,this.viewport=!1,this.isfixed=!1,this.iframe=!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"!=T.opt.autohidemode,this.onmousedown=!1,this.onmouseup=!1,this.onmousemove=!1,this.onmousewheel=!1,this.onkeypress=!1,this.ongesturezoom=!1,this.onclick=!1,this.onscrollstart=!1,this.onscrollend=!1,this.onscrollcancel=!1,this.onzoomin=!1,this.onzoomout=!1,this.view=!1,this.page=!1,this.scroll={x:0,y:0},this.scrollratio={x:0,y:0},this.cursorheight=20,this.scrollvaluemax=0,"auto"==this.opt.rtlmode){var M=this.win[0]==a?this.body:this.win,L=M.css("writing-mode")||M.css("-webkit-writing-mode")||M.css("-ms-writing-mode")||M.css("-moz-writing-mode");"horizontal-tb"==L||"lr-tb"==L||""===L?(this.isrtlmode="rtl"==M.css("direction"),this.isvertical=!1):(this.isrtlmode="vertical-rl"==L||"tb"==L||"tb-rl"==L||"rl-tb"==L,this.isvertical="vertical-rl"==L||"tb"==L||"tb-rl"==L)}else this.isrtlmode=!0===this.opt.rtlmode,this.isvertical=!1;if(this.scrollrunning=!1,this.scrollmom=!1,this.observer=!1,this.observerremover=!1,this.observerbody=!1,!1!==T.opt.scrollbarid)this.id=T.opt.scrollbarid;else do{this.id="ascrail"+i++}while(l.getElementById(this.id));this.rail=!1,this.cursor=!1,this.cursorfreezed=!1,this.selectiondrag=!1,this.zoom=!1,this.zoomactive=!1,this.hasfocus=!1,this.hasmousefocus=!1,this.visibility=!0,this.railslocked=!1,this.locked=!1,this.hidden=!1,this.cursoractive=!0,this.wheelprevented=!1,this.overflowx=T.opt.overflowx,this.overflowy=T.opt.overflowy,this.nativescrollingarea=!1,this.checkarea=0,this.events=[],this.saved={},this.delaylist={},this.synclist={},this.lastdeltax=0,this.lastdeltay=0,this.detected=v();var C=n.extend({},this.detected);this.canhwscroll=C.hastransform&&T.opt.hwacceleration,this.ishwscroll=this.canhwscroll&&T.haswrapper,this.isrtlmode?this.isvertical?this.hasreversehr=!(C.iswebkit||C.isie||C.isie11):this.hasreversehr=!(C.iswebkit||C.isie&&!C.isie10&&!C.isie11):this.hasreversehr=!1,this.istouchcapable=!1,C.cantouch||!C.hasw3ctouch&&!C.hasmstouch?!C.cantouch||C.isios||C.isandroid||!C.iswebkit&&!C.ismozilla||(this.istouchcapable=!0):this.istouchcapable=!0,T.opt.enablemouselockapi||(C.hasmousecapture=!1,C.haspointerlock=!1),this.debounced=function(e,o,t){T&&(T.delaylist[e]||!1||(T.delaylist[e]={h:d(function(){T.delaylist[e].fn.call(T),T.delaylist[e]=!1},t)},o.call(T)),T.delaylist[e].fn=o)},this.synched=function(e,o){T.synclist[e]?T.synclist[e]=o:(T.synclist[e]=o,d(function(){T&&(T.synclist[e]&&T.synclist[e].call(T),T.synclist[e]=null)}))},this.unsynched=function(e){T.synclist[e]&&(T.synclist[e]=!1)},this.css=function(e,o){for(var t in o)T.saved.css.push([e,t,e.css(t)]),e.css(t,o[t])},this.scrollTop=function(e){return void 0===e?T.getScrollTop():T.setScrollTop(e)},this.scrollLeft=function(e){return void 0===e?T.getScrollLeft():T.setScrollLeft(e)};var N=function(e,o,t,r,i,s,n){this.st=e,this.ed=o,this.spd=t,this.p1=r||0,this.p2=i||1,this.p3=s||0,this.p4=n||1,this.ts=m(),this.df=o-e};if(N.prototype={B2:function(e){return 3*(1-e)*(1-e)*e},B3:function(e){return 3*(1-e)*e*e},B4:function(e){return e*e*e},getPos:function(){return(m()-this.ts)/this.spd},getNow:function(){var e=(m()-this.ts)/this.spd,o=this.B2(e)+this.B3(e)+this.B4(e);return e>=1?this.ed:this.st+this.df*o|0},update:function(e,o){return this.st=this.getNow(),this.ed=e,this.spd=o,this.ts=m(),this.df=this.ed-this.st,this}},this.ishwscroll){this.doc.translate={x:0,y:0,tx:"0px",ty:"0px"},C.hastranslate3d&&C.isios&&this.doc.css("-webkit-backface-visibility","hidden"),this.getScrollTop=function(e){if(!e){var o=g();if(o)return 16==o.length?-o[13]:-o[5];if(T.timerscroll&&T.timerscroll.bz)return T.timerscroll.bz.getNow()}return T.doc.translate.y},this.getScrollLeft=function(e){if(!e){var o=g();if(o)return 16==o.length?-o[12]:-o[4];if(T.timerscroll&&T.timerscroll.bh)return T.timerscroll.bh.getNow()}return T.doc.translate.x},this.notifyScrollEvent=function(e){var o=l.createEvent("UIEvents");o.initUIEvent("scroll",!1,!0,a,1),o.niceevent=!0,e.dispatchEvent(o)};var P=this.isrtlmode?1:-1;C.hastranslate3d&&T.opt.enabletranslate3d?(this.setScrollTop=function(e,o){T.doc.translate.y=e,T.doc.translate.ty=-1*e+"px",T.doc.css(C.trstyle,"translate3d("+T.doc.translate.tx+","+T.doc.translate.ty+",0)"),o||T.notifyScrollEvent(T.win[0])},this.setScrollLeft=function(e,o){T.doc.translate.x=e,T.doc.translate.tx=e*P+"px",T.doc.css(C.trstyle,"translate3d("+T.doc.translate.tx+","+T.doc.translate.ty+",0)"),o||T.notifyScrollEvent(T.win[0])}):(this.setScrollTop=function(e,o){T.doc.translate.y=e,T.doc.translate.ty=-1*e+"px",T.doc.css(C.trstyle,"translate("+T.doc.translate.tx+","+T.doc.translate.ty+")"),o||T.notifyScrollEvent(T.win[0])},this.setScrollLeft=function(e,o){T.doc.translate.x=e,T.doc.translate.tx=e*P+"px",T.doc.css(C.trstyle,"translate("+T.doc.translate.tx+","+T.doc.translate.ty+")"),o||T.notifyScrollEvent(T.win[0])})}else this.getScrollTop=function(){return T.docscroll.scrollTop()},this.setScrollTop=function(e){T.docscroll.scrollTop(e)},this.getScrollLeft=function(){return T.hasreversehr?T.detected.ismozilla?T.page.maxw-Math.abs(T.docscroll.scrollLeft()):T.page.maxw-T.docscroll.scrollLeft():T.docscroll.scrollLeft()},this.setScrollLeft=function(e){return setTimeout(function(){if(T)return T.hasreversehr&&(e=T.detected.ismozilla?-(T.page.maxw-e):T.page.maxw-e),T.docscroll.scrollLeft(e)},1)};this.getTarget=function(e){return!!e&&(e.target?e.target:!!e.srcElement&&e.srcElement)},this.hasParent=function(e,o){if(!e)return!1;for(var t=e.target||e.srcElement||e||!1;t&&t.id!=o;)t=t.parentNode||!1;return!1!==t};var R={thin:1,medium:3,thick:5};this.getDocumentScrollOffset=function(){return{top:a.pageYOffset||l.documentElement.scrollTop,left:a.pageXOffset||l.documentElement.scrollLeft}},this.getOffset=function(){if(T.isfixed){var e=T.win.offset(),o=T.getDocumentScrollOffset();return e.top-=o.top,e.left-=o.left,e}var t=T.win.offset();if(!T.viewport)return t;var r=T.viewport.offset();return{top:t.top-r.top,left:t.left-r.left}},this.updateScrollBar=function(e){var o,t;if(T.ishwscroll)T.rail.css({height:T.win.innerHeight()-(T.opt.railpadding.top+T.opt.railpadding.bottom)}),T.railh&&T.railh.css({width:T.win.innerWidth()-(T.opt.railpadding.left+T.opt.railpadding.right)});else{var r=T.getOffset();if(o={top:r.top,left:r.left-(T.opt.railpadding.left+T.opt.railpadding.right)},o.top+=y(T.win,"border-top-width",!0),o.left+=T.rail.align?T.win.outerWidth()-y(T.win,"border-right-width")-T.rail.width:y(T.win,"border-left-width"),(t=T.opt.railoffset)&&(t.top&&(o.top+=t.top),t.left&&(o.left+=t.left)),T.railslocked||T.rail.css({top:o.top,left:o.left,height:(e?e.h:T.win.innerHeight())-(T.opt.railpadding.top+T.opt.railpadding.bottom)}),T.zoom&&T.zoom.css({top:o.top+1,left:1==T.rail.align?o.left-20:o.left+T.rail.width+4}),T.railh&&!T.railslocked){o={top:r.top,left:r.left},(t=T.opt.railhoffset)&&(t.top&&(o.top+=t.top),t.left&&(o.left+=t.left));var i=T.railh.align?o.top+y(T.win,"border-top-width",!0)+T.win.innerHeight()-T.railh.height:o.top+y(T.win,"border-top-width",!0),s=o.left+y(T.win,"border-left-width");T.railh.css({top:i-(T.opt.railpadding.top+T.opt.railpadding.bottom),left:s,width:T.railh.width})}}},this.doRailClick=function(e,o,t){var r,i,s,n;T.railslocked||(T.cancelEvent(e),"pageY"in e||(e.pageX=e.clientX+l.documentElement.scrollLeft,e.pageY=e.clientY+l.documentElement.scrollTop),o?(r=t?T.doScrollLeft:T.doScrollTop)(s=t?(e.pageX-T.railh.offset().left-T.cursorwidth/2)*T.scrollratio.x:(e.pageY-T.rail.offset().top-T.cursorheight/2)*T.scrollratio.y):(r=t?T.doScrollLeftBy:T.doScrollBy,s=t?T.scroll.x:T.scroll.y,n=t?e.pageX-T.railh.offset().left:e.pageY-T.rail.offset().top,i=t?T.view.w:T.view.h,r(s>=n?i:-i)))},T.newscrolly=T.newscrollx=0,T.hasanimationframe="requestAnimationFrame"in a,T.hascancelanimationframe="cancelAnimationFrame"in a,T.hasborderbox=!1,this.init=function(){if(T.saved.css=[],C.isoperamini)return!0;if(C.isandroid&&!("hidden"in l))return!0;T.opt.emulatetouch=T.opt.emulatetouch||T.opt.touchbehavior,T.hasborderbox=a.getComputedStyle&&"border-box"===a.getComputedStyle(l.body)["box-sizing"];var e={"overflow-y":"hidden"};if((C.isie11||C.isie10)&&(e["-ms-overflow-style"]="none"),T.ishwscroll&&(this.doc.css(C.transitionstyle,C.prefixstyle+"transform 0ms ease-out"),C.transitionend&&T.bind(T.doc,C.transitionend,T.onScrollTransitionEnd,!1)),T.zindex="auto",T.ispage||"auto"!=T.opt.zindex?T.zindex=T.opt.zindex:T.zindex=w()||"auto",!T.ispage&&"auto"!=T.zindex&&T.zindex>s&&(s=T.zindex),T.isie&&0===T.zindex&&"auto"==T.opt.zindex&&(T.zindex="auto"),!T.ispage||!C.cantouch&&!C.isieold){var i=T.docscroll;T.ispage&&(i=T.haswrapper?T.win:T.doc),T.css(i,e),T.ispage&&(C.isie11||C.isie)&&T.css(n("html"),e),!C.isios||T.ispage||T.haswrapper||T.css(k,{"-webkit-overflow-scrolling":"touch"});var d=n(l.createElement("div"));d.css({position:"relative",top:0,float:"right",width:T.opt.cursorwidth,height:0,"background-color":T.opt.cursorcolor,border:T.opt.cursorborder,"background-clip":"padding-box","-webkit-border-radius":T.opt.cursorborderradius,"-moz-border-radius":T.opt.cursorborderradius,"border-radius":T.opt.cursorborderradius}),d.addClass("nicescroll-cursors"),T.cursor=d;var u=n(l.createElement("div"));u.attr("id",T.id),u.addClass("nicescroll-rails nicescroll-rails-vr");var h,m,f=["left","right","top","bottom"];for(var g in f)m=f[g],(h=T.opt.railpadding[m]||0)&&u.css("padding-"+m,h+"px");u.append(d),u.width=Math.max(parseFloat(T.opt.cursorwidth),d.outerWidth()),u.css({width:u.width+"px",zIndex:T.zindex,background:T.opt.background,cursor:"default"}),u.visibility=!0,u.scrollable=!0,u.align="left"==T.opt.railalign?0:1,T.rail=u,T.rail.drag=!1;var v=!1;!T.opt.boxzoom||T.ispage||C.isieold||(v=l.createElement("div"),T.bind(v,"click",T.doZoom),T.bind(v,"mouseenter",function(){T.zoom.css("opacity",T.opt.cursoropacitymax)}),T.bind(v,"mouseleave",function(){T.zoom.css("opacity",T.opt.cursoropacitymin)}),T.zoom=n(v),T.zoom.css({cursor:"pointer",zIndex:T.zindex,backgroundImage:"url("+T.opt.scriptpath+"zoomico.png)",height:18,width:18,backgroundPosition:"0 0"}),T.opt.dblclickzoom&&T.bind(T.win,"dblclick",T.doZoom),C.cantouch&&T.opt.gesturezoom&&(T.ongesturezoom=function(e){return e.scale>1.5&&T.doZoomIn(e),e.scale<.8&&T.doZoomOut(e),T.cancelEvent(e)},T.bind(T.win,"gestureend",T.ongesturezoom))),T.railh=!1;var y;if(T.opt.horizrailenabled&&(T.css(i,{overflowX:"hidden"}),(d=n(l.createElement("div"))).css({position:"absolute",top:0,height:T.opt.cursorwidth,width:0,backgroundColor:T.opt.cursorcolor,border:T.opt.cursorborder,backgroundClip:"padding-box","-webkit-border-radius":T.opt.cursorborderradius,"-moz-border-radius":T.opt.cursorborderradius,"border-radius":T.opt.cursorborderradius}),C.isieold&&d.css("overflow","hidden"),d.addClass("nicescroll-cursors"),T.cursorh=d,(y=n(l.createElement("div"))).attr("id",T.id+"-hr"),y.addClass("nicescroll-rails nicescroll-rails-hr"),y.height=Math.max(parseFloat(T.opt.cursorwidth),d.outerHeight()),y.css({height:y.height+"px",zIndex:T.zindex,background:T.opt.background}),y.append(d),y.visibility=!0,y.scrollable=!0,y.align="top"==T.opt.railvalign?0:1,T.railh=y,T.railh.drag=!1),T.ispage)u.css({position:"fixed",top:0,height:"100%"}),u.css(u.align?{right:0}:{left:0}),T.body.append(u),T.railh&&(y.css({position:"fixed",left:0,width:"100%"}),y.css(y.align?{bottom:0}:{top:0}),T.body.append(y));else{if(T.ishwscroll){"static"==T.win.css("position")&&T.css(T.win,{position:"relative"});var x="HTML"==T.win[0].nodeName?T.body:T.win;n(x).scrollTop(0).scrollLeft(0),T.zoom&&(T.zoom.css({position:"absolute",top:1,right:0,"margin-right":u.width+4}),x.append(T.zoom)),u.css({position:"absolute",top:0}),u.css(u.align?{right:0}:{left:0}),x.append(u),y&&(y.css({position:"absolute",left:0,bottom:0}),y.css(y.align?{bottom:0}:{top:0}),x.append(y))}else{T.isfixed="fixed"==T.win.css("position");var S=T.isfixed?"fixed":"absolute";T.isfixed||(T.viewport=T.getViewport(T.win[0])),T.viewport&&(T.body=T.viewport,/fixed|absolute/.test(T.viewport.css("position"))||T.css(T.viewport,{position:"relative"})),u.css({position:S}),T.zoom&&T.zoom.css({position:S}),T.updateScrollBar(),T.body.append(u),T.zoom&&T.body.append(T.zoom),T.railh&&(y.css({position:S}),T.body.append(y))}C.isios&&T.css(T.win,{"-webkit-tap-highlight-color":"rgba(0,0,0,0)","-webkit-touch-callout":"none"}),C.isie&&T.opt.disableoutline&&T.win.attr("hideFocus","true"),C.iswebkit&&T.opt.disableoutline&&T.win.css("outline","none")}if(!1===T.opt.autohidemode?(T.autohidedom=!1,T.rail.css({opacity:T.opt.cursoropacitymax}),T.railh&&T.railh.css({opacity:T.opt.cursoropacitymax})):!0===T.opt.autohidemode||"leave"===T.opt.autohidemode?(T.autohidedom=n().add(T.rail),C.isie8&&(T.autohidedom=T.autohidedom.add(T.cursor)),T.railh&&(T.autohidedom=T.autohidedom.add(T.railh)),T.railh&&C.isie8&&(T.autohidedom=T.autohidedom.add(T.cursorh))):"scroll"==T.opt.autohidemode?(T.autohidedom=n().add(T.rail),T.railh&&(T.autohidedom=T.autohidedom.add(T.railh))):"cursor"==T.opt.autohidemode?(T.autohidedom=n().add(T.cursor),T.railh&&(T.autohidedom=T.autohidedom.add(T.cursorh))):"hidden"==T.opt.autohidemode&&(T.autohidedom=!1,T.hide(),T.railslocked=!1),C.cantouch||T.istouchcapable||T.opt.emulatetouch||C.hasmstouch){T.scrollmom=new b(T),T.ontouchstart=function(e){if(e.pointerType&&("mouse"===e.pointerType||e.pointerType===e.MSPOINTER_TYPE_MOUSE))return!1;if(T.hasmoving=!1,!T.railslocked){var o;if(C.hasmstouch)for(o=!!e.target&&e.target;o;){var t=n(o).getNiceScroll();if(t.length>0&&t[0].me==T.me)break;if(t.length>0)return!1;if("DIV"==o.nodeName&&o.id==T.id)break;o=!!o.parentNode&&o.parentNode}if(e.stopPropagation(),T.cancelScroll(),(o=T.getTarget(e))&&/INPUT/i.test(o.nodeName)&&/range/i.test(o.type))return T.stopPropagation(e);if(!("clientX"in e)&&"changedTouches"in e&&(e.clientX=e.changedTouches[0].clientX,e.clientY=e.changedTouches[0].clientY),T.forcescreen){var r=e;(e={original:e.original?e.original:e}).clientX=r.screenX,e.clientY=r.screenY}if(T.rail.drag={x:e.clientX,y:e.clientY,sx:T.scroll.x,sy:T.scroll.y,st:T.getScrollTop(),sl:T.getScrollLeft(),pt:2,dl:!1,tg:o},T.ispage||!T.opt.directionlockdeadzone)T.rail.drag.dl="f";else{var i={w:c.width(),h:c.height()},s={w:Math.max(l.body.scrollWidth,l.documentElement.scrollWidth),h:Math.max(l.body.scrollHeight,l.documentElement.scrollHeight)},a=Math.max(0,s.h-i.h),d=Math.max(0,s.w-i.w);!T.rail.scrollable&&T.railh.scrollable?T.rail.drag.ck=a>0&&"v":T.rail.scrollable&&!T.railh.scrollable?T.rail.drag.ck=d>0&&"h":T.rail.drag.ck=!1}if(T.opt.emulatetouch&&T.isiframe&&C.isie){var u=T.win.position();T.rail.drag.x+=u.left,T.rail.drag.y+=u.top}if(T.hasmoving=!1,T.lastmouseup=!1,T.scrollmom.reset(e.clientX,e.clientY),!C.cantouch&&!this.istouchcapable&&!e.pointerType){if(!(!!o&&/INPUT|SELECT|BUTTON|TEXTAREA/i.test(o.nodeName)))return!T.ispage&&C.hasmousecapture&&o.setCapture(),T.opt.emulatetouch?(o.onclick&&!o._onclick&&(o._onclick=o.onclick,o.onclick=function(e){if(T.hasmoving)return!1;o._onclick.call(this,e)}),T.cancelEvent(e)):T.stopPropagation(e);/SUBMIT|CANCEL|BUTTON/i.test(n(o).attr("type"))&&(T.preventclick={tg:o,click:!1})}}},T.ontouchend=function(e){if(!T.rail.drag)return!0;if(2==T.rail.drag.pt){if(e.pointerType&&("mouse"===e.pointerType||e.pointerType===e.MSPOINTER_TYPE_MOUSE))return!1;if(T.rail.drag=!1,T.hasmoving&&(T.scrollmom.doMomentum(),T.lastmouseup=!0,T.hideCursor(),C.hasmousecapture&&l.releaseCapture(),!C.cantouch))return T.cancelEvent(e)}else if(1==T.rail.drag.pt)return T.onmouseup(e)};var z=T.opt.emulatetouch&&T.isiframe&&!C.hasmousecapture;T.ontouchmove=function(e,o){if(!T.rail.drag)return!1;if(e.targetTouches&&T.opt.preventmultitouchscrolling&&e.targetTouches.length>1)return!1;if(e.pointerType&&("mouse"===e.pointerType||e.pointerType===e.MSPOINTER_TYPE_MOUSE))return!1;if(2==T.rail.drag.pt){if("changedTouches"in e&&(e.clientX=e.changedTouches[0].clientX,e.clientY=e.changedTouches[0].clientY),!T.hasmoving){if(T.rail.drag.y===e.clientY&&T.rail.drag.x===e.clientX)return!1;T.triggerScrollStart(e.clientX,e.clientY,0,0,0),T.hasmoving=!0}T.preventclick&&!T.preventclick.click&&(T.preventclick.click=T.preventclick.tg.onclick||!1,T.preventclick.tg.onclick=T.onpreventclick);var t,r;if(r=t=0,z&&!o){var i=T.win.position();r=-i.left,t=-i.top}var s=e.clientY+t,n=s-T.rail.drag.y,a=e.clientX+r,c=a-T.rail.drag.x,d=T.rail.drag.st-n;T.ishwscroll&&T.opt.bouncescroll?d<0?d=Math.round(d/2):d>T.page.maxh&&(d=T.page.maxh+Math.round((d-T.page.maxh)/2)):(d<0&&(d=0,s=0),d>T.page.maxh&&(d=T.page.maxh,s=0));var u;T.railh&&T.railh.scrollable&&(u=T.isrtlmode?c-T.rail.drag.sl:T.rail.drag.sl-c,T.ishwscroll&&T.opt.bouncescroll?u<0?u=Math.round(u/2):u>T.page.maxw&&(u=T.page.maxw+Math.round((u-T.page.maxw)/2)):(u<0&&(u=0,a=0),u>T.page.maxw&&(u=T.page.maxw,a=0)));var h=!1;if(!T.rail.drag.dl){var p=Math.abs(n),m=Math.abs(c),f=T.opt.directionlockdeadzone;if(T.rail.drag.ck){if("v"==T.rail.drag.ck){if(p>f&&m<=.3*p)return T.rail.drag=!1,!0;m>f&&(T.rail.drag.dl="f",k.scrollTop(k.scrollTop()))}else if("h"==T.rail.drag.ck){if(m>f&&p<=.3*m)return T.rail.drag=!1,!0;T.rail.drag.dl="f",k.scrollTop(k.scrollTop())}}else p>f&&m>f?T.rail.drag.dl="f":p>f?T.rail.drag.dl=m?"f":"v":m>f&&(T.rail.drag.dl=p?"f":"h");return!1}if(h=!0,"v"==T.rail.drag.dl?u=T.rail.drag.sl:"h"==T.rail.drag.dl&&(d=T.rail.drag.st),T.synched("touchmove",function(){T.rail.drag&&2==T.rail.drag.pt&&(T.prepareTransition&&T.resetTransition(),T.rail.scrollable&&T.setScrollTop(d),T.scrollmom.update(a,s),T.railh&&T.railh.scrollable?(T.setScrollLeft(u),T.showCursor(d,u)):T.showCursor(d),C.isie10&&l.selection.clear())}),C.ischrome&&T.istouchcapable&&(h=!1),h)return T.cancelEvent(e)}else if(1==T.rail.drag.pt)return T.onmousemove(e)},T.ontouchstartCursor=function(e,o){if(!T.rail.drag||3==T.rail.drag.pt){if(T.locked)return T.cancelEvent(e);T.cancelScroll(),T.rail.drag={x:e.touches[0].clientX,y:e.touches[0].clientY,sx:T.scroll.x,sy:T.scroll.y,pt:3,hr:!!o};var t=T.getTarget(e);return!T.ispage&&C.hasmousecapture&&t.setCapture(),T.isiframe&&!C.hasmousecapture&&(T.saved.csspointerevents=T.doc.css("pointer-events"),T.css(T.doc,{"pointer-events":"none"})),T.cancelEvent(e)}},T.ontouchendCursor=function(e){if(T.rail.drag){if(C.hasmousecapture&&l.releaseCapture(),T.isiframe&&!C.hasmousecapture&&T.doc.css("pointer-events",T.saved.csspointerevents),3!=T.rail.drag.pt)return;return T.rail.drag=!1,T.cancelEvent(e)}},T.ontouchmoveCursor=function(e){if(T.rail.drag){if(3!=T.rail.drag.pt)return;if(T.cursorfreezed=!0,T.rail.drag.hr){T.scroll.x=T.rail.drag.sx+(e.touches[0].clientX-T.rail.drag.x),T.scroll.x<0&&(T.scroll.x=0);var o=T.scrollvaluemaxw;T.scroll.x>o&&(T.scroll.x=o)}else{T.scroll.y=T.rail.drag.sy+(e.touches[0].clientY-T.rail.drag.y),T.scroll.y<0&&(T.scroll.y=0);var t=T.scrollvaluemax;T.scroll.y>t&&(T.scroll.y=t)}return T.synched("touchmove",function(){T.rail.drag&&3==T.rail.drag.pt&&(T.showCursor(),T.rail.drag.hr?T.doScrollLeft(Math.round(T.scroll.x*T.scrollratio.x),T.opt.cursordragspeed):T.doScrollTop(Math.round(T.scroll.y*T.scrollratio.y),T.opt.cursordragspeed))}),T.cancelEvent(e)}}}if(T.onmousedown=function(e,o){if(!T.rail.drag||1==T.rail.drag.pt){if(T.railslocked)return T.cancelEvent(e);T.cancelScroll(),T.rail.drag={x:e.clientX,y:e.clientY,sx:T.scroll.x,sy:T.scroll.y,pt:1,hr:o||!1};var t=T.getTarget(e);return C.hasmousecapture&&t.setCapture(),T.isiframe&&!C.hasmousecapture&&(T.saved.csspointerevents=T.doc.css("pointer-events"),T.css(T.doc,{"pointer-events":"none"})),T.hasmoving=!1,T.cancelEvent(e)}},T.onmouseup=function(e){if(T.rail.drag)return 1!=T.rail.drag.pt||(C.hasmousecapture&&l.releaseCapture(),T.isiframe&&!C.hasmousecapture&&T.doc.css("pointer-events",T.saved.csspointerevents),T.rail.drag=!1,T.cursorfreezed=!1,T.hasmoving&&T.triggerScrollEnd(),T.cancelEvent(e))},T.onmousemove=function(e){if(T.rail.drag){if(1!==T.rail.drag.pt)return;if(C.ischrome&&0===e.which)return T.onmouseup(e);if(T.cursorfreezed=!0,T.hasmoving||T.triggerScrollStart(e.clientX,e.clientY,0,0,0),T.hasmoving=!0,T.rail.drag.hr){T.scroll.x=T.rail.drag.sx+(e.clientX-T.rail.drag.x),T.scroll.x<0&&(T.scroll.x=0);var o=T.scrollvaluemaxw;T.scroll.x>o&&(T.scroll.x=o)}else{T.scroll.y=T.rail.drag.sy+(e.clientY-T.rail.drag.y),T.scroll.y<0&&(T.scroll.y=0);var t=T.scrollvaluemax;T.scroll.y>t&&(T.scroll.y=t)}return T.synched("mousemove",function(){T.cursorfreezed&&(T.showCursor(),T.rail.drag.hr?T.scrollLeft(Math.round(T.scroll.x*T.scrollratio.x)):T.scrollTop(Math.round(T.scroll.y*T.scrollratio.y)))}),T.cancelEvent(e)}T.checkarea=0},C.cantouch||T.opt.emulatetouch)T.onpreventclick=function(e){if(T.preventclick)return T.preventclick.tg.onclick=T.preventclick.click,T.preventclick=!1,T.cancelEvent(e)},T.onclick=!C.isios&&function(e){return!T.lastmouseup||(T.lastmouseup=!1,T.cancelEvent(e))},T.opt.grabcursorenabled&&C.cursorgrabvalue&&(T.css(T.ispage?T.doc:T.win,{cursor:C.cursorgrabvalue}),T.css(T.rail,{cursor:C.cursorgrabvalue}));else{var E=function(e){if(T.selectiondrag){if(e){var o=T.win.outerHeight(),t=e.pageY-T.selectiondrag.top;t>0&&t=o&&(t-=o),T.selectiondrag.df=t}if(0!==T.selectiondrag.df){var r=2*-Math.floor(T.selectiondrag.df/6);T.doScrollBy(r),T.debounced("doselectionscroll",function(){E()},50)}}};T.hasTextSelected="getSelection"in l?function(){return l.getSelection().rangeCount>0}:"selection"in l?function(){return"None"!=l.selection.type}:function(){return!1},T.onselectionstart=function(e){T.ispage||(T.selectiondrag=T.win.offset())},T.onselectionend=function(e){T.selectiondrag=!1},T.onselectiondrag=function(e){T.selectiondrag&&T.hasTextSelected()&&T.debounced("selectionscroll",function(){E(e)},250)}}if(C.hasw3ctouch?(T.css(T.ispage?n("html"):T.win,{"touch-action":"none"}),T.css(T.rail,{"touch-action":"none"}),T.css(T.cursor,{"touch-action":"none"}),T.bind(T.win,"pointerdown",T.ontouchstart),T.bind(l,"pointerup",T.ontouchend),T.bind(l,"pointermove",T.ontouchmove)):C.hasmstouch?(T.css(T.ispage?n("html"):T.win,{"-ms-touch-action":"none"}),T.css(T.rail,{"-ms-touch-action":"none"}),T.css(T.cursor,{"-ms-touch-action":"none"}),T.bind(T.win,"MSPointerDown",T.ontouchstart),T.bind(l,"MSPointerUp",T.ontouchend),T.bind(l,"MSPointerMove",T.ontouchmove),T.bind(T.cursor,"MSGestureHold",function(e){e.preventDefault()}),T.bind(T.cursor,"contextmenu",function(e){e.preventDefault()})):C.cantouch&&(T.bind(T.win,"touchstart",T.ontouchstart,!1,!0),T.bind(l,"touchend",T.ontouchend,!1,!0),T.bind(l,"touchcancel",T.ontouchend,!1,!0),T.bind(l,"touchmove",T.ontouchmove,!1,!0)),T.opt.emulatetouch&&(T.bind(T.win,"mousedown",T.ontouchstart,!1,!0),T.bind(l,"mouseup",T.ontouchend,!1,!0),T.bind(l,"mousemove",T.ontouchmove,!1,!0)),(T.opt.cursordragontouch||!C.cantouch&&!T.opt.emulatetouch)&&(T.rail.css({cursor:"default"}),T.railh&&T.railh.css({cursor:"default"}),T.jqbind(T.rail,"mouseenter",function(){if(!T.ispage&&!T.win.is(":visible"))return!1;T.canshowonmouseevent&&T.showCursor(),T.rail.active=!0}),T.jqbind(T.rail,"mouseleave",function(){T.rail.active=!1,T.rail.drag||T.hideCursor()}),T.opt.sensitiverail&&(T.bind(T.rail,"click",function(e){T.doRailClick(e,!1,!1)}),T.bind(T.rail,"dblclick",function(e){T.doRailClick(e,!0,!1)}),T.bind(T.cursor,"click",function(e){T.cancelEvent(e)}),T.bind(T.cursor,"dblclick",function(e){T.cancelEvent(e)})),T.railh&&(T.jqbind(T.railh,"mouseenter",function(){if(!T.ispage&&!T.win.is(":visible"))return!1;T.canshowonmouseevent&&T.showCursor(),T.rail.active=!0}),T.jqbind(T.railh,"mouseleave",function(){T.rail.active=!1,T.rail.drag||T.hideCursor()}),T.opt.sensitiverail&&(T.bind(T.railh,"click",function(e){T.doRailClick(e,!1,!0)}),T.bind(T.railh,"dblclick",function(e){T.doRailClick(e,!0,!0)}),T.bind(T.cursorh,"click",function(e){T.cancelEvent(e)}),T.bind(T.cursorh,"dblclick",function(e){T.cancelEvent(e)})))),T.opt.cursordragontouch&&(this.istouchcapable||C.cantouch)&&(T.bind(T.cursor,"touchstart",T.ontouchstartCursor),T.bind(T.cursor,"touchmove",T.ontouchmoveCursor),T.bind(T.cursor,"touchend",T.ontouchendCursor),T.cursorh&&T.bind(T.cursorh,"touchstart",function(e){T.ontouchstartCursor(e,!0)}),T.cursorh&&T.bind(T.cursorh,"touchmove",T.ontouchmoveCursor),T.cursorh&&T.bind(T.cursorh,"touchend",T.ontouchendCursor)),C.cantouch||T.opt.emulatetouch?(T.bind(C.hasmousecapture?T.win:l,"mouseup",T.ontouchend),T.onclick&&T.bind(l,"click",T.onclick),T.opt.cursordragontouch?(T.bind(T.cursor,"mousedown",T.onmousedown),T.bind(T.cursor,"mouseup",T.onmouseup),T.cursorh&&T.bind(T.cursorh,"mousedown",function(e){T.onmousedown(e,!0)}),T.cursorh&&T.bind(T.cursorh,"mouseup",T.onmouseup)):(T.bind(T.rail,"mousedown",function(e){e.preventDefault()}),T.railh&&T.bind(T.railh,"mousedown",function(e){e.preventDefault()}))):(T.bind(C.hasmousecapture?T.win:l,"mouseup",T.onmouseup),T.bind(l,"mousemove",T.onmousemove),T.onclick&&T.bind(l,"click",T.onclick),T.bind(T.cursor,"mousedown",T.onmousedown),T.bind(T.cursor,"mouseup",T.onmouseup),T.railh&&(T.bind(T.cursorh,"mousedown",function(e){T.onmousedown(e,!0)}),T.bind(T.cursorh,"mouseup",T.onmouseup)),!T.ispage&&T.opt.enablescrollonselection&&(T.bind(T.win[0],"mousedown",T.onselectionstart),T.bind(l,"mouseup",T.onselectionend),T.bind(T.cursor,"mouseup",T.onselectionend),T.cursorh&&T.bind(T.cursorh,"mouseup",T.onselectionend),T.bind(l,"mousemove",T.onselectiondrag)),T.zoom&&(T.jqbind(T.zoom,"mouseenter",function(){T.canshowonmouseevent&&T.showCursor(),T.rail.active=!0}),T.jqbind(T.zoom,"mouseleave",function(){T.rail.active=!1,T.rail.drag||T.hideCursor()}))),T.opt.enablemousewheel&&(T.isiframe||T.mousewheel(C.isie&&T.ispage?l:T.win,T.onmousewheel),T.mousewheel(T.rail,T.onmousewheel),T.railh&&T.mousewheel(T.railh,T.onmousewheelhr)),T.ispage||C.cantouch||/HTML|^BODY/.test(T.win[0].nodeName)||(T.win.attr("tabindex")||T.win.attr({tabindex:++r}),T.bind(T.win,"focus",function(e){o=T.getTarget(e).id||T.getTarget(e)||!1,T.hasfocus=!0,T.canshowonmouseevent&&T.noticeCursor()}),T.bind(T.win,"blur",function(e){o=!1,T.hasfocus=!1}),T.bind(T.win,"mouseenter",function(e){t=T.getTarget(e).id||T.getTarget(e)||!1,T.hasmousefocus=!0,T.canshowonmouseevent&&T.noticeCursor()}),T.bind(T.win,"mouseleave",function(e){t=!1,T.hasmousefocus=!1,T.rail.drag||T.hideCursor()})),T.onkeypress=function(e){if(T.railslocked&&0===T.page.maxh)return!0;e=e||a.event;var r=T.getTarget(e);if(r&&/INPUT|TEXTAREA|SELECT|OPTION/.test(r.nodeName)&&(!(r.getAttribute("type")||r.type||!1)||!/submit|button|cancel/i.tp))return!0;if(n(r).attr("contenteditable"))return!0;if(T.hasfocus||T.hasmousefocus&&!o||T.ispage&&!o&&!t){var i=e.keyCode;if(T.railslocked&&27!=i)return T.cancelEvent(e);var s=e.ctrlKey||!1,l=e.shiftKey||!1,c=!1;switch(i){case 38:case 63233:T.doScrollBy(72),c=!0;break;case 40:case 63235:T.doScrollBy(-72),c=!0;break;case 37:case 63232:T.railh&&(s?T.doScrollLeft(0):T.doScrollLeftBy(72),c=!0);break;case 39:case 63234:T.railh&&(s?T.doScrollLeft(T.page.maxw):T.doScrollLeftBy(-72),c=!0);break;case 33:case 63276:T.doScrollBy(T.view.h),c=!0;break;case 34:case 63277:T.doScrollBy(-T.view.h),c=!0;break;case 36:case 63273:T.railh&&s?T.doScrollPos(0,0):T.doScrollTo(0),c=!0;break;case 35:case 63275:T.railh&&s?T.doScrollPos(T.page.maxw,T.page.maxh):T.doScrollTo(T.page.maxh),c=!0;break;case 32:T.opt.spacebarenabled&&(l?T.doScrollBy(T.view.h):T.doScrollBy(-T.view.h),c=!0);break;case 27:T.zoomactive&&(T.doZoom(),c=!0)}if(c)return T.cancelEvent(e)}},T.opt.enablekeyboard&&T.bind(l,C.isopera&&!C.isopera12?"keypress":"keydown",T.onkeypress),T.bind(l,"keydown",function(e){(e.ctrlKey||!1)&&(T.wheelprevented=!0)}),T.bind(l,"keyup",function(e){e.ctrlKey||!1||(T.wheelprevented=!1)}),T.bind(a,"blur",function(e){T.wheelprevented=!1}),T.bind(a,"resize",T.lazyResize),T.bind(a,"orientationchange",T.lazyResize),T.bind(a,"load",T.lazyResize),C.ischrome&&!T.ispage&&!T.haswrapper){var M=T.win.attr("style"),L=parseFloat(T.win.css("width"))+1;T.win.css("width",L),T.synched("chromefix",function(){T.win.attr("style",M)})}T.onAttributeChange=function(e){T.lazyResize(T.isieold?250:30)},T.opt.enableobserver&&(T.isie11||!1===p||(T.observerbody=new p(function(e){if(e.forEach(function(e){if("attributes"==e.type)return k.hasClass("modal-open")&&k.hasClass("modal-dialog")&&!n.contains(n(".modal-dialog")[0],T.doc[0])?T.hide():T.show()}),T.me.clientWidth!=T.page.width||T.me.clientHeight!=T.page.height)return T.lazyResize(30)}),T.observerbody.observe(l.body,{childList:!0,subtree:!0,characterData:!1,attributes:!0,attributeFilter:["class"]})),T.ispage||T.haswrapper||(!1!==p?(T.observer=new p(function(e){e.forEach(T.onAttributeChange)}),T.observer.observe(T.win[0],{childList:!0,characterData:!1,attributes:!0,subtree:!1}),T.observerremover=new p(function(e){e.forEach(function(e){if(e.removedNodes.length>0)for(var o in e.removedNodes)if(T&&e.removedNodes[o]==T.win[0])return T.remove()})}),T.observerremover.observe(T.win[0].parentNode,{childList:!0,characterData:!1,attributes:!1,subtree:!1})):(T.bind(T.win,C.isie&&!C.isie9?"propertychange":"DOMAttrModified",T.onAttributeChange),C.isie9&&T.win[0].attachEvent("onpropertychange",T.onAttributeChange),T.bind(T.win,"DOMNodeRemoved",function(e){e.target==T.win[0]&&T.remove()})))),!T.ispage&&T.opt.boxzoom&&T.bind(a,"resize",T.resizeZoom),T.istextarea&&(T.bind(T.win,"keydown",T.lazyResize),T.bind(T.win,"mouseup",T.lazyResize)),T.lazyResize(30)}if("IFRAME"==this.doc[0].nodeName){var N=function(){T.iframexd=!1;var o;try{(o="contentDocument"in this?this.contentDocument:this.contentWindow._doc).domain}catch(e){T.iframexd=!0,o=!1}if(T.iframexd)return"console"in a&&console.log("NiceScroll error: policy restriced iframe"),!0;if(T.forcescreen=!0,T.isiframe&&(T.iframe={doc:n(o),html:T.doc.contents().find("html")[0],body:T.doc.contents().find("body")[0]},T.getContentSize=function(){return{w:Math.max(T.iframe.html.scrollWidth,T.iframe.body.scrollWidth),h:Math.max(T.iframe.html.scrollHeight,T.iframe.body.scrollHeight)}},T.docscroll=n(T.iframe.body)),!C.isios&&T.opt.iframeautoresize&&!T.isiframe){T.win.scrollTop(0),T.doc.height("");var t=Math.max(o.getElementsByTagName("html")[0].scrollHeight,o.body.scrollHeight);T.doc.height(t)}T.lazyResize(30),T.css(n(T.iframe.body),e),C.isios&&T.haswrapper&&T.css(n(o.body),{"-webkit-transform":"translate3d(0,0,0)"}),"contentWindow"in this?T.bind(this.contentWindow,"scroll",T.onscroll):T.bind(o,"scroll",T.onscroll),T.opt.enablemousewheel&&T.mousewheel(o,T.onmousewheel),T.opt.enablekeyboard&&T.bind(o,C.isopera?"keypress":"keydown",T.onkeypress),C.cantouch?(T.bind(o,"touchstart",T.ontouchstart),T.bind(o,"touchmove",T.ontouchmove)):T.opt.emulatetouch&&(T.bind(o,"mousedown",T.ontouchstart),T.bind(o,"mousemove",function(e){return T.ontouchmove(e,!0)}),T.opt.grabcursorenabled&&C.cursorgrabvalue&&T.css(n(o.body),{cursor:C.cursorgrabvalue})),T.bind(o,"mouseup",T.ontouchend),T.zoom&&(T.opt.dblclickzoom&&T.bind(o,"dblclick",T.doZoom),T.ongesturezoom&&T.bind(o,"gestureend",T.ongesturezoom))};this.doc[0].readyState&&"complete"===this.doc[0].readyState&&setTimeout(function(){N.call(T.doc[0],!1)},500),T.bind(this.doc,"load",N)}},this.showCursor=function(e,o){if(T.cursortimeout&&(clearTimeout(T.cursortimeout),T.cursortimeout=0),T.rail){if(T.autohidedom&&(T.autohidedom.stop().css({opacity:T.opt.cursoropacitymax}),T.cursoractive=!0),T.rail.drag&&1==T.rail.drag.pt||(void 0!==e&&!1!==e&&(T.scroll.y=e/T.scrollratio.y|0),void 0!==o&&(T.scroll.x=o/T.scrollratio.x|0)),T.cursor.css({height:T.cursorheight,top:T.scroll.y}),T.cursorh){var t=T.hasreversehr?T.scrollvaluemaxw-T.scroll.x:T.scroll.x;T.cursorh.css({width:T.cursorwidth,left:!T.rail.align&&T.rail.visibility?t+T.rail.width:t}),T.cursoractive=!0}T.zoom&&T.zoom.stop().css({opacity:T.opt.cursoropacitymax})}},this.hideCursor=function(e){T.cursortimeout||T.rail&&T.autohidedom&&(T.hasmousefocus&&"leave"===T.opt.autohidemode||(T.cursortimeout=setTimeout(function(){T.rail.active&&T.showonmouseevent||(T.autohidedom.stop().animate({opacity:T.opt.cursoropacitymin}),T.zoom&&T.zoom.stop().animate({opacity:T.opt.cursoropacitymin}),T.cursoractive=!1),T.cursortimeout=0},e||T.opt.hidecursordelay)))},this.noticeCursor=function(e,o,t){T.showCursor(o,t),T.rail.active||T.hideCursor(e)},this.getContentSize=T.ispage?function(){return{w:Math.max(l.body.scrollWidth,l.documentElement.scrollWidth),h:Math.max(l.body.scrollHeight,l.documentElement.scrollHeight)}}:T.haswrapper?function(){return{w:T.doc[0].offsetWidth,h:T.doc[0].offsetHeight}}:function(){return{w:T.docscroll[0].scrollWidth,h:T.docscroll[0].scrollHeight}},this.onResize=function(e,o){if(!T||!T.win)return!1;var t=T.page.maxh,r=T.page.maxw,i={h:T.view.h,w:T.view.w};if(T.view={w:T.ispage?T.win.width():T.win[0].clientWidth,h:T.ispage?T.win.height():T.win[0].clientHeight},T.page=o||T.getContentSize(),T.page.maxh=Math.max(0,T.page.h-T.view.h),T.page.maxw=Math.max(0,T.page.w-T.view.w),T.page.maxh==t&&T.page.maxw==r&&T.view.w==i.w&&T.view.h==i.h){if(T.ispage)return T;var s=T.win.offset();if(T.lastposition){var n=T.lastposition;if(n.top==s.top&&n.left==s.left)return T}T.lastposition=s}return 0===T.page.maxh?(T.hideRail(),T.scrollvaluemax=0,T.scroll.y=0,T.scrollratio.y=0,T.cursorheight=0,T.setScrollTop(0),T.rail&&(T.rail.scrollable=!1)):(T.page.maxh-=T.opt.railpadding.top+T.opt.railpadding.bottom,T.rail.scrollable=!0),0===T.page.maxw?(T.hideRailHr(),T.scrollvaluemaxw=0,T.scroll.x=0,T.scrollratio.x=0,T.cursorwidth=0,T.setScrollLeft(0),T.railh&&(T.railh.scrollable=!1)):(T.page.maxw-=T.opt.railpadding.left+T.opt.railpadding.right,T.railh&&(T.railh.scrollable=T.opt.horizrailenabled)),T.railslocked=T.locked||0===T.page.maxh&&0===T.page.maxw,T.railslocked?(T.ispage||T.updateScrollBar(T.view),!1):(T.hidden||T.visibility?!T.railh||T.hidden||T.railh.visibility||T.showRailHr():T.showRail().showRailHr(),T.istextarea&&T.win.css("resize")&&"none"!=T.win.css("resize")&&(T.view.h-=20),T.cursorheight=Math.min(T.view.h,Math.round(T.view.h*(T.view.h/T.page.h))),T.cursorheight=T.opt.cursorfixedheight?T.opt.cursorfixedheight:Math.max(T.opt.cursorminheight,T.cursorheight),T.cursorwidth=Math.min(T.view.w,Math.round(T.view.w*(T.view.w/T.page.w))),T.cursorwidth=T.opt.cursorfixedheight?T.opt.cursorfixedheight:Math.max(T.opt.cursorminheight,T.cursorwidth),T.scrollvaluemax=T.view.h-T.cursorheight-(T.opt.railpadding.top+T.opt.railpadding.bottom),T.hasborderbox||(T.scrollvaluemax-=T.cursor[0].offsetHeight-T.cursor[0].clientHeight),T.railh&&(T.railh.width=T.page.maxh>0?T.view.w-T.rail.width:T.view.w,T.scrollvaluemaxw=T.railh.width-T.cursorwidth-(T.opt.railpadding.left+T.opt.railpadding.right)),T.ispage||T.updateScrollBar(T.view),T.scrollratio={x:T.page.maxw/T.scrollvaluemaxw,y:T.page.maxh/T.scrollvaluemax},T.getScrollTop()>T.page.maxh?T.doScrollTop(T.page.maxh):(T.scroll.y=T.getScrollTop()/T.scrollratio.y|0,T.scroll.x=T.getScrollLeft()/T.scrollratio.x|0,T.cursoractive&&T.noticeCursor()),T.scroll.y&&0===T.getScrollTop()&&T.doScrollTo(Math.floor(T.scroll.y*T.scrollratio.y)),T)},this.resize=T.onResize,this.hlazyresize=0,this.lazyResize=function(e){T.hlazyresize&&clearTimeout(T.hlazyresize);var o=!T.ispage&&!T.haswrapper;return o&&T.hideRails(),T.hlazyresize=setTimeout(function(){T&&(o&&T.showRails(),T.resize())},240),T},this.jqbind=function(e,o,t){T.events.push({e:e,n:o,f:t,q:!0}),n(e).on(o,t)},this.mousewheel=function(e,o,t){var r="jquery"in e?e[0]:e;if("onwheel"in l.createElement("div"))T._bind(r,"wheel",o,t||!1);else{var i=void 0!==l.onmousewheel?"mousewheel":"DOMMouseScroll";x(r,i,o,t||!1),"DOMMouseScroll"==i&&x(r,"MozMousePixelScroll",o,t||!1)}};var _=!1;if(C.haseventlistener){try{var H=Object.defineProperty({},"passive",{get:function(){_=!0}});a.addEventListener("test",null,H)}catch(e){}this.cancelEvent=function(e){return!!e&&((e=e.original?e.original:e).cancelable&&e.preventDefault(),e.stopPropagation(),e.preventManipulation&&e.preventManipulation(),!1)},this.stopPropagation=function(e){return!!e&&((e=e.original?e.original:e).stopPropagation(),!1)}}else Event.prototype.preventDefault=function(){this.returnValue=!1},Event.prototype.stopPropagation=function(){this.cancelBubble=!0},a.constructor.prototype.addEventListener=l.constructor.prototype.addEventListener=Element.prototype.addEventListener=function(e,o,t){this.attachEvent("on"+e,o)},a.constructor.prototype.removeEventListener=l.constructor.prototype.removeEventListener=Element.prototype.removeEventListener=function(e,o,t){this.detachEvent("on"+e,o)},this.cancelEvent=function(e){return!!(e=e||a.event)&&(e.cancelBubble=!0,e.cancel=!0,e.returnValue=!1,!1)},this.stopPropagation=function(e){return(e=e||a.event)&&(e.cancelBubble=!0),!1};this.bind=function(e,o,t,r,i){var s="jquery"in e?e[0]:e;T._bind(s,o,t,r||!1,i||!1)},this._bind=function(e,o,t,r,i){T.events.push({e:e,n:o,f:t,b:r,q:!1}),_&&i?e.addEventListener(o,t,{passive:!1,capture:r}):e.addEventListener(o,t,r||!1)},this._unbind=function(e,o,t,r){e.removeEventListener(o,t,r)},this.unbindAll=function(){for(var e=0;e0)return t;o=!!o.parentNode&&o.parentNode}return!1},this.triggerScrollStart=function(e,o,t,r,i){if(T.onscrollstart){var s={type:"scrollstart",current:{x:e,y:o},request:{x:t,y:r},end:{x:T.newscrollx,y:T.newscrolly},speed:i};T.onscrollstart.call(T,s)}},this.triggerScrollEnd=function(){if(T.onscrollend){var e=T.getScrollLeft(),o=T.getScrollTop(),t={type:"scrollend",current:{x:e,y:o},end:{x:e,y:o}};T.onscrollend.call(T,t)}};var I=0,O=0,Y=0,B=1,X=!1;if(this.onmousewheel=function(e){if(!T.wheelprevented){if(T.railslocked)return T.debounced("checkunlock",T.resize,250),!0;if(T.rail.drag)return T.cancelEvent(e);if("auto"===T.opt.oneaxismousemode&&0!==e.deltaX&&(T.opt.oneaxismousemode=!1),T.opt.oneaxismousemode&&0===e.deltaX&&!T.rail.scrollable)return!T.railh||!T.railh.scrollable||T.onmousewheelhr(e);var o=m(),t=!1;if(T.opt.preservenativescrolling&&T.checkarea+600T.page.maxh&&(o=T.page.maxh+(o-T.page.maxh)/2|0),e<0?e=e/2|0:e>T.page.maxw&&(e=T.page.maxw+(o-T.page.maxw)/2|0)):(o<0?o=0:o>T.page.maxh&&(o=T.page.maxh),e<0?e=0:e>T.page.maxw&&(e=T.page.maxw)),T.scrollrunning&&e==T.newscrollx&&o==T.newscrolly)return!1;T.newscrolly=o,T.newscrollx=e;var s=T.getScrollTop(),n=T.getScrollLeft(),l={};l.x=e-n,l.y=o-s;var a=0|Math.sqrt(l.x*l.x+l.y*l.y),c=T.prepareTransition(a);T.scrollrunning||(T.scrollrunning=!0,T.triggerScrollStart(n,s,e,o,c),T.cursorupdate.start()),T.scrollendtrapped=!0,C.transitionend||(T.scrollendtrapped&&clearTimeout(T.scrollendtrapped),T.scrollendtrapped=setTimeout(T.onScrollTransitionEnd,c)),T.setScrollTop(T.newscrolly),T.setScrollLeft(T.newscrollx)},this.cancelScroll=function(){if(!T.scrollendtrapped)return!0;var e=T.getScrollTop(),o=T.getScrollLeft();return T.scrollrunning=!1,C.transitionend||clearTimeout(C.transitionend),T.scrollendtrapped=!1,T.resetTransition(),T.setScrollTop(e),T.railh&&T.setScrollLeft(o),T.timerscroll&&T.timerscroll.tm&&clearInterval(T.timerscroll.tm),T.timerscroll=!1,T.cursorfreezed=!1,T.cursorupdate.stop(),T.showCursor(e,o),T},this.onScrollTransitionEnd=function(){if(T.scrollendtrapped){var e=T.getScrollTop(),o=T.getScrollLeft();if(e<0?e=0:e>T.page.maxh&&(e=T.page.maxh),o<0?o=0:o>T.page.maxw&&(o=T.page.maxw),e!=T.newscrolly||o!=T.newscrollx)return T.doScrollPos(o,e,T.opt.snapbackspeed);T.scrollrunning&&T.triggerScrollEnd(),T.scrollrunning=!1,T.scrollendtrapped=!1,T.resetTransition(),T.timerscroll=!1,T.setScrollTop(e),T.railh&&T.setScrollLeft(o),T.cursorupdate.stop(),T.noticeCursor(!1,e,o),T.cursorfreezed=!1}}}else this.doScrollLeft=function(e,o){var t=T.scrollrunning?T.newscrolly:T.getScrollTop();T.doScrollPos(e,t,o)},this.doScrollTop=function(e,o){var t=T.scrollrunning?T.newscrollx:T.getScrollLeft();T.doScrollPos(t,e,o)},this.doScrollPos=function(e,o,t){var r=T.getScrollTop(),i=T.getScrollLeft();((T.newscrolly-r)*(o-r)<0||(T.newscrollx-i)*(e-i)<0)&&T.cancelScroll();var s=!1;if(T.bouncescroll&&T.rail.visibility||(o<0?(o=0,s=!0):o>T.page.maxh&&(o=T.page.maxh,s=!0)),T.bouncescroll&&T.railh.visibility||(e<0?(e=0,s=!0):e>T.page.maxw&&(e=T.page.maxw,s=!0)),T.scrollrunning&&T.newscrolly===o&&T.newscrollx===e)return!0;T.newscrolly=o,T.newscrollx=e,T.dst={},T.dst.x=e-i,T.dst.y=o-r,T.dst.px=i,T.dst.py=r;var n=0|Math.sqrt(T.dst.x*T.dst.x+T.dst.y*T.dst.y),l=T.getTransitionSpeed(n);T.bzscroll={};var a=s?1:.58;T.bzscroll.x=new N(i,T.newscrollx,l,0,0,a,1),T.bzscroll.y=new N(r,T.newscrolly,l,0,0,a,1);var c=function(){if(T.scrollrunning){var e=T.bzscroll.y.getPos();T.setScrollLeft(T.bzscroll.x.getNow()),T.setScrollTop(T.bzscroll.y.getNow()),e<=1?d(c):(T.scrollrunning=!1,T.timer=0,T.triggerScrollEnd())}};T.scrollrunning||(T.triggerScrollStart(i,r,e,o,l),T.scrollrunning=!0,T.timer=d(c))},this.cancelScroll=function(){return T.timer&&u(T.timer),T.timer=0,T.bzscroll=!1,T.scrollrunning=!1,T};else this.doScrollLeft=function(e,o){var t=T.getScrollTop();T.doScrollPos(e,t,o)},this.doScrollTop=function(e,o){var t=T.getScrollLeft();T.doScrollPos(t,e,o)},this.doScrollPos=function(e,o,t){var r=e>T.page.maxw?T.page.maxw:e;r<0&&(r=0);var i=o>T.page.maxh?T.page.maxh:o;i<0&&(i=0),T.synched("scroll",function(){T.setScrollTop(i),T.setScrollLeft(r)})},this.cancelScroll=function(){};this.doScrollBy=function(e,o){S(0,e)},this.doScrollLeftBy=function(e,o){S(e,0)},this.doScrollTo=function(e,o){var t=o?Math.round(e*T.scrollratio.y):e;t<0?t=0:t>T.page.maxh&&(t=T.page.maxh),T.cursorfreezed=!1,T.doScrollTop(e)},this.checkContentSize=function(){var e=T.getContentSize();e.h==T.page.h&&e.w==T.page.w||T.resize(!1,e)},T.onscroll=function(e){T.rail.drag||T.cursorfreezed||T.synched("scroll",function(){T.scroll.y=Math.round(T.getScrollTop()/T.scrollratio.y),T.railh&&(T.scroll.x=Math.round(T.getScrollLeft()/T.scrollratio.x)),T.noticeCursor()})},T.bind(T.docscroll,"scroll",T.onscroll),this.doZoomIn=function(e){if(!T.zoomactive){T.zoomactive=!0,T.zoomrestore={style:{}};var o=["position","top","left","zIndex","backgroundColor","marginTop","marginBottom","marginLeft","marginRight"],t=T.win[0].style;for(var r in o){var i=o[r];T.zoomrestore.style[i]=void 0!==t[i]?t[i]:""}T.zoomrestore.style.width=T.win.css("width"),T.zoomrestore.style.height=T.win.css("height"),T.zoomrestore.padding={w:T.win.outerWidth()-T.win.width(),h:T.win.outerHeight()-T.win.height()},C.isios4&&(T.zoomrestore.scrollTop=c.scrollTop(),c.scrollTop(0)),T.win.css({position:C.isios4?"absolute":"fixed",top:0,left:0,zIndex:s+100,margin:0});var n=T.win.css("backgroundColor");return(""===n||/transparent|rgba\(0, 0, 0, 0\)|rgba\(0,0,0,0\)/.test(n))&&T.win.css("backgroundColor","#fff"),T.rail.css({zIndex:s+101}),T.zoom.css({zIndex:s+102}),T.zoom.css("backgroundPosition","0 -18px"),T.resizeZoom(),T.onzoomin&&T.onzoomin.call(T),T.cancelEvent(e)}},this.doZoomOut=function(e){if(T.zoomactive)return T.zoomactive=!1,T.win.css("margin",""),T.win.css(T.zoomrestore.style),C.isios4&&c.scrollTop(T.zoomrestore.scrollTop),T.rail.css({"z-index":T.zindex}),T.zoom.css({"z-index":T.zindex}),T.zoomrestore=!1,T.zoom.css("backgroundPosition","0 0"),T.onResize(),T.onzoomout&&T.onzoomout.call(T),T.cancelEvent(e)},this.doZoom=function(e){return T.zoomactive?T.doZoomOut(e):T.doZoomIn(e)},this.resizeZoom=function(){if(T.zoomactive){var e=T.getScrollTop();T.win.css({width:c.width()-T.zoomrestore.padding.w+"px",height:c.height()-T.zoomrestore.padding.h+"px"}),T.onResize(),T.setScrollTop(Math.min(T.page.maxh,e))}},this.init(),n.nicescroll.push(this)},b=function(e){var o=this;this.nc=e,this.lastx=0,this.lasty=0,this.speedx=0,this.speedy=0,this.lasttime=0,this.steptime=0,this.snapx=!1,this.snapy=!1,this.demulx=0,this.demuly=0,this.lastscrollx=-1,this.lastscrolly=-1,this.chkx=0,this.chky=0,this.timer=0,this.reset=function(e,t){o.stop(),o.steptime=0,o.lasttime=m(),o.speedx=0,o.speedy=0,o.lastx=e,o.lasty=t,o.lastscrollx=-1,o.lastscrolly=-1},this.update=function(e,t){var r=m();o.steptime=r-o.lasttime,o.lasttime=r;var i=t-o.lasty,s=e-o.lastx,n=o.nc.getScrollTop()+i,l=o.nc.getScrollLeft()+s;o.snapx=l<0||l>o.nc.page.maxw,o.snapy=n<0||n>o.nc.page.maxh,o.speedx=s,o.speedy=i,o.lastx=e,o.lasty=t},this.stop=function(){o.nc.unsynched("domomentum2d"),o.timer&&clearTimeout(o.timer),o.timer=0,o.lastscrollx=-1,o.lastscrolly=-1},this.doSnapy=function(e,t){var r=!1;t<0?(t=0,r=!0):t>o.nc.page.maxh&&(t=o.nc.page.maxh,r=!0),e<0?(e=0,r=!0):e>o.nc.page.maxw&&(e=o.nc.page.maxw,r=!0),r?o.nc.doScrollPos(e,t,o.nc.opt.snapbackspeed):o.nc.triggerScrollEnd()},this.doMomentum=function(e){var t=m(),r=e?t+e:o.lasttime,i=o.nc.getScrollLeft(),s=o.nc.getScrollTop(),n=o.nc.page.maxh,l=o.nc.page.maxw;o.speedx=l>0?Math.min(60,o.speedx):0,o.speedy=n>0?Math.min(60,o.speedy):0;var a=r&&t-r<=60;(s<0||s>n||i<0||i>l)&&(a=!1);var c=!(!o.speedy||!a)&&o.speedy,d=!(!o.speedx||!a)&&o.speedx;if(c||d){var u=Math.max(16,o.steptime);if(u>50){var h=u/50;o.speedx*=h,o.speedy*=h,u=50}o.demulxy=0,o.lastscrollx=o.nc.getScrollLeft(),o.chkx=o.lastscrollx,o.lastscrolly=o.nc.getScrollTop(),o.chky=o.lastscrolly;var p=o.lastscrollx,f=o.lastscrolly,g=function(){var e=m()-t>600?.04:.02;o.speedx&&(p=Math.floor(o.lastscrollx-o.speedx*(1-o.demulxy)),o.lastscrollx=p,(p<0||p>l)&&(e=.1)),o.speedy&&(f=Math.floor(o.lastscrolly-o.speedy*(1-o.demulxy)),o.lastscrolly=f,(f<0||f>n)&&(e=.1)),o.demulxy=Math.min(1,o.demulxy+e),o.nc.synched("domomentum2d",function(){if(o.speedx){o.nc.getScrollLeft();o.chkx=p,o.nc.setScrollLeft(p)}if(o.speedy){o.nc.getScrollTop();o.chky=f,o.nc.setScrollTop(f)}o.timer||(o.nc.hideCursor(),o.doSnapy(p,f))}),o.demulxy<1?o.timer=setTimeout(g,u):(o.stop(),o.nc.hideCursor(),o.doSnapy(p,f))};g()}else o.doSnapy(o.nc.getScrollLeft(),o.nc.getScrollTop())}},y=e.fn.scrollTop;e.cssHooks.pageYOffset={get:function(e,o,t){var r=n.data(e,"__nicescroll")||!1;return r&&r.ishwscroll?r.getScrollTop():y.call(e)},set:function(e,o){var t=n.data(e,"__nicescroll")||!1;return t&&t.ishwscroll?t.setScrollTop(parseInt(o)):y.call(e,o),this}},e.fn.scrollTop=function(e){if(void 0===e){var o=!!this[0]&&(n.data(this[0],"__nicescroll")||!1);return o&&o.ishwscroll?o.getScrollTop():y.call(this)}return this.each(function(){var o=n.data(this,"__nicescroll")||!1;o&&o.ishwscroll?o.setScrollTop(parseInt(e)):y.call(n(this),e)})};var x=e.fn.scrollLeft;n.cssHooks.pageXOffset={get:function(e,o,t){var r=n.data(e,"__nicescroll")||!1;return r&&r.ishwscroll?r.getScrollLeft():x.call(e)},set:function(e,o){var t=n.data(e,"__nicescroll")||!1;return t&&t.ishwscroll?t.setScrollLeft(parseInt(o)):x.call(e,o),this}},e.fn.scrollLeft=function(e){if(void 0===e){var o=!!this[0]&&(n.data(this[0],"__nicescroll")||!1);return o&&o.ishwscroll?o.getScrollLeft():x.call(this)}return this.each(function(){var o=n.data(this,"__nicescroll")||!1;o&&o.ishwscroll?o.setScrollLeft(parseInt(e)):x.call(n(this),e)})};var S=function(e){var o=this;if(this.length=0,this.name="nicescrollarray",this.each=function(e){return n.each(o,e),o},this.push=function(e){o[o.length]=e,o.length++},this.eq=function(e){return o[e]},e)for(var t=0;t1?n(e,r):s,i.win=r}!("doc"in i)||"win"in i||(i.win=r);var l=r.data("__nicescroll")||!1;l||(i.doc=i.doc||r,l=new w(i,r),r.data("__nicescroll",l)),t.push(l)}),1===t.length?t[0]:t},a.NiceScroll={getjQuery:function(){return e}},n.nicescroll||(n.nicescroll=new S,n.nicescroll.options=f)}); \ No newline at end of file From 6ec6ee204eb5bfb1b647066cded59cf7f3971c5d Mon Sep 17 00:00:00 2001 From: InuYaksa Date: Fri, 30 Jun 2017 15:53:02 +0200 Subject: [PATCH 06/14] RC5 - touch fixes and prevent bar flickering - some fixes and optimization to scrolling on touch devices - prevent bar flickering when window not changed aka -Using this plugin I got a flickering scroll bar #674 --- changelog_3.7.4.txt | 2 + jquery.nicescroll.js | 494 +++++++++++++++++++++++---------------- jquery.nicescroll.min.js | 2 +- 3 files changed, 301 insertions(+), 197 deletions(-) diff --git a/changelog_3.7.4.txt b/changelog_3.7.4.txt index 2db2419..4ee1c25 100644 --- a/changelog_3.7.4.txt +++ b/changelog_3.7.4.txt @@ -8,6 +8,8 @@ Fixes - touchpad scrolling support for MS Surface aka FYI - Browser test results on Surface Pro touchscreen and touchpad #668 - changed scrollbarid setting procedure because uglify mades uncompatible code for IE8 aka use nicescroll in IE8 #672 - preserve scrol chain +- page scrollbar not customized on android +- prevent bar flickering when window not changed aka Using this plugin I got a flickering scroll bar #674 Changes - more responsive direct scrolling from bars diff --git a/jquery.nicescroll.js b/jquery.nicescroll.js index 1b92bb9..c601375 100644 --- a/jquery.nicescroll.js +++ b/jquery.nicescroll.js @@ -1,5 +1,5 @@ /* jquery.nicescroll --- version 3.7.4-e [DEV REL] +-- version 3.7.4-f [DEV REL] -- copyright 2017-06-18 InuYaksa*2017 -- licensed under the MIT -- @@ -8,6 +8,8 @@ -- */ +/* jshint expr: true */ + (function (factory) { if (typeof define === 'function' && define.amd) { // AMD. Register as anonymous module. @@ -30,11 +32,13 @@ ascrailcounter = 2000, globalmaxzindex = 0; - var $ = jQuery, // sandboxes + var $ = jQuery, // sandbox _doc = document, _win = window, $window = $(_win); + var delegatevents = []; + // http://stackoverflow.com/questions/2161159/get-script-path function getScriptPath() { var scripts = _doc.currentScript || (function () { var s = _doc.getElementsByTagName('script'); return (s.length) ? s[s.length - 1] : false; })(); @@ -258,36 +262,36 @@ var self = this; - this.version = '3.7.4-e'; + this.version = '3.7.4-f'; this.name = 'nicescroll'; this.me = me; var $body = $("body"); - this.opt = { + var opt = this.opt = { doc: $body, win: false }; - $.extend(this.opt, _globaloptions); // clone opts + $.extend(opt, _globaloptions); // clone opts // Options for internal use - this.opt.snapbackspeed = 80; + opt.snapbackspeed = 80; if (myopt || false) { - for (var a in self.opt) { - if (myopt[a] !== undefined) self.opt[a] = myopt[a]; + for (var a in opt) { + if (myopt[a] !== undefined) opt[a] = myopt[a]; } } - if (self.opt.disablemutationobserver) ClsMutationObserver = false; + if (opt.disablemutationobserver) ClsMutationObserver = false; - this.doc = self.opt.doc; + this.doc = opt.doc; this.iddoc = (this.doc && this.doc[0]) ? this.doc[0].id || '' : ''; - this.ispage = /^BODY|HTML/.test((self.opt.win) ? self.opt.win[0].nodeName : this.doc[0].nodeName); - this.haswrapper = (self.opt.win !== false); - this.win = self.opt.win || (this.ispage ? $window : this.doc); + this.ispage = /^BODY|HTML/.test((opt.win) ? opt.win[0].nodeName : this.doc[0].nodeName); + this.haswrapper = (opt.win !== false); + this.win = opt.win || (this.ispage ? $window : this.doc); this.docscroll = (this.ispage && !this.haswrapper) ? $window : this.win; this.body = $body; this.viewport = false; @@ -301,7 +305,7 @@ this.forcescreen = false; //force to use screen position on events - this.canshowonmouseevent = (self.opt.autohidemode != "scroll"); + this.canshowonmouseevent = (opt.autohidemode != "scroll"); // Events jump table this.onmousedown = false; @@ -337,7 +341,7 @@ // http://dev.w3.org/csswg/css-writing-modes-3/#logical-to-physical // http://dev.w3.org/csswg/css-writing-modes-3/#svg-writing-mode - if (this.opt.rtlmode == "auto") { + if (opt.rtlmode == "auto") { var target = this.win[0] == _win ? this.body : this.win; var writingMode = target.css("writing-mode") || target.css("-webkit-writing-mode") || target.css("-ms-writing-mode") || target.css("-moz-writing-mode"); @@ -349,7 +353,7 @@ this.isvertical = (writingMode == "vertical-rl" || writingMode == "tb" || writingMode == "tb-rl"); } } else { - this.isrtlmode = (this.opt.rtlmode === true); + this.isrtlmode = (opt.rtlmode === true); this.isvertical = false; } // this.checkrtlmode = false; @@ -362,8 +366,8 @@ this.observerremover = false; // observer on parent for remove detection this.observerbody = false; // observer on body for position change - if (self.opt.scrollbarid !== false) { - this.id = self.opt.scrollbarid; + if (opt.scrollbarid !== false) { + this.id = opt.scrollbarid; } else { do { this.id = "ascrail" + (ascrailcounter++); @@ -389,8 +393,8 @@ this.wheelprevented = false; //prevent mousewheel event - this.overflowx = self.opt.overflowx; - this.overflowy = self.opt.overflowy; + this.overflowx = opt.overflowx; + this.overflowy = opt.overflowy; this.nativescrollingarea = false; this.checkarea = 0; @@ -409,7 +413,7 @@ var cap = $.extend({}, this.detected); - this.canhwscroll = (cap.hastransform && self.opt.hwacceleration); + this.canhwscroll = (cap.hastransform && opt.hwacceleration); this.ishwscroll = (this.canhwscroll && self.haswrapper); if (!this.isrtlmode) { @@ -433,7 +437,7 @@ } //## disable MouseLock API on user request - if (!self.opt.enablemouselockapi) { + if (!opt.enablemouselockapi) { cap.hasmousecapture = false; cap.haspointerlock = false; } @@ -579,7 +583,7 @@ var cxscrollleft = (this.isrtlmode) ? 1 : -1; - if (cap.hastranslate3d && self.opt.enabletranslate3d) { + if (cap.hastranslate3d && opt.enabletranslate3d) { this.setScrollTop = function (val, silent) { self.doc.translate.y = val; self.doc.translate.ty = (val * -1) + "px"; @@ -716,21 +720,21 @@ var pos, off; if (self.ishwscroll) { self.rail.css({ //** - height: self.win.innerHeight() - (self.opt.railpadding.top + self.opt.railpadding.bottom) + height: self.win.innerHeight() - (opt.railpadding.top + opt.railpadding.bottom) }); if (self.railh) self.railh.css({ //** - width: self.win.innerWidth() - (self.opt.railpadding.left + self.opt.railpadding.right) + width: self.win.innerWidth() - (opt.railpadding.left + opt.railpadding.right) }); } else { var wpos = self.getOffset(); pos = { top: wpos.top, - left: wpos.left - (self.opt.railpadding.left + self.opt.railpadding.right) + left: wpos.left - (opt.railpadding.left + opt.railpadding.right) }; pos.top += getWidthToPixel(self.win, 'border-top-width', true); pos.left += (self.rail.align) ? self.win.outerWidth() - getWidthToPixel(self.win, 'border-right-width') - self.rail.width : getWidthToPixel(self.win, 'border-left-width'); - off = self.opt.railoffset; + off = opt.railoffset; if (off) { if (off.top) pos.top += off.top; if (off.left) pos.left += off.left; @@ -739,7 +743,7 @@ if (!self.railslocked) self.rail.css({ top: pos.top, left: pos.left, - height: ((len) ? len.h : self.win.innerHeight()) - (self.opt.railpadding.top + self.opt.railpadding.bottom) + height: ((len) ? len.h : self.win.innerHeight()) - (opt.railpadding.top + opt.railpadding.bottom) }); if (self.zoom) { @@ -754,7 +758,7 @@ top: wpos.top, left: wpos.left }; - off = self.opt.railhoffset; + off = opt.railhoffset; if (off) { if (off.top) pos.top += off.top; if (off.left) pos.left += off.left; @@ -762,7 +766,7 @@ var y = (self.railh.align) ? pos.top + getWidthToPixel(self.win, 'border-top-width', true) + self.win.innerHeight() - self.railh.height : pos.top + getWidthToPixel(self.win, 'border-top-width', true); var x = pos.left + getWidthToPixel(self.win, 'border-left-width'); self.railh.css({ - top: y - (self.opt.railpadding.top + self.opt.railpadding.bottom), + top: y - (opt.railpadding.top + opt.railpadding.bottom), left: x, width: self.railh.width }); @@ -810,7 +814,7 @@ if (cap.isoperamini) return true; // SORRY, DO NOT WORK! if (cap.isandroid && !("hidden" in _doc)) return true; // Android 3- SORRY, DO NOT WORK! - self.opt.emulatetouch = self.opt.emulatetouch || self.opt.touchbehavior; // mantain compatibility with "touchbehavior" + opt.emulatetouch = opt.emulatetouch || opt.touchbehavior; // mantain compatibility with "touchbehavior" self.hasborderbox = _win.getComputedStyle && (_win.getComputedStyle(_doc.body)['box-sizing'] === "border-box"); @@ -823,21 +827,21 @@ } self.zindex = "auto"; - if (!self.ispage && self.opt.zindex == "auto") { + if (!self.ispage && opt.zindex == "auto") { self.zindex = getZIndex() || "auto"; } else { - self.zindex = self.opt.zindex; + self.zindex = opt.zindex; } if (!self.ispage && self.zindex != "auto" && self.zindex > globalmaxzindex) { globalmaxzindex = self.zindex; } - if (self.isie && self.zindex === 0 && self.opt.zindex == "auto") { // fix IE auto == 0 + if (self.isie && self.zindex === 0 && opt.zindex == "auto") { // fix IE auto == 0 self.zindex = "auto"; } - if (!self.ispage || (!cap.cantouch && !cap.isieold)) { + if (!self.ispage || !cap.isieold) { var cont = self.docscroll; if (self.ispage) cont = (self.haswrapper) ? self.win : self.doc; @@ -857,14 +861,14 @@ position: "relative", top: 0, "float": "right", - width: self.opt.cursorwidth, + width: opt.cursorwidth, height: 0, - 'background-color': self.opt.cursorcolor, - border: self.opt.cursorborder, + 'background-color': opt.cursorcolor, + border: opt.cursorborder, 'background-clip': 'padding-box', - '-webkit-border-radius': self.opt.cursorborderradius, - '-moz-border-radius': self.opt.cursorborderradius, - 'border-radius': self.opt.cursorborderradius + '-webkit-border-radius': opt.cursorborderradius, + '-moz-border-radius': opt.cursorborderradius, + 'border-radius': opt.cursorborderradius }); cursor.addClass('nicescroll-cursors'); @@ -878,52 +882,52 @@ var v, a, kp = ["left", "right", "top", "bottom"]; //** for (var n in kp) { a = kp[n]; - v = self.opt.railpadding[a] || 0; + v = opt.railpadding[a] || 0; v && rail.css("padding-" + a, v + "px"); } rail.append(cursor); - rail.width = Math.max(parseFloat(self.opt.cursorwidth), cursor.outerWidth()); + rail.width = Math.max(parseFloat(opt.cursorwidth), cursor.outerWidth()); rail.css({ width: rail.width + "px", zIndex: self.zindex, - background: self.opt.background, + background: opt.background, cursor: "default" }); rail.visibility = true; rail.scrollable = true; - rail.align = (self.opt.railalign == "left") ? 0 : 1; + rail.align = (opt.railalign == "left") ? 0 : 1; self.rail = rail; self.rail.drag = false; var zoom = false; - if (self.opt.boxzoom && !self.ispage && !cap.isieold) { + if (opt.boxzoom && !self.ispage && !cap.isieold) { zoom = _doc.createElement('div'); self.bind(zoom, "click", self.doZoom); self.bind(zoom, "mouseenter", function () { - self.zoom.css('opacity', self.opt.cursoropacitymax); + self.zoom.css('opacity', opt.cursoropacitymax); }); self.bind(zoom, "mouseleave", function () { - self.zoom.css('opacity', self.opt.cursoropacitymin); + self.zoom.css('opacity', opt.cursoropacitymin); }); self.zoom = $(zoom); self.zoom.css({ cursor: "pointer", zIndex: self.zindex, - backgroundImage: 'url(' + self.opt.scriptpath + 'zoomico.png)', + backgroundImage: 'url(' + opt.scriptpath + 'zoomico.png)', height: 18, width: 18, backgroundPosition: '0 0' }); - if (self.opt.dblclickzoom) self.bind(self.win, "dblclick", self.doZoom); - if (cap.cantouch && self.opt.gesturezoom) { + if (opt.dblclickzoom) self.bind(self.win, "dblclick", self.doZoom); + if (cap.cantouch && opt.gesturezoom) { self.ongesturezoom = function (e) { if (e.scale > 1.5) self.doZoomIn(e); if (e.scale < 0.8) self.doZoomOut(e); @@ -938,7 +942,7 @@ self.railh = false; var railh; - if (self.opt.horizrailenabled) { + if (opt.horizrailenabled) { self.css(cont, { overflowX: 'hidden' @@ -948,14 +952,14 @@ cursor.css({ position: "absolute", top: 0, - height: self.opt.cursorwidth, + height: opt.cursorwidth, width: 0, - backgroundColor: self.opt.cursorcolor, - border: self.opt.cursorborder, + backgroundColor: opt.cursorcolor, + border: opt.cursorborder, backgroundClip: 'padding-box', - '-webkit-border-radius': self.opt.cursorborderradius, - '-moz-border-radius': self.opt.cursorborderradius, - 'border-radius': self.opt.cursorborderradius + '-webkit-border-radius': opt.cursorborderradius, + '-moz-border-radius': opt.cursorborderradius, + 'border-radius': opt.cursorborderradius }); if (cap.isieold) cursor.css('overflow', 'hidden'); //IE6 horiz scrollbar issue @@ -969,11 +973,11 @@ railh = $(_doc.createElement('div')); railh.attr('id', self.id + '-hr'); railh.addClass('nicescroll-rails nicescroll-rails-hr'); - railh.height = Math.max(parseFloat(self.opt.cursorwidth), cursor.outerHeight()); + railh.height = Math.max(parseFloat(opt.cursorwidth), cursor.outerHeight()); railh.css({ height: railh.height + "px", 'zIndex': self.zindex, - "background": self.opt.background + "background": opt.background }); railh.append(cursor); @@ -981,7 +985,7 @@ railh.visibility = true; railh.scrollable = true; - railh.align = (self.opt.railvalign == "top") ? 0 : 1; + railh.align = (opt.railvalign == "top") ? 0 : 1; self.railh = railh; @@ -992,6 +996,7 @@ // if (self.ispage) { + rail.css({ position: "fixed", top: 0, @@ -1075,37 +1080,37 @@ '-webkit-touch-callout': 'none' }); // prevent grey layer on click - if (cap.isie && self.opt.disableoutline) self.win.attr("hideFocus", "true"); // IE, prevent dotted rectangle on focused div - if (cap.iswebkit && self.opt.disableoutline) self.win.css('outline', 'none'); // Webkit outline + if (cap.isie && opt.disableoutline) self.win.attr("hideFocus", "true"); // IE, prevent dotted rectangle on focused div + if (cap.iswebkit && opt.disableoutline) self.win.css('outline', 'none'); // Webkit outline } - if (self.opt.autohidemode === false) { + if (opt.autohidemode === false) { self.autohidedom = false; self.rail.css({ - opacity: self.opt.cursoropacitymax + opacity: opt.cursoropacitymax }); if (self.railh) self.railh.css({ - opacity: self.opt.cursoropacitymax + opacity: opt.cursoropacitymax }); - } else if ((self.opt.autohidemode === true) || (self.opt.autohidemode === "leave")) { + } else if ((opt.autohidemode === true) || (opt.autohidemode === "leave")) { self.autohidedom = $().add(self.rail); if (cap.isie8) self.autohidedom = self.autohidedom.add(self.cursor); if (self.railh) self.autohidedom = self.autohidedom.add(self.railh); if (self.railh && cap.isie8) self.autohidedom = self.autohidedom.add(self.cursorh); - } else if (self.opt.autohidemode == "scroll") { + } else if (opt.autohidemode == "scroll") { self.autohidedom = $().add(self.rail); if (self.railh) self.autohidedom = self.autohidedom.add(self.railh); - } else if (self.opt.autohidemode == "cursor") { + } else if (opt.autohidemode == "cursor") { self.autohidedom = $().add(self.cursor); if (self.railh) self.autohidedom = self.autohidedom.add(self.cursorh); - } else if (self.opt.autohidemode == "hidden") { + } else if (opt.autohidemode == "hidden") { self.autohidedom = false; self.hide(); self.railslocked = false; } - if (cap.cantouch || self.istouchcapable || self.opt.emulatetouch || cap.hasmstouch) { + if (cap.cantouch || self.istouchcapable || opt.emulatetouch || cap.hasmstouch) { self.scrollmom = new ScrollMomentumClass2D(self); @@ -1116,6 +1121,11 @@ self.hasmoving = false; + if (self.scrollmom.timer) { + self.triggerScrollEnd(); + self.scrollmom.stop(); + } + if (!self.railslocked) { var tg; if (cap.hasmstouch) { @@ -1129,9 +1139,7 @@ } } - e.stopPropagation(); - - self.cancelScroll(); + //e.stopPropagation(); tg = self.getTarget(e); @@ -1166,7 +1174,7 @@ tg: tg }; - if (self.ispage || !self.opt.directionlockdeadzone) { + if (self.ispage || !opt.directionlockdeadzone) { self.rail.drag.dl = "f"; @@ -1185,13 +1193,13 @@ var maxh = Math.max(0, page.h - view.h); var maxw = Math.max(0, page.w - view.w); - if (!self.rail.scrollable && self.railh.scrollable) self.rail.drag.ck = (maxh > 0) ? "v" : false; - else if (self.rail.scrollable && !self.railh.scrollable) self.rail.drag.ck = (maxw > 0) ? "h" : false; + if (self.rail.scrollable && !self.railh.scrollable) self.rail.drag.ck = (maxh > 0) ? "v" : false; + else if (!self.rail.scrollable && self.railh.scrollable) self.rail.drag.ck = (maxw > 0) ? "h" : false; else self.rail.drag.ck = false; - //if (!self.rail.drag.ck) self.rail.drag.dl = "f"; + } - if (self.opt.emulatetouch && self.isiframe && cap.isie) { + if (opt.emulatetouch && self.isiframe && cap.isie) { var wp = self.win.position(); self.rail.drag.x += wp.left; self.rail.drag.y += wp.top; @@ -1206,7 +1214,7 @@ var ip = (tg) ? /INPUT|SELECT|BUTTON|TEXTAREA/i.test(tg.nodeName) : false; if (!ip) { if (!self.ispage && cap.hasmousecapture) tg.setCapture(); - if (self.opt.emulatetouch) { + if (opt.emulatetouch) { if (tg.onclick && !(tg._onclick || false)) { // intercept DOM0 onclick event tg._onclick = tg.onclick; tg.onclick = function (e) { @@ -1267,18 +1275,20 @@ }; - var moveneedoffset = (self.opt.emulatetouch && self.isiframe && !cap.hasmousecapture); + var moveneedoffset = (opt.emulatetouch && self.isiframe && !cap.hasmousecapture); + + var locktollerance = opt.directionlockdeadzone * 0.3 | 0; self.ontouchmove = function (e, byiframe) { - if (!self.rail.drag) return false; + if (!self.rail.drag) return true; - if (e.targetTouches && self.opt.preventmultitouchscrolling) { - if (e.targetTouches.length > 1) return false; // multitouch + if (e.targetTouches && opt.preventmultitouchscrolling) { + if (e.targetTouches.length > 1) return true; // multitouch } //if (e.pointerType && e.pointerType != 2 && e.pointerType != "touch") return false; - if (e.pointerType && (e.pointerType === 'mouse' || e.pointerType === e.MSPOINTER_TYPE_MOUSE)) return false; + if (e.pointerType && (e.pointerType === 'mouse' || e.pointerType === e.MSPOINTER_TYPE_MOUSE)) return true; if (self.rail.drag.pt == 2) { @@ -1287,18 +1297,6 @@ e.clientY = e.changedTouches[0].clientY; } - if (!self.hasmoving) { - if (self.rail.drag.y === e.clientY && self.rail.drag.x === e.clientX) return false; // prevent first useless move event - - self.triggerScrollStart(e.clientX, e.clientY, 0, 0, 0); - self.hasmoving = true; - } - - if (self.preventclick && !self.preventclick.click) { - self.preventclick.click = self.preventclick.tg.onclick || false; - self.preventclick.tg.onclick = self.onpreventclick; - } - var ofy, ofx; ofx = ofy = 0; @@ -1315,7 +1313,7 @@ var ny = self.rail.drag.st - my; - if (self.ishwscroll && self.opt.bouncescroll) { + if (self.ishwscroll && opt.bouncescroll) { if (ny < 0) { ny = Math.round(ny / 2); } else if (ny > self.page.maxh) { @@ -1326,17 +1324,22 @@ ny = 0; fy = 0; } - if (ny > self.page.maxh) { + else if (ny > self.page.maxh) { ny = self.page.maxh; fy = 0; } + if (fy === 0 && !self.hasmoving) { + self.rail.drag = false; + return true; + } } - var nx; + var nx = self.getScrollLeft(); + if (self.railh && self.railh.scrollable) { nx = (self.isrtlmode) ? mx - self.rail.drag.sl : self.rail.drag.sl - mx; - if (self.ishwscroll && self.opt.bouncescroll) { + if (self.ishwscroll && opt.bouncescroll) { if (nx < 0) { nx = Math.round(nx / 2); } else if (nx > self.page.maxw) { @@ -1355,40 +1358,68 @@ } - var grabbed = false; - if (self.rail.drag.dl) { - grabbed = true; - if (self.rail.drag.dl == "v") nx = self.rail.drag.sl; - else if (self.rail.drag.dl == "h") ny = self.rail.drag.st; - } else { + + if (!self.hasmoving) { + + if (self.rail.drag.y === e.clientY && self.rail.drag.x === e.clientX) return e.stopPropagation(); // prevent first useless move event + var ay = Math.abs(my); var ax = Math.abs(mx); - var dz = self.opt.directionlockdeadzone; + var dz = opt.directionlockdeadzone; if (!self.rail.drag.ck) { if (ay > dz && ax > dz) self.rail.drag.dl = "f"; - else if (ay > dz) self.rail.drag.dl = (ax) ? "f" : "v"; - else if (ax > dz) self.rail.drag.dl = (ay) ? "f" : "h"; - } + else if (ay > dz) self.rail.drag.dl = (ax > locktollerance) ? "f" : "v"; + else if (ax > dz) self.rail.drag.dl = (ay > locktollerance) ? "f" : "h"; + } else if (self.rail.drag.ck == "v") { - if (ay > dz && (ax <= (ay * 0.3))) { + if (ax > dz && ay <= locktollerance) { self.rail.drag = false; - return true; - } else if (ax > dz) { - self.rail.drag.dl = "f"; - $body.scrollTop($body.scrollTop()); // stop iOS native scrolling (when active javascript has blocked) } - } + else if (ay > dz) self.rail.drag.dl = "v"; + + /* + if (ay > dz && (ax <= (ay * 0.3))) { + self.rail.drag = false; + return true; + } else if (ax > dz) { + self.rail.drag.dl = "f"; + $body.scrollTop($body.scrollTop()); // stop iOS native scrolling (when active javascript has blocked) + } + */ + } else if (self.rail.drag.ck == "h") { - if (ax > dz && (ay <= (ax * 0.3))) { + + if (ay > dz && ax <= locktollerance) { self.rail.drag = false; - return true; - } else { - self.rail.drag.dl = "f"; - $body.scrollTop($body.scrollTop()); // stop iOS native scrolling (when active javascript has blocked) } + else if (ax > dz) self.rail.drag.dl = "h"; + + /* + if (ax > dz && (ay <= (ax * 0.3))) { + self.rail.drag = false; + return true; + } else { + self.rail.drag.dl = "f"; + $body.scrollTop($body.scrollTop()); // stop iOS native scrolling (when active javascript has blocked) + } + */ } - return false; + + if (!self.rail.drag.dl) return false; + + self.triggerScrollStart(e.clientX, e.clientY, 0, 0, 0); + self.hasmoving = true; + } + + if (self.preventclick && !self.preventclick.click) { + self.preventclick.click = self.preventclick.tg.onclick || false; + self.preventclick.tg.onclick = self.onpreventclick; + } + + if (self.rail.drag.dl) { + if (self.rail.drag.dl == "v") nx = self.rail.drag.sl; + else if (self.rail.drag.dl == "h") ny = self.rail.drag.st; } self.synched("touchmove", function () { @@ -1406,8 +1437,13 @@ } }); - if (cap.ischrome && self.istouchcapable) grabbed = false; //chrome touch emulation doesn't like! - if (grabbed) return self.cancelEvent(e); + // if (cap.ischrome && self.istouchcapable) grabbed = false; //chrome touch emulation doesn't like! + // if (grabbed) return self.cancelEvent(e); + + //e.stopPropagation(); + self.cancelEvent(e); + return false; + } else if (self.rail.drag.pt == 1) { // drag on cursor return self.onmousemove(e); @@ -1430,7 +1466,7 @@ var tg = self.getTarget(e); if (!self.ispage && cap.hasmousecapture) tg.setCapture(); if (self.isiframe && !cap.hasmousecapture) { - self.saved["csspointerevents"] = self.doc.css("pointer-events"); + self.saved.csspointerevents = self.doc.css("pointer-events"); self.css(self.doc, { "pointer-events": "none" }); } return self.cancelEvent(e); @@ -1439,7 +1475,7 @@ self.ontouchendCursor = function (e) { if (self.rail.drag) { if (cap.hasmousecapture) _doc.releaseCapture(); - if (self.isiframe && !cap.hasmousecapture) self.doc.css("pointer-events", self.saved["csspointerevents"]); + if (self.isiframe && !cap.hasmousecapture) self.doc.css("pointer-events", self.saved.csspointerevents); if (self.rail.drag.pt != 3) return; self.rail.drag = false; return self.cancelEvent(e); @@ -1467,8 +1503,8 @@ self.synched('touchmove', function () { if (self.rail.drag && (self.rail.drag.pt == 3)) { self.showCursor(); - if (self.rail.drag.hr) self.doScrollLeft(Math.round(self.scroll.x * self.scrollratio.x), self.opt.cursordragspeed); - else self.doScrollTop(Math.round(self.scroll.y * self.scrollratio.y), self.opt.cursordragspeed); + if (self.rail.drag.hr) self.doScrollLeft(Math.round(self.scroll.x * self.scrollratio.x), opt.cursordragspeed); + else self.doScrollTop(Math.round(self.scroll.y * self.scrollratio.y), opt.cursordragspeed); } }); @@ -1548,12 +1584,12 @@ /* if (self.rail.drag.hr) { if (self.hasreversehr) { - self.doScrollLeft(self.scrollvaluemaxw - Math.round(self.scroll.x * self.scrollratio.x), self.opt.cursordragspeed); + self.doScrollLeft(self.scrollvaluemaxw - Math.round(self.scroll.x * self.scrollratio.x), opt.cursordragspeed); } else { - self.doScrollLeft(Math.round(self.scroll.x * self.scrollratio.x), self.opt.cursordragspeed); + self.doScrollLeft(Math.round(self.scroll.x * self.scrollratio.x), opt.cursordragspeed); } } - else self.doScrollTop(Math.round(self.scroll.y * self.scrollratio.y), self.opt.cursordragspeed); + else self.doScrollTop(Math.round(self.scroll.y * self.scrollratio.y), opt.cursordragspeed); */ if (self.rail.drag.hr) { @@ -1572,7 +1608,7 @@ } }; - if (cap.cantouch || self.opt.emulatetouch) { + if (cap.cantouch || opt.emulatetouch) { self.onpreventclick = function (e) { if (self.preventclick) { @@ -1593,7 +1629,7 @@ } }; - if (self.opt.grabcursorenabled && cap.cursorgrabvalue) { + if (opt.grabcursorenabled && cap.cursorgrabvalue) { self.css((self.ispage) ? self.doc : self.win, { 'cursor': cap.cursorgrabvalue }); @@ -1695,16 +1731,17 @@ self.bind(self.win, "touchstart", self.ontouchstart, false, true); self.bind(_doc, "touchend", self.ontouchend, false, true); self.bind(_doc, "touchcancel", self.ontouchend, false, true); - self.bind(_doc, "touchmove", self.ontouchmove, false, true); + //self.bind(_doc, "touchmove", self.ontouchmove, false, true); + self.delegate(_doc, "touchmove", self.ontouchmove, false, true); } - if (self.opt.emulatetouch) { + if (opt.emulatetouch) { self.bind(self.win, "mousedown", self.ontouchstart, false, true); self.bind(_doc, "mouseup", self.ontouchend, false, true); self.bind(_doc, "mousemove", self.ontouchmove, false, true); } - if (self.opt.cursordragontouch || (!cap.cantouch && !self.opt.emulatetouch)) { + if (opt.cursordragontouch || (!cap.cantouch && !opt.emulatetouch)) { self.rail.css({ cursor: "default" @@ -1723,7 +1760,7 @@ if (!self.rail.drag) self.hideCursor(); }); - if (self.opt.sensitiverail) { + if (opt.sensitiverail) { self.bind(self.rail, "click", function (e) { self.doRailClick(e, false, false); }); @@ -1749,7 +1786,7 @@ if (!self.rail.drag) self.hideCursor(); }); - if (self.opt.sensitiverail) { + if (opt.sensitiverail) { self.bind(self.railh, "click", function (e) { self.doRailClick(e, false, true); }); @@ -1768,7 +1805,7 @@ } - if (self.opt.cursordragontouch && (this.istouchcapable || cap.cantouch)) { + if (opt.cursordragontouch && (this.istouchcapable || cap.cantouch)) { self.bind(self.cursor, "touchstart", self.ontouchstartCursor); self.bind(self.cursor, "touchmove", self.ontouchmoveCursor); self.bind(self.cursor, "touchend", self.ontouchendCursor); @@ -1779,7 +1816,7 @@ self.cursorh && self.bind(self.cursorh, "touchend", self.ontouchendCursor); } - if (!cap.cantouch && !self.opt.emulatetouch) { + if (!cap.cantouch && !opt.emulatetouch) { self.bind((cap.hasmousecapture) ? self.win : _doc, "mouseup", self.onmouseup); self.bind(_doc, "mousemove", self.onmousemove); @@ -1795,7 +1832,7 @@ self.bind(self.cursorh, "mouseup", self.onmouseup); } - if (!self.ispage && self.opt.enablescrollonselection) { + if (!self.ispage && opt.enablescrollonselection) { self.bind(self.win[0], "mousedown", self.onselectionstart); self.bind(_doc, "mouseup", self.onselectionend); self.bind(self.cursor, "mouseup", self.onselectionend); @@ -1819,7 +1856,7 @@ self.bind((cap.hasmousecapture) ? self.win : _doc, "mouseup", self.ontouchend); if (self.onclick) self.bind(_doc, "click", self.onclick); - if (self.opt.cursordragontouch) { + if (opt.cursordragontouch) { self.bind(self.cursor, "mousedown", self.onmousedown); self.bind(self.cursor, "mouseup", self.onmouseup); self.cursorh && self.bind(self.cursorh, "mousedown", function (e) { @@ -1834,7 +1871,7 @@ } - if (self.opt.enablemousewheel) { + if (opt.enablemousewheel) { if (!self.isiframe) self.mousewheel((cap.isie && self.ispage) ? _doc : self.win, self.onmousewheel); self.mousewheel(self.rail, self.onmousewheel); if (self.railh) self.mousewheel(self.railh, self.onmousewheelhr); @@ -1941,7 +1978,7 @@ ret = true; break; case 32: - if (self.opt.spacebarenabled) { + if (opt.spacebarenabled) { (shift) ? self.doScrollBy(self.view.h) : self.doScrollBy(-self.view.h); ret = true; } @@ -1957,7 +1994,7 @@ } }; - if (self.opt.enablekeyboard) self.bind(_doc, (cap.isopera && !cap.isopera12) ? "keypress" : "keydown", self.onkeypress); + if (opt.enablekeyboard) self.bind(_doc, (cap.isopera && !cap.isopera12) ? "keypress" : "keydown", self.onkeypress); self.bind(_doc, "keydown", function (e) { var ctrl = e.ctrlKey || false; @@ -1971,8 +2008,8 @@ self.wheelprevented = false; }); - self.bind(_win, 'resize', self.lazyResize); - self.bind(_win, 'orientationchange', self.lazyResize); + self.bind(_win, 'resize', self.onscreenresize); + self.bind(_win, 'orientationchange', self.onscreenresize); self.bind(_win, "load", self.lazyResize); @@ -1992,7 +2029,7 @@ self.lazyResize(self.isieold ? 250 : 30); }; - if (self.opt.enableobserver) { + if (opt.enableobserver) { if ((!self.isie11) && (ClsMutationObserver !== false)) { // IE11 crashes #568 self.observerbody = new ClsMutationObserver(function (mutations) { @@ -2052,7 +2089,7 @@ // - if (!self.ispage && self.opt.boxzoom) self.bind(_win, "resize", self.resizeZoom); + if (!self.ispage && opt.boxzoom) self.bind(_win, "resize", self.resizeZoom); if (self.istextarea) { self.bind(self.win, "keydown", self.lazyResize); self.bind(self.win, "mouseup", self.lazyResize); @@ -2097,7 +2134,7 @@ self.docscroll = $(self.iframe.body); //$(this.contentWindow); } - if (!cap.isios && self.opt.iframeautoresize && !self.isiframe) { + if (!cap.isios && opt.iframeautoresize && !self.isiframe) { self.win.scrollTop(0); // reset position self.doc.height(""); //reset height to fix browser bug var hh = Math.max(doc.getElementsByTagName('html')[0].scrollHeight, doc.body.scrollHeight); @@ -2120,22 +2157,22 @@ self.bind(doc, "scroll", self.onscroll); } - if (self.opt.enablemousewheel) { + if (opt.enablemousewheel) { self.mousewheel(doc, self.onmousewheel); } - if (self.opt.enablekeyboard) self.bind(doc, (cap.isopera) ? "keypress" : "keydown", self.onkeypress); + if (opt.enablekeyboard) self.bind(doc, (cap.isopera) ? "keypress" : "keydown", self.onkeypress); if (cap.cantouch) { self.bind(doc, "touchstart", self.ontouchstart); self.bind(doc, "touchmove", self.ontouchmove); } - else if (self.opt.emulatetouch) { + else if (opt.emulatetouch) { self.bind(doc, "mousedown", self.ontouchstart); self.bind(doc, "mousemove", function (e) { return self.ontouchmove(e, true); }); - if (self.opt.grabcursorenabled && cap.cursorgrabvalue) self.css($(doc.body), { + if (opt.grabcursorenabled && cap.cursorgrabvalue) self.css($(doc.body), { 'cursor': cap.cursorgrabvalue }); } @@ -2143,7 +2180,7 @@ self.bind(doc, "mouseup", self.ontouchend); if (self.zoom) { - if (self.opt.dblclickzoom) self.bind(doc, 'dblclick', self.doZoom); + if (opt.dblclickzoom) self.bind(doc, 'dblclick', self.doZoom); if (self.ongesturezoom) self.bind(doc, "gestureend", self.ongesturezoom); } }; @@ -2167,7 +2204,7 @@ if (!self.rail) return; if (self.autohidedom) { self.autohidedom.stop().css({ - opacity: self.opt.cursoropacitymax + opacity: opt.cursoropacitymax }); self.cursoractive = true; } @@ -2195,7 +2232,7 @@ } if (self.zoom) self.zoom.stop().css({ - opacity: self.opt.cursoropacitymax + opacity: opt.cursoropacitymax }); }; @@ -2204,19 +2241,19 @@ if (!self.rail) return; if (!self.autohidedom) return; - if (self.hasmousefocus && self.opt.autohidemode === "leave") return; + if (self.hasmousefocus && opt.autohidemode === "leave") return; self.cursortimeout = setTimeout(function () { if (!self.rail.active || !self.showonmouseevent) { self.autohidedom.stop().animate({ - opacity: self.opt.cursoropacitymin + opacity: opt.cursoropacitymin }); if (self.zoom) self.zoom.stop().animate({ - opacity: self.opt.cursoropacitymin + opacity: opt.cursoropacitymin }); self.cursoractive = false; } self.cursortimeout = 0; - }, tm || self.opt.hidecursordelay); + }, tm || opt.hidecursordelay); }; this.noticeCursor = function (tm, py, px) { @@ -2300,7 +2337,7 @@ self.setScrollTop(0); if (self.rail) self.rail.scrollable = false; } else { - self.page.maxh -= (self.opt.railpadding.top + self.opt.railpadding.bottom); //** + self.page.maxh -= (opt.railpadding.top + opt.railpadding.bottom); //** self.rail.scrollable = true; } @@ -2315,8 +2352,8 @@ self.railh.scrollable = false; } } else { - self.page.maxw -= (self.opt.railpadding.left + self.opt.railpadding.right); //** - if (self.railh) self.railh.scrollable = (self.opt.horizrailenabled); + self.page.maxw -= (opt.railpadding.left + opt.railpadding.right); //** + if (self.railh) self.railh.scrollable = (opt.horizrailenabled); } self.railslocked = (self.locked) || ((self.page.maxh === 0) && (self.page.maxw === 0)); @@ -2333,25 +2370,25 @@ if (self.istextarea && self.win.css('resize') && self.win.css('resize') != 'none') self.view.h -= 20; self.cursorheight = Math.min(self.view.h, Math.round(self.view.h * (self.view.h / self.page.h))); - self.cursorheight = (self.opt.cursorfixedheight) ? self.opt.cursorfixedheight : Math.max(self.opt.cursorminheight, self.cursorheight); + self.cursorheight = (opt.cursorfixedheight) ? opt.cursorfixedheight : Math.max(opt.cursorminheight, self.cursorheight); self.cursorwidth = Math.min(self.view.w, Math.round(self.view.w * (self.view.w / self.page.w))); - self.cursorwidth = (self.opt.cursorfixedheight) ? self.opt.cursorfixedheight : Math.max(self.opt.cursorminheight, self.cursorwidth); + self.cursorwidth = (opt.cursorfixedheight) ? opt.cursorfixedheight : Math.max(opt.cursorminheight, self.cursorwidth); // self.cursorwidth -= self.railh.cursor[0].outerWidth - self.railh.cursor[0].innerWidth; - self.scrollvaluemax = self.view.h - self.cursorheight - (self.opt.railpadding.top + self.opt.railpadding.bottom); // - self.cursor.hborder //** + self.scrollvaluemax = self.view.h - self.cursorheight - (opt.railpadding.top + opt.railpadding.bottom); // - self.cursor.hborder //** if (!self.hasborderbox) self.scrollvaluemax -= self.cursor[0].offsetHeight - self.cursor[0].clientHeight; if (self.railh) { self.railh.width = (self.page.maxh > 0) ? (self.view.w - self.rail.width) : self.view.w; - self.scrollvaluemaxw = self.railh.width - self.cursorwidth - (self.opt.railpadding.left + self.opt.railpadding.right); // - self.cursorh.wborder //** + self.scrollvaluemaxw = self.railh.width - self.cursorwidth - (opt.railpadding.left + opt.railpadding.right); // - self.cursorh.wborder //** } /* if (self.checkrtlmode&&self.railh) { self.checkrtlmode = false; - if (self.opt.rtlmode&&self.scroll.x==0) self.setScrollLeft(self.page.maxw); + if (opt.rtlmode&&self.scroll.x==0) self.setScrollLeft(self.page.maxw); } */ @@ -2378,22 +2415,31 @@ this.resize = self.onResize; - this.hlazyresize = 0; - - this.lazyResize = function (tm) { // event debounce + var hlazyresize = 0; - if (self.hlazyresize) clearTimeout(self.hlazyresize); + this.onscreenresize = function(e) { + clearTimeout(hlazyresize); var hiderails = (!self.ispage && !self.haswrapper); - if (hiderails) self.hideRails(); - - self.hlazyresize = setTimeout(function () { + + hlazyresize = setTimeout(function () { if (self) { if (hiderails) self.showRails(); self.resize(); } - }, 240); + hlazyresize=0; + }, 120); + }; + + this.lazyResize = function (tm) { // event debounce + + clearTimeout(hlazyresize); + + hlazyresize = setTimeout(function () { + if (self) self.resize(); + hlazyresize=0; + }, tm||240); return self; @@ -2514,6 +2560,62 @@ } + this.delegate = function (dom, name, fn, bubble, active) { + + var de = delegatevents[name] || false; + + if (!de) { + + de = { + a: [], + l: [], + f: function (e) { + var lst = de.l, l = lst.length - 1; + var r = false; + for (var a = l; a >= 0; a--) { + r = lst[a].call(e.target, e); + if (r === false) { + e.preventDefault(); + e.stopImmediatePropagation(); + return false; + } + } + return r; + } + }; + + self.bind(dom, name, de.f, bubble, active); + + delegatevents[name] = de; + + } + + if (self.ispage) { + de.a = [self.id].concat(de.a); + de.l = [fn].concat(de.l); + } else { + de.a.push(self.id); + de.l.push(fn); + } + + }; + + this.undelegate = function (dom, name, fn, bubble, active) { + var de = delegatevents[name]||false; + if (de) { + for (var a=0,l=de.l.length;a> 1; if (self.newscrolly < -ny) { self.newscrolly = -ny; py = -1; } else if (self.newscrolly > self.page.maxh + ny) { self.newscrolly = self.page.maxh + ny; py = 1; } @@ -2856,14 +2958,14 @@ if (!chkscroll && hasparentscrollingphase) return true; if (e.deltaMode === 0) { // PIXEL - px = -(e.deltaX * (self.opt.mousescrollstep / (18 * 3))) | 0; - py = -(e.deltaY * (self.opt.mousescrollstep / (18 * 3))) | 0; + px = -(e.deltaX * (opt.mousescrollstep / (18 * 3))) | 0; + py = -(e.deltaY * (opt.mousescrollstep / (18 * 3))) | 0; } else if (e.deltaMode === 1) { // LINE - px = -(e.deltaX * self.opt.mousescrollstep * 50 / 80) | 0; - py = -(e.deltaY * self.opt.mousescrollstep * 50 / 80) | 0; + px = -(e.deltaX * opt.mousescrollstep * 50 / 80) | 0; + py = -(e.deltaY * opt.mousescrollstep * 50 / 80) | 0; } - if (hr && self.opt.oneaxismousemode && (px === 0) && py) { // classic vertical-only mousewheel + browser with x/y support + if (hr && opt.oneaxismousemode && (px === 0) && py) { // classic vertical-only mousewheel + browser with x/y support px = py; py = 0; @@ -2900,9 +3002,9 @@ } if (self.rail.drag) return self.cancelEvent(e); - if (self.opt.oneaxismousemode === "auto" && e.deltaX !== 0) self.opt.oneaxismousemode = false; // check two-axis mouse support (not very elegant) + if (opt.oneaxismousemode === "auto" && e.deltaX !== 0) opt.oneaxismousemode = false; // check two-axis mouse support (not very elegant) - if (self.opt.oneaxismousemode && e.deltaX === 0) { + if (opt.oneaxismousemode && e.deltaX === 0) { if (!self.rail.scrollable) { if (self.railh && self.railh.scrollable) { return self.onmousewheelhr(e); @@ -2914,7 +3016,7 @@ var nw = now(); var chk = false; - if (self.opt.preservenativescrolling && ((self.checkarea + 600) < nw)) { + if (opt.preservenativescrolling && ((self.checkarea + 600) < nw)) { self.nativescrollingarea = self.isScrollable(e); chk = true; } @@ -2932,7 +3034,7 @@ var nw = now(); var chk = false; - if (self.opt.preservenativescrolling && ((self.checkarea + 600) < nw)) { + if (opt.preservenativescrolling && ((self.checkarea + 600) < nw)) { self.nativescrollingarea = self.isScrollable(e); chk = true; } @@ -2954,11 +3056,11 @@ this.getTransitionSpeed = function (dif) { - return 80 + (dif / 72) * self.opt.scrollspeed | 0; + return 80 + (dif / 72) * opt.scrollspeed | 0; }; - if (!self.opt.smoothscroll) { + if (!opt.smoothscroll) { this.doScrollLeft = function (x, spd) { //direct var y = self.getScrollTop(); self.doScrollPos(x, y, spd); @@ -2978,7 +3080,7 @@ }); }; this.cancelScroll = function () { }; // direct - } else if (self.ishwscroll && cap.hastransition && self.opt.usetransition && !!self.opt.smoothscroll) { + } else if (self.ishwscroll && cap.hastransition && opt.usetransition && !!opt.smoothscroll) { var lasttransitionstyle = ''; @@ -3034,7 +3136,7 @@ if (((self.newscrolly - py) * (y - py) < 0) || ((self.newscrollx - px) * (x - px) < 0)) self.cancelScroll(); //inverted movement detection - if (!self.opt.bouncescroll) { + if (!opt.bouncescroll) { if (y < 0) y = 0; else if (y > self.page.maxh) y = self.page.maxh; if (x < 0) x = 0; @@ -3163,7 +3265,7 @@ else if (py > self.page.maxh) py = self.page.maxh; if (px < 0) px = 0; else if (px > self.page.maxw) px = self.page.maxw; - if ((py != self.newscrolly) || (px != self.newscrollx)) return self.doScrollPos(px, py, self.opt.snapbackspeed); + if ((py != self.newscrolly) || (px != self.newscrollx)) return self.doScrollPos(px, py, opt.snapbackspeed); if (self.scrollrunning) self.triggerScrollEnd(); self.scrollrunning = false; @@ -3259,7 +3361,7 @@ self.triggerScrollEnd(); } - } + }; if (!self.scrollrunning) { self.triggerScrollStart(px, py, x, y, ms); @@ -3269,7 +3371,7 @@ }; - this.cancelScroll = function () { + this.cancelScroll = function () { if (self.timer) clearAnimationFrame(self.timer); self.timer = 0; self.bzscroll = false; diff --git a/jquery.nicescroll.min.js b/jquery.nicescroll.min.js index cdb1988..92a239a 100644 --- a/jquery.nicescroll.min.js +++ b/jquery.nicescroll.min.js @@ -1,2 +1,2 @@ /* jquery.nicescroll v 3.7.4-d [DEV REL] - InuYaksa*2017 - MIT - https://nicescroll.areaaperta.com/ */ -!function(e){"function"==typeof define&&define.amd?define(["jquery"],e):"object"==typeof exports?module.exports=e(require("jquery")):e(jQuery)}(function(e){"use strict";var o=!1,t=!1,r=0,i=2e3,s=0,n=e,l=document,a=window,c=n(a),d=a.requestAnimationFrame||a.webkitRequestAnimationFrame||a.mozRequestAnimationFrame||!1,u=a.cancelAnimationFrame||a.webkitCancelAnimationFrame||a.mozCancelAnimationFrame||!1;if(d)a.cancelAnimationFrame||(u=function(e){});else{var h=0;d=function(e,o){var t=(new Date).getTime(),r=Math.max(0,16-(t-h)),i=a.setTimeout(function(){e(t+r)},r);return h=t+r,i},u=function(e){a.clearTimeout(e)}}var p=a.MutationObserver||a.WebKitMutationObserver||!1,m=Date.now||function(){return(new Date).getTime()},f={zindex:"auto",cursoropacitymin:0,cursoropacitymax:1,cursorcolor:"#424242",cursorwidth:"6px",cursorborder:"1px solid #fff",cursorborderradius:"5px",scrollspeed:40,mousescrollstep:27,touchbehavior:!1,emulatetouch:!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 e=l.currentScript||function(){var e=l.getElementsByTagName("script");return!!e.length&&e[e.length-1]}(),o=e?e.src.split("?")[0]:"";return o.split("/").length>0?o.split("/").slice(0,-1).join("/")+"/":""}(),preventmultitouchscrolling:!0,disablemutationobserver:!1,enableobserver:!0,scrollbarid:!1},g=!1,v=function(){if(g)return g;var e=l.createElement("DIV"),o=e.style,t=navigator.userAgent,r=navigator.platform,i={};return i.haspointerlock="pointerLockElement"in l||"webkitPointerLockElement"in l||"mozPointerLockElement"in l,i.isopera="opera"in a,i.isopera12=i.isopera&&"getUserMedia"in navigator,i.isoperamini="[object OperaMini]"===Object.prototype.toString.call(a.operamini),i.isie="all"in l&&"attachEvent"in e&&!i.isopera,i.isieold=i.isie&&!("msInterpolationMode"in o),i.isie7=i.isie&&!i.isieold&&(!("documentMode"in l)||7===l.documentMode),i.isie8=i.isie&&"documentMode"in l&&8===l.documentMode,i.isie9=i.isie&&"performance"in a&&9===l.documentMode,i.isie10=i.isie&&"performance"in a&&10===l.documentMode,i.isie11="msRequestFullscreen"in e&&l.documentMode>=11,i.ismsedge="msCredentials"in a,i.ismozilla="MozAppearance"in o,i.iswebkit=!i.ismsedge&&"WebkitAppearance"in o,i.ischrome=i.iswebkit&&"chrome"in a,i.ischrome38=i.ischrome&&"touchAction"in o,i.ischrome22=!i.ischrome38&&i.ischrome&&i.haspointerlock,i.ischrome26=!i.ischrome38&&i.ischrome&&"transition"in o,i.cantouch="ontouchstart"in l.documentElement||"ontouchstart"in a,i.hasw3ctouch=(a.PointerEvent||!1)&&(navigator.MaxTouchPoints>0||navigator.msMaxTouchPoints>0),i.hasmstouch=!i.hasw3ctouch&&(a.MSPointerEvent||!1),i.ismac=/^mac$/i.test(r),i.isios=i.cantouch&&/iphone|ipad|ipod/i.test(r),i.isios4=i.isios&&!("seal"in Object),i.isios7=i.isios&&"webkitHidden"in l,i.isios8=i.isios&&"hidden"in l,i.isios10=i.isios&&a.Proxy,i.isandroid=/android/i.test(t),i.haseventlistener="addEventListener"in e,i.trstyle=!1,i.hastransform=!1,i.hastranslate3d=!1,i.transitionstyle=!1,i.hastransition=!1,i.transitionend=!1,i.trstyle="transform",i.hastransform="transform"in o||function(){for(var e=["msTransform","webkitTransform","MozTransform","OTransform"],t=0,r=e.length;t0;){if(9==e[0].nodeType)return!1;var o=e.css("zIndex");if(!isNaN(o)&&0!==o)return parseInt(o);e=e.parent()}return!1}function y(e,o,t){var r=e.css(o),i=parseFloat(r);if(isNaN(i)){var s=3==(i=R[r]||0)?t?T.win.outerHeight()-T.win.innerHeight():T.win.outerWidth()-T.win.innerWidth():1;return T.isie8&&i&&(i+=1),s?i:0}return i}function x(e,o,t,r){T._bind(e,o,function(r){var i={original:r=r||a.event,target:r.target||r.srcElement,type:"wheel",deltaMode:"MozMousePixelScroll"==r.type?0:1,deltaX:0,deltaZ:0,preventDefault:function(){return r.preventDefault?r.preventDefault():r.returnValue=!1,!1},stopImmediatePropagation:function(){r.stopImmediatePropagation?r.stopImmediatePropagation():r.cancelBubble=!0}};return"mousewheel"==o?(r.wheelDeltaX&&(i.deltaX=-.025*r.wheelDeltaX),r.wheelDeltaY&&(i.deltaY=-.025*r.wheelDeltaY),!i.deltaY&&!i.deltaX&&(i.deltaY=-.025*r.wheelDelta)):i.deltaY=r.detail,t.call(e,i)},r)}function S(e,o,t,r){T.scrollrunning||(T.newscrolly=T.getScrollTop(),T.newscrollx=T.getScrollLeft(),Y=m());var i=m()-Y;if(Y=m(),i>350?B=1:B+=(2-B)/10,e=e*B|0,o=o*B|0,e){if(r)if(e<0){if(T.getScrollLeft()>=T.page.maxw)return!0}else if(T.getScrollLeft()<=0)return!0;var s=e>0?1:-1;O!==s&&(T.scrollmom&&T.scrollmom.stop(),T.newscrollx=T.getScrollLeft(),O=s),T.lastdeltax-=e}if(o){if(function(){var e=T.getScrollTop();if(o<0){if(e>=T.page.maxh)return!0}else if(e<=0)return!0}()){if(T.opt.nativeparentscrolling&&t&&!T.ispage&&!T.zoomactive)return!0;var n=T.view.h>>1;T.newscrolly<-n?(T.newscrolly=-n,o=-1):T.newscrolly>T.page.maxh+n?(T.newscrolly=T.page.maxh+n,o=1):o=0}var l=o>0?1:-1;I!==l&&(T.scrollmom&&T.scrollmom.stop(),T.newscrolly=T.getScrollTop(),I=l),T.lastdeltay-=o}(o||e)&&T.synched("relativexy",function(){var e=T.lastdeltay+T.newscrolly;T.lastdeltay=0;var o=T.lastdeltax+T.newscrollx;T.lastdeltax=0,T.rail.drag||T.doScrollPos(o,e)})}function z(e,o,t){var r,i;return!(t||!X)||(0===e.deltaMode?(r=-e.deltaX*(T.opt.mousescrollstep/54)|0,i=-e.deltaY*(T.opt.mousescrollstep/54)|0):1===e.deltaMode&&(r=-e.deltaX*T.opt.mousescrollstep*50/80|0,i=-e.deltaY*T.opt.mousescrollstep*50/80|0),o&&T.opt.oneaxismousemode&&0===r&&i&&(r=i,i=0,t&&(r<0?T.getScrollLeft()>=T.page.maxw:T.getScrollLeft()<=0)&&(i=r,r=0)),T.isrtlmode&&(r=-r),S(r,i,t,!0)?void(t&&(X=!0)):(X=!1,e.stopImmediatePropagation(),e.preventDefault()))}var T=this;this.version="3.7.4-e",this.name="nicescroll",this.me=h;var k=n("body");if(this.opt={doc:k,win:!1},n.extend(this.opt,f),this.opt.snapbackspeed=80,e)for(var E in T.opt)void 0!==e[E]&&(T.opt[E]=e[E]);if(T.opt.disablemutationobserver&&(p=!1),this.doc=T.opt.doc,this.iddoc=this.doc&&this.doc[0]?this.doc[0].id||"":"",this.ispage=/^BODY|HTML/.test(T.opt.win?T.opt.win[0].nodeName:this.doc[0].nodeName),this.haswrapper=!1!==T.opt.win,this.win=T.opt.win||(this.ispage?c:this.doc),this.docscroll=this.ispage&&!this.haswrapper?c:this.win,this.body=k,this.viewport=!1,this.isfixed=!1,this.iframe=!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"!=T.opt.autohidemode,this.onmousedown=!1,this.onmouseup=!1,this.onmousemove=!1,this.onmousewheel=!1,this.onkeypress=!1,this.ongesturezoom=!1,this.onclick=!1,this.onscrollstart=!1,this.onscrollend=!1,this.onscrollcancel=!1,this.onzoomin=!1,this.onzoomout=!1,this.view=!1,this.page=!1,this.scroll={x:0,y:0},this.scrollratio={x:0,y:0},this.cursorheight=20,this.scrollvaluemax=0,"auto"==this.opt.rtlmode){var M=this.win[0]==a?this.body:this.win,L=M.css("writing-mode")||M.css("-webkit-writing-mode")||M.css("-ms-writing-mode")||M.css("-moz-writing-mode");"horizontal-tb"==L||"lr-tb"==L||""===L?(this.isrtlmode="rtl"==M.css("direction"),this.isvertical=!1):(this.isrtlmode="vertical-rl"==L||"tb"==L||"tb-rl"==L||"rl-tb"==L,this.isvertical="vertical-rl"==L||"tb"==L||"tb-rl"==L)}else this.isrtlmode=!0===this.opt.rtlmode,this.isvertical=!1;if(this.scrollrunning=!1,this.scrollmom=!1,this.observer=!1,this.observerremover=!1,this.observerbody=!1,!1!==T.opt.scrollbarid)this.id=T.opt.scrollbarid;else do{this.id="ascrail"+i++}while(l.getElementById(this.id));this.rail=!1,this.cursor=!1,this.cursorfreezed=!1,this.selectiondrag=!1,this.zoom=!1,this.zoomactive=!1,this.hasfocus=!1,this.hasmousefocus=!1,this.visibility=!0,this.railslocked=!1,this.locked=!1,this.hidden=!1,this.cursoractive=!0,this.wheelprevented=!1,this.overflowx=T.opt.overflowx,this.overflowy=T.opt.overflowy,this.nativescrollingarea=!1,this.checkarea=0,this.events=[],this.saved={},this.delaylist={},this.synclist={},this.lastdeltax=0,this.lastdeltay=0,this.detected=v();var C=n.extend({},this.detected);this.canhwscroll=C.hastransform&&T.opt.hwacceleration,this.ishwscroll=this.canhwscroll&&T.haswrapper,this.isrtlmode?this.isvertical?this.hasreversehr=!(C.iswebkit||C.isie||C.isie11):this.hasreversehr=!(C.iswebkit||C.isie&&!C.isie10&&!C.isie11):this.hasreversehr=!1,this.istouchcapable=!1,C.cantouch||!C.hasw3ctouch&&!C.hasmstouch?!C.cantouch||C.isios||C.isandroid||!C.iswebkit&&!C.ismozilla||(this.istouchcapable=!0):this.istouchcapable=!0,T.opt.enablemouselockapi||(C.hasmousecapture=!1,C.haspointerlock=!1),this.debounced=function(e,o,t){T&&(T.delaylist[e]||!1||(T.delaylist[e]={h:d(function(){T.delaylist[e].fn.call(T),T.delaylist[e]=!1},t)},o.call(T)),T.delaylist[e].fn=o)},this.synched=function(e,o){T.synclist[e]?T.synclist[e]=o:(T.synclist[e]=o,d(function(){T&&(T.synclist[e]&&T.synclist[e].call(T),T.synclist[e]=null)}))},this.unsynched=function(e){T.synclist[e]&&(T.synclist[e]=!1)},this.css=function(e,o){for(var t in o)T.saved.css.push([e,t,e.css(t)]),e.css(t,o[t])},this.scrollTop=function(e){return void 0===e?T.getScrollTop():T.setScrollTop(e)},this.scrollLeft=function(e){return void 0===e?T.getScrollLeft():T.setScrollLeft(e)};var N=function(e,o,t,r,i,s,n){this.st=e,this.ed=o,this.spd=t,this.p1=r||0,this.p2=i||1,this.p3=s||0,this.p4=n||1,this.ts=m(),this.df=o-e};if(N.prototype={B2:function(e){return 3*(1-e)*(1-e)*e},B3:function(e){return 3*(1-e)*e*e},B4:function(e){return e*e*e},getPos:function(){return(m()-this.ts)/this.spd},getNow:function(){var e=(m()-this.ts)/this.spd,o=this.B2(e)+this.B3(e)+this.B4(e);return e>=1?this.ed:this.st+this.df*o|0},update:function(e,o){return this.st=this.getNow(),this.ed=e,this.spd=o,this.ts=m(),this.df=this.ed-this.st,this}},this.ishwscroll){this.doc.translate={x:0,y:0,tx:"0px",ty:"0px"},C.hastranslate3d&&C.isios&&this.doc.css("-webkit-backface-visibility","hidden"),this.getScrollTop=function(e){if(!e){var o=g();if(o)return 16==o.length?-o[13]:-o[5];if(T.timerscroll&&T.timerscroll.bz)return T.timerscroll.bz.getNow()}return T.doc.translate.y},this.getScrollLeft=function(e){if(!e){var o=g();if(o)return 16==o.length?-o[12]:-o[4];if(T.timerscroll&&T.timerscroll.bh)return T.timerscroll.bh.getNow()}return T.doc.translate.x},this.notifyScrollEvent=function(e){var o=l.createEvent("UIEvents");o.initUIEvent("scroll",!1,!0,a,1),o.niceevent=!0,e.dispatchEvent(o)};var P=this.isrtlmode?1:-1;C.hastranslate3d&&T.opt.enabletranslate3d?(this.setScrollTop=function(e,o){T.doc.translate.y=e,T.doc.translate.ty=-1*e+"px",T.doc.css(C.trstyle,"translate3d("+T.doc.translate.tx+","+T.doc.translate.ty+",0)"),o||T.notifyScrollEvent(T.win[0])},this.setScrollLeft=function(e,o){T.doc.translate.x=e,T.doc.translate.tx=e*P+"px",T.doc.css(C.trstyle,"translate3d("+T.doc.translate.tx+","+T.doc.translate.ty+",0)"),o||T.notifyScrollEvent(T.win[0])}):(this.setScrollTop=function(e,o){T.doc.translate.y=e,T.doc.translate.ty=-1*e+"px",T.doc.css(C.trstyle,"translate("+T.doc.translate.tx+","+T.doc.translate.ty+")"),o||T.notifyScrollEvent(T.win[0])},this.setScrollLeft=function(e,o){T.doc.translate.x=e,T.doc.translate.tx=e*P+"px",T.doc.css(C.trstyle,"translate("+T.doc.translate.tx+","+T.doc.translate.ty+")"),o||T.notifyScrollEvent(T.win[0])})}else this.getScrollTop=function(){return T.docscroll.scrollTop()},this.setScrollTop=function(e){T.docscroll.scrollTop(e)},this.getScrollLeft=function(){return T.hasreversehr?T.detected.ismozilla?T.page.maxw-Math.abs(T.docscroll.scrollLeft()):T.page.maxw-T.docscroll.scrollLeft():T.docscroll.scrollLeft()},this.setScrollLeft=function(e){return setTimeout(function(){if(T)return T.hasreversehr&&(e=T.detected.ismozilla?-(T.page.maxw-e):T.page.maxw-e),T.docscroll.scrollLeft(e)},1)};this.getTarget=function(e){return!!e&&(e.target?e.target:!!e.srcElement&&e.srcElement)},this.hasParent=function(e,o){if(!e)return!1;for(var t=e.target||e.srcElement||e||!1;t&&t.id!=o;)t=t.parentNode||!1;return!1!==t};var R={thin:1,medium:3,thick:5};this.getDocumentScrollOffset=function(){return{top:a.pageYOffset||l.documentElement.scrollTop,left:a.pageXOffset||l.documentElement.scrollLeft}},this.getOffset=function(){if(T.isfixed){var e=T.win.offset(),o=T.getDocumentScrollOffset();return e.top-=o.top,e.left-=o.left,e}var t=T.win.offset();if(!T.viewport)return t;var r=T.viewport.offset();return{top:t.top-r.top,left:t.left-r.left}},this.updateScrollBar=function(e){var o,t;if(T.ishwscroll)T.rail.css({height:T.win.innerHeight()-(T.opt.railpadding.top+T.opt.railpadding.bottom)}),T.railh&&T.railh.css({width:T.win.innerWidth()-(T.opt.railpadding.left+T.opt.railpadding.right)});else{var r=T.getOffset();if(o={top:r.top,left:r.left-(T.opt.railpadding.left+T.opt.railpadding.right)},o.top+=y(T.win,"border-top-width",!0),o.left+=T.rail.align?T.win.outerWidth()-y(T.win,"border-right-width")-T.rail.width:y(T.win,"border-left-width"),(t=T.opt.railoffset)&&(t.top&&(o.top+=t.top),t.left&&(o.left+=t.left)),T.railslocked||T.rail.css({top:o.top,left:o.left,height:(e?e.h:T.win.innerHeight())-(T.opt.railpadding.top+T.opt.railpadding.bottom)}),T.zoom&&T.zoom.css({top:o.top+1,left:1==T.rail.align?o.left-20:o.left+T.rail.width+4}),T.railh&&!T.railslocked){o={top:r.top,left:r.left},(t=T.opt.railhoffset)&&(t.top&&(o.top+=t.top),t.left&&(o.left+=t.left));var i=T.railh.align?o.top+y(T.win,"border-top-width",!0)+T.win.innerHeight()-T.railh.height:o.top+y(T.win,"border-top-width",!0),s=o.left+y(T.win,"border-left-width");T.railh.css({top:i-(T.opt.railpadding.top+T.opt.railpadding.bottom),left:s,width:T.railh.width})}}},this.doRailClick=function(e,o,t){var r,i,s,n;T.railslocked||(T.cancelEvent(e),"pageY"in e||(e.pageX=e.clientX+l.documentElement.scrollLeft,e.pageY=e.clientY+l.documentElement.scrollTop),o?(r=t?T.doScrollLeft:T.doScrollTop)(s=t?(e.pageX-T.railh.offset().left-T.cursorwidth/2)*T.scrollratio.x:(e.pageY-T.rail.offset().top-T.cursorheight/2)*T.scrollratio.y):(r=t?T.doScrollLeftBy:T.doScrollBy,s=t?T.scroll.x:T.scroll.y,n=t?e.pageX-T.railh.offset().left:e.pageY-T.rail.offset().top,i=t?T.view.w:T.view.h,r(s>=n?i:-i)))},T.newscrolly=T.newscrollx=0,T.hasanimationframe="requestAnimationFrame"in a,T.hascancelanimationframe="cancelAnimationFrame"in a,T.hasborderbox=!1,this.init=function(){if(T.saved.css=[],C.isoperamini)return!0;if(C.isandroid&&!("hidden"in l))return!0;T.opt.emulatetouch=T.opt.emulatetouch||T.opt.touchbehavior,T.hasborderbox=a.getComputedStyle&&"border-box"===a.getComputedStyle(l.body)["box-sizing"];var e={"overflow-y":"hidden"};if((C.isie11||C.isie10)&&(e["-ms-overflow-style"]="none"),T.ishwscroll&&(this.doc.css(C.transitionstyle,C.prefixstyle+"transform 0ms ease-out"),C.transitionend&&T.bind(T.doc,C.transitionend,T.onScrollTransitionEnd,!1)),T.zindex="auto",T.ispage||"auto"!=T.opt.zindex?T.zindex=T.opt.zindex:T.zindex=w()||"auto",!T.ispage&&"auto"!=T.zindex&&T.zindex>s&&(s=T.zindex),T.isie&&0===T.zindex&&"auto"==T.opt.zindex&&(T.zindex="auto"),!T.ispage||!C.cantouch&&!C.isieold){var i=T.docscroll;T.ispage&&(i=T.haswrapper?T.win:T.doc),T.css(i,e),T.ispage&&(C.isie11||C.isie)&&T.css(n("html"),e),!C.isios||T.ispage||T.haswrapper||T.css(k,{"-webkit-overflow-scrolling":"touch"});var d=n(l.createElement("div"));d.css({position:"relative",top:0,float:"right",width:T.opt.cursorwidth,height:0,"background-color":T.opt.cursorcolor,border:T.opt.cursorborder,"background-clip":"padding-box","-webkit-border-radius":T.opt.cursorborderradius,"-moz-border-radius":T.opt.cursorborderradius,"border-radius":T.opt.cursorborderradius}),d.addClass("nicescroll-cursors"),T.cursor=d;var u=n(l.createElement("div"));u.attr("id",T.id),u.addClass("nicescroll-rails nicescroll-rails-vr");var h,m,f=["left","right","top","bottom"];for(var g in f)m=f[g],(h=T.opt.railpadding[m]||0)&&u.css("padding-"+m,h+"px");u.append(d),u.width=Math.max(parseFloat(T.opt.cursorwidth),d.outerWidth()),u.css({width:u.width+"px",zIndex:T.zindex,background:T.opt.background,cursor:"default"}),u.visibility=!0,u.scrollable=!0,u.align="left"==T.opt.railalign?0:1,T.rail=u,T.rail.drag=!1;var v=!1;!T.opt.boxzoom||T.ispage||C.isieold||(v=l.createElement("div"),T.bind(v,"click",T.doZoom),T.bind(v,"mouseenter",function(){T.zoom.css("opacity",T.opt.cursoropacitymax)}),T.bind(v,"mouseleave",function(){T.zoom.css("opacity",T.opt.cursoropacitymin)}),T.zoom=n(v),T.zoom.css({cursor:"pointer",zIndex:T.zindex,backgroundImage:"url("+T.opt.scriptpath+"zoomico.png)",height:18,width:18,backgroundPosition:"0 0"}),T.opt.dblclickzoom&&T.bind(T.win,"dblclick",T.doZoom),C.cantouch&&T.opt.gesturezoom&&(T.ongesturezoom=function(e){return e.scale>1.5&&T.doZoomIn(e),e.scale<.8&&T.doZoomOut(e),T.cancelEvent(e)},T.bind(T.win,"gestureend",T.ongesturezoom))),T.railh=!1;var y;if(T.opt.horizrailenabled&&(T.css(i,{overflowX:"hidden"}),(d=n(l.createElement("div"))).css({position:"absolute",top:0,height:T.opt.cursorwidth,width:0,backgroundColor:T.opt.cursorcolor,border:T.opt.cursorborder,backgroundClip:"padding-box","-webkit-border-radius":T.opt.cursorborderradius,"-moz-border-radius":T.opt.cursorborderradius,"border-radius":T.opt.cursorborderradius}),C.isieold&&d.css("overflow","hidden"),d.addClass("nicescroll-cursors"),T.cursorh=d,(y=n(l.createElement("div"))).attr("id",T.id+"-hr"),y.addClass("nicescroll-rails nicescroll-rails-hr"),y.height=Math.max(parseFloat(T.opt.cursorwidth),d.outerHeight()),y.css({height:y.height+"px",zIndex:T.zindex,background:T.opt.background}),y.append(d),y.visibility=!0,y.scrollable=!0,y.align="top"==T.opt.railvalign?0:1,T.railh=y,T.railh.drag=!1),T.ispage)u.css({position:"fixed",top:0,height:"100%"}),u.css(u.align?{right:0}:{left:0}),T.body.append(u),T.railh&&(y.css({position:"fixed",left:0,width:"100%"}),y.css(y.align?{bottom:0}:{top:0}),T.body.append(y));else{if(T.ishwscroll){"static"==T.win.css("position")&&T.css(T.win,{position:"relative"});var x="HTML"==T.win[0].nodeName?T.body:T.win;n(x).scrollTop(0).scrollLeft(0),T.zoom&&(T.zoom.css({position:"absolute",top:1,right:0,"margin-right":u.width+4}),x.append(T.zoom)),u.css({position:"absolute",top:0}),u.css(u.align?{right:0}:{left:0}),x.append(u),y&&(y.css({position:"absolute",left:0,bottom:0}),y.css(y.align?{bottom:0}:{top:0}),x.append(y))}else{T.isfixed="fixed"==T.win.css("position");var S=T.isfixed?"fixed":"absolute";T.isfixed||(T.viewport=T.getViewport(T.win[0])),T.viewport&&(T.body=T.viewport,/fixed|absolute/.test(T.viewport.css("position"))||T.css(T.viewport,{position:"relative"})),u.css({position:S}),T.zoom&&T.zoom.css({position:S}),T.updateScrollBar(),T.body.append(u),T.zoom&&T.body.append(T.zoom),T.railh&&(y.css({position:S}),T.body.append(y))}C.isios&&T.css(T.win,{"-webkit-tap-highlight-color":"rgba(0,0,0,0)","-webkit-touch-callout":"none"}),C.isie&&T.opt.disableoutline&&T.win.attr("hideFocus","true"),C.iswebkit&&T.opt.disableoutline&&T.win.css("outline","none")}if(!1===T.opt.autohidemode?(T.autohidedom=!1,T.rail.css({opacity:T.opt.cursoropacitymax}),T.railh&&T.railh.css({opacity:T.opt.cursoropacitymax})):!0===T.opt.autohidemode||"leave"===T.opt.autohidemode?(T.autohidedom=n().add(T.rail),C.isie8&&(T.autohidedom=T.autohidedom.add(T.cursor)),T.railh&&(T.autohidedom=T.autohidedom.add(T.railh)),T.railh&&C.isie8&&(T.autohidedom=T.autohidedom.add(T.cursorh))):"scroll"==T.opt.autohidemode?(T.autohidedom=n().add(T.rail),T.railh&&(T.autohidedom=T.autohidedom.add(T.railh))):"cursor"==T.opt.autohidemode?(T.autohidedom=n().add(T.cursor),T.railh&&(T.autohidedom=T.autohidedom.add(T.cursorh))):"hidden"==T.opt.autohidemode&&(T.autohidedom=!1,T.hide(),T.railslocked=!1),C.cantouch||T.istouchcapable||T.opt.emulatetouch||C.hasmstouch){T.scrollmom=new b(T),T.ontouchstart=function(e){if(e.pointerType&&("mouse"===e.pointerType||e.pointerType===e.MSPOINTER_TYPE_MOUSE))return!1;if(T.hasmoving=!1,!T.railslocked){var o;if(C.hasmstouch)for(o=!!e.target&&e.target;o;){var t=n(o).getNiceScroll();if(t.length>0&&t[0].me==T.me)break;if(t.length>0)return!1;if("DIV"==o.nodeName&&o.id==T.id)break;o=!!o.parentNode&&o.parentNode}if(e.stopPropagation(),T.cancelScroll(),(o=T.getTarget(e))&&/INPUT/i.test(o.nodeName)&&/range/i.test(o.type))return T.stopPropagation(e);if(!("clientX"in e)&&"changedTouches"in e&&(e.clientX=e.changedTouches[0].clientX,e.clientY=e.changedTouches[0].clientY),T.forcescreen){var r=e;(e={original:e.original?e.original:e}).clientX=r.screenX,e.clientY=r.screenY}if(T.rail.drag={x:e.clientX,y:e.clientY,sx:T.scroll.x,sy:T.scroll.y,st:T.getScrollTop(),sl:T.getScrollLeft(),pt:2,dl:!1,tg:o},T.ispage||!T.opt.directionlockdeadzone)T.rail.drag.dl="f";else{var i={w:c.width(),h:c.height()},s={w:Math.max(l.body.scrollWidth,l.documentElement.scrollWidth),h:Math.max(l.body.scrollHeight,l.documentElement.scrollHeight)},a=Math.max(0,s.h-i.h),d=Math.max(0,s.w-i.w);!T.rail.scrollable&&T.railh.scrollable?T.rail.drag.ck=a>0&&"v":T.rail.scrollable&&!T.railh.scrollable?T.rail.drag.ck=d>0&&"h":T.rail.drag.ck=!1}if(T.opt.emulatetouch&&T.isiframe&&C.isie){var u=T.win.position();T.rail.drag.x+=u.left,T.rail.drag.y+=u.top}if(T.hasmoving=!1,T.lastmouseup=!1,T.scrollmom.reset(e.clientX,e.clientY),!C.cantouch&&!this.istouchcapable&&!e.pointerType){if(!(!!o&&/INPUT|SELECT|BUTTON|TEXTAREA/i.test(o.nodeName)))return!T.ispage&&C.hasmousecapture&&o.setCapture(),T.opt.emulatetouch?(o.onclick&&!o._onclick&&(o._onclick=o.onclick,o.onclick=function(e){if(T.hasmoving)return!1;o._onclick.call(this,e)}),T.cancelEvent(e)):T.stopPropagation(e);/SUBMIT|CANCEL|BUTTON/i.test(n(o).attr("type"))&&(T.preventclick={tg:o,click:!1})}}},T.ontouchend=function(e){if(!T.rail.drag)return!0;if(2==T.rail.drag.pt){if(e.pointerType&&("mouse"===e.pointerType||e.pointerType===e.MSPOINTER_TYPE_MOUSE))return!1;if(T.rail.drag=!1,T.hasmoving&&(T.scrollmom.doMomentum(),T.lastmouseup=!0,T.hideCursor(),C.hasmousecapture&&l.releaseCapture(),!C.cantouch))return T.cancelEvent(e)}else if(1==T.rail.drag.pt)return T.onmouseup(e)};var z=T.opt.emulatetouch&&T.isiframe&&!C.hasmousecapture;T.ontouchmove=function(e,o){if(!T.rail.drag)return!1;if(e.targetTouches&&T.opt.preventmultitouchscrolling&&e.targetTouches.length>1)return!1;if(e.pointerType&&("mouse"===e.pointerType||e.pointerType===e.MSPOINTER_TYPE_MOUSE))return!1;if(2==T.rail.drag.pt){if("changedTouches"in e&&(e.clientX=e.changedTouches[0].clientX,e.clientY=e.changedTouches[0].clientY),!T.hasmoving){if(T.rail.drag.y===e.clientY&&T.rail.drag.x===e.clientX)return!1;T.triggerScrollStart(e.clientX,e.clientY,0,0,0),T.hasmoving=!0}T.preventclick&&!T.preventclick.click&&(T.preventclick.click=T.preventclick.tg.onclick||!1,T.preventclick.tg.onclick=T.onpreventclick);var t,r;if(r=t=0,z&&!o){var i=T.win.position();r=-i.left,t=-i.top}var s=e.clientY+t,n=s-T.rail.drag.y,a=e.clientX+r,c=a-T.rail.drag.x,d=T.rail.drag.st-n;T.ishwscroll&&T.opt.bouncescroll?d<0?d=Math.round(d/2):d>T.page.maxh&&(d=T.page.maxh+Math.round((d-T.page.maxh)/2)):(d<0&&(d=0,s=0),d>T.page.maxh&&(d=T.page.maxh,s=0));var u;T.railh&&T.railh.scrollable&&(u=T.isrtlmode?c-T.rail.drag.sl:T.rail.drag.sl-c,T.ishwscroll&&T.opt.bouncescroll?u<0?u=Math.round(u/2):u>T.page.maxw&&(u=T.page.maxw+Math.round((u-T.page.maxw)/2)):(u<0&&(u=0,a=0),u>T.page.maxw&&(u=T.page.maxw,a=0)));var h=!1;if(!T.rail.drag.dl){var p=Math.abs(n),m=Math.abs(c),f=T.opt.directionlockdeadzone;if(T.rail.drag.ck){if("v"==T.rail.drag.ck){if(p>f&&m<=.3*p)return T.rail.drag=!1,!0;m>f&&(T.rail.drag.dl="f",k.scrollTop(k.scrollTop()))}else if("h"==T.rail.drag.ck){if(m>f&&p<=.3*m)return T.rail.drag=!1,!0;T.rail.drag.dl="f",k.scrollTop(k.scrollTop())}}else p>f&&m>f?T.rail.drag.dl="f":p>f?T.rail.drag.dl=m?"f":"v":m>f&&(T.rail.drag.dl=p?"f":"h");return!1}if(h=!0,"v"==T.rail.drag.dl?u=T.rail.drag.sl:"h"==T.rail.drag.dl&&(d=T.rail.drag.st),T.synched("touchmove",function(){T.rail.drag&&2==T.rail.drag.pt&&(T.prepareTransition&&T.resetTransition(),T.rail.scrollable&&T.setScrollTop(d),T.scrollmom.update(a,s),T.railh&&T.railh.scrollable?(T.setScrollLeft(u),T.showCursor(d,u)):T.showCursor(d),C.isie10&&l.selection.clear())}),C.ischrome&&T.istouchcapable&&(h=!1),h)return T.cancelEvent(e)}else if(1==T.rail.drag.pt)return T.onmousemove(e)},T.ontouchstartCursor=function(e,o){if(!T.rail.drag||3==T.rail.drag.pt){if(T.locked)return T.cancelEvent(e);T.cancelScroll(),T.rail.drag={x:e.touches[0].clientX,y:e.touches[0].clientY,sx:T.scroll.x,sy:T.scroll.y,pt:3,hr:!!o};var t=T.getTarget(e);return!T.ispage&&C.hasmousecapture&&t.setCapture(),T.isiframe&&!C.hasmousecapture&&(T.saved.csspointerevents=T.doc.css("pointer-events"),T.css(T.doc,{"pointer-events":"none"})),T.cancelEvent(e)}},T.ontouchendCursor=function(e){if(T.rail.drag){if(C.hasmousecapture&&l.releaseCapture(),T.isiframe&&!C.hasmousecapture&&T.doc.css("pointer-events",T.saved.csspointerevents),3!=T.rail.drag.pt)return;return T.rail.drag=!1,T.cancelEvent(e)}},T.ontouchmoveCursor=function(e){if(T.rail.drag){if(3!=T.rail.drag.pt)return;if(T.cursorfreezed=!0,T.rail.drag.hr){T.scroll.x=T.rail.drag.sx+(e.touches[0].clientX-T.rail.drag.x),T.scroll.x<0&&(T.scroll.x=0);var o=T.scrollvaluemaxw;T.scroll.x>o&&(T.scroll.x=o)}else{T.scroll.y=T.rail.drag.sy+(e.touches[0].clientY-T.rail.drag.y),T.scroll.y<0&&(T.scroll.y=0);var t=T.scrollvaluemax;T.scroll.y>t&&(T.scroll.y=t)}return T.synched("touchmove",function(){T.rail.drag&&3==T.rail.drag.pt&&(T.showCursor(),T.rail.drag.hr?T.doScrollLeft(Math.round(T.scroll.x*T.scrollratio.x),T.opt.cursordragspeed):T.doScrollTop(Math.round(T.scroll.y*T.scrollratio.y),T.opt.cursordragspeed))}),T.cancelEvent(e)}}}if(T.onmousedown=function(e,o){if(!T.rail.drag||1==T.rail.drag.pt){if(T.railslocked)return T.cancelEvent(e);T.cancelScroll(),T.rail.drag={x:e.clientX,y:e.clientY,sx:T.scroll.x,sy:T.scroll.y,pt:1,hr:o||!1};var t=T.getTarget(e);return C.hasmousecapture&&t.setCapture(),T.isiframe&&!C.hasmousecapture&&(T.saved.csspointerevents=T.doc.css("pointer-events"),T.css(T.doc,{"pointer-events":"none"})),T.hasmoving=!1,T.cancelEvent(e)}},T.onmouseup=function(e){if(T.rail.drag)return 1!=T.rail.drag.pt||(C.hasmousecapture&&l.releaseCapture(),T.isiframe&&!C.hasmousecapture&&T.doc.css("pointer-events",T.saved.csspointerevents),T.rail.drag=!1,T.cursorfreezed=!1,T.hasmoving&&T.triggerScrollEnd(),T.cancelEvent(e))},T.onmousemove=function(e){if(T.rail.drag){if(1!==T.rail.drag.pt)return;if(C.ischrome&&0===e.which)return T.onmouseup(e);if(T.cursorfreezed=!0,T.hasmoving||T.triggerScrollStart(e.clientX,e.clientY,0,0,0),T.hasmoving=!0,T.rail.drag.hr){T.scroll.x=T.rail.drag.sx+(e.clientX-T.rail.drag.x),T.scroll.x<0&&(T.scroll.x=0);var o=T.scrollvaluemaxw;T.scroll.x>o&&(T.scroll.x=o)}else{T.scroll.y=T.rail.drag.sy+(e.clientY-T.rail.drag.y),T.scroll.y<0&&(T.scroll.y=0);var t=T.scrollvaluemax;T.scroll.y>t&&(T.scroll.y=t)}return T.synched("mousemove",function(){T.cursorfreezed&&(T.showCursor(),T.rail.drag.hr?T.scrollLeft(Math.round(T.scroll.x*T.scrollratio.x)):T.scrollTop(Math.round(T.scroll.y*T.scrollratio.y)))}),T.cancelEvent(e)}T.checkarea=0},C.cantouch||T.opt.emulatetouch)T.onpreventclick=function(e){if(T.preventclick)return T.preventclick.tg.onclick=T.preventclick.click,T.preventclick=!1,T.cancelEvent(e)},T.onclick=!C.isios&&function(e){return!T.lastmouseup||(T.lastmouseup=!1,T.cancelEvent(e))},T.opt.grabcursorenabled&&C.cursorgrabvalue&&(T.css(T.ispage?T.doc:T.win,{cursor:C.cursorgrabvalue}),T.css(T.rail,{cursor:C.cursorgrabvalue}));else{var E=function(e){if(T.selectiondrag){if(e){var o=T.win.outerHeight(),t=e.pageY-T.selectiondrag.top;t>0&&t=o&&(t-=o),T.selectiondrag.df=t}if(0!==T.selectiondrag.df){var r=2*-Math.floor(T.selectiondrag.df/6);T.doScrollBy(r),T.debounced("doselectionscroll",function(){E()},50)}}};T.hasTextSelected="getSelection"in l?function(){return l.getSelection().rangeCount>0}:"selection"in l?function(){return"None"!=l.selection.type}:function(){return!1},T.onselectionstart=function(e){T.ispage||(T.selectiondrag=T.win.offset())},T.onselectionend=function(e){T.selectiondrag=!1},T.onselectiondrag=function(e){T.selectiondrag&&T.hasTextSelected()&&T.debounced("selectionscroll",function(){E(e)},250)}}if(C.hasw3ctouch?(T.css(T.ispage?n("html"):T.win,{"touch-action":"none"}),T.css(T.rail,{"touch-action":"none"}),T.css(T.cursor,{"touch-action":"none"}),T.bind(T.win,"pointerdown",T.ontouchstart),T.bind(l,"pointerup",T.ontouchend),T.bind(l,"pointermove",T.ontouchmove)):C.hasmstouch?(T.css(T.ispage?n("html"):T.win,{"-ms-touch-action":"none"}),T.css(T.rail,{"-ms-touch-action":"none"}),T.css(T.cursor,{"-ms-touch-action":"none"}),T.bind(T.win,"MSPointerDown",T.ontouchstart),T.bind(l,"MSPointerUp",T.ontouchend),T.bind(l,"MSPointerMove",T.ontouchmove),T.bind(T.cursor,"MSGestureHold",function(e){e.preventDefault()}),T.bind(T.cursor,"contextmenu",function(e){e.preventDefault()})):C.cantouch&&(T.bind(T.win,"touchstart",T.ontouchstart,!1,!0),T.bind(l,"touchend",T.ontouchend,!1,!0),T.bind(l,"touchcancel",T.ontouchend,!1,!0),T.bind(l,"touchmove",T.ontouchmove,!1,!0)),T.opt.emulatetouch&&(T.bind(T.win,"mousedown",T.ontouchstart,!1,!0),T.bind(l,"mouseup",T.ontouchend,!1,!0),T.bind(l,"mousemove",T.ontouchmove,!1,!0)),(T.opt.cursordragontouch||!C.cantouch&&!T.opt.emulatetouch)&&(T.rail.css({cursor:"default"}),T.railh&&T.railh.css({cursor:"default"}),T.jqbind(T.rail,"mouseenter",function(){if(!T.ispage&&!T.win.is(":visible"))return!1;T.canshowonmouseevent&&T.showCursor(),T.rail.active=!0}),T.jqbind(T.rail,"mouseleave",function(){T.rail.active=!1,T.rail.drag||T.hideCursor()}),T.opt.sensitiverail&&(T.bind(T.rail,"click",function(e){T.doRailClick(e,!1,!1)}),T.bind(T.rail,"dblclick",function(e){T.doRailClick(e,!0,!1)}),T.bind(T.cursor,"click",function(e){T.cancelEvent(e)}),T.bind(T.cursor,"dblclick",function(e){T.cancelEvent(e)})),T.railh&&(T.jqbind(T.railh,"mouseenter",function(){if(!T.ispage&&!T.win.is(":visible"))return!1;T.canshowonmouseevent&&T.showCursor(),T.rail.active=!0}),T.jqbind(T.railh,"mouseleave",function(){T.rail.active=!1,T.rail.drag||T.hideCursor()}),T.opt.sensitiverail&&(T.bind(T.railh,"click",function(e){T.doRailClick(e,!1,!0)}),T.bind(T.railh,"dblclick",function(e){T.doRailClick(e,!0,!0)}),T.bind(T.cursorh,"click",function(e){T.cancelEvent(e)}),T.bind(T.cursorh,"dblclick",function(e){T.cancelEvent(e)})))),T.opt.cursordragontouch&&(this.istouchcapable||C.cantouch)&&(T.bind(T.cursor,"touchstart",T.ontouchstartCursor),T.bind(T.cursor,"touchmove",T.ontouchmoveCursor),T.bind(T.cursor,"touchend",T.ontouchendCursor),T.cursorh&&T.bind(T.cursorh,"touchstart",function(e){T.ontouchstartCursor(e,!0)}),T.cursorh&&T.bind(T.cursorh,"touchmove",T.ontouchmoveCursor),T.cursorh&&T.bind(T.cursorh,"touchend",T.ontouchendCursor)),C.cantouch||T.opt.emulatetouch?(T.bind(C.hasmousecapture?T.win:l,"mouseup",T.ontouchend),T.onclick&&T.bind(l,"click",T.onclick),T.opt.cursordragontouch?(T.bind(T.cursor,"mousedown",T.onmousedown),T.bind(T.cursor,"mouseup",T.onmouseup),T.cursorh&&T.bind(T.cursorh,"mousedown",function(e){T.onmousedown(e,!0)}),T.cursorh&&T.bind(T.cursorh,"mouseup",T.onmouseup)):(T.bind(T.rail,"mousedown",function(e){e.preventDefault()}),T.railh&&T.bind(T.railh,"mousedown",function(e){e.preventDefault()}))):(T.bind(C.hasmousecapture?T.win:l,"mouseup",T.onmouseup),T.bind(l,"mousemove",T.onmousemove),T.onclick&&T.bind(l,"click",T.onclick),T.bind(T.cursor,"mousedown",T.onmousedown),T.bind(T.cursor,"mouseup",T.onmouseup),T.railh&&(T.bind(T.cursorh,"mousedown",function(e){T.onmousedown(e,!0)}),T.bind(T.cursorh,"mouseup",T.onmouseup)),!T.ispage&&T.opt.enablescrollonselection&&(T.bind(T.win[0],"mousedown",T.onselectionstart),T.bind(l,"mouseup",T.onselectionend),T.bind(T.cursor,"mouseup",T.onselectionend),T.cursorh&&T.bind(T.cursorh,"mouseup",T.onselectionend),T.bind(l,"mousemove",T.onselectiondrag)),T.zoom&&(T.jqbind(T.zoom,"mouseenter",function(){T.canshowonmouseevent&&T.showCursor(),T.rail.active=!0}),T.jqbind(T.zoom,"mouseleave",function(){T.rail.active=!1,T.rail.drag||T.hideCursor()}))),T.opt.enablemousewheel&&(T.isiframe||T.mousewheel(C.isie&&T.ispage?l:T.win,T.onmousewheel),T.mousewheel(T.rail,T.onmousewheel),T.railh&&T.mousewheel(T.railh,T.onmousewheelhr)),T.ispage||C.cantouch||/HTML|^BODY/.test(T.win[0].nodeName)||(T.win.attr("tabindex")||T.win.attr({tabindex:++r}),T.bind(T.win,"focus",function(e){o=T.getTarget(e).id||T.getTarget(e)||!1,T.hasfocus=!0,T.canshowonmouseevent&&T.noticeCursor()}),T.bind(T.win,"blur",function(e){o=!1,T.hasfocus=!1}),T.bind(T.win,"mouseenter",function(e){t=T.getTarget(e).id||T.getTarget(e)||!1,T.hasmousefocus=!0,T.canshowonmouseevent&&T.noticeCursor()}),T.bind(T.win,"mouseleave",function(e){t=!1,T.hasmousefocus=!1,T.rail.drag||T.hideCursor()})),T.onkeypress=function(e){if(T.railslocked&&0===T.page.maxh)return!0;e=e||a.event;var r=T.getTarget(e);if(r&&/INPUT|TEXTAREA|SELECT|OPTION/.test(r.nodeName)&&(!(r.getAttribute("type")||r.type||!1)||!/submit|button|cancel/i.tp))return!0;if(n(r).attr("contenteditable"))return!0;if(T.hasfocus||T.hasmousefocus&&!o||T.ispage&&!o&&!t){var i=e.keyCode;if(T.railslocked&&27!=i)return T.cancelEvent(e);var s=e.ctrlKey||!1,l=e.shiftKey||!1,c=!1;switch(i){case 38:case 63233:T.doScrollBy(72),c=!0;break;case 40:case 63235:T.doScrollBy(-72),c=!0;break;case 37:case 63232:T.railh&&(s?T.doScrollLeft(0):T.doScrollLeftBy(72),c=!0);break;case 39:case 63234:T.railh&&(s?T.doScrollLeft(T.page.maxw):T.doScrollLeftBy(-72),c=!0);break;case 33:case 63276:T.doScrollBy(T.view.h),c=!0;break;case 34:case 63277:T.doScrollBy(-T.view.h),c=!0;break;case 36:case 63273:T.railh&&s?T.doScrollPos(0,0):T.doScrollTo(0),c=!0;break;case 35:case 63275:T.railh&&s?T.doScrollPos(T.page.maxw,T.page.maxh):T.doScrollTo(T.page.maxh),c=!0;break;case 32:T.opt.spacebarenabled&&(l?T.doScrollBy(T.view.h):T.doScrollBy(-T.view.h),c=!0);break;case 27:T.zoomactive&&(T.doZoom(),c=!0)}if(c)return T.cancelEvent(e)}},T.opt.enablekeyboard&&T.bind(l,C.isopera&&!C.isopera12?"keypress":"keydown",T.onkeypress),T.bind(l,"keydown",function(e){(e.ctrlKey||!1)&&(T.wheelprevented=!0)}),T.bind(l,"keyup",function(e){e.ctrlKey||!1||(T.wheelprevented=!1)}),T.bind(a,"blur",function(e){T.wheelprevented=!1}),T.bind(a,"resize",T.lazyResize),T.bind(a,"orientationchange",T.lazyResize),T.bind(a,"load",T.lazyResize),C.ischrome&&!T.ispage&&!T.haswrapper){var M=T.win.attr("style"),L=parseFloat(T.win.css("width"))+1;T.win.css("width",L),T.synched("chromefix",function(){T.win.attr("style",M)})}T.onAttributeChange=function(e){T.lazyResize(T.isieold?250:30)},T.opt.enableobserver&&(T.isie11||!1===p||(T.observerbody=new p(function(e){if(e.forEach(function(e){if("attributes"==e.type)return k.hasClass("modal-open")&&k.hasClass("modal-dialog")&&!n.contains(n(".modal-dialog")[0],T.doc[0])?T.hide():T.show()}),T.me.clientWidth!=T.page.width||T.me.clientHeight!=T.page.height)return T.lazyResize(30)}),T.observerbody.observe(l.body,{childList:!0,subtree:!0,characterData:!1,attributes:!0,attributeFilter:["class"]})),T.ispage||T.haswrapper||(!1!==p?(T.observer=new p(function(e){e.forEach(T.onAttributeChange)}),T.observer.observe(T.win[0],{childList:!0,characterData:!1,attributes:!0,subtree:!1}),T.observerremover=new p(function(e){e.forEach(function(e){if(e.removedNodes.length>0)for(var o in e.removedNodes)if(T&&e.removedNodes[o]==T.win[0])return T.remove()})}),T.observerremover.observe(T.win[0].parentNode,{childList:!0,characterData:!1,attributes:!1,subtree:!1})):(T.bind(T.win,C.isie&&!C.isie9?"propertychange":"DOMAttrModified",T.onAttributeChange),C.isie9&&T.win[0].attachEvent("onpropertychange",T.onAttributeChange),T.bind(T.win,"DOMNodeRemoved",function(e){e.target==T.win[0]&&T.remove()})))),!T.ispage&&T.opt.boxzoom&&T.bind(a,"resize",T.resizeZoom),T.istextarea&&(T.bind(T.win,"keydown",T.lazyResize),T.bind(T.win,"mouseup",T.lazyResize)),T.lazyResize(30)}if("IFRAME"==this.doc[0].nodeName){var N=function(){T.iframexd=!1;var o;try{(o="contentDocument"in this?this.contentDocument:this.contentWindow._doc).domain}catch(e){T.iframexd=!0,o=!1}if(T.iframexd)return"console"in a&&console.log("NiceScroll error: policy restriced iframe"),!0;if(T.forcescreen=!0,T.isiframe&&(T.iframe={doc:n(o),html:T.doc.contents().find("html")[0],body:T.doc.contents().find("body")[0]},T.getContentSize=function(){return{w:Math.max(T.iframe.html.scrollWidth,T.iframe.body.scrollWidth),h:Math.max(T.iframe.html.scrollHeight,T.iframe.body.scrollHeight)}},T.docscroll=n(T.iframe.body)),!C.isios&&T.opt.iframeautoresize&&!T.isiframe){T.win.scrollTop(0),T.doc.height("");var t=Math.max(o.getElementsByTagName("html")[0].scrollHeight,o.body.scrollHeight);T.doc.height(t)}T.lazyResize(30),T.css(n(T.iframe.body),e),C.isios&&T.haswrapper&&T.css(n(o.body),{"-webkit-transform":"translate3d(0,0,0)"}),"contentWindow"in this?T.bind(this.contentWindow,"scroll",T.onscroll):T.bind(o,"scroll",T.onscroll),T.opt.enablemousewheel&&T.mousewheel(o,T.onmousewheel),T.opt.enablekeyboard&&T.bind(o,C.isopera?"keypress":"keydown",T.onkeypress),C.cantouch?(T.bind(o,"touchstart",T.ontouchstart),T.bind(o,"touchmove",T.ontouchmove)):T.opt.emulatetouch&&(T.bind(o,"mousedown",T.ontouchstart),T.bind(o,"mousemove",function(e){return T.ontouchmove(e,!0)}),T.opt.grabcursorenabled&&C.cursorgrabvalue&&T.css(n(o.body),{cursor:C.cursorgrabvalue})),T.bind(o,"mouseup",T.ontouchend),T.zoom&&(T.opt.dblclickzoom&&T.bind(o,"dblclick",T.doZoom),T.ongesturezoom&&T.bind(o,"gestureend",T.ongesturezoom))};this.doc[0].readyState&&"complete"===this.doc[0].readyState&&setTimeout(function(){N.call(T.doc[0],!1)},500),T.bind(this.doc,"load",N)}},this.showCursor=function(e,o){if(T.cursortimeout&&(clearTimeout(T.cursortimeout),T.cursortimeout=0),T.rail){if(T.autohidedom&&(T.autohidedom.stop().css({opacity:T.opt.cursoropacitymax}),T.cursoractive=!0),T.rail.drag&&1==T.rail.drag.pt||(void 0!==e&&!1!==e&&(T.scroll.y=e/T.scrollratio.y|0),void 0!==o&&(T.scroll.x=o/T.scrollratio.x|0)),T.cursor.css({height:T.cursorheight,top:T.scroll.y}),T.cursorh){var t=T.hasreversehr?T.scrollvaluemaxw-T.scroll.x:T.scroll.x;T.cursorh.css({width:T.cursorwidth,left:!T.rail.align&&T.rail.visibility?t+T.rail.width:t}),T.cursoractive=!0}T.zoom&&T.zoom.stop().css({opacity:T.opt.cursoropacitymax})}},this.hideCursor=function(e){T.cursortimeout||T.rail&&T.autohidedom&&(T.hasmousefocus&&"leave"===T.opt.autohidemode||(T.cursortimeout=setTimeout(function(){T.rail.active&&T.showonmouseevent||(T.autohidedom.stop().animate({opacity:T.opt.cursoropacitymin}),T.zoom&&T.zoom.stop().animate({opacity:T.opt.cursoropacitymin}),T.cursoractive=!1),T.cursortimeout=0},e||T.opt.hidecursordelay)))},this.noticeCursor=function(e,o,t){T.showCursor(o,t),T.rail.active||T.hideCursor(e)},this.getContentSize=T.ispage?function(){return{w:Math.max(l.body.scrollWidth,l.documentElement.scrollWidth),h:Math.max(l.body.scrollHeight,l.documentElement.scrollHeight)}}:T.haswrapper?function(){return{w:T.doc[0].offsetWidth,h:T.doc[0].offsetHeight}}:function(){return{w:T.docscroll[0].scrollWidth,h:T.docscroll[0].scrollHeight}},this.onResize=function(e,o){if(!T||!T.win)return!1;var t=T.page.maxh,r=T.page.maxw,i={h:T.view.h,w:T.view.w};if(T.view={w:T.ispage?T.win.width():T.win[0].clientWidth,h:T.ispage?T.win.height():T.win[0].clientHeight},T.page=o||T.getContentSize(),T.page.maxh=Math.max(0,T.page.h-T.view.h),T.page.maxw=Math.max(0,T.page.w-T.view.w),T.page.maxh==t&&T.page.maxw==r&&T.view.w==i.w&&T.view.h==i.h){if(T.ispage)return T;var s=T.win.offset();if(T.lastposition){var n=T.lastposition;if(n.top==s.top&&n.left==s.left)return T}T.lastposition=s}return 0===T.page.maxh?(T.hideRail(),T.scrollvaluemax=0,T.scroll.y=0,T.scrollratio.y=0,T.cursorheight=0,T.setScrollTop(0),T.rail&&(T.rail.scrollable=!1)):(T.page.maxh-=T.opt.railpadding.top+T.opt.railpadding.bottom,T.rail.scrollable=!0),0===T.page.maxw?(T.hideRailHr(),T.scrollvaluemaxw=0,T.scroll.x=0,T.scrollratio.x=0,T.cursorwidth=0,T.setScrollLeft(0),T.railh&&(T.railh.scrollable=!1)):(T.page.maxw-=T.opt.railpadding.left+T.opt.railpadding.right,T.railh&&(T.railh.scrollable=T.opt.horizrailenabled)),T.railslocked=T.locked||0===T.page.maxh&&0===T.page.maxw,T.railslocked?(T.ispage||T.updateScrollBar(T.view),!1):(T.hidden||T.visibility?!T.railh||T.hidden||T.railh.visibility||T.showRailHr():T.showRail().showRailHr(),T.istextarea&&T.win.css("resize")&&"none"!=T.win.css("resize")&&(T.view.h-=20),T.cursorheight=Math.min(T.view.h,Math.round(T.view.h*(T.view.h/T.page.h))),T.cursorheight=T.opt.cursorfixedheight?T.opt.cursorfixedheight:Math.max(T.opt.cursorminheight,T.cursorheight),T.cursorwidth=Math.min(T.view.w,Math.round(T.view.w*(T.view.w/T.page.w))),T.cursorwidth=T.opt.cursorfixedheight?T.opt.cursorfixedheight:Math.max(T.opt.cursorminheight,T.cursorwidth),T.scrollvaluemax=T.view.h-T.cursorheight-(T.opt.railpadding.top+T.opt.railpadding.bottom),T.hasborderbox||(T.scrollvaluemax-=T.cursor[0].offsetHeight-T.cursor[0].clientHeight),T.railh&&(T.railh.width=T.page.maxh>0?T.view.w-T.rail.width:T.view.w,T.scrollvaluemaxw=T.railh.width-T.cursorwidth-(T.opt.railpadding.left+T.opt.railpadding.right)),T.ispage||T.updateScrollBar(T.view),T.scrollratio={x:T.page.maxw/T.scrollvaluemaxw,y:T.page.maxh/T.scrollvaluemax},T.getScrollTop()>T.page.maxh?T.doScrollTop(T.page.maxh):(T.scroll.y=T.getScrollTop()/T.scrollratio.y|0,T.scroll.x=T.getScrollLeft()/T.scrollratio.x|0,T.cursoractive&&T.noticeCursor()),T.scroll.y&&0===T.getScrollTop()&&T.doScrollTo(Math.floor(T.scroll.y*T.scrollratio.y)),T)},this.resize=T.onResize,this.hlazyresize=0,this.lazyResize=function(e){T.hlazyresize&&clearTimeout(T.hlazyresize);var o=!T.ispage&&!T.haswrapper;return o&&T.hideRails(),T.hlazyresize=setTimeout(function(){T&&(o&&T.showRails(),T.resize())},240),T},this.jqbind=function(e,o,t){T.events.push({e:e,n:o,f:t,q:!0}),n(e).on(o,t)},this.mousewheel=function(e,o,t){var r="jquery"in e?e[0]:e;if("onwheel"in l.createElement("div"))T._bind(r,"wheel",o,t||!1);else{var i=void 0!==l.onmousewheel?"mousewheel":"DOMMouseScroll";x(r,i,o,t||!1),"DOMMouseScroll"==i&&x(r,"MozMousePixelScroll",o,t||!1)}};var _=!1;if(C.haseventlistener){try{var H=Object.defineProperty({},"passive",{get:function(){_=!0}});a.addEventListener("test",null,H)}catch(e){}this.cancelEvent=function(e){return!!e&&((e=e.original?e.original:e).cancelable&&e.preventDefault(),e.stopPropagation(),e.preventManipulation&&e.preventManipulation(),!1)},this.stopPropagation=function(e){return!!e&&((e=e.original?e.original:e).stopPropagation(),!1)}}else Event.prototype.preventDefault=function(){this.returnValue=!1},Event.prototype.stopPropagation=function(){this.cancelBubble=!0},a.constructor.prototype.addEventListener=l.constructor.prototype.addEventListener=Element.prototype.addEventListener=function(e,o,t){this.attachEvent("on"+e,o)},a.constructor.prototype.removeEventListener=l.constructor.prototype.removeEventListener=Element.prototype.removeEventListener=function(e,o,t){this.detachEvent("on"+e,o)},this.cancelEvent=function(e){return!!(e=e||a.event)&&(e.cancelBubble=!0,e.cancel=!0,e.returnValue=!1,!1)},this.stopPropagation=function(e){return(e=e||a.event)&&(e.cancelBubble=!0),!1};this.bind=function(e,o,t,r,i){var s="jquery"in e?e[0]:e;T._bind(s,o,t,r||!1,i||!1)},this._bind=function(e,o,t,r,i){T.events.push({e:e,n:o,f:t,b:r,q:!1}),_&&i?e.addEventListener(o,t,{passive:!1,capture:r}):e.addEventListener(o,t,r||!1)},this._unbind=function(e,o,t,r){e.removeEventListener(o,t,r)},this.unbindAll=function(){for(var e=0;e0)return t;o=!!o.parentNode&&o.parentNode}return!1},this.triggerScrollStart=function(e,o,t,r,i){if(T.onscrollstart){var s={type:"scrollstart",current:{x:e,y:o},request:{x:t,y:r},end:{x:T.newscrollx,y:T.newscrolly},speed:i};T.onscrollstart.call(T,s)}},this.triggerScrollEnd=function(){if(T.onscrollend){var e=T.getScrollLeft(),o=T.getScrollTop(),t={type:"scrollend",current:{x:e,y:o},end:{x:e,y:o}};T.onscrollend.call(T,t)}};var I=0,O=0,Y=0,B=1,X=!1;if(this.onmousewheel=function(e){if(!T.wheelprevented){if(T.railslocked)return T.debounced("checkunlock",T.resize,250),!0;if(T.rail.drag)return T.cancelEvent(e);if("auto"===T.opt.oneaxismousemode&&0!==e.deltaX&&(T.opt.oneaxismousemode=!1),T.opt.oneaxismousemode&&0===e.deltaX&&!T.rail.scrollable)return!T.railh||!T.railh.scrollable||T.onmousewheelhr(e);var o=m(),t=!1;if(T.opt.preservenativescrolling&&T.checkarea+600T.page.maxh&&(o=T.page.maxh+(o-T.page.maxh)/2|0),e<0?e=e/2|0:e>T.page.maxw&&(e=T.page.maxw+(o-T.page.maxw)/2|0)):(o<0?o=0:o>T.page.maxh&&(o=T.page.maxh),e<0?e=0:e>T.page.maxw&&(e=T.page.maxw)),T.scrollrunning&&e==T.newscrollx&&o==T.newscrolly)return!1;T.newscrolly=o,T.newscrollx=e;var s=T.getScrollTop(),n=T.getScrollLeft(),l={};l.x=e-n,l.y=o-s;var a=0|Math.sqrt(l.x*l.x+l.y*l.y),c=T.prepareTransition(a);T.scrollrunning||(T.scrollrunning=!0,T.triggerScrollStart(n,s,e,o,c),T.cursorupdate.start()),T.scrollendtrapped=!0,C.transitionend||(T.scrollendtrapped&&clearTimeout(T.scrollendtrapped),T.scrollendtrapped=setTimeout(T.onScrollTransitionEnd,c)),T.setScrollTop(T.newscrolly),T.setScrollLeft(T.newscrollx)},this.cancelScroll=function(){if(!T.scrollendtrapped)return!0;var e=T.getScrollTop(),o=T.getScrollLeft();return T.scrollrunning=!1,C.transitionend||clearTimeout(C.transitionend),T.scrollendtrapped=!1,T.resetTransition(),T.setScrollTop(e),T.railh&&T.setScrollLeft(o),T.timerscroll&&T.timerscroll.tm&&clearInterval(T.timerscroll.tm),T.timerscroll=!1,T.cursorfreezed=!1,T.cursorupdate.stop(),T.showCursor(e,o),T},this.onScrollTransitionEnd=function(){if(T.scrollendtrapped){var e=T.getScrollTop(),o=T.getScrollLeft();if(e<0?e=0:e>T.page.maxh&&(e=T.page.maxh),o<0?o=0:o>T.page.maxw&&(o=T.page.maxw),e!=T.newscrolly||o!=T.newscrollx)return T.doScrollPos(o,e,T.opt.snapbackspeed);T.scrollrunning&&T.triggerScrollEnd(),T.scrollrunning=!1,T.scrollendtrapped=!1,T.resetTransition(),T.timerscroll=!1,T.setScrollTop(e),T.railh&&T.setScrollLeft(o),T.cursorupdate.stop(),T.noticeCursor(!1,e,o),T.cursorfreezed=!1}}}else this.doScrollLeft=function(e,o){var t=T.scrollrunning?T.newscrolly:T.getScrollTop();T.doScrollPos(e,t,o)},this.doScrollTop=function(e,o){var t=T.scrollrunning?T.newscrollx:T.getScrollLeft();T.doScrollPos(t,e,o)},this.doScrollPos=function(e,o,t){var r=T.getScrollTop(),i=T.getScrollLeft();((T.newscrolly-r)*(o-r)<0||(T.newscrollx-i)*(e-i)<0)&&T.cancelScroll();var s=!1;if(T.bouncescroll&&T.rail.visibility||(o<0?(o=0,s=!0):o>T.page.maxh&&(o=T.page.maxh,s=!0)),T.bouncescroll&&T.railh.visibility||(e<0?(e=0,s=!0):e>T.page.maxw&&(e=T.page.maxw,s=!0)),T.scrollrunning&&T.newscrolly===o&&T.newscrollx===e)return!0;T.newscrolly=o,T.newscrollx=e,T.dst={},T.dst.x=e-i,T.dst.y=o-r,T.dst.px=i,T.dst.py=r;var n=0|Math.sqrt(T.dst.x*T.dst.x+T.dst.y*T.dst.y),l=T.getTransitionSpeed(n);T.bzscroll={};var a=s?1:.58;T.bzscroll.x=new N(i,T.newscrollx,l,0,0,a,1),T.bzscroll.y=new N(r,T.newscrolly,l,0,0,a,1);var c=function(){if(T.scrollrunning){var e=T.bzscroll.y.getPos();T.setScrollLeft(T.bzscroll.x.getNow()),T.setScrollTop(T.bzscroll.y.getNow()),e<=1?d(c):(T.scrollrunning=!1,T.timer=0,T.triggerScrollEnd())}};T.scrollrunning||(T.triggerScrollStart(i,r,e,o,l),T.scrollrunning=!0,T.timer=d(c))},this.cancelScroll=function(){return T.timer&&u(T.timer),T.timer=0,T.bzscroll=!1,T.scrollrunning=!1,T};else this.doScrollLeft=function(e,o){var t=T.getScrollTop();T.doScrollPos(e,t,o)},this.doScrollTop=function(e,o){var t=T.getScrollLeft();T.doScrollPos(t,e,o)},this.doScrollPos=function(e,o,t){var r=e>T.page.maxw?T.page.maxw:e;r<0&&(r=0);var i=o>T.page.maxh?T.page.maxh:o;i<0&&(i=0),T.synched("scroll",function(){T.setScrollTop(i),T.setScrollLeft(r)})},this.cancelScroll=function(){};this.doScrollBy=function(e,o){S(0,e)},this.doScrollLeftBy=function(e,o){S(e,0)},this.doScrollTo=function(e,o){var t=o?Math.round(e*T.scrollratio.y):e;t<0?t=0:t>T.page.maxh&&(t=T.page.maxh),T.cursorfreezed=!1,T.doScrollTop(e)},this.checkContentSize=function(){var e=T.getContentSize();e.h==T.page.h&&e.w==T.page.w||T.resize(!1,e)},T.onscroll=function(e){T.rail.drag||T.cursorfreezed||T.synched("scroll",function(){T.scroll.y=Math.round(T.getScrollTop()/T.scrollratio.y),T.railh&&(T.scroll.x=Math.round(T.getScrollLeft()/T.scrollratio.x)),T.noticeCursor()})},T.bind(T.docscroll,"scroll",T.onscroll),this.doZoomIn=function(e){if(!T.zoomactive){T.zoomactive=!0,T.zoomrestore={style:{}};var o=["position","top","left","zIndex","backgroundColor","marginTop","marginBottom","marginLeft","marginRight"],t=T.win[0].style;for(var r in o){var i=o[r];T.zoomrestore.style[i]=void 0!==t[i]?t[i]:""}T.zoomrestore.style.width=T.win.css("width"),T.zoomrestore.style.height=T.win.css("height"),T.zoomrestore.padding={w:T.win.outerWidth()-T.win.width(),h:T.win.outerHeight()-T.win.height()},C.isios4&&(T.zoomrestore.scrollTop=c.scrollTop(),c.scrollTop(0)),T.win.css({position:C.isios4?"absolute":"fixed",top:0,left:0,zIndex:s+100,margin:0});var n=T.win.css("backgroundColor");return(""===n||/transparent|rgba\(0, 0, 0, 0\)|rgba\(0,0,0,0\)/.test(n))&&T.win.css("backgroundColor","#fff"),T.rail.css({zIndex:s+101}),T.zoom.css({zIndex:s+102}),T.zoom.css("backgroundPosition","0 -18px"),T.resizeZoom(),T.onzoomin&&T.onzoomin.call(T),T.cancelEvent(e)}},this.doZoomOut=function(e){if(T.zoomactive)return T.zoomactive=!1,T.win.css("margin",""),T.win.css(T.zoomrestore.style),C.isios4&&c.scrollTop(T.zoomrestore.scrollTop),T.rail.css({"z-index":T.zindex}),T.zoom.css({"z-index":T.zindex}),T.zoomrestore=!1,T.zoom.css("backgroundPosition","0 0"),T.onResize(),T.onzoomout&&T.onzoomout.call(T),T.cancelEvent(e)},this.doZoom=function(e){return T.zoomactive?T.doZoomOut(e):T.doZoomIn(e)},this.resizeZoom=function(){if(T.zoomactive){var e=T.getScrollTop();T.win.css({width:c.width()-T.zoomrestore.padding.w+"px",height:c.height()-T.zoomrestore.padding.h+"px"}),T.onResize(),T.setScrollTop(Math.min(T.page.maxh,e))}},this.init(),n.nicescroll.push(this)},b=function(e){var o=this;this.nc=e,this.lastx=0,this.lasty=0,this.speedx=0,this.speedy=0,this.lasttime=0,this.steptime=0,this.snapx=!1,this.snapy=!1,this.demulx=0,this.demuly=0,this.lastscrollx=-1,this.lastscrolly=-1,this.chkx=0,this.chky=0,this.timer=0,this.reset=function(e,t){o.stop(),o.steptime=0,o.lasttime=m(),o.speedx=0,o.speedy=0,o.lastx=e,o.lasty=t,o.lastscrollx=-1,o.lastscrolly=-1},this.update=function(e,t){var r=m();o.steptime=r-o.lasttime,o.lasttime=r;var i=t-o.lasty,s=e-o.lastx,n=o.nc.getScrollTop()+i,l=o.nc.getScrollLeft()+s;o.snapx=l<0||l>o.nc.page.maxw,o.snapy=n<0||n>o.nc.page.maxh,o.speedx=s,o.speedy=i,o.lastx=e,o.lasty=t},this.stop=function(){o.nc.unsynched("domomentum2d"),o.timer&&clearTimeout(o.timer),o.timer=0,o.lastscrollx=-1,o.lastscrolly=-1},this.doSnapy=function(e,t){var r=!1;t<0?(t=0,r=!0):t>o.nc.page.maxh&&(t=o.nc.page.maxh,r=!0),e<0?(e=0,r=!0):e>o.nc.page.maxw&&(e=o.nc.page.maxw,r=!0),r?o.nc.doScrollPos(e,t,o.nc.opt.snapbackspeed):o.nc.triggerScrollEnd()},this.doMomentum=function(e){var t=m(),r=e?t+e:o.lasttime,i=o.nc.getScrollLeft(),s=o.nc.getScrollTop(),n=o.nc.page.maxh,l=o.nc.page.maxw;o.speedx=l>0?Math.min(60,o.speedx):0,o.speedy=n>0?Math.min(60,o.speedy):0;var a=r&&t-r<=60;(s<0||s>n||i<0||i>l)&&(a=!1);var c=!(!o.speedy||!a)&&o.speedy,d=!(!o.speedx||!a)&&o.speedx;if(c||d){var u=Math.max(16,o.steptime);if(u>50){var h=u/50;o.speedx*=h,o.speedy*=h,u=50}o.demulxy=0,o.lastscrollx=o.nc.getScrollLeft(),o.chkx=o.lastscrollx,o.lastscrolly=o.nc.getScrollTop(),o.chky=o.lastscrolly;var p=o.lastscrollx,f=o.lastscrolly,g=function(){var e=m()-t>600?.04:.02;o.speedx&&(p=Math.floor(o.lastscrollx-o.speedx*(1-o.demulxy)),o.lastscrollx=p,(p<0||p>l)&&(e=.1)),o.speedy&&(f=Math.floor(o.lastscrolly-o.speedy*(1-o.demulxy)),o.lastscrolly=f,(f<0||f>n)&&(e=.1)),o.demulxy=Math.min(1,o.demulxy+e),o.nc.synched("domomentum2d",function(){if(o.speedx){o.nc.getScrollLeft();o.chkx=p,o.nc.setScrollLeft(p)}if(o.speedy){o.nc.getScrollTop();o.chky=f,o.nc.setScrollTop(f)}o.timer||(o.nc.hideCursor(),o.doSnapy(p,f))}),o.demulxy<1?o.timer=setTimeout(g,u):(o.stop(),o.nc.hideCursor(),o.doSnapy(p,f))};g()}else o.doSnapy(o.nc.getScrollLeft(),o.nc.getScrollTop())}},y=e.fn.scrollTop;e.cssHooks.pageYOffset={get:function(e,o,t){var r=n.data(e,"__nicescroll")||!1;return r&&r.ishwscroll?r.getScrollTop():y.call(e)},set:function(e,o){var t=n.data(e,"__nicescroll")||!1;return t&&t.ishwscroll?t.setScrollTop(parseInt(o)):y.call(e,o),this}},e.fn.scrollTop=function(e){if(void 0===e){var o=!!this[0]&&(n.data(this[0],"__nicescroll")||!1);return o&&o.ishwscroll?o.getScrollTop():y.call(this)}return this.each(function(){var o=n.data(this,"__nicescroll")||!1;o&&o.ishwscroll?o.setScrollTop(parseInt(e)):y.call(n(this),e)})};var x=e.fn.scrollLeft;n.cssHooks.pageXOffset={get:function(e,o,t){var r=n.data(e,"__nicescroll")||!1;return r&&r.ishwscroll?r.getScrollLeft():x.call(e)},set:function(e,o){var t=n.data(e,"__nicescroll")||!1;return t&&t.ishwscroll?t.setScrollLeft(parseInt(o)):x.call(e,o),this}},e.fn.scrollLeft=function(e){if(void 0===e){var o=!!this[0]&&(n.data(this[0],"__nicescroll")||!1);return o&&o.ishwscroll?o.getScrollLeft():x.call(this)}return this.each(function(){var o=n.data(this,"__nicescroll")||!1;o&&o.ishwscroll?o.setScrollLeft(parseInt(e)):x.call(n(this),e)})};var S=function(e){var o=this;if(this.length=0,this.name="nicescrollarray",this.each=function(e){return n.each(o,e),o},this.push=function(e){o[o.length]=e,o.length++},this.eq=function(e){return o[e]},e)for(var t=0;t1?n(e,r):s,i.win=r}!("doc"in i)||"win"in i||(i.win=r);var l=r.data("__nicescroll")||!1;l||(i.doc=i.doc||r,l=new w(i,r),r.data("__nicescroll",l)),t.push(l)}),1===t.length?t[0]:t},a.NiceScroll={getjQuery:function(){return e}},n.nicescroll||(n.nicescroll=new S,n.nicescroll.options=f)}); \ No newline at end of file +!function(e){"function"==typeof define&&define.amd?define(["jquery"],e):"object"==typeof exports?module.exports=e(require("jquery")):e(jQuery)}(function(e){"use strict";var o=!1,t=!1,r=0,i=2e3,s=0,n=e,l=document,a=window,c=n(a),d=[],u=a.requestAnimationFrame||a.webkitRequestAnimationFrame||a.mozRequestAnimationFrame||!1,h=a.cancelAnimationFrame||a.webkitCancelAnimationFrame||a.mozCancelAnimationFrame||!1;if(u)a.cancelAnimationFrame||(h=function(e){});else{var p=0;u=function(e,o){var t=(new Date).getTime(),r=Math.max(0,16-(t-p)),i=a.setTimeout(function(){e(t+r)},r);return p=t+r,i},h=function(e){a.clearTimeout(e)}}var m=a.MutationObserver||a.WebKitMutationObserver||!1,f=Date.now||function(){return(new Date).getTime()},g={zindex:"auto",cursoropacitymin:0,cursoropacitymax:1,cursorcolor:"#424242",cursorwidth:"6px",cursorborder:"1px solid #fff",cursorborderradius:"5px",scrollspeed:40,mousescrollstep:27,touchbehavior:!1,emulatetouch:!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 e=l.currentScript||function(){var e=l.getElementsByTagName("script");return!!e.length&&e[e.length-1]}(),o=e?e.src.split("?")[0]:"";return o.split("/").length>0?o.split("/").slice(0,-1).join("/")+"/":""}(),preventmultitouchscrolling:!0,disablemutationobserver:!1,enableobserver:!0,scrollbarid:!1},v=!1,w=function(){if(v)return v;var e=l.createElement("DIV"),o=e.style,t=navigator.userAgent,r=navigator.platform,i={};return i.haspointerlock="pointerLockElement"in l||"webkitPointerLockElement"in l||"mozPointerLockElement"in l,i.isopera="opera"in a,i.isopera12=i.isopera&&"getUserMedia"in navigator,i.isoperamini="[object OperaMini]"===Object.prototype.toString.call(a.operamini),i.isie="all"in l&&"attachEvent"in e&&!i.isopera,i.isieold=i.isie&&!("msInterpolationMode"in o),i.isie7=i.isie&&!i.isieold&&(!("documentMode"in l)||7===l.documentMode),i.isie8=i.isie&&"documentMode"in l&&8===l.documentMode,i.isie9=i.isie&&"performance"in a&&9===l.documentMode,i.isie10=i.isie&&"performance"in a&&10===l.documentMode,i.isie11="msRequestFullscreen"in e&&l.documentMode>=11,i.ismsedge="msCredentials"in a,i.ismozilla="MozAppearance"in o,i.iswebkit=!i.ismsedge&&"WebkitAppearance"in o,i.ischrome=i.iswebkit&&"chrome"in a,i.ischrome38=i.ischrome&&"touchAction"in o,i.ischrome22=!i.ischrome38&&i.ischrome&&i.haspointerlock,i.ischrome26=!i.ischrome38&&i.ischrome&&"transition"in o,i.cantouch="ontouchstart"in l.documentElement||"ontouchstart"in a,i.hasw3ctouch=(a.PointerEvent||!1)&&(navigator.MaxTouchPoints>0||navigator.msMaxTouchPoints>0),i.hasmstouch=!i.hasw3ctouch&&(a.MSPointerEvent||!1),i.ismac=/^mac$/i.test(r),i.isios=i.cantouch&&/iphone|ipad|ipod/i.test(r),i.isios4=i.isios&&!("seal"in Object),i.isios7=i.isios&&"webkitHidden"in l,i.isios8=i.isios&&"hidden"in l,i.isios10=i.isios&&a.Proxy,i.isandroid=/android/i.test(t),i.haseventlistener="addEventListener"in e,i.trstyle=!1,i.hastransform=!1,i.hastranslate3d=!1,i.transitionstyle=!1,i.hastransition=!1,i.transitionend=!1,i.trstyle="transform",i.hastransform="transform"in o||function(){for(var e=["msTransform","webkitTransform","MozTransform","OTransform"],t=0,r=e.length;t0;){if(9==e[0].nodeType)return!1;var o=e.css("zIndex");if(!isNaN(o)&&0!==o)return parseInt(o);e=e.parent()}return!1}function x(e,o,t){var r=e.css(o),i=parseFloat(r);if(isNaN(i)){var s=3==(i=I[r]||0)?t?T.win.outerHeight()-T.win.innerHeight():T.win.outerWidth()-T.win.innerWidth():1;return T.isie8&&i&&(i+=1),s?i:0}return i}function S(e,o,t,r){T._bind(e,o,function(r){var i={original:r=r||a.event,target:r.target||r.srcElement,type:"wheel",deltaMode:"MozMousePixelScroll"==r.type?0:1,deltaX:0,deltaZ:0,preventDefault:function(){return r.preventDefault?r.preventDefault():r.returnValue=!1,!1},stopImmediatePropagation:function(){r.stopImmediatePropagation?r.stopImmediatePropagation():r.cancelBubble=!0}};return"mousewheel"==o?(r.wheelDeltaX&&(i.deltaX=-.025*r.wheelDeltaX),r.wheelDeltaY&&(i.deltaY=-.025*r.wheelDeltaY),!i.deltaY&&!i.deltaX&&(i.deltaY=-.025*r.wheelDelta)):i.deltaY=r.detail,t.call(e,i)},r)}function z(e,o,t,r){T.scrollrunning||(T.newscrolly=T.getScrollTop(),T.newscrollx=T.getScrollLeft(),D=f());var i=f()-D;if(D=f(),i>350?A=1:A+=(2-A)/10,e=e*A|0,o=o*A|0,e){if(r)if(e<0){if(T.getScrollLeft()>=T.page.maxw)return!0}else if(T.getScrollLeft()<=0)return!0;var s=e>0?1:-1;X!==s&&(T.scrollmom&&T.scrollmom.stop(),T.newscrollx=T.getScrollLeft(),X=s),T.lastdeltax-=e}if(o){if(function(){var e=T.getScrollTop();if(o<0){if(e>=T.page.maxh)return!0}else if(e<=0)return!0}()){if(M.nativeparentscrolling&&t&&!T.ispage&&!T.zoomactive)return!0;var n=T.view.h>>1;T.newscrolly<-n?(T.newscrolly=-n,o=-1):T.newscrolly>T.page.maxh+n?(T.newscrolly=T.page.maxh+n,o=1):o=0}var l=o>0?1:-1;B!==l&&(T.scrollmom&&T.scrollmom.stop(),T.newscrolly=T.getScrollTop(),B=l),T.lastdeltay-=o}(o||e)&&T.synched("relativexy",function(){var e=T.lastdeltay+T.newscrolly;T.lastdeltay=0;var o=T.lastdeltax+T.newscrollx;T.lastdeltax=0,T.rail.drag||T.doScrollPos(o,e)})}function k(e,o,t){var r,i;return!(t||!q)||(0===e.deltaMode?(r=-e.deltaX*(M.mousescrollstep/54)|0,i=-e.deltaY*(M.mousescrollstep/54)|0):1===e.deltaMode&&(r=-e.deltaX*M.mousescrollstep*50/80|0,i=-e.deltaY*M.mousescrollstep*50/80|0),o&&M.oneaxismousemode&&0===r&&i&&(r=i,i=0,t&&(r<0?T.getScrollLeft()>=T.page.maxw:T.getScrollLeft()<=0)&&(i=r,r=0)),T.isrtlmode&&(r=-r),z(r,i,t,!0)?void(t&&(q=!0)):(q=!1,e.stopImmediatePropagation(),e.preventDefault()))}var T=this;this.version="3.7.4-f",this.name="nicescroll",this.me=p;var E=n("body"),M=this.opt={doc:E,win:!1};if(n.extend(M,g),M.snapbackspeed=80,e)for(var L in M)void 0!==e[L]&&(M[L]=e[L]);if(M.disablemutationobserver&&(m=!1),this.doc=M.doc,this.iddoc=this.doc&&this.doc[0]?this.doc[0].id||"":"",this.ispage=/^BODY|HTML/.test(M.win?M.win[0].nodeName:this.doc[0].nodeName),this.haswrapper=!1!==M.win,this.win=M.win||(this.ispage?c:this.doc),this.docscroll=this.ispage&&!this.haswrapper?c:this.win,this.body=E,this.viewport=!1,this.isfixed=!1,this.iframe=!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"!=M.autohidemode,this.onmousedown=!1,this.onmouseup=!1,this.onmousemove=!1,this.onmousewheel=!1,this.onkeypress=!1,this.ongesturezoom=!1,this.onclick=!1,this.onscrollstart=!1,this.onscrollend=!1,this.onscrollcancel=!1,this.onzoomin=!1,this.onzoomout=!1,this.view=!1,this.page=!1,this.scroll={x:0,y:0},this.scrollratio={x:0,y:0},this.cursorheight=20,this.scrollvaluemax=0,"auto"==M.rtlmode){var C=this.win[0]==a?this.body:this.win,N=C.css("writing-mode")||C.css("-webkit-writing-mode")||C.css("-ms-writing-mode")||C.css("-moz-writing-mode");"horizontal-tb"==N||"lr-tb"==N||""===N?(this.isrtlmode="rtl"==C.css("direction"),this.isvertical=!1):(this.isrtlmode="vertical-rl"==N||"tb"==N||"tb-rl"==N||"rl-tb"==N,this.isvertical="vertical-rl"==N||"tb"==N||"tb-rl"==N)}else this.isrtlmode=!0===M.rtlmode,this.isvertical=!1;if(this.scrollrunning=!1,this.scrollmom=!1,this.observer=!1,this.observerremover=!1,this.observerbody=!1,!1!==M.scrollbarid)this.id=M.scrollbarid;else do{this.id="ascrail"+i++}while(l.getElementById(this.id));this.rail=!1,this.cursor=!1,this.cursorfreezed=!1,this.selectiondrag=!1,this.zoom=!1,this.zoomactive=!1,this.hasfocus=!1,this.hasmousefocus=!1,this.visibility=!0,this.railslocked=!1,this.locked=!1,this.hidden=!1,this.cursoractive=!0,this.wheelprevented=!1,this.overflowx=M.overflowx,this.overflowy=M.overflowy,this.nativescrollingarea=!1,this.checkarea=0,this.events=[],this.saved={},this.delaylist={},this.synclist={},this.lastdeltax=0,this.lastdeltay=0,this.detected=w();var P=n.extend({},this.detected);this.canhwscroll=P.hastransform&&M.hwacceleration,this.ishwscroll=this.canhwscroll&&T.haswrapper,this.isrtlmode?this.isvertical?this.hasreversehr=!(P.iswebkit||P.isie||P.isie11):this.hasreversehr=!(P.iswebkit||P.isie&&!P.isie10&&!P.isie11):this.hasreversehr=!1,this.istouchcapable=!1,P.cantouch||!P.hasw3ctouch&&!P.hasmstouch?!P.cantouch||P.isios||P.isandroid||!P.iswebkit&&!P.ismozilla||(this.istouchcapable=!0):this.istouchcapable=!0,M.enablemouselockapi||(P.hasmousecapture=!1,P.haspointerlock=!1),this.debounced=function(e,o,t){T&&(T.delaylist[e]||!1||(T.delaylist[e]={h:u(function(){T.delaylist[e].fn.call(T),T.delaylist[e]=!1},t)},o.call(T)),T.delaylist[e].fn=o)},this.synched=function(e,o){T.synclist[e]?T.synclist[e]=o:(T.synclist[e]=o,u(function(){T&&(T.synclist[e]&&T.synclist[e].call(T),T.synclist[e]=null)}))},this.unsynched=function(e){T.synclist[e]&&(T.synclist[e]=!1)},this.css=function(e,o){for(var t in o)T.saved.css.push([e,t,e.css(t)]),e.css(t,o[t])},this.scrollTop=function(e){return void 0===e?T.getScrollTop():T.setScrollTop(e)},this.scrollLeft=function(e){return void 0===e?T.getScrollLeft():T.setScrollLeft(e)};var R=function(e,o,t,r,i,s,n){this.st=e,this.ed=o,this.spd=t,this.p1=r||0,this.p2=i||1,this.p3=s||0,this.p4=n||1,this.ts=f(),this.df=o-e};if(R.prototype={B2:function(e){return 3*(1-e)*(1-e)*e},B3:function(e){return 3*(1-e)*e*e},B4:function(e){return e*e*e},getPos:function(){return(f()-this.ts)/this.spd},getNow:function(){var e=(f()-this.ts)/this.spd,o=this.B2(e)+this.B3(e)+this.B4(e);return e>=1?this.ed:this.st+this.df*o|0},update:function(e,o){return this.st=this.getNow(),this.ed=e,this.spd=o,this.ts=f(),this.df=this.ed-this.st,this}},this.ishwscroll){this.doc.translate={x:0,y:0,tx:"0px",ty:"0px"},P.hastranslate3d&&P.isios&&this.doc.css("-webkit-backface-visibility","hidden"),this.getScrollTop=function(e){if(!e){var o=v();if(o)return 16==o.length?-o[13]:-o[5];if(T.timerscroll&&T.timerscroll.bz)return T.timerscroll.bz.getNow()}return T.doc.translate.y},this.getScrollLeft=function(e){if(!e){var o=v();if(o)return 16==o.length?-o[12]:-o[4];if(T.timerscroll&&T.timerscroll.bh)return T.timerscroll.bh.getNow()}return T.doc.translate.x},this.notifyScrollEvent=function(e){var o=l.createEvent("UIEvents");o.initUIEvent("scroll",!1,!0,a,1),o.niceevent=!0,e.dispatchEvent(o)};var _=this.isrtlmode?1:-1;P.hastranslate3d&&M.enabletranslate3d?(this.setScrollTop=function(e,o){T.doc.translate.y=e,T.doc.translate.ty=-1*e+"px",T.doc.css(P.trstyle,"translate3d("+T.doc.translate.tx+","+T.doc.translate.ty+",0)"),o||T.notifyScrollEvent(T.win[0])},this.setScrollLeft=function(e,o){T.doc.translate.x=e,T.doc.translate.tx=e*_+"px",T.doc.css(P.trstyle,"translate3d("+T.doc.translate.tx+","+T.doc.translate.ty+",0)"),o||T.notifyScrollEvent(T.win[0])}):(this.setScrollTop=function(e,o){T.doc.translate.y=e,T.doc.translate.ty=-1*e+"px",T.doc.css(P.trstyle,"translate("+T.doc.translate.tx+","+T.doc.translate.ty+")"),o||T.notifyScrollEvent(T.win[0])},this.setScrollLeft=function(e,o){T.doc.translate.x=e,T.doc.translate.tx=e*_+"px",T.doc.css(P.trstyle,"translate("+T.doc.translate.tx+","+T.doc.translate.ty+")"),o||T.notifyScrollEvent(T.win[0])})}else this.getScrollTop=function(){return T.docscroll.scrollTop()},this.setScrollTop=function(e){T.docscroll.scrollTop(e)},this.getScrollLeft=function(){return T.hasreversehr?T.detected.ismozilla?T.page.maxw-Math.abs(T.docscroll.scrollLeft()):T.page.maxw-T.docscroll.scrollLeft():T.docscroll.scrollLeft()},this.setScrollLeft=function(e){return setTimeout(function(){if(T)return T.hasreversehr&&(e=T.detected.ismozilla?-(T.page.maxw-e):T.page.maxw-e),T.docscroll.scrollLeft(e)},1)};this.getTarget=function(e){return!!e&&(e.target?e.target:!!e.srcElement&&e.srcElement)},this.hasParent=function(e,o){if(!e)return!1;for(var t=e.target||e.srcElement||e||!1;t&&t.id!=o;)t=t.parentNode||!1;return!1!==t};var I={thin:1,medium:3,thick:5};this.getDocumentScrollOffset=function(){return{top:a.pageYOffset||l.documentElement.scrollTop,left:a.pageXOffset||l.documentElement.scrollLeft}},this.getOffset=function(){if(T.isfixed){var e=T.win.offset(),o=T.getDocumentScrollOffset();return e.top-=o.top,e.left-=o.left,e}var t=T.win.offset();if(!T.viewport)return t;var r=T.viewport.offset();return{top:t.top-r.top,left:t.left-r.left}},this.updateScrollBar=function(e){var o,t;if(T.ishwscroll)T.rail.css({height:T.win.innerHeight()-(M.railpadding.top+M.railpadding.bottom)}),T.railh&&T.railh.css({width:T.win.innerWidth()-(M.railpadding.left+M.railpadding.right)});else{var r=T.getOffset();if(o={top:r.top,left:r.left-(M.railpadding.left+M.railpadding.right)},o.top+=x(T.win,"border-top-width",!0),o.left+=T.rail.align?T.win.outerWidth()-x(T.win,"border-right-width")-T.rail.width:x(T.win,"border-left-width"),(t=M.railoffset)&&(t.top&&(o.top+=t.top),t.left&&(o.left+=t.left)),T.railslocked||T.rail.css({top:o.top,left:o.left,height:(e?e.h:T.win.innerHeight())-(M.railpadding.top+M.railpadding.bottom)}),T.zoom&&T.zoom.css({top:o.top+1,left:1==T.rail.align?o.left-20:o.left+T.rail.width+4}),T.railh&&!T.railslocked){o={top:r.top,left:r.left},(t=M.railhoffset)&&(t.top&&(o.top+=t.top),t.left&&(o.left+=t.left));var i=T.railh.align?o.top+x(T.win,"border-top-width",!0)+T.win.innerHeight()-T.railh.height:o.top+x(T.win,"border-top-width",!0),s=o.left+x(T.win,"border-left-width");T.railh.css({top:i-(M.railpadding.top+M.railpadding.bottom),left:s,width:T.railh.width})}}},this.doRailClick=function(e,o,t){var r,i,s,n;T.railslocked||(T.cancelEvent(e),"pageY"in e||(e.pageX=e.clientX+l.documentElement.scrollLeft,e.pageY=e.clientY+l.documentElement.scrollTop),o?(r=t?T.doScrollLeft:T.doScrollTop)(s=t?(e.pageX-T.railh.offset().left-T.cursorwidth/2)*T.scrollratio.x:(e.pageY-T.rail.offset().top-T.cursorheight/2)*T.scrollratio.y):(r=t?T.doScrollLeftBy:T.doScrollBy,s=t?T.scroll.x:T.scroll.y,n=t?e.pageX-T.railh.offset().left:e.pageY-T.rail.offset().top,i=t?T.view.w:T.view.h,r(s>=n?i:-i)))},T.newscrolly=T.newscrollx=0,T.hasanimationframe="requestAnimationFrame"in a,T.hascancelanimationframe="cancelAnimationFrame"in a,T.hasborderbox=!1,this.init=function(){if(T.saved.css=[],P.isoperamini)return!0;if(P.isandroid&&!("hidden"in l))return!0;M.emulatetouch=M.emulatetouch||M.touchbehavior,T.hasborderbox=a.getComputedStyle&&"border-box"===a.getComputedStyle(l.body)["box-sizing"];var e={"overflow-y":"hidden"};if((P.isie11||P.isie10)&&(e["-ms-overflow-style"]="none"),T.ishwscroll&&(this.doc.css(P.transitionstyle,P.prefixstyle+"transform 0ms ease-out"),P.transitionend&&T.bind(T.doc,P.transitionend,T.onScrollTransitionEnd,!1)),T.zindex="auto",T.ispage||"auto"!=M.zindex?T.zindex=M.zindex:T.zindex=b()||"auto",!T.ispage&&"auto"!=T.zindex&&T.zindex>s&&(s=T.zindex),T.isie&&0===T.zindex&&"auto"==M.zindex&&(T.zindex="auto"),!T.ispage||!P.isieold){var i=T.docscroll;T.ispage&&(i=T.haswrapper?T.win:T.doc),T.css(i,e),T.ispage&&(P.isie11||P.isie)&&T.css(n("html"),e),!P.isios||T.ispage||T.haswrapper||T.css(E,{"-webkit-overflow-scrolling":"touch"});var d=n(l.createElement("div"));d.css({position:"relative",top:0,float:"right",width:M.cursorwidth,height:0,"background-color":M.cursorcolor,border:M.cursorborder,"background-clip":"padding-box","-webkit-border-radius":M.cursorborderradius,"-moz-border-radius":M.cursorborderradius,"border-radius":M.cursorborderradius}),d.addClass("nicescroll-cursors"),T.cursor=d;var u=n(l.createElement("div"));u.attr("id",T.id),u.addClass("nicescroll-rails nicescroll-rails-vr");var h,p,f=["left","right","top","bottom"];for(var g in f)p=f[g],(h=M.railpadding[p]||0)&&u.css("padding-"+p,h+"px");u.append(d),u.width=Math.max(parseFloat(M.cursorwidth),d.outerWidth()),u.css({width:u.width+"px",zIndex:T.zindex,background:M.background,cursor:"default"}),u.visibility=!0,u.scrollable=!0,u.align="left"==M.railalign?0:1,T.rail=u,T.rail.drag=!1;var v=!1;!M.boxzoom||T.ispage||P.isieold||(v=l.createElement("div"),T.bind(v,"click",T.doZoom),T.bind(v,"mouseenter",function(){T.zoom.css("opacity",M.cursoropacitymax)}),T.bind(v,"mouseleave",function(){T.zoom.css("opacity",M.cursoropacitymin)}),T.zoom=n(v),T.zoom.css({cursor:"pointer",zIndex:T.zindex,backgroundImage:"url("+M.scriptpath+"zoomico.png)",height:18,width:18,backgroundPosition:"0 0"}),M.dblclickzoom&&T.bind(T.win,"dblclick",T.doZoom),P.cantouch&&M.gesturezoom&&(T.ongesturezoom=function(e){return e.scale>1.5&&T.doZoomIn(e),e.scale<.8&&T.doZoomOut(e),T.cancelEvent(e)},T.bind(T.win,"gestureend",T.ongesturezoom))),T.railh=!1;var w;if(M.horizrailenabled&&(T.css(i,{overflowX:"hidden"}),(d=n(l.createElement("div"))).css({position:"absolute",top:0,height:M.cursorwidth,width:0,backgroundColor:M.cursorcolor,border:M.cursorborder,backgroundClip:"padding-box","-webkit-border-radius":M.cursorborderradius,"-moz-border-radius":M.cursorborderradius,"border-radius":M.cursorborderradius}),P.isieold&&d.css("overflow","hidden"),d.addClass("nicescroll-cursors"),T.cursorh=d,(w=n(l.createElement("div"))).attr("id",T.id+"-hr"),w.addClass("nicescroll-rails nicescroll-rails-hr"),w.height=Math.max(parseFloat(M.cursorwidth),d.outerHeight()),w.css({height:w.height+"px",zIndex:T.zindex,background:M.background}),w.append(d),w.visibility=!0,w.scrollable=!0,w.align="top"==M.railvalign?0:1,T.railh=w,T.railh.drag=!1),T.ispage)u.css({position:"fixed",top:0,height:"100%"}),u.css(u.align?{right:0}:{left:0}),T.body.append(u),T.railh&&(w.css({position:"fixed",left:0,width:"100%"}),w.css(w.align?{bottom:0}:{top:0}),T.body.append(w));else{if(T.ishwscroll){"static"==T.win.css("position")&&T.css(T.win,{position:"relative"});var x="HTML"==T.win[0].nodeName?T.body:T.win;n(x).scrollTop(0).scrollLeft(0),T.zoom&&(T.zoom.css({position:"absolute",top:1,right:0,"margin-right":u.width+4}),x.append(T.zoom)),u.css({position:"absolute",top:0}),u.css(u.align?{right:0}:{left:0}),x.append(u),w&&(w.css({position:"absolute",left:0,bottom:0}),w.css(w.align?{bottom:0}:{top:0}),x.append(w))}else{T.isfixed="fixed"==T.win.css("position");var S=T.isfixed?"fixed":"absolute";T.isfixed||(T.viewport=T.getViewport(T.win[0])),T.viewport&&(T.body=T.viewport,/fixed|absolute/.test(T.viewport.css("position"))||T.css(T.viewport,{position:"relative"})),u.css({position:S}),T.zoom&&T.zoom.css({position:S}),T.updateScrollBar(),T.body.append(u),T.zoom&&T.body.append(T.zoom),T.railh&&(w.css({position:S}),T.body.append(w))}P.isios&&T.css(T.win,{"-webkit-tap-highlight-color":"rgba(0,0,0,0)","-webkit-touch-callout":"none"}),P.isie&&M.disableoutline&&T.win.attr("hideFocus","true"),P.iswebkit&&M.disableoutline&&T.win.css("outline","none")}if(!1===M.autohidemode?(T.autohidedom=!1,T.rail.css({opacity:M.cursoropacitymax}),T.railh&&T.railh.css({opacity:M.cursoropacitymax})):!0===M.autohidemode||"leave"===M.autohidemode?(T.autohidedom=n().add(T.rail),P.isie8&&(T.autohidedom=T.autohidedom.add(T.cursor)),T.railh&&(T.autohidedom=T.autohidedom.add(T.railh)),T.railh&&P.isie8&&(T.autohidedom=T.autohidedom.add(T.cursorh))):"scroll"==M.autohidemode?(T.autohidedom=n().add(T.rail),T.railh&&(T.autohidedom=T.autohidedom.add(T.railh))):"cursor"==M.autohidemode?(T.autohidedom=n().add(T.cursor),T.railh&&(T.autohidedom=T.autohidedom.add(T.cursorh))):"hidden"==M.autohidemode&&(T.autohidedom=!1,T.hide(),T.railslocked=!1),P.cantouch||T.istouchcapable||M.emulatetouch||P.hasmstouch){T.scrollmom=new y(T),T.ontouchstart=function(e){if(e.pointerType&&("mouse"===e.pointerType||e.pointerType===e.MSPOINTER_TYPE_MOUSE))return!1;if(T.hasmoving=!1,T.scrollmom.timer&&(T.triggerScrollEnd(),T.scrollmom.stop()),!T.railslocked){var o;if(P.hasmstouch)for(o=!!e.target&&e.target;o;){var t=n(o).getNiceScroll();if(t.length>0&&t[0].me==T.me)break;if(t.length>0)return!1;if("DIV"==o.nodeName&&o.id==T.id)break;o=!!o.parentNode&&o.parentNode}if((o=T.getTarget(e))&&/INPUT/i.test(o.nodeName)&&/range/i.test(o.type))return T.stopPropagation(e);if(!("clientX"in e)&&"changedTouches"in e&&(e.clientX=e.changedTouches[0].clientX,e.clientY=e.changedTouches[0].clientY),T.forcescreen){var r=e;(e={original:e.original?e.original:e}).clientX=r.screenX,e.clientY=r.screenY}if(T.rail.drag={x:e.clientX,y:e.clientY,sx:T.scroll.x,sy:T.scroll.y,st:T.getScrollTop(),sl:T.getScrollLeft(),pt:2,dl:!1,tg:o},T.ispage||!M.directionlockdeadzone)T.rail.drag.dl="f";else{var i={w:c.width(),h:c.height()},s={w:Math.max(l.body.scrollWidth,l.documentElement.scrollWidth),h:Math.max(l.body.scrollHeight,l.documentElement.scrollHeight)},a=Math.max(0,s.h-i.h),d=Math.max(0,s.w-i.w);T.rail.scrollable&&!T.railh.scrollable?T.rail.drag.ck=a>0&&"v":!T.rail.scrollable&&T.railh.scrollable?T.rail.drag.ck=d>0&&"h":T.rail.drag.ck=!1}if(M.emulatetouch&&T.isiframe&&P.isie){var u=T.win.position();T.rail.drag.x+=u.left,T.rail.drag.y+=u.top}if(T.hasmoving=!1,T.lastmouseup=!1,T.scrollmom.reset(e.clientX,e.clientY),!P.cantouch&&!this.istouchcapable&&!e.pointerType){if(!(!!o&&/INPUT|SELECT|BUTTON|TEXTAREA/i.test(o.nodeName)))return!T.ispage&&P.hasmousecapture&&o.setCapture(),M.emulatetouch?(o.onclick&&!o._onclick&&(o._onclick=o.onclick,o.onclick=function(e){if(T.hasmoving)return!1;o._onclick.call(this,e)}),T.cancelEvent(e)):T.stopPropagation(e);/SUBMIT|CANCEL|BUTTON/i.test(n(o).attr("type"))&&(T.preventclick={tg:o,click:!1})}}},T.ontouchend=function(e){if(!T.rail.drag)return!0;if(2==T.rail.drag.pt){if(e.pointerType&&("mouse"===e.pointerType||e.pointerType===e.MSPOINTER_TYPE_MOUSE))return!1;if(T.rail.drag=!1,T.hasmoving&&(T.scrollmom.doMomentum(),T.lastmouseup=!0,T.hideCursor(),P.hasmousecapture&&l.releaseCapture(),!P.cantouch))return T.cancelEvent(e)}else if(1==T.rail.drag.pt)return T.onmouseup(e)};var z=M.emulatetouch&&T.isiframe&&!P.hasmousecapture,k=.3*M.directionlockdeadzone|0;T.ontouchmove=function(e,o){if(!T.rail.drag)return!0;if(e.targetTouches&&M.preventmultitouchscrolling&&e.targetTouches.length>1)return!0;if(e.pointerType&&("mouse"===e.pointerType||e.pointerType===e.MSPOINTER_TYPE_MOUSE))return!0;if(2==T.rail.drag.pt){"changedTouches"in e&&(e.clientX=e.changedTouches[0].clientX,e.clientY=e.changedTouches[0].clientY);var t,r;if(r=t=0,z&&!o){var i=T.win.position();r=-i.left,t=-i.top}var s=e.clientY+t,n=s-T.rail.drag.y,a=e.clientX+r,c=a-T.rail.drag.x,d=T.rail.drag.st-n;if(T.ishwscroll&&M.bouncescroll)d<0?d=Math.round(d/2):d>T.page.maxh&&(d=T.page.maxh+Math.round((d-T.page.maxh)/2));else if(d<0?(d=0,s=0):d>T.page.maxh&&(d=T.page.maxh,s=0),0===s&&!T.hasmoving)return T.rail.drag=!1,!0;var u=T.getScrollLeft();if(T.railh&&T.railh.scrollable&&(u=T.isrtlmode?c-T.rail.drag.sl:T.rail.drag.sl-c,T.ishwscroll&&M.bouncescroll?u<0?u=Math.round(u/2):u>T.page.maxw&&(u=T.page.maxw+Math.round((u-T.page.maxw)/2)):(u<0&&(u=0,a=0),u>T.page.maxw&&(u=T.page.maxw,a=0))),!T.hasmoving){if(T.rail.drag.y===e.clientY&&T.rail.drag.x===e.clientX)return e.stopPropagation();var h=Math.abs(n),p=Math.abs(c),m=M.directionlockdeadzone;if(T.rail.drag.ck?"v"==T.rail.drag.ck?p>m&&h<=k?T.rail.drag=!1:h>m&&(T.rail.drag.dl="v"):"h"==T.rail.drag.ck&&(h>m&&p<=k?T.rail.drag=!1:p>m&&(T.rail.drag.dl="h")):h>m&&p>m?T.rail.drag.dl="f":h>m?T.rail.drag.dl=p>k?"f":"v":p>m&&(T.rail.drag.dl=h>k?"f":"h"),!T.rail.drag.dl)return!1;T.triggerScrollStart(e.clientX,e.clientY,0,0,0),T.hasmoving=!0}return T.preventclick&&!T.preventclick.click&&(T.preventclick.click=T.preventclick.tg.onclick||!1,T.preventclick.tg.onclick=T.onpreventclick),T.rail.drag.dl&&("v"==T.rail.drag.dl?u=T.rail.drag.sl:"h"==T.rail.drag.dl&&(d=T.rail.drag.st)),T.synched("touchmove",function(){T.rail.drag&&2==T.rail.drag.pt&&(T.prepareTransition&&T.resetTransition(),T.rail.scrollable&&T.setScrollTop(d),T.scrollmom.update(a,s),T.railh&&T.railh.scrollable?(T.setScrollLeft(u),T.showCursor(d,u)):T.showCursor(d),P.isie10&&l.selection.clear())}),T.cancelEvent(e),!1}return 1==T.rail.drag.pt?T.onmousemove(e):void 0},T.ontouchstartCursor=function(e,o){if(!T.rail.drag||3==T.rail.drag.pt){if(T.locked)return T.cancelEvent(e);T.cancelScroll(),T.rail.drag={x:e.touches[0].clientX,y:e.touches[0].clientY,sx:T.scroll.x,sy:T.scroll.y,pt:3,hr:!!o};var t=T.getTarget(e);return!T.ispage&&P.hasmousecapture&&t.setCapture(),T.isiframe&&!P.hasmousecapture&&(T.saved.csspointerevents=T.doc.css("pointer-events"),T.css(T.doc,{"pointer-events":"none"})),T.cancelEvent(e)}},T.ontouchendCursor=function(e){if(T.rail.drag){if(P.hasmousecapture&&l.releaseCapture(),T.isiframe&&!P.hasmousecapture&&T.doc.css("pointer-events",T.saved.csspointerevents),3!=T.rail.drag.pt)return;return T.rail.drag=!1,T.cancelEvent(e)}},T.ontouchmoveCursor=function(e){if(T.rail.drag){if(3!=T.rail.drag.pt)return;if(T.cursorfreezed=!0,T.rail.drag.hr){T.scroll.x=T.rail.drag.sx+(e.touches[0].clientX-T.rail.drag.x),T.scroll.x<0&&(T.scroll.x=0);var o=T.scrollvaluemaxw;T.scroll.x>o&&(T.scroll.x=o)}else{T.scroll.y=T.rail.drag.sy+(e.touches[0].clientY-T.rail.drag.y),T.scroll.y<0&&(T.scroll.y=0);var t=T.scrollvaluemax;T.scroll.y>t&&(T.scroll.y=t)}return T.synched("touchmove",function(){T.rail.drag&&3==T.rail.drag.pt&&(T.showCursor(),T.rail.drag.hr?T.doScrollLeft(Math.round(T.scroll.x*T.scrollratio.x),M.cursordragspeed):T.doScrollTop(Math.round(T.scroll.y*T.scrollratio.y),M.cursordragspeed))}),T.cancelEvent(e)}}}if(T.onmousedown=function(e,o){if(!T.rail.drag||1==T.rail.drag.pt){if(T.railslocked)return T.cancelEvent(e);T.cancelScroll(),T.rail.drag={x:e.clientX,y:e.clientY,sx:T.scroll.x,sy:T.scroll.y,pt:1,hr:o||!1};var t=T.getTarget(e);return P.hasmousecapture&&t.setCapture(),T.isiframe&&!P.hasmousecapture&&(T.saved.csspointerevents=T.doc.css("pointer-events"),T.css(T.doc,{"pointer-events":"none"})),T.hasmoving=!1,T.cancelEvent(e)}},T.onmouseup=function(e){if(T.rail.drag)return 1!=T.rail.drag.pt||(P.hasmousecapture&&l.releaseCapture(),T.isiframe&&!P.hasmousecapture&&T.doc.css("pointer-events",T.saved.csspointerevents),T.rail.drag=!1,T.cursorfreezed=!1,T.hasmoving&&T.triggerScrollEnd(),T.cancelEvent(e))},T.onmousemove=function(e){if(T.rail.drag){if(1!==T.rail.drag.pt)return;if(P.ischrome&&0===e.which)return T.onmouseup(e);if(T.cursorfreezed=!0,T.hasmoving||T.triggerScrollStart(e.clientX,e.clientY,0,0,0),T.hasmoving=!0,T.rail.drag.hr){T.scroll.x=T.rail.drag.sx+(e.clientX-T.rail.drag.x),T.scroll.x<0&&(T.scroll.x=0);var o=T.scrollvaluemaxw;T.scroll.x>o&&(T.scroll.x=o)}else{T.scroll.y=T.rail.drag.sy+(e.clientY-T.rail.drag.y),T.scroll.y<0&&(T.scroll.y=0);var t=T.scrollvaluemax;T.scroll.y>t&&(T.scroll.y=t)}return T.synched("mousemove",function(){T.cursorfreezed&&(T.showCursor(),T.rail.drag.hr?T.scrollLeft(Math.round(T.scroll.x*T.scrollratio.x)):T.scrollTop(Math.round(T.scroll.y*T.scrollratio.y)))}),T.cancelEvent(e)}T.checkarea=0},P.cantouch||M.emulatetouch)T.onpreventclick=function(e){if(T.preventclick)return T.preventclick.tg.onclick=T.preventclick.click,T.preventclick=!1,T.cancelEvent(e)},T.onclick=!P.isios&&function(e){return!T.lastmouseup||(T.lastmouseup=!1,T.cancelEvent(e))},M.grabcursorenabled&&P.cursorgrabvalue&&(T.css(T.ispage?T.doc:T.win,{cursor:P.cursorgrabvalue}),T.css(T.rail,{cursor:P.cursorgrabvalue}));else{var L=function(e){if(T.selectiondrag){if(e){var o=T.win.outerHeight(),t=e.pageY-T.selectiondrag.top;t>0&&t=o&&(t-=o),T.selectiondrag.df=t}if(0!==T.selectiondrag.df){var r=2*-Math.floor(T.selectiondrag.df/6);T.doScrollBy(r),T.debounced("doselectionscroll",function(){L()},50)}}};T.hasTextSelected="getSelection"in l?function(){return l.getSelection().rangeCount>0}:"selection"in l?function(){return"None"!=l.selection.type}:function(){return!1},T.onselectionstart=function(e){T.ispage||(T.selectiondrag=T.win.offset())},T.onselectionend=function(e){T.selectiondrag=!1},T.onselectiondrag=function(e){T.selectiondrag&&T.hasTextSelected()&&T.debounced("selectionscroll",function(){L(e)},250)}}if(P.hasw3ctouch?(T.css(T.ispage?n("html"):T.win,{"touch-action":"none"}),T.css(T.rail,{"touch-action":"none"}),T.css(T.cursor,{"touch-action":"none"}),T.bind(T.win,"pointerdown",T.ontouchstart),T.bind(l,"pointerup",T.ontouchend),T.bind(l,"pointermove",T.ontouchmove)):P.hasmstouch?(T.css(T.ispage?n("html"):T.win,{"-ms-touch-action":"none"}),T.css(T.rail,{"-ms-touch-action":"none"}),T.css(T.cursor,{"-ms-touch-action":"none"}),T.bind(T.win,"MSPointerDown",T.ontouchstart),T.bind(l,"MSPointerUp",T.ontouchend),T.bind(l,"MSPointerMove",T.ontouchmove),T.bind(T.cursor,"MSGestureHold",function(e){e.preventDefault()}),T.bind(T.cursor,"contextmenu",function(e){e.preventDefault()})):P.cantouch&&(T.bind(T.win,"touchstart",T.ontouchstart,!1,!0),T.bind(l,"touchend",T.ontouchend,!1,!0),T.bind(l,"touchcancel",T.ontouchend,!1,!0),T.delegate(l,"touchmove",T.ontouchmove,!1,!0)),M.emulatetouch&&(T.bind(T.win,"mousedown",T.ontouchstart,!1,!0),T.bind(l,"mouseup",T.ontouchend,!1,!0),T.bind(l,"mousemove",T.ontouchmove,!1,!0)),(M.cursordragontouch||!P.cantouch&&!M.emulatetouch)&&(T.rail.css({cursor:"default"}),T.railh&&T.railh.css({cursor:"default"}),T.jqbind(T.rail,"mouseenter",function(){if(!T.ispage&&!T.win.is(":visible"))return!1;T.canshowonmouseevent&&T.showCursor(),T.rail.active=!0}),T.jqbind(T.rail,"mouseleave",function(){T.rail.active=!1,T.rail.drag||T.hideCursor()}),M.sensitiverail&&(T.bind(T.rail,"click",function(e){T.doRailClick(e,!1,!1)}),T.bind(T.rail,"dblclick",function(e){T.doRailClick(e,!0,!1)}),T.bind(T.cursor,"click",function(e){T.cancelEvent(e)}),T.bind(T.cursor,"dblclick",function(e){T.cancelEvent(e)})),T.railh&&(T.jqbind(T.railh,"mouseenter",function(){if(!T.ispage&&!T.win.is(":visible"))return!1;T.canshowonmouseevent&&T.showCursor(),T.rail.active=!0}),T.jqbind(T.railh,"mouseleave",function(){T.rail.active=!1,T.rail.drag||T.hideCursor()}),M.sensitiverail&&(T.bind(T.railh,"click",function(e){T.doRailClick(e,!1,!0)}),T.bind(T.railh,"dblclick",function(e){T.doRailClick(e,!0,!0)}),T.bind(T.cursorh,"click",function(e){T.cancelEvent(e)}),T.bind(T.cursorh,"dblclick",function(e){T.cancelEvent(e)})))),M.cursordragontouch&&(this.istouchcapable||P.cantouch)&&(T.bind(T.cursor,"touchstart",T.ontouchstartCursor),T.bind(T.cursor,"touchmove",T.ontouchmoveCursor),T.bind(T.cursor,"touchend",T.ontouchendCursor),T.cursorh&&T.bind(T.cursorh,"touchstart",function(e){T.ontouchstartCursor(e,!0)}),T.cursorh&&T.bind(T.cursorh,"touchmove",T.ontouchmoveCursor),T.cursorh&&T.bind(T.cursorh,"touchend",T.ontouchendCursor)),P.cantouch||M.emulatetouch?(T.bind(P.hasmousecapture?T.win:l,"mouseup",T.ontouchend),T.onclick&&T.bind(l,"click",T.onclick),M.cursordragontouch?(T.bind(T.cursor,"mousedown",T.onmousedown),T.bind(T.cursor,"mouseup",T.onmouseup),T.cursorh&&T.bind(T.cursorh,"mousedown",function(e){T.onmousedown(e,!0)}),T.cursorh&&T.bind(T.cursorh,"mouseup",T.onmouseup)):(T.bind(T.rail,"mousedown",function(e){e.preventDefault()}),T.railh&&T.bind(T.railh,"mousedown",function(e){e.preventDefault()}))):(T.bind(P.hasmousecapture?T.win:l,"mouseup",T.onmouseup),T.bind(l,"mousemove",T.onmousemove),T.onclick&&T.bind(l,"click",T.onclick),T.bind(T.cursor,"mousedown",T.onmousedown),T.bind(T.cursor,"mouseup",T.onmouseup),T.railh&&(T.bind(T.cursorh,"mousedown",function(e){T.onmousedown(e,!0)}),T.bind(T.cursorh,"mouseup",T.onmouseup)),!T.ispage&&M.enablescrollonselection&&(T.bind(T.win[0],"mousedown",T.onselectionstart),T.bind(l,"mouseup",T.onselectionend),T.bind(T.cursor,"mouseup",T.onselectionend),T.cursorh&&T.bind(T.cursorh,"mouseup",T.onselectionend),T.bind(l,"mousemove",T.onselectiondrag)),T.zoom&&(T.jqbind(T.zoom,"mouseenter",function(){T.canshowonmouseevent&&T.showCursor(),T.rail.active=!0}),T.jqbind(T.zoom,"mouseleave",function(){T.rail.active=!1,T.rail.drag||T.hideCursor()}))),M.enablemousewheel&&(T.isiframe||T.mousewheel(P.isie&&T.ispage?l:T.win,T.onmousewheel),T.mousewheel(T.rail,T.onmousewheel),T.railh&&T.mousewheel(T.railh,T.onmousewheelhr)),T.ispage||P.cantouch||/HTML|^BODY/.test(T.win[0].nodeName)||(T.win.attr("tabindex")||T.win.attr({tabindex:++r}),T.bind(T.win,"focus",function(e){o=T.getTarget(e).id||T.getTarget(e)||!1,T.hasfocus=!0,T.canshowonmouseevent&&T.noticeCursor()}),T.bind(T.win,"blur",function(e){o=!1,T.hasfocus=!1}),T.bind(T.win,"mouseenter",function(e){t=T.getTarget(e).id||T.getTarget(e)||!1,T.hasmousefocus=!0,T.canshowonmouseevent&&T.noticeCursor()}),T.bind(T.win,"mouseleave",function(e){t=!1,T.hasmousefocus=!1,T.rail.drag||T.hideCursor()})),T.onkeypress=function(e){if(T.railslocked&&0===T.page.maxh)return!0;e=e||a.event;var r=T.getTarget(e);if(r&&/INPUT|TEXTAREA|SELECT|OPTION/.test(r.nodeName)&&(!(r.getAttribute("type")||r.type||!1)||!/submit|button|cancel/i.tp))return!0;if(n(r).attr("contenteditable"))return!0;if(T.hasfocus||T.hasmousefocus&&!o||T.ispage&&!o&&!t){var i=e.keyCode;if(T.railslocked&&27!=i)return T.cancelEvent(e);var s=e.ctrlKey||!1,l=e.shiftKey||!1,c=!1;switch(i){case 38:case 63233:T.doScrollBy(72),c=!0;break;case 40:case 63235:T.doScrollBy(-72),c=!0;break;case 37:case 63232:T.railh&&(s?T.doScrollLeft(0):T.doScrollLeftBy(72),c=!0);break;case 39:case 63234:T.railh&&(s?T.doScrollLeft(T.page.maxw):T.doScrollLeftBy(-72),c=!0);break;case 33:case 63276:T.doScrollBy(T.view.h),c=!0;break;case 34:case 63277:T.doScrollBy(-T.view.h),c=!0;break;case 36:case 63273:T.railh&&s?T.doScrollPos(0,0):T.doScrollTo(0),c=!0;break;case 35:case 63275:T.railh&&s?T.doScrollPos(T.page.maxw,T.page.maxh):T.doScrollTo(T.page.maxh),c=!0;break;case 32:M.spacebarenabled&&(l?T.doScrollBy(T.view.h):T.doScrollBy(-T.view.h),c=!0);break;case 27:T.zoomactive&&(T.doZoom(),c=!0)}if(c)return T.cancelEvent(e)}},M.enablekeyboard&&T.bind(l,P.isopera&&!P.isopera12?"keypress":"keydown",T.onkeypress),T.bind(l,"keydown",function(e){(e.ctrlKey||!1)&&(T.wheelprevented=!0)}),T.bind(l,"keyup",function(e){e.ctrlKey||!1||(T.wheelprevented=!1)}),T.bind(a,"blur",function(e){T.wheelprevented=!1}),T.bind(a,"resize",T.onscreenresize),T.bind(a,"orientationchange",T.onscreenresize),T.bind(a,"load",T.lazyResize),P.ischrome&&!T.ispage&&!T.haswrapper){var C=T.win.attr("style"),N=parseFloat(T.win.css("width"))+1;T.win.css("width",N),T.synched("chromefix",function(){T.win.attr("style",C)})}T.onAttributeChange=function(e){T.lazyResize(T.isieold?250:30)},M.enableobserver&&(T.isie11||!1===m||(T.observerbody=new m(function(e){if(e.forEach(function(e){if("attributes"==e.type)return E.hasClass("modal-open")&&E.hasClass("modal-dialog")&&!n.contains(n(".modal-dialog")[0],T.doc[0])?T.hide():T.show()}),T.me.clientWidth!=T.page.width||T.me.clientHeight!=T.page.height)return T.lazyResize(30)}),T.observerbody.observe(l.body,{childList:!0,subtree:!0,characterData:!1,attributes:!0,attributeFilter:["class"]})),T.ispage||T.haswrapper||(!1!==m?(T.observer=new m(function(e){e.forEach(T.onAttributeChange)}),T.observer.observe(T.win[0],{childList:!0,characterData:!1,attributes:!0,subtree:!1}),T.observerremover=new m(function(e){e.forEach(function(e){if(e.removedNodes.length>0)for(var o in e.removedNodes)if(T&&e.removedNodes[o]==T.win[0])return T.remove()})}),T.observerremover.observe(T.win[0].parentNode,{childList:!0,characterData:!1,attributes:!1,subtree:!1})):(T.bind(T.win,P.isie&&!P.isie9?"propertychange":"DOMAttrModified",T.onAttributeChange),P.isie9&&T.win[0].attachEvent("onpropertychange",T.onAttributeChange),T.bind(T.win,"DOMNodeRemoved",function(e){e.target==T.win[0]&&T.remove()})))),!T.ispage&&M.boxzoom&&T.bind(a,"resize",T.resizeZoom),T.istextarea&&(T.bind(T.win,"keydown",T.lazyResize),T.bind(T.win,"mouseup",T.lazyResize)),T.lazyResize(30)}if("IFRAME"==this.doc[0].nodeName){var R=function(){T.iframexd=!1;var o;try{(o="contentDocument"in this?this.contentDocument:this.contentWindow._doc).domain}catch(e){T.iframexd=!0,o=!1}if(T.iframexd)return"console"in a&&console.log("NiceScroll error: policy restriced iframe"),!0;if(T.forcescreen=!0,T.isiframe&&(T.iframe={doc:n(o),html:T.doc.contents().find("html")[0],body:T.doc.contents().find("body")[0]},T.getContentSize=function(){return{w:Math.max(T.iframe.html.scrollWidth,T.iframe.body.scrollWidth),h:Math.max(T.iframe.html.scrollHeight,T.iframe.body.scrollHeight)}},T.docscroll=n(T.iframe.body)),!P.isios&&M.iframeautoresize&&!T.isiframe){T.win.scrollTop(0),T.doc.height("");var t=Math.max(o.getElementsByTagName("html")[0].scrollHeight,o.body.scrollHeight);T.doc.height(t)}T.lazyResize(30),T.css(n(T.iframe.body),e),P.isios&&T.haswrapper&&T.css(n(o.body),{"-webkit-transform":"translate3d(0,0,0)"}),"contentWindow"in this?T.bind(this.contentWindow,"scroll",T.onscroll):T.bind(o,"scroll",T.onscroll),M.enablemousewheel&&T.mousewheel(o,T.onmousewheel),M.enablekeyboard&&T.bind(o,P.isopera?"keypress":"keydown",T.onkeypress),P.cantouch?(T.bind(o,"touchstart",T.ontouchstart),T.bind(o,"touchmove",T.ontouchmove)):M.emulatetouch&&(T.bind(o,"mousedown",T.ontouchstart),T.bind(o,"mousemove",function(e){return T.ontouchmove(e,!0)}),M.grabcursorenabled&&P.cursorgrabvalue&&T.css(n(o.body),{cursor:P.cursorgrabvalue})),T.bind(o,"mouseup",T.ontouchend),T.zoom&&(M.dblclickzoom&&T.bind(o,"dblclick",T.doZoom),T.ongesturezoom&&T.bind(o,"gestureend",T.ongesturezoom))};this.doc[0].readyState&&"complete"===this.doc[0].readyState&&setTimeout(function(){R.call(T.doc[0],!1)},500),T.bind(this.doc,"load",R)}},this.showCursor=function(e,o){if(T.cursortimeout&&(clearTimeout(T.cursortimeout),T.cursortimeout=0),T.rail){if(T.autohidedom&&(T.autohidedom.stop().css({opacity:M.cursoropacitymax}),T.cursoractive=!0),T.rail.drag&&1==T.rail.drag.pt||(void 0!==e&&!1!==e&&(T.scroll.y=e/T.scrollratio.y|0),void 0!==o&&(T.scroll.x=o/T.scrollratio.x|0)),T.cursor.css({height:T.cursorheight,top:T.scroll.y}),T.cursorh){var t=T.hasreversehr?T.scrollvaluemaxw-T.scroll.x:T.scroll.x;T.cursorh.css({width:T.cursorwidth,left:!T.rail.align&&T.rail.visibility?t+T.rail.width:t}),T.cursoractive=!0}T.zoom&&T.zoom.stop().css({opacity:M.cursoropacitymax})}},this.hideCursor=function(e){T.cursortimeout||T.rail&&T.autohidedom&&(T.hasmousefocus&&"leave"===M.autohidemode||(T.cursortimeout=setTimeout(function(){T.rail.active&&T.showonmouseevent||(T.autohidedom.stop().animate({opacity:M.cursoropacitymin}),T.zoom&&T.zoom.stop().animate({opacity:M.cursoropacitymin}),T.cursoractive=!1),T.cursortimeout=0},e||M.hidecursordelay)))},this.noticeCursor=function(e,o,t){T.showCursor(o,t),T.rail.active||T.hideCursor(e)},this.getContentSize=T.ispage?function(){return{w:Math.max(l.body.scrollWidth,l.documentElement.scrollWidth),h:Math.max(l.body.scrollHeight,l.documentElement.scrollHeight)}}:T.haswrapper?function(){return{w:T.doc[0].offsetWidth,h:T.doc[0].offsetHeight}}:function(){return{w:T.docscroll[0].scrollWidth,h:T.docscroll[0].scrollHeight}},this.onResize=function(e,o){if(!T||!T.win)return!1;var t=T.page.maxh,r=T.page.maxw,i={h:T.view.h,w:T.view.w};if(T.view={w:T.ispage?T.win.width():T.win[0].clientWidth,h:T.ispage?T.win.height():T.win[0].clientHeight},T.page=o||T.getContentSize(),T.page.maxh=Math.max(0,T.page.h-T.view.h),T.page.maxw=Math.max(0,T.page.w-T.view.w),T.page.maxh==t&&T.page.maxw==r&&T.view.w==i.w&&T.view.h==i.h){if(T.ispage)return T;var s=T.win.offset();if(T.lastposition){var n=T.lastposition;if(n.top==s.top&&n.left==s.left)return T}T.lastposition=s}return 0===T.page.maxh?(T.hideRail(),T.scrollvaluemax=0,T.scroll.y=0,T.scrollratio.y=0,T.cursorheight=0,T.setScrollTop(0),T.rail&&(T.rail.scrollable=!1)):(T.page.maxh-=M.railpadding.top+M.railpadding.bottom,T.rail.scrollable=!0),0===T.page.maxw?(T.hideRailHr(),T.scrollvaluemaxw=0,T.scroll.x=0,T.scrollratio.x=0,T.cursorwidth=0,T.setScrollLeft(0),T.railh&&(T.railh.scrollable=!1)):(T.page.maxw-=M.railpadding.left+M.railpadding.right,T.railh&&(T.railh.scrollable=M.horizrailenabled)),T.railslocked=T.locked||0===T.page.maxh&&0===T.page.maxw,T.railslocked?(T.ispage||T.updateScrollBar(T.view),!1):(T.hidden||T.visibility?!T.railh||T.hidden||T.railh.visibility||T.showRailHr():T.showRail().showRailHr(),T.istextarea&&T.win.css("resize")&&"none"!=T.win.css("resize")&&(T.view.h-=20),T.cursorheight=Math.min(T.view.h,Math.round(T.view.h*(T.view.h/T.page.h))),T.cursorheight=M.cursorfixedheight?M.cursorfixedheight:Math.max(M.cursorminheight,T.cursorheight),T.cursorwidth=Math.min(T.view.w,Math.round(T.view.w*(T.view.w/T.page.w))),T.cursorwidth=M.cursorfixedheight?M.cursorfixedheight:Math.max(M.cursorminheight,T.cursorwidth),T.scrollvaluemax=T.view.h-T.cursorheight-(M.railpadding.top+M.railpadding.bottom),T.hasborderbox||(T.scrollvaluemax-=T.cursor[0].offsetHeight-T.cursor[0].clientHeight),T.railh&&(T.railh.width=T.page.maxh>0?T.view.w-T.rail.width:T.view.w,T.scrollvaluemaxw=T.railh.width-T.cursorwidth-(M.railpadding.left+M.railpadding.right)),T.ispage||T.updateScrollBar(T.view),T.scrollratio={x:T.page.maxw/T.scrollvaluemaxw,y:T.page.maxh/T.scrollvaluemax},T.getScrollTop()>T.page.maxh?T.doScrollTop(T.page.maxh):(T.scroll.y=T.getScrollTop()/T.scrollratio.y|0,T.scroll.x=T.getScrollLeft()/T.scrollratio.x|0,T.cursoractive&&T.noticeCursor()),T.scroll.y&&0===T.getScrollTop()&&T.doScrollTo(Math.floor(T.scroll.y*T.scrollratio.y)),T)},this.resize=T.onResize;var H=0;this.onscreenresize=function(e){clearTimeout(H);var o=!T.ispage&&!T.haswrapper;o&&T.hideRails(),H=setTimeout(function(){T&&(o&&T.showRails(),T.resize()),H=0},120)},this.lazyResize=function(e){return clearTimeout(H),H=setTimeout(function(){T&&T.resize(),H=0},e||240),T},this.jqbind=function(e,o,t){T.events.push({e:e,n:o,f:t,q:!0}),n(e).on(o,t)},this.mousewheel=function(e,o,t){var r="jquery"in e?e[0]:e;if("onwheel"in l.createElement("div"))T._bind(r,"wheel",o,t||!1);else{var i=void 0!==l.onmousewheel?"mousewheel":"DOMMouseScroll";S(r,i,o,t||!1),"DOMMouseScroll"==i&&S(r,"MozMousePixelScroll",o,t||!1)}};var O=!1;if(P.haseventlistener){try{var Y=Object.defineProperty({},"passive",{get:function(){O=!0}});a.addEventListener("test",null,Y)}catch(e){}this.cancelEvent=function(e){return!!e&&((e=e.original?e.original:e).cancelable&&e.preventDefault(),e.stopPropagation(),e.preventManipulation&&e.preventManipulation(),!1)},this.stopPropagation=function(e){return!!e&&((e=e.original?e.original:e).stopPropagation(),!1)}}else Event.prototype.preventDefault=function(){this.returnValue=!1},Event.prototype.stopPropagation=function(){this.cancelBubble=!0},a.constructor.prototype.addEventListener=l.constructor.prototype.addEventListener=Element.prototype.addEventListener=function(e,o,t){this.attachEvent("on"+e,o)},a.constructor.prototype.removeEventListener=l.constructor.prototype.removeEventListener=Element.prototype.removeEventListener=function(e,o,t){this.detachEvent("on"+e,o)},this.cancelEvent=function(e){return!!(e=e||a.event)&&(e.cancelBubble=!0,e.cancel=!0,e.returnValue=!1,!1)},this.stopPropagation=function(e){return(e=e||a.event)&&(e.cancelBubble=!0),!1};this.delegate=function(e,o,t,r,i){var s=d[o]||!1;s||(s={a:[],l:[],f:function(e){for(var o=s.l,t=!1,r=o.length-1;r>=0;r--)if(!1===(t=o[r].call(e.target,e)))return e.preventDefault(),e.stopImmediatePropagation(),!1;return t}},T.bind(e,o,s.f,r,i),d[o]=s),T.ispage?(s.a=[T.id].concat(s.a),s.l=[t].concat(s.l)):(s.a.push(T.id),s.l.push(t))},this.undelegate=function(e,o,t,r,i){var s=d[o]||!1;if(s)for(var n=0,l=s.l.length;n0)return t;o=!!o.parentNode&&o.parentNode}return!1},this.triggerScrollStart=function(e,o,t,r,i){if(T.onscrollstart){var s={type:"scrollstart",current:{x:e,y:o},request:{x:t,y:r},end:{x:T.newscrollx,y:T.newscrolly},speed:i};T.onscrollstart.call(T,s)}},this.triggerScrollEnd=function(){if(T.onscrollend){var e=T.getScrollLeft(),o=T.getScrollTop(),t={type:"scrollend",current:{x:e,y:o},end:{x:e,y:o}};T.onscrollend.call(T,t)}};var B=0,X=0,D=0,A=1,q=!1;if(this.onmousewheel=function(e){if(!T.wheelprevented){if(T.railslocked)return T.debounced("checkunlock",T.resize,250),!0;if(T.rail.drag)return T.cancelEvent(e);if("auto"===M.oneaxismousemode&&0!==e.deltaX&&(M.oneaxismousemode=!1),M.oneaxismousemode&&0===e.deltaX&&!T.rail.scrollable)return!T.railh||!T.railh.scrollable||T.onmousewheelhr(e);var o=f(),t=!1;if(M.preservenativescrolling&&T.checkarea+600T.page.maxh&&(o=T.page.maxh+(o-T.page.maxh)/2|0),e<0?e=e/2|0:e>T.page.maxw&&(e=T.page.maxw+(o-T.page.maxw)/2|0)):(o<0?o=0:o>T.page.maxh&&(o=T.page.maxh),e<0?e=0:e>T.page.maxw&&(e=T.page.maxw)),T.scrollrunning&&e==T.newscrollx&&o==T.newscrolly)return!1;T.newscrolly=o,T.newscrollx=e;var s=T.getScrollTop(),n=T.getScrollLeft(),l={};l.x=e-n,l.y=o-s;var a=0|Math.sqrt(l.x*l.x+l.y*l.y),c=T.prepareTransition(a);T.scrollrunning||(T.scrollrunning=!0,T.triggerScrollStart(n,s,e,o,c),T.cursorupdate.start()),T.scrollendtrapped=!0,P.transitionend||(T.scrollendtrapped&&clearTimeout(T.scrollendtrapped),T.scrollendtrapped=setTimeout(T.onScrollTransitionEnd,c)),T.setScrollTop(T.newscrolly),T.setScrollLeft(T.newscrollx)},this.cancelScroll=function(){if(!T.scrollendtrapped)return!0;var e=T.getScrollTop(),o=T.getScrollLeft();return T.scrollrunning=!1,P.transitionend||clearTimeout(P.transitionend),T.scrollendtrapped=!1,T.resetTransition(),T.setScrollTop(e),T.railh&&T.setScrollLeft(o),T.timerscroll&&T.timerscroll.tm&&clearInterval(T.timerscroll.tm),T.timerscroll=!1,T.cursorfreezed=!1,T.cursorupdate.stop(),T.showCursor(e,o),T},this.onScrollTransitionEnd=function(){if(T.scrollendtrapped){var e=T.getScrollTop(),o=T.getScrollLeft();if(e<0?e=0:e>T.page.maxh&&(e=T.page.maxh),o<0?o=0:o>T.page.maxw&&(o=T.page.maxw),e!=T.newscrolly||o!=T.newscrollx)return T.doScrollPos(o,e,M.snapbackspeed);T.scrollrunning&&T.triggerScrollEnd(),T.scrollrunning=!1,T.scrollendtrapped=!1,T.resetTransition(),T.timerscroll=!1,T.setScrollTop(e),T.railh&&T.setScrollLeft(o),T.cursorupdate.stop(),T.noticeCursor(!1,e,o),T.cursorfreezed=!1}}}else this.doScrollLeft=function(e,o){var t=T.scrollrunning?T.newscrolly:T.getScrollTop();T.doScrollPos(e,t,o)},this.doScrollTop=function(e,o){var t=T.scrollrunning?T.newscrollx:T.getScrollLeft();T.doScrollPos(t,e,o)},this.doScrollPos=function(e,o,t){var r=T.getScrollTop(),i=T.getScrollLeft();((T.newscrolly-r)*(o-r)<0||(T.newscrollx-i)*(e-i)<0)&&T.cancelScroll();var s=!1;if(T.bouncescroll&&T.rail.visibility||(o<0?(o=0,s=!0):o>T.page.maxh&&(o=T.page.maxh,s=!0)),T.bouncescroll&&T.railh.visibility||(e<0?(e=0,s=!0):e>T.page.maxw&&(e=T.page.maxw,s=!0)),T.scrollrunning&&T.newscrolly===o&&T.newscrollx===e)return!0;T.newscrolly=o,T.newscrollx=e,T.dst={},T.dst.x=e-i,T.dst.y=o-r,T.dst.px=i,T.dst.py=r;var n=0|Math.sqrt(T.dst.x*T.dst.x+T.dst.y*T.dst.y),l=T.getTransitionSpeed(n);T.bzscroll={};var a=s?1:.58;T.bzscroll.x=new R(i,T.newscrollx,l,0,0,a,1),T.bzscroll.y=new R(r,T.newscrolly,l,0,0,a,1);var c=function(){if(T.scrollrunning){var e=T.bzscroll.y.getPos();T.setScrollLeft(T.bzscroll.x.getNow()),T.setScrollTop(T.bzscroll.y.getNow()),e<=1?u(c):(T.scrollrunning=!1,T.timer=0,T.triggerScrollEnd())}};T.scrollrunning||(T.triggerScrollStart(i,r,e,o,l),T.scrollrunning=!0,T.timer=u(c))},this.cancelScroll=function(){return T.timer&&h(T.timer),T.timer=0,T.bzscroll=!1,T.scrollrunning=!1,T};else this.doScrollLeft=function(e,o){var t=T.getScrollTop();T.doScrollPos(e,t,o)},this.doScrollTop=function(e,o){var t=T.getScrollLeft();T.doScrollPos(t,e,o)},this.doScrollPos=function(e,o,t){var r=e>T.page.maxw?T.page.maxw:e;r<0&&(r=0);var i=o>T.page.maxh?T.page.maxh:o;i<0&&(i=0),T.synched("scroll",function(){T.setScrollTop(i),T.setScrollLeft(r)})},this.cancelScroll=function(){};this.doScrollBy=function(e,o){z(0,e)},this.doScrollLeftBy=function(e,o){z(e,0)},this.doScrollTo=function(e,o){var t=o?Math.round(e*T.scrollratio.y):e;t<0?t=0:t>T.page.maxh&&(t=T.page.maxh),T.cursorfreezed=!1,T.doScrollTop(e)},this.checkContentSize=function(){var e=T.getContentSize();e.h==T.page.h&&e.w==T.page.w||T.resize(!1,e)},T.onscroll=function(e){T.rail.drag||T.cursorfreezed||T.synched("scroll",function(){T.scroll.y=Math.round(T.getScrollTop()/T.scrollratio.y),T.railh&&(T.scroll.x=Math.round(T.getScrollLeft()/T.scrollratio.x)),T.noticeCursor()})},T.bind(T.docscroll,"scroll",T.onscroll),this.doZoomIn=function(e){if(!T.zoomactive){T.zoomactive=!0,T.zoomrestore={style:{}};var o=["position","top","left","zIndex","backgroundColor","marginTop","marginBottom","marginLeft","marginRight"],t=T.win[0].style;for(var r in o){var i=o[r];T.zoomrestore.style[i]=void 0!==t[i]?t[i]:""}T.zoomrestore.style.width=T.win.css("width"),T.zoomrestore.style.height=T.win.css("height"),T.zoomrestore.padding={w:T.win.outerWidth()-T.win.width(),h:T.win.outerHeight()-T.win.height()},P.isios4&&(T.zoomrestore.scrollTop=c.scrollTop(),c.scrollTop(0)),T.win.css({position:P.isios4?"absolute":"fixed",top:0,left:0,zIndex:s+100,margin:0});var n=T.win.css("backgroundColor");return(""===n||/transparent|rgba\(0, 0, 0, 0\)|rgba\(0,0,0,0\)/.test(n))&&T.win.css("backgroundColor","#fff"),T.rail.css({zIndex:s+101}),T.zoom.css({zIndex:s+102}),T.zoom.css("backgroundPosition","0 -18px"),T.resizeZoom(),T.onzoomin&&T.onzoomin.call(T),T.cancelEvent(e)}},this.doZoomOut=function(e){if(T.zoomactive)return T.zoomactive=!1,T.win.css("margin",""),T.win.css(T.zoomrestore.style),P.isios4&&c.scrollTop(T.zoomrestore.scrollTop),T.rail.css({"z-index":T.zindex}),T.zoom.css({"z-index":T.zindex}),T.zoomrestore=!1,T.zoom.css("backgroundPosition","0 0"),T.onResize(),T.onzoomout&&T.onzoomout.call(T),T.cancelEvent(e)},this.doZoom=function(e){return T.zoomactive?T.doZoomOut(e):T.doZoomIn(e)},this.resizeZoom=function(){if(T.zoomactive){var e=T.getScrollTop();T.win.css({width:c.width()-T.zoomrestore.padding.w+"px",height:c.height()-T.zoomrestore.padding.h+"px"}),T.onResize(),T.setScrollTop(Math.min(T.page.maxh,e))}},this.init(),n.nicescroll.push(this)},y=function(e){var o=this;this.nc=e,this.lastx=0,this.lasty=0,this.speedx=0,this.speedy=0,this.lasttime=0,this.steptime=0,this.snapx=!1,this.snapy=!1,this.demulx=0,this.demuly=0,this.lastscrollx=-1,this.lastscrolly=-1,this.chkx=0,this.chky=0,this.timer=0,this.reset=function(e,t){o.stop(),o.steptime=0,o.lasttime=f(),o.speedx=0,o.speedy=0,o.lastx=e,o.lasty=t,o.lastscrollx=-1,o.lastscrolly=-1},this.update=function(e,t){var r=f();o.steptime=r-o.lasttime,o.lasttime=r;var i=t-o.lasty,s=e-o.lastx,n=o.nc.getScrollTop()+i,l=o.nc.getScrollLeft()+s;o.snapx=l<0||l>o.nc.page.maxw,o.snapy=n<0||n>o.nc.page.maxh,o.speedx=s,o.speedy=i,o.lastx=e,o.lasty=t},this.stop=function(){o.nc.unsynched("domomentum2d"),o.timer&&clearTimeout(o.timer),o.timer=0,o.lastscrollx=-1,o.lastscrolly=-1},this.doSnapy=function(e,t){var r=!1;t<0?(t=0,r=!0):t>o.nc.page.maxh&&(t=o.nc.page.maxh,r=!0),e<0?(e=0,r=!0):e>o.nc.page.maxw&&(e=o.nc.page.maxw,r=!0),r?o.nc.doScrollPos(e,t,o.nc.opt.snapbackspeed):o.nc.triggerScrollEnd()},this.doMomentum=function(e){var t=f(),r=e?t+e:o.lasttime,i=o.nc.getScrollLeft(),s=o.nc.getScrollTop(),n=o.nc.page.maxh,l=o.nc.page.maxw;o.speedx=l>0?Math.min(60,o.speedx):0,o.speedy=n>0?Math.min(60,o.speedy):0;var a=r&&t-r<=60;(s<0||s>n||i<0||i>l)&&(a=!1);var c=!(!o.speedy||!a)&&o.speedy,d=!(!o.speedx||!a)&&o.speedx;if(c||d){var u=Math.max(16,o.steptime);if(u>50){var h=u/50;o.speedx*=h,o.speedy*=h,u=50}o.demulxy=0,o.lastscrollx=o.nc.getScrollLeft(),o.chkx=o.lastscrollx,o.lastscrolly=o.nc.getScrollTop(),o.chky=o.lastscrolly;var p=o.lastscrollx,m=o.lastscrolly,g=function(){var e=f()-t>600?.04:.02;o.speedx&&(p=Math.floor(o.lastscrollx-o.speedx*(1-o.demulxy)),o.lastscrollx=p,(p<0||p>l)&&(e=.1)),o.speedy&&(m=Math.floor(o.lastscrolly-o.speedy*(1-o.demulxy)),o.lastscrolly=m,(m<0||m>n)&&(e=.1)),o.demulxy=Math.min(1,o.demulxy+e),o.nc.synched("domomentum2d",function(){if(o.speedx){o.nc.getScrollLeft();o.chkx=p,o.nc.setScrollLeft(p)}if(o.speedy){o.nc.getScrollTop();o.chky=m,o.nc.setScrollTop(m)}o.timer||(o.nc.hideCursor(),o.doSnapy(p,m))}),o.demulxy<1?o.timer=setTimeout(g,u):(o.stop(),o.nc.hideCursor(),o.doSnapy(p,m))};g()}else o.doSnapy(o.nc.getScrollLeft(),o.nc.getScrollTop())}},x=e.fn.scrollTop;e.cssHooks.pageYOffset={get:function(e,o,t){var r=n.data(e,"__nicescroll")||!1;return r&&r.ishwscroll?r.getScrollTop():x.call(e)},set:function(e,o){var t=n.data(e,"__nicescroll")||!1;return t&&t.ishwscroll?t.setScrollTop(parseInt(o)):x.call(e,o),this}},e.fn.scrollTop=function(e){if(void 0===e){var o=!!this[0]&&(n.data(this[0],"__nicescroll")||!1);return o&&o.ishwscroll?o.getScrollTop():x.call(this)}return this.each(function(){var o=n.data(this,"__nicescroll")||!1;o&&o.ishwscroll?o.setScrollTop(parseInt(e)):x.call(n(this),e)})};var S=e.fn.scrollLeft;n.cssHooks.pageXOffset={get:function(e,o,t){var r=n.data(e,"__nicescroll")||!1;return r&&r.ishwscroll?r.getScrollLeft():S.call(e)},set:function(e,o){var t=n.data(e,"__nicescroll")||!1;return t&&t.ishwscroll?t.setScrollLeft(parseInt(o)):S.call(e,o),this}},e.fn.scrollLeft=function(e){if(void 0===e){var o=!!this[0]&&(n.data(this[0],"__nicescroll")||!1);return o&&o.ishwscroll?o.getScrollLeft():S.call(this)}return this.each(function(){var o=n.data(this,"__nicescroll")||!1;o&&o.ishwscroll?o.setScrollLeft(parseInt(e)):S.call(n(this),e)})};var z=function(e){var o=this;if(this.length=0,this.name="nicescrollarray",this.each=function(e){return n.each(o,e),o},this.push=function(e){o[o.length]=e,o.length++},this.eq=function(e){return o[e]},e)for(var t=0;t1?n(e,r):s,i.win=r}!("doc"in i)||"win"in i||(i.win=r);var l=r.data("__nicescroll")||!1;l||(i.doc=i.doc||r,l=new b(i,r),r.data("__nicescroll",l)),t.push(l)}),1===t.length?t[0]:t},a.NiceScroll={getjQuery:function(){return e}},n.nicescroll||(n.nicescroll=new z,n.nicescroll.options=g)}); \ No newline at end of file From 2ed09add0738a8bf37be048e56d55ca674041053 Mon Sep 17 00:00:00 2001 From: InuYaksa Date: Sat, 1 Jul 2017 15:58:51 +0200 Subject: [PATCH 07/14] RC6 surface scroll fixes --- jquery.nicescroll.js | 396 +++++++++------------------------------ jquery.nicescroll.min.js | 4 +- 2 files changed, 90 insertions(+), 310 deletions(-) diff --git a/jquery.nicescroll.js b/jquery.nicescroll.js index c601375..6340fc9 100644 --- a/jquery.nicescroll.js +++ b/jquery.nicescroll.js @@ -1,5 +1,5 @@ /* jquery.nicescroll --- version 3.7.4-f [DEV REL] +-- version 3.7.4-g [DEV REL] -- copyright 2017-06-18 InuYaksa*2017 -- licensed under the MIT -- @@ -228,9 +228,8 @@ break; } } - if (d.ischrome26) { // always use prefix - d.prefixstyle = prefix[1]; - } + if (d.ischrome26) d.prefixstyle = prefix[1]; // always use prefix + d.hastransition = (d.transitionstyle); })(); @@ -262,7 +261,7 @@ var self = this; - this.version = '3.7.4-f'; + this.version = '3.7.4-g'; this.name = 'nicescroll'; this.me = me; @@ -433,7 +432,6 @@ this.istouchcapable = true; } else if (cap.cantouch && !cap.isios && !cap.isandroid && (cap.iswebkit || cap.ismozilla)) { this.istouchcapable = true; - // cap.cantouch = false; // parse normal desktop events } //## disable MouseLock API on user request @@ -446,8 +444,6 @@ if (!self) return; var dd = self.delaylist[name] || false; if (!dd) { - //fixed loop call fn:checkSelectionScroll - //fn.call(self); self.delaylist[name] = { h: setAnimationFrame(function () { self.delaylist[name].fn.call(self); @@ -711,18 +707,18 @@ if (!self.viewport) return ww; var vp = self.viewport.offset(); return { - top: ww.top - vp.top,// + self.viewport.scrollTop(), - left: ww.left - vp.left // + self.viewport.scrollLeft() + top: ww.top - vp.top, + left: ww.left - vp.left }; }; this.updateScrollBar = function (len) { var pos, off; if (self.ishwscroll) { - self.rail.css({ //** + self.rail.css({ height: self.win.innerHeight() - (opt.railpadding.top + opt.railpadding.bottom) }); - if (self.railh) self.railh.css({ //** + if (self.railh) self.railh.css({ width: self.win.innerWidth() - (opt.railpadding.left + opt.railpadding.right) }); } else { @@ -964,8 +960,6 @@ if (cap.isieold) cursor.css('overflow', 'hidden'); //IE6 horiz scrollbar issue - // cursor.wborder = parseFloat(cursor.outerWidth() - cursor.innerWidth()); // ** - cursor.addClass('nicescroll-cursors'); self.cursorh = cursor; @@ -993,8 +987,6 @@ } - // - if (self.ispage) { rail.css({ @@ -1080,8 +1072,10 @@ '-webkit-touch-callout': 'none' }); // prevent grey layer on click - if (cap.isie && opt.disableoutline) self.win.attr("hideFocus", "true"); // IE, prevent dotted rectangle on focused div - if (cap.iswebkit && opt.disableoutline) self.win.css('outline', 'none'); // Webkit outline + if (opt.disableoutline) { + if (cap.isie) self.win.attr("hideFocus", "true"); // IE, prevent dotted rectangle on focused div + if (cap.iswebkit) self.win.css('outline', 'none'); // Webkit outline + } } @@ -1114,10 +1108,14 @@ self.scrollmom = new ScrollMomentumClass2D(self); + var delayedclick = null; + self.ontouchstart = function (e) { + if (self.locked) return false; + //if (e.pointerType && e.pointerType != 2 && e.pointerType != "touch") return false; - if (e.pointerType && (e.pointerType === 'mouse' || e.pointerType === e.MSPOINTER_TYPE_MOUSE)) return false; + if (e.pointerType && (e.pointerType === 'mouse' || e.pointerType === e.MSPOINTER_TYPE_MOUSE)) return false; // need test on surface!! self.hasmoving = false; @@ -1127,27 +1125,15 @@ } if (!self.railslocked) { - var tg; - if (cap.hasmstouch) { - tg = (e.target) ? e.target : false; - while (tg) { - var nc = $(tg).getNiceScroll(); - if ((nc.length > 0) && (nc[0].me == self.me)) break; - if (nc.length > 0) return false; - if ((tg.nodeName == 'DIV') && (tg.id == self.id)) break; - tg = (tg.parentNode) ? tg.parentNode : false; - } - } - - //e.stopPropagation(); - - tg = self.getTarget(e); + var tg = self.getTarget(e); if (tg) { var skp = (/INPUT/i.test(tg.nodeName)) && (/range/i.test(tg.type)); if (skp) return self.stopPropagation(e); } + var ismouse = (e.type === "mousedown"); + if (!("clientX" in e) && ("changedTouches" in e)) { e.clientX = e.changedTouches[0].clientX; e.clientY = e.changedTouches[0].clientY; @@ -1185,13 +1171,10 @@ h: $window.height() }; - var page = { - w: Math.max(_doc.body.scrollWidth, _doc.documentElement.scrollWidth), - h: Math.max(_doc.body.scrollHeight, _doc.documentElement.scrollHeight) - }; + var page = self.getContentSize(); - var maxh = Math.max(0, page.h - view.h); - var maxw = Math.max(0, page.w - view.w); + var maxh = page.h - view.h; + var maxw = page.w - view.w; if (self.rail.scrollable && !self.railh.scrollable) self.rail.drag.ck = (maxh > 0) ? "v" : false; else if (!self.rail.scrollable && self.railh.scrollable) self.rail.drag.ck = (maxw > 0) ? "h" : false; @@ -1209,11 +1192,11 @@ self.lastmouseup = false; self.scrollmom.reset(e.clientX, e.clientY); - if (!cap.cantouch && !this.istouchcapable && !e.pointerType) { + if (tg&&ismouse) { - var ip = (tg) ? /INPUT|SELECT|BUTTON|TEXTAREA/i.test(tg.nodeName) : false; + var ip = /INPUT|SELECT|BUTTON|TEXTAREA/i.test(tg.nodeName); if (!ip) { - if (!self.ispage && cap.hasmousecapture) tg.setCapture(); + if (cap.hasmousecapture) tg.setCapture(); if (opt.emulatetouch) { if (tg.onclick && !(tg._onclick || false)) { // intercept DOM0 onclick event tg._onclick = tg.onclick; @@ -1225,7 +1208,7 @@ return self.cancelEvent(e); } return self.stopPropagation(e); - } + } if (/SUBMIT|CANCEL|BUTTON/i.test($(tg).attr('type'))) { self.preventclick = { @@ -1247,25 +1230,16 @@ //if (e.pointerType && e.pointerType != 2 && e.pointerType != "touch") return false; if (e.pointerType && (e.pointerType === 'mouse' || e.pointerType === e.MSPOINTER_TYPE_MOUSE)) return false; - /* - if (!self.hasmoving) { - if (e.type === "mouseup") { - var tg = self.rail.drag.tg; - setTimeout(function () { - tg && $(tg).trigger("click"); - }, 20); - } - } - */ - self.rail.drag = false; + var ismouse = (e.type === "mouseup"); + if (self.hasmoving) { self.scrollmom.doMomentum(); self.lastmouseup = true; self.hideCursor(); if (cap.hasmousecapture) _doc.releaseCapture(); - if (!cap.cantouch) return self.cancelEvent(e); + if (ismouse) return self.cancelEvent(e); } } @@ -1329,7 +1303,7 @@ fy = 0; } if (fy === 0 && !self.hasmoving) { - self.rail.drag = false; + if (!self.ispage) self.rail.drag = false; return true; } } @@ -1361,7 +1335,7 @@ if (!self.hasmoving) { - if (self.rail.drag.y === e.clientY && self.rail.drag.x === e.clientX) return e.stopPropagation(); // prevent first useless move event + if (self.rail.drag.y === e.clientY && self.rail.drag.x === e.clientX) return self.cancelEvent(e); // prevent first useless move event var ay = Math.abs(my); var ax = Math.abs(mx); @@ -1378,15 +1352,6 @@ } else if (ay > dz) self.rail.drag.dl = "v"; - /* - if (ay > dz && (ax <= (ay * 0.3))) { - self.rail.drag = false; - return true; - } else if (ax > dz) { - self.rail.drag.dl = "f"; - $body.scrollTop($body.scrollTop()); // stop iOS native scrolling (when active javascript has blocked) - } - */ } else if (self.rail.drag.ck == "h") { @@ -1395,18 +1360,9 @@ } else if (ax > dz) self.rail.drag.dl = "h"; - /* - if (ax > dz && (ay <= (ax * 0.3))) { - self.rail.drag = false; - return true; - } else { - self.rail.drag.dl = "f"; - $body.scrollTop($body.scrollTop()); // stop iOS native scrolling (when active javascript has blocked) - } - */ } - if (!self.rail.drag.dl) return false; + if (!self.rail.drag.dl) return self.cancelEvent(e); self.triggerScrollStart(e.clientX, e.clientY, 0, 0, 0); self.hasmoving = true; @@ -1437,12 +1393,7 @@ } }); - // if (cap.ischrome && self.istouchcapable) grabbed = false; //chrome touch emulation doesn't like! - // if (grabbed) return self.cancelEvent(e); - - //e.stopPropagation(); - self.cancelEvent(e); - return false; + return self.cancelEvent(e); } else if (self.rail.drag.pt == 1) { // drag on cursor @@ -1528,7 +1479,7 @@ hr: hronly || false }; var tg = self.getTarget(e); - //if (!self.ispage && cap.hasmousecapture) tg.setCapture(); + if (cap.hasmousecapture) tg.setCapture(); if (self.isiframe && !cap.hasmousecapture) { self.saved.csspointerevents = self.doc.css("pointer-events"); @@ -1548,7 +1499,7 @@ if (self.isiframe && !cap.hasmousecapture) self.doc.css("pointer-events", self.saved.csspointerevents); self.rail.drag = false; self.cursorfreezed = false; - if (self.hasmoving) self.triggerScrollEnd(); // TODO - check &&!self.scrollrunning + if (self.hasmoving) self.triggerScrollEnd(); return self.cancelEvent(e); } }; @@ -1581,16 +1532,6 @@ if (self.cursorfreezed) { self.showCursor(); - /* - if (self.rail.drag.hr) { - if (self.hasreversehr) { - self.doScrollLeft(self.scrollvaluemaxw - Math.round(self.scroll.x * self.scrollratio.x), opt.cursordragspeed); - } else { - self.doScrollLeft(Math.round(self.scroll.x * self.scrollratio.x), opt.cursordragspeed); - } - } - else self.doScrollTop(Math.round(self.scroll.y * self.scrollratio.y), opt.cursordragspeed); - */ if (self.rail.drag.hr) { self.scrollLeft(Math.round(self.scroll.x * self.scrollratio.x)); @@ -1618,8 +1559,6 @@ } }; - //self.bind(self.win, "mousedown", self.ontouchstart); // control content dragging <-- REENABLE!! - self.onclick = (cap.isios) ? false : function (e) { // it needs to check IE11 ??? if (self.lastmouseup) { self.lastmouseup = false; @@ -1652,7 +1591,7 @@ } if (self.selectiondrag.df === 0) return; - var rt = -Math.floor(self.selectiondrag.df / 6) * 2; + var rt = -(self.selectiondrag.df*2/6)|0; self.doScrollBy(rt); self.debounced("doselectionscroll", function () { @@ -1675,11 +1614,12 @@ } self.onselectionstart = function (e) { - /* More testing - severe chrome issues + // More testing - severe chrome issues + /* if (!self.haswrapper&&(e.which&&e.which==2)) { // fool browser to manage middle button scrolling self.win.css({'overflow':'auto'}); setTimeout(function(){ - self.win.css({'overflow':''}); + self.win.css({'overflow':'hidden'}); },10); return true; } @@ -1709,7 +1649,7 @@ }); self.bind(self.win, "pointerdown", self.ontouchstart); self.bind(_doc, "pointerup", self.ontouchend); - self.bind(_doc, "pointermove", self.ontouchmove); + self.delegate(_doc, "pointermove", self.ontouchmove); } else if (cap.hasmstouch) { //IE10 self.css((self.ispage) ? $("html") : self.win, { '-ms-touch-action': 'none' }); self.css(self.rail, { @@ -1720,7 +1660,7 @@ }); self.bind(self.win, "MSPointerDown", self.ontouchstart); self.bind(_doc, "MSPointerUp", self.ontouchend); - self.bind(_doc, "MSPointerMove", self.ontouchmove); + self.delegate(_doc, "MSPointerMove", self.ontouchmove); self.bind(self.cursor, "MSGestureHold", function (e) { e.preventDefault(); }); @@ -1731,7 +1671,6 @@ self.bind(self.win, "touchstart", self.ontouchstart, false, true); self.bind(_doc, "touchend", self.ontouchend, false, true); self.bind(_doc, "touchcancel", self.ontouchend, false, true); - //self.bind(_doc, "touchmove", self.ontouchmove, false, true); self.delegate(_doc, "touchmove", self.ontouchmove, false, true); } @@ -1882,25 +1821,21 @@ "tabindex": ++tabindexcounter }); - // self.jqbind(self.win, "focus", function (e) { self.bind(self.win, "focus", function (e) { // better using native events domfocus = (self.getTarget(e)).id || self.getTarget(e) || false; self.hasfocus = true; if (self.canshowonmouseevent) self.noticeCursor(); }); - // self.jqbind(self.win, "blur", function (e) { self.bind(self.win, "blur", function (e) { // * domfocus = false; self.hasfocus = false; }); - // self.jqbind(self.win, "mouseenter", function (e) { self.bind(self.win, "mouseenter", function (e) { // * mousefocus = (self.getTarget(e)).id || self.getTarget(e) || false; self.hasmousefocus = true; if (self.canshowonmouseevent) self.noticeCursor(); }); - //self.jqbind(self.win, "mouseleave", function (e) { self.bind(self.win, "mouseleave", function (e) { // * mousefocus = false; self.hasmousefocus = false; @@ -2095,7 +2030,6 @@ self.bind(self.win, "mouseup", self.lazyResize); } - // self.checkrtlmode = true; self.lazyResize(30); } @@ -2131,7 +2065,7 @@ h: Math.max(self.iframe.html.scrollHeight, self.iframe.body.scrollHeight) }; }; - self.docscroll = $(self.iframe.body); //$(this.contentWindow); + self.docscroll = $(self.iframe.body); } if (!cap.isios && opt.iframeautoresize && !self.isiframe) { @@ -2142,7 +2076,6 @@ } self.lazyResize(30); - //if (cap.isie7) self.css($(self.iframe.html), _scrollyhidden); self.css($(self.iframe.body), _scrollyhidden); if (cap.isios && self.haswrapper) { @@ -2285,24 +2218,10 @@ if (!self || !self.win) return false; - /* - if (!self.haswrapper && !self.ispage) { - if (self.win.css('display') === 'none') { - if (self.visibility) self.hideRail().hideRailHr(); - return false; - } else { - if (!self.hidden && !self.visibility) self.showRail().showRailHr(); - } - } - */ - - var premaxh = self.page.maxh; - var premaxw = self.page.maxw; - - var preview = { - h: self.view.h, - w: self.view.w - }; + var premaxh = self.page.maxh, + premaxw = self.page.maxw, + previewh = self.view.h, + previeww = self.view.w; self.view = { w: (self.ispage) ? self.win.width() : self.win[0].clientWidth, @@ -2314,7 +2233,7 @@ self.page.maxh = Math.max(0, self.page.h - self.view.h); self.page.maxw = Math.max(0, self.page.w - self.view.w); - if ((self.page.maxh == premaxh) && (self.page.maxw == premaxw) && (self.view.w == preview.w) && (self.view.h == preview.h)) { + if ((self.page.maxh == premaxh) && (self.page.maxw == premaxw) && (self.view.w == previeww) && (self.view.h == previewh)) { // test position if (!self.ispage) { var pos = self.win.offset(); @@ -2337,7 +2256,7 @@ self.setScrollTop(0); if (self.rail) self.rail.scrollable = false; } else { - self.page.maxh -= (opt.railpadding.top + opt.railpadding.bottom); //** + self.page.maxh -= (opt.railpadding.top + opt.railpadding.bottom); self.rail.scrollable = true; } @@ -2352,7 +2271,7 @@ self.railh.scrollable = false; } } else { - self.page.maxw -= (opt.railpadding.left + opt.railpadding.right); //** + self.page.maxw -= (opt.railpadding.left + opt.railpadding.right); if (self.railh) self.railh.scrollable = (opt.horizrailenabled); } @@ -2375,23 +2294,14 @@ self.cursorwidth = Math.min(self.view.w, Math.round(self.view.w * (self.view.w / self.page.w))); self.cursorwidth = (opt.cursorfixedheight) ? opt.cursorfixedheight : Math.max(opt.cursorminheight, self.cursorwidth); - // self.cursorwidth -= self.railh.cursor[0].outerWidth - self.railh.cursor[0].innerWidth; - - self.scrollvaluemax = self.view.h - self.cursorheight - (opt.railpadding.top + opt.railpadding.bottom); // - self.cursor.hborder //** + self.scrollvaluemax = self.view.h - self.cursorheight - (opt.railpadding.top + opt.railpadding.bottom); if (!self.hasborderbox) self.scrollvaluemax -= self.cursor[0].offsetHeight - self.cursor[0].clientHeight; if (self.railh) { self.railh.width = (self.page.maxh > 0) ? (self.view.w - self.rail.width) : self.view.w; - self.scrollvaluemaxw = self.railh.width - self.cursorwidth - (opt.railpadding.left + opt.railpadding.right); // - self.cursorh.wborder //** + self.scrollvaluemaxw = self.railh.width - self.cursorwidth - (opt.railpadding.left + opt.railpadding.right); } - /* - if (self.checkrtlmode&&self.railh) { - self.checkrtlmode = false; - if (opt.rtlmode&&self.scroll.x==0) self.setScrollLeft(self.page.maxw); - } -*/ - if (!self.ispage) self.updateScrollBar(self.view); self.scrollratio = { @@ -2408,7 +2318,7 @@ if (self.cursoractive) self.noticeCursor(); } - if (self.scroll.y && (self.getScrollTop() === 0)) self.doScrollTo(Math.floor(self.scroll.y * self.scrollratio.y)); + if (self.scroll.y && (self.getScrollTop() === 0)) self.doScrollTo((self.scroll.y * self.scrollratio.y)|0); return self; }; @@ -2507,21 +2417,19 @@ // thanks to https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener try { var options = Object.defineProperty({}, "passive", { get: function () { passiveSupported = !0; } }); _win.addEventListener("test", null, options); } catch (err) { } - this.cancelEvent = function (e) { + this.stopPropagation = function (e) { if (!e) return false; e = (e.original) ? e.original : e; - if (e.cancelable) e.preventDefault(); e.stopPropagation(); - if (e.preventManipulation) e.preventManipulation(); //IE10 return false; }; - this.stopPropagation = function (e) { - if (!e) return false; - e = (e.original) ? e.original : e; - e.stopPropagation(); + this.cancelEvent = function(e) { + if (e.cancelable) e.preventDefault(); + e.stopImmediatePropagation(); + if (e.preventManipulation) e.preventManipulation(); // IE10+ return false; - }; + }; } else { @@ -2545,10 +2453,11 @@ // Thanks to http://www.switchonthecode.com !! this.cancelEvent = function (e) { e = e || _win.event; - if (!e) return false; - e.cancelBubble = true; - e.cancel = true; - e.returnValue = false; + if (e) { + e.cancelBubble = true; + e.cancel = true; + e.returnValue = false; + } return false; }; @@ -2574,11 +2483,7 @@ var r = false; for (var a = l; a >= 0; a--) { r = lst[a].call(e.target, e); - if (r === false) { - e.preventDefault(); - e.stopImmediatePropagation(); - return false; - } + if (r === false) return false; } return r; } @@ -2608,7 +2513,7 @@ de.a.splice(a); de.l.splice(a); if (de.a.length===0) { - self.unbind(dom,name,del.f); + self._unbind(dom,name,del.f); delegatevents[name] = null; } } @@ -2635,7 +2540,8 @@ }; this._unbind = function (el, name, fn, bub) { // primitive unbind - el.removeEventListener(name, fn, bub); + if (delegatevents[name]) self.undelegate(el, name, fn, bub); + else el.removeEventListener(name, fn, bub); }; this.unbindAll = function () { @@ -2806,32 +2712,29 @@ if (dd.getNiceScroll().length > 0) return dd; dom = (dom.parentNode) ? dom.parentNode : false; } - return false; //(dom) ? $(dom) : false; + return false; }; this.triggerScrollStart = function (cx, cy, rx, ry, ms) { if (self.onscrollstart) { - var info = { - "type": "scrollstart", - "current": { - "x": cx, - "y": cy + type: "scrollstart", + current: { + x: cx, + y: cy }, - "request": { - "x": rx, - "y": ry + request: { + x: rx, + y: ry }, - "end": { - "x": self.newscrollx, - "y": self.newscrolly + end: { + x: self.newscrollx, + y: self.newscrolly }, - "speed": ms + speed: ms }; - self.onscrollstart.call(self, info); - } }; @@ -2853,6 +2756,7 @@ y: py } }; + self.onscrollend.call(self, info); } @@ -2995,10 +2899,10 @@ } this.onmousewheel = function (e) { - if (self.wheelprevented) return; + if (self.wheelprevented||self.locked) return false; if (self.railslocked) { self.debounced("checkunlock", self.resize, 250); - return true; + return false; } if (self.rail.drag) return self.cancelEvent(e); @@ -3056,7 +2960,7 @@ this.getTransitionSpeed = function (dif) { - return 80 + (dif / 72) * opt.scrollspeed | 0; + return 80 + (dif / 72) * opt.scrollspeed |0; }; @@ -3080,6 +2984,7 @@ }); }; this.cancelScroll = function () { }; // direct + } else if (self.ishwscroll && cap.hastransition && opt.usetransition && !!opt.smoothscroll) { var lasttransitionstyle = ''; @@ -3145,7 +3050,7 @@ if (y < 0) y = y / 2 | 0; else if (y > self.page.maxh) y = self.page.maxh + (y - self.page.maxh) / 2 | 0; if (x < 0) x = x / 2 | 0; - else if (x > self.page.maxw) x = self.page.maxw + (y - self.page.maxw) / 2 | 0; + else if (x > self.page.maxw) x = self.page.maxw + (x - self.page.maxw) / 2 | 0; } if (self.scrollrunning && x == self.newscrollx && y == self.newscrolly) return false; @@ -3153,16 +3058,12 @@ self.newscrolly = y; self.newscrollx = x; - //self.newscrollspeed = spd || false; - var top = self.getScrollTop(); var lft = self.getScrollLeft(); var dst = {}; dst.x = x - lft; dst.y = y - top; - //dst.px = lft; - //dst.py = top; var dd = Math.sqrt((dst.x * dst.x) + (dst.y * dst.y)) | 0; @@ -3184,53 +3085,6 @@ self.setScrollTop(self.newscrolly); self.setScrollLeft(self.newscrollx); - //if (ms===0) self.onScrollTransitionEnd(); - - /* - if (self.timerscroll && self.timerscroll.tm) clearInterval(self.timerscroll.tm); - - if (ms > 0) { - - if (!self.scrollrunning) self.triggerScrollStart(lft, top, x, y, ms); - - if (cap.transitionend) { - if (!self.scrollendtrapped) { - self.scrollendtrapped = true; - self.bind(self.doc, cap.transitionend, self.onScrollTransitionEnd, false); //I have got to do something usefull!! - } - } else { - if (self.scrollendtrapped) clearTimeout(self.scrollendtrapped); - self.scrollendtrapped = setTimeout(self.onScrollTransitionEnd, ms); // simulate transitionend event - } - - var py = top; - var px = lft; - self.timerscroll = { - bz: new BezierClass(py, self.newscrolly, ms, 0, 0, 0.58, 1), - bh: new BezierClass(px, self.newscrollx, ms, 0, 0, 0.58, 1) - }; - if (!self.cursorfreezed) self.timerscroll.tm = setInterval(function () { - self.showCursor(self.getScrollTop(), self.getScrollLeft()); - }, 60); - - } - - self.synched("doScroll-set", function () { - self.timer = 0; - if (self.scrollendtrapped) self.scrollrunning = true; - self.setScrollTop(self.newscrolly); - self.setScrollLeft(self.newscrollx); - if (!self.scrollendtrapped) self.onScrollTransitionEnd(); - - //console.log(ms,self.newscrolly); - - }); - - - }, 50); - - */ - }; this.cancelScroll = function () { @@ -3240,7 +3094,6 @@ self.scrollrunning = false; if (!cap.transitionend) clearTimeout(cap.transitionend); self.scrollendtrapped = false; - //self._unbind(self.doc[0], cap.transitionend, self.onScrollTransitionEnd); self.resetTransition(); self.setScrollTop(py); // fire event onscroll if (self.railh) self.setScrollLeft(px); @@ -3253,10 +3106,10 @@ self.showCursor(py, px); return self; }; + this.onScrollTransitionEnd = function () { if (!self.scrollendtrapped) return; - //if (self.scrollendtrapped) self._unbind(self.doc[0], cap.transitionend, self.onScrollTransitionEnd); var py = self.getScrollTop(); var px = self.getScrollLeft(); @@ -3272,7 +3125,6 @@ self.scrollendtrapped = false; self.resetTransition(); - //if (self.timerscroll && self.timerscroll.tm) clearInterval(self.timerscroll.tm); self.timerscroll = false; self.setScrollTop(py); // fire event onscroll if (self.railh) self.setScrollLeft(px); // fire event onscroll left @@ -3297,7 +3149,6 @@ }; this.doScrollPos = function (x, y, spd) { //no-trans - //y = y || self.getScrollTop(true); var py = self.getScrollTop(); var px = self.getScrollLeft(); @@ -3382,65 +3233,11 @@ } this.doScrollBy = function (stp, relative) { - // var ny = 0; - - /* - if (relative) { - ny = Math.floor((self.scroll.y - stp) * self.scrollratio.y); - } else { - var sy = (self.timer) ? self.newscrolly : self.getScrollTop(true); - ny = sy - stp; - } - */ - - /* - var haf = self.view.h << 2; - var ny = self.getScrollTop() + stp; - if (ny < -haf) stp = haf-ny; - else if (ny > (self.page.maxh + haf)) stp = (self.page.maxh + haf -ny); - */ - - // self.cursorfreezed = false; - - /* - var py = self.getScrollTop(true); - if (ny < 0 && py <= 0) return self.noticeCursor(); - else if (ny > self.page.maxh && py >= self.page.maxh) { - self.checkContentSize(); - return self.noticeCursor(); - } - */ - - //self.doScrollTop(ny); - doScrollRelative(0, stp); }; this.doScrollLeftBy = function (stp, relative) { - /* - var nx = 0; - if (relative) { - nx = Math.floor((self.scroll.x - stp) * self.scrollratio.x); - } else { - var sx = (self.timer) ? self.newscrollx : self.getScrollLeft(true); - nx = sx - stp; - } - if (self.bouncescroll) { - var haf = Math.round(self.view.w / 2); - if (nx < -haf) nx = -haf; - else if (nx > (self.page.maxw + haf)) nx = (self.page.maxw + haf); - } - self.cursorfreezed = false; - - var px = self.getScrollLeft(true); - if (nx < 0 && px <= 0) return self.noticeCursor(); - else if (nx > self.page.maxw && px >= self.page.maxw) return self.noticeCursor(); - - self.doScrollLeft(nx); - */ - doScrollRelative(stp, 0); - }; this.doScrollTo = function (pos, relative) { @@ -3569,8 +3366,6 @@ // Inspired by the work of Kin Blas // http://webpro.host.adobe.com/people/jblas/momentum/includes/jquery.momentum.0.7.js - - var ScrollMomentumClass2D = function (nc) { var self = this; this.nc = nc; @@ -3755,7 +3550,6 @@ // override jQuery scrollTop - var _scrollTop = jQuery.fn.scrollTop; // preserve original function jQuery.cssHooks.pageYOffset = { @@ -3770,12 +3564,6 @@ } }; - /* - $.fx.step["scrollTop"] = function(fx){ - $.cssHooks["scrollTop"].set( fx.elem, fx.now + fx.unit ); - }; -*/ - jQuery.fn.scrollTop = function (value) { if (value === undefined) { var nice = (this[0]) ? $.data(this[0], '__nicescroll') || false : false; @@ -3789,7 +3577,6 @@ }; // override jQuery scrollLeft - var _scrollLeft = jQuery.fn.scrollLeft; // preserve original function $.cssHooks.pageXOffset = { @@ -3804,12 +3591,6 @@ } }; - /* - $.fx.step["scrollLeft"] = function(fx){ - $.cssHooks["scrollLeft"].set( fx.elem, fx.now + fx.unit ); - }; -*/ - jQuery.fn.scrollLeft = function (value) { if (value === undefined) { var nice = (this[0]) ? $.data(this[0], '__nicescroll') || false : false; @@ -3926,5 +3707,4 @@ $.nicescroll.options = _globaloptions; } -})); - +})); \ No newline at end of file diff --git a/jquery.nicescroll.min.js b/jquery.nicescroll.min.js index 92a239a..ea69eda 100644 --- a/jquery.nicescroll.min.js +++ b/jquery.nicescroll.min.js @@ -1,2 +1,2 @@ -/* jquery.nicescroll v 3.7.4-d [DEV REL] - InuYaksa*2017 - MIT - https://nicescroll.areaaperta.com/ */ -!function(e){"function"==typeof define&&define.amd?define(["jquery"],e):"object"==typeof exports?module.exports=e(require("jquery")):e(jQuery)}(function(e){"use strict";var o=!1,t=!1,r=0,i=2e3,s=0,n=e,l=document,a=window,c=n(a),d=[],u=a.requestAnimationFrame||a.webkitRequestAnimationFrame||a.mozRequestAnimationFrame||!1,h=a.cancelAnimationFrame||a.webkitCancelAnimationFrame||a.mozCancelAnimationFrame||!1;if(u)a.cancelAnimationFrame||(h=function(e){});else{var p=0;u=function(e,o){var t=(new Date).getTime(),r=Math.max(0,16-(t-p)),i=a.setTimeout(function(){e(t+r)},r);return p=t+r,i},h=function(e){a.clearTimeout(e)}}var m=a.MutationObserver||a.WebKitMutationObserver||!1,f=Date.now||function(){return(new Date).getTime()},g={zindex:"auto",cursoropacitymin:0,cursoropacitymax:1,cursorcolor:"#424242",cursorwidth:"6px",cursorborder:"1px solid #fff",cursorborderradius:"5px",scrollspeed:40,mousescrollstep:27,touchbehavior:!1,emulatetouch:!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 e=l.currentScript||function(){var e=l.getElementsByTagName("script");return!!e.length&&e[e.length-1]}(),o=e?e.src.split("?")[0]:"";return o.split("/").length>0?o.split("/").slice(0,-1).join("/")+"/":""}(),preventmultitouchscrolling:!0,disablemutationobserver:!1,enableobserver:!0,scrollbarid:!1},v=!1,w=function(){if(v)return v;var e=l.createElement("DIV"),o=e.style,t=navigator.userAgent,r=navigator.platform,i={};return i.haspointerlock="pointerLockElement"in l||"webkitPointerLockElement"in l||"mozPointerLockElement"in l,i.isopera="opera"in a,i.isopera12=i.isopera&&"getUserMedia"in navigator,i.isoperamini="[object OperaMini]"===Object.prototype.toString.call(a.operamini),i.isie="all"in l&&"attachEvent"in e&&!i.isopera,i.isieold=i.isie&&!("msInterpolationMode"in o),i.isie7=i.isie&&!i.isieold&&(!("documentMode"in l)||7===l.documentMode),i.isie8=i.isie&&"documentMode"in l&&8===l.documentMode,i.isie9=i.isie&&"performance"in a&&9===l.documentMode,i.isie10=i.isie&&"performance"in a&&10===l.documentMode,i.isie11="msRequestFullscreen"in e&&l.documentMode>=11,i.ismsedge="msCredentials"in a,i.ismozilla="MozAppearance"in o,i.iswebkit=!i.ismsedge&&"WebkitAppearance"in o,i.ischrome=i.iswebkit&&"chrome"in a,i.ischrome38=i.ischrome&&"touchAction"in o,i.ischrome22=!i.ischrome38&&i.ischrome&&i.haspointerlock,i.ischrome26=!i.ischrome38&&i.ischrome&&"transition"in o,i.cantouch="ontouchstart"in l.documentElement||"ontouchstart"in a,i.hasw3ctouch=(a.PointerEvent||!1)&&(navigator.MaxTouchPoints>0||navigator.msMaxTouchPoints>0),i.hasmstouch=!i.hasw3ctouch&&(a.MSPointerEvent||!1),i.ismac=/^mac$/i.test(r),i.isios=i.cantouch&&/iphone|ipad|ipod/i.test(r),i.isios4=i.isios&&!("seal"in Object),i.isios7=i.isios&&"webkitHidden"in l,i.isios8=i.isios&&"hidden"in l,i.isios10=i.isios&&a.Proxy,i.isandroid=/android/i.test(t),i.haseventlistener="addEventListener"in e,i.trstyle=!1,i.hastransform=!1,i.hastranslate3d=!1,i.transitionstyle=!1,i.hastransition=!1,i.transitionend=!1,i.trstyle="transform",i.hastransform="transform"in o||function(){for(var e=["msTransform","webkitTransform","MozTransform","OTransform"],t=0,r=e.length;t0;){if(9==e[0].nodeType)return!1;var o=e.css("zIndex");if(!isNaN(o)&&0!==o)return parseInt(o);e=e.parent()}return!1}function x(e,o,t){var r=e.css(o),i=parseFloat(r);if(isNaN(i)){var s=3==(i=I[r]||0)?t?T.win.outerHeight()-T.win.innerHeight():T.win.outerWidth()-T.win.innerWidth():1;return T.isie8&&i&&(i+=1),s?i:0}return i}function S(e,o,t,r){T._bind(e,o,function(r){var i={original:r=r||a.event,target:r.target||r.srcElement,type:"wheel",deltaMode:"MozMousePixelScroll"==r.type?0:1,deltaX:0,deltaZ:0,preventDefault:function(){return r.preventDefault?r.preventDefault():r.returnValue=!1,!1},stopImmediatePropagation:function(){r.stopImmediatePropagation?r.stopImmediatePropagation():r.cancelBubble=!0}};return"mousewheel"==o?(r.wheelDeltaX&&(i.deltaX=-.025*r.wheelDeltaX),r.wheelDeltaY&&(i.deltaY=-.025*r.wheelDeltaY),!i.deltaY&&!i.deltaX&&(i.deltaY=-.025*r.wheelDelta)):i.deltaY=r.detail,t.call(e,i)},r)}function z(e,o,t,r){T.scrollrunning||(T.newscrolly=T.getScrollTop(),T.newscrollx=T.getScrollLeft(),D=f());var i=f()-D;if(D=f(),i>350?A=1:A+=(2-A)/10,e=e*A|0,o=o*A|0,e){if(r)if(e<0){if(T.getScrollLeft()>=T.page.maxw)return!0}else if(T.getScrollLeft()<=0)return!0;var s=e>0?1:-1;X!==s&&(T.scrollmom&&T.scrollmom.stop(),T.newscrollx=T.getScrollLeft(),X=s),T.lastdeltax-=e}if(o){if(function(){var e=T.getScrollTop();if(o<0){if(e>=T.page.maxh)return!0}else if(e<=0)return!0}()){if(M.nativeparentscrolling&&t&&!T.ispage&&!T.zoomactive)return!0;var n=T.view.h>>1;T.newscrolly<-n?(T.newscrolly=-n,o=-1):T.newscrolly>T.page.maxh+n?(T.newscrolly=T.page.maxh+n,o=1):o=0}var l=o>0?1:-1;B!==l&&(T.scrollmom&&T.scrollmom.stop(),T.newscrolly=T.getScrollTop(),B=l),T.lastdeltay-=o}(o||e)&&T.synched("relativexy",function(){var e=T.lastdeltay+T.newscrolly;T.lastdeltay=0;var o=T.lastdeltax+T.newscrollx;T.lastdeltax=0,T.rail.drag||T.doScrollPos(o,e)})}function k(e,o,t){var r,i;return!(t||!q)||(0===e.deltaMode?(r=-e.deltaX*(M.mousescrollstep/54)|0,i=-e.deltaY*(M.mousescrollstep/54)|0):1===e.deltaMode&&(r=-e.deltaX*M.mousescrollstep*50/80|0,i=-e.deltaY*M.mousescrollstep*50/80|0),o&&M.oneaxismousemode&&0===r&&i&&(r=i,i=0,t&&(r<0?T.getScrollLeft()>=T.page.maxw:T.getScrollLeft()<=0)&&(i=r,r=0)),T.isrtlmode&&(r=-r),z(r,i,t,!0)?void(t&&(q=!0)):(q=!1,e.stopImmediatePropagation(),e.preventDefault()))}var T=this;this.version="3.7.4-f",this.name="nicescroll",this.me=p;var E=n("body"),M=this.opt={doc:E,win:!1};if(n.extend(M,g),M.snapbackspeed=80,e)for(var L in M)void 0!==e[L]&&(M[L]=e[L]);if(M.disablemutationobserver&&(m=!1),this.doc=M.doc,this.iddoc=this.doc&&this.doc[0]?this.doc[0].id||"":"",this.ispage=/^BODY|HTML/.test(M.win?M.win[0].nodeName:this.doc[0].nodeName),this.haswrapper=!1!==M.win,this.win=M.win||(this.ispage?c:this.doc),this.docscroll=this.ispage&&!this.haswrapper?c:this.win,this.body=E,this.viewport=!1,this.isfixed=!1,this.iframe=!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"!=M.autohidemode,this.onmousedown=!1,this.onmouseup=!1,this.onmousemove=!1,this.onmousewheel=!1,this.onkeypress=!1,this.ongesturezoom=!1,this.onclick=!1,this.onscrollstart=!1,this.onscrollend=!1,this.onscrollcancel=!1,this.onzoomin=!1,this.onzoomout=!1,this.view=!1,this.page=!1,this.scroll={x:0,y:0},this.scrollratio={x:0,y:0},this.cursorheight=20,this.scrollvaluemax=0,"auto"==M.rtlmode){var C=this.win[0]==a?this.body:this.win,N=C.css("writing-mode")||C.css("-webkit-writing-mode")||C.css("-ms-writing-mode")||C.css("-moz-writing-mode");"horizontal-tb"==N||"lr-tb"==N||""===N?(this.isrtlmode="rtl"==C.css("direction"),this.isvertical=!1):(this.isrtlmode="vertical-rl"==N||"tb"==N||"tb-rl"==N||"rl-tb"==N,this.isvertical="vertical-rl"==N||"tb"==N||"tb-rl"==N)}else this.isrtlmode=!0===M.rtlmode,this.isvertical=!1;if(this.scrollrunning=!1,this.scrollmom=!1,this.observer=!1,this.observerremover=!1,this.observerbody=!1,!1!==M.scrollbarid)this.id=M.scrollbarid;else do{this.id="ascrail"+i++}while(l.getElementById(this.id));this.rail=!1,this.cursor=!1,this.cursorfreezed=!1,this.selectiondrag=!1,this.zoom=!1,this.zoomactive=!1,this.hasfocus=!1,this.hasmousefocus=!1,this.visibility=!0,this.railslocked=!1,this.locked=!1,this.hidden=!1,this.cursoractive=!0,this.wheelprevented=!1,this.overflowx=M.overflowx,this.overflowy=M.overflowy,this.nativescrollingarea=!1,this.checkarea=0,this.events=[],this.saved={},this.delaylist={},this.synclist={},this.lastdeltax=0,this.lastdeltay=0,this.detected=w();var P=n.extend({},this.detected);this.canhwscroll=P.hastransform&&M.hwacceleration,this.ishwscroll=this.canhwscroll&&T.haswrapper,this.isrtlmode?this.isvertical?this.hasreversehr=!(P.iswebkit||P.isie||P.isie11):this.hasreversehr=!(P.iswebkit||P.isie&&!P.isie10&&!P.isie11):this.hasreversehr=!1,this.istouchcapable=!1,P.cantouch||!P.hasw3ctouch&&!P.hasmstouch?!P.cantouch||P.isios||P.isandroid||!P.iswebkit&&!P.ismozilla||(this.istouchcapable=!0):this.istouchcapable=!0,M.enablemouselockapi||(P.hasmousecapture=!1,P.haspointerlock=!1),this.debounced=function(e,o,t){T&&(T.delaylist[e]||!1||(T.delaylist[e]={h:u(function(){T.delaylist[e].fn.call(T),T.delaylist[e]=!1},t)},o.call(T)),T.delaylist[e].fn=o)},this.synched=function(e,o){T.synclist[e]?T.synclist[e]=o:(T.synclist[e]=o,u(function(){T&&(T.synclist[e]&&T.synclist[e].call(T),T.synclist[e]=null)}))},this.unsynched=function(e){T.synclist[e]&&(T.synclist[e]=!1)},this.css=function(e,o){for(var t in o)T.saved.css.push([e,t,e.css(t)]),e.css(t,o[t])},this.scrollTop=function(e){return void 0===e?T.getScrollTop():T.setScrollTop(e)},this.scrollLeft=function(e){return void 0===e?T.getScrollLeft():T.setScrollLeft(e)};var R=function(e,o,t,r,i,s,n){this.st=e,this.ed=o,this.spd=t,this.p1=r||0,this.p2=i||1,this.p3=s||0,this.p4=n||1,this.ts=f(),this.df=o-e};if(R.prototype={B2:function(e){return 3*(1-e)*(1-e)*e},B3:function(e){return 3*(1-e)*e*e},B4:function(e){return e*e*e},getPos:function(){return(f()-this.ts)/this.spd},getNow:function(){var e=(f()-this.ts)/this.spd,o=this.B2(e)+this.B3(e)+this.B4(e);return e>=1?this.ed:this.st+this.df*o|0},update:function(e,o){return this.st=this.getNow(),this.ed=e,this.spd=o,this.ts=f(),this.df=this.ed-this.st,this}},this.ishwscroll){this.doc.translate={x:0,y:0,tx:"0px",ty:"0px"},P.hastranslate3d&&P.isios&&this.doc.css("-webkit-backface-visibility","hidden"),this.getScrollTop=function(e){if(!e){var o=v();if(o)return 16==o.length?-o[13]:-o[5];if(T.timerscroll&&T.timerscroll.bz)return T.timerscroll.bz.getNow()}return T.doc.translate.y},this.getScrollLeft=function(e){if(!e){var o=v();if(o)return 16==o.length?-o[12]:-o[4];if(T.timerscroll&&T.timerscroll.bh)return T.timerscroll.bh.getNow()}return T.doc.translate.x},this.notifyScrollEvent=function(e){var o=l.createEvent("UIEvents");o.initUIEvent("scroll",!1,!0,a,1),o.niceevent=!0,e.dispatchEvent(o)};var _=this.isrtlmode?1:-1;P.hastranslate3d&&M.enabletranslate3d?(this.setScrollTop=function(e,o){T.doc.translate.y=e,T.doc.translate.ty=-1*e+"px",T.doc.css(P.trstyle,"translate3d("+T.doc.translate.tx+","+T.doc.translate.ty+",0)"),o||T.notifyScrollEvent(T.win[0])},this.setScrollLeft=function(e,o){T.doc.translate.x=e,T.doc.translate.tx=e*_+"px",T.doc.css(P.trstyle,"translate3d("+T.doc.translate.tx+","+T.doc.translate.ty+",0)"),o||T.notifyScrollEvent(T.win[0])}):(this.setScrollTop=function(e,o){T.doc.translate.y=e,T.doc.translate.ty=-1*e+"px",T.doc.css(P.trstyle,"translate("+T.doc.translate.tx+","+T.doc.translate.ty+")"),o||T.notifyScrollEvent(T.win[0])},this.setScrollLeft=function(e,o){T.doc.translate.x=e,T.doc.translate.tx=e*_+"px",T.doc.css(P.trstyle,"translate("+T.doc.translate.tx+","+T.doc.translate.ty+")"),o||T.notifyScrollEvent(T.win[0])})}else this.getScrollTop=function(){return T.docscroll.scrollTop()},this.setScrollTop=function(e){T.docscroll.scrollTop(e)},this.getScrollLeft=function(){return T.hasreversehr?T.detected.ismozilla?T.page.maxw-Math.abs(T.docscroll.scrollLeft()):T.page.maxw-T.docscroll.scrollLeft():T.docscroll.scrollLeft()},this.setScrollLeft=function(e){return setTimeout(function(){if(T)return T.hasreversehr&&(e=T.detected.ismozilla?-(T.page.maxw-e):T.page.maxw-e),T.docscroll.scrollLeft(e)},1)};this.getTarget=function(e){return!!e&&(e.target?e.target:!!e.srcElement&&e.srcElement)},this.hasParent=function(e,o){if(!e)return!1;for(var t=e.target||e.srcElement||e||!1;t&&t.id!=o;)t=t.parentNode||!1;return!1!==t};var I={thin:1,medium:3,thick:5};this.getDocumentScrollOffset=function(){return{top:a.pageYOffset||l.documentElement.scrollTop,left:a.pageXOffset||l.documentElement.scrollLeft}},this.getOffset=function(){if(T.isfixed){var e=T.win.offset(),o=T.getDocumentScrollOffset();return e.top-=o.top,e.left-=o.left,e}var t=T.win.offset();if(!T.viewport)return t;var r=T.viewport.offset();return{top:t.top-r.top,left:t.left-r.left}},this.updateScrollBar=function(e){var o,t;if(T.ishwscroll)T.rail.css({height:T.win.innerHeight()-(M.railpadding.top+M.railpadding.bottom)}),T.railh&&T.railh.css({width:T.win.innerWidth()-(M.railpadding.left+M.railpadding.right)});else{var r=T.getOffset();if(o={top:r.top,left:r.left-(M.railpadding.left+M.railpadding.right)},o.top+=x(T.win,"border-top-width",!0),o.left+=T.rail.align?T.win.outerWidth()-x(T.win,"border-right-width")-T.rail.width:x(T.win,"border-left-width"),(t=M.railoffset)&&(t.top&&(o.top+=t.top),t.left&&(o.left+=t.left)),T.railslocked||T.rail.css({top:o.top,left:o.left,height:(e?e.h:T.win.innerHeight())-(M.railpadding.top+M.railpadding.bottom)}),T.zoom&&T.zoom.css({top:o.top+1,left:1==T.rail.align?o.left-20:o.left+T.rail.width+4}),T.railh&&!T.railslocked){o={top:r.top,left:r.left},(t=M.railhoffset)&&(t.top&&(o.top+=t.top),t.left&&(o.left+=t.left));var i=T.railh.align?o.top+x(T.win,"border-top-width",!0)+T.win.innerHeight()-T.railh.height:o.top+x(T.win,"border-top-width",!0),s=o.left+x(T.win,"border-left-width");T.railh.css({top:i-(M.railpadding.top+M.railpadding.bottom),left:s,width:T.railh.width})}}},this.doRailClick=function(e,o,t){var r,i,s,n;T.railslocked||(T.cancelEvent(e),"pageY"in e||(e.pageX=e.clientX+l.documentElement.scrollLeft,e.pageY=e.clientY+l.documentElement.scrollTop),o?(r=t?T.doScrollLeft:T.doScrollTop)(s=t?(e.pageX-T.railh.offset().left-T.cursorwidth/2)*T.scrollratio.x:(e.pageY-T.rail.offset().top-T.cursorheight/2)*T.scrollratio.y):(r=t?T.doScrollLeftBy:T.doScrollBy,s=t?T.scroll.x:T.scroll.y,n=t?e.pageX-T.railh.offset().left:e.pageY-T.rail.offset().top,i=t?T.view.w:T.view.h,r(s>=n?i:-i)))},T.newscrolly=T.newscrollx=0,T.hasanimationframe="requestAnimationFrame"in a,T.hascancelanimationframe="cancelAnimationFrame"in a,T.hasborderbox=!1,this.init=function(){if(T.saved.css=[],P.isoperamini)return!0;if(P.isandroid&&!("hidden"in l))return!0;M.emulatetouch=M.emulatetouch||M.touchbehavior,T.hasborderbox=a.getComputedStyle&&"border-box"===a.getComputedStyle(l.body)["box-sizing"];var e={"overflow-y":"hidden"};if((P.isie11||P.isie10)&&(e["-ms-overflow-style"]="none"),T.ishwscroll&&(this.doc.css(P.transitionstyle,P.prefixstyle+"transform 0ms ease-out"),P.transitionend&&T.bind(T.doc,P.transitionend,T.onScrollTransitionEnd,!1)),T.zindex="auto",T.ispage||"auto"!=M.zindex?T.zindex=M.zindex:T.zindex=b()||"auto",!T.ispage&&"auto"!=T.zindex&&T.zindex>s&&(s=T.zindex),T.isie&&0===T.zindex&&"auto"==M.zindex&&(T.zindex="auto"),!T.ispage||!P.isieold){var i=T.docscroll;T.ispage&&(i=T.haswrapper?T.win:T.doc),T.css(i,e),T.ispage&&(P.isie11||P.isie)&&T.css(n("html"),e),!P.isios||T.ispage||T.haswrapper||T.css(E,{"-webkit-overflow-scrolling":"touch"});var d=n(l.createElement("div"));d.css({position:"relative",top:0,float:"right",width:M.cursorwidth,height:0,"background-color":M.cursorcolor,border:M.cursorborder,"background-clip":"padding-box","-webkit-border-radius":M.cursorborderradius,"-moz-border-radius":M.cursorborderradius,"border-radius":M.cursorborderradius}),d.addClass("nicescroll-cursors"),T.cursor=d;var u=n(l.createElement("div"));u.attr("id",T.id),u.addClass("nicescroll-rails nicescroll-rails-vr");var h,p,f=["left","right","top","bottom"];for(var g in f)p=f[g],(h=M.railpadding[p]||0)&&u.css("padding-"+p,h+"px");u.append(d),u.width=Math.max(parseFloat(M.cursorwidth),d.outerWidth()),u.css({width:u.width+"px",zIndex:T.zindex,background:M.background,cursor:"default"}),u.visibility=!0,u.scrollable=!0,u.align="left"==M.railalign?0:1,T.rail=u,T.rail.drag=!1;var v=!1;!M.boxzoom||T.ispage||P.isieold||(v=l.createElement("div"),T.bind(v,"click",T.doZoom),T.bind(v,"mouseenter",function(){T.zoom.css("opacity",M.cursoropacitymax)}),T.bind(v,"mouseleave",function(){T.zoom.css("opacity",M.cursoropacitymin)}),T.zoom=n(v),T.zoom.css({cursor:"pointer",zIndex:T.zindex,backgroundImage:"url("+M.scriptpath+"zoomico.png)",height:18,width:18,backgroundPosition:"0 0"}),M.dblclickzoom&&T.bind(T.win,"dblclick",T.doZoom),P.cantouch&&M.gesturezoom&&(T.ongesturezoom=function(e){return e.scale>1.5&&T.doZoomIn(e),e.scale<.8&&T.doZoomOut(e),T.cancelEvent(e)},T.bind(T.win,"gestureend",T.ongesturezoom))),T.railh=!1;var w;if(M.horizrailenabled&&(T.css(i,{overflowX:"hidden"}),(d=n(l.createElement("div"))).css({position:"absolute",top:0,height:M.cursorwidth,width:0,backgroundColor:M.cursorcolor,border:M.cursorborder,backgroundClip:"padding-box","-webkit-border-radius":M.cursorborderradius,"-moz-border-radius":M.cursorborderradius,"border-radius":M.cursorborderradius}),P.isieold&&d.css("overflow","hidden"),d.addClass("nicescroll-cursors"),T.cursorh=d,(w=n(l.createElement("div"))).attr("id",T.id+"-hr"),w.addClass("nicescroll-rails nicescroll-rails-hr"),w.height=Math.max(parseFloat(M.cursorwidth),d.outerHeight()),w.css({height:w.height+"px",zIndex:T.zindex,background:M.background}),w.append(d),w.visibility=!0,w.scrollable=!0,w.align="top"==M.railvalign?0:1,T.railh=w,T.railh.drag=!1),T.ispage)u.css({position:"fixed",top:0,height:"100%"}),u.css(u.align?{right:0}:{left:0}),T.body.append(u),T.railh&&(w.css({position:"fixed",left:0,width:"100%"}),w.css(w.align?{bottom:0}:{top:0}),T.body.append(w));else{if(T.ishwscroll){"static"==T.win.css("position")&&T.css(T.win,{position:"relative"});var x="HTML"==T.win[0].nodeName?T.body:T.win;n(x).scrollTop(0).scrollLeft(0),T.zoom&&(T.zoom.css({position:"absolute",top:1,right:0,"margin-right":u.width+4}),x.append(T.zoom)),u.css({position:"absolute",top:0}),u.css(u.align?{right:0}:{left:0}),x.append(u),w&&(w.css({position:"absolute",left:0,bottom:0}),w.css(w.align?{bottom:0}:{top:0}),x.append(w))}else{T.isfixed="fixed"==T.win.css("position");var S=T.isfixed?"fixed":"absolute";T.isfixed||(T.viewport=T.getViewport(T.win[0])),T.viewport&&(T.body=T.viewport,/fixed|absolute/.test(T.viewport.css("position"))||T.css(T.viewport,{position:"relative"})),u.css({position:S}),T.zoom&&T.zoom.css({position:S}),T.updateScrollBar(),T.body.append(u),T.zoom&&T.body.append(T.zoom),T.railh&&(w.css({position:S}),T.body.append(w))}P.isios&&T.css(T.win,{"-webkit-tap-highlight-color":"rgba(0,0,0,0)","-webkit-touch-callout":"none"}),P.isie&&M.disableoutline&&T.win.attr("hideFocus","true"),P.iswebkit&&M.disableoutline&&T.win.css("outline","none")}if(!1===M.autohidemode?(T.autohidedom=!1,T.rail.css({opacity:M.cursoropacitymax}),T.railh&&T.railh.css({opacity:M.cursoropacitymax})):!0===M.autohidemode||"leave"===M.autohidemode?(T.autohidedom=n().add(T.rail),P.isie8&&(T.autohidedom=T.autohidedom.add(T.cursor)),T.railh&&(T.autohidedom=T.autohidedom.add(T.railh)),T.railh&&P.isie8&&(T.autohidedom=T.autohidedom.add(T.cursorh))):"scroll"==M.autohidemode?(T.autohidedom=n().add(T.rail),T.railh&&(T.autohidedom=T.autohidedom.add(T.railh))):"cursor"==M.autohidemode?(T.autohidedom=n().add(T.cursor),T.railh&&(T.autohidedom=T.autohidedom.add(T.cursorh))):"hidden"==M.autohidemode&&(T.autohidedom=!1,T.hide(),T.railslocked=!1),P.cantouch||T.istouchcapable||M.emulatetouch||P.hasmstouch){T.scrollmom=new y(T),T.ontouchstart=function(e){if(e.pointerType&&("mouse"===e.pointerType||e.pointerType===e.MSPOINTER_TYPE_MOUSE))return!1;if(T.hasmoving=!1,T.scrollmom.timer&&(T.triggerScrollEnd(),T.scrollmom.stop()),!T.railslocked){var o;if(P.hasmstouch)for(o=!!e.target&&e.target;o;){var t=n(o).getNiceScroll();if(t.length>0&&t[0].me==T.me)break;if(t.length>0)return!1;if("DIV"==o.nodeName&&o.id==T.id)break;o=!!o.parentNode&&o.parentNode}if((o=T.getTarget(e))&&/INPUT/i.test(o.nodeName)&&/range/i.test(o.type))return T.stopPropagation(e);if(!("clientX"in e)&&"changedTouches"in e&&(e.clientX=e.changedTouches[0].clientX,e.clientY=e.changedTouches[0].clientY),T.forcescreen){var r=e;(e={original:e.original?e.original:e}).clientX=r.screenX,e.clientY=r.screenY}if(T.rail.drag={x:e.clientX,y:e.clientY,sx:T.scroll.x,sy:T.scroll.y,st:T.getScrollTop(),sl:T.getScrollLeft(),pt:2,dl:!1,tg:o},T.ispage||!M.directionlockdeadzone)T.rail.drag.dl="f";else{var i={w:c.width(),h:c.height()},s={w:Math.max(l.body.scrollWidth,l.documentElement.scrollWidth),h:Math.max(l.body.scrollHeight,l.documentElement.scrollHeight)},a=Math.max(0,s.h-i.h),d=Math.max(0,s.w-i.w);T.rail.scrollable&&!T.railh.scrollable?T.rail.drag.ck=a>0&&"v":!T.rail.scrollable&&T.railh.scrollable?T.rail.drag.ck=d>0&&"h":T.rail.drag.ck=!1}if(M.emulatetouch&&T.isiframe&&P.isie){var u=T.win.position();T.rail.drag.x+=u.left,T.rail.drag.y+=u.top}if(T.hasmoving=!1,T.lastmouseup=!1,T.scrollmom.reset(e.clientX,e.clientY),!P.cantouch&&!this.istouchcapable&&!e.pointerType){if(!(!!o&&/INPUT|SELECT|BUTTON|TEXTAREA/i.test(o.nodeName)))return!T.ispage&&P.hasmousecapture&&o.setCapture(),M.emulatetouch?(o.onclick&&!o._onclick&&(o._onclick=o.onclick,o.onclick=function(e){if(T.hasmoving)return!1;o._onclick.call(this,e)}),T.cancelEvent(e)):T.stopPropagation(e);/SUBMIT|CANCEL|BUTTON/i.test(n(o).attr("type"))&&(T.preventclick={tg:o,click:!1})}}},T.ontouchend=function(e){if(!T.rail.drag)return!0;if(2==T.rail.drag.pt){if(e.pointerType&&("mouse"===e.pointerType||e.pointerType===e.MSPOINTER_TYPE_MOUSE))return!1;if(T.rail.drag=!1,T.hasmoving&&(T.scrollmom.doMomentum(),T.lastmouseup=!0,T.hideCursor(),P.hasmousecapture&&l.releaseCapture(),!P.cantouch))return T.cancelEvent(e)}else if(1==T.rail.drag.pt)return T.onmouseup(e)};var z=M.emulatetouch&&T.isiframe&&!P.hasmousecapture,k=.3*M.directionlockdeadzone|0;T.ontouchmove=function(e,o){if(!T.rail.drag)return!0;if(e.targetTouches&&M.preventmultitouchscrolling&&e.targetTouches.length>1)return!0;if(e.pointerType&&("mouse"===e.pointerType||e.pointerType===e.MSPOINTER_TYPE_MOUSE))return!0;if(2==T.rail.drag.pt){"changedTouches"in e&&(e.clientX=e.changedTouches[0].clientX,e.clientY=e.changedTouches[0].clientY);var t,r;if(r=t=0,z&&!o){var i=T.win.position();r=-i.left,t=-i.top}var s=e.clientY+t,n=s-T.rail.drag.y,a=e.clientX+r,c=a-T.rail.drag.x,d=T.rail.drag.st-n;if(T.ishwscroll&&M.bouncescroll)d<0?d=Math.round(d/2):d>T.page.maxh&&(d=T.page.maxh+Math.round((d-T.page.maxh)/2));else if(d<0?(d=0,s=0):d>T.page.maxh&&(d=T.page.maxh,s=0),0===s&&!T.hasmoving)return T.rail.drag=!1,!0;var u=T.getScrollLeft();if(T.railh&&T.railh.scrollable&&(u=T.isrtlmode?c-T.rail.drag.sl:T.rail.drag.sl-c,T.ishwscroll&&M.bouncescroll?u<0?u=Math.round(u/2):u>T.page.maxw&&(u=T.page.maxw+Math.round((u-T.page.maxw)/2)):(u<0&&(u=0,a=0),u>T.page.maxw&&(u=T.page.maxw,a=0))),!T.hasmoving){if(T.rail.drag.y===e.clientY&&T.rail.drag.x===e.clientX)return e.stopPropagation();var h=Math.abs(n),p=Math.abs(c),m=M.directionlockdeadzone;if(T.rail.drag.ck?"v"==T.rail.drag.ck?p>m&&h<=k?T.rail.drag=!1:h>m&&(T.rail.drag.dl="v"):"h"==T.rail.drag.ck&&(h>m&&p<=k?T.rail.drag=!1:p>m&&(T.rail.drag.dl="h")):h>m&&p>m?T.rail.drag.dl="f":h>m?T.rail.drag.dl=p>k?"f":"v":p>m&&(T.rail.drag.dl=h>k?"f":"h"),!T.rail.drag.dl)return!1;T.triggerScrollStart(e.clientX,e.clientY,0,0,0),T.hasmoving=!0}return T.preventclick&&!T.preventclick.click&&(T.preventclick.click=T.preventclick.tg.onclick||!1,T.preventclick.tg.onclick=T.onpreventclick),T.rail.drag.dl&&("v"==T.rail.drag.dl?u=T.rail.drag.sl:"h"==T.rail.drag.dl&&(d=T.rail.drag.st)),T.synched("touchmove",function(){T.rail.drag&&2==T.rail.drag.pt&&(T.prepareTransition&&T.resetTransition(),T.rail.scrollable&&T.setScrollTop(d),T.scrollmom.update(a,s),T.railh&&T.railh.scrollable?(T.setScrollLeft(u),T.showCursor(d,u)):T.showCursor(d),P.isie10&&l.selection.clear())}),T.cancelEvent(e),!1}return 1==T.rail.drag.pt?T.onmousemove(e):void 0},T.ontouchstartCursor=function(e,o){if(!T.rail.drag||3==T.rail.drag.pt){if(T.locked)return T.cancelEvent(e);T.cancelScroll(),T.rail.drag={x:e.touches[0].clientX,y:e.touches[0].clientY,sx:T.scroll.x,sy:T.scroll.y,pt:3,hr:!!o};var t=T.getTarget(e);return!T.ispage&&P.hasmousecapture&&t.setCapture(),T.isiframe&&!P.hasmousecapture&&(T.saved.csspointerevents=T.doc.css("pointer-events"),T.css(T.doc,{"pointer-events":"none"})),T.cancelEvent(e)}},T.ontouchendCursor=function(e){if(T.rail.drag){if(P.hasmousecapture&&l.releaseCapture(),T.isiframe&&!P.hasmousecapture&&T.doc.css("pointer-events",T.saved.csspointerevents),3!=T.rail.drag.pt)return;return T.rail.drag=!1,T.cancelEvent(e)}},T.ontouchmoveCursor=function(e){if(T.rail.drag){if(3!=T.rail.drag.pt)return;if(T.cursorfreezed=!0,T.rail.drag.hr){T.scroll.x=T.rail.drag.sx+(e.touches[0].clientX-T.rail.drag.x),T.scroll.x<0&&(T.scroll.x=0);var o=T.scrollvaluemaxw;T.scroll.x>o&&(T.scroll.x=o)}else{T.scroll.y=T.rail.drag.sy+(e.touches[0].clientY-T.rail.drag.y),T.scroll.y<0&&(T.scroll.y=0);var t=T.scrollvaluemax;T.scroll.y>t&&(T.scroll.y=t)}return T.synched("touchmove",function(){T.rail.drag&&3==T.rail.drag.pt&&(T.showCursor(),T.rail.drag.hr?T.doScrollLeft(Math.round(T.scroll.x*T.scrollratio.x),M.cursordragspeed):T.doScrollTop(Math.round(T.scroll.y*T.scrollratio.y),M.cursordragspeed))}),T.cancelEvent(e)}}}if(T.onmousedown=function(e,o){if(!T.rail.drag||1==T.rail.drag.pt){if(T.railslocked)return T.cancelEvent(e);T.cancelScroll(),T.rail.drag={x:e.clientX,y:e.clientY,sx:T.scroll.x,sy:T.scroll.y,pt:1,hr:o||!1};var t=T.getTarget(e);return P.hasmousecapture&&t.setCapture(),T.isiframe&&!P.hasmousecapture&&(T.saved.csspointerevents=T.doc.css("pointer-events"),T.css(T.doc,{"pointer-events":"none"})),T.hasmoving=!1,T.cancelEvent(e)}},T.onmouseup=function(e){if(T.rail.drag)return 1!=T.rail.drag.pt||(P.hasmousecapture&&l.releaseCapture(),T.isiframe&&!P.hasmousecapture&&T.doc.css("pointer-events",T.saved.csspointerevents),T.rail.drag=!1,T.cursorfreezed=!1,T.hasmoving&&T.triggerScrollEnd(),T.cancelEvent(e))},T.onmousemove=function(e){if(T.rail.drag){if(1!==T.rail.drag.pt)return;if(P.ischrome&&0===e.which)return T.onmouseup(e);if(T.cursorfreezed=!0,T.hasmoving||T.triggerScrollStart(e.clientX,e.clientY,0,0,0),T.hasmoving=!0,T.rail.drag.hr){T.scroll.x=T.rail.drag.sx+(e.clientX-T.rail.drag.x),T.scroll.x<0&&(T.scroll.x=0);var o=T.scrollvaluemaxw;T.scroll.x>o&&(T.scroll.x=o)}else{T.scroll.y=T.rail.drag.sy+(e.clientY-T.rail.drag.y),T.scroll.y<0&&(T.scroll.y=0);var t=T.scrollvaluemax;T.scroll.y>t&&(T.scroll.y=t)}return T.synched("mousemove",function(){T.cursorfreezed&&(T.showCursor(),T.rail.drag.hr?T.scrollLeft(Math.round(T.scroll.x*T.scrollratio.x)):T.scrollTop(Math.round(T.scroll.y*T.scrollratio.y)))}),T.cancelEvent(e)}T.checkarea=0},P.cantouch||M.emulatetouch)T.onpreventclick=function(e){if(T.preventclick)return T.preventclick.tg.onclick=T.preventclick.click,T.preventclick=!1,T.cancelEvent(e)},T.onclick=!P.isios&&function(e){return!T.lastmouseup||(T.lastmouseup=!1,T.cancelEvent(e))},M.grabcursorenabled&&P.cursorgrabvalue&&(T.css(T.ispage?T.doc:T.win,{cursor:P.cursorgrabvalue}),T.css(T.rail,{cursor:P.cursorgrabvalue}));else{var L=function(e){if(T.selectiondrag){if(e){var o=T.win.outerHeight(),t=e.pageY-T.selectiondrag.top;t>0&&t=o&&(t-=o),T.selectiondrag.df=t}if(0!==T.selectiondrag.df){var r=2*-Math.floor(T.selectiondrag.df/6);T.doScrollBy(r),T.debounced("doselectionscroll",function(){L()},50)}}};T.hasTextSelected="getSelection"in l?function(){return l.getSelection().rangeCount>0}:"selection"in l?function(){return"None"!=l.selection.type}:function(){return!1},T.onselectionstart=function(e){T.ispage||(T.selectiondrag=T.win.offset())},T.onselectionend=function(e){T.selectiondrag=!1},T.onselectiondrag=function(e){T.selectiondrag&&T.hasTextSelected()&&T.debounced("selectionscroll",function(){L(e)},250)}}if(P.hasw3ctouch?(T.css(T.ispage?n("html"):T.win,{"touch-action":"none"}),T.css(T.rail,{"touch-action":"none"}),T.css(T.cursor,{"touch-action":"none"}),T.bind(T.win,"pointerdown",T.ontouchstart),T.bind(l,"pointerup",T.ontouchend),T.bind(l,"pointermove",T.ontouchmove)):P.hasmstouch?(T.css(T.ispage?n("html"):T.win,{"-ms-touch-action":"none"}),T.css(T.rail,{"-ms-touch-action":"none"}),T.css(T.cursor,{"-ms-touch-action":"none"}),T.bind(T.win,"MSPointerDown",T.ontouchstart),T.bind(l,"MSPointerUp",T.ontouchend),T.bind(l,"MSPointerMove",T.ontouchmove),T.bind(T.cursor,"MSGestureHold",function(e){e.preventDefault()}),T.bind(T.cursor,"contextmenu",function(e){e.preventDefault()})):P.cantouch&&(T.bind(T.win,"touchstart",T.ontouchstart,!1,!0),T.bind(l,"touchend",T.ontouchend,!1,!0),T.bind(l,"touchcancel",T.ontouchend,!1,!0),T.delegate(l,"touchmove",T.ontouchmove,!1,!0)),M.emulatetouch&&(T.bind(T.win,"mousedown",T.ontouchstart,!1,!0),T.bind(l,"mouseup",T.ontouchend,!1,!0),T.bind(l,"mousemove",T.ontouchmove,!1,!0)),(M.cursordragontouch||!P.cantouch&&!M.emulatetouch)&&(T.rail.css({cursor:"default"}),T.railh&&T.railh.css({cursor:"default"}),T.jqbind(T.rail,"mouseenter",function(){if(!T.ispage&&!T.win.is(":visible"))return!1;T.canshowonmouseevent&&T.showCursor(),T.rail.active=!0}),T.jqbind(T.rail,"mouseleave",function(){T.rail.active=!1,T.rail.drag||T.hideCursor()}),M.sensitiverail&&(T.bind(T.rail,"click",function(e){T.doRailClick(e,!1,!1)}),T.bind(T.rail,"dblclick",function(e){T.doRailClick(e,!0,!1)}),T.bind(T.cursor,"click",function(e){T.cancelEvent(e)}),T.bind(T.cursor,"dblclick",function(e){T.cancelEvent(e)})),T.railh&&(T.jqbind(T.railh,"mouseenter",function(){if(!T.ispage&&!T.win.is(":visible"))return!1;T.canshowonmouseevent&&T.showCursor(),T.rail.active=!0}),T.jqbind(T.railh,"mouseleave",function(){T.rail.active=!1,T.rail.drag||T.hideCursor()}),M.sensitiverail&&(T.bind(T.railh,"click",function(e){T.doRailClick(e,!1,!0)}),T.bind(T.railh,"dblclick",function(e){T.doRailClick(e,!0,!0)}),T.bind(T.cursorh,"click",function(e){T.cancelEvent(e)}),T.bind(T.cursorh,"dblclick",function(e){T.cancelEvent(e)})))),M.cursordragontouch&&(this.istouchcapable||P.cantouch)&&(T.bind(T.cursor,"touchstart",T.ontouchstartCursor),T.bind(T.cursor,"touchmove",T.ontouchmoveCursor),T.bind(T.cursor,"touchend",T.ontouchendCursor),T.cursorh&&T.bind(T.cursorh,"touchstart",function(e){T.ontouchstartCursor(e,!0)}),T.cursorh&&T.bind(T.cursorh,"touchmove",T.ontouchmoveCursor),T.cursorh&&T.bind(T.cursorh,"touchend",T.ontouchendCursor)),P.cantouch||M.emulatetouch?(T.bind(P.hasmousecapture?T.win:l,"mouseup",T.ontouchend),T.onclick&&T.bind(l,"click",T.onclick),M.cursordragontouch?(T.bind(T.cursor,"mousedown",T.onmousedown),T.bind(T.cursor,"mouseup",T.onmouseup),T.cursorh&&T.bind(T.cursorh,"mousedown",function(e){T.onmousedown(e,!0)}),T.cursorh&&T.bind(T.cursorh,"mouseup",T.onmouseup)):(T.bind(T.rail,"mousedown",function(e){e.preventDefault()}),T.railh&&T.bind(T.railh,"mousedown",function(e){e.preventDefault()}))):(T.bind(P.hasmousecapture?T.win:l,"mouseup",T.onmouseup),T.bind(l,"mousemove",T.onmousemove),T.onclick&&T.bind(l,"click",T.onclick),T.bind(T.cursor,"mousedown",T.onmousedown),T.bind(T.cursor,"mouseup",T.onmouseup),T.railh&&(T.bind(T.cursorh,"mousedown",function(e){T.onmousedown(e,!0)}),T.bind(T.cursorh,"mouseup",T.onmouseup)),!T.ispage&&M.enablescrollonselection&&(T.bind(T.win[0],"mousedown",T.onselectionstart),T.bind(l,"mouseup",T.onselectionend),T.bind(T.cursor,"mouseup",T.onselectionend),T.cursorh&&T.bind(T.cursorh,"mouseup",T.onselectionend),T.bind(l,"mousemove",T.onselectiondrag)),T.zoom&&(T.jqbind(T.zoom,"mouseenter",function(){T.canshowonmouseevent&&T.showCursor(),T.rail.active=!0}),T.jqbind(T.zoom,"mouseleave",function(){T.rail.active=!1,T.rail.drag||T.hideCursor()}))),M.enablemousewheel&&(T.isiframe||T.mousewheel(P.isie&&T.ispage?l:T.win,T.onmousewheel),T.mousewheel(T.rail,T.onmousewheel),T.railh&&T.mousewheel(T.railh,T.onmousewheelhr)),T.ispage||P.cantouch||/HTML|^BODY/.test(T.win[0].nodeName)||(T.win.attr("tabindex")||T.win.attr({tabindex:++r}),T.bind(T.win,"focus",function(e){o=T.getTarget(e).id||T.getTarget(e)||!1,T.hasfocus=!0,T.canshowonmouseevent&&T.noticeCursor()}),T.bind(T.win,"blur",function(e){o=!1,T.hasfocus=!1}),T.bind(T.win,"mouseenter",function(e){t=T.getTarget(e).id||T.getTarget(e)||!1,T.hasmousefocus=!0,T.canshowonmouseevent&&T.noticeCursor()}),T.bind(T.win,"mouseleave",function(e){t=!1,T.hasmousefocus=!1,T.rail.drag||T.hideCursor()})),T.onkeypress=function(e){if(T.railslocked&&0===T.page.maxh)return!0;e=e||a.event;var r=T.getTarget(e);if(r&&/INPUT|TEXTAREA|SELECT|OPTION/.test(r.nodeName)&&(!(r.getAttribute("type")||r.type||!1)||!/submit|button|cancel/i.tp))return!0;if(n(r).attr("contenteditable"))return!0;if(T.hasfocus||T.hasmousefocus&&!o||T.ispage&&!o&&!t){var i=e.keyCode;if(T.railslocked&&27!=i)return T.cancelEvent(e);var s=e.ctrlKey||!1,l=e.shiftKey||!1,c=!1;switch(i){case 38:case 63233:T.doScrollBy(72),c=!0;break;case 40:case 63235:T.doScrollBy(-72),c=!0;break;case 37:case 63232:T.railh&&(s?T.doScrollLeft(0):T.doScrollLeftBy(72),c=!0);break;case 39:case 63234:T.railh&&(s?T.doScrollLeft(T.page.maxw):T.doScrollLeftBy(-72),c=!0);break;case 33:case 63276:T.doScrollBy(T.view.h),c=!0;break;case 34:case 63277:T.doScrollBy(-T.view.h),c=!0;break;case 36:case 63273:T.railh&&s?T.doScrollPos(0,0):T.doScrollTo(0),c=!0;break;case 35:case 63275:T.railh&&s?T.doScrollPos(T.page.maxw,T.page.maxh):T.doScrollTo(T.page.maxh),c=!0;break;case 32:M.spacebarenabled&&(l?T.doScrollBy(T.view.h):T.doScrollBy(-T.view.h),c=!0);break;case 27:T.zoomactive&&(T.doZoom(),c=!0)}if(c)return T.cancelEvent(e)}},M.enablekeyboard&&T.bind(l,P.isopera&&!P.isopera12?"keypress":"keydown",T.onkeypress),T.bind(l,"keydown",function(e){(e.ctrlKey||!1)&&(T.wheelprevented=!0)}),T.bind(l,"keyup",function(e){e.ctrlKey||!1||(T.wheelprevented=!1)}),T.bind(a,"blur",function(e){T.wheelprevented=!1}),T.bind(a,"resize",T.onscreenresize),T.bind(a,"orientationchange",T.onscreenresize),T.bind(a,"load",T.lazyResize),P.ischrome&&!T.ispage&&!T.haswrapper){var C=T.win.attr("style"),N=parseFloat(T.win.css("width"))+1;T.win.css("width",N),T.synched("chromefix",function(){T.win.attr("style",C)})}T.onAttributeChange=function(e){T.lazyResize(T.isieold?250:30)},M.enableobserver&&(T.isie11||!1===m||(T.observerbody=new m(function(e){if(e.forEach(function(e){if("attributes"==e.type)return E.hasClass("modal-open")&&E.hasClass("modal-dialog")&&!n.contains(n(".modal-dialog")[0],T.doc[0])?T.hide():T.show()}),T.me.clientWidth!=T.page.width||T.me.clientHeight!=T.page.height)return T.lazyResize(30)}),T.observerbody.observe(l.body,{childList:!0,subtree:!0,characterData:!1,attributes:!0,attributeFilter:["class"]})),T.ispage||T.haswrapper||(!1!==m?(T.observer=new m(function(e){e.forEach(T.onAttributeChange)}),T.observer.observe(T.win[0],{childList:!0,characterData:!1,attributes:!0,subtree:!1}),T.observerremover=new m(function(e){e.forEach(function(e){if(e.removedNodes.length>0)for(var o in e.removedNodes)if(T&&e.removedNodes[o]==T.win[0])return T.remove()})}),T.observerremover.observe(T.win[0].parentNode,{childList:!0,characterData:!1,attributes:!1,subtree:!1})):(T.bind(T.win,P.isie&&!P.isie9?"propertychange":"DOMAttrModified",T.onAttributeChange),P.isie9&&T.win[0].attachEvent("onpropertychange",T.onAttributeChange),T.bind(T.win,"DOMNodeRemoved",function(e){e.target==T.win[0]&&T.remove()})))),!T.ispage&&M.boxzoom&&T.bind(a,"resize",T.resizeZoom),T.istextarea&&(T.bind(T.win,"keydown",T.lazyResize),T.bind(T.win,"mouseup",T.lazyResize)),T.lazyResize(30)}if("IFRAME"==this.doc[0].nodeName){var R=function(){T.iframexd=!1;var o;try{(o="contentDocument"in this?this.contentDocument:this.contentWindow._doc).domain}catch(e){T.iframexd=!0,o=!1}if(T.iframexd)return"console"in a&&console.log("NiceScroll error: policy restriced iframe"),!0;if(T.forcescreen=!0,T.isiframe&&(T.iframe={doc:n(o),html:T.doc.contents().find("html")[0],body:T.doc.contents().find("body")[0]},T.getContentSize=function(){return{w:Math.max(T.iframe.html.scrollWidth,T.iframe.body.scrollWidth),h:Math.max(T.iframe.html.scrollHeight,T.iframe.body.scrollHeight)}},T.docscroll=n(T.iframe.body)),!P.isios&&M.iframeautoresize&&!T.isiframe){T.win.scrollTop(0),T.doc.height("");var t=Math.max(o.getElementsByTagName("html")[0].scrollHeight,o.body.scrollHeight);T.doc.height(t)}T.lazyResize(30),T.css(n(T.iframe.body),e),P.isios&&T.haswrapper&&T.css(n(o.body),{"-webkit-transform":"translate3d(0,0,0)"}),"contentWindow"in this?T.bind(this.contentWindow,"scroll",T.onscroll):T.bind(o,"scroll",T.onscroll),M.enablemousewheel&&T.mousewheel(o,T.onmousewheel),M.enablekeyboard&&T.bind(o,P.isopera?"keypress":"keydown",T.onkeypress),P.cantouch?(T.bind(o,"touchstart",T.ontouchstart),T.bind(o,"touchmove",T.ontouchmove)):M.emulatetouch&&(T.bind(o,"mousedown",T.ontouchstart),T.bind(o,"mousemove",function(e){return T.ontouchmove(e,!0)}),M.grabcursorenabled&&P.cursorgrabvalue&&T.css(n(o.body),{cursor:P.cursorgrabvalue})),T.bind(o,"mouseup",T.ontouchend),T.zoom&&(M.dblclickzoom&&T.bind(o,"dblclick",T.doZoom),T.ongesturezoom&&T.bind(o,"gestureend",T.ongesturezoom))};this.doc[0].readyState&&"complete"===this.doc[0].readyState&&setTimeout(function(){R.call(T.doc[0],!1)},500),T.bind(this.doc,"load",R)}},this.showCursor=function(e,o){if(T.cursortimeout&&(clearTimeout(T.cursortimeout),T.cursortimeout=0),T.rail){if(T.autohidedom&&(T.autohidedom.stop().css({opacity:M.cursoropacitymax}),T.cursoractive=!0),T.rail.drag&&1==T.rail.drag.pt||(void 0!==e&&!1!==e&&(T.scroll.y=e/T.scrollratio.y|0),void 0!==o&&(T.scroll.x=o/T.scrollratio.x|0)),T.cursor.css({height:T.cursorheight,top:T.scroll.y}),T.cursorh){var t=T.hasreversehr?T.scrollvaluemaxw-T.scroll.x:T.scroll.x;T.cursorh.css({width:T.cursorwidth,left:!T.rail.align&&T.rail.visibility?t+T.rail.width:t}),T.cursoractive=!0}T.zoom&&T.zoom.stop().css({opacity:M.cursoropacitymax})}},this.hideCursor=function(e){T.cursortimeout||T.rail&&T.autohidedom&&(T.hasmousefocus&&"leave"===M.autohidemode||(T.cursortimeout=setTimeout(function(){T.rail.active&&T.showonmouseevent||(T.autohidedom.stop().animate({opacity:M.cursoropacitymin}),T.zoom&&T.zoom.stop().animate({opacity:M.cursoropacitymin}),T.cursoractive=!1),T.cursortimeout=0},e||M.hidecursordelay)))},this.noticeCursor=function(e,o,t){T.showCursor(o,t),T.rail.active||T.hideCursor(e)},this.getContentSize=T.ispage?function(){return{w:Math.max(l.body.scrollWidth,l.documentElement.scrollWidth),h:Math.max(l.body.scrollHeight,l.documentElement.scrollHeight)}}:T.haswrapper?function(){return{w:T.doc[0].offsetWidth,h:T.doc[0].offsetHeight}}:function(){return{w:T.docscroll[0].scrollWidth,h:T.docscroll[0].scrollHeight}},this.onResize=function(e,o){if(!T||!T.win)return!1;var t=T.page.maxh,r=T.page.maxw,i={h:T.view.h,w:T.view.w};if(T.view={w:T.ispage?T.win.width():T.win[0].clientWidth,h:T.ispage?T.win.height():T.win[0].clientHeight},T.page=o||T.getContentSize(),T.page.maxh=Math.max(0,T.page.h-T.view.h),T.page.maxw=Math.max(0,T.page.w-T.view.w),T.page.maxh==t&&T.page.maxw==r&&T.view.w==i.w&&T.view.h==i.h){if(T.ispage)return T;var s=T.win.offset();if(T.lastposition){var n=T.lastposition;if(n.top==s.top&&n.left==s.left)return T}T.lastposition=s}return 0===T.page.maxh?(T.hideRail(),T.scrollvaluemax=0,T.scroll.y=0,T.scrollratio.y=0,T.cursorheight=0,T.setScrollTop(0),T.rail&&(T.rail.scrollable=!1)):(T.page.maxh-=M.railpadding.top+M.railpadding.bottom,T.rail.scrollable=!0),0===T.page.maxw?(T.hideRailHr(),T.scrollvaluemaxw=0,T.scroll.x=0,T.scrollratio.x=0,T.cursorwidth=0,T.setScrollLeft(0),T.railh&&(T.railh.scrollable=!1)):(T.page.maxw-=M.railpadding.left+M.railpadding.right,T.railh&&(T.railh.scrollable=M.horizrailenabled)),T.railslocked=T.locked||0===T.page.maxh&&0===T.page.maxw,T.railslocked?(T.ispage||T.updateScrollBar(T.view),!1):(T.hidden||T.visibility?!T.railh||T.hidden||T.railh.visibility||T.showRailHr():T.showRail().showRailHr(),T.istextarea&&T.win.css("resize")&&"none"!=T.win.css("resize")&&(T.view.h-=20),T.cursorheight=Math.min(T.view.h,Math.round(T.view.h*(T.view.h/T.page.h))),T.cursorheight=M.cursorfixedheight?M.cursorfixedheight:Math.max(M.cursorminheight,T.cursorheight),T.cursorwidth=Math.min(T.view.w,Math.round(T.view.w*(T.view.w/T.page.w))),T.cursorwidth=M.cursorfixedheight?M.cursorfixedheight:Math.max(M.cursorminheight,T.cursorwidth),T.scrollvaluemax=T.view.h-T.cursorheight-(M.railpadding.top+M.railpadding.bottom),T.hasborderbox||(T.scrollvaluemax-=T.cursor[0].offsetHeight-T.cursor[0].clientHeight),T.railh&&(T.railh.width=T.page.maxh>0?T.view.w-T.rail.width:T.view.w,T.scrollvaluemaxw=T.railh.width-T.cursorwidth-(M.railpadding.left+M.railpadding.right)),T.ispage||T.updateScrollBar(T.view),T.scrollratio={x:T.page.maxw/T.scrollvaluemaxw,y:T.page.maxh/T.scrollvaluemax},T.getScrollTop()>T.page.maxh?T.doScrollTop(T.page.maxh):(T.scroll.y=T.getScrollTop()/T.scrollratio.y|0,T.scroll.x=T.getScrollLeft()/T.scrollratio.x|0,T.cursoractive&&T.noticeCursor()),T.scroll.y&&0===T.getScrollTop()&&T.doScrollTo(Math.floor(T.scroll.y*T.scrollratio.y)),T)},this.resize=T.onResize;var H=0;this.onscreenresize=function(e){clearTimeout(H);var o=!T.ispage&&!T.haswrapper;o&&T.hideRails(),H=setTimeout(function(){T&&(o&&T.showRails(),T.resize()),H=0},120)},this.lazyResize=function(e){return clearTimeout(H),H=setTimeout(function(){T&&T.resize(),H=0},e||240),T},this.jqbind=function(e,o,t){T.events.push({e:e,n:o,f:t,q:!0}),n(e).on(o,t)},this.mousewheel=function(e,o,t){var r="jquery"in e?e[0]:e;if("onwheel"in l.createElement("div"))T._bind(r,"wheel",o,t||!1);else{var i=void 0!==l.onmousewheel?"mousewheel":"DOMMouseScroll";S(r,i,o,t||!1),"DOMMouseScroll"==i&&S(r,"MozMousePixelScroll",o,t||!1)}};var O=!1;if(P.haseventlistener){try{var Y=Object.defineProperty({},"passive",{get:function(){O=!0}});a.addEventListener("test",null,Y)}catch(e){}this.cancelEvent=function(e){return!!e&&((e=e.original?e.original:e).cancelable&&e.preventDefault(),e.stopPropagation(),e.preventManipulation&&e.preventManipulation(),!1)},this.stopPropagation=function(e){return!!e&&((e=e.original?e.original:e).stopPropagation(),!1)}}else Event.prototype.preventDefault=function(){this.returnValue=!1},Event.prototype.stopPropagation=function(){this.cancelBubble=!0},a.constructor.prototype.addEventListener=l.constructor.prototype.addEventListener=Element.prototype.addEventListener=function(e,o,t){this.attachEvent("on"+e,o)},a.constructor.prototype.removeEventListener=l.constructor.prototype.removeEventListener=Element.prototype.removeEventListener=function(e,o,t){this.detachEvent("on"+e,o)},this.cancelEvent=function(e){return!!(e=e||a.event)&&(e.cancelBubble=!0,e.cancel=!0,e.returnValue=!1,!1)},this.stopPropagation=function(e){return(e=e||a.event)&&(e.cancelBubble=!0),!1};this.delegate=function(e,o,t,r,i){var s=d[o]||!1;s||(s={a:[],l:[],f:function(e){for(var o=s.l,t=!1,r=o.length-1;r>=0;r--)if(!1===(t=o[r].call(e.target,e)))return e.preventDefault(),e.stopImmediatePropagation(),!1;return t}},T.bind(e,o,s.f,r,i),d[o]=s),T.ispage?(s.a=[T.id].concat(s.a),s.l=[t].concat(s.l)):(s.a.push(T.id),s.l.push(t))},this.undelegate=function(e,o,t,r,i){var s=d[o]||!1;if(s)for(var n=0,l=s.l.length;n0)return t;o=!!o.parentNode&&o.parentNode}return!1},this.triggerScrollStart=function(e,o,t,r,i){if(T.onscrollstart){var s={type:"scrollstart",current:{x:e,y:o},request:{x:t,y:r},end:{x:T.newscrollx,y:T.newscrolly},speed:i};T.onscrollstart.call(T,s)}},this.triggerScrollEnd=function(){if(T.onscrollend){var e=T.getScrollLeft(),o=T.getScrollTop(),t={type:"scrollend",current:{x:e,y:o},end:{x:e,y:o}};T.onscrollend.call(T,t)}};var B=0,X=0,D=0,A=1,q=!1;if(this.onmousewheel=function(e){if(!T.wheelprevented){if(T.railslocked)return T.debounced("checkunlock",T.resize,250),!0;if(T.rail.drag)return T.cancelEvent(e);if("auto"===M.oneaxismousemode&&0!==e.deltaX&&(M.oneaxismousemode=!1),M.oneaxismousemode&&0===e.deltaX&&!T.rail.scrollable)return!T.railh||!T.railh.scrollable||T.onmousewheelhr(e);var o=f(),t=!1;if(M.preservenativescrolling&&T.checkarea+600T.page.maxh&&(o=T.page.maxh+(o-T.page.maxh)/2|0),e<0?e=e/2|0:e>T.page.maxw&&(e=T.page.maxw+(o-T.page.maxw)/2|0)):(o<0?o=0:o>T.page.maxh&&(o=T.page.maxh),e<0?e=0:e>T.page.maxw&&(e=T.page.maxw)),T.scrollrunning&&e==T.newscrollx&&o==T.newscrolly)return!1;T.newscrolly=o,T.newscrollx=e;var s=T.getScrollTop(),n=T.getScrollLeft(),l={};l.x=e-n,l.y=o-s;var a=0|Math.sqrt(l.x*l.x+l.y*l.y),c=T.prepareTransition(a);T.scrollrunning||(T.scrollrunning=!0,T.triggerScrollStart(n,s,e,o,c),T.cursorupdate.start()),T.scrollendtrapped=!0,P.transitionend||(T.scrollendtrapped&&clearTimeout(T.scrollendtrapped),T.scrollendtrapped=setTimeout(T.onScrollTransitionEnd,c)),T.setScrollTop(T.newscrolly),T.setScrollLeft(T.newscrollx)},this.cancelScroll=function(){if(!T.scrollendtrapped)return!0;var e=T.getScrollTop(),o=T.getScrollLeft();return T.scrollrunning=!1,P.transitionend||clearTimeout(P.transitionend),T.scrollendtrapped=!1,T.resetTransition(),T.setScrollTop(e),T.railh&&T.setScrollLeft(o),T.timerscroll&&T.timerscroll.tm&&clearInterval(T.timerscroll.tm),T.timerscroll=!1,T.cursorfreezed=!1,T.cursorupdate.stop(),T.showCursor(e,o),T},this.onScrollTransitionEnd=function(){if(T.scrollendtrapped){var e=T.getScrollTop(),o=T.getScrollLeft();if(e<0?e=0:e>T.page.maxh&&(e=T.page.maxh),o<0?o=0:o>T.page.maxw&&(o=T.page.maxw),e!=T.newscrolly||o!=T.newscrollx)return T.doScrollPos(o,e,M.snapbackspeed);T.scrollrunning&&T.triggerScrollEnd(),T.scrollrunning=!1,T.scrollendtrapped=!1,T.resetTransition(),T.timerscroll=!1,T.setScrollTop(e),T.railh&&T.setScrollLeft(o),T.cursorupdate.stop(),T.noticeCursor(!1,e,o),T.cursorfreezed=!1}}}else this.doScrollLeft=function(e,o){var t=T.scrollrunning?T.newscrolly:T.getScrollTop();T.doScrollPos(e,t,o)},this.doScrollTop=function(e,o){var t=T.scrollrunning?T.newscrollx:T.getScrollLeft();T.doScrollPos(t,e,o)},this.doScrollPos=function(e,o,t){var r=T.getScrollTop(),i=T.getScrollLeft();((T.newscrolly-r)*(o-r)<0||(T.newscrollx-i)*(e-i)<0)&&T.cancelScroll();var s=!1;if(T.bouncescroll&&T.rail.visibility||(o<0?(o=0,s=!0):o>T.page.maxh&&(o=T.page.maxh,s=!0)),T.bouncescroll&&T.railh.visibility||(e<0?(e=0,s=!0):e>T.page.maxw&&(e=T.page.maxw,s=!0)),T.scrollrunning&&T.newscrolly===o&&T.newscrollx===e)return!0;T.newscrolly=o,T.newscrollx=e,T.dst={},T.dst.x=e-i,T.dst.y=o-r,T.dst.px=i,T.dst.py=r;var n=0|Math.sqrt(T.dst.x*T.dst.x+T.dst.y*T.dst.y),l=T.getTransitionSpeed(n);T.bzscroll={};var a=s?1:.58;T.bzscroll.x=new R(i,T.newscrollx,l,0,0,a,1),T.bzscroll.y=new R(r,T.newscrolly,l,0,0,a,1);var c=function(){if(T.scrollrunning){var e=T.bzscroll.y.getPos();T.setScrollLeft(T.bzscroll.x.getNow()),T.setScrollTop(T.bzscroll.y.getNow()),e<=1?u(c):(T.scrollrunning=!1,T.timer=0,T.triggerScrollEnd())}};T.scrollrunning||(T.triggerScrollStart(i,r,e,o,l),T.scrollrunning=!0,T.timer=u(c))},this.cancelScroll=function(){return T.timer&&h(T.timer),T.timer=0,T.bzscroll=!1,T.scrollrunning=!1,T};else this.doScrollLeft=function(e,o){var t=T.getScrollTop();T.doScrollPos(e,t,o)},this.doScrollTop=function(e,o){var t=T.getScrollLeft();T.doScrollPos(t,e,o)},this.doScrollPos=function(e,o,t){var r=e>T.page.maxw?T.page.maxw:e;r<0&&(r=0);var i=o>T.page.maxh?T.page.maxh:o;i<0&&(i=0),T.synched("scroll",function(){T.setScrollTop(i),T.setScrollLeft(r)})},this.cancelScroll=function(){};this.doScrollBy=function(e,o){z(0,e)},this.doScrollLeftBy=function(e,o){z(e,0)},this.doScrollTo=function(e,o){var t=o?Math.round(e*T.scrollratio.y):e;t<0?t=0:t>T.page.maxh&&(t=T.page.maxh),T.cursorfreezed=!1,T.doScrollTop(e)},this.checkContentSize=function(){var e=T.getContentSize();e.h==T.page.h&&e.w==T.page.w||T.resize(!1,e)},T.onscroll=function(e){T.rail.drag||T.cursorfreezed||T.synched("scroll",function(){T.scroll.y=Math.round(T.getScrollTop()/T.scrollratio.y),T.railh&&(T.scroll.x=Math.round(T.getScrollLeft()/T.scrollratio.x)),T.noticeCursor()})},T.bind(T.docscroll,"scroll",T.onscroll),this.doZoomIn=function(e){if(!T.zoomactive){T.zoomactive=!0,T.zoomrestore={style:{}};var o=["position","top","left","zIndex","backgroundColor","marginTop","marginBottom","marginLeft","marginRight"],t=T.win[0].style;for(var r in o){var i=o[r];T.zoomrestore.style[i]=void 0!==t[i]?t[i]:""}T.zoomrestore.style.width=T.win.css("width"),T.zoomrestore.style.height=T.win.css("height"),T.zoomrestore.padding={w:T.win.outerWidth()-T.win.width(),h:T.win.outerHeight()-T.win.height()},P.isios4&&(T.zoomrestore.scrollTop=c.scrollTop(),c.scrollTop(0)),T.win.css({position:P.isios4?"absolute":"fixed",top:0,left:0,zIndex:s+100,margin:0});var n=T.win.css("backgroundColor");return(""===n||/transparent|rgba\(0, 0, 0, 0\)|rgba\(0,0,0,0\)/.test(n))&&T.win.css("backgroundColor","#fff"),T.rail.css({zIndex:s+101}),T.zoom.css({zIndex:s+102}),T.zoom.css("backgroundPosition","0 -18px"),T.resizeZoom(),T.onzoomin&&T.onzoomin.call(T),T.cancelEvent(e)}},this.doZoomOut=function(e){if(T.zoomactive)return T.zoomactive=!1,T.win.css("margin",""),T.win.css(T.zoomrestore.style),P.isios4&&c.scrollTop(T.zoomrestore.scrollTop),T.rail.css({"z-index":T.zindex}),T.zoom.css({"z-index":T.zindex}),T.zoomrestore=!1,T.zoom.css("backgroundPosition","0 0"),T.onResize(),T.onzoomout&&T.onzoomout.call(T),T.cancelEvent(e)},this.doZoom=function(e){return T.zoomactive?T.doZoomOut(e):T.doZoomIn(e)},this.resizeZoom=function(){if(T.zoomactive){var e=T.getScrollTop();T.win.css({width:c.width()-T.zoomrestore.padding.w+"px",height:c.height()-T.zoomrestore.padding.h+"px"}),T.onResize(),T.setScrollTop(Math.min(T.page.maxh,e))}},this.init(),n.nicescroll.push(this)},y=function(e){var o=this;this.nc=e,this.lastx=0,this.lasty=0,this.speedx=0,this.speedy=0,this.lasttime=0,this.steptime=0,this.snapx=!1,this.snapy=!1,this.demulx=0,this.demuly=0,this.lastscrollx=-1,this.lastscrolly=-1,this.chkx=0,this.chky=0,this.timer=0,this.reset=function(e,t){o.stop(),o.steptime=0,o.lasttime=f(),o.speedx=0,o.speedy=0,o.lastx=e,o.lasty=t,o.lastscrollx=-1,o.lastscrolly=-1},this.update=function(e,t){var r=f();o.steptime=r-o.lasttime,o.lasttime=r;var i=t-o.lasty,s=e-o.lastx,n=o.nc.getScrollTop()+i,l=o.nc.getScrollLeft()+s;o.snapx=l<0||l>o.nc.page.maxw,o.snapy=n<0||n>o.nc.page.maxh,o.speedx=s,o.speedy=i,o.lastx=e,o.lasty=t},this.stop=function(){o.nc.unsynched("domomentum2d"),o.timer&&clearTimeout(o.timer),o.timer=0,o.lastscrollx=-1,o.lastscrolly=-1},this.doSnapy=function(e,t){var r=!1;t<0?(t=0,r=!0):t>o.nc.page.maxh&&(t=o.nc.page.maxh,r=!0),e<0?(e=0,r=!0):e>o.nc.page.maxw&&(e=o.nc.page.maxw,r=!0),r?o.nc.doScrollPos(e,t,o.nc.opt.snapbackspeed):o.nc.triggerScrollEnd()},this.doMomentum=function(e){var t=f(),r=e?t+e:o.lasttime,i=o.nc.getScrollLeft(),s=o.nc.getScrollTop(),n=o.nc.page.maxh,l=o.nc.page.maxw;o.speedx=l>0?Math.min(60,o.speedx):0,o.speedy=n>0?Math.min(60,o.speedy):0;var a=r&&t-r<=60;(s<0||s>n||i<0||i>l)&&(a=!1);var c=!(!o.speedy||!a)&&o.speedy,d=!(!o.speedx||!a)&&o.speedx;if(c||d){var u=Math.max(16,o.steptime);if(u>50){var h=u/50;o.speedx*=h,o.speedy*=h,u=50}o.demulxy=0,o.lastscrollx=o.nc.getScrollLeft(),o.chkx=o.lastscrollx,o.lastscrolly=o.nc.getScrollTop(),o.chky=o.lastscrolly;var p=o.lastscrollx,m=o.lastscrolly,g=function(){var e=f()-t>600?.04:.02;o.speedx&&(p=Math.floor(o.lastscrollx-o.speedx*(1-o.demulxy)),o.lastscrollx=p,(p<0||p>l)&&(e=.1)),o.speedy&&(m=Math.floor(o.lastscrolly-o.speedy*(1-o.demulxy)),o.lastscrolly=m,(m<0||m>n)&&(e=.1)),o.demulxy=Math.min(1,o.demulxy+e),o.nc.synched("domomentum2d",function(){if(o.speedx){o.nc.getScrollLeft();o.chkx=p,o.nc.setScrollLeft(p)}if(o.speedy){o.nc.getScrollTop();o.chky=m,o.nc.setScrollTop(m)}o.timer||(o.nc.hideCursor(),o.doSnapy(p,m))}),o.demulxy<1?o.timer=setTimeout(g,u):(o.stop(),o.nc.hideCursor(),o.doSnapy(p,m))};g()}else o.doSnapy(o.nc.getScrollLeft(),o.nc.getScrollTop())}},x=e.fn.scrollTop;e.cssHooks.pageYOffset={get:function(e,o,t){var r=n.data(e,"__nicescroll")||!1;return r&&r.ishwscroll?r.getScrollTop():x.call(e)},set:function(e,o){var t=n.data(e,"__nicescroll")||!1;return t&&t.ishwscroll?t.setScrollTop(parseInt(o)):x.call(e,o),this}},e.fn.scrollTop=function(e){if(void 0===e){var o=!!this[0]&&(n.data(this[0],"__nicescroll")||!1);return o&&o.ishwscroll?o.getScrollTop():x.call(this)}return this.each(function(){var o=n.data(this,"__nicescroll")||!1;o&&o.ishwscroll?o.setScrollTop(parseInt(e)):x.call(n(this),e)})};var S=e.fn.scrollLeft;n.cssHooks.pageXOffset={get:function(e,o,t){var r=n.data(e,"__nicescroll")||!1;return r&&r.ishwscroll?r.getScrollLeft():S.call(e)},set:function(e,o){var t=n.data(e,"__nicescroll")||!1;return t&&t.ishwscroll?t.setScrollLeft(parseInt(o)):S.call(e,o),this}},e.fn.scrollLeft=function(e){if(void 0===e){var o=!!this[0]&&(n.data(this[0],"__nicescroll")||!1);return o&&o.ishwscroll?o.getScrollLeft():S.call(this)}return this.each(function(){var o=n.data(this,"__nicescroll")||!1;o&&o.ishwscroll?o.setScrollLeft(parseInt(e)):S.call(n(this),e)})};var z=function(e){var o=this;if(this.length=0,this.name="nicescrollarray",this.each=function(e){return n.each(o,e),o},this.push=function(e){o[o.length]=e,o.length++},this.eq=function(e){return o[e]},e)for(var t=0;t1?n(e,r):s,i.win=r}!("doc"in i)||"win"in i||(i.win=r);var l=r.data("__nicescroll")||!1;l||(i.doc=i.doc||r,l=new b(i,r),r.data("__nicescroll",l)),t.push(l)}),1===t.length?t[0]:t},a.NiceScroll={getjQuery:function(){return e}},n.nicescroll||(n.nicescroll=new z,n.nicescroll.options=g)}); \ No newline at end of file +/* nicescroll v3.7.4-g [DEV REL] InuYaksa - MIT - https://nicescroll.areaaperta.com */ +!function(e){"function"==typeof define&&define.amd?define(["jquery"],e):"object"==typeof exports?module.exports=e(require("jquery")):e(jQuery)}(function(e){"use strict";var o=!1,t=!1,r=0,i=2e3,s=0,n=e,l=document,a=window,c=n(a),d=[],u=a.requestAnimationFrame||a.webkitRequestAnimationFrame||a.mozRequestAnimationFrame||!1,h=a.cancelAnimationFrame||a.webkitCancelAnimationFrame||a.mozCancelAnimationFrame||!1;if(u)a.cancelAnimationFrame||(h=function(e){});else{var p=0;u=function(e,o){var t=(new Date).getTime(),r=Math.max(0,16-(t-p)),i=a.setTimeout(function(){e(t+r)},r);return p=t+r,i},h=function(e){a.clearTimeout(e)}}var m=a.MutationObserver||a.WebKitMutationObserver||!1,f=Date.now||function(){return(new Date).getTime()},g={zindex:"auto",cursoropacitymin:0,cursoropacitymax:1,cursorcolor:"#424242",cursorwidth:"6px",cursorborder:"1px solid #fff",cursorborderradius:"5px",scrollspeed:40,mousescrollstep:27,touchbehavior:!1,emulatetouch:!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 e=l.currentScript||function(){var e=l.getElementsByTagName("script");return!!e.length&&e[e.length-1]}(),o=e?e.src.split("?")[0]:"";return o.split("/").length>0?o.split("/").slice(0,-1).join("/")+"/":""}(),preventmultitouchscrolling:!0,disablemutationobserver:!1,enableobserver:!0,scrollbarid:!1},v=!1,w=function(){if(v)return v;var e=l.createElement("DIV"),o=e.style,t=navigator.userAgent,r=navigator.platform,i={};return i.haspointerlock="pointerLockElement"in l||"webkitPointerLockElement"in l||"mozPointerLockElement"in l,i.isopera="opera"in a,i.isopera12=i.isopera&&"getUserMedia"in navigator,i.isoperamini="[object OperaMini]"===Object.prototype.toString.call(a.operamini),i.isie="all"in l&&"attachEvent"in e&&!i.isopera,i.isieold=i.isie&&!("msInterpolationMode"in o),i.isie7=i.isie&&!i.isieold&&(!("documentMode"in l)||7===l.documentMode),i.isie8=i.isie&&"documentMode"in l&&8===l.documentMode,i.isie9=i.isie&&"performance"in a&&9===l.documentMode,i.isie10=i.isie&&"performance"in a&&10===l.documentMode,i.isie11="msRequestFullscreen"in e&&l.documentMode>=11,i.ismsedge="msCredentials"in a,i.ismozilla="MozAppearance"in o,i.iswebkit=!i.ismsedge&&"WebkitAppearance"in o,i.ischrome=i.iswebkit&&"chrome"in a,i.ischrome38=i.ischrome&&"touchAction"in o,i.ischrome22=!i.ischrome38&&i.ischrome&&i.haspointerlock,i.ischrome26=!i.ischrome38&&i.ischrome&&"transition"in o,i.cantouch="ontouchstart"in l.documentElement||"ontouchstart"in a,i.hasw3ctouch=(a.PointerEvent||!1)&&(navigator.MaxTouchPoints>0||navigator.msMaxTouchPoints>0),i.hasmstouch=!i.hasw3ctouch&&(a.MSPointerEvent||!1),i.ismac=/^mac$/i.test(r),i.isios=i.cantouch&&/iphone|ipad|ipod/i.test(r),i.isios4=i.isios&&!("seal"in Object),i.isios7=i.isios&&"webkitHidden"in l,i.isios8=i.isios&&"hidden"in l,i.isios10=i.isios&&a.Proxy,i.isandroid=/android/i.test(t),i.haseventlistener="addEventListener"in e,i.trstyle=!1,i.hastransform=!1,i.hastranslate3d=!1,i.transitionstyle=!1,i.hastransition=!1,i.transitionend=!1,i.trstyle="transform",i.hastransform="transform"in o||function(){for(var e=["msTransform","webkitTransform","MozTransform","OTransform"],t=0,r=e.length;t0;){if(9==e[0].nodeType)return!1;var o=e.css("zIndex");if(!isNaN(o)&&0!==o)return parseInt(o);e=e.parent()}return!1}function x(e,o,t){var r=e.css(o),i=parseFloat(r);if(isNaN(i)){var s=3==(i=I[r]||0)?t?T.win.outerHeight()-T.win.innerHeight():T.win.outerWidth()-T.win.innerWidth():1;return T.isie8&&i&&(i+=1),s?i:0}return i}function S(e,o,t,r){T._bind(e,o,function(r){var i={original:r=r||a.event,target:r.target||r.srcElement,type:"wheel",deltaMode:"MozMousePixelScroll"==r.type?0:1,deltaX:0,deltaZ:0,preventDefault:function(){return r.preventDefault?r.preventDefault():r.returnValue=!1,!1},stopImmediatePropagation:function(){r.stopImmediatePropagation?r.stopImmediatePropagation():r.cancelBubble=!0}};return"mousewheel"==o?(r.wheelDeltaX&&(i.deltaX=-.025*r.wheelDeltaX),r.wheelDeltaY&&(i.deltaY=-.025*r.wheelDeltaY),!i.deltaY&&!i.deltaX&&(i.deltaY=-.025*r.wheelDelta)):i.deltaY=r.detail,t.call(e,i)},r)}function z(e,o,t,r){T.scrollrunning||(T.newscrolly=T.getScrollTop(),T.newscrollx=T.getScrollLeft(),D=f());var i=f()-D;if(D=f(),i>350?A=1:A+=(2-A)/10,e=e*A|0,o=o*A|0,e){if(r)if(e<0){if(T.getScrollLeft()>=T.page.maxw)return!0}else if(T.getScrollLeft()<=0)return!0;var s=e>0?1:-1;X!==s&&(T.scrollmom&&T.scrollmom.stop(),T.newscrollx=T.getScrollLeft(),X=s),T.lastdeltax-=e}if(o){if(function(){var e=T.getScrollTop();if(o<0){if(e>=T.page.maxh)return!0}else if(e<=0)return!0}()){if(M.nativeparentscrolling&&t&&!T.ispage&&!T.zoomactive)return!0;var n=T.view.h>>1;T.newscrolly<-n?(T.newscrolly=-n,o=-1):T.newscrolly>T.page.maxh+n?(T.newscrolly=T.page.maxh+n,o=1):o=0}var l=o>0?1:-1;B!==l&&(T.scrollmom&&T.scrollmom.stop(),T.newscrolly=T.getScrollTop(),B=l),T.lastdeltay-=o}(o||e)&&T.synched("relativexy",function(){var e=T.lastdeltay+T.newscrolly;T.lastdeltay=0;var o=T.lastdeltax+T.newscrollx;T.lastdeltax=0,T.rail.drag||T.doScrollPos(o,e)})}function k(e,o,t){var r,i;return!(t||!q)||(0===e.deltaMode?(r=-e.deltaX*(M.mousescrollstep/54)|0,i=-e.deltaY*(M.mousescrollstep/54)|0):1===e.deltaMode&&(r=-e.deltaX*M.mousescrollstep*50/80|0,i=-e.deltaY*M.mousescrollstep*50/80|0),o&&M.oneaxismousemode&&0===r&&i&&(r=i,i=0,t&&(r<0?T.getScrollLeft()>=T.page.maxw:T.getScrollLeft()<=0)&&(i=r,r=0)),T.isrtlmode&&(r=-r),z(r,i,t,!0)?void(t&&(q=!0)):(q=!1,e.stopImmediatePropagation(),e.preventDefault()))}var T=this;this.version="3.7.4-g",this.name="nicescroll",this.me=p;var E=n("body"),M=this.opt={doc:E,win:!1};if(n.extend(M,g),M.snapbackspeed=80,e)for(var L in M)void 0!==e[L]&&(M[L]=e[L]);if(M.disablemutationobserver&&(m=!1),this.doc=M.doc,this.iddoc=this.doc&&this.doc[0]?this.doc[0].id||"":"",this.ispage=/^BODY|HTML/.test(M.win?M.win[0].nodeName:this.doc[0].nodeName),this.haswrapper=!1!==M.win,this.win=M.win||(this.ispage?c:this.doc),this.docscroll=this.ispage&&!this.haswrapper?c:this.win,this.body=E,this.viewport=!1,this.isfixed=!1,this.iframe=!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"!=M.autohidemode,this.onmousedown=!1,this.onmouseup=!1,this.onmousemove=!1,this.onmousewheel=!1,this.onkeypress=!1,this.ongesturezoom=!1,this.onclick=!1,this.onscrollstart=!1,this.onscrollend=!1,this.onscrollcancel=!1,this.onzoomin=!1,this.onzoomout=!1,this.view=!1,this.page=!1,this.scroll={x:0,y:0},this.scrollratio={x:0,y:0},this.cursorheight=20,this.scrollvaluemax=0,"auto"==M.rtlmode){var C=this.win[0]==a?this.body:this.win,P=C.css("writing-mode")||C.css("-webkit-writing-mode")||C.css("-ms-writing-mode")||C.css("-moz-writing-mode");"horizontal-tb"==P||"lr-tb"==P||""===P?(this.isrtlmode="rtl"==C.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===M.rtlmode,this.isvertical=!1;if(this.scrollrunning=!1,this.scrollmom=!1,this.observer=!1,this.observerremover=!1,this.observerbody=!1,!1!==M.scrollbarid)this.id=M.scrollbarid;else do{this.id="ascrail"+i++}while(l.getElementById(this.id));this.rail=!1,this.cursor=!1,this.cursorfreezed=!1,this.selectiondrag=!1,this.zoom=!1,this.zoomactive=!1,this.hasfocus=!1,this.hasmousefocus=!1,this.visibility=!0,this.railslocked=!1,this.locked=!1,this.hidden=!1,this.cursoractive=!0,this.wheelprevented=!1,this.overflowx=M.overflowx,this.overflowy=M.overflowy,this.nativescrollingarea=!1,this.checkarea=0,this.events=[],this.saved={},this.delaylist={},this.synclist={},this.lastdeltax=0,this.lastdeltay=0,this.detected=w();var N=n.extend({},this.detected);this.canhwscroll=N.hastransform&&M.hwacceleration,this.ishwscroll=this.canhwscroll&&T.haswrapper,this.isrtlmode?this.isvertical?this.hasreversehr=!(N.iswebkit||N.isie||N.isie11):this.hasreversehr=!(N.iswebkit||N.isie&&!N.isie10&&!N.isie11):this.hasreversehr=!1,this.istouchcapable=!1,N.cantouch||!N.hasw3ctouch&&!N.hasmstouch?!N.cantouch||N.isios||N.isandroid||!N.iswebkit&&!N.ismozilla||(this.istouchcapable=!0):this.istouchcapable=!0,M.enablemouselockapi||(N.hasmousecapture=!1,N.haspointerlock=!1),this.debounced=function(e,o,t){T&&(T.delaylist[e]||!1||(T.delaylist[e]={h:u(function(){T.delaylist[e].fn.call(T),T.delaylist[e]=!1},t)},o.call(T)),T.delaylist[e].fn=o)},this.synched=function(e,o){T.synclist[e]?T.synclist[e]=o:(T.synclist[e]=o,u(function(){T&&(T.synclist[e]&&T.synclist[e].call(T),T.synclist[e]=null)}))},this.unsynched=function(e){T.synclist[e]&&(T.synclist[e]=!1)},this.css=function(e,o){for(var t in o)T.saved.css.push([e,t,e.css(t)]),e.css(t,o[t])},this.scrollTop=function(e){return void 0===e?T.getScrollTop():T.setScrollTop(e)},this.scrollLeft=function(e){return void 0===e?T.getScrollLeft():T.setScrollLeft(e)};var R=function(e,o,t,r,i,s,n){this.st=e,this.ed=o,this.spd=t,this.p1=r||0,this.p2=i||1,this.p3=s||0,this.p4=n||1,this.ts=f(),this.df=o-e};if(R.prototype={B2:function(e){return 3*(1-e)*(1-e)*e},B3:function(e){return 3*(1-e)*e*e},B4:function(e){return e*e*e},getPos:function(){return(f()-this.ts)/this.spd},getNow:function(){var e=(f()-this.ts)/this.spd,o=this.B2(e)+this.B3(e)+this.B4(e);return e>=1?this.ed:this.st+this.df*o|0},update:function(e,o){return this.st=this.getNow(),this.ed=e,this.spd=o,this.ts=f(),this.df=this.ed-this.st,this}},this.ishwscroll){this.doc.translate={x:0,y:0,tx:"0px",ty:"0px"},N.hastranslate3d&&N.isios&&this.doc.css("-webkit-backface-visibility","hidden"),this.getScrollTop=function(e){if(!e){var o=v();if(o)return 16==o.length?-o[13]:-o[5];if(T.timerscroll&&T.timerscroll.bz)return T.timerscroll.bz.getNow()}return T.doc.translate.y},this.getScrollLeft=function(e){if(!e){var o=v();if(o)return 16==o.length?-o[12]:-o[4];if(T.timerscroll&&T.timerscroll.bh)return T.timerscroll.bh.getNow()}return T.doc.translate.x},this.notifyScrollEvent=function(e){var o=l.createEvent("UIEvents");o.initUIEvent("scroll",!1,!0,a,1),o.niceevent=!0,e.dispatchEvent(o)};var _=this.isrtlmode?1:-1;N.hastranslate3d&&M.enabletranslate3d?(this.setScrollTop=function(e,o){T.doc.translate.y=e,T.doc.translate.ty=-1*e+"px",T.doc.css(N.trstyle,"translate3d("+T.doc.translate.tx+","+T.doc.translate.ty+",0)"),o||T.notifyScrollEvent(T.win[0])},this.setScrollLeft=function(e,o){T.doc.translate.x=e,T.doc.translate.tx=e*_+"px",T.doc.css(N.trstyle,"translate3d("+T.doc.translate.tx+","+T.doc.translate.ty+",0)"),o||T.notifyScrollEvent(T.win[0])}):(this.setScrollTop=function(e,o){T.doc.translate.y=e,T.doc.translate.ty=-1*e+"px",T.doc.css(N.trstyle,"translate("+T.doc.translate.tx+","+T.doc.translate.ty+")"),o||T.notifyScrollEvent(T.win[0])},this.setScrollLeft=function(e,o){T.doc.translate.x=e,T.doc.translate.tx=e*_+"px",T.doc.css(N.trstyle,"translate("+T.doc.translate.tx+","+T.doc.translate.ty+")"),o||T.notifyScrollEvent(T.win[0])})}else this.getScrollTop=function(){return T.docscroll.scrollTop()},this.setScrollTop=function(e){T.docscroll.scrollTop(e)},this.getScrollLeft=function(){return T.hasreversehr?T.detected.ismozilla?T.page.maxw-Math.abs(T.docscroll.scrollLeft()):T.page.maxw-T.docscroll.scrollLeft():T.docscroll.scrollLeft()},this.setScrollLeft=function(e){return setTimeout(function(){if(T)return T.hasreversehr&&(e=T.detected.ismozilla?-(T.page.maxw-e):T.page.maxw-e),T.docscroll.scrollLeft(e)},1)};this.getTarget=function(e){return!!e&&(e.target?e.target:!!e.srcElement&&e.srcElement)},this.hasParent=function(e,o){if(!e)return!1;for(var t=e.target||e.srcElement||e||!1;t&&t.id!=o;)t=t.parentNode||!1;return!1!==t};var I={thin:1,medium:3,thick:5};this.getDocumentScrollOffset=function(){return{top:a.pageYOffset||l.documentElement.scrollTop,left:a.pageXOffset||l.documentElement.scrollLeft}},this.getOffset=function(){if(T.isfixed){var e=T.win.offset(),o=T.getDocumentScrollOffset();return e.top-=o.top,e.left-=o.left,e}var t=T.win.offset();if(!T.viewport)return t;var r=T.viewport.offset();return{top:t.top-r.top,left:t.left-r.left}},this.updateScrollBar=function(e){var o,t;if(T.ishwscroll)T.rail.css({height:T.win.innerHeight()-(M.railpadding.top+M.railpadding.bottom)}),T.railh&&T.railh.css({width:T.win.innerWidth()-(M.railpadding.left+M.railpadding.right)});else{var r=T.getOffset();if(o={top:r.top,left:r.left-(M.railpadding.left+M.railpadding.right)},o.top+=x(T.win,"border-top-width",!0),o.left+=T.rail.align?T.win.outerWidth()-x(T.win,"border-right-width")-T.rail.width:x(T.win,"border-left-width"),(t=M.railoffset)&&(t.top&&(o.top+=t.top),t.left&&(o.left+=t.left)),T.railslocked||T.rail.css({top:o.top,left:o.left,height:(e?e.h:T.win.innerHeight())-(M.railpadding.top+M.railpadding.bottom)}),T.zoom&&T.zoom.css({top:o.top+1,left:1==T.rail.align?o.left-20:o.left+T.rail.width+4}),T.railh&&!T.railslocked){o={top:r.top,left:r.left},(t=M.railhoffset)&&(t.top&&(o.top+=t.top),t.left&&(o.left+=t.left));var i=T.railh.align?o.top+x(T.win,"border-top-width",!0)+T.win.innerHeight()-T.railh.height:o.top+x(T.win,"border-top-width",!0),s=o.left+x(T.win,"border-left-width");T.railh.css({top:i-(M.railpadding.top+M.railpadding.bottom),left:s,width:T.railh.width})}}},this.doRailClick=function(e,o,t){var r,i,s,n;T.railslocked||(T.cancelEvent(e),"pageY"in e||(e.pageX=e.clientX+l.documentElement.scrollLeft,e.pageY=e.clientY+l.documentElement.scrollTop),o?(r=t?T.doScrollLeft:T.doScrollTop)(s=t?(e.pageX-T.railh.offset().left-T.cursorwidth/2)*T.scrollratio.x:(e.pageY-T.rail.offset().top-T.cursorheight/2)*T.scrollratio.y):(r=t?T.doScrollLeftBy:T.doScrollBy,s=t?T.scroll.x:T.scroll.y,n=t?e.pageX-T.railh.offset().left:e.pageY-T.rail.offset().top,i=t?T.view.w:T.view.h,r(s>=n?i:-i)))},T.newscrolly=T.newscrollx=0,T.hasanimationframe="requestAnimationFrame"in a,T.hascancelanimationframe="cancelAnimationFrame"in a,T.hasborderbox=!1,this.init=function(){if(T.saved.css=[],N.isoperamini)return!0;if(N.isandroid&&!("hidden"in l))return!0;M.emulatetouch=M.emulatetouch||M.touchbehavior,T.hasborderbox=a.getComputedStyle&&"border-box"===a.getComputedStyle(l.body)["box-sizing"];var e={"overflow-y":"hidden"};if((N.isie11||N.isie10)&&(e["-ms-overflow-style"]="none"),T.ishwscroll&&(this.doc.css(N.transitionstyle,N.prefixstyle+"transform 0ms ease-out"),N.transitionend&&T.bind(T.doc,N.transitionend,T.onScrollTransitionEnd,!1)),T.zindex="auto",T.ispage||"auto"!=M.zindex?T.zindex=M.zindex:T.zindex=b()||"auto",!T.ispage&&"auto"!=T.zindex&&T.zindex>s&&(s=T.zindex),T.isie&&0===T.zindex&&"auto"==M.zindex&&(T.zindex="auto"),!T.ispage||!N.isieold){var i=T.docscroll;T.ispage&&(i=T.haswrapper?T.win:T.doc),T.css(i,e),T.ispage&&(N.isie11||N.isie)&&T.css(n("html"),e),!N.isios||T.ispage||T.haswrapper||T.css(E,{"-webkit-overflow-scrolling":"touch"});var d=n(l.createElement("div"));d.css({position:"relative",top:0,float:"right",width:M.cursorwidth,height:0,"background-color":M.cursorcolor,border:M.cursorborder,"background-clip":"padding-box","-webkit-border-radius":M.cursorborderradius,"-moz-border-radius":M.cursorborderradius,"border-radius":M.cursorborderradius}),d.addClass("nicescroll-cursors"),T.cursor=d;var u=n(l.createElement("div"));u.attr("id",T.id),u.addClass("nicescroll-rails nicescroll-rails-vr");var h,p,f=["left","right","top","bottom"];for(var g in f)p=f[g],(h=M.railpadding[p]||0)&&u.css("padding-"+p,h+"px");u.append(d),u.width=Math.max(parseFloat(M.cursorwidth),d.outerWidth()),u.css({width:u.width+"px",zIndex:T.zindex,background:M.background,cursor:"default"}),u.visibility=!0,u.scrollable=!0,u.align="left"==M.railalign?0:1,T.rail=u,T.rail.drag=!1;var v=!1;!M.boxzoom||T.ispage||N.isieold||(v=l.createElement("div"),T.bind(v,"click",T.doZoom),T.bind(v,"mouseenter",function(){T.zoom.css("opacity",M.cursoropacitymax)}),T.bind(v,"mouseleave",function(){T.zoom.css("opacity",M.cursoropacitymin)}),T.zoom=n(v),T.zoom.css({cursor:"pointer",zIndex:T.zindex,backgroundImage:"url("+M.scriptpath+"zoomico.png)",height:18,width:18,backgroundPosition:"0 0"}),M.dblclickzoom&&T.bind(T.win,"dblclick",T.doZoom),N.cantouch&&M.gesturezoom&&(T.ongesturezoom=function(e){return e.scale>1.5&&T.doZoomIn(e),e.scale<.8&&T.doZoomOut(e),T.cancelEvent(e)},T.bind(T.win,"gestureend",T.ongesturezoom))),T.railh=!1;var w;if(M.horizrailenabled&&(T.css(i,{overflowX:"hidden"}),(d=n(l.createElement("div"))).css({position:"absolute",top:0,height:M.cursorwidth,width:0,backgroundColor:M.cursorcolor,border:M.cursorborder,backgroundClip:"padding-box","-webkit-border-radius":M.cursorborderradius,"-moz-border-radius":M.cursorborderradius,"border-radius":M.cursorborderradius}),N.isieold&&d.css("overflow","hidden"),d.addClass("nicescroll-cursors"),T.cursorh=d,(w=n(l.createElement("div"))).attr("id",T.id+"-hr"),w.addClass("nicescroll-rails nicescroll-rails-hr"),w.height=Math.max(parseFloat(M.cursorwidth),d.outerHeight()),w.css({height:w.height+"px",zIndex:T.zindex,background:M.background}),w.append(d),w.visibility=!0,w.scrollable=!0,w.align="top"==M.railvalign?0:1,T.railh=w,T.railh.drag=!1),T.ispage)u.css({position:"fixed",top:0,height:"100%"}),u.css(u.align?{right:0}:{left:0}),T.body.append(u),T.railh&&(w.css({position:"fixed",left:0,width:"100%"}),w.css(w.align?{bottom:0}:{top:0}),T.body.append(w));else{if(T.ishwscroll){"static"==T.win.css("position")&&T.css(T.win,{position:"relative"});var x="HTML"==T.win[0].nodeName?T.body:T.win;n(x).scrollTop(0).scrollLeft(0),T.zoom&&(T.zoom.css({position:"absolute",top:1,right:0,"margin-right":u.width+4}),x.append(T.zoom)),u.css({position:"absolute",top:0}),u.css(u.align?{right:0}:{left:0}),x.append(u),w&&(w.css({position:"absolute",left:0,bottom:0}),w.css(w.align?{bottom:0}:{top:0}),x.append(w))}else{T.isfixed="fixed"==T.win.css("position");var S=T.isfixed?"fixed":"absolute";T.isfixed||(T.viewport=T.getViewport(T.win[0])),T.viewport&&(T.body=T.viewport,/fixed|absolute/.test(T.viewport.css("position"))||T.css(T.viewport,{position:"relative"})),u.css({position:S}),T.zoom&&T.zoom.css({position:S}),T.updateScrollBar(),T.body.append(u),T.zoom&&T.body.append(T.zoom),T.railh&&(w.css({position:S}),T.body.append(w))}N.isios&&T.css(T.win,{"-webkit-tap-highlight-color":"rgba(0,0,0,0)","-webkit-touch-callout":"none"}),M.disableoutline&&(N.isie&&T.win.attr("hideFocus","true"),N.iswebkit&&T.win.css("outline","none"))}if(!1===M.autohidemode?(T.autohidedom=!1,T.rail.css({opacity:M.cursoropacitymax}),T.railh&&T.railh.css({opacity:M.cursoropacitymax})):!0===M.autohidemode||"leave"===M.autohidemode?(T.autohidedom=n().add(T.rail),N.isie8&&(T.autohidedom=T.autohidedom.add(T.cursor)),T.railh&&(T.autohidedom=T.autohidedom.add(T.railh)),T.railh&&N.isie8&&(T.autohidedom=T.autohidedom.add(T.cursorh))):"scroll"==M.autohidemode?(T.autohidedom=n().add(T.rail),T.railh&&(T.autohidedom=T.autohidedom.add(T.railh))):"cursor"==M.autohidemode?(T.autohidedom=n().add(T.cursor),T.railh&&(T.autohidedom=T.autohidedom.add(T.cursorh))):"hidden"==M.autohidemode&&(T.autohidedom=!1,T.hide(),T.railslocked=!1),N.cantouch||T.istouchcapable||M.emulatetouch||N.hasmstouch){T.scrollmom=new y(T);T.ontouchstart=function(e){if(T.locked)return!1;if(e.pointerType&&("mouse"===e.pointerType||e.pointerType===e.MSPOINTER_TYPE_MOUSE))return!1;if(T.hasmoving=!1,T.scrollmom.timer&&(T.triggerScrollEnd(),T.scrollmom.stop()),!T.railslocked){var o=T.getTarget(e);if(o&&/INPUT/i.test(o.nodeName)&&/range/i.test(o.type))return T.stopPropagation(e);var t="mousedown"===e.type;if(!("clientX"in e)&&"changedTouches"in e&&(e.clientX=e.changedTouches[0].clientX,e.clientY=e.changedTouches[0].clientY),T.forcescreen){var r=e;(e={original:e.original?e.original:e}).clientX=r.screenX,e.clientY=r.screenY}if(T.rail.drag={x:e.clientX,y:e.clientY,sx:T.scroll.x,sy:T.scroll.y,st:T.getScrollTop(),sl:T.getScrollLeft(),pt:2,dl:!1,tg:o},T.ispage||!M.directionlockdeadzone)T.rail.drag.dl="f";else{var i={w:c.width(),h:c.height()},s=T.getContentSize(),l=s.h-i.h,a=s.w-i.w;T.rail.scrollable&&!T.railh.scrollable?T.rail.drag.ck=l>0&&"v":!T.rail.scrollable&&T.railh.scrollable?T.rail.drag.ck=a>0&&"h":T.rail.drag.ck=!1}if(M.emulatetouch&&T.isiframe&&N.isie){var d=T.win.position();T.rail.drag.x+=d.left,T.rail.drag.y+=d.top}if(T.hasmoving=!1,T.lastmouseup=!1,T.scrollmom.reset(e.clientX,e.clientY),o&&t){if(!/INPUT|SELECT|BUTTON|TEXTAREA/i.test(o.nodeName))return N.hasmousecapture&&o.setCapture(),M.emulatetouch?(o.onclick&&!o._onclick&&(o._onclick=o.onclick,o.onclick=function(e){if(T.hasmoving)return!1;o._onclick.call(this,e)}),T.cancelEvent(e)):T.stopPropagation(e);/SUBMIT|CANCEL|BUTTON/i.test(n(o).attr("type"))&&(T.preventclick={tg:o,click:!1})}}},T.ontouchend=function(e){if(!T.rail.drag)return!0;if(2==T.rail.drag.pt){if(e.pointerType&&("mouse"===e.pointerType||e.pointerType===e.MSPOINTER_TYPE_MOUSE))return!1;T.rail.drag=!1;var o="mouseup"===e.type;if(T.hasmoving&&(T.scrollmom.doMomentum(),T.lastmouseup=!0,T.hideCursor(),N.hasmousecapture&&l.releaseCapture(),o))return T.cancelEvent(e)}else if(1==T.rail.drag.pt)return T.onmouseup(e)};var z=M.emulatetouch&&T.isiframe&&!N.hasmousecapture,k=.3*M.directionlockdeadzone|0;T.ontouchmove=function(e,o){if(!T.rail.drag)return!0;if(e.targetTouches&&M.preventmultitouchscrolling&&e.targetTouches.length>1)return!0;if(e.pointerType&&("mouse"===e.pointerType||e.pointerType===e.MSPOINTER_TYPE_MOUSE))return!0;if(2==T.rail.drag.pt){"changedTouches"in e&&(e.clientX=e.changedTouches[0].clientX,e.clientY=e.changedTouches[0].clientY);var t,r;if(r=t=0,z&&!o){var i=T.win.position();r=-i.left,t=-i.top}var s=e.clientY+t,n=s-T.rail.drag.y,a=e.clientX+r,c=a-T.rail.drag.x,d=T.rail.drag.st-n;if(T.ishwscroll&&M.bouncescroll)d<0?d=Math.round(d/2):d>T.page.maxh&&(d=T.page.maxh+Math.round((d-T.page.maxh)/2));else if(d<0?(d=0,s=0):d>T.page.maxh&&(d=T.page.maxh,s=0),0===s&&!T.hasmoving)return T.ispage||(T.rail.drag=!1),!0;var u=T.getScrollLeft();if(T.railh&&T.railh.scrollable&&(u=T.isrtlmode?c-T.rail.drag.sl:T.rail.drag.sl-c,T.ishwscroll&&M.bouncescroll?u<0?u=Math.round(u/2):u>T.page.maxw&&(u=T.page.maxw+Math.round((u-T.page.maxw)/2)):(u<0&&(u=0,a=0),u>T.page.maxw&&(u=T.page.maxw,a=0))),!T.hasmoving){if(T.rail.drag.y===e.clientY&&T.rail.drag.x===e.clientX)return T.cancelEvent(e);var h=Math.abs(n),p=Math.abs(c),m=M.directionlockdeadzone;if(T.rail.drag.ck?"v"==T.rail.drag.ck?p>m&&h<=k?T.rail.drag=!1:h>m&&(T.rail.drag.dl="v"):"h"==T.rail.drag.ck&&(h>m&&p<=k?T.rail.drag=!1:p>m&&(T.rail.drag.dl="h")):h>m&&p>m?T.rail.drag.dl="f":h>m?T.rail.drag.dl=p>k?"f":"v":p>m&&(T.rail.drag.dl=h>k?"f":"h"),!T.rail.drag.dl)return T.cancelEvent(e);T.triggerScrollStart(e.clientX,e.clientY,0,0,0),T.hasmoving=!0}return T.preventclick&&!T.preventclick.click&&(T.preventclick.click=T.preventclick.tg.onclick||!1,T.preventclick.tg.onclick=T.onpreventclick),T.rail.drag.dl&&("v"==T.rail.drag.dl?u=T.rail.drag.sl:"h"==T.rail.drag.dl&&(d=T.rail.drag.st)),T.synched("touchmove",function(){T.rail.drag&&2==T.rail.drag.pt&&(T.prepareTransition&&T.resetTransition(),T.rail.scrollable&&T.setScrollTop(d),T.scrollmom.update(a,s),T.railh&&T.railh.scrollable?(T.setScrollLeft(u),T.showCursor(d,u)):T.showCursor(d),N.isie10&&l.selection.clear())}),T.cancelEvent(e)}return 1==T.rail.drag.pt?T.onmousemove(e):void 0},T.ontouchstartCursor=function(e,o){if(!T.rail.drag||3==T.rail.drag.pt){if(T.locked)return T.cancelEvent(e);T.cancelScroll(),T.rail.drag={x:e.touches[0].clientX,y:e.touches[0].clientY,sx:T.scroll.x,sy:T.scroll.y,pt:3,hr:!!o};var t=T.getTarget(e);return!T.ispage&&N.hasmousecapture&&t.setCapture(),T.isiframe&&!N.hasmousecapture&&(T.saved.csspointerevents=T.doc.css("pointer-events"),T.css(T.doc,{"pointer-events":"none"})),T.cancelEvent(e)}},T.ontouchendCursor=function(e){if(T.rail.drag){if(N.hasmousecapture&&l.releaseCapture(),T.isiframe&&!N.hasmousecapture&&T.doc.css("pointer-events",T.saved.csspointerevents),3!=T.rail.drag.pt)return;return T.rail.drag=!1,T.cancelEvent(e)}},T.ontouchmoveCursor=function(e){if(T.rail.drag){if(3!=T.rail.drag.pt)return;if(T.cursorfreezed=!0,T.rail.drag.hr){T.scroll.x=T.rail.drag.sx+(e.touches[0].clientX-T.rail.drag.x),T.scroll.x<0&&(T.scroll.x=0);var o=T.scrollvaluemaxw;T.scroll.x>o&&(T.scroll.x=o)}else{T.scroll.y=T.rail.drag.sy+(e.touches[0].clientY-T.rail.drag.y),T.scroll.y<0&&(T.scroll.y=0);var t=T.scrollvaluemax;T.scroll.y>t&&(T.scroll.y=t)}return T.synched("touchmove",function(){T.rail.drag&&3==T.rail.drag.pt&&(T.showCursor(),T.rail.drag.hr?T.doScrollLeft(Math.round(T.scroll.x*T.scrollratio.x),M.cursordragspeed):T.doScrollTop(Math.round(T.scroll.y*T.scrollratio.y),M.cursordragspeed))}),T.cancelEvent(e)}}}if(T.onmousedown=function(e,o){if(!T.rail.drag||1==T.rail.drag.pt){if(T.railslocked)return T.cancelEvent(e);T.cancelScroll(),T.rail.drag={x:e.clientX,y:e.clientY,sx:T.scroll.x,sy:T.scroll.y,pt:1,hr:o||!1};var t=T.getTarget(e);return N.hasmousecapture&&t.setCapture(),T.isiframe&&!N.hasmousecapture&&(T.saved.csspointerevents=T.doc.css("pointer-events"),T.css(T.doc,{"pointer-events":"none"})),T.hasmoving=!1,T.cancelEvent(e)}},T.onmouseup=function(e){if(T.rail.drag)return 1!=T.rail.drag.pt||(N.hasmousecapture&&l.releaseCapture(),T.isiframe&&!N.hasmousecapture&&T.doc.css("pointer-events",T.saved.csspointerevents),T.rail.drag=!1,T.cursorfreezed=!1,T.hasmoving&&T.triggerScrollEnd(),T.cancelEvent(e))},T.onmousemove=function(e){if(T.rail.drag){if(1!==T.rail.drag.pt)return;if(N.ischrome&&0===e.which)return T.onmouseup(e);if(T.cursorfreezed=!0,T.hasmoving||T.triggerScrollStart(e.clientX,e.clientY,0,0,0),T.hasmoving=!0,T.rail.drag.hr){T.scroll.x=T.rail.drag.sx+(e.clientX-T.rail.drag.x),T.scroll.x<0&&(T.scroll.x=0);var o=T.scrollvaluemaxw;T.scroll.x>o&&(T.scroll.x=o)}else{T.scroll.y=T.rail.drag.sy+(e.clientY-T.rail.drag.y),T.scroll.y<0&&(T.scroll.y=0);var t=T.scrollvaluemax;T.scroll.y>t&&(T.scroll.y=t)}return T.synched("mousemove",function(){T.cursorfreezed&&(T.showCursor(),T.rail.drag.hr?T.scrollLeft(Math.round(T.scroll.x*T.scrollratio.x)):T.scrollTop(Math.round(T.scroll.y*T.scrollratio.y)))}),T.cancelEvent(e)}T.checkarea=0},N.cantouch||M.emulatetouch)T.onpreventclick=function(e){if(T.preventclick)return T.preventclick.tg.onclick=T.preventclick.click,T.preventclick=!1,T.cancelEvent(e)},T.onclick=!N.isios&&function(e){return!T.lastmouseup||(T.lastmouseup=!1,T.cancelEvent(e))},M.grabcursorenabled&&N.cursorgrabvalue&&(T.css(T.ispage?T.doc:T.win,{cursor:N.cursorgrabvalue}),T.css(T.rail,{cursor:N.cursorgrabvalue}));else{var L=function(e){if(T.selectiondrag){if(e){var o=T.win.outerHeight(),t=e.pageY-T.selectiondrag.top;t>0&&t=o&&(t-=o),T.selectiondrag.df=t}if(0!==T.selectiondrag.df){var r=-2*T.selectiondrag.df/6|0;T.doScrollBy(r),T.debounced("doselectionscroll",function(){L()},50)}}};T.hasTextSelected="getSelection"in l?function(){return l.getSelection().rangeCount>0}:"selection"in l?function(){return"None"!=l.selection.type}:function(){return!1},T.onselectionstart=function(e){T.ispage||(T.selectiondrag=T.win.offset())},T.onselectionend=function(e){T.selectiondrag=!1},T.onselectiondrag=function(e){T.selectiondrag&&T.hasTextSelected()&&T.debounced("selectionscroll",function(){L(e)},250)}}if(N.hasw3ctouch?(T.css(T.ispage?n("html"):T.win,{"touch-action":"none"}),T.css(T.rail,{"touch-action":"none"}),T.css(T.cursor,{"touch-action":"none"}),T.bind(T.win,"pointerdown",T.ontouchstart),T.bind(l,"pointerup",T.ontouchend),T.delegate(l,"pointermove",T.ontouchmove)):N.hasmstouch?(T.css(T.ispage?n("html"):T.win,{"-ms-touch-action":"none"}),T.css(T.rail,{"-ms-touch-action":"none"}),T.css(T.cursor,{"-ms-touch-action":"none"}),T.bind(T.win,"MSPointerDown",T.ontouchstart),T.bind(l,"MSPointerUp",T.ontouchend),T.delegate(l,"MSPointerMove",T.ontouchmove),T.bind(T.cursor,"MSGestureHold",function(e){e.preventDefault()}),T.bind(T.cursor,"contextmenu",function(e){e.preventDefault()})):N.cantouch&&(T.bind(T.win,"touchstart",T.ontouchstart,!1,!0),T.bind(l,"touchend",T.ontouchend,!1,!0),T.bind(l,"touchcancel",T.ontouchend,!1,!0),T.delegate(l,"touchmove",T.ontouchmove,!1,!0)),M.emulatetouch&&(T.bind(T.win,"mousedown",T.ontouchstart,!1,!0),T.bind(l,"mouseup",T.ontouchend,!1,!0),T.bind(l,"mousemove",T.ontouchmove,!1,!0)),(M.cursordragontouch||!N.cantouch&&!M.emulatetouch)&&(T.rail.css({cursor:"default"}),T.railh&&T.railh.css({cursor:"default"}),T.jqbind(T.rail,"mouseenter",function(){if(!T.ispage&&!T.win.is(":visible"))return!1;T.canshowonmouseevent&&T.showCursor(),T.rail.active=!0}),T.jqbind(T.rail,"mouseleave",function(){T.rail.active=!1,T.rail.drag||T.hideCursor()}),M.sensitiverail&&(T.bind(T.rail,"click",function(e){T.doRailClick(e,!1,!1)}),T.bind(T.rail,"dblclick",function(e){T.doRailClick(e,!0,!1)}),T.bind(T.cursor,"click",function(e){T.cancelEvent(e)}),T.bind(T.cursor,"dblclick",function(e){T.cancelEvent(e)})),T.railh&&(T.jqbind(T.railh,"mouseenter",function(){if(!T.ispage&&!T.win.is(":visible"))return!1;T.canshowonmouseevent&&T.showCursor(),T.rail.active=!0}),T.jqbind(T.railh,"mouseleave",function(){T.rail.active=!1,T.rail.drag||T.hideCursor()}),M.sensitiverail&&(T.bind(T.railh,"click",function(e){T.doRailClick(e,!1,!0)}),T.bind(T.railh,"dblclick",function(e){T.doRailClick(e,!0,!0)}),T.bind(T.cursorh,"click",function(e){T.cancelEvent(e)}),T.bind(T.cursorh,"dblclick",function(e){T.cancelEvent(e)})))),M.cursordragontouch&&(this.istouchcapable||N.cantouch)&&(T.bind(T.cursor,"touchstart",T.ontouchstartCursor),T.bind(T.cursor,"touchmove",T.ontouchmoveCursor),T.bind(T.cursor,"touchend",T.ontouchendCursor),T.cursorh&&T.bind(T.cursorh,"touchstart",function(e){T.ontouchstartCursor(e,!0)}),T.cursorh&&T.bind(T.cursorh,"touchmove",T.ontouchmoveCursor),T.cursorh&&T.bind(T.cursorh,"touchend",T.ontouchendCursor)),N.cantouch||M.emulatetouch?(T.bind(N.hasmousecapture?T.win:l,"mouseup",T.ontouchend),T.onclick&&T.bind(l,"click",T.onclick),M.cursordragontouch?(T.bind(T.cursor,"mousedown",T.onmousedown),T.bind(T.cursor,"mouseup",T.onmouseup),T.cursorh&&T.bind(T.cursorh,"mousedown",function(e){T.onmousedown(e,!0)}),T.cursorh&&T.bind(T.cursorh,"mouseup",T.onmouseup)):(T.bind(T.rail,"mousedown",function(e){e.preventDefault()}),T.railh&&T.bind(T.railh,"mousedown",function(e){e.preventDefault()}))):(T.bind(N.hasmousecapture?T.win:l,"mouseup",T.onmouseup),T.bind(l,"mousemove",T.onmousemove),T.onclick&&T.bind(l,"click",T.onclick),T.bind(T.cursor,"mousedown",T.onmousedown),T.bind(T.cursor,"mouseup",T.onmouseup),T.railh&&(T.bind(T.cursorh,"mousedown",function(e){T.onmousedown(e,!0)}),T.bind(T.cursorh,"mouseup",T.onmouseup)),!T.ispage&&M.enablescrollonselection&&(T.bind(T.win[0],"mousedown",T.onselectionstart),T.bind(l,"mouseup",T.onselectionend),T.bind(T.cursor,"mouseup",T.onselectionend),T.cursorh&&T.bind(T.cursorh,"mouseup",T.onselectionend),T.bind(l,"mousemove",T.onselectiondrag)),T.zoom&&(T.jqbind(T.zoom,"mouseenter",function(){T.canshowonmouseevent&&T.showCursor(),T.rail.active=!0}),T.jqbind(T.zoom,"mouseleave",function(){T.rail.active=!1,T.rail.drag||T.hideCursor()}))),M.enablemousewheel&&(T.isiframe||T.mousewheel(N.isie&&T.ispage?l:T.win,T.onmousewheel),T.mousewheel(T.rail,T.onmousewheel),T.railh&&T.mousewheel(T.railh,T.onmousewheelhr)),T.ispage||N.cantouch||/HTML|^BODY/.test(T.win[0].nodeName)||(T.win.attr("tabindex")||T.win.attr({tabindex:++r}),T.bind(T.win,"focus",function(e){o=T.getTarget(e).id||T.getTarget(e)||!1,T.hasfocus=!0,T.canshowonmouseevent&&T.noticeCursor()}),T.bind(T.win,"blur",function(e){o=!1,T.hasfocus=!1}),T.bind(T.win,"mouseenter",function(e){t=T.getTarget(e).id||T.getTarget(e)||!1,T.hasmousefocus=!0,T.canshowonmouseevent&&T.noticeCursor()}),T.bind(T.win,"mouseleave",function(e){t=!1,T.hasmousefocus=!1,T.rail.drag||T.hideCursor()})),T.onkeypress=function(e){if(T.railslocked&&0===T.page.maxh)return!0;e=e||a.event;var r=T.getTarget(e);if(r&&/INPUT|TEXTAREA|SELECT|OPTION/.test(r.nodeName)&&(!(r.getAttribute("type")||r.type||!1)||!/submit|button|cancel/i.tp))return!0;if(n(r).attr("contenteditable"))return!0;if(T.hasfocus||T.hasmousefocus&&!o||T.ispage&&!o&&!t){var i=e.keyCode;if(T.railslocked&&27!=i)return T.cancelEvent(e);var s=e.ctrlKey||!1,l=e.shiftKey||!1,c=!1;switch(i){case 38:case 63233:T.doScrollBy(72),c=!0;break;case 40:case 63235:T.doScrollBy(-72),c=!0;break;case 37:case 63232:T.railh&&(s?T.doScrollLeft(0):T.doScrollLeftBy(72),c=!0);break;case 39:case 63234:T.railh&&(s?T.doScrollLeft(T.page.maxw):T.doScrollLeftBy(-72),c=!0);break;case 33:case 63276:T.doScrollBy(T.view.h),c=!0;break;case 34:case 63277:T.doScrollBy(-T.view.h),c=!0;break;case 36:case 63273:T.railh&&s?T.doScrollPos(0,0):T.doScrollTo(0),c=!0;break;case 35:case 63275:T.railh&&s?T.doScrollPos(T.page.maxw,T.page.maxh):T.doScrollTo(T.page.maxh),c=!0;break;case 32:M.spacebarenabled&&(l?T.doScrollBy(T.view.h):T.doScrollBy(-T.view.h),c=!0);break;case 27:T.zoomactive&&(T.doZoom(),c=!0)}if(c)return T.cancelEvent(e)}},M.enablekeyboard&&T.bind(l,N.isopera&&!N.isopera12?"keypress":"keydown",T.onkeypress),T.bind(l,"keydown",function(e){(e.ctrlKey||!1)&&(T.wheelprevented=!0)}),T.bind(l,"keyup",function(e){e.ctrlKey||!1||(T.wheelprevented=!1)}),T.bind(a,"blur",function(e){T.wheelprevented=!1}),T.bind(a,"resize",T.onscreenresize),T.bind(a,"orientationchange",T.onscreenresize),T.bind(a,"load",T.lazyResize),N.ischrome&&!T.ispage&&!T.haswrapper){var C=T.win.attr("style"),P=parseFloat(T.win.css("width"))+1;T.win.css("width",P),T.synched("chromefix",function(){T.win.attr("style",C)})}T.onAttributeChange=function(e){T.lazyResize(T.isieold?250:30)},M.enableobserver&&(T.isie11||!1===m||(T.observerbody=new m(function(e){if(e.forEach(function(e){if("attributes"==e.type)return E.hasClass("modal-open")&&E.hasClass("modal-dialog")&&!n.contains(n(".modal-dialog")[0],T.doc[0])?T.hide():T.show()}),T.me.clientWidth!=T.page.width||T.me.clientHeight!=T.page.height)return T.lazyResize(30)}),T.observerbody.observe(l.body,{childList:!0,subtree:!0,characterData:!1,attributes:!0,attributeFilter:["class"]})),T.ispage||T.haswrapper||(!1!==m?(T.observer=new m(function(e){e.forEach(T.onAttributeChange)}),T.observer.observe(T.win[0],{childList:!0,characterData:!1,attributes:!0,subtree:!1}),T.observerremover=new m(function(e){e.forEach(function(e){if(e.removedNodes.length>0)for(var o in e.removedNodes)if(T&&e.removedNodes[o]==T.win[0])return T.remove()})}),T.observerremover.observe(T.win[0].parentNode,{childList:!0,characterData:!1,attributes:!1,subtree:!1})):(T.bind(T.win,N.isie&&!N.isie9?"propertychange":"DOMAttrModified",T.onAttributeChange),N.isie9&&T.win[0].attachEvent("onpropertychange",T.onAttributeChange),T.bind(T.win,"DOMNodeRemoved",function(e){e.target==T.win[0]&&T.remove()})))),!T.ispage&&M.boxzoom&&T.bind(a,"resize",T.resizeZoom),T.istextarea&&(T.bind(T.win,"keydown",T.lazyResize),T.bind(T.win,"mouseup",T.lazyResize)),T.lazyResize(30)}if("IFRAME"==this.doc[0].nodeName){var R=function(){T.iframexd=!1;var o;try{(o="contentDocument"in this?this.contentDocument:this.contentWindow._doc).domain}catch(e){T.iframexd=!0,o=!1}if(T.iframexd)return"console"in a&&console.log("NiceScroll error: policy restriced iframe"),!0;if(T.forcescreen=!0,T.isiframe&&(T.iframe={doc:n(o),html:T.doc.contents().find("html")[0],body:T.doc.contents().find("body")[0]},T.getContentSize=function(){return{w:Math.max(T.iframe.html.scrollWidth,T.iframe.body.scrollWidth),h:Math.max(T.iframe.html.scrollHeight,T.iframe.body.scrollHeight)}},T.docscroll=n(T.iframe.body)),!N.isios&&M.iframeautoresize&&!T.isiframe){T.win.scrollTop(0),T.doc.height("");var t=Math.max(o.getElementsByTagName("html")[0].scrollHeight,o.body.scrollHeight);T.doc.height(t)}T.lazyResize(30),T.css(n(T.iframe.body),e),N.isios&&T.haswrapper&&T.css(n(o.body),{"-webkit-transform":"translate3d(0,0,0)"}),"contentWindow"in this?T.bind(this.contentWindow,"scroll",T.onscroll):T.bind(o,"scroll",T.onscroll),M.enablemousewheel&&T.mousewheel(o,T.onmousewheel),M.enablekeyboard&&T.bind(o,N.isopera?"keypress":"keydown",T.onkeypress),N.cantouch?(T.bind(o,"touchstart",T.ontouchstart),T.bind(o,"touchmove",T.ontouchmove)):M.emulatetouch&&(T.bind(o,"mousedown",T.ontouchstart),T.bind(o,"mousemove",function(e){return T.ontouchmove(e,!0)}),M.grabcursorenabled&&N.cursorgrabvalue&&T.css(n(o.body),{cursor:N.cursorgrabvalue})),T.bind(o,"mouseup",T.ontouchend),T.zoom&&(M.dblclickzoom&&T.bind(o,"dblclick",T.doZoom),T.ongesturezoom&&T.bind(o,"gestureend",T.ongesturezoom))};this.doc[0].readyState&&"complete"===this.doc[0].readyState&&setTimeout(function(){R.call(T.doc[0],!1)},500),T.bind(this.doc,"load",R)}},this.showCursor=function(e,o){if(T.cursortimeout&&(clearTimeout(T.cursortimeout),T.cursortimeout=0),T.rail){if(T.autohidedom&&(T.autohidedom.stop().css({opacity:M.cursoropacitymax}),T.cursoractive=!0),T.rail.drag&&1==T.rail.drag.pt||(void 0!==e&&!1!==e&&(T.scroll.y=e/T.scrollratio.y|0),void 0!==o&&(T.scroll.x=o/T.scrollratio.x|0)),T.cursor.css({height:T.cursorheight,top:T.scroll.y}),T.cursorh){var t=T.hasreversehr?T.scrollvaluemaxw-T.scroll.x:T.scroll.x;T.cursorh.css({width:T.cursorwidth,left:!T.rail.align&&T.rail.visibility?t+T.rail.width:t}),T.cursoractive=!0}T.zoom&&T.zoom.stop().css({opacity:M.cursoropacitymax})}},this.hideCursor=function(e){T.cursortimeout||T.rail&&T.autohidedom&&(T.hasmousefocus&&"leave"===M.autohidemode||(T.cursortimeout=setTimeout(function(){T.rail.active&&T.showonmouseevent||(T.autohidedom.stop().animate({opacity:M.cursoropacitymin}),T.zoom&&T.zoom.stop().animate({opacity:M.cursoropacitymin}),T.cursoractive=!1),T.cursortimeout=0},e||M.hidecursordelay)))},this.noticeCursor=function(e,o,t){T.showCursor(o,t),T.rail.active||T.hideCursor(e)},this.getContentSize=T.ispage?function(){return{w:Math.max(l.body.scrollWidth,l.documentElement.scrollWidth),h:Math.max(l.body.scrollHeight,l.documentElement.scrollHeight)}}:T.haswrapper?function(){return{w:T.doc[0].offsetWidth,h:T.doc[0].offsetHeight}}:function(){return{w:T.docscroll[0].scrollWidth,h:T.docscroll[0].scrollHeight}},this.onResize=function(e,o){if(!T||!T.win)return!1;var t=T.page.maxh,r=T.page.maxw,i=T.view.h,s=T.view.w;if(T.view={w:T.ispage?T.win.width():T.win[0].clientWidth,h:T.ispage?T.win.height():T.win[0].clientHeight},T.page=o||T.getContentSize(),T.page.maxh=Math.max(0,T.page.h-T.view.h),T.page.maxw=Math.max(0,T.page.w-T.view.w),T.page.maxh==t&&T.page.maxw==r&&T.view.w==s&&T.view.h==i){if(T.ispage)return T;var n=T.win.offset();if(T.lastposition){var l=T.lastposition;if(l.top==n.top&&l.left==n.left)return T}T.lastposition=n}return 0===T.page.maxh?(T.hideRail(),T.scrollvaluemax=0,T.scroll.y=0,T.scrollratio.y=0,T.cursorheight=0,T.setScrollTop(0),T.rail&&(T.rail.scrollable=!1)):(T.page.maxh-=M.railpadding.top+M.railpadding.bottom,T.rail.scrollable=!0),0===T.page.maxw?(T.hideRailHr(),T.scrollvaluemaxw=0,T.scroll.x=0,T.scrollratio.x=0,T.cursorwidth=0,T.setScrollLeft(0),T.railh&&(T.railh.scrollable=!1)):(T.page.maxw-=M.railpadding.left+M.railpadding.right,T.railh&&(T.railh.scrollable=M.horizrailenabled)),T.railslocked=T.locked||0===T.page.maxh&&0===T.page.maxw,T.railslocked?(T.ispage||T.updateScrollBar(T.view),!1):(T.hidden||T.visibility?!T.railh||T.hidden||T.railh.visibility||T.showRailHr():T.showRail().showRailHr(),T.istextarea&&T.win.css("resize")&&"none"!=T.win.css("resize")&&(T.view.h-=20),T.cursorheight=Math.min(T.view.h,Math.round(T.view.h*(T.view.h/T.page.h))),T.cursorheight=M.cursorfixedheight?M.cursorfixedheight:Math.max(M.cursorminheight,T.cursorheight),T.cursorwidth=Math.min(T.view.w,Math.round(T.view.w*(T.view.w/T.page.w))),T.cursorwidth=M.cursorfixedheight?M.cursorfixedheight:Math.max(M.cursorminheight,T.cursorwidth),T.scrollvaluemax=T.view.h-T.cursorheight-(M.railpadding.top+M.railpadding.bottom),T.hasborderbox||(T.scrollvaluemax-=T.cursor[0].offsetHeight-T.cursor[0].clientHeight),T.railh&&(T.railh.width=T.page.maxh>0?T.view.w-T.rail.width:T.view.w,T.scrollvaluemaxw=T.railh.width-T.cursorwidth-(M.railpadding.left+M.railpadding.right)),T.ispage||T.updateScrollBar(T.view),T.scrollratio={x:T.page.maxw/T.scrollvaluemaxw,y:T.page.maxh/T.scrollvaluemax},T.getScrollTop()>T.page.maxh?T.doScrollTop(T.page.maxh):(T.scroll.y=T.getScrollTop()/T.scrollratio.y|0,T.scroll.x=T.getScrollLeft()/T.scrollratio.x|0,T.cursoractive&&T.noticeCursor()),T.scroll.y&&0===T.getScrollTop()&&T.doScrollTo(T.scroll.y*T.scrollratio.y|0),T)},this.resize=T.onResize;var O=0;this.onscreenresize=function(e){clearTimeout(O);var o=!T.ispage&&!T.haswrapper;o&&T.hideRails(),O=setTimeout(function(){T&&(o&&T.showRails(),T.resize()),O=0},120)},this.lazyResize=function(e){return clearTimeout(O),O=setTimeout(function(){T&&T.resize(),O=0},e||240),T},this.jqbind=function(e,o,t){T.events.push({e:e,n:o,f:t,q:!0}),n(e).on(o,t)},this.mousewheel=function(e,o,t){var r="jquery"in e?e[0]:e;if("onwheel"in l.createElement("div"))T._bind(r,"wheel",o,t||!1);else{var i=void 0!==l.onmousewheel?"mousewheel":"DOMMouseScroll";S(r,i,o,t||!1),"DOMMouseScroll"==i&&S(r,"MozMousePixelScroll",o,t||!1)}};var Y=!1;if(N.haseventlistener){try{var H=Object.defineProperty({},"passive",{get:function(){Y=!0}});a.addEventListener("test",null,H)}catch(e){}this.stopPropagation=function(e){return!!e&&((e=e.original?e.original:e).stopPropagation(),!1)},this.cancelEvent=function(e){return e.cancelable&&e.preventDefault(),e.stopImmediatePropagation(),e.preventManipulation&&e.preventManipulation(),!1}}else Event.prototype.preventDefault=function(){this.returnValue=!1},Event.prototype.stopPropagation=function(){this.cancelBubble=!0},a.constructor.prototype.addEventListener=l.constructor.prototype.addEventListener=Element.prototype.addEventListener=function(e,o,t){this.attachEvent("on"+e,o)},a.constructor.prototype.removeEventListener=l.constructor.prototype.removeEventListener=Element.prototype.removeEventListener=function(e,o,t){this.detachEvent("on"+e,o)},this.cancelEvent=function(e){return(e=e||a.event)&&(e.cancelBubble=!0,e.cancel=!0,e.returnValue=!1),!1},this.stopPropagation=function(e){return(e=e||a.event)&&(e.cancelBubble=!0),!1};this.delegate=function(e,o,t,r,i){var s=d[o]||!1;s||(s={a:[],l:[],f:function(e){for(var o=s.l,t=!1,r=o.length-1;r>=0;r--)if(!1===(t=o[r].call(e.target,e)))return!1;return t}},T.bind(e,o,s.f,r,i),d[o]=s),T.ispage?(s.a=[T.id].concat(s.a),s.l=[t].concat(s.l)):(s.a.push(T.id),s.l.push(t))},this.undelegate=function(e,o,t,r,i){var s=d[o]||!1;if(s)for(var n=0,l=s.l.length;n0)return t;o=!!o.parentNode&&o.parentNode}return!1},this.triggerScrollStart=function(e,o,t,r,i){if(T.onscrollstart){var s={type:"scrollstart",current:{x:e,y:o},request:{x:t,y:r},end:{x:T.newscrollx,y:T.newscrolly},speed:i};T.onscrollstart.call(T,s)}},this.triggerScrollEnd=function(){if(T.onscrollend){var e=T.getScrollLeft(),o=T.getScrollTop(),t={type:"scrollend",current:{x:e,y:o},end:{x:e,y:o}};T.onscrollend.call(T,t)}};var B=0,X=0,D=0,A=1,q=!1;if(this.onmousewheel=function(e){if(T.wheelprevented||T.locked)return!1;if(T.railslocked)return T.debounced("checkunlock",T.resize,250),!1;if(T.rail.drag)return T.cancelEvent(e);if("auto"===M.oneaxismousemode&&0!==e.deltaX&&(M.oneaxismousemode=!1),M.oneaxismousemode&&0===e.deltaX&&!T.rail.scrollable)return!T.railh||!T.railh.scrollable||T.onmousewheelhr(e);var o=f(),t=!1;if(M.preservenativescrolling&&T.checkarea+600T.page.maxh&&(o=T.page.maxh+(o-T.page.maxh)/2|0),e<0?e=e/2|0:e>T.page.maxw&&(e=T.page.maxw+(e-T.page.maxw)/2|0)):(o<0?o=0:o>T.page.maxh&&(o=T.page.maxh),e<0?e=0:e>T.page.maxw&&(e=T.page.maxw)),T.scrollrunning&&e==T.newscrollx&&o==T.newscrolly)return!1;T.newscrolly=o,T.newscrollx=e;var s=T.getScrollTop(),n=T.getScrollLeft(),l={};l.x=e-n,l.y=o-s;var a=0|Math.sqrt(l.x*l.x+l.y*l.y),c=T.prepareTransition(a);T.scrollrunning||(T.scrollrunning=!0,T.triggerScrollStart(n,s,e,o,c),T.cursorupdate.start()),T.scrollendtrapped=!0,N.transitionend||(T.scrollendtrapped&&clearTimeout(T.scrollendtrapped),T.scrollendtrapped=setTimeout(T.onScrollTransitionEnd,c)),T.setScrollTop(T.newscrolly),T.setScrollLeft(T.newscrollx)},this.cancelScroll=function(){if(!T.scrollendtrapped)return!0;var e=T.getScrollTop(),o=T.getScrollLeft();return T.scrollrunning=!1,N.transitionend||clearTimeout(N.transitionend),T.scrollendtrapped=!1,T.resetTransition(),T.setScrollTop(e),T.railh&&T.setScrollLeft(o),T.timerscroll&&T.timerscroll.tm&&clearInterval(T.timerscroll.tm),T.timerscroll=!1,T.cursorfreezed=!1,T.cursorupdate.stop(),T.showCursor(e,o),T},this.onScrollTransitionEnd=function(){if(T.scrollendtrapped){var e=T.getScrollTop(),o=T.getScrollLeft();if(e<0?e=0:e>T.page.maxh&&(e=T.page.maxh),o<0?o=0:o>T.page.maxw&&(o=T.page.maxw),e!=T.newscrolly||o!=T.newscrollx)return T.doScrollPos(o,e,M.snapbackspeed);T.scrollrunning&&T.triggerScrollEnd(),T.scrollrunning=!1,T.scrollendtrapped=!1,T.resetTransition(),T.timerscroll=!1,T.setScrollTop(e),T.railh&&T.setScrollLeft(o),T.cursorupdate.stop(),T.noticeCursor(!1,e,o),T.cursorfreezed=!1}}}else this.doScrollLeft=function(e,o){var t=T.scrollrunning?T.newscrolly:T.getScrollTop();T.doScrollPos(e,t,o)},this.doScrollTop=function(e,o){var t=T.scrollrunning?T.newscrollx:T.getScrollLeft();T.doScrollPos(t,e,o)},this.doScrollPos=function(e,o,t){var r=T.getScrollTop(),i=T.getScrollLeft();((T.newscrolly-r)*(o-r)<0||(T.newscrollx-i)*(e-i)<0)&&T.cancelScroll();var s=!1;if(T.bouncescroll&&T.rail.visibility||(o<0?(o=0,s=!0):o>T.page.maxh&&(o=T.page.maxh,s=!0)),T.bouncescroll&&T.railh.visibility||(e<0?(e=0,s=!0):e>T.page.maxw&&(e=T.page.maxw,s=!0)),T.scrollrunning&&T.newscrolly===o&&T.newscrollx===e)return!0;T.newscrolly=o,T.newscrollx=e,T.dst={},T.dst.x=e-i,T.dst.y=o-r,T.dst.px=i,T.dst.py=r;var n=0|Math.sqrt(T.dst.x*T.dst.x+T.dst.y*T.dst.y),l=T.getTransitionSpeed(n);T.bzscroll={};var a=s?1:.58;T.bzscroll.x=new R(i,T.newscrollx,l,0,0,a,1),T.bzscroll.y=new R(r,T.newscrolly,l,0,0,a,1);var c=function(){if(T.scrollrunning){var e=T.bzscroll.y.getPos();T.setScrollLeft(T.bzscroll.x.getNow()),T.setScrollTop(T.bzscroll.y.getNow()),e<=1?u(c):(T.scrollrunning=!1,T.timer=0,T.triggerScrollEnd())}};T.scrollrunning||(T.triggerScrollStart(i,r,e,o,l),T.scrollrunning=!0,T.timer=u(c))},this.cancelScroll=function(){return T.timer&&h(T.timer),T.timer=0,T.bzscroll=!1,T.scrollrunning=!1,T};else this.doScrollLeft=function(e,o){var t=T.getScrollTop();T.doScrollPos(e,t,o)},this.doScrollTop=function(e,o){var t=T.getScrollLeft();T.doScrollPos(t,e,o)},this.doScrollPos=function(e,o,t){var r=e>T.page.maxw?T.page.maxw:e;r<0&&(r=0);var i=o>T.page.maxh?T.page.maxh:o;i<0&&(i=0),T.synched("scroll",function(){T.setScrollTop(i),T.setScrollLeft(r)})},this.cancelScroll=function(){};this.doScrollBy=function(e,o){z(0,e)},this.doScrollLeftBy=function(e,o){z(e,0)},this.doScrollTo=function(e,o){var t=o?Math.round(e*T.scrollratio.y):e;t<0?t=0:t>T.page.maxh&&(t=T.page.maxh),T.cursorfreezed=!1,T.doScrollTop(e)},this.checkContentSize=function(){var e=T.getContentSize();e.h==T.page.h&&e.w==T.page.w||T.resize(!1,e)},T.onscroll=function(e){T.rail.drag||T.cursorfreezed||T.synched("scroll",function(){T.scroll.y=Math.round(T.getScrollTop()/T.scrollratio.y),T.railh&&(T.scroll.x=Math.round(T.getScrollLeft()/T.scrollratio.x)),T.noticeCursor()})},T.bind(T.docscroll,"scroll",T.onscroll),this.doZoomIn=function(e){if(!T.zoomactive){T.zoomactive=!0,T.zoomrestore={style:{}};var o=["position","top","left","zIndex","backgroundColor","marginTop","marginBottom","marginLeft","marginRight"],t=T.win[0].style;for(var r in o){var i=o[r];T.zoomrestore.style[i]=void 0!==t[i]?t[i]:""}T.zoomrestore.style.width=T.win.css("width"),T.zoomrestore.style.height=T.win.css("height"),T.zoomrestore.padding={w:T.win.outerWidth()-T.win.width(),h:T.win.outerHeight()-T.win.height()},N.isios4&&(T.zoomrestore.scrollTop=c.scrollTop(),c.scrollTop(0)),T.win.css({position:N.isios4?"absolute":"fixed",top:0,left:0,zIndex:s+100,margin:0});var n=T.win.css("backgroundColor");return(""===n||/transparent|rgba\(0, 0, 0, 0\)|rgba\(0,0,0,0\)/.test(n))&&T.win.css("backgroundColor","#fff"),T.rail.css({zIndex:s+101}),T.zoom.css({zIndex:s+102}),T.zoom.css("backgroundPosition","0 -18px"),T.resizeZoom(),T.onzoomin&&T.onzoomin.call(T),T.cancelEvent(e)}},this.doZoomOut=function(e){if(T.zoomactive)return T.zoomactive=!1,T.win.css("margin",""),T.win.css(T.zoomrestore.style),N.isios4&&c.scrollTop(T.zoomrestore.scrollTop),T.rail.css({"z-index":T.zindex}),T.zoom.css({"z-index":T.zindex}),T.zoomrestore=!1,T.zoom.css("backgroundPosition","0 0"),T.onResize(),T.onzoomout&&T.onzoomout.call(T),T.cancelEvent(e)},this.doZoom=function(e){return T.zoomactive?T.doZoomOut(e):T.doZoomIn(e)},this.resizeZoom=function(){if(T.zoomactive){var e=T.getScrollTop();T.win.css({width:c.width()-T.zoomrestore.padding.w+"px",height:c.height()-T.zoomrestore.padding.h+"px"}),T.onResize(),T.setScrollTop(Math.min(T.page.maxh,e))}},this.init(),n.nicescroll.push(this)},y=function(e){var o=this;this.nc=e,this.lastx=0,this.lasty=0,this.speedx=0,this.speedy=0,this.lasttime=0,this.steptime=0,this.snapx=!1,this.snapy=!1,this.demulx=0,this.demuly=0,this.lastscrollx=-1,this.lastscrolly=-1,this.chkx=0,this.chky=0,this.timer=0,this.reset=function(e,t){o.stop(),o.steptime=0,o.lasttime=f(),o.speedx=0,o.speedy=0,o.lastx=e,o.lasty=t,o.lastscrollx=-1,o.lastscrolly=-1},this.update=function(e,t){var r=f();o.steptime=r-o.lasttime,o.lasttime=r;var i=t-o.lasty,s=e-o.lastx,n=o.nc.getScrollTop()+i,l=o.nc.getScrollLeft()+s;o.snapx=l<0||l>o.nc.page.maxw,o.snapy=n<0||n>o.nc.page.maxh,o.speedx=s,o.speedy=i,o.lastx=e,o.lasty=t},this.stop=function(){o.nc.unsynched("domomentum2d"),o.timer&&clearTimeout(o.timer),o.timer=0,o.lastscrollx=-1,o.lastscrolly=-1},this.doSnapy=function(e,t){var r=!1;t<0?(t=0,r=!0):t>o.nc.page.maxh&&(t=o.nc.page.maxh,r=!0),e<0?(e=0,r=!0):e>o.nc.page.maxw&&(e=o.nc.page.maxw,r=!0),r?o.nc.doScrollPos(e,t,o.nc.opt.snapbackspeed):o.nc.triggerScrollEnd()},this.doMomentum=function(e){var t=f(),r=e?t+e:o.lasttime,i=o.nc.getScrollLeft(),s=o.nc.getScrollTop(),n=o.nc.page.maxh,l=o.nc.page.maxw;o.speedx=l>0?Math.min(60,o.speedx):0,o.speedy=n>0?Math.min(60,o.speedy):0;var a=r&&t-r<=60;(s<0||s>n||i<0||i>l)&&(a=!1);var c=!(!o.speedy||!a)&&o.speedy,d=!(!o.speedx||!a)&&o.speedx;if(c||d){var u=Math.max(16,o.steptime);if(u>50){var h=u/50;o.speedx*=h,o.speedy*=h,u=50}o.demulxy=0,o.lastscrollx=o.nc.getScrollLeft(),o.chkx=o.lastscrollx,o.lastscrolly=o.nc.getScrollTop(),o.chky=o.lastscrolly;var p=o.lastscrollx,m=o.lastscrolly,g=function(){var e=f()-t>600?.04:.02;o.speedx&&(p=Math.floor(o.lastscrollx-o.speedx*(1-o.demulxy)),o.lastscrollx=p,(p<0||p>l)&&(e=.1)),o.speedy&&(m=Math.floor(o.lastscrolly-o.speedy*(1-o.demulxy)),o.lastscrolly=m,(m<0||m>n)&&(e=.1)),o.demulxy=Math.min(1,o.demulxy+e),o.nc.synched("domomentum2d",function(){if(o.speedx){o.nc.getScrollLeft();o.chkx=p,o.nc.setScrollLeft(p)}if(o.speedy){o.nc.getScrollTop();o.chky=m,o.nc.setScrollTop(m)}o.timer||(o.nc.hideCursor(),o.doSnapy(p,m))}),o.demulxy<1?o.timer=setTimeout(g,u):(o.stop(),o.nc.hideCursor(),o.doSnapy(p,m))};g()}else o.doSnapy(o.nc.getScrollLeft(),o.nc.getScrollTop())}},x=e.fn.scrollTop;e.cssHooks.pageYOffset={get:function(e,o,t){var r=n.data(e,"__nicescroll")||!1;return r&&r.ishwscroll?r.getScrollTop():x.call(e)},set:function(e,o){var t=n.data(e,"__nicescroll")||!1;return t&&t.ishwscroll?t.setScrollTop(parseInt(o)):x.call(e,o),this}},e.fn.scrollTop=function(e){if(void 0===e){var o=!!this[0]&&(n.data(this[0],"__nicescroll")||!1);return o&&o.ishwscroll?o.getScrollTop():x.call(this)}return this.each(function(){var o=n.data(this,"__nicescroll")||!1;o&&o.ishwscroll?o.setScrollTop(parseInt(e)):x.call(n(this),e)})};var S=e.fn.scrollLeft;n.cssHooks.pageXOffset={get:function(e,o,t){var r=n.data(e,"__nicescroll")||!1;return r&&r.ishwscroll?r.getScrollLeft():S.call(e)},set:function(e,o){var t=n.data(e,"__nicescroll")||!1;return t&&t.ishwscroll?t.setScrollLeft(parseInt(o)):S.call(e,o),this}},e.fn.scrollLeft=function(e){if(void 0===e){var o=!!this[0]&&(n.data(this[0],"__nicescroll")||!1);return o&&o.ishwscroll?o.getScrollLeft():S.call(this)}return this.each(function(){var o=n.data(this,"__nicescroll")||!1;o&&o.ishwscroll?o.setScrollLeft(parseInt(e)):S.call(n(this),e)})};var z=function(e){var o=this;if(this.length=0,this.name="nicescrollarray",this.each=function(e){return n.each(o,e),o},this.push=function(e){o[o.length]=e,o.length++},this.eq=function(e){return o[e]},e)for(var t=0;t1?n(e,r):s,i.win=r}!("doc"in i)||"win"in i||(i.win=r);var l=r.data("__nicescroll")||!1;l||(i.doc=i.doc||r,l=new b(i,r),r.data("__nicescroll",l)),t.push(l)}),1===t.length?t[0]:t},a.NiceScroll={getjQuery:function(){return e}},n.nicescroll||(n.nicescroll=new z,n.nicescroll.options=g)}); \ No newline at end of file From 5b3a8354376ae684a32ad06652d1feeccfcb1acc Mon Sep 17 00:00:00 2001 From: InuYaksa Date: Sun, 2 Jul 2017 18:47:49 +0200 Subject: [PATCH 08/14] RC7 - fixed dbl click on rails - scroll event for hw scroll restored --- jquery.nicescroll.js | 13 +++++++++---- jquery.nicescroll.min.js | 2 +- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/jquery.nicescroll.js b/jquery.nicescroll.js index 6340fc9..4495136 100644 --- a/jquery.nicescroll.js +++ b/jquery.nicescroll.js @@ -572,7 +572,7 @@ this.notifyScrollEvent = function (el) { var e = _doc.createEvent("UIEvents"); - e.initUIEvent("scroll", false, true, _win, 1); + e.initUIEvent("scroll", false, false, _win, 1); e.niceevent = true; el.dispatchEvent(e); }; @@ -775,6 +775,7 @@ var fn, pg, cur, pos; if (self.railslocked) return; + self.cancelEvent(e); if (!("pageY" in e)) { @@ -785,13 +786,14 @@ if (dbl) { fn = (hr) ? self.doScrollLeft : self.doScrollTop; cur = (hr) ? ((e.pageX - self.railh.offset().left - (self.cursorwidth / 2)) * self.scrollratio.x) : ((e.pageY - self.rail.offset().top - (self.cursorheight / 2)) * self.scrollratio.y); - fn(cur); + self.unsynched("relativexy"); + fn(cur|0); } else { fn = (hr) ? self.doScrollLeftBy : self.doScrollBy; cur = (hr) ? self.scroll.x : self.scroll.y; pos = (hr) ? e.pageX - self.railh.offset().left : e.pageY - self.rail.offset().top; pg = (hr) ? self.view.w : self.view.h; - fn((cur >= pos) ? pg : -pg);// (cur >= pos) ? fn(pg): fn(-pg); + fn((cur >= pos) ? pg : -pg); } }; @@ -3025,6 +3027,7 @@ var loop = function () { if (m.running) setAnimationFrame(loop); self.showCursor(self.getScrollTop(), self.getScrollLeft()); + self.notifyScrollEvent(self.win[0]); }; setAnimationFrame(loop); @@ -3196,6 +3199,8 @@ self.bzscroll.x = new BezierClass(px, self.newscrollx, ms, 0, 0, p3, 1); self.bzscroll.y = new BezierClass(py, self.newscrolly, ms, 0, 0, p3, 1); + var loopid = now(); + var loop = function () { if (!self.scrollrunning) return; @@ -3205,7 +3210,7 @@ self.setScrollTop(self.bzscroll.y.getNow()); if (x <= 1) { - setAnimationFrame(loop); + self.timer = setAnimationFrame(loop); } else { self.scrollrunning = false; self.timer = 0; diff --git a/jquery.nicescroll.min.js b/jquery.nicescroll.min.js index ea69eda..a9868cf 100644 --- a/jquery.nicescroll.min.js +++ b/jquery.nicescroll.min.js @@ -1,2 +1,2 @@ /* nicescroll v3.7.4-g [DEV REL] InuYaksa - MIT - https://nicescroll.areaaperta.com */ -!function(e){"function"==typeof define&&define.amd?define(["jquery"],e):"object"==typeof exports?module.exports=e(require("jquery")):e(jQuery)}(function(e){"use strict";var o=!1,t=!1,r=0,i=2e3,s=0,n=e,l=document,a=window,c=n(a),d=[],u=a.requestAnimationFrame||a.webkitRequestAnimationFrame||a.mozRequestAnimationFrame||!1,h=a.cancelAnimationFrame||a.webkitCancelAnimationFrame||a.mozCancelAnimationFrame||!1;if(u)a.cancelAnimationFrame||(h=function(e){});else{var p=0;u=function(e,o){var t=(new Date).getTime(),r=Math.max(0,16-(t-p)),i=a.setTimeout(function(){e(t+r)},r);return p=t+r,i},h=function(e){a.clearTimeout(e)}}var m=a.MutationObserver||a.WebKitMutationObserver||!1,f=Date.now||function(){return(new Date).getTime()},g={zindex:"auto",cursoropacitymin:0,cursoropacitymax:1,cursorcolor:"#424242",cursorwidth:"6px",cursorborder:"1px solid #fff",cursorborderradius:"5px",scrollspeed:40,mousescrollstep:27,touchbehavior:!1,emulatetouch:!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 e=l.currentScript||function(){var e=l.getElementsByTagName("script");return!!e.length&&e[e.length-1]}(),o=e?e.src.split("?")[0]:"";return o.split("/").length>0?o.split("/").slice(0,-1).join("/")+"/":""}(),preventmultitouchscrolling:!0,disablemutationobserver:!1,enableobserver:!0,scrollbarid:!1},v=!1,w=function(){if(v)return v;var e=l.createElement("DIV"),o=e.style,t=navigator.userAgent,r=navigator.platform,i={};return i.haspointerlock="pointerLockElement"in l||"webkitPointerLockElement"in l||"mozPointerLockElement"in l,i.isopera="opera"in a,i.isopera12=i.isopera&&"getUserMedia"in navigator,i.isoperamini="[object OperaMini]"===Object.prototype.toString.call(a.operamini),i.isie="all"in l&&"attachEvent"in e&&!i.isopera,i.isieold=i.isie&&!("msInterpolationMode"in o),i.isie7=i.isie&&!i.isieold&&(!("documentMode"in l)||7===l.documentMode),i.isie8=i.isie&&"documentMode"in l&&8===l.documentMode,i.isie9=i.isie&&"performance"in a&&9===l.documentMode,i.isie10=i.isie&&"performance"in a&&10===l.documentMode,i.isie11="msRequestFullscreen"in e&&l.documentMode>=11,i.ismsedge="msCredentials"in a,i.ismozilla="MozAppearance"in o,i.iswebkit=!i.ismsedge&&"WebkitAppearance"in o,i.ischrome=i.iswebkit&&"chrome"in a,i.ischrome38=i.ischrome&&"touchAction"in o,i.ischrome22=!i.ischrome38&&i.ischrome&&i.haspointerlock,i.ischrome26=!i.ischrome38&&i.ischrome&&"transition"in o,i.cantouch="ontouchstart"in l.documentElement||"ontouchstart"in a,i.hasw3ctouch=(a.PointerEvent||!1)&&(navigator.MaxTouchPoints>0||navigator.msMaxTouchPoints>0),i.hasmstouch=!i.hasw3ctouch&&(a.MSPointerEvent||!1),i.ismac=/^mac$/i.test(r),i.isios=i.cantouch&&/iphone|ipad|ipod/i.test(r),i.isios4=i.isios&&!("seal"in Object),i.isios7=i.isios&&"webkitHidden"in l,i.isios8=i.isios&&"hidden"in l,i.isios10=i.isios&&a.Proxy,i.isandroid=/android/i.test(t),i.haseventlistener="addEventListener"in e,i.trstyle=!1,i.hastransform=!1,i.hastranslate3d=!1,i.transitionstyle=!1,i.hastransition=!1,i.transitionend=!1,i.trstyle="transform",i.hastransform="transform"in o||function(){for(var e=["msTransform","webkitTransform","MozTransform","OTransform"],t=0,r=e.length;t0;){if(9==e[0].nodeType)return!1;var o=e.css("zIndex");if(!isNaN(o)&&0!==o)return parseInt(o);e=e.parent()}return!1}function x(e,o,t){var r=e.css(o),i=parseFloat(r);if(isNaN(i)){var s=3==(i=I[r]||0)?t?T.win.outerHeight()-T.win.innerHeight():T.win.outerWidth()-T.win.innerWidth():1;return T.isie8&&i&&(i+=1),s?i:0}return i}function S(e,o,t,r){T._bind(e,o,function(r){var i={original:r=r||a.event,target:r.target||r.srcElement,type:"wheel",deltaMode:"MozMousePixelScroll"==r.type?0:1,deltaX:0,deltaZ:0,preventDefault:function(){return r.preventDefault?r.preventDefault():r.returnValue=!1,!1},stopImmediatePropagation:function(){r.stopImmediatePropagation?r.stopImmediatePropagation():r.cancelBubble=!0}};return"mousewheel"==o?(r.wheelDeltaX&&(i.deltaX=-.025*r.wheelDeltaX),r.wheelDeltaY&&(i.deltaY=-.025*r.wheelDeltaY),!i.deltaY&&!i.deltaX&&(i.deltaY=-.025*r.wheelDelta)):i.deltaY=r.detail,t.call(e,i)},r)}function z(e,o,t,r){T.scrollrunning||(T.newscrolly=T.getScrollTop(),T.newscrollx=T.getScrollLeft(),D=f());var i=f()-D;if(D=f(),i>350?A=1:A+=(2-A)/10,e=e*A|0,o=o*A|0,e){if(r)if(e<0){if(T.getScrollLeft()>=T.page.maxw)return!0}else if(T.getScrollLeft()<=0)return!0;var s=e>0?1:-1;X!==s&&(T.scrollmom&&T.scrollmom.stop(),T.newscrollx=T.getScrollLeft(),X=s),T.lastdeltax-=e}if(o){if(function(){var e=T.getScrollTop();if(o<0){if(e>=T.page.maxh)return!0}else if(e<=0)return!0}()){if(M.nativeparentscrolling&&t&&!T.ispage&&!T.zoomactive)return!0;var n=T.view.h>>1;T.newscrolly<-n?(T.newscrolly=-n,o=-1):T.newscrolly>T.page.maxh+n?(T.newscrolly=T.page.maxh+n,o=1):o=0}var l=o>0?1:-1;B!==l&&(T.scrollmom&&T.scrollmom.stop(),T.newscrolly=T.getScrollTop(),B=l),T.lastdeltay-=o}(o||e)&&T.synched("relativexy",function(){var e=T.lastdeltay+T.newscrolly;T.lastdeltay=0;var o=T.lastdeltax+T.newscrollx;T.lastdeltax=0,T.rail.drag||T.doScrollPos(o,e)})}function k(e,o,t){var r,i;return!(t||!q)||(0===e.deltaMode?(r=-e.deltaX*(M.mousescrollstep/54)|0,i=-e.deltaY*(M.mousescrollstep/54)|0):1===e.deltaMode&&(r=-e.deltaX*M.mousescrollstep*50/80|0,i=-e.deltaY*M.mousescrollstep*50/80|0),o&&M.oneaxismousemode&&0===r&&i&&(r=i,i=0,t&&(r<0?T.getScrollLeft()>=T.page.maxw:T.getScrollLeft()<=0)&&(i=r,r=0)),T.isrtlmode&&(r=-r),z(r,i,t,!0)?void(t&&(q=!0)):(q=!1,e.stopImmediatePropagation(),e.preventDefault()))}var T=this;this.version="3.7.4-g",this.name="nicescroll",this.me=p;var E=n("body"),M=this.opt={doc:E,win:!1};if(n.extend(M,g),M.snapbackspeed=80,e)for(var L in M)void 0!==e[L]&&(M[L]=e[L]);if(M.disablemutationobserver&&(m=!1),this.doc=M.doc,this.iddoc=this.doc&&this.doc[0]?this.doc[0].id||"":"",this.ispage=/^BODY|HTML/.test(M.win?M.win[0].nodeName:this.doc[0].nodeName),this.haswrapper=!1!==M.win,this.win=M.win||(this.ispage?c:this.doc),this.docscroll=this.ispage&&!this.haswrapper?c:this.win,this.body=E,this.viewport=!1,this.isfixed=!1,this.iframe=!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"!=M.autohidemode,this.onmousedown=!1,this.onmouseup=!1,this.onmousemove=!1,this.onmousewheel=!1,this.onkeypress=!1,this.ongesturezoom=!1,this.onclick=!1,this.onscrollstart=!1,this.onscrollend=!1,this.onscrollcancel=!1,this.onzoomin=!1,this.onzoomout=!1,this.view=!1,this.page=!1,this.scroll={x:0,y:0},this.scrollratio={x:0,y:0},this.cursorheight=20,this.scrollvaluemax=0,"auto"==M.rtlmode){var C=this.win[0]==a?this.body:this.win,P=C.css("writing-mode")||C.css("-webkit-writing-mode")||C.css("-ms-writing-mode")||C.css("-moz-writing-mode");"horizontal-tb"==P||"lr-tb"==P||""===P?(this.isrtlmode="rtl"==C.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===M.rtlmode,this.isvertical=!1;if(this.scrollrunning=!1,this.scrollmom=!1,this.observer=!1,this.observerremover=!1,this.observerbody=!1,!1!==M.scrollbarid)this.id=M.scrollbarid;else do{this.id="ascrail"+i++}while(l.getElementById(this.id));this.rail=!1,this.cursor=!1,this.cursorfreezed=!1,this.selectiondrag=!1,this.zoom=!1,this.zoomactive=!1,this.hasfocus=!1,this.hasmousefocus=!1,this.visibility=!0,this.railslocked=!1,this.locked=!1,this.hidden=!1,this.cursoractive=!0,this.wheelprevented=!1,this.overflowx=M.overflowx,this.overflowy=M.overflowy,this.nativescrollingarea=!1,this.checkarea=0,this.events=[],this.saved={},this.delaylist={},this.synclist={},this.lastdeltax=0,this.lastdeltay=0,this.detected=w();var N=n.extend({},this.detected);this.canhwscroll=N.hastransform&&M.hwacceleration,this.ishwscroll=this.canhwscroll&&T.haswrapper,this.isrtlmode?this.isvertical?this.hasreversehr=!(N.iswebkit||N.isie||N.isie11):this.hasreversehr=!(N.iswebkit||N.isie&&!N.isie10&&!N.isie11):this.hasreversehr=!1,this.istouchcapable=!1,N.cantouch||!N.hasw3ctouch&&!N.hasmstouch?!N.cantouch||N.isios||N.isandroid||!N.iswebkit&&!N.ismozilla||(this.istouchcapable=!0):this.istouchcapable=!0,M.enablemouselockapi||(N.hasmousecapture=!1,N.haspointerlock=!1),this.debounced=function(e,o,t){T&&(T.delaylist[e]||!1||(T.delaylist[e]={h:u(function(){T.delaylist[e].fn.call(T),T.delaylist[e]=!1},t)},o.call(T)),T.delaylist[e].fn=o)},this.synched=function(e,o){T.synclist[e]?T.synclist[e]=o:(T.synclist[e]=o,u(function(){T&&(T.synclist[e]&&T.synclist[e].call(T),T.synclist[e]=null)}))},this.unsynched=function(e){T.synclist[e]&&(T.synclist[e]=!1)},this.css=function(e,o){for(var t in o)T.saved.css.push([e,t,e.css(t)]),e.css(t,o[t])},this.scrollTop=function(e){return void 0===e?T.getScrollTop():T.setScrollTop(e)},this.scrollLeft=function(e){return void 0===e?T.getScrollLeft():T.setScrollLeft(e)};var R=function(e,o,t,r,i,s,n){this.st=e,this.ed=o,this.spd=t,this.p1=r||0,this.p2=i||1,this.p3=s||0,this.p4=n||1,this.ts=f(),this.df=o-e};if(R.prototype={B2:function(e){return 3*(1-e)*(1-e)*e},B3:function(e){return 3*(1-e)*e*e},B4:function(e){return e*e*e},getPos:function(){return(f()-this.ts)/this.spd},getNow:function(){var e=(f()-this.ts)/this.spd,o=this.B2(e)+this.B3(e)+this.B4(e);return e>=1?this.ed:this.st+this.df*o|0},update:function(e,o){return this.st=this.getNow(),this.ed=e,this.spd=o,this.ts=f(),this.df=this.ed-this.st,this}},this.ishwscroll){this.doc.translate={x:0,y:0,tx:"0px",ty:"0px"},N.hastranslate3d&&N.isios&&this.doc.css("-webkit-backface-visibility","hidden"),this.getScrollTop=function(e){if(!e){var o=v();if(o)return 16==o.length?-o[13]:-o[5];if(T.timerscroll&&T.timerscroll.bz)return T.timerscroll.bz.getNow()}return T.doc.translate.y},this.getScrollLeft=function(e){if(!e){var o=v();if(o)return 16==o.length?-o[12]:-o[4];if(T.timerscroll&&T.timerscroll.bh)return T.timerscroll.bh.getNow()}return T.doc.translate.x},this.notifyScrollEvent=function(e){var o=l.createEvent("UIEvents");o.initUIEvent("scroll",!1,!0,a,1),o.niceevent=!0,e.dispatchEvent(o)};var _=this.isrtlmode?1:-1;N.hastranslate3d&&M.enabletranslate3d?(this.setScrollTop=function(e,o){T.doc.translate.y=e,T.doc.translate.ty=-1*e+"px",T.doc.css(N.trstyle,"translate3d("+T.doc.translate.tx+","+T.doc.translate.ty+",0)"),o||T.notifyScrollEvent(T.win[0])},this.setScrollLeft=function(e,o){T.doc.translate.x=e,T.doc.translate.tx=e*_+"px",T.doc.css(N.trstyle,"translate3d("+T.doc.translate.tx+","+T.doc.translate.ty+",0)"),o||T.notifyScrollEvent(T.win[0])}):(this.setScrollTop=function(e,o){T.doc.translate.y=e,T.doc.translate.ty=-1*e+"px",T.doc.css(N.trstyle,"translate("+T.doc.translate.tx+","+T.doc.translate.ty+")"),o||T.notifyScrollEvent(T.win[0])},this.setScrollLeft=function(e,o){T.doc.translate.x=e,T.doc.translate.tx=e*_+"px",T.doc.css(N.trstyle,"translate("+T.doc.translate.tx+","+T.doc.translate.ty+")"),o||T.notifyScrollEvent(T.win[0])})}else this.getScrollTop=function(){return T.docscroll.scrollTop()},this.setScrollTop=function(e){T.docscroll.scrollTop(e)},this.getScrollLeft=function(){return T.hasreversehr?T.detected.ismozilla?T.page.maxw-Math.abs(T.docscroll.scrollLeft()):T.page.maxw-T.docscroll.scrollLeft():T.docscroll.scrollLeft()},this.setScrollLeft=function(e){return setTimeout(function(){if(T)return T.hasreversehr&&(e=T.detected.ismozilla?-(T.page.maxw-e):T.page.maxw-e),T.docscroll.scrollLeft(e)},1)};this.getTarget=function(e){return!!e&&(e.target?e.target:!!e.srcElement&&e.srcElement)},this.hasParent=function(e,o){if(!e)return!1;for(var t=e.target||e.srcElement||e||!1;t&&t.id!=o;)t=t.parentNode||!1;return!1!==t};var I={thin:1,medium:3,thick:5};this.getDocumentScrollOffset=function(){return{top:a.pageYOffset||l.documentElement.scrollTop,left:a.pageXOffset||l.documentElement.scrollLeft}},this.getOffset=function(){if(T.isfixed){var e=T.win.offset(),o=T.getDocumentScrollOffset();return e.top-=o.top,e.left-=o.left,e}var t=T.win.offset();if(!T.viewport)return t;var r=T.viewport.offset();return{top:t.top-r.top,left:t.left-r.left}},this.updateScrollBar=function(e){var o,t;if(T.ishwscroll)T.rail.css({height:T.win.innerHeight()-(M.railpadding.top+M.railpadding.bottom)}),T.railh&&T.railh.css({width:T.win.innerWidth()-(M.railpadding.left+M.railpadding.right)});else{var r=T.getOffset();if(o={top:r.top,left:r.left-(M.railpadding.left+M.railpadding.right)},o.top+=x(T.win,"border-top-width",!0),o.left+=T.rail.align?T.win.outerWidth()-x(T.win,"border-right-width")-T.rail.width:x(T.win,"border-left-width"),(t=M.railoffset)&&(t.top&&(o.top+=t.top),t.left&&(o.left+=t.left)),T.railslocked||T.rail.css({top:o.top,left:o.left,height:(e?e.h:T.win.innerHeight())-(M.railpadding.top+M.railpadding.bottom)}),T.zoom&&T.zoom.css({top:o.top+1,left:1==T.rail.align?o.left-20:o.left+T.rail.width+4}),T.railh&&!T.railslocked){o={top:r.top,left:r.left},(t=M.railhoffset)&&(t.top&&(o.top+=t.top),t.left&&(o.left+=t.left));var i=T.railh.align?o.top+x(T.win,"border-top-width",!0)+T.win.innerHeight()-T.railh.height:o.top+x(T.win,"border-top-width",!0),s=o.left+x(T.win,"border-left-width");T.railh.css({top:i-(M.railpadding.top+M.railpadding.bottom),left:s,width:T.railh.width})}}},this.doRailClick=function(e,o,t){var r,i,s,n;T.railslocked||(T.cancelEvent(e),"pageY"in e||(e.pageX=e.clientX+l.documentElement.scrollLeft,e.pageY=e.clientY+l.documentElement.scrollTop),o?(r=t?T.doScrollLeft:T.doScrollTop)(s=t?(e.pageX-T.railh.offset().left-T.cursorwidth/2)*T.scrollratio.x:(e.pageY-T.rail.offset().top-T.cursorheight/2)*T.scrollratio.y):(r=t?T.doScrollLeftBy:T.doScrollBy,s=t?T.scroll.x:T.scroll.y,n=t?e.pageX-T.railh.offset().left:e.pageY-T.rail.offset().top,i=t?T.view.w:T.view.h,r(s>=n?i:-i)))},T.newscrolly=T.newscrollx=0,T.hasanimationframe="requestAnimationFrame"in a,T.hascancelanimationframe="cancelAnimationFrame"in a,T.hasborderbox=!1,this.init=function(){if(T.saved.css=[],N.isoperamini)return!0;if(N.isandroid&&!("hidden"in l))return!0;M.emulatetouch=M.emulatetouch||M.touchbehavior,T.hasborderbox=a.getComputedStyle&&"border-box"===a.getComputedStyle(l.body)["box-sizing"];var e={"overflow-y":"hidden"};if((N.isie11||N.isie10)&&(e["-ms-overflow-style"]="none"),T.ishwscroll&&(this.doc.css(N.transitionstyle,N.prefixstyle+"transform 0ms ease-out"),N.transitionend&&T.bind(T.doc,N.transitionend,T.onScrollTransitionEnd,!1)),T.zindex="auto",T.ispage||"auto"!=M.zindex?T.zindex=M.zindex:T.zindex=b()||"auto",!T.ispage&&"auto"!=T.zindex&&T.zindex>s&&(s=T.zindex),T.isie&&0===T.zindex&&"auto"==M.zindex&&(T.zindex="auto"),!T.ispage||!N.isieold){var i=T.docscroll;T.ispage&&(i=T.haswrapper?T.win:T.doc),T.css(i,e),T.ispage&&(N.isie11||N.isie)&&T.css(n("html"),e),!N.isios||T.ispage||T.haswrapper||T.css(E,{"-webkit-overflow-scrolling":"touch"});var d=n(l.createElement("div"));d.css({position:"relative",top:0,float:"right",width:M.cursorwidth,height:0,"background-color":M.cursorcolor,border:M.cursorborder,"background-clip":"padding-box","-webkit-border-radius":M.cursorborderradius,"-moz-border-radius":M.cursorborderradius,"border-radius":M.cursorborderradius}),d.addClass("nicescroll-cursors"),T.cursor=d;var u=n(l.createElement("div"));u.attr("id",T.id),u.addClass("nicescroll-rails nicescroll-rails-vr");var h,p,f=["left","right","top","bottom"];for(var g in f)p=f[g],(h=M.railpadding[p]||0)&&u.css("padding-"+p,h+"px");u.append(d),u.width=Math.max(parseFloat(M.cursorwidth),d.outerWidth()),u.css({width:u.width+"px",zIndex:T.zindex,background:M.background,cursor:"default"}),u.visibility=!0,u.scrollable=!0,u.align="left"==M.railalign?0:1,T.rail=u,T.rail.drag=!1;var v=!1;!M.boxzoom||T.ispage||N.isieold||(v=l.createElement("div"),T.bind(v,"click",T.doZoom),T.bind(v,"mouseenter",function(){T.zoom.css("opacity",M.cursoropacitymax)}),T.bind(v,"mouseleave",function(){T.zoom.css("opacity",M.cursoropacitymin)}),T.zoom=n(v),T.zoom.css({cursor:"pointer",zIndex:T.zindex,backgroundImage:"url("+M.scriptpath+"zoomico.png)",height:18,width:18,backgroundPosition:"0 0"}),M.dblclickzoom&&T.bind(T.win,"dblclick",T.doZoom),N.cantouch&&M.gesturezoom&&(T.ongesturezoom=function(e){return e.scale>1.5&&T.doZoomIn(e),e.scale<.8&&T.doZoomOut(e),T.cancelEvent(e)},T.bind(T.win,"gestureend",T.ongesturezoom))),T.railh=!1;var w;if(M.horizrailenabled&&(T.css(i,{overflowX:"hidden"}),(d=n(l.createElement("div"))).css({position:"absolute",top:0,height:M.cursorwidth,width:0,backgroundColor:M.cursorcolor,border:M.cursorborder,backgroundClip:"padding-box","-webkit-border-radius":M.cursorborderradius,"-moz-border-radius":M.cursorborderradius,"border-radius":M.cursorborderradius}),N.isieold&&d.css("overflow","hidden"),d.addClass("nicescroll-cursors"),T.cursorh=d,(w=n(l.createElement("div"))).attr("id",T.id+"-hr"),w.addClass("nicescroll-rails nicescroll-rails-hr"),w.height=Math.max(parseFloat(M.cursorwidth),d.outerHeight()),w.css({height:w.height+"px",zIndex:T.zindex,background:M.background}),w.append(d),w.visibility=!0,w.scrollable=!0,w.align="top"==M.railvalign?0:1,T.railh=w,T.railh.drag=!1),T.ispage)u.css({position:"fixed",top:0,height:"100%"}),u.css(u.align?{right:0}:{left:0}),T.body.append(u),T.railh&&(w.css({position:"fixed",left:0,width:"100%"}),w.css(w.align?{bottom:0}:{top:0}),T.body.append(w));else{if(T.ishwscroll){"static"==T.win.css("position")&&T.css(T.win,{position:"relative"});var x="HTML"==T.win[0].nodeName?T.body:T.win;n(x).scrollTop(0).scrollLeft(0),T.zoom&&(T.zoom.css({position:"absolute",top:1,right:0,"margin-right":u.width+4}),x.append(T.zoom)),u.css({position:"absolute",top:0}),u.css(u.align?{right:0}:{left:0}),x.append(u),w&&(w.css({position:"absolute",left:0,bottom:0}),w.css(w.align?{bottom:0}:{top:0}),x.append(w))}else{T.isfixed="fixed"==T.win.css("position");var S=T.isfixed?"fixed":"absolute";T.isfixed||(T.viewport=T.getViewport(T.win[0])),T.viewport&&(T.body=T.viewport,/fixed|absolute/.test(T.viewport.css("position"))||T.css(T.viewport,{position:"relative"})),u.css({position:S}),T.zoom&&T.zoom.css({position:S}),T.updateScrollBar(),T.body.append(u),T.zoom&&T.body.append(T.zoom),T.railh&&(w.css({position:S}),T.body.append(w))}N.isios&&T.css(T.win,{"-webkit-tap-highlight-color":"rgba(0,0,0,0)","-webkit-touch-callout":"none"}),M.disableoutline&&(N.isie&&T.win.attr("hideFocus","true"),N.iswebkit&&T.win.css("outline","none"))}if(!1===M.autohidemode?(T.autohidedom=!1,T.rail.css({opacity:M.cursoropacitymax}),T.railh&&T.railh.css({opacity:M.cursoropacitymax})):!0===M.autohidemode||"leave"===M.autohidemode?(T.autohidedom=n().add(T.rail),N.isie8&&(T.autohidedom=T.autohidedom.add(T.cursor)),T.railh&&(T.autohidedom=T.autohidedom.add(T.railh)),T.railh&&N.isie8&&(T.autohidedom=T.autohidedom.add(T.cursorh))):"scroll"==M.autohidemode?(T.autohidedom=n().add(T.rail),T.railh&&(T.autohidedom=T.autohidedom.add(T.railh))):"cursor"==M.autohidemode?(T.autohidedom=n().add(T.cursor),T.railh&&(T.autohidedom=T.autohidedom.add(T.cursorh))):"hidden"==M.autohidemode&&(T.autohidedom=!1,T.hide(),T.railslocked=!1),N.cantouch||T.istouchcapable||M.emulatetouch||N.hasmstouch){T.scrollmom=new y(T);T.ontouchstart=function(e){if(T.locked)return!1;if(e.pointerType&&("mouse"===e.pointerType||e.pointerType===e.MSPOINTER_TYPE_MOUSE))return!1;if(T.hasmoving=!1,T.scrollmom.timer&&(T.triggerScrollEnd(),T.scrollmom.stop()),!T.railslocked){var o=T.getTarget(e);if(o&&/INPUT/i.test(o.nodeName)&&/range/i.test(o.type))return T.stopPropagation(e);var t="mousedown"===e.type;if(!("clientX"in e)&&"changedTouches"in e&&(e.clientX=e.changedTouches[0].clientX,e.clientY=e.changedTouches[0].clientY),T.forcescreen){var r=e;(e={original:e.original?e.original:e}).clientX=r.screenX,e.clientY=r.screenY}if(T.rail.drag={x:e.clientX,y:e.clientY,sx:T.scroll.x,sy:T.scroll.y,st:T.getScrollTop(),sl:T.getScrollLeft(),pt:2,dl:!1,tg:o},T.ispage||!M.directionlockdeadzone)T.rail.drag.dl="f";else{var i={w:c.width(),h:c.height()},s=T.getContentSize(),l=s.h-i.h,a=s.w-i.w;T.rail.scrollable&&!T.railh.scrollable?T.rail.drag.ck=l>0&&"v":!T.rail.scrollable&&T.railh.scrollable?T.rail.drag.ck=a>0&&"h":T.rail.drag.ck=!1}if(M.emulatetouch&&T.isiframe&&N.isie){var d=T.win.position();T.rail.drag.x+=d.left,T.rail.drag.y+=d.top}if(T.hasmoving=!1,T.lastmouseup=!1,T.scrollmom.reset(e.clientX,e.clientY),o&&t){if(!/INPUT|SELECT|BUTTON|TEXTAREA/i.test(o.nodeName))return N.hasmousecapture&&o.setCapture(),M.emulatetouch?(o.onclick&&!o._onclick&&(o._onclick=o.onclick,o.onclick=function(e){if(T.hasmoving)return!1;o._onclick.call(this,e)}),T.cancelEvent(e)):T.stopPropagation(e);/SUBMIT|CANCEL|BUTTON/i.test(n(o).attr("type"))&&(T.preventclick={tg:o,click:!1})}}},T.ontouchend=function(e){if(!T.rail.drag)return!0;if(2==T.rail.drag.pt){if(e.pointerType&&("mouse"===e.pointerType||e.pointerType===e.MSPOINTER_TYPE_MOUSE))return!1;T.rail.drag=!1;var o="mouseup"===e.type;if(T.hasmoving&&(T.scrollmom.doMomentum(),T.lastmouseup=!0,T.hideCursor(),N.hasmousecapture&&l.releaseCapture(),o))return T.cancelEvent(e)}else if(1==T.rail.drag.pt)return T.onmouseup(e)};var z=M.emulatetouch&&T.isiframe&&!N.hasmousecapture,k=.3*M.directionlockdeadzone|0;T.ontouchmove=function(e,o){if(!T.rail.drag)return!0;if(e.targetTouches&&M.preventmultitouchscrolling&&e.targetTouches.length>1)return!0;if(e.pointerType&&("mouse"===e.pointerType||e.pointerType===e.MSPOINTER_TYPE_MOUSE))return!0;if(2==T.rail.drag.pt){"changedTouches"in e&&(e.clientX=e.changedTouches[0].clientX,e.clientY=e.changedTouches[0].clientY);var t,r;if(r=t=0,z&&!o){var i=T.win.position();r=-i.left,t=-i.top}var s=e.clientY+t,n=s-T.rail.drag.y,a=e.clientX+r,c=a-T.rail.drag.x,d=T.rail.drag.st-n;if(T.ishwscroll&&M.bouncescroll)d<0?d=Math.round(d/2):d>T.page.maxh&&(d=T.page.maxh+Math.round((d-T.page.maxh)/2));else if(d<0?(d=0,s=0):d>T.page.maxh&&(d=T.page.maxh,s=0),0===s&&!T.hasmoving)return T.ispage||(T.rail.drag=!1),!0;var u=T.getScrollLeft();if(T.railh&&T.railh.scrollable&&(u=T.isrtlmode?c-T.rail.drag.sl:T.rail.drag.sl-c,T.ishwscroll&&M.bouncescroll?u<0?u=Math.round(u/2):u>T.page.maxw&&(u=T.page.maxw+Math.round((u-T.page.maxw)/2)):(u<0&&(u=0,a=0),u>T.page.maxw&&(u=T.page.maxw,a=0))),!T.hasmoving){if(T.rail.drag.y===e.clientY&&T.rail.drag.x===e.clientX)return T.cancelEvent(e);var h=Math.abs(n),p=Math.abs(c),m=M.directionlockdeadzone;if(T.rail.drag.ck?"v"==T.rail.drag.ck?p>m&&h<=k?T.rail.drag=!1:h>m&&(T.rail.drag.dl="v"):"h"==T.rail.drag.ck&&(h>m&&p<=k?T.rail.drag=!1:p>m&&(T.rail.drag.dl="h")):h>m&&p>m?T.rail.drag.dl="f":h>m?T.rail.drag.dl=p>k?"f":"v":p>m&&(T.rail.drag.dl=h>k?"f":"h"),!T.rail.drag.dl)return T.cancelEvent(e);T.triggerScrollStart(e.clientX,e.clientY,0,0,0),T.hasmoving=!0}return T.preventclick&&!T.preventclick.click&&(T.preventclick.click=T.preventclick.tg.onclick||!1,T.preventclick.tg.onclick=T.onpreventclick),T.rail.drag.dl&&("v"==T.rail.drag.dl?u=T.rail.drag.sl:"h"==T.rail.drag.dl&&(d=T.rail.drag.st)),T.synched("touchmove",function(){T.rail.drag&&2==T.rail.drag.pt&&(T.prepareTransition&&T.resetTransition(),T.rail.scrollable&&T.setScrollTop(d),T.scrollmom.update(a,s),T.railh&&T.railh.scrollable?(T.setScrollLeft(u),T.showCursor(d,u)):T.showCursor(d),N.isie10&&l.selection.clear())}),T.cancelEvent(e)}return 1==T.rail.drag.pt?T.onmousemove(e):void 0},T.ontouchstartCursor=function(e,o){if(!T.rail.drag||3==T.rail.drag.pt){if(T.locked)return T.cancelEvent(e);T.cancelScroll(),T.rail.drag={x:e.touches[0].clientX,y:e.touches[0].clientY,sx:T.scroll.x,sy:T.scroll.y,pt:3,hr:!!o};var t=T.getTarget(e);return!T.ispage&&N.hasmousecapture&&t.setCapture(),T.isiframe&&!N.hasmousecapture&&(T.saved.csspointerevents=T.doc.css("pointer-events"),T.css(T.doc,{"pointer-events":"none"})),T.cancelEvent(e)}},T.ontouchendCursor=function(e){if(T.rail.drag){if(N.hasmousecapture&&l.releaseCapture(),T.isiframe&&!N.hasmousecapture&&T.doc.css("pointer-events",T.saved.csspointerevents),3!=T.rail.drag.pt)return;return T.rail.drag=!1,T.cancelEvent(e)}},T.ontouchmoveCursor=function(e){if(T.rail.drag){if(3!=T.rail.drag.pt)return;if(T.cursorfreezed=!0,T.rail.drag.hr){T.scroll.x=T.rail.drag.sx+(e.touches[0].clientX-T.rail.drag.x),T.scroll.x<0&&(T.scroll.x=0);var o=T.scrollvaluemaxw;T.scroll.x>o&&(T.scroll.x=o)}else{T.scroll.y=T.rail.drag.sy+(e.touches[0].clientY-T.rail.drag.y),T.scroll.y<0&&(T.scroll.y=0);var t=T.scrollvaluemax;T.scroll.y>t&&(T.scroll.y=t)}return T.synched("touchmove",function(){T.rail.drag&&3==T.rail.drag.pt&&(T.showCursor(),T.rail.drag.hr?T.doScrollLeft(Math.round(T.scroll.x*T.scrollratio.x),M.cursordragspeed):T.doScrollTop(Math.round(T.scroll.y*T.scrollratio.y),M.cursordragspeed))}),T.cancelEvent(e)}}}if(T.onmousedown=function(e,o){if(!T.rail.drag||1==T.rail.drag.pt){if(T.railslocked)return T.cancelEvent(e);T.cancelScroll(),T.rail.drag={x:e.clientX,y:e.clientY,sx:T.scroll.x,sy:T.scroll.y,pt:1,hr:o||!1};var t=T.getTarget(e);return N.hasmousecapture&&t.setCapture(),T.isiframe&&!N.hasmousecapture&&(T.saved.csspointerevents=T.doc.css("pointer-events"),T.css(T.doc,{"pointer-events":"none"})),T.hasmoving=!1,T.cancelEvent(e)}},T.onmouseup=function(e){if(T.rail.drag)return 1!=T.rail.drag.pt||(N.hasmousecapture&&l.releaseCapture(),T.isiframe&&!N.hasmousecapture&&T.doc.css("pointer-events",T.saved.csspointerevents),T.rail.drag=!1,T.cursorfreezed=!1,T.hasmoving&&T.triggerScrollEnd(),T.cancelEvent(e))},T.onmousemove=function(e){if(T.rail.drag){if(1!==T.rail.drag.pt)return;if(N.ischrome&&0===e.which)return T.onmouseup(e);if(T.cursorfreezed=!0,T.hasmoving||T.triggerScrollStart(e.clientX,e.clientY,0,0,0),T.hasmoving=!0,T.rail.drag.hr){T.scroll.x=T.rail.drag.sx+(e.clientX-T.rail.drag.x),T.scroll.x<0&&(T.scroll.x=0);var o=T.scrollvaluemaxw;T.scroll.x>o&&(T.scroll.x=o)}else{T.scroll.y=T.rail.drag.sy+(e.clientY-T.rail.drag.y),T.scroll.y<0&&(T.scroll.y=0);var t=T.scrollvaluemax;T.scroll.y>t&&(T.scroll.y=t)}return T.synched("mousemove",function(){T.cursorfreezed&&(T.showCursor(),T.rail.drag.hr?T.scrollLeft(Math.round(T.scroll.x*T.scrollratio.x)):T.scrollTop(Math.round(T.scroll.y*T.scrollratio.y)))}),T.cancelEvent(e)}T.checkarea=0},N.cantouch||M.emulatetouch)T.onpreventclick=function(e){if(T.preventclick)return T.preventclick.tg.onclick=T.preventclick.click,T.preventclick=!1,T.cancelEvent(e)},T.onclick=!N.isios&&function(e){return!T.lastmouseup||(T.lastmouseup=!1,T.cancelEvent(e))},M.grabcursorenabled&&N.cursorgrabvalue&&(T.css(T.ispage?T.doc:T.win,{cursor:N.cursorgrabvalue}),T.css(T.rail,{cursor:N.cursorgrabvalue}));else{var L=function(e){if(T.selectiondrag){if(e){var o=T.win.outerHeight(),t=e.pageY-T.selectiondrag.top;t>0&&t=o&&(t-=o),T.selectiondrag.df=t}if(0!==T.selectiondrag.df){var r=-2*T.selectiondrag.df/6|0;T.doScrollBy(r),T.debounced("doselectionscroll",function(){L()},50)}}};T.hasTextSelected="getSelection"in l?function(){return l.getSelection().rangeCount>0}:"selection"in l?function(){return"None"!=l.selection.type}:function(){return!1},T.onselectionstart=function(e){T.ispage||(T.selectiondrag=T.win.offset())},T.onselectionend=function(e){T.selectiondrag=!1},T.onselectiondrag=function(e){T.selectiondrag&&T.hasTextSelected()&&T.debounced("selectionscroll",function(){L(e)},250)}}if(N.hasw3ctouch?(T.css(T.ispage?n("html"):T.win,{"touch-action":"none"}),T.css(T.rail,{"touch-action":"none"}),T.css(T.cursor,{"touch-action":"none"}),T.bind(T.win,"pointerdown",T.ontouchstart),T.bind(l,"pointerup",T.ontouchend),T.delegate(l,"pointermove",T.ontouchmove)):N.hasmstouch?(T.css(T.ispage?n("html"):T.win,{"-ms-touch-action":"none"}),T.css(T.rail,{"-ms-touch-action":"none"}),T.css(T.cursor,{"-ms-touch-action":"none"}),T.bind(T.win,"MSPointerDown",T.ontouchstart),T.bind(l,"MSPointerUp",T.ontouchend),T.delegate(l,"MSPointerMove",T.ontouchmove),T.bind(T.cursor,"MSGestureHold",function(e){e.preventDefault()}),T.bind(T.cursor,"contextmenu",function(e){e.preventDefault()})):N.cantouch&&(T.bind(T.win,"touchstart",T.ontouchstart,!1,!0),T.bind(l,"touchend",T.ontouchend,!1,!0),T.bind(l,"touchcancel",T.ontouchend,!1,!0),T.delegate(l,"touchmove",T.ontouchmove,!1,!0)),M.emulatetouch&&(T.bind(T.win,"mousedown",T.ontouchstart,!1,!0),T.bind(l,"mouseup",T.ontouchend,!1,!0),T.bind(l,"mousemove",T.ontouchmove,!1,!0)),(M.cursordragontouch||!N.cantouch&&!M.emulatetouch)&&(T.rail.css({cursor:"default"}),T.railh&&T.railh.css({cursor:"default"}),T.jqbind(T.rail,"mouseenter",function(){if(!T.ispage&&!T.win.is(":visible"))return!1;T.canshowonmouseevent&&T.showCursor(),T.rail.active=!0}),T.jqbind(T.rail,"mouseleave",function(){T.rail.active=!1,T.rail.drag||T.hideCursor()}),M.sensitiverail&&(T.bind(T.rail,"click",function(e){T.doRailClick(e,!1,!1)}),T.bind(T.rail,"dblclick",function(e){T.doRailClick(e,!0,!1)}),T.bind(T.cursor,"click",function(e){T.cancelEvent(e)}),T.bind(T.cursor,"dblclick",function(e){T.cancelEvent(e)})),T.railh&&(T.jqbind(T.railh,"mouseenter",function(){if(!T.ispage&&!T.win.is(":visible"))return!1;T.canshowonmouseevent&&T.showCursor(),T.rail.active=!0}),T.jqbind(T.railh,"mouseleave",function(){T.rail.active=!1,T.rail.drag||T.hideCursor()}),M.sensitiverail&&(T.bind(T.railh,"click",function(e){T.doRailClick(e,!1,!0)}),T.bind(T.railh,"dblclick",function(e){T.doRailClick(e,!0,!0)}),T.bind(T.cursorh,"click",function(e){T.cancelEvent(e)}),T.bind(T.cursorh,"dblclick",function(e){T.cancelEvent(e)})))),M.cursordragontouch&&(this.istouchcapable||N.cantouch)&&(T.bind(T.cursor,"touchstart",T.ontouchstartCursor),T.bind(T.cursor,"touchmove",T.ontouchmoveCursor),T.bind(T.cursor,"touchend",T.ontouchendCursor),T.cursorh&&T.bind(T.cursorh,"touchstart",function(e){T.ontouchstartCursor(e,!0)}),T.cursorh&&T.bind(T.cursorh,"touchmove",T.ontouchmoveCursor),T.cursorh&&T.bind(T.cursorh,"touchend",T.ontouchendCursor)),N.cantouch||M.emulatetouch?(T.bind(N.hasmousecapture?T.win:l,"mouseup",T.ontouchend),T.onclick&&T.bind(l,"click",T.onclick),M.cursordragontouch?(T.bind(T.cursor,"mousedown",T.onmousedown),T.bind(T.cursor,"mouseup",T.onmouseup),T.cursorh&&T.bind(T.cursorh,"mousedown",function(e){T.onmousedown(e,!0)}),T.cursorh&&T.bind(T.cursorh,"mouseup",T.onmouseup)):(T.bind(T.rail,"mousedown",function(e){e.preventDefault()}),T.railh&&T.bind(T.railh,"mousedown",function(e){e.preventDefault()}))):(T.bind(N.hasmousecapture?T.win:l,"mouseup",T.onmouseup),T.bind(l,"mousemove",T.onmousemove),T.onclick&&T.bind(l,"click",T.onclick),T.bind(T.cursor,"mousedown",T.onmousedown),T.bind(T.cursor,"mouseup",T.onmouseup),T.railh&&(T.bind(T.cursorh,"mousedown",function(e){T.onmousedown(e,!0)}),T.bind(T.cursorh,"mouseup",T.onmouseup)),!T.ispage&&M.enablescrollonselection&&(T.bind(T.win[0],"mousedown",T.onselectionstart),T.bind(l,"mouseup",T.onselectionend),T.bind(T.cursor,"mouseup",T.onselectionend),T.cursorh&&T.bind(T.cursorh,"mouseup",T.onselectionend),T.bind(l,"mousemove",T.onselectiondrag)),T.zoom&&(T.jqbind(T.zoom,"mouseenter",function(){T.canshowonmouseevent&&T.showCursor(),T.rail.active=!0}),T.jqbind(T.zoom,"mouseleave",function(){T.rail.active=!1,T.rail.drag||T.hideCursor()}))),M.enablemousewheel&&(T.isiframe||T.mousewheel(N.isie&&T.ispage?l:T.win,T.onmousewheel),T.mousewheel(T.rail,T.onmousewheel),T.railh&&T.mousewheel(T.railh,T.onmousewheelhr)),T.ispage||N.cantouch||/HTML|^BODY/.test(T.win[0].nodeName)||(T.win.attr("tabindex")||T.win.attr({tabindex:++r}),T.bind(T.win,"focus",function(e){o=T.getTarget(e).id||T.getTarget(e)||!1,T.hasfocus=!0,T.canshowonmouseevent&&T.noticeCursor()}),T.bind(T.win,"blur",function(e){o=!1,T.hasfocus=!1}),T.bind(T.win,"mouseenter",function(e){t=T.getTarget(e).id||T.getTarget(e)||!1,T.hasmousefocus=!0,T.canshowonmouseevent&&T.noticeCursor()}),T.bind(T.win,"mouseleave",function(e){t=!1,T.hasmousefocus=!1,T.rail.drag||T.hideCursor()})),T.onkeypress=function(e){if(T.railslocked&&0===T.page.maxh)return!0;e=e||a.event;var r=T.getTarget(e);if(r&&/INPUT|TEXTAREA|SELECT|OPTION/.test(r.nodeName)&&(!(r.getAttribute("type")||r.type||!1)||!/submit|button|cancel/i.tp))return!0;if(n(r).attr("contenteditable"))return!0;if(T.hasfocus||T.hasmousefocus&&!o||T.ispage&&!o&&!t){var i=e.keyCode;if(T.railslocked&&27!=i)return T.cancelEvent(e);var s=e.ctrlKey||!1,l=e.shiftKey||!1,c=!1;switch(i){case 38:case 63233:T.doScrollBy(72),c=!0;break;case 40:case 63235:T.doScrollBy(-72),c=!0;break;case 37:case 63232:T.railh&&(s?T.doScrollLeft(0):T.doScrollLeftBy(72),c=!0);break;case 39:case 63234:T.railh&&(s?T.doScrollLeft(T.page.maxw):T.doScrollLeftBy(-72),c=!0);break;case 33:case 63276:T.doScrollBy(T.view.h),c=!0;break;case 34:case 63277:T.doScrollBy(-T.view.h),c=!0;break;case 36:case 63273:T.railh&&s?T.doScrollPos(0,0):T.doScrollTo(0),c=!0;break;case 35:case 63275:T.railh&&s?T.doScrollPos(T.page.maxw,T.page.maxh):T.doScrollTo(T.page.maxh),c=!0;break;case 32:M.spacebarenabled&&(l?T.doScrollBy(T.view.h):T.doScrollBy(-T.view.h),c=!0);break;case 27:T.zoomactive&&(T.doZoom(),c=!0)}if(c)return T.cancelEvent(e)}},M.enablekeyboard&&T.bind(l,N.isopera&&!N.isopera12?"keypress":"keydown",T.onkeypress),T.bind(l,"keydown",function(e){(e.ctrlKey||!1)&&(T.wheelprevented=!0)}),T.bind(l,"keyup",function(e){e.ctrlKey||!1||(T.wheelprevented=!1)}),T.bind(a,"blur",function(e){T.wheelprevented=!1}),T.bind(a,"resize",T.onscreenresize),T.bind(a,"orientationchange",T.onscreenresize),T.bind(a,"load",T.lazyResize),N.ischrome&&!T.ispage&&!T.haswrapper){var C=T.win.attr("style"),P=parseFloat(T.win.css("width"))+1;T.win.css("width",P),T.synched("chromefix",function(){T.win.attr("style",C)})}T.onAttributeChange=function(e){T.lazyResize(T.isieold?250:30)},M.enableobserver&&(T.isie11||!1===m||(T.observerbody=new m(function(e){if(e.forEach(function(e){if("attributes"==e.type)return E.hasClass("modal-open")&&E.hasClass("modal-dialog")&&!n.contains(n(".modal-dialog")[0],T.doc[0])?T.hide():T.show()}),T.me.clientWidth!=T.page.width||T.me.clientHeight!=T.page.height)return T.lazyResize(30)}),T.observerbody.observe(l.body,{childList:!0,subtree:!0,characterData:!1,attributes:!0,attributeFilter:["class"]})),T.ispage||T.haswrapper||(!1!==m?(T.observer=new m(function(e){e.forEach(T.onAttributeChange)}),T.observer.observe(T.win[0],{childList:!0,characterData:!1,attributes:!0,subtree:!1}),T.observerremover=new m(function(e){e.forEach(function(e){if(e.removedNodes.length>0)for(var o in e.removedNodes)if(T&&e.removedNodes[o]==T.win[0])return T.remove()})}),T.observerremover.observe(T.win[0].parentNode,{childList:!0,characterData:!1,attributes:!1,subtree:!1})):(T.bind(T.win,N.isie&&!N.isie9?"propertychange":"DOMAttrModified",T.onAttributeChange),N.isie9&&T.win[0].attachEvent("onpropertychange",T.onAttributeChange),T.bind(T.win,"DOMNodeRemoved",function(e){e.target==T.win[0]&&T.remove()})))),!T.ispage&&M.boxzoom&&T.bind(a,"resize",T.resizeZoom),T.istextarea&&(T.bind(T.win,"keydown",T.lazyResize),T.bind(T.win,"mouseup",T.lazyResize)),T.lazyResize(30)}if("IFRAME"==this.doc[0].nodeName){var R=function(){T.iframexd=!1;var o;try{(o="contentDocument"in this?this.contentDocument:this.contentWindow._doc).domain}catch(e){T.iframexd=!0,o=!1}if(T.iframexd)return"console"in a&&console.log("NiceScroll error: policy restriced iframe"),!0;if(T.forcescreen=!0,T.isiframe&&(T.iframe={doc:n(o),html:T.doc.contents().find("html")[0],body:T.doc.contents().find("body")[0]},T.getContentSize=function(){return{w:Math.max(T.iframe.html.scrollWidth,T.iframe.body.scrollWidth),h:Math.max(T.iframe.html.scrollHeight,T.iframe.body.scrollHeight)}},T.docscroll=n(T.iframe.body)),!N.isios&&M.iframeautoresize&&!T.isiframe){T.win.scrollTop(0),T.doc.height("");var t=Math.max(o.getElementsByTagName("html")[0].scrollHeight,o.body.scrollHeight);T.doc.height(t)}T.lazyResize(30),T.css(n(T.iframe.body),e),N.isios&&T.haswrapper&&T.css(n(o.body),{"-webkit-transform":"translate3d(0,0,0)"}),"contentWindow"in this?T.bind(this.contentWindow,"scroll",T.onscroll):T.bind(o,"scroll",T.onscroll),M.enablemousewheel&&T.mousewheel(o,T.onmousewheel),M.enablekeyboard&&T.bind(o,N.isopera?"keypress":"keydown",T.onkeypress),N.cantouch?(T.bind(o,"touchstart",T.ontouchstart),T.bind(o,"touchmove",T.ontouchmove)):M.emulatetouch&&(T.bind(o,"mousedown",T.ontouchstart),T.bind(o,"mousemove",function(e){return T.ontouchmove(e,!0)}),M.grabcursorenabled&&N.cursorgrabvalue&&T.css(n(o.body),{cursor:N.cursorgrabvalue})),T.bind(o,"mouseup",T.ontouchend),T.zoom&&(M.dblclickzoom&&T.bind(o,"dblclick",T.doZoom),T.ongesturezoom&&T.bind(o,"gestureend",T.ongesturezoom))};this.doc[0].readyState&&"complete"===this.doc[0].readyState&&setTimeout(function(){R.call(T.doc[0],!1)},500),T.bind(this.doc,"load",R)}},this.showCursor=function(e,o){if(T.cursortimeout&&(clearTimeout(T.cursortimeout),T.cursortimeout=0),T.rail){if(T.autohidedom&&(T.autohidedom.stop().css({opacity:M.cursoropacitymax}),T.cursoractive=!0),T.rail.drag&&1==T.rail.drag.pt||(void 0!==e&&!1!==e&&(T.scroll.y=e/T.scrollratio.y|0),void 0!==o&&(T.scroll.x=o/T.scrollratio.x|0)),T.cursor.css({height:T.cursorheight,top:T.scroll.y}),T.cursorh){var t=T.hasreversehr?T.scrollvaluemaxw-T.scroll.x:T.scroll.x;T.cursorh.css({width:T.cursorwidth,left:!T.rail.align&&T.rail.visibility?t+T.rail.width:t}),T.cursoractive=!0}T.zoom&&T.zoom.stop().css({opacity:M.cursoropacitymax})}},this.hideCursor=function(e){T.cursortimeout||T.rail&&T.autohidedom&&(T.hasmousefocus&&"leave"===M.autohidemode||(T.cursortimeout=setTimeout(function(){T.rail.active&&T.showonmouseevent||(T.autohidedom.stop().animate({opacity:M.cursoropacitymin}),T.zoom&&T.zoom.stop().animate({opacity:M.cursoropacitymin}),T.cursoractive=!1),T.cursortimeout=0},e||M.hidecursordelay)))},this.noticeCursor=function(e,o,t){T.showCursor(o,t),T.rail.active||T.hideCursor(e)},this.getContentSize=T.ispage?function(){return{w:Math.max(l.body.scrollWidth,l.documentElement.scrollWidth),h:Math.max(l.body.scrollHeight,l.documentElement.scrollHeight)}}:T.haswrapper?function(){return{w:T.doc[0].offsetWidth,h:T.doc[0].offsetHeight}}:function(){return{w:T.docscroll[0].scrollWidth,h:T.docscroll[0].scrollHeight}},this.onResize=function(e,o){if(!T||!T.win)return!1;var t=T.page.maxh,r=T.page.maxw,i=T.view.h,s=T.view.w;if(T.view={w:T.ispage?T.win.width():T.win[0].clientWidth,h:T.ispage?T.win.height():T.win[0].clientHeight},T.page=o||T.getContentSize(),T.page.maxh=Math.max(0,T.page.h-T.view.h),T.page.maxw=Math.max(0,T.page.w-T.view.w),T.page.maxh==t&&T.page.maxw==r&&T.view.w==s&&T.view.h==i){if(T.ispage)return T;var n=T.win.offset();if(T.lastposition){var l=T.lastposition;if(l.top==n.top&&l.left==n.left)return T}T.lastposition=n}return 0===T.page.maxh?(T.hideRail(),T.scrollvaluemax=0,T.scroll.y=0,T.scrollratio.y=0,T.cursorheight=0,T.setScrollTop(0),T.rail&&(T.rail.scrollable=!1)):(T.page.maxh-=M.railpadding.top+M.railpadding.bottom,T.rail.scrollable=!0),0===T.page.maxw?(T.hideRailHr(),T.scrollvaluemaxw=0,T.scroll.x=0,T.scrollratio.x=0,T.cursorwidth=0,T.setScrollLeft(0),T.railh&&(T.railh.scrollable=!1)):(T.page.maxw-=M.railpadding.left+M.railpadding.right,T.railh&&(T.railh.scrollable=M.horizrailenabled)),T.railslocked=T.locked||0===T.page.maxh&&0===T.page.maxw,T.railslocked?(T.ispage||T.updateScrollBar(T.view),!1):(T.hidden||T.visibility?!T.railh||T.hidden||T.railh.visibility||T.showRailHr():T.showRail().showRailHr(),T.istextarea&&T.win.css("resize")&&"none"!=T.win.css("resize")&&(T.view.h-=20),T.cursorheight=Math.min(T.view.h,Math.round(T.view.h*(T.view.h/T.page.h))),T.cursorheight=M.cursorfixedheight?M.cursorfixedheight:Math.max(M.cursorminheight,T.cursorheight),T.cursorwidth=Math.min(T.view.w,Math.round(T.view.w*(T.view.w/T.page.w))),T.cursorwidth=M.cursorfixedheight?M.cursorfixedheight:Math.max(M.cursorminheight,T.cursorwidth),T.scrollvaluemax=T.view.h-T.cursorheight-(M.railpadding.top+M.railpadding.bottom),T.hasborderbox||(T.scrollvaluemax-=T.cursor[0].offsetHeight-T.cursor[0].clientHeight),T.railh&&(T.railh.width=T.page.maxh>0?T.view.w-T.rail.width:T.view.w,T.scrollvaluemaxw=T.railh.width-T.cursorwidth-(M.railpadding.left+M.railpadding.right)),T.ispage||T.updateScrollBar(T.view),T.scrollratio={x:T.page.maxw/T.scrollvaluemaxw,y:T.page.maxh/T.scrollvaluemax},T.getScrollTop()>T.page.maxh?T.doScrollTop(T.page.maxh):(T.scroll.y=T.getScrollTop()/T.scrollratio.y|0,T.scroll.x=T.getScrollLeft()/T.scrollratio.x|0,T.cursoractive&&T.noticeCursor()),T.scroll.y&&0===T.getScrollTop()&&T.doScrollTo(T.scroll.y*T.scrollratio.y|0),T)},this.resize=T.onResize;var O=0;this.onscreenresize=function(e){clearTimeout(O);var o=!T.ispage&&!T.haswrapper;o&&T.hideRails(),O=setTimeout(function(){T&&(o&&T.showRails(),T.resize()),O=0},120)},this.lazyResize=function(e){return clearTimeout(O),O=setTimeout(function(){T&&T.resize(),O=0},e||240),T},this.jqbind=function(e,o,t){T.events.push({e:e,n:o,f:t,q:!0}),n(e).on(o,t)},this.mousewheel=function(e,o,t){var r="jquery"in e?e[0]:e;if("onwheel"in l.createElement("div"))T._bind(r,"wheel",o,t||!1);else{var i=void 0!==l.onmousewheel?"mousewheel":"DOMMouseScroll";S(r,i,o,t||!1),"DOMMouseScroll"==i&&S(r,"MozMousePixelScroll",o,t||!1)}};var Y=!1;if(N.haseventlistener){try{var H=Object.defineProperty({},"passive",{get:function(){Y=!0}});a.addEventListener("test",null,H)}catch(e){}this.stopPropagation=function(e){return!!e&&((e=e.original?e.original:e).stopPropagation(),!1)},this.cancelEvent=function(e){return e.cancelable&&e.preventDefault(),e.stopImmediatePropagation(),e.preventManipulation&&e.preventManipulation(),!1}}else Event.prototype.preventDefault=function(){this.returnValue=!1},Event.prototype.stopPropagation=function(){this.cancelBubble=!0},a.constructor.prototype.addEventListener=l.constructor.prototype.addEventListener=Element.prototype.addEventListener=function(e,o,t){this.attachEvent("on"+e,o)},a.constructor.prototype.removeEventListener=l.constructor.prototype.removeEventListener=Element.prototype.removeEventListener=function(e,o,t){this.detachEvent("on"+e,o)},this.cancelEvent=function(e){return(e=e||a.event)&&(e.cancelBubble=!0,e.cancel=!0,e.returnValue=!1),!1},this.stopPropagation=function(e){return(e=e||a.event)&&(e.cancelBubble=!0),!1};this.delegate=function(e,o,t,r,i){var s=d[o]||!1;s||(s={a:[],l:[],f:function(e){for(var o=s.l,t=!1,r=o.length-1;r>=0;r--)if(!1===(t=o[r].call(e.target,e)))return!1;return t}},T.bind(e,o,s.f,r,i),d[o]=s),T.ispage?(s.a=[T.id].concat(s.a),s.l=[t].concat(s.l)):(s.a.push(T.id),s.l.push(t))},this.undelegate=function(e,o,t,r,i){var s=d[o]||!1;if(s)for(var n=0,l=s.l.length;n0)return t;o=!!o.parentNode&&o.parentNode}return!1},this.triggerScrollStart=function(e,o,t,r,i){if(T.onscrollstart){var s={type:"scrollstart",current:{x:e,y:o},request:{x:t,y:r},end:{x:T.newscrollx,y:T.newscrolly},speed:i};T.onscrollstart.call(T,s)}},this.triggerScrollEnd=function(){if(T.onscrollend){var e=T.getScrollLeft(),o=T.getScrollTop(),t={type:"scrollend",current:{x:e,y:o},end:{x:e,y:o}};T.onscrollend.call(T,t)}};var B=0,X=0,D=0,A=1,q=!1;if(this.onmousewheel=function(e){if(T.wheelprevented||T.locked)return!1;if(T.railslocked)return T.debounced("checkunlock",T.resize,250),!1;if(T.rail.drag)return T.cancelEvent(e);if("auto"===M.oneaxismousemode&&0!==e.deltaX&&(M.oneaxismousemode=!1),M.oneaxismousemode&&0===e.deltaX&&!T.rail.scrollable)return!T.railh||!T.railh.scrollable||T.onmousewheelhr(e);var o=f(),t=!1;if(M.preservenativescrolling&&T.checkarea+600T.page.maxh&&(o=T.page.maxh+(o-T.page.maxh)/2|0),e<0?e=e/2|0:e>T.page.maxw&&(e=T.page.maxw+(e-T.page.maxw)/2|0)):(o<0?o=0:o>T.page.maxh&&(o=T.page.maxh),e<0?e=0:e>T.page.maxw&&(e=T.page.maxw)),T.scrollrunning&&e==T.newscrollx&&o==T.newscrolly)return!1;T.newscrolly=o,T.newscrollx=e;var s=T.getScrollTop(),n=T.getScrollLeft(),l={};l.x=e-n,l.y=o-s;var a=0|Math.sqrt(l.x*l.x+l.y*l.y),c=T.prepareTransition(a);T.scrollrunning||(T.scrollrunning=!0,T.triggerScrollStart(n,s,e,o,c),T.cursorupdate.start()),T.scrollendtrapped=!0,N.transitionend||(T.scrollendtrapped&&clearTimeout(T.scrollendtrapped),T.scrollendtrapped=setTimeout(T.onScrollTransitionEnd,c)),T.setScrollTop(T.newscrolly),T.setScrollLeft(T.newscrollx)},this.cancelScroll=function(){if(!T.scrollendtrapped)return!0;var e=T.getScrollTop(),o=T.getScrollLeft();return T.scrollrunning=!1,N.transitionend||clearTimeout(N.transitionend),T.scrollendtrapped=!1,T.resetTransition(),T.setScrollTop(e),T.railh&&T.setScrollLeft(o),T.timerscroll&&T.timerscroll.tm&&clearInterval(T.timerscroll.tm),T.timerscroll=!1,T.cursorfreezed=!1,T.cursorupdate.stop(),T.showCursor(e,o),T},this.onScrollTransitionEnd=function(){if(T.scrollendtrapped){var e=T.getScrollTop(),o=T.getScrollLeft();if(e<0?e=0:e>T.page.maxh&&(e=T.page.maxh),o<0?o=0:o>T.page.maxw&&(o=T.page.maxw),e!=T.newscrolly||o!=T.newscrollx)return T.doScrollPos(o,e,M.snapbackspeed);T.scrollrunning&&T.triggerScrollEnd(),T.scrollrunning=!1,T.scrollendtrapped=!1,T.resetTransition(),T.timerscroll=!1,T.setScrollTop(e),T.railh&&T.setScrollLeft(o),T.cursorupdate.stop(),T.noticeCursor(!1,e,o),T.cursorfreezed=!1}}}else this.doScrollLeft=function(e,o){var t=T.scrollrunning?T.newscrolly:T.getScrollTop();T.doScrollPos(e,t,o)},this.doScrollTop=function(e,o){var t=T.scrollrunning?T.newscrollx:T.getScrollLeft();T.doScrollPos(t,e,o)},this.doScrollPos=function(e,o,t){var r=T.getScrollTop(),i=T.getScrollLeft();((T.newscrolly-r)*(o-r)<0||(T.newscrollx-i)*(e-i)<0)&&T.cancelScroll();var s=!1;if(T.bouncescroll&&T.rail.visibility||(o<0?(o=0,s=!0):o>T.page.maxh&&(o=T.page.maxh,s=!0)),T.bouncescroll&&T.railh.visibility||(e<0?(e=0,s=!0):e>T.page.maxw&&(e=T.page.maxw,s=!0)),T.scrollrunning&&T.newscrolly===o&&T.newscrollx===e)return!0;T.newscrolly=o,T.newscrollx=e,T.dst={},T.dst.x=e-i,T.dst.y=o-r,T.dst.px=i,T.dst.py=r;var n=0|Math.sqrt(T.dst.x*T.dst.x+T.dst.y*T.dst.y),l=T.getTransitionSpeed(n);T.bzscroll={};var a=s?1:.58;T.bzscroll.x=new R(i,T.newscrollx,l,0,0,a,1),T.bzscroll.y=new R(r,T.newscrolly,l,0,0,a,1);var c=function(){if(T.scrollrunning){var e=T.bzscroll.y.getPos();T.setScrollLeft(T.bzscroll.x.getNow()),T.setScrollTop(T.bzscroll.y.getNow()),e<=1?u(c):(T.scrollrunning=!1,T.timer=0,T.triggerScrollEnd())}};T.scrollrunning||(T.triggerScrollStart(i,r,e,o,l),T.scrollrunning=!0,T.timer=u(c))},this.cancelScroll=function(){return T.timer&&h(T.timer),T.timer=0,T.bzscroll=!1,T.scrollrunning=!1,T};else this.doScrollLeft=function(e,o){var t=T.getScrollTop();T.doScrollPos(e,t,o)},this.doScrollTop=function(e,o){var t=T.getScrollLeft();T.doScrollPos(t,e,o)},this.doScrollPos=function(e,o,t){var r=e>T.page.maxw?T.page.maxw:e;r<0&&(r=0);var i=o>T.page.maxh?T.page.maxh:o;i<0&&(i=0),T.synched("scroll",function(){T.setScrollTop(i),T.setScrollLeft(r)})},this.cancelScroll=function(){};this.doScrollBy=function(e,o){z(0,e)},this.doScrollLeftBy=function(e,o){z(e,0)},this.doScrollTo=function(e,o){var t=o?Math.round(e*T.scrollratio.y):e;t<0?t=0:t>T.page.maxh&&(t=T.page.maxh),T.cursorfreezed=!1,T.doScrollTop(e)},this.checkContentSize=function(){var e=T.getContentSize();e.h==T.page.h&&e.w==T.page.w||T.resize(!1,e)},T.onscroll=function(e){T.rail.drag||T.cursorfreezed||T.synched("scroll",function(){T.scroll.y=Math.round(T.getScrollTop()/T.scrollratio.y),T.railh&&(T.scroll.x=Math.round(T.getScrollLeft()/T.scrollratio.x)),T.noticeCursor()})},T.bind(T.docscroll,"scroll",T.onscroll),this.doZoomIn=function(e){if(!T.zoomactive){T.zoomactive=!0,T.zoomrestore={style:{}};var o=["position","top","left","zIndex","backgroundColor","marginTop","marginBottom","marginLeft","marginRight"],t=T.win[0].style;for(var r in o){var i=o[r];T.zoomrestore.style[i]=void 0!==t[i]?t[i]:""}T.zoomrestore.style.width=T.win.css("width"),T.zoomrestore.style.height=T.win.css("height"),T.zoomrestore.padding={w:T.win.outerWidth()-T.win.width(),h:T.win.outerHeight()-T.win.height()},N.isios4&&(T.zoomrestore.scrollTop=c.scrollTop(),c.scrollTop(0)),T.win.css({position:N.isios4?"absolute":"fixed",top:0,left:0,zIndex:s+100,margin:0});var n=T.win.css("backgroundColor");return(""===n||/transparent|rgba\(0, 0, 0, 0\)|rgba\(0,0,0,0\)/.test(n))&&T.win.css("backgroundColor","#fff"),T.rail.css({zIndex:s+101}),T.zoom.css({zIndex:s+102}),T.zoom.css("backgroundPosition","0 -18px"),T.resizeZoom(),T.onzoomin&&T.onzoomin.call(T),T.cancelEvent(e)}},this.doZoomOut=function(e){if(T.zoomactive)return T.zoomactive=!1,T.win.css("margin",""),T.win.css(T.zoomrestore.style),N.isios4&&c.scrollTop(T.zoomrestore.scrollTop),T.rail.css({"z-index":T.zindex}),T.zoom.css({"z-index":T.zindex}),T.zoomrestore=!1,T.zoom.css("backgroundPosition","0 0"),T.onResize(),T.onzoomout&&T.onzoomout.call(T),T.cancelEvent(e)},this.doZoom=function(e){return T.zoomactive?T.doZoomOut(e):T.doZoomIn(e)},this.resizeZoom=function(){if(T.zoomactive){var e=T.getScrollTop();T.win.css({width:c.width()-T.zoomrestore.padding.w+"px",height:c.height()-T.zoomrestore.padding.h+"px"}),T.onResize(),T.setScrollTop(Math.min(T.page.maxh,e))}},this.init(),n.nicescroll.push(this)},y=function(e){var o=this;this.nc=e,this.lastx=0,this.lasty=0,this.speedx=0,this.speedy=0,this.lasttime=0,this.steptime=0,this.snapx=!1,this.snapy=!1,this.demulx=0,this.demuly=0,this.lastscrollx=-1,this.lastscrolly=-1,this.chkx=0,this.chky=0,this.timer=0,this.reset=function(e,t){o.stop(),o.steptime=0,o.lasttime=f(),o.speedx=0,o.speedy=0,o.lastx=e,o.lasty=t,o.lastscrollx=-1,o.lastscrolly=-1},this.update=function(e,t){var r=f();o.steptime=r-o.lasttime,o.lasttime=r;var i=t-o.lasty,s=e-o.lastx,n=o.nc.getScrollTop()+i,l=o.nc.getScrollLeft()+s;o.snapx=l<0||l>o.nc.page.maxw,o.snapy=n<0||n>o.nc.page.maxh,o.speedx=s,o.speedy=i,o.lastx=e,o.lasty=t},this.stop=function(){o.nc.unsynched("domomentum2d"),o.timer&&clearTimeout(o.timer),o.timer=0,o.lastscrollx=-1,o.lastscrolly=-1},this.doSnapy=function(e,t){var r=!1;t<0?(t=0,r=!0):t>o.nc.page.maxh&&(t=o.nc.page.maxh,r=!0),e<0?(e=0,r=!0):e>o.nc.page.maxw&&(e=o.nc.page.maxw,r=!0),r?o.nc.doScrollPos(e,t,o.nc.opt.snapbackspeed):o.nc.triggerScrollEnd()},this.doMomentum=function(e){var t=f(),r=e?t+e:o.lasttime,i=o.nc.getScrollLeft(),s=o.nc.getScrollTop(),n=o.nc.page.maxh,l=o.nc.page.maxw;o.speedx=l>0?Math.min(60,o.speedx):0,o.speedy=n>0?Math.min(60,o.speedy):0;var a=r&&t-r<=60;(s<0||s>n||i<0||i>l)&&(a=!1);var c=!(!o.speedy||!a)&&o.speedy,d=!(!o.speedx||!a)&&o.speedx;if(c||d){var u=Math.max(16,o.steptime);if(u>50){var h=u/50;o.speedx*=h,o.speedy*=h,u=50}o.demulxy=0,o.lastscrollx=o.nc.getScrollLeft(),o.chkx=o.lastscrollx,o.lastscrolly=o.nc.getScrollTop(),o.chky=o.lastscrolly;var p=o.lastscrollx,m=o.lastscrolly,g=function(){var e=f()-t>600?.04:.02;o.speedx&&(p=Math.floor(o.lastscrollx-o.speedx*(1-o.demulxy)),o.lastscrollx=p,(p<0||p>l)&&(e=.1)),o.speedy&&(m=Math.floor(o.lastscrolly-o.speedy*(1-o.demulxy)),o.lastscrolly=m,(m<0||m>n)&&(e=.1)),o.demulxy=Math.min(1,o.demulxy+e),o.nc.synched("domomentum2d",function(){if(o.speedx){o.nc.getScrollLeft();o.chkx=p,o.nc.setScrollLeft(p)}if(o.speedy){o.nc.getScrollTop();o.chky=m,o.nc.setScrollTop(m)}o.timer||(o.nc.hideCursor(),o.doSnapy(p,m))}),o.demulxy<1?o.timer=setTimeout(g,u):(o.stop(),o.nc.hideCursor(),o.doSnapy(p,m))};g()}else o.doSnapy(o.nc.getScrollLeft(),o.nc.getScrollTop())}},x=e.fn.scrollTop;e.cssHooks.pageYOffset={get:function(e,o,t){var r=n.data(e,"__nicescroll")||!1;return r&&r.ishwscroll?r.getScrollTop():x.call(e)},set:function(e,o){var t=n.data(e,"__nicescroll")||!1;return t&&t.ishwscroll?t.setScrollTop(parseInt(o)):x.call(e,o),this}},e.fn.scrollTop=function(e){if(void 0===e){var o=!!this[0]&&(n.data(this[0],"__nicescroll")||!1);return o&&o.ishwscroll?o.getScrollTop():x.call(this)}return this.each(function(){var o=n.data(this,"__nicescroll")||!1;o&&o.ishwscroll?o.setScrollTop(parseInt(e)):x.call(n(this),e)})};var S=e.fn.scrollLeft;n.cssHooks.pageXOffset={get:function(e,o,t){var r=n.data(e,"__nicescroll")||!1;return r&&r.ishwscroll?r.getScrollLeft():S.call(e)},set:function(e,o){var t=n.data(e,"__nicescroll")||!1;return t&&t.ishwscroll?t.setScrollLeft(parseInt(o)):S.call(e,o),this}},e.fn.scrollLeft=function(e){if(void 0===e){var o=!!this[0]&&(n.data(this[0],"__nicescroll")||!1);return o&&o.ishwscroll?o.getScrollLeft():S.call(this)}return this.each(function(){var o=n.data(this,"__nicescroll")||!1;o&&o.ishwscroll?o.setScrollLeft(parseInt(e)):S.call(n(this),e)})};var z=function(e){var o=this;if(this.length=0,this.name="nicescrollarray",this.each=function(e){return n.each(o,e),o},this.push=function(e){o[o.length]=e,o.length++},this.eq=function(e){return o[e]},e)for(var t=0;t1?n(e,r):s,i.win=r}!("doc"in i)||"win"in i||(i.win=r);var l=r.data("__nicescroll")||!1;l||(i.doc=i.doc||r,l=new b(i,r),r.data("__nicescroll",l)),t.push(l)}),1===t.length?t[0]:t},a.NiceScroll={getjQuery:function(){return e}},n.nicescroll||(n.nicescroll=new z,n.nicescroll.options=g)}); \ No newline at end of file +!function(e){"function"==typeof define&&define.amd?define(["jquery"],e):"object"==typeof exports?module.exports=e(require("jquery")):e(jQuery)}(function(e){"use strict";var o=!1,t=!1,r=0,i=2e3,s=0,n=e,l=document,a=window,c=n(a),d=[],u=a.requestAnimationFrame||a.webkitRequestAnimationFrame||a.mozRequestAnimationFrame||!1,h=a.cancelAnimationFrame||a.webkitCancelAnimationFrame||a.mozCancelAnimationFrame||!1;if(u)a.cancelAnimationFrame||(h=function(e){});else{var p=0;u=function(e,o){var t=(new Date).getTime(),r=Math.max(0,16-(t-p)),i=a.setTimeout(function(){e(t+r)},r);return p=t+r,i},h=function(e){a.clearTimeout(e)}}var m=a.MutationObserver||a.WebKitMutationObserver||!1,f=Date.now||function(){return(new Date).getTime()},g={zindex:"auto",cursoropacitymin:0,cursoropacitymax:1,cursorcolor:"#424242",cursorwidth:"6px",cursorborder:"1px solid #fff",cursorborderradius:"5px",scrollspeed:40,mousescrollstep:27,touchbehavior:!1,emulatetouch:!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 e=l.currentScript||function(){var e=l.getElementsByTagName("script");return!!e.length&&e[e.length-1]}(),o=e?e.src.split("?")[0]:"";return o.split("/").length>0?o.split("/").slice(0,-1).join("/")+"/":""}(),preventmultitouchscrolling:!0,disablemutationobserver:!1,enableobserver:!0,scrollbarid:!1},v=!1,w=function(){if(v)return v;var e=l.createElement("DIV"),o=e.style,t=navigator.userAgent,r=navigator.platform,i={};return i.haspointerlock="pointerLockElement"in l||"webkitPointerLockElement"in l||"mozPointerLockElement"in l,i.isopera="opera"in a,i.isopera12=i.isopera&&"getUserMedia"in navigator,i.isoperamini="[object OperaMini]"===Object.prototype.toString.call(a.operamini),i.isie="all"in l&&"attachEvent"in e&&!i.isopera,i.isieold=i.isie&&!("msInterpolationMode"in o),i.isie7=i.isie&&!i.isieold&&(!("documentMode"in l)||7===l.documentMode),i.isie8=i.isie&&"documentMode"in l&&8===l.documentMode,i.isie9=i.isie&&"performance"in a&&9===l.documentMode,i.isie10=i.isie&&"performance"in a&&10===l.documentMode,i.isie11="msRequestFullscreen"in e&&l.documentMode>=11,i.ismsedge="msCredentials"in a,i.ismozilla="MozAppearance"in o,i.iswebkit=!i.ismsedge&&"WebkitAppearance"in o,i.ischrome=i.iswebkit&&"chrome"in a,i.ischrome38=i.ischrome&&"touchAction"in o,i.ischrome22=!i.ischrome38&&i.ischrome&&i.haspointerlock,i.ischrome26=!i.ischrome38&&i.ischrome&&"transition"in o,i.cantouch="ontouchstart"in l.documentElement||"ontouchstart"in a,i.hasw3ctouch=(a.PointerEvent||!1)&&(navigator.MaxTouchPoints>0||navigator.msMaxTouchPoints>0),i.hasmstouch=!i.hasw3ctouch&&(a.MSPointerEvent||!1),i.ismac=/^mac$/i.test(r),i.isios=i.cantouch&&/iphone|ipad|ipod/i.test(r),i.isios4=i.isios&&!("seal"in Object),i.isios7=i.isios&&"webkitHidden"in l,i.isios8=i.isios&&"hidden"in l,i.isios10=i.isios&&a.Proxy,i.isandroid=/android/i.test(t),i.haseventlistener="addEventListener"in e,i.trstyle=!1,i.hastransform=!1,i.hastranslate3d=!1,i.transitionstyle=!1,i.hastransition=!1,i.transitionend=!1,i.trstyle="transform",i.hastransform="transform"in o||function(){for(var e=["msTransform","webkitTransform","MozTransform","OTransform"],t=0,r=e.length;t0;){if(9==e[0].nodeType)return!1;var o=e.css("zIndex");if(!isNaN(o)&&0!==o)return parseInt(o);e=e.parent()}return!1}function x(e,o,t){var r=e.css(o),i=parseFloat(r);if(isNaN(i)){var s=3==(i=I[r]||0)?t?T.win.outerHeight()-T.win.innerHeight():T.win.outerWidth()-T.win.innerWidth():1;return T.isie8&&i&&(i+=1),s?i:0}return i}function S(e,o,t,r){T._bind(e,o,function(r){var i={original:r=r||a.event,target:r.target||r.srcElement,type:"wheel",deltaMode:"MozMousePixelScroll"==r.type?0:1,deltaX:0,deltaZ:0,preventDefault:function(){return r.preventDefault?r.preventDefault():r.returnValue=!1,!1},stopImmediatePropagation:function(){r.stopImmediatePropagation?r.stopImmediatePropagation():r.cancelBubble=!0}};return"mousewheel"==o?(r.wheelDeltaX&&(i.deltaX=-.025*r.wheelDeltaX),r.wheelDeltaY&&(i.deltaY=-.025*r.wheelDeltaY),!i.deltaY&&!i.deltaX&&(i.deltaY=-.025*r.wheelDelta)):i.deltaY=r.detail,t.call(e,i)},r)}function z(e,o,t,r){T.scrollrunning||(T.newscrolly=T.getScrollTop(),T.newscrollx=T.getScrollLeft(),D=f());var i=f()-D;if(D=f(),i>350?A=1:A+=(2-A)/10,e=e*A|0,o=o*A|0,e){if(r)if(e<0){if(T.getScrollLeft()>=T.page.maxw)return!0}else if(T.getScrollLeft()<=0)return!0;var s=e>0?1:-1;X!==s&&(T.scrollmom&&T.scrollmom.stop(),T.newscrollx=T.getScrollLeft(),X=s),T.lastdeltax-=e}if(o){if(function(){var e=T.getScrollTop();if(o<0){if(e>=T.page.maxh)return!0}else if(e<=0)return!0}()){if(M.nativeparentscrolling&&t&&!T.ispage&&!T.zoomactive)return!0;var n=T.view.h>>1;T.newscrolly<-n?(T.newscrolly=-n,o=-1):T.newscrolly>T.page.maxh+n?(T.newscrolly=T.page.maxh+n,o=1):o=0}var l=o>0?1:-1;B!==l&&(T.scrollmom&&T.scrollmom.stop(),T.newscrolly=T.getScrollTop(),B=l),T.lastdeltay-=o}(o||e)&&T.synched("relativexy",function(){var e=T.lastdeltay+T.newscrolly;T.lastdeltay=0;var o=T.lastdeltax+T.newscrollx;T.lastdeltax=0,T.rail.drag||T.doScrollPos(o,e)})}function k(e,o,t){var r,i;return!(t||!q)||(0===e.deltaMode?(r=-e.deltaX*(M.mousescrollstep/54)|0,i=-e.deltaY*(M.mousescrollstep/54)|0):1===e.deltaMode&&(r=-e.deltaX*M.mousescrollstep*50/80|0,i=-e.deltaY*M.mousescrollstep*50/80|0),o&&M.oneaxismousemode&&0===r&&i&&(r=i,i=0,t&&(r<0?T.getScrollLeft()>=T.page.maxw:T.getScrollLeft()<=0)&&(i=r,r=0)),T.isrtlmode&&(r=-r),z(r,i,t,!0)?void(t&&(q=!0)):(q=!1,e.stopImmediatePropagation(),e.preventDefault()))}var T=this;this.version="3.7.4-g",this.name="nicescroll",this.me=p;var E=n("body"),M=this.opt={doc:E,win:!1};if(n.extend(M,g),M.snapbackspeed=80,e)for(var L in M)void 0!==e[L]&&(M[L]=e[L]);if(M.disablemutationobserver&&(m=!1),this.doc=M.doc,this.iddoc=this.doc&&this.doc[0]?this.doc[0].id||"":"",this.ispage=/^BODY|HTML/.test(M.win?M.win[0].nodeName:this.doc[0].nodeName),this.haswrapper=!1!==M.win,this.win=M.win||(this.ispage?c:this.doc),this.docscroll=this.ispage&&!this.haswrapper?c:this.win,this.body=E,this.viewport=!1,this.isfixed=!1,this.iframe=!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"!=M.autohidemode,this.onmousedown=!1,this.onmouseup=!1,this.onmousemove=!1,this.onmousewheel=!1,this.onkeypress=!1,this.ongesturezoom=!1,this.onclick=!1,this.onscrollstart=!1,this.onscrollend=!1,this.onscrollcancel=!1,this.onzoomin=!1,this.onzoomout=!1,this.view=!1,this.page=!1,this.scroll={x:0,y:0},this.scrollratio={x:0,y:0},this.cursorheight=20,this.scrollvaluemax=0,"auto"==M.rtlmode){var C=this.win[0]==a?this.body:this.win,P=C.css("writing-mode")||C.css("-webkit-writing-mode")||C.css("-ms-writing-mode")||C.css("-moz-writing-mode");"horizontal-tb"==P||"lr-tb"==P||""===P?(this.isrtlmode="rtl"==C.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===M.rtlmode,this.isvertical=!1;if(this.scrollrunning=!1,this.scrollmom=!1,this.observer=!1,this.observerremover=!1,this.observerbody=!1,!1!==M.scrollbarid)this.id=M.scrollbarid;else do{this.id="ascrail"+i++}while(l.getElementById(this.id));this.rail=!1,this.cursor=!1,this.cursorfreezed=!1,this.selectiondrag=!1,this.zoom=!1,this.zoomactive=!1,this.hasfocus=!1,this.hasmousefocus=!1,this.visibility=!0,this.railslocked=!1,this.locked=!1,this.hidden=!1,this.cursoractive=!0,this.wheelprevented=!1,this.overflowx=M.overflowx,this.overflowy=M.overflowy,this.nativescrollingarea=!1,this.checkarea=0,this.events=[],this.saved={},this.delaylist={},this.synclist={},this.lastdeltax=0,this.lastdeltay=0,this.detected=w();var N=n.extend({},this.detected);this.canhwscroll=N.hastransform&&M.hwacceleration,this.ishwscroll=this.canhwscroll&&T.haswrapper,this.isrtlmode?this.isvertical?this.hasreversehr=!(N.iswebkit||N.isie||N.isie11):this.hasreversehr=!(N.iswebkit||N.isie&&!N.isie10&&!N.isie11):this.hasreversehr=!1,this.istouchcapable=!1,N.cantouch||!N.hasw3ctouch&&!N.hasmstouch?!N.cantouch||N.isios||N.isandroid||!N.iswebkit&&!N.ismozilla||(this.istouchcapable=!0):this.istouchcapable=!0,M.enablemouselockapi||(N.hasmousecapture=!1,N.haspointerlock=!1),this.debounced=function(e,o,t){T&&(T.delaylist[e]||!1||(T.delaylist[e]={h:u(function(){T.delaylist[e].fn.call(T),T.delaylist[e]=!1},t)},o.call(T)),T.delaylist[e].fn=o)},this.synched=function(e,o){T.synclist[e]?T.synclist[e]=o:(T.synclist[e]=o,u(function(){T&&(T.synclist[e]&&T.synclist[e].call(T),T.synclist[e]=null)}))},this.unsynched=function(e){T.synclist[e]&&(T.synclist[e]=!1)},this.css=function(e,o){for(var t in o)T.saved.css.push([e,t,e.css(t)]),e.css(t,o[t])},this.scrollTop=function(e){return void 0===e?T.getScrollTop():T.setScrollTop(e)},this.scrollLeft=function(e){return void 0===e?T.getScrollLeft():T.setScrollLeft(e)};var R=function(e,o,t,r,i,s,n){this.st=e,this.ed=o,this.spd=t,this.p1=r||0,this.p2=i||1,this.p3=s||0,this.p4=n||1,this.ts=f(),this.df=o-e};if(R.prototype={B2:function(e){return 3*(1-e)*(1-e)*e},B3:function(e){return 3*(1-e)*e*e},B4:function(e){return e*e*e},getPos:function(){return(f()-this.ts)/this.spd},getNow:function(){var e=(f()-this.ts)/this.spd,o=this.B2(e)+this.B3(e)+this.B4(e);return e>=1?this.ed:this.st+this.df*o|0},update:function(e,o){return this.st=this.getNow(),this.ed=e,this.spd=o,this.ts=f(),this.df=this.ed-this.st,this}},this.ishwscroll){this.doc.translate={x:0,y:0,tx:"0px",ty:"0px"},N.hastranslate3d&&N.isios&&this.doc.css("-webkit-backface-visibility","hidden"),this.getScrollTop=function(e){if(!e){var o=v();if(o)return 16==o.length?-o[13]:-o[5];if(T.timerscroll&&T.timerscroll.bz)return T.timerscroll.bz.getNow()}return T.doc.translate.y},this.getScrollLeft=function(e){if(!e){var o=v();if(o)return 16==o.length?-o[12]:-o[4];if(T.timerscroll&&T.timerscroll.bh)return T.timerscroll.bh.getNow()}return T.doc.translate.x},this.notifyScrollEvent=function(e){var o=l.createEvent("UIEvents");o.initUIEvent("scroll",!1,!1,a,1),o.niceevent=!0,e.dispatchEvent(o)};var _=this.isrtlmode?1:-1;N.hastranslate3d&&M.enabletranslate3d?(this.setScrollTop=function(e,o){T.doc.translate.y=e,T.doc.translate.ty=-1*e+"px",T.doc.css(N.trstyle,"translate3d("+T.doc.translate.tx+","+T.doc.translate.ty+",0)"),o||T.notifyScrollEvent(T.win[0])},this.setScrollLeft=function(e,o){T.doc.translate.x=e,T.doc.translate.tx=e*_+"px",T.doc.css(N.trstyle,"translate3d("+T.doc.translate.tx+","+T.doc.translate.ty+",0)"),o||T.notifyScrollEvent(T.win[0])}):(this.setScrollTop=function(e,o){T.doc.translate.y=e,T.doc.translate.ty=-1*e+"px",T.doc.css(N.trstyle,"translate("+T.doc.translate.tx+","+T.doc.translate.ty+")"),o||T.notifyScrollEvent(T.win[0])},this.setScrollLeft=function(e,o){T.doc.translate.x=e,T.doc.translate.tx=e*_+"px",T.doc.css(N.trstyle,"translate("+T.doc.translate.tx+","+T.doc.translate.ty+")"),o||T.notifyScrollEvent(T.win[0])})}else this.getScrollTop=function(){return T.docscroll.scrollTop()},this.setScrollTop=function(e){T.docscroll.scrollTop(e)},this.getScrollLeft=function(){return T.hasreversehr?T.detected.ismozilla?T.page.maxw-Math.abs(T.docscroll.scrollLeft()):T.page.maxw-T.docscroll.scrollLeft():T.docscroll.scrollLeft()},this.setScrollLeft=function(e){return setTimeout(function(){if(T)return T.hasreversehr&&(e=T.detected.ismozilla?-(T.page.maxw-e):T.page.maxw-e),T.docscroll.scrollLeft(e)},1)};this.getTarget=function(e){return!!e&&(e.target?e.target:!!e.srcElement&&e.srcElement)},this.hasParent=function(e,o){if(!e)return!1;for(var t=e.target||e.srcElement||e||!1;t&&t.id!=o;)t=t.parentNode||!1;return!1!==t};var I={thin:1,medium:3,thick:5};this.getDocumentScrollOffset=function(){return{top:a.pageYOffset||l.documentElement.scrollTop,left:a.pageXOffset||l.documentElement.scrollLeft}},this.getOffset=function(){if(T.isfixed){var e=T.win.offset(),o=T.getDocumentScrollOffset();return e.top-=o.top,e.left-=o.left,e}var t=T.win.offset();if(!T.viewport)return t;var r=T.viewport.offset();return{top:t.top-r.top,left:t.left-r.left}},this.updateScrollBar=function(e){var o,t;if(T.ishwscroll)T.rail.css({height:T.win.innerHeight()-(M.railpadding.top+M.railpadding.bottom)}),T.railh&&T.railh.css({width:T.win.innerWidth()-(M.railpadding.left+M.railpadding.right)});else{var r=T.getOffset();if(o={top:r.top,left:r.left-(M.railpadding.left+M.railpadding.right)},o.top+=x(T.win,"border-top-width",!0),o.left+=T.rail.align?T.win.outerWidth()-x(T.win,"border-right-width")-T.rail.width:x(T.win,"border-left-width"),(t=M.railoffset)&&(t.top&&(o.top+=t.top),t.left&&(o.left+=t.left)),T.railslocked||T.rail.css({top:o.top,left:o.left,height:(e?e.h:T.win.innerHeight())-(M.railpadding.top+M.railpadding.bottom)}),T.zoom&&T.zoom.css({top:o.top+1,left:1==T.rail.align?o.left-20:o.left+T.rail.width+4}),T.railh&&!T.railslocked){o={top:r.top,left:r.left},(t=M.railhoffset)&&(t.top&&(o.top+=t.top),t.left&&(o.left+=t.left));var i=T.railh.align?o.top+x(T.win,"border-top-width",!0)+T.win.innerHeight()-T.railh.height:o.top+x(T.win,"border-top-width",!0),s=o.left+x(T.win,"border-left-width");T.railh.css({top:i-(M.railpadding.top+M.railpadding.bottom),left:s,width:T.railh.width})}}},this.doRailClick=function(e,o,t){var r,i,s,n;T.railslocked||(T.cancelEvent(e),"pageY"in e||(e.pageX=e.clientX+l.documentElement.scrollLeft,e.pageY=e.clientY+l.documentElement.scrollTop),o?(r=t?T.doScrollLeft:T.doScrollTop,s=t?(e.pageX-T.railh.offset().left-T.cursorwidth/2)*T.scrollratio.x:(e.pageY-T.rail.offset().top-T.cursorheight/2)*T.scrollratio.y,T.unsynched("relativexy"),r(0|s)):(r=t?T.doScrollLeftBy:T.doScrollBy,s=t?T.scroll.x:T.scroll.y,n=t?e.pageX-T.railh.offset().left:e.pageY-T.rail.offset().top,i=t?T.view.w:T.view.h,r(s>=n?i:-i)))},T.newscrolly=T.newscrollx=0,T.hasanimationframe="requestAnimationFrame"in a,T.hascancelanimationframe="cancelAnimationFrame"in a,T.hasborderbox=!1,this.init=function(){if(T.saved.css=[],N.isoperamini)return!0;if(N.isandroid&&!("hidden"in l))return!0;M.emulatetouch=M.emulatetouch||M.touchbehavior,T.hasborderbox=a.getComputedStyle&&"border-box"===a.getComputedStyle(l.body)["box-sizing"];var e={"overflow-y":"hidden"};if((N.isie11||N.isie10)&&(e["-ms-overflow-style"]="none"),T.ishwscroll&&(this.doc.css(N.transitionstyle,N.prefixstyle+"transform 0ms ease-out"),N.transitionend&&T.bind(T.doc,N.transitionend,T.onScrollTransitionEnd,!1)),T.zindex="auto",T.ispage||"auto"!=M.zindex?T.zindex=M.zindex:T.zindex=b()||"auto",!T.ispage&&"auto"!=T.zindex&&T.zindex>s&&(s=T.zindex),T.isie&&0===T.zindex&&"auto"==M.zindex&&(T.zindex="auto"),!T.ispage||!N.isieold){var i=T.docscroll;T.ispage&&(i=T.haswrapper?T.win:T.doc),T.css(i,e),T.ispage&&(N.isie11||N.isie)&&T.css(n("html"),e),!N.isios||T.ispage||T.haswrapper||T.css(E,{"-webkit-overflow-scrolling":"touch"});var d=n(l.createElement("div"));d.css({position:"relative",top:0,float:"right",width:M.cursorwidth,height:0,"background-color":M.cursorcolor,border:M.cursorborder,"background-clip":"padding-box","-webkit-border-radius":M.cursorborderradius,"-moz-border-radius":M.cursorborderradius,"border-radius":M.cursorborderradius}),d.addClass("nicescroll-cursors"),T.cursor=d;var u=n(l.createElement("div"));u.attr("id",T.id),u.addClass("nicescroll-rails nicescroll-rails-vr");var h,p,f=["left","right","top","bottom"];for(var g in f)p=f[g],(h=M.railpadding[p]||0)&&u.css("padding-"+p,h+"px");u.append(d),u.width=Math.max(parseFloat(M.cursorwidth),d.outerWidth()),u.css({width:u.width+"px",zIndex:T.zindex,background:M.background,cursor:"default"}),u.visibility=!0,u.scrollable=!0,u.align="left"==M.railalign?0:1,T.rail=u,T.rail.drag=!1;var v=!1;!M.boxzoom||T.ispage||N.isieold||(v=l.createElement("div"),T.bind(v,"click",T.doZoom),T.bind(v,"mouseenter",function(){T.zoom.css("opacity",M.cursoropacitymax)}),T.bind(v,"mouseleave",function(){T.zoom.css("opacity",M.cursoropacitymin)}),T.zoom=n(v),T.zoom.css({cursor:"pointer",zIndex:T.zindex,backgroundImage:"url("+M.scriptpath+"zoomico.png)",height:18,width:18,backgroundPosition:"0 0"}),M.dblclickzoom&&T.bind(T.win,"dblclick",T.doZoom),N.cantouch&&M.gesturezoom&&(T.ongesturezoom=function(e){return e.scale>1.5&&T.doZoomIn(e),e.scale<.8&&T.doZoomOut(e),T.cancelEvent(e)},T.bind(T.win,"gestureend",T.ongesturezoom))),T.railh=!1;var w;if(M.horizrailenabled&&(T.css(i,{overflowX:"hidden"}),(d=n(l.createElement("div"))).css({position:"absolute",top:0,height:M.cursorwidth,width:0,backgroundColor:M.cursorcolor,border:M.cursorborder,backgroundClip:"padding-box","-webkit-border-radius":M.cursorborderradius,"-moz-border-radius":M.cursorborderradius,"border-radius":M.cursorborderradius}),N.isieold&&d.css("overflow","hidden"),d.addClass("nicescroll-cursors"),T.cursorh=d,(w=n(l.createElement("div"))).attr("id",T.id+"-hr"),w.addClass("nicescroll-rails nicescroll-rails-hr"),w.height=Math.max(parseFloat(M.cursorwidth),d.outerHeight()),w.css({height:w.height+"px",zIndex:T.zindex,background:M.background}),w.append(d),w.visibility=!0,w.scrollable=!0,w.align="top"==M.railvalign?0:1,T.railh=w,T.railh.drag=!1),T.ispage)u.css({position:"fixed",top:0,height:"100%"}),u.css(u.align?{right:0}:{left:0}),T.body.append(u),T.railh&&(w.css({position:"fixed",left:0,width:"100%"}),w.css(w.align?{bottom:0}:{top:0}),T.body.append(w));else{if(T.ishwscroll){"static"==T.win.css("position")&&T.css(T.win,{position:"relative"});var x="HTML"==T.win[0].nodeName?T.body:T.win;n(x).scrollTop(0).scrollLeft(0),T.zoom&&(T.zoom.css({position:"absolute",top:1,right:0,"margin-right":u.width+4}),x.append(T.zoom)),u.css({position:"absolute",top:0}),u.css(u.align?{right:0}:{left:0}),x.append(u),w&&(w.css({position:"absolute",left:0,bottom:0}),w.css(w.align?{bottom:0}:{top:0}),x.append(w))}else{T.isfixed="fixed"==T.win.css("position");var S=T.isfixed?"fixed":"absolute";T.isfixed||(T.viewport=T.getViewport(T.win[0])),T.viewport&&(T.body=T.viewport,/fixed|absolute/.test(T.viewport.css("position"))||T.css(T.viewport,{position:"relative"})),u.css({position:S}),T.zoom&&T.zoom.css({position:S}),T.updateScrollBar(),T.body.append(u),T.zoom&&T.body.append(T.zoom),T.railh&&(w.css({position:S}),T.body.append(w))}N.isios&&T.css(T.win,{"-webkit-tap-highlight-color":"rgba(0,0,0,0)","-webkit-touch-callout":"none"}),M.disableoutline&&(N.isie&&T.win.attr("hideFocus","true"),N.iswebkit&&T.win.css("outline","none"))}if(!1===M.autohidemode?(T.autohidedom=!1,T.rail.css({opacity:M.cursoropacitymax}),T.railh&&T.railh.css({opacity:M.cursoropacitymax})):!0===M.autohidemode||"leave"===M.autohidemode?(T.autohidedom=n().add(T.rail),N.isie8&&(T.autohidedom=T.autohidedom.add(T.cursor)),T.railh&&(T.autohidedom=T.autohidedom.add(T.railh)),T.railh&&N.isie8&&(T.autohidedom=T.autohidedom.add(T.cursorh))):"scroll"==M.autohidemode?(T.autohidedom=n().add(T.rail),T.railh&&(T.autohidedom=T.autohidedom.add(T.railh))):"cursor"==M.autohidemode?(T.autohidedom=n().add(T.cursor),T.railh&&(T.autohidedom=T.autohidedom.add(T.cursorh))):"hidden"==M.autohidemode&&(T.autohidedom=!1,T.hide(),T.railslocked=!1),N.cantouch||T.istouchcapable||M.emulatetouch||N.hasmstouch){T.scrollmom=new y(T);T.ontouchstart=function(e){if(T.locked)return!1;if(e.pointerType&&("mouse"===e.pointerType||e.pointerType===e.MSPOINTER_TYPE_MOUSE))return!1;if(T.hasmoving=!1,T.scrollmom.timer&&(T.triggerScrollEnd(),T.scrollmom.stop()),!T.railslocked){var o=T.getTarget(e);if(o&&/INPUT/i.test(o.nodeName)&&/range/i.test(o.type))return T.stopPropagation(e);var t="mousedown"===e.type;if(!("clientX"in e)&&"changedTouches"in e&&(e.clientX=e.changedTouches[0].clientX,e.clientY=e.changedTouches[0].clientY),T.forcescreen){var r=e;(e={original:e.original?e.original:e}).clientX=r.screenX,e.clientY=r.screenY}if(T.rail.drag={x:e.clientX,y:e.clientY,sx:T.scroll.x,sy:T.scroll.y,st:T.getScrollTop(),sl:T.getScrollLeft(),pt:2,dl:!1,tg:o},T.ispage||!M.directionlockdeadzone)T.rail.drag.dl="f";else{var i={w:c.width(),h:c.height()},s=T.getContentSize(),l=s.h-i.h,a=s.w-i.w;T.rail.scrollable&&!T.railh.scrollable?T.rail.drag.ck=l>0&&"v":!T.rail.scrollable&&T.railh.scrollable?T.rail.drag.ck=a>0&&"h":T.rail.drag.ck=!1}if(M.emulatetouch&&T.isiframe&&N.isie){var d=T.win.position();T.rail.drag.x+=d.left,T.rail.drag.y+=d.top}if(T.hasmoving=!1,T.lastmouseup=!1,T.scrollmom.reset(e.clientX,e.clientY),o&&t){if(!/INPUT|SELECT|BUTTON|TEXTAREA/i.test(o.nodeName))return N.hasmousecapture&&o.setCapture(),M.emulatetouch?(o.onclick&&!o._onclick&&(o._onclick=o.onclick,o.onclick=function(e){if(T.hasmoving)return!1;o._onclick.call(this,e)}),T.cancelEvent(e)):T.stopPropagation(e);/SUBMIT|CANCEL|BUTTON/i.test(n(o).attr("type"))&&(T.preventclick={tg:o,click:!1})}}},T.ontouchend=function(e){if(!T.rail.drag)return!0;if(2==T.rail.drag.pt){if(e.pointerType&&("mouse"===e.pointerType||e.pointerType===e.MSPOINTER_TYPE_MOUSE))return!1;T.rail.drag=!1;var o="mouseup"===e.type;if(T.hasmoving&&(T.scrollmom.doMomentum(),T.lastmouseup=!0,T.hideCursor(),N.hasmousecapture&&l.releaseCapture(),o))return T.cancelEvent(e)}else if(1==T.rail.drag.pt)return T.onmouseup(e)};var z=M.emulatetouch&&T.isiframe&&!N.hasmousecapture,k=.3*M.directionlockdeadzone|0;T.ontouchmove=function(e,o){if(!T.rail.drag)return!0;if(e.targetTouches&&M.preventmultitouchscrolling&&e.targetTouches.length>1)return!0;if(e.pointerType&&("mouse"===e.pointerType||e.pointerType===e.MSPOINTER_TYPE_MOUSE))return!0;if(2==T.rail.drag.pt){"changedTouches"in e&&(e.clientX=e.changedTouches[0].clientX,e.clientY=e.changedTouches[0].clientY);var t,r;if(r=t=0,z&&!o){var i=T.win.position();r=-i.left,t=-i.top}var s=e.clientY+t,n=s-T.rail.drag.y,a=e.clientX+r,c=a-T.rail.drag.x,d=T.rail.drag.st-n;if(T.ishwscroll&&M.bouncescroll)d<0?d=Math.round(d/2):d>T.page.maxh&&(d=T.page.maxh+Math.round((d-T.page.maxh)/2));else if(d<0?(d=0,s=0):d>T.page.maxh&&(d=T.page.maxh,s=0),0===s&&!T.hasmoving)return T.ispage||(T.rail.drag=!1),!0;var u=T.getScrollLeft();if(T.railh&&T.railh.scrollable&&(u=T.isrtlmode?c-T.rail.drag.sl:T.rail.drag.sl-c,T.ishwscroll&&M.bouncescroll?u<0?u=Math.round(u/2):u>T.page.maxw&&(u=T.page.maxw+Math.round((u-T.page.maxw)/2)):(u<0&&(u=0,a=0),u>T.page.maxw&&(u=T.page.maxw,a=0))),!T.hasmoving){if(T.rail.drag.y===e.clientY&&T.rail.drag.x===e.clientX)return T.cancelEvent(e);var h=Math.abs(n),p=Math.abs(c),m=M.directionlockdeadzone;if(T.rail.drag.ck?"v"==T.rail.drag.ck?p>m&&h<=k?T.rail.drag=!1:h>m&&(T.rail.drag.dl="v"):"h"==T.rail.drag.ck&&(h>m&&p<=k?T.rail.drag=!1:p>m&&(T.rail.drag.dl="h")):h>m&&p>m?T.rail.drag.dl="f":h>m?T.rail.drag.dl=p>k?"f":"v":p>m&&(T.rail.drag.dl=h>k?"f":"h"),!T.rail.drag.dl)return T.cancelEvent(e);T.triggerScrollStart(e.clientX,e.clientY,0,0,0),T.hasmoving=!0}return T.preventclick&&!T.preventclick.click&&(T.preventclick.click=T.preventclick.tg.onclick||!1,T.preventclick.tg.onclick=T.onpreventclick),T.rail.drag.dl&&("v"==T.rail.drag.dl?u=T.rail.drag.sl:"h"==T.rail.drag.dl&&(d=T.rail.drag.st)),T.synched("touchmove",function(){T.rail.drag&&2==T.rail.drag.pt&&(T.prepareTransition&&T.resetTransition(),T.rail.scrollable&&T.setScrollTop(d),T.scrollmom.update(a,s),T.railh&&T.railh.scrollable?(T.setScrollLeft(u),T.showCursor(d,u)):T.showCursor(d),N.isie10&&l.selection.clear())}),T.cancelEvent(e)}return 1==T.rail.drag.pt?T.onmousemove(e):void 0},T.ontouchstartCursor=function(e,o){if(!T.rail.drag||3==T.rail.drag.pt){if(T.locked)return T.cancelEvent(e);T.cancelScroll(),T.rail.drag={x:e.touches[0].clientX,y:e.touches[0].clientY,sx:T.scroll.x,sy:T.scroll.y,pt:3,hr:!!o};var t=T.getTarget(e);return!T.ispage&&N.hasmousecapture&&t.setCapture(),T.isiframe&&!N.hasmousecapture&&(T.saved.csspointerevents=T.doc.css("pointer-events"),T.css(T.doc,{"pointer-events":"none"})),T.cancelEvent(e)}},T.ontouchendCursor=function(e){if(T.rail.drag){if(N.hasmousecapture&&l.releaseCapture(),T.isiframe&&!N.hasmousecapture&&T.doc.css("pointer-events",T.saved.csspointerevents),3!=T.rail.drag.pt)return;return T.rail.drag=!1,T.cancelEvent(e)}},T.ontouchmoveCursor=function(e){if(T.rail.drag){if(3!=T.rail.drag.pt)return;if(T.cursorfreezed=!0,T.rail.drag.hr){T.scroll.x=T.rail.drag.sx+(e.touches[0].clientX-T.rail.drag.x),T.scroll.x<0&&(T.scroll.x=0);var o=T.scrollvaluemaxw;T.scroll.x>o&&(T.scroll.x=o)}else{T.scroll.y=T.rail.drag.sy+(e.touches[0].clientY-T.rail.drag.y),T.scroll.y<0&&(T.scroll.y=0);var t=T.scrollvaluemax;T.scroll.y>t&&(T.scroll.y=t)}return T.synched("touchmove",function(){T.rail.drag&&3==T.rail.drag.pt&&(T.showCursor(),T.rail.drag.hr?T.doScrollLeft(Math.round(T.scroll.x*T.scrollratio.x),M.cursordragspeed):T.doScrollTop(Math.round(T.scroll.y*T.scrollratio.y),M.cursordragspeed))}),T.cancelEvent(e)}}}if(T.onmousedown=function(e,o){if(!T.rail.drag||1==T.rail.drag.pt){if(T.railslocked)return T.cancelEvent(e);T.cancelScroll(),T.rail.drag={x:e.clientX,y:e.clientY,sx:T.scroll.x,sy:T.scroll.y,pt:1,hr:o||!1};var t=T.getTarget(e);return N.hasmousecapture&&t.setCapture(),T.isiframe&&!N.hasmousecapture&&(T.saved.csspointerevents=T.doc.css("pointer-events"),T.css(T.doc,{"pointer-events":"none"})),T.hasmoving=!1,T.cancelEvent(e)}},T.onmouseup=function(e){if(T.rail.drag)return 1!=T.rail.drag.pt||(N.hasmousecapture&&l.releaseCapture(),T.isiframe&&!N.hasmousecapture&&T.doc.css("pointer-events",T.saved.csspointerevents),T.rail.drag=!1,T.cursorfreezed=!1,T.hasmoving&&T.triggerScrollEnd(),T.cancelEvent(e))},T.onmousemove=function(e){if(T.rail.drag){if(1!==T.rail.drag.pt)return;if(N.ischrome&&0===e.which)return T.onmouseup(e);if(T.cursorfreezed=!0,T.hasmoving||T.triggerScrollStart(e.clientX,e.clientY,0,0,0),T.hasmoving=!0,T.rail.drag.hr){T.scroll.x=T.rail.drag.sx+(e.clientX-T.rail.drag.x),T.scroll.x<0&&(T.scroll.x=0);var o=T.scrollvaluemaxw;T.scroll.x>o&&(T.scroll.x=o)}else{T.scroll.y=T.rail.drag.sy+(e.clientY-T.rail.drag.y),T.scroll.y<0&&(T.scroll.y=0);var t=T.scrollvaluemax;T.scroll.y>t&&(T.scroll.y=t)}return T.synched("mousemove",function(){T.cursorfreezed&&(T.showCursor(),T.rail.drag.hr?T.scrollLeft(Math.round(T.scroll.x*T.scrollratio.x)):T.scrollTop(Math.round(T.scroll.y*T.scrollratio.y)))}),T.cancelEvent(e)}T.checkarea=0},N.cantouch||M.emulatetouch)T.onpreventclick=function(e){if(T.preventclick)return T.preventclick.tg.onclick=T.preventclick.click,T.preventclick=!1,T.cancelEvent(e)},T.onclick=!N.isios&&function(e){return!T.lastmouseup||(T.lastmouseup=!1,T.cancelEvent(e))},M.grabcursorenabled&&N.cursorgrabvalue&&(T.css(T.ispage?T.doc:T.win,{cursor:N.cursorgrabvalue}),T.css(T.rail,{cursor:N.cursorgrabvalue}));else{var L=function(e){if(T.selectiondrag){if(e){var o=T.win.outerHeight(),t=e.pageY-T.selectiondrag.top;t>0&&t=o&&(t-=o),T.selectiondrag.df=t}if(0!==T.selectiondrag.df){var r=-2*T.selectiondrag.df/6|0;T.doScrollBy(r),T.debounced("doselectionscroll",function(){L()},50)}}};T.hasTextSelected="getSelection"in l?function(){return l.getSelection().rangeCount>0}:"selection"in l?function(){return"None"!=l.selection.type}:function(){return!1},T.onselectionstart=function(e){T.ispage||(T.selectiondrag=T.win.offset())},T.onselectionend=function(e){T.selectiondrag=!1},T.onselectiondrag=function(e){T.selectiondrag&&T.hasTextSelected()&&T.debounced("selectionscroll",function(){L(e)},250)}}if(N.hasw3ctouch?(T.css(T.ispage?n("html"):T.win,{"touch-action":"none"}),T.css(T.rail,{"touch-action":"none"}),T.css(T.cursor,{"touch-action":"none"}),T.bind(T.win,"pointerdown",T.ontouchstart),T.bind(l,"pointerup",T.ontouchend),T.delegate(l,"pointermove",T.ontouchmove)):N.hasmstouch?(T.css(T.ispage?n("html"):T.win,{"-ms-touch-action":"none"}),T.css(T.rail,{"-ms-touch-action":"none"}),T.css(T.cursor,{"-ms-touch-action":"none"}),T.bind(T.win,"MSPointerDown",T.ontouchstart),T.bind(l,"MSPointerUp",T.ontouchend),T.delegate(l,"MSPointerMove",T.ontouchmove),T.bind(T.cursor,"MSGestureHold",function(e){e.preventDefault()}),T.bind(T.cursor,"contextmenu",function(e){e.preventDefault()})):N.cantouch&&(T.bind(T.win,"touchstart",T.ontouchstart,!1,!0),T.bind(l,"touchend",T.ontouchend,!1,!0),T.bind(l,"touchcancel",T.ontouchend,!1,!0),T.delegate(l,"touchmove",T.ontouchmove,!1,!0)),M.emulatetouch&&(T.bind(T.win,"mousedown",T.ontouchstart,!1,!0),T.bind(l,"mouseup",T.ontouchend,!1,!0),T.bind(l,"mousemove",T.ontouchmove,!1,!0)),(M.cursordragontouch||!N.cantouch&&!M.emulatetouch)&&(T.rail.css({cursor:"default"}),T.railh&&T.railh.css({cursor:"default"}),T.jqbind(T.rail,"mouseenter",function(){if(!T.ispage&&!T.win.is(":visible"))return!1;T.canshowonmouseevent&&T.showCursor(),T.rail.active=!0}),T.jqbind(T.rail,"mouseleave",function(){T.rail.active=!1,T.rail.drag||T.hideCursor()}),M.sensitiverail&&(T.bind(T.rail,"click",function(e){T.doRailClick(e,!1,!1)}),T.bind(T.rail,"dblclick",function(e){T.doRailClick(e,!0,!1)}),T.bind(T.cursor,"click",function(e){T.cancelEvent(e)}),T.bind(T.cursor,"dblclick",function(e){T.cancelEvent(e)})),T.railh&&(T.jqbind(T.railh,"mouseenter",function(){if(!T.ispage&&!T.win.is(":visible"))return!1;T.canshowonmouseevent&&T.showCursor(),T.rail.active=!0}),T.jqbind(T.railh,"mouseleave",function(){T.rail.active=!1,T.rail.drag||T.hideCursor()}),M.sensitiverail&&(T.bind(T.railh,"click",function(e){T.doRailClick(e,!1,!0)}),T.bind(T.railh,"dblclick",function(e){T.doRailClick(e,!0,!0)}),T.bind(T.cursorh,"click",function(e){T.cancelEvent(e)}),T.bind(T.cursorh,"dblclick",function(e){T.cancelEvent(e)})))),M.cursordragontouch&&(this.istouchcapable||N.cantouch)&&(T.bind(T.cursor,"touchstart",T.ontouchstartCursor),T.bind(T.cursor,"touchmove",T.ontouchmoveCursor),T.bind(T.cursor,"touchend",T.ontouchendCursor),T.cursorh&&T.bind(T.cursorh,"touchstart",function(e){T.ontouchstartCursor(e,!0)}),T.cursorh&&T.bind(T.cursorh,"touchmove",T.ontouchmoveCursor),T.cursorh&&T.bind(T.cursorh,"touchend",T.ontouchendCursor)),N.cantouch||M.emulatetouch?(T.bind(N.hasmousecapture?T.win:l,"mouseup",T.ontouchend),T.onclick&&T.bind(l,"click",T.onclick),M.cursordragontouch?(T.bind(T.cursor,"mousedown",T.onmousedown),T.bind(T.cursor,"mouseup",T.onmouseup),T.cursorh&&T.bind(T.cursorh,"mousedown",function(e){T.onmousedown(e,!0)}),T.cursorh&&T.bind(T.cursorh,"mouseup",T.onmouseup)):(T.bind(T.rail,"mousedown",function(e){e.preventDefault()}),T.railh&&T.bind(T.railh,"mousedown",function(e){e.preventDefault()}))):(T.bind(N.hasmousecapture?T.win:l,"mouseup",T.onmouseup),T.bind(l,"mousemove",T.onmousemove),T.onclick&&T.bind(l,"click",T.onclick),T.bind(T.cursor,"mousedown",T.onmousedown),T.bind(T.cursor,"mouseup",T.onmouseup),T.railh&&(T.bind(T.cursorh,"mousedown",function(e){T.onmousedown(e,!0)}),T.bind(T.cursorh,"mouseup",T.onmouseup)),!T.ispage&&M.enablescrollonselection&&(T.bind(T.win[0],"mousedown",T.onselectionstart),T.bind(l,"mouseup",T.onselectionend),T.bind(T.cursor,"mouseup",T.onselectionend),T.cursorh&&T.bind(T.cursorh,"mouseup",T.onselectionend),T.bind(l,"mousemove",T.onselectiondrag)),T.zoom&&(T.jqbind(T.zoom,"mouseenter",function(){T.canshowonmouseevent&&T.showCursor(),T.rail.active=!0}),T.jqbind(T.zoom,"mouseleave",function(){T.rail.active=!1,T.rail.drag||T.hideCursor()}))),M.enablemousewheel&&(T.isiframe||T.mousewheel(N.isie&&T.ispage?l:T.win,T.onmousewheel),T.mousewheel(T.rail,T.onmousewheel),T.railh&&T.mousewheel(T.railh,T.onmousewheelhr)),T.ispage||N.cantouch||/HTML|^BODY/.test(T.win[0].nodeName)||(T.win.attr("tabindex")||T.win.attr({tabindex:++r}),T.bind(T.win,"focus",function(e){o=T.getTarget(e).id||T.getTarget(e)||!1,T.hasfocus=!0,T.canshowonmouseevent&&T.noticeCursor()}),T.bind(T.win,"blur",function(e){o=!1,T.hasfocus=!1}),T.bind(T.win,"mouseenter",function(e){t=T.getTarget(e).id||T.getTarget(e)||!1,T.hasmousefocus=!0,T.canshowonmouseevent&&T.noticeCursor()}),T.bind(T.win,"mouseleave",function(e){t=!1,T.hasmousefocus=!1,T.rail.drag||T.hideCursor()})),T.onkeypress=function(e){if(T.railslocked&&0===T.page.maxh)return!0;e=e||a.event;var r=T.getTarget(e);if(r&&/INPUT|TEXTAREA|SELECT|OPTION/.test(r.nodeName)&&(!(r.getAttribute("type")||r.type||!1)||!/submit|button|cancel/i.tp))return!0;if(n(r).attr("contenteditable"))return!0;if(T.hasfocus||T.hasmousefocus&&!o||T.ispage&&!o&&!t){var i=e.keyCode;if(T.railslocked&&27!=i)return T.cancelEvent(e);var s=e.ctrlKey||!1,l=e.shiftKey||!1,c=!1;switch(i){case 38:case 63233:T.doScrollBy(72),c=!0;break;case 40:case 63235:T.doScrollBy(-72),c=!0;break;case 37:case 63232:T.railh&&(s?T.doScrollLeft(0):T.doScrollLeftBy(72),c=!0);break;case 39:case 63234:T.railh&&(s?T.doScrollLeft(T.page.maxw):T.doScrollLeftBy(-72),c=!0);break;case 33:case 63276:T.doScrollBy(T.view.h),c=!0;break;case 34:case 63277:T.doScrollBy(-T.view.h),c=!0;break;case 36:case 63273:T.railh&&s?T.doScrollPos(0,0):T.doScrollTo(0),c=!0;break;case 35:case 63275:T.railh&&s?T.doScrollPos(T.page.maxw,T.page.maxh):T.doScrollTo(T.page.maxh),c=!0;break;case 32:M.spacebarenabled&&(l?T.doScrollBy(T.view.h):T.doScrollBy(-T.view.h),c=!0);break;case 27:T.zoomactive&&(T.doZoom(),c=!0)}if(c)return T.cancelEvent(e)}},M.enablekeyboard&&T.bind(l,N.isopera&&!N.isopera12?"keypress":"keydown",T.onkeypress),T.bind(l,"keydown",function(e){(e.ctrlKey||!1)&&(T.wheelprevented=!0)}),T.bind(l,"keyup",function(e){e.ctrlKey||!1||(T.wheelprevented=!1)}),T.bind(a,"blur",function(e){T.wheelprevented=!1}),T.bind(a,"resize",T.onscreenresize),T.bind(a,"orientationchange",T.onscreenresize),T.bind(a,"load",T.lazyResize),N.ischrome&&!T.ispage&&!T.haswrapper){var C=T.win.attr("style"),P=parseFloat(T.win.css("width"))+1;T.win.css("width",P),T.synched("chromefix",function(){T.win.attr("style",C)})}T.onAttributeChange=function(e){T.lazyResize(T.isieold?250:30)},M.enableobserver&&(T.isie11||!1===m||(T.observerbody=new m(function(e){if(e.forEach(function(e){if("attributes"==e.type)return E.hasClass("modal-open")&&E.hasClass("modal-dialog")&&!n.contains(n(".modal-dialog")[0],T.doc[0])?T.hide():T.show()}),T.me.clientWidth!=T.page.width||T.me.clientHeight!=T.page.height)return T.lazyResize(30)}),T.observerbody.observe(l.body,{childList:!0,subtree:!0,characterData:!1,attributes:!0,attributeFilter:["class"]})),T.ispage||T.haswrapper||(!1!==m?(T.observer=new m(function(e){e.forEach(T.onAttributeChange)}),T.observer.observe(T.win[0],{childList:!0,characterData:!1,attributes:!0,subtree:!1}),T.observerremover=new m(function(e){e.forEach(function(e){if(e.removedNodes.length>0)for(var o in e.removedNodes)if(T&&e.removedNodes[o]==T.win[0])return T.remove()})}),T.observerremover.observe(T.win[0].parentNode,{childList:!0,characterData:!1,attributes:!1,subtree:!1})):(T.bind(T.win,N.isie&&!N.isie9?"propertychange":"DOMAttrModified",T.onAttributeChange),N.isie9&&T.win[0].attachEvent("onpropertychange",T.onAttributeChange),T.bind(T.win,"DOMNodeRemoved",function(e){e.target==T.win[0]&&T.remove()})))),!T.ispage&&M.boxzoom&&T.bind(a,"resize",T.resizeZoom),T.istextarea&&(T.bind(T.win,"keydown",T.lazyResize),T.bind(T.win,"mouseup",T.lazyResize)),T.lazyResize(30)}if("IFRAME"==this.doc[0].nodeName){var R=function(){T.iframexd=!1;var o;try{(o="contentDocument"in this?this.contentDocument:this.contentWindow._doc).domain}catch(e){T.iframexd=!0,o=!1}if(T.iframexd)return"console"in a&&console.log("NiceScroll error: policy restriced iframe"),!0;if(T.forcescreen=!0,T.isiframe&&(T.iframe={doc:n(o),html:T.doc.contents().find("html")[0],body:T.doc.contents().find("body")[0]},T.getContentSize=function(){return{w:Math.max(T.iframe.html.scrollWidth,T.iframe.body.scrollWidth),h:Math.max(T.iframe.html.scrollHeight,T.iframe.body.scrollHeight)}},T.docscroll=n(T.iframe.body)),!N.isios&&M.iframeautoresize&&!T.isiframe){T.win.scrollTop(0),T.doc.height("");var t=Math.max(o.getElementsByTagName("html")[0].scrollHeight,o.body.scrollHeight);T.doc.height(t)}T.lazyResize(30),T.css(n(T.iframe.body),e),N.isios&&T.haswrapper&&T.css(n(o.body),{"-webkit-transform":"translate3d(0,0,0)"}),"contentWindow"in this?T.bind(this.contentWindow,"scroll",T.onscroll):T.bind(o,"scroll",T.onscroll),M.enablemousewheel&&T.mousewheel(o,T.onmousewheel),M.enablekeyboard&&T.bind(o,N.isopera?"keypress":"keydown",T.onkeypress),N.cantouch?(T.bind(o,"touchstart",T.ontouchstart),T.bind(o,"touchmove",T.ontouchmove)):M.emulatetouch&&(T.bind(o,"mousedown",T.ontouchstart),T.bind(o,"mousemove",function(e){return T.ontouchmove(e,!0)}),M.grabcursorenabled&&N.cursorgrabvalue&&T.css(n(o.body),{cursor:N.cursorgrabvalue})),T.bind(o,"mouseup",T.ontouchend),T.zoom&&(M.dblclickzoom&&T.bind(o,"dblclick",T.doZoom),T.ongesturezoom&&T.bind(o,"gestureend",T.ongesturezoom))};this.doc[0].readyState&&"complete"===this.doc[0].readyState&&setTimeout(function(){R.call(T.doc[0],!1)},500),T.bind(this.doc,"load",R)}},this.showCursor=function(e,o){if(T.cursortimeout&&(clearTimeout(T.cursortimeout),T.cursortimeout=0),T.rail){if(T.autohidedom&&(T.autohidedom.stop().css({opacity:M.cursoropacitymax}),T.cursoractive=!0),T.rail.drag&&1==T.rail.drag.pt||(void 0!==e&&!1!==e&&(T.scroll.y=e/T.scrollratio.y|0),void 0!==o&&(T.scroll.x=o/T.scrollratio.x|0)),T.cursor.css({height:T.cursorheight,top:T.scroll.y}),T.cursorh){var t=T.hasreversehr?T.scrollvaluemaxw-T.scroll.x:T.scroll.x;T.cursorh.css({width:T.cursorwidth,left:!T.rail.align&&T.rail.visibility?t+T.rail.width:t}),T.cursoractive=!0}T.zoom&&T.zoom.stop().css({opacity:M.cursoropacitymax})}},this.hideCursor=function(e){T.cursortimeout||T.rail&&T.autohidedom&&(T.hasmousefocus&&"leave"===M.autohidemode||(T.cursortimeout=setTimeout(function(){T.rail.active&&T.showonmouseevent||(T.autohidedom.stop().animate({opacity:M.cursoropacitymin}),T.zoom&&T.zoom.stop().animate({opacity:M.cursoropacitymin}),T.cursoractive=!1),T.cursortimeout=0},e||M.hidecursordelay)))},this.noticeCursor=function(e,o,t){T.showCursor(o,t),T.rail.active||T.hideCursor(e)},this.getContentSize=T.ispage?function(){return{w:Math.max(l.body.scrollWidth,l.documentElement.scrollWidth),h:Math.max(l.body.scrollHeight,l.documentElement.scrollHeight)}}:T.haswrapper?function(){return{w:T.doc[0].offsetWidth,h:T.doc[0].offsetHeight}}:function(){return{w:T.docscroll[0].scrollWidth,h:T.docscroll[0].scrollHeight}},this.onResize=function(e,o){if(!T||!T.win)return!1;var t=T.page.maxh,r=T.page.maxw,i=T.view.h,s=T.view.w;if(T.view={w:T.ispage?T.win.width():T.win[0].clientWidth,h:T.ispage?T.win.height():T.win[0].clientHeight},T.page=o||T.getContentSize(),T.page.maxh=Math.max(0,T.page.h-T.view.h),T.page.maxw=Math.max(0,T.page.w-T.view.w),T.page.maxh==t&&T.page.maxw==r&&T.view.w==s&&T.view.h==i){if(T.ispage)return T;var n=T.win.offset();if(T.lastposition){var l=T.lastposition;if(l.top==n.top&&l.left==n.left)return T}T.lastposition=n}return 0===T.page.maxh?(T.hideRail(),T.scrollvaluemax=0,T.scroll.y=0,T.scrollratio.y=0,T.cursorheight=0,T.setScrollTop(0),T.rail&&(T.rail.scrollable=!1)):(T.page.maxh-=M.railpadding.top+M.railpadding.bottom,T.rail.scrollable=!0),0===T.page.maxw?(T.hideRailHr(),T.scrollvaluemaxw=0,T.scroll.x=0,T.scrollratio.x=0,T.cursorwidth=0,T.setScrollLeft(0),T.railh&&(T.railh.scrollable=!1)):(T.page.maxw-=M.railpadding.left+M.railpadding.right,T.railh&&(T.railh.scrollable=M.horizrailenabled)),T.railslocked=T.locked||0===T.page.maxh&&0===T.page.maxw,T.railslocked?(T.ispage||T.updateScrollBar(T.view),!1):(T.hidden||T.visibility?!T.railh||T.hidden||T.railh.visibility||T.showRailHr():T.showRail().showRailHr(),T.istextarea&&T.win.css("resize")&&"none"!=T.win.css("resize")&&(T.view.h-=20),T.cursorheight=Math.min(T.view.h,Math.round(T.view.h*(T.view.h/T.page.h))),T.cursorheight=M.cursorfixedheight?M.cursorfixedheight:Math.max(M.cursorminheight,T.cursorheight),T.cursorwidth=Math.min(T.view.w,Math.round(T.view.w*(T.view.w/T.page.w))),T.cursorwidth=M.cursorfixedheight?M.cursorfixedheight:Math.max(M.cursorminheight,T.cursorwidth),T.scrollvaluemax=T.view.h-T.cursorheight-(M.railpadding.top+M.railpadding.bottom),T.hasborderbox||(T.scrollvaluemax-=T.cursor[0].offsetHeight-T.cursor[0].clientHeight),T.railh&&(T.railh.width=T.page.maxh>0?T.view.w-T.rail.width:T.view.w,T.scrollvaluemaxw=T.railh.width-T.cursorwidth-(M.railpadding.left+M.railpadding.right)),T.ispage||T.updateScrollBar(T.view),T.scrollratio={x:T.page.maxw/T.scrollvaluemaxw,y:T.page.maxh/T.scrollvaluemax},T.getScrollTop()>T.page.maxh?T.doScrollTop(T.page.maxh):(T.scroll.y=T.getScrollTop()/T.scrollratio.y|0,T.scroll.x=T.getScrollLeft()/T.scrollratio.x|0,T.cursoractive&&T.noticeCursor()),T.scroll.y&&0===T.getScrollTop()&&T.doScrollTo(T.scroll.y*T.scrollratio.y|0),T)},this.resize=T.onResize;var O=0;this.onscreenresize=function(e){clearTimeout(O);var o=!T.ispage&&!T.haswrapper;o&&T.hideRails(),O=setTimeout(function(){T&&(o&&T.showRails(),T.resize()),O=0},120)},this.lazyResize=function(e){return clearTimeout(O),O=setTimeout(function(){T&&T.resize(),O=0},e||240),T},this.jqbind=function(e,o,t){T.events.push({e:e,n:o,f:t,q:!0}),n(e).on(o,t)},this.mousewheel=function(e,o,t){var r="jquery"in e?e[0]:e;if("onwheel"in l.createElement("div"))T._bind(r,"wheel",o,t||!1);else{var i=void 0!==l.onmousewheel?"mousewheel":"DOMMouseScroll";S(r,i,o,t||!1),"DOMMouseScroll"==i&&S(r,"MozMousePixelScroll",o,t||!1)}};var Y=!1;if(N.haseventlistener){try{var H=Object.defineProperty({},"passive",{get:function(){Y=!0}});a.addEventListener("test",null,H)}catch(e){}this.stopPropagation=function(e){return!!e&&((e=e.original?e.original:e).stopPropagation(),!1)},this.cancelEvent=function(e){return e.cancelable&&e.preventDefault(),e.stopImmediatePropagation(),e.preventManipulation&&e.preventManipulation(),!1}}else Event.prototype.preventDefault=function(){this.returnValue=!1},Event.prototype.stopPropagation=function(){this.cancelBubble=!0},a.constructor.prototype.addEventListener=l.constructor.prototype.addEventListener=Element.prototype.addEventListener=function(e,o,t){this.attachEvent("on"+e,o)},a.constructor.prototype.removeEventListener=l.constructor.prototype.removeEventListener=Element.prototype.removeEventListener=function(e,o,t){this.detachEvent("on"+e,o)},this.cancelEvent=function(e){return(e=e||a.event)&&(e.cancelBubble=!0,e.cancel=!0,e.returnValue=!1),!1},this.stopPropagation=function(e){return(e=e||a.event)&&(e.cancelBubble=!0),!1};this.delegate=function(e,o,t,r,i){var s=d[o]||!1;s||(s={a:[],l:[],f:function(e){for(var o=s.l,t=!1,r=o.length-1;r>=0;r--)if(!1===(t=o[r].call(e.target,e)))return!1;return t}},T.bind(e,o,s.f,r,i),d[o]=s),T.ispage?(s.a=[T.id].concat(s.a),s.l=[t].concat(s.l)):(s.a.push(T.id),s.l.push(t))},this.undelegate=function(e,o,t,r,i){var s=d[o]||!1;if(s)for(var n=0,l=s.l.length;n0)return t;o=!!o.parentNode&&o.parentNode}return!1},this.triggerScrollStart=function(e,o,t,r,i){if(T.onscrollstart){var s={type:"scrollstart",current:{x:e,y:o},request:{x:t,y:r},end:{x:T.newscrollx,y:T.newscrolly},speed:i};T.onscrollstart.call(T,s)}},this.triggerScrollEnd=function(){if(T.onscrollend){var e=T.getScrollLeft(),o=T.getScrollTop(),t={type:"scrollend",current:{x:e,y:o},end:{x:e,y:o}};T.onscrollend.call(T,t)}};var B=0,X=0,D=0,A=1,q=!1;if(this.onmousewheel=function(e){if(T.wheelprevented||T.locked)return!1;if(T.railslocked)return T.debounced("checkunlock",T.resize,250),!1;if(T.rail.drag)return T.cancelEvent(e);if("auto"===M.oneaxismousemode&&0!==e.deltaX&&(M.oneaxismousemode=!1),M.oneaxismousemode&&0===e.deltaX&&!T.rail.scrollable)return!T.railh||!T.railh.scrollable||T.onmousewheelhr(e);var o=f(),t=!1;if(M.preservenativescrolling&&T.checkarea+600T.page.maxh&&(o=T.page.maxh+(o-T.page.maxh)/2|0),e<0?e=e/2|0:e>T.page.maxw&&(e=T.page.maxw+(e-T.page.maxw)/2|0)):(o<0?o=0:o>T.page.maxh&&(o=T.page.maxh),e<0?e=0:e>T.page.maxw&&(e=T.page.maxw)),T.scrollrunning&&e==T.newscrollx&&o==T.newscrolly)return!1;T.newscrolly=o,T.newscrollx=e;var s=T.getScrollTop(),n=T.getScrollLeft(),l={};l.x=e-n,l.y=o-s;var a=0|Math.sqrt(l.x*l.x+l.y*l.y),c=T.prepareTransition(a);T.scrollrunning||(T.scrollrunning=!0,T.triggerScrollStart(n,s,e,o,c),T.cursorupdate.start()),T.scrollendtrapped=!0,N.transitionend||(T.scrollendtrapped&&clearTimeout(T.scrollendtrapped),T.scrollendtrapped=setTimeout(T.onScrollTransitionEnd,c)),T.setScrollTop(T.newscrolly),T.setScrollLeft(T.newscrollx)},this.cancelScroll=function(){if(!T.scrollendtrapped)return!0;var e=T.getScrollTop(),o=T.getScrollLeft();return T.scrollrunning=!1,N.transitionend||clearTimeout(N.transitionend),T.scrollendtrapped=!1,T.resetTransition(),T.setScrollTop(e),T.railh&&T.setScrollLeft(o),T.timerscroll&&T.timerscroll.tm&&clearInterval(T.timerscroll.tm),T.timerscroll=!1,T.cursorfreezed=!1,T.cursorupdate.stop(),T.showCursor(e,o),T},this.onScrollTransitionEnd=function(){if(T.scrollendtrapped){var e=T.getScrollTop(),o=T.getScrollLeft();if(e<0?e=0:e>T.page.maxh&&(e=T.page.maxh),o<0?o=0:o>T.page.maxw&&(o=T.page.maxw),e!=T.newscrolly||o!=T.newscrollx)return T.doScrollPos(o,e,M.snapbackspeed);T.scrollrunning&&T.triggerScrollEnd(),T.scrollrunning=!1,T.scrollendtrapped=!1,T.resetTransition(),T.timerscroll=!1,T.setScrollTop(e),T.railh&&T.setScrollLeft(o),T.cursorupdate.stop(),T.noticeCursor(!1,e,o),T.cursorfreezed=!1}}}else this.doScrollLeft=function(e,o){var t=T.scrollrunning?T.newscrolly:T.getScrollTop();T.doScrollPos(e,t,o)},this.doScrollTop=function(e,o){var t=T.scrollrunning?T.newscrollx:T.getScrollLeft();T.doScrollPos(t,e,o)},this.doScrollPos=function(e,o,t){var r=T.getScrollTop(),i=T.getScrollLeft();((T.newscrolly-r)*(o-r)<0||(T.newscrollx-i)*(e-i)<0)&&T.cancelScroll();var s=!1;if(T.bouncescroll&&T.rail.visibility||(o<0?(o=0,s=!0):o>T.page.maxh&&(o=T.page.maxh,s=!0)),T.bouncescroll&&T.railh.visibility||(e<0?(e=0,s=!0):e>T.page.maxw&&(e=T.page.maxw,s=!0)),T.scrollrunning&&T.newscrolly===o&&T.newscrollx===e)return!0;T.newscrolly=o,T.newscrollx=e,T.dst={},T.dst.x=e-i,T.dst.y=o-r,T.dst.px=i,T.dst.py=r;var n=0|Math.sqrt(T.dst.x*T.dst.x+T.dst.y*T.dst.y),l=T.getTransitionSpeed(n);T.bzscroll={};var a=s?1:.58;T.bzscroll.x=new R(i,T.newscrollx,l,0,0,a,1),T.bzscroll.y=new R(r,T.newscrolly,l,0,0,a,1);f();var c=function(){if(T.scrollrunning){var e=T.bzscroll.y.getPos();T.setScrollLeft(T.bzscroll.x.getNow()),T.setScrollTop(T.bzscroll.y.getNow()),e<=1?T.timer=u(c):(T.scrollrunning=!1,T.timer=0,T.triggerScrollEnd())}};T.scrollrunning||(T.triggerScrollStart(i,r,e,o,l),T.scrollrunning=!0,T.timer=u(c))},this.cancelScroll=function(){return T.timer&&h(T.timer),T.timer=0,T.bzscroll=!1,T.scrollrunning=!1,T};else this.doScrollLeft=function(e,o){var t=T.getScrollTop();T.doScrollPos(e,t,o)},this.doScrollTop=function(e,o){var t=T.getScrollLeft();T.doScrollPos(t,e,o)},this.doScrollPos=function(e,o,t){var r=e>T.page.maxw?T.page.maxw:e;r<0&&(r=0);var i=o>T.page.maxh?T.page.maxh:o;i<0&&(i=0),T.synched("scroll",function(){T.setScrollTop(i),T.setScrollLeft(r)})},this.cancelScroll=function(){};this.doScrollBy=function(e,o){z(0,e)},this.doScrollLeftBy=function(e,o){z(e,0)},this.doScrollTo=function(e,o){var t=o?Math.round(e*T.scrollratio.y):e;t<0?t=0:t>T.page.maxh&&(t=T.page.maxh),T.cursorfreezed=!1,T.doScrollTop(e)},this.checkContentSize=function(){var e=T.getContentSize();e.h==T.page.h&&e.w==T.page.w||T.resize(!1,e)},T.onscroll=function(e){T.rail.drag||T.cursorfreezed||T.synched("scroll",function(){T.scroll.y=Math.round(T.getScrollTop()/T.scrollratio.y),T.railh&&(T.scroll.x=Math.round(T.getScrollLeft()/T.scrollratio.x)),T.noticeCursor()})},T.bind(T.docscroll,"scroll",T.onscroll),this.doZoomIn=function(e){if(!T.zoomactive){T.zoomactive=!0,T.zoomrestore={style:{}};var o=["position","top","left","zIndex","backgroundColor","marginTop","marginBottom","marginLeft","marginRight"],t=T.win[0].style;for(var r in o){var i=o[r];T.zoomrestore.style[i]=void 0!==t[i]?t[i]:""}T.zoomrestore.style.width=T.win.css("width"),T.zoomrestore.style.height=T.win.css("height"),T.zoomrestore.padding={w:T.win.outerWidth()-T.win.width(),h:T.win.outerHeight()-T.win.height()},N.isios4&&(T.zoomrestore.scrollTop=c.scrollTop(),c.scrollTop(0)),T.win.css({position:N.isios4?"absolute":"fixed",top:0,left:0,zIndex:s+100,margin:0});var n=T.win.css("backgroundColor");return(""===n||/transparent|rgba\(0, 0, 0, 0\)|rgba\(0,0,0,0\)/.test(n))&&T.win.css("backgroundColor","#fff"),T.rail.css({zIndex:s+101}),T.zoom.css({zIndex:s+102}),T.zoom.css("backgroundPosition","0 -18px"),T.resizeZoom(),T.onzoomin&&T.onzoomin.call(T),T.cancelEvent(e)}},this.doZoomOut=function(e){if(T.zoomactive)return T.zoomactive=!1,T.win.css("margin",""),T.win.css(T.zoomrestore.style),N.isios4&&c.scrollTop(T.zoomrestore.scrollTop),T.rail.css({"z-index":T.zindex}),T.zoom.css({"z-index":T.zindex}),T.zoomrestore=!1,T.zoom.css("backgroundPosition","0 0"),T.onResize(),T.onzoomout&&T.onzoomout.call(T),T.cancelEvent(e)},this.doZoom=function(e){return T.zoomactive?T.doZoomOut(e):T.doZoomIn(e)},this.resizeZoom=function(){if(T.zoomactive){var e=T.getScrollTop();T.win.css({width:c.width()-T.zoomrestore.padding.w+"px",height:c.height()-T.zoomrestore.padding.h+"px"}),T.onResize(),T.setScrollTop(Math.min(T.page.maxh,e))}},this.init(),n.nicescroll.push(this)},y=function(e){var o=this;this.nc=e,this.lastx=0,this.lasty=0,this.speedx=0,this.speedy=0,this.lasttime=0,this.steptime=0,this.snapx=!1,this.snapy=!1,this.demulx=0,this.demuly=0,this.lastscrollx=-1,this.lastscrolly=-1,this.chkx=0,this.chky=0,this.timer=0,this.reset=function(e,t){o.stop(),o.steptime=0,o.lasttime=f(),o.speedx=0,o.speedy=0,o.lastx=e,o.lasty=t,o.lastscrollx=-1,o.lastscrolly=-1},this.update=function(e,t){var r=f();o.steptime=r-o.lasttime,o.lasttime=r;var i=t-o.lasty,s=e-o.lastx,n=o.nc.getScrollTop()+i,l=o.nc.getScrollLeft()+s;o.snapx=l<0||l>o.nc.page.maxw,o.snapy=n<0||n>o.nc.page.maxh,o.speedx=s,o.speedy=i,o.lastx=e,o.lasty=t},this.stop=function(){o.nc.unsynched("domomentum2d"),o.timer&&clearTimeout(o.timer),o.timer=0,o.lastscrollx=-1,o.lastscrolly=-1},this.doSnapy=function(e,t){var r=!1;t<0?(t=0,r=!0):t>o.nc.page.maxh&&(t=o.nc.page.maxh,r=!0),e<0?(e=0,r=!0):e>o.nc.page.maxw&&(e=o.nc.page.maxw,r=!0),r?o.nc.doScrollPos(e,t,o.nc.opt.snapbackspeed):o.nc.triggerScrollEnd()},this.doMomentum=function(e){var t=f(),r=e?t+e:o.lasttime,i=o.nc.getScrollLeft(),s=o.nc.getScrollTop(),n=o.nc.page.maxh,l=o.nc.page.maxw;o.speedx=l>0?Math.min(60,o.speedx):0,o.speedy=n>0?Math.min(60,o.speedy):0;var a=r&&t-r<=60;(s<0||s>n||i<0||i>l)&&(a=!1);var c=!(!o.speedy||!a)&&o.speedy,d=!(!o.speedx||!a)&&o.speedx;if(c||d){var u=Math.max(16,o.steptime);if(u>50){var h=u/50;o.speedx*=h,o.speedy*=h,u=50}o.demulxy=0,o.lastscrollx=o.nc.getScrollLeft(),o.chkx=o.lastscrollx,o.lastscrolly=o.nc.getScrollTop(),o.chky=o.lastscrolly;var p=o.lastscrollx,m=o.lastscrolly,g=function(){var e=f()-t>600?.04:.02;o.speedx&&(p=Math.floor(o.lastscrollx-o.speedx*(1-o.demulxy)),o.lastscrollx=p,(p<0||p>l)&&(e=.1)),o.speedy&&(m=Math.floor(o.lastscrolly-o.speedy*(1-o.demulxy)),o.lastscrolly=m,(m<0||m>n)&&(e=.1)),o.demulxy=Math.min(1,o.demulxy+e),o.nc.synched("domomentum2d",function(){if(o.speedx){o.nc.getScrollLeft();o.chkx=p,o.nc.setScrollLeft(p)}if(o.speedy){o.nc.getScrollTop();o.chky=m,o.nc.setScrollTop(m)}o.timer||(o.nc.hideCursor(),o.doSnapy(p,m))}),o.demulxy<1?o.timer=setTimeout(g,u):(o.stop(),o.nc.hideCursor(),o.doSnapy(p,m))};g()}else o.doSnapy(o.nc.getScrollLeft(),o.nc.getScrollTop())}},x=e.fn.scrollTop;e.cssHooks.pageYOffset={get:function(e,o,t){var r=n.data(e,"__nicescroll")||!1;return r&&r.ishwscroll?r.getScrollTop():x.call(e)},set:function(e,o){var t=n.data(e,"__nicescroll")||!1;return t&&t.ishwscroll?t.setScrollTop(parseInt(o)):x.call(e,o),this}},e.fn.scrollTop=function(e){if(void 0===e){var o=!!this[0]&&(n.data(this[0],"__nicescroll")||!1);return o&&o.ishwscroll?o.getScrollTop():x.call(this)}return this.each(function(){var o=n.data(this,"__nicescroll")||!1;o&&o.ishwscroll?o.setScrollTop(parseInt(e)):x.call(n(this),e)})};var S=e.fn.scrollLeft;n.cssHooks.pageXOffset={get:function(e,o,t){var r=n.data(e,"__nicescroll")||!1;return r&&r.ishwscroll?r.getScrollLeft():S.call(e)},set:function(e,o){var t=n.data(e,"__nicescroll")||!1;return t&&t.ishwscroll?t.setScrollLeft(parseInt(o)):S.call(e,o),this}},e.fn.scrollLeft=function(e){if(void 0===e){var o=!!this[0]&&(n.data(this[0],"__nicescroll")||!1);return o&&o.ishwscroll?o.getScrollLeft():S.call(this)}return this.each(function(){var o=n.data(this,"__nicescroll")||!1;o&&o.ishwscroll?o.setScrollLeft(parseInt(e)):S.call(n(this),e)})};var z=function(e){var o=this;if(this.length=0,this.name="nicescrollarray",this.each=function(e){return n.each(o,e),o},this.push=function(e){o[o.length]=e,o.length++},this.eq=function(e){return o[e]},e)for(var t=0;t1?n(e,r):s,i.win=r}!("doc"in i)||"win"in i||(i.win=r);var l=r.data("__nicescroll")||!1;l||(i.doc=i.doc||r,l=new b(i,r),r.data("__nicescroll",l)),t.push(l)}),1===t.length?t[0]:t},a.NiceScroll={getjQuery:function(){return e}},n.nicescroll||(n.nicescroll=new z,n.nicescroll.options=g)}); \ No newline at end of file From 41d2c38479a04a6a9645862a29f5c22b38fb07f3 Mon Sep 17 00:00:00 2001 From: InuYaksa Date: Mon, 10 Jul 2017 12:00:46 +0200 Subject: [PATCH 09/14] 3.7.5-b [DEV] Fixes - Calling .remove() throws an error after update to v. 3.7.4 #681 - more robust hybrid system support mouse + touch events aka no drag and scroll #676 Changes - remove outdated self.visibility --- changelog_3.7.4.txt | 20 ----- changelog_3.7.5.txt | 12 +++ jquery.nicescroll.iframehelper.js | 107 -------------------------- jquery.nicescroll.iframehelper.min.js | 2 - jquery.nicescroll.js | 28 +++---- jquery.nicescroll.min.js | 4 +- 6 files changed, 28 insertions(+), 145 deletions(-) delete mode 100644 changelog_3.7.4.txt create mode 100644 changelog_3.7.5.txt delete mode 100644 jquery.nicescroll.iframehelper.js delete mode 100644 jquery.nicescroll.iframehelper.min.js diff --git a/changelog_3.7.4.txt b/changelog_3.7.4.txt deleted file mode 100644 index 4ee1c25..0000000 --- a/changelog_3.7.4.txt +++ /dev/null @@ -1,20 +0,0 @@ -Changelog nicescroll release 3.7.4 [[ DEVELOPER RELEASE ]] -https://nicescroll.areaaperta.com/ -https://github.com/inuyaksa/jquery.nicescroll - - - -Fixes -- touchpad scrolling support for MS Surface aka FYI - Browser test results on Surface Pro touchscreen and touchpad #668 -- changed scrollbarid setting procedure because uglify mades uncompatible code for IE8 aka use nicescroll in IE8 #672 -- preserve scrol chain -- page scrollbar not customized on android -- prevent bar flickering when window not changed aka Using this plugin I got a flickering scroll bar #674 - -Changes -- more responsive direct scrolling from bars -- more consistence scrolling speed on many browsers (Chrome, Firefox, Edge) -- minor code optimizations and jshint check -- jQuery "bind" event function changed to "on", migration to jQuery 3 (still jQuery 1 compatible) #361 -- Using jQuery.expr.pseudos, migration to jQuery 3 (still jQuery 1 compatible) #361 -- changed arguments for doScrollBy and doScrollLeftBy \ No newline at end of file diff --git a/changelog_3.7.5.txt b/changelog_3.7.5.txt new file mode 100644 index 0000000..66d01ec --- /dev/null +++ b/changelog_3.7.5.txt @@ -0,0 +1,12 @@ +Changelog nicescroll release 3.7.5 [[ DEVELOPER RELEASE ]] +https://nicescroll.areaaperta.com/ +https://github.com/inuyaksa/jquery.nicescroll + + + +Fixes +- Calling .remove() throws an error after update to v. 3.7.4 #681 +- more robust hybrid system support mouse + touch events aka no drag and scroll #676 + +Changes +- remove outdated self.visibility \ No newline at end of file diff --git a/jquery.nicescroll.iframehelper.js b/jquery.nicescroll.iframehelper.js deleted file mode 100644 index 2fe40c3..0000000 --- a/jquery.nicescroll.iframehelper.js +++ /dev/null @@ -1,107 +0,0 @@ -/* iframe script helper for jquery.nicescroll --- version 0.9.0 --- copyright 2017-06-18 InuYaksa*2017 --- licensed under the MIT --- --- https://nicescroll.areaaperta.com/ --- https://github.com/inuyaksa/jquery.nicescroll --- -*/ - -(function (document,window) { - - var body = document.body; - var parent = window.parent; - - if (parent && ("createEvent" in document)) { - - var isoldie = ("documentMode" in document); // 11- - var ismsedge = ("msCredentials" in window); // MS Edge 14+ - - function onwheel(e) { - - var evt = document.createEvent("MouseEvents"); - evt.initEvent('wheel', true, true); - evt.deltaMode = e.deltaMode; - evt.deltaX = e.deltaX; - evt.deltaY = e.deltaY; - evt.deltaZ = e.deltaZ; - evt.wheelDelta = e.wheelDelta; - evt.wheelDeltaX = e.wheelDeltaX; - evt.wheelDeltaY = e.wheelDeltaY; - - parent.dispatchEvent(evt); - } - - body.addEventListener("wheel", onwheel); - - } - - if (window.addEventListener) { - - // https://davidwalsh.name/add-rules-stylesheets - var sheet = (function () { - var style = document.createElement("style"); - style.appendChild(document.createTextNode("")); - document.head.appendChild(style); - return style.sheet; - })(); - - var tmrscroll = false; - var lastiframe = null; - var lastiframeviewport = null; - var lastscroll = []; - - window.addEventListener("scroll", function (e) { - if (lastiframeviewport) { - // var df = [ window.scrollX - lastscroll[0], window.scrollY - lastscroll[1] ]; - window.scrollTo(lastscroll[0], lastscroll[1]); - // lastiframeviewport.scrollBy(df[0],df[1]); - // console.log(df); - } - }); - - function findNiceParent(t) { - do { - if ($.data(t, '__nicescroll') !== undefined) return t; - t = t.parentNode || false; - } while (t); - return false; - } - - window.addEventListener("load", function () { - - var hasstyle = false; - - $.nicescroll.each(function () { - var nice = this; - nice.scrollstart(function () { - console.log("start"); - if (!hasstyle) sheet.insertRule("iframe { pointer-events: none !important; }", 0); - hasstyle = true; - }); - nice.scrollend(function () { - console.log("end"); - if (hasstyle) sheet.deleteRule(0); - hasstyle = false; - }); - }); - - $("iframe").each(function () { - this.addEventListener("mouseenter", function (e) { - lastiframe = e.target; - var chk = findNiceParent(lastiframe); - lastiframeviewport = chk; - //if (chk) lastiframeviewport = $(chk).getNiceScroll(); - lastscroll = [window.scrollX, window.scrollY]; - }); - this.addEventListener("mouseleave", function (e) { - lastiframe = lastiframeviewport = null; - }); - }); - - }); - - } - -})(document,window); \ No newline at end of file diff --git a/jquery.nicescroll.iframehelper.min.js b/jquery.nicescroll.iframehelper.min.js deleted file mode 100644 index ba0d9de..0000000 --- a/jquery.nicescroll.iframehelper.min.js +++ /dev/null @@ -1,2 +0,0 @@ -/* iframe helper for nicescroll v3.7.4-c [DEV REL] InuYaksa - MIT - https://nicescroll.areaaperta.com */ -!function(e,t){function n(t){var n=e.createEvent("MouseEvents");n.initEvent("wheel",!0,!0),n.deltaMode=t.deltaMode,n.deltaX=t.deltaX,n.deltaY=t.deltaY,n.deltaZ=t.deltaZ,n.wheelDelta=t.wheelDelta,n.wheelDeltaX=t.wheelDeltaX,n.wheelDeltaY=t.wheelDeltaY,o.dispatchEvent(n)}function l(e){do{if(void 0!==$.data(e,"__nicescroll"))return e;e=e.parentNode||!1}while(e);return!1}var a=e.body,o=t.parent;if(o&&"createEvent"in e){a.addEventListener("wheel",n)}if(t.addEventListener){var r=function(){var t=e.createElement("style");return t.appendChild(e.createTextNode("")),e.head.appendChild(t),t.sheet}(),d=null,i=null,c=[];t.addEventListener("scroll",function(e){i&&t.scrollTo(c[0],c[1])}),t.addEventListener("load",function(){var e=!1;$.nicescroll.each(function(){var t=this;t.scrollstart(function(){console.log("start"),e||r.insertRule("iframe { pointer-events: none !important; }",0),e=!0}),t.scrollend(function(){console.log("end"),e&&r.deleteRule(0),e=!1})}),$("iframe").each(function(){this.addEventListener("mouseenter",function(e){var n=l(d=e.target);i=n,c=[t.scrollX,t.scrollY]}),this.addEventListener("mouseleave",function(e){d=i=null})})})}}(document,window); \ No newline at end of file diff --git a/jquery.nicescroll.js b/jquery.nicescroll.js index 4495136..3510e9e 100644 --- a/jquery.nicescroll.js +++ b/jquery.nicescroll.js @@ -1,6 +1,6 @@ /* jquery.nicescroll --- version 3.7.4-g [DEV REL] --- copyright 2017-06-18 InuYaksa*2017 +-- version 3.7.5-b +-- copyright 2017-07-02 InuYaksa*2017 -- licensed under the MIT -- -- https://nicescroll.areaaperta.com/ @@ -261,7 +261,7 @@ var self = this; - this.version = '3.7.4-g'; + this.version = '3.7.5-b'; this.name = 'nicescroll'; this.me = me; @@ -384,7 +384,7 @@ this.hasfocus = false; this.hasmousefocus = false; - this.visibility = true; + //this.visibility = true; this.railslocked = false; // locked by resize this.locked = false; // prevent lost of locked status sets by user this.hidden = false; // rails always hidden @@ -504,7 +504,6 @@ }; BezierClass.prototype = { B2: function (t) { - //return 3 * t * t * (1 - t); return 3 * (1 - t) * (1 - t) * t; }, B3: function (t) { @@ -1210,7 +1209,7 @@ return self.cancelEvent(e); } return self.stopPropagation(e); - } + } if (/SUBMIT|CANCEL|BUTTON/i.test($(tg).attr('type'))) { self.preventclick = { @@ -1757,7 +1756,8 @@ self.cursorh && self.bind(self.cursorh, "touchend", self.ontouchendCursor); } - if (!cap.cantouch && !opt.emulatetouch) { +// if (!cap.cantouch && !opt.emulatetouch) { + if (!opt.emulatetouch && !cap.isandroid && !cap.isios) { self.bind((cap.hasmousecapture) ? self.win : _doc, "mouseup", self.onmouseup); self.bind(_doc, "mousemove", self.onmousemove); @@ -2283,10 +2283,10 @@ return false; } - if (!self.hidden && !self.visibility) { - self.showRail().showRailHr(); + if (!self.hidden) { + if (!self.rail.visibility) self.showRail(); + if (self.railh && !self.railh.visibility) self.showRailHr(); } - else if (self.railh && (!self.hidden && !self.railh.visibility)) self.showRailHr(); if (self.istextarea && self.win.css('resize') && self.win.css('resize') != 'none') self.view.h -= 20; @@ -2515,7 +2515,7 @@ de.a.splice(a); de.l.splice(a); if (de.a.length===0) { - self._unbind(dom,name,del.f); + self._unbind(dom,name,de.l.f); delegatevents[name] = null; } } @@ -2559,7 +2559,7 @@ this.showRail = function () { if ((self.page.maxh !== 0) && (self.ispage || self.win.css('display') != 'none')) { - self.visibility = true; + //self.visibility = true; self.rail.visibility = true; self.rail.css('display', 'block'); } @@ -2581,7 +2581,7 @@ }; this.hideRail = function () { - self.visibility = false; + //self.visibility = false; self.rail.visibility = false; self.rail.css('display', 'none'); return self; @@ -3227,7 +3227,7 @@ }; - this.cancelScroll = function () { + this.cancelScroll = function () { if (self.timer) clearAnimationFrame(self.timer); self.timer = 0; self.bzscroll = false; diff --git a/jquery.nicescroll.min.js b/jquery.nicescroll.min.js index a9868cf..1a58f1d 100644 --- a/jquery.nicescroll.min.js +++ b/jquery.nicescroll.min.js @@ -1,2 +1,2 @@ -/* nicescroll v3.7.4-g [DEV REL] InuYaksa - MIT - https://nicescroll.areaaperta.com */ -!function(e){"function"==typeof define&&define.amd?define(["jquery"],e):"object"==typeof exports?module.exports=e(require("jquery")):e(jQuery)}(function(e){"use strict";var o=!1,t=!1,r=0,i=2e3,s=0,n=e,l=document,a=window,c=n(a),d=[],u=a.requestAnimationFrame||a.webkitRequestAnimationFrame||a.mozRequestAnimationFrame||!1,h=a.cancelAnimationFrame||a.webkitCancelAnimationFrame||a.mozCancelAnimationFrame||!1;if(u)a.cancelAnimationFrame||(h=function(e){});else{var p=0;u=function(e,o){var t=(new Date).getTime(),r=Math.max(0,16-(t-p)),i=a.setTimeout(function(){e(t+r)},r);return p=t+r,i},h=function(e){a.clearTimeout(e)}}var m=a.MutationObserver||a.WebKitMutationObserver||!1,f=Date.now||function(){return(new Date).getTime()},g={zindex:"auto",cursoropacitymin:0,cursoropacitymax:1,cursorcolor:"#424242",cursorwidth:"6px",cursorborder:"1px solid #fff",cursorborderradius:"5px",scrollspeed:40,mousescrollstep:27,touchbehavior:!1,emulatetouch:!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 e=l.currentScript||function(){var e=l.getElementsByTagName("script");return!!e.length&&e[e.length-1]}(),o=e?e.src.split("?")[0]:"";return o.split("/").length>0?o.split("/").slice(0,-1).join("/")+"/":""}(),preventmultitouchscrolling:!0,disablemutationobserver:!1,enableobserver:!0,scrollbarid:!1},v=!1,w=function(){if(v)return v;var e=l.createElement("DIV"),o=e.style,t=navigator.userAgent,r=navigator.platform,i={};return i.haspointerlock="pointerLockElement"in l||"webkitPointerLockElement"in l||"mozPointerLockElement"in l,i.isopera="opera"in a,i.isopera12=i.isopera&&"getUserMedia"in navigator,i.isoperamini="[object OperaMini]"===Object.prototype.toString.call(a.operamini),i.isie="all"in l&&"attachEvent"in e&&!i.isopera,i.isieold=i.isie&&!("msInterpolationMode"in o),i.isie7=i.isie&&!i.isieold&&(!("documentMode"in l)||7===l.documentMode),i.isie8=i.isie&&"documentMode"in l&&8===l.documentMode,i.isie9=i.isie&&"performance"in a&&9===l.documentMode,i.isie10=i.isie&&"performance"in a&&10===l.documentMode,i.isie11="msRequestFullscreen"in e&&l.documentMode>=11,i.ismsedge="msCredentials"in a,i.ismozilla="MozAppearance"in o,i.iswebkit=!i.ismsedge&&"WebkitAppearance"in o,i.ischrome=i.iswebkit&&"chrome"in a,i.ischrome38=i.ischrome&&"touchAction"in o,i.ischrome22=!i.ischrome38&&i.ischrome&&i.haspointerlock,i.ischrome26=!i.ischrome38&&i.ischrome&&"transition"in o,i.cantouch="ontouchstart"in l.documentElement||"ontouchstart"in a,i.hasw3ctouch=(a.PointerEvent||!1)&&(navigator.MaxTouchPoints>0||navigator.msMaxTouchPoints>0),i.hasmstouch=!i.hasw3ctouch&&(a.MSPointerEvent||!1),i.ismac=/^mac$/i.test(r),i.isios=i.cantouch&&/iphone|ipad|ipod/i.test(r),i.isios4=i.isios&&!("seal"in Object),i.isios7=i.isios&&"webkitHidden"in l,i.isios8=i.isios&&"hidden"in l,i.isios10=i.isios&&a.Proxy,i.isandroid=/android/i.test(t),i.haseventlistener="addEventListener"in e,i.trstyle=!1,i.hastransform=!1,i.hastranslate3d=!1,i.transitionstyle=!1,i.hastransition=!1,i.transitionend=!1,i.trstyle="transform",i.hastransform="transform"in o||function(){for(var e=["msTransform","webkitTransform","MozTransform","OTransform"],t=0,r=e.length;t0;){if(9==e[0].nodeType)return!1;var o=e.css("zIndex");if(!isNaN(o)&&0!==o)return parseInt(o);e=e.parent()}return!1}function x(e,o,t){var r=e.css(o),i=parseFloat(r);if(isNaN(i)){var s=3==(i=I[r]||0)?t?T.win.outerHeight()-T.win.innerHeight():T.win.outerWidth()-T.win.innerWidth():1;return T.isie8&&i&&(i+=1),s?i:0}return i}function S(e,o,t,r){T._bind(e,o,function(r){var i={original:r=r||a.event,target:r.target||r.srcElement,type:"wheel",deltaMode:"MozMousePixelScroll"==r.type?0:1,deltaX:0,deltaZ:0,preventDefault:function(){return r.preventDefault?r.preventDefault():r.returnValue=!1,!1},stopImmediatePropagation:function(){r.stopImmediatePropagation?r.stopImmediatePropagation():r.cancelBubble=!0}};return"mousewheel"==o?(r.wheelDeltaX&&(i.deltaX=-.025*r.wheelDeltaX),r.wheelDeltaY&&(i.deltaY=-.025*r.wheelDeltaY),!i.deltaY&&!i.deltaX&&(i.deltaY=-.025*r.wheelDelta)):i.deltaY=r.detail,t.call(e,i)},r)}function z(e,o,t,r){T.scrollrunning||(T.newscrolly=T.getScrollTop(),T.newscrollx=T.getScrollLeft(),D=f());var i=f()-D;if(D=f(),i>350?A=1:A+=(2-A)/10,e=e*A|0,o=o*A|0,e){if(r)if(e<0){if(T.getScrollLeft()>=T.page.maxw)return!0}else if(T.getScrollLeft()<=0)return!0;var s=e>0?1:-1;X!==s&&(T.scrollmom&&T.scrollmom.stop(),T.newscrollx=T.getScrollLeft(),X=s),T.lastdeltax-=e}if(o){if(function(){var e=T.getScrollTop();if(o<0){if(e>=T.page.maxh)return!0}else if(e<=0)return!0}()){if(M.nativeparentscrolling&&t&&!T.ispage&&!T.zoomactive)return!0;var n=T.view.h>>1;T.newscrolly<-n?(T.newscrolly=-n,o=-1):T.newscrolly>T.page.maxh+n?(T.newscrolly=T.page.maxh+n,o=1):o=0}var l=o>0?1:-1;B!==l&&(T.scrollmom&&T.scrollmom.stop(),T.newscrolly=T.getScrollTop(),B=l),T.lastdeltay-=o}(o||e)&&T.synched("relativexy",function(){var e=T.lastdeltay+T.newscrolly;T.lastdeltay=0;var o=T.lastdeltax+T.newscrollx;T.lastdeltax=0,T.rail.drag||T.doScrollPos(o,e)})}function k(e,o,t){var r,i;return!(t||!q)||(0===e.deltaMode?(r=-e.deltaX*(M.mousescrollstep/54)|0,i=-e.deltaY*(M.mousescrollstep/54)|0):1===e.deltaMode&&(r=-e.deltaX*M.mousescrollstep*50/80|0,i=-e.deltaY*M.mousescrollstep*50/80|0),o&&M.oneaxismousemode&&0===r&&i&&(r=i,i=0,t&&(r<0?T.getScrollLeft()>=T.page.maxw:T.getScrollLeft()<=0)&&(i=r,r=0)),T.isrtlmode&&(r=-r),z(r,i,t,!0)?void(t&&(q=!0)):(q=!1,e.stopImmediatePropagation(),e.preventDefault()))}var T=this;this.version="3.7.4-g",this.name="nicescroll",this.me=p;var E=n("body"),M=this.opt={doc:E,win:!1};if(n.extend(M,g),M.snapbackspeed=80,e)for(var L in M)void 0!==e[L]&&(M[L]=e[L]);if(M.disablemutationobserver&&(m=!1),this.doc=M.doc,this.iddoc=this.doc&&this.doc[0]?this.doc[0].id||"":"",this.ispage=/^BODY|HTML/.test(M.win?M.win[0].nodeName:this.doc[0].nodeName),this.haswrapper=!1!==M.win,this.win=M.win||(this.ispage?c:this.doc),this.docscroll=this.ispage&&!this.haswrapper?c:this.win,this.body=E,this.viewport=!1,this.isfixed=!1,this.iframe=!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"!=M.autohidemode,this.onmousedown=!1,this.onmouseup=!1,this.onmousemove=!1,this.onmousewheel=!1,this.onkeypress=!1,this.ongesturezoom=!1,this.onclick=!1,this.onscrollstart=!1,this.onscrollend=!1,this.onscrollcancel=!1,this.onzoomin=!1,this.onzoomout=!1,this.view=!1,this.page=!1,this.scroll={x:0,y:0},this.scrollratio={x:0,y:0},this.cursorheight=20,this.scrollvaluemax=0,"auto"==M.rtlmode){var C=this.win[0]==a?this.body:this.win,P=C.css("writing-mode")||C.css("-webkit-writing-mode")||C.css("-ms-writing-mode")||C.css("-moz-writing-mode");"horizontal-tb"==P||"lr-tb"==P||""===P?(this.isrtlmode="rtl"==C.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===M.rtlmode,this.isvertical=!1;if(this.scrollrunning=!1,this.scrollmom=!1,this.observer=!1,this.observerremover=!1,this.observerbody=!1,!1!==M.scrollbarid)this.id=M.scrollbarid;else do{this.id="ascrail"+i++}while(l.getElementById(this.id));this.rail=!1,this.cursor=!1,this.cursorfreezed=!1,this.selectiondrag=!1,this.zoom=!1,this.zoomactive=!1,this.hasfocus=!1,this.hasmousefocus=!1,this.visibility=!0,this.railslocked=!1,this.locked=!1,this.hidden=!1,this.cursoractive=!0,this.wheelprevented=!1,this.overflowx=M.overflowx,this.overflowy=M.overflowy,this.nativescrollingarea=!1,this.checkarea=0,this.events=[],this.saved={},this.delaylist={},this.synclist={},this.lastdeltax=0,this.lastdeltay=0,this.detected=w();var N=n.extend({},this.detected);this.canhwscroll=N.hastransform&&M.hwacceleration,this.ishwscroll=this.canhwscroll&&T.haswrapper,this.isrtlmode?this.isvertical?this.hasreversehr=!(N.iswebkit||N.isie||N.isie11):this.hasreversehr=!(N.iswebkit||N.isie&&!N.isie10&&!N.isie11):this.hasreversehr=!1,this.istouchcapable=!1,N.cantouch||!N.hasw3ctouch&&!N.hasmstouch?!N.cantouch||N.isios||N.isandroid||!N.iswebkit&&!N.ismozilla||(this.istouchcapable=!0):this.istouchcapable=!0,M.enablemouselockapi||(N.hasmousecapture=!1,N.haspointerlock=!1),this.debounced=function(e,o,t){T&&(T.delaylist[e]||!1||(T.delaylist[e]={h:u(function(){T.delaylist[e].fn.call(T),T.delaylist[e]=!1},t)},o.call(T)),T.delaylist[e].fn=o)},this.synched=function(e,o){T.synclist[e]?T.synclist[e]=o:(T.synclist[e]=o,u(function(){T&&(T.synclist[e]&&T.synclist[e].call(T),T.synclist[e]=null)}))},this.unsynched=function(e){T.synclist[e]&&(T.synclist[e]=!1)},this.css=function(e,o){for(var t in o)T.saved.css.push([e,t,e.css(t)]),e.css(t,o[t])},this.scrollTop=function(e){return void 0===e?T.getScrollTop():T.setScrollTop(e)},this.scrollLeft=function(e){return void 0===e?T.getScrollLeft():T.setScrollLeft(e)};var R=function(e,o,t,r,i,s,n){this.st=e,this.ed=o,this.spd=t,this.p1=r||0,this.p2=i||1,this.p3=s||0,this.p4=n||1,this.ts=f(),this.df=o-e};if(R.prototype={B2:function(e){return 3*(1-e)*(1-e)*e},B3:function(e){return 3*(1-e)*e*e},B4:function(e){return e*e*e},getPos:function(){return(f()-this.ts)/this.spd},getNow:function(){var e=(f()-this.ts)/this.spd,o=this.B2(e)+this.B3(e)+this.B4(e);return e>=1?this.ed:this.st+this.df*o|0},update:function(e,o){return this.st=this.getNow(),this.ed=e,this.spd=o,this.ts=f(),this.df=this.ed-this.st,this}},this.ishwscroll){this.doc.translate={x:0,y:0,tx:"0px",ty:"0px"},N.hastranslate3d&&N.isios&&this.doc.css("-webkit-backface-visibility","hidden"),this.getScrollTop=function(e){if(!e){var o=v();if(o)return 16==o.length?-o[13]:-o[5];if(T.timerscroll&&T.timerscroll.bz)return T.timerscroll.bz.getNow()}return T.doc.translate.y},this.getScrollLeft=function(e){if(!e){var o=v();if(o)return 16==o.length?-o[12]:-o[4];if(T.timerscroll&&T.timerscroll.bh)return T.timerscroll.bh.getNow()}return T.doc.translate.x},this.notifyScrollEvent=function(e){var o=l.createEvent("UIEvents");o.initUIEvent("scroll",!1,!1,a,1),o.niceevent=!0,e.dispatchEvent(o)};var _=this.isrtlmode?1:-1;N.hastranslate3d&&M.enabletranslate3d?(this.setScrollTop=function(e,o){T.doc.translate.y=e,T.doc.translate.ty=-1*e+"px",T.doc.css(N.trstyle,"translate3d("+T.doc.translate.tx+","+T.doc.translate.ty+",0)"),o||T.notifyScrollEvent(T.win[0])},this.setScrollLeft=function(e,o){T.doc.translate.x=e,T.doc.translate.tx=e*_+"px",T.doc.css(N.trstyle,"translate3d("+T.doc.translate.tx+","+T.doc.translate.ty+",0)"),o||T.notifyScrollEvent(T.win[0])}):(this.setScrollTop=function(e,o){T.doc.translate.y=e,T.doc.translate.ty=-1*e+"px",T.doc.css(N.trstyle,"translate("+T.doc.translate.tx+","+T.doc.translate.ty+")"),o||T.notifyScrollEvent(T.win[0])},this.setScrollLeft=function(e,o){T.doc.translate.x=e,T.doc.translate.tx=e*_+"px",T.doc.css(N.trstyle,"translate("+T.doc.translate.tx+","+T.doc.translate.ty+")"),o||T.notifyScrollEvent(T.win[0])})}else this.getScrollTop=function(){return T.docscroll.scrollTop()},this.setScrollTop=function(e){T.docscroll.scrollTop(e)},this.getScrollLeft=function(){return T.hasreversehr?T.detected.ismozilla?T.page.maxw-Math.abs(T.docscroll.scrollLeft()):T.page.maxw-T.docscroll.scrollLeft():T.docscroll.scrollLeft()},this.setScrollLeft=function(e){return setTimeout(function(){if(T)return T.hasreversehr&&(e=T.detected.ismozilla?-(T.page.maxw-e):T.page.maxw-e),T.docscroll.scrollLeft(e)},1)};this.getTarget=function(e){return!!e&&(e.target?e.target:!!e.srcElement&&e.srcElement)},this.hasParent=function(e,o){if(!e)return!1;for(var t=e.target||e.srcElement||e||!1;t&&t.id!=o;)t=t.parentNode||!1;return!1!==t};var I={thin:1,medium:3,thick:5};this.getDocumentScrollOffset=function(){return{top:a.pageYOffset||l.documentElement.scrollTop,left:a.pageXOffset||l.documentElement.scrollLeft}},this.getOffset=function(){if(T.isfixed){var e=T.win.offset(),o=T.getDocumentScrollOffset();return e.top-=o.top,e.left-=o.left,e}var t=T.win.offset();if(!T.viewport)return t;var r=T.viewport.offset();return{top:t.top-r.top,left:t.left-r.left}},this.updateScrollBar=function(e){var o,t;if(T.ishwscroll)T.rail.css({height:T.win.innerHeight()-(M.railpadding.top+M.railpadding.bottom)}),T.railh&&T.railh.css({width:T.win.innerWidth()-(M.railpadding.left+M.railpadding.right)});else{var r=T.getOffset();if(o={top:r.top,left:r.left-(M.railpadding.left+M.railpadding.right)},o.top+=x(T.win,"border-top-width",!0),o.left+=T.rail.align?T.win.outerWidth()-x(T.win,"border-right-width")-T.rail.width:x(T.win,"border-left-width"),(t=M.railoffset)&&(t.top&&(o.top+=t.top),t.left&&(o.left+=t.left)),T.railslocked||T.rail.css({top:o.top,left:o.left,height:(e?e.h:T.win.innerHeight())-(M.railpadding.top+M.railpadding.bottom)}),T.zoom&&T.zoom.css({top:o.top+1,left:1==T.rail.align?o.left-20:o.left+T.rail.width+4}),T.railh&&!T.railslocked){o={top:r.top,left:r.left},(t=M.railhoffset)&&(t.top&&(o.top+=t.top),t.left&&(o.left+=t.left));var i=T.railh.align?o.top+x(T.win,"border-top-width",!0)+T.win.innerHeight()-T.railh.height:o.top+x(T.win,"border-top-width",!0),s=o.left+x(T.win,"border-left-width");T.railh.css({top:i-(M.railpadding.top+M.railpadding.bottom),left:s,width:T.railh.width})}}},this.doRailClick=function(e,o,t){var r,i,s,n;T.railslocked||(T.cancelEvent(e),"pageY"in e||(e.pageX=e.clientX+l.documentElement.scrollLeft,e.pageY=e.clientY+l.documentElement.scrollTop),o?(r=t?T.doScrollLeft:T.doScrollTop,s=t?(e.pageX-T.railh.offset().left-T.cursorwidth/2)*T.scrollratio.x:(e.pageY-T.rail.offset().top-T.cursorheight/2)*T.scrollratio.y,T.unsynched("relativexy"),r(0|s)):(r=t?T.doScrollLeftBy:T.doScrollBy,s=t?T.scroll.x:T.scroll.y,n=t?e.pageX-T.railh.offset().left:e.pageY-T.rail.offset().top,i=t?T.view.w:T.view.h,r(s>=n?i:-i)))},T.newscrolly=T.newscrollx=0,T.hasanimationframe="requestAnimationFrame"in a,T.hascancelanimationframe="cancelAnimationFrame"in a,T.hasborderbox=!1,this.init=function(){if(T.saved.css=[],N.isoperamini)return!0;if(N.isandroid&&!("hidden"in l))return!0;M.emulatetouch=M.emulatetouch||M.touchbehavior,T.hasborderbox=a.getComputedStyle&&"border-box"===a.getComputedStyle(l.body)["box-sizing"];var e={"overflow-y":"hidden"};if((N.isie11||N.isie10)&&(e["-ms-overflow-style"]="none"),T.ishwscroll&&(this.doc.css(N.transitionstyle,N.prefixstyle+"transform 0ms ease-out"),N.transitionend&&T.bind(T.doc,N.transitionend,T.onScrollTransitionEnd,!1)),T.zindex="auto",T.ispage||"auto"!=M.zindex?T.zindex=M.zindex:T.zindex=b()||"auto",!T.ispage&&"auto"!=T.zindex&&T.zindex>s&&(s=T.zindex),T.isie&&0===T.zindex&&"auto"==M.zindex&&(T.zindex="auto"),!T.ispage||!N.isieold){var i=T.docscroll;T.ispage&&(i=T.haswrapper?T.win:T.doc),T.css(i,e),T.ispage&&(N.isie11||N.isie)&&T.css(n("html"),e),!N.isios||T.ispage||T.haswrapper||T.css(E,{"-webkit-overflow-scrolling":"touch"});var d=n(l.createElement("div"));d.css({position:"relative",top:0,float:"right",width:M.cursorwidth,height:0,"background-color":M.cursorcolor,border:M.cursorborder,"background-clip":"padding-box","-webkit-border-radius":M.cursorborderradius,"-moz-border-radius":M.cursorborderradius,"border-radius":M.cursorborderradius}),d.addClass("nicescroll-cursors"),T.cursor=d;var u=n(l.createElement("div"));u.attr("id",T.id),u.addClass("nicescroll-rails nicescroll-rails-vr");var h,p,f=["left","right","top","bottom"];for(var g in f)p=f[g],(h=M.railpadding[p]||0)&&u.css("padding-"+p,h+"px");u.append(d),u.width=Math.max(parseFloat(M.cursorwidth),d.outerWidth()),u.css({width:u.width+"px",zIndex:T.zindex,background:M.background,cursor:"default"}),u.visibility=!0,u.scrollable=!0,u.align="left"==M.railalign?0:1,T.rail=u,T.rail.drag=!1;var v=!1;!M.boxzoom||T.ispage||N.isieold||(v=l.createElement("div"),T.bind(v,"click",T.doZoom),T.bind(v,"mouseenter",function(){T.zoom.css("opacity",M.cursoropacitymax)}),T.bind(v,"mouseleave",function(){T.zoom.css("opacity",M.cursoropacitymin)}),T.zoom=n(v),T.zoom.css({cursor:"pointer",zIndex:T.zindex,backgroundImage:"url("+M.scriptpath+"zoomico.png)",height:18,width:18,backgroundPosition:"0 0"}),M.dblclickzoom&&T.bind(T.win,"dblclick",T.doZoom),N.cantouch&&M.gesturezoom&&(T.ongesturezoom=function(e){return e.scale>1.5&&T.doZoomIn(e),e.scale<.8&&T.doZoomOut(e),T.cancelEvent(e)},T.bind(T.win,"gestureend",T.ongesturezoom))),T.railh=!1;var w;if(M.horizrailenabled&&(T.css(i,{overflowX:"hidden"}),(d=n(l.createElement("div"))).css({position:"absolute",top:0,height:M.cursorwidth,width:0,backgroundColor:M.cursorcolor,border:M.cursorborder,backgroundClip:"padding-box","-webkit-border-radius":M.cursorborderradius,"-moz-border-radius":M.cursorborderradius,"border-radius":M.cursorborderradius}),N.isieold&&d.css("overflow","hidden"),d.addClass("nicescroll-cursors"),T.cursorh=d,(w=n(l.createElement("div"))).attr("id",T.id+"-hr"),w.addClass("nicescroll-rails nicescroll-rails-hr"),w.height=Math.max(parseFloat(M.cursorwidth),d.outerHeight()),w.css({height:w.height+"px",zIndex:T.zindex,background:M.background}),w.append(d),w.visibility=!0,w.scrollable=!0,w.align="top"==M.railvalign?0:1,T.railh=w,T.railh.drag=!1),T.ispage)u.css({position:"fixed",top:0,height:"100%"}),u.css(u.align?{right:0}:{left:0}),T.body.append(u),T.railh&&(w.css({position:"fixed",left:0,width:"100%"}),w.css(w.align?{bottom:0}:{top:0}),T.body.append(w));else{if(T.ishwscroll){"static"==T.win.css("position")&&T.css(T.win,{position:"relative"});var x="HTML"==T.win[0].nodeName?T.body:T.win;n(x).scrollTop(0).scrollLeft(0),T.zoom&&(T.zoom.css({position:"absolute",top:1,right:0,"margin-right":u.width+4}),x.append(T.zoom)),u.css({position:"absolute",top:0}),u.css(u.align?{right:0}:{left:0}),x.append(u),w&&(w.css({position:"absolute",left:0,bottom:0}),w.css(w.align?{bottom:0}:{top:0}),x.append(w))}else{T.isfixed="fixed"==T.win.css("position");var S=T.isfixed?"fixed":"absolute";T.isfixed||(T.viewport=T.getViewport(T.win[0])),T.viewport&&(T.body=T.viewport,/fixed|absolute/.test(T.viewport.css("position"))||T.css(T.viewport,{position:"relative"})),u.css({position:S}),T.zoom&&T.zoom.css({position:S}),T.updateScrollBar(),T.body.append(u),T.zoom&&T.body.append(T.zoom),T.railh&&(w.css({position:S}),T.body.append(w))}N.isios&&T.css(T.win,{"-webkit-tap-highlight-color":"rgba(0,0,0,0)","-webkit-touch-callout":"none"}),M.disableoutline&&(N.isie&&T.win.attr("hideFocus","true"),N.iswebkit&&T.win.css("outline","none"))}if(!1===M.autohidemode?(T.autohidedom=!1,T.rail.css({opacity:M.cursoropacitymax}),T.railh&&T.railh.css({opacity:M.cursoropacitymax})):!0===M.autohidemode||"leave"===M.autohidemode?(T.autohidedom=n().add(T.rail),N.isie8&&(T.autohidedom=T.autohidedom.add(T.cursor)),T.railh&&(T.autohidedom=T.autohidedom.add(T.railh)),T.railh&&N.isie8&&(T.autohidedom=T.autohidedom.add(T.cursorh))):"scroll"==M.autohidemode?(T.autohidedom=n().add(T.rail),T.railh&&(T.autohidedom=T.autohidedom.add(T.railh))):"cursor"==M.autohidemode?(T.autohidedom=n().add(T.cursor),T.railh&&(T.autohidedom=T.autohidedom.add(T.cursorh))):"hidden"==M.autohidemode&&(T.autohidedom=!1,T.hide(),T.railslocked=!1),N.cantouch||T.istouchcapable||M.emulatetouch||N.hasmstouch){T.scrollmom=new y(T);T.ontouchstart=function(e){if(T.locked)return!1;if(e.pointerType&&("mouse"===e.pointerType||e.pointerType===e.MSPOINTER_TYPE_MOUSE))return!1;if(T.hasmoving=!1,T.scrollmom.timer&&(T.triggerScrollEnd(),T.scrollmom.stop()),!T.railslocked){var o=T.getTarget(e);if(o&&/INPUT/i.test(o.nodeName)&&/range/i.test(o.type))return T.stopPropagation(e);var t="mousedown"===e.type;if(!("clientX"in e)&&"changedTouches"in e&&(e.clientX=e.changedTouches[0].clientX,e.clientY=e.changedTouches[0].clientY),T.forcescreen){var r=e;(e={original:e.original?e.original:e}).clientX=r.screenX,e.clientY=r.screenY}if(T.rail.drag={x:e.clientX,y:e.clientY,sx:T.scroll.x,sy:T.scroll.y,st:T.getScrollTop(),sl:T.getScrollLeft(),pt:2,dl:!1,tg:o},T.ispage||!M.directionlockdeadzone)T.rail.drag.dl="f";else{var i={w:c.width(),h:c.height()},s=T.getContentSize(),l=s.h-i.h,a=s.w-i.w;T.rail.scrollable&&!T.railh.scrollable?T.rail.drag.ck=l>0&&"v":!T.rail.scrollable&&T.railh.scrollable?T.rail.drag.ck=a>0&&"h":T.rail.drag.ck=!1}if(M.emulatetouch&&T.isiframe&&N.isie){var d=T.win.position();T.rail.drag.x+=d.left,T.rail.drag.y+=d.top}if(T.hasmoving=!1,T.lastmouseup=!1,T.scrollmom.reset(e.clientX,e.clientY),o&&t){if(!/INPUT|SELECT|BUTTON|TEXTAREA/i.test(o.nodeName))return N.hasmousecapture&&o.setCapture(),M.emulatetouch?(o.onclick&&!o._onclick&&(o._onclick=o.onclick,o.onclick=function(e){if(T.hasmoving)return!1;o._onclick.call(this,e)}),T.cancelEvent(e)):T.stopPropagation(e);/SUBMIT|CANCEL|BUTTON/i.test(n(o).attr("type"))&&(T.preventclick={tg:o,click:!1})}}},T.ontouchend=function(e){if(!T.rail.drag)return!0;if(2==T.rail.drag.pt){if(e.pointerType&&("mouse"===e.pointerType||e.pointerType===e.MSPOINTER_TYPE_MOUSE))return!1;T.rail.drag=!1;var o="mouseup"===e.type;if(T.hasmoving&&(T.scrollmom.doMomentum(),T.lastmouseup=!0,T.hideCursor(),N.hasmousecapture&&l.releaseCapture(),o))return T.cancelEvent(e)}else if(1==T.rail.drag.pt)return T.onmouseup(e)};var z=M.emulatetouch&&T.isiframe&&!N.hasmousecapture,k=.3*M.directionlockdeadzone|0;T.ontouchmove=function(e,o){if(!T.rail.drag)return!0;if(e.targetTouches&&M.preventmultitouchscrolling&&e.targetTouches.length>1)return!0;if(e.pointerType&&("mouse"===e.pointerType||e.pointerType===e.MSPOINTER_TYPE_MOUSE))return!0;if(2==T.rail.drag.pt){"changedTouches"in e&&(e.clientX=e.changedTouches[0].clientX,e.clientY=e.changedTouches[0].clientY);var t,r;if(r=t=0,z&&!o){var i=T.win.position();r=-i.left,t=-i.top}var s=e.clientY+t,n=s-T.rail.drag.y,a=e.clientX+r,c=a-T.rail.drag.x,d=T.rail.drag.st-n;if(T.ishwscroll&&M.bouncescroll)d<0?d=Math.round(d/2):d>T.page.maxh&&(d=T.page.maxh+Math.round((d-T.page.maxh)/2));else if(d<0?(d=0,s=0):d>T.page.maxh&&(d=T.page.maxh,s=0),0===s&&!T.hasmoving)return T.ispage||(T.rail.drag=!1),!0;var u=T.getScrollLeft();if(T.railh&&T.railh.scrollable&&(u=T.isrtlmode?c-T.rail.drag.sl:T.rail.drag.sl-c,T.ishwscroll&&M.bouncescroll?u<0?u=Math.round(u/2):u>T.page.maxw&&(u=T.page.maxw+Math.round((u-T.page.maxw)/2)):(u<0&&(u=0,a=0),u>T.page.maxw&&(u=T.page.maxw,a=0))),!T.hasmoving){if(T.rail.drag.y===e.clientY&&T.rail.drag.x===e.clientX)return T.cancelEvent(e);var h=Math.abs(n),p=Math.abs(c),m=M.directionlockdeadzone;if(T.rail.drag.ck?"v"==T.rail.drag.ck?p>m&&h<=k?T.rail.drag=!1:h>m&&(T.rail.drag.dl="v"):"h"==T.rail.drag.ck&&(h>m&&p<=k?T.rail.drag=!1:p>m&&(T.rail.drag.dl="h")):h>m&&p>m?T.rail.drag.dl="f":h>m?T.rail.drag.dl=p>k?"f":"v":p>m&&(T.rail.drag.dl=h>k?"f":"h"),!T.rail.drag.dl)return T.cancelEvent(e);T.triggerScrollStart(e.clientX,e.clientY,0,0,0),T.hasmoving=!0}return T.preventclick&&!T.preventclick.click&&(T.preventclick.click=T.preventclick.tg.onclick||!1,T.preventclick.tg.onclick=T.onpreventclick),T.rail.drag.dl&&("v"==T.rail.drag.dl?u=T.rail.drag.sl:"h"==T.rail.drag.dl&&(d=T.rail.drag.st)),T.synched("touchmove",function(){T.rail.drag&&2==T.rail.drag.pt&&(T.prepareTransition&&T.resetTransition(),T.rail.scrollable&&T.setScrollTop(d),T.scrollmom.update(a,s),T.railh&&T.railh.scrollable?(T.setScrollLeft(u),T.showCursor(d,u)):T.showCursor(d),N.isie10&&l.selection.clear())}),T.cancelEvent(e)}return 1==T.rail.drag.pt?T.onmousemove(e):void 0},T.ontouchstartCursor=function(e,o){if(!T.rail.drag||3==T.rail.drag.pt){if(T.locked)return T.cancelEvent(e);T.cancelScroll(),T.rail.drag={x:e.touches[0].clientX,y:e.touches[0].clientY,sx:T.scroll.x,sy:T.scroll.y,pt:3,hr:!!o};var t=T.getTarget(e);return!T.ispage&&N.hasmousecapture&&t.setCapture(),T.isiframe&&!N.hasmousecapture&&(T.saved.csspointerevents=T.doc.css("pointer-events"),T.css(T.doc,{"pointer-events":"none"})),T.cancelEvent(e)}},T.ontouchendCursor=function(e){if(T.rail.drag){if(N.hasmousecapture&&l.releaseCapture(),T.isiframe&&!N.hasmousecapture&&T.doc.css("pointer-events",T.saved.csspointerevents),3!=T.rail.drag.pt)return;return T.rail.drag=!1,T.cancelEvent(e)}},T.ontouchmoveCursor=function(e){if(T.rail.drag){if(3!=T.rail.drag.pt)return;if(T.cursorfreezed=!0,T.rail.drag.hr){T.scroll.x=T.rail.drag.sx+(e.touches[0].clientX-T.rail.drag.x),T.scroll.x<0&&(T.scroll.x=0);var o=T.scrollvaluemaxw;T.scroll.x>o&&(T.scroll.x=o)}else{T.scroll.y=T.rail.drag.sy+(e.touches[0].clientY-T.rail.drag.y),T.scroll.y<0&&(T.scroll.y=0);var t=T.scrollvaluemax;T.scroll.y>t&&(T.scroll.y=t)}return T.synched("touchmove",function(){T.rail.drag&&3==T.rail.drag.pt&&(T.showCursor(),T.rail.drag.hr?T.doScrollLeft(Math.round(T.scroll.x*T.scrollratio.x),M.cursordragspeed):T.doScrollTop(Math.round(T.scroll.y*T.scrollratio.y),M.cursordragspeed))}),T.cancelEvent(e)}}}if(T.onmousedown=function(e,o){if(!T.rail.drag||1==T.rail.drag.pt){if(T.railslocked)return T.cancelEvent(e);T.cancelScroll(),T.rail.drag={x:e.clientX,y:e.clientY,sx:T.scroll.x,sy:T.scroll.y,pt:1,hr:o||!1};var t=T.getTarget(e);return N.hasmousecapture&&t.setCapture(),T.isiframe&&!N.hasmousecapture&&(T.saved.csspointerevents=T.doc.css("pointer-events"),T.css(T.doc,{"pointer-events":"none"})),T.hasmoving=!1,T.cancelEvent(e)}},T.onmouseup=function(e){if(T.rail.drag)return 1!=T.rail.drag.pt||(N.hasmousecapture&&l.releaseCapture(),T.isiframe&&!N.hasmousecapture&&T.doc.css("pointer-events",T.saved.csspointerevents),T.rail.drag=!1,T.cursorfreezed=!1,T.hasmoving&&T.triggerScrollEnd(),T.cancelEvent(e))},T.onmousemove=function(e){if(T.rail.drag){if(1!==T.rail.drag.pt)return;if(N.ischrome&&0===e.which)return T.onmouseup(e);if(T.cursorfreezed=!0,T.hasmoving||T.triggerScrollStart(e.clientX,e.clientY,0,0,0),T.hasmoving=!0,T.rail.drag.hr){T.scroll.x=T.rail.drag.sx+(e.clientX-T.rail.drag.x),T.scroll.x<0&&(T.scroll.x=0);var o=T.scrollvaluemaxw;T.scroll.x>o&&(T.scroll.x=o)}else{T.scroll.y=T.rail.drag.sy+(e.clientY-T.rail.drag.y),T.scroll.y<0&&(T.scroll.y=0);var t=T.scrollvaluemax;T.scroll.y>t&&(T.scroll.y=t)}return T.synched("mousemove",function(){T.cursorfreezed&&(T.showCursor(),T.rail.drag.hr?T.scrollLeft(Math.round(T.scroll.x*T.scrollratio.x)):T.scrollTop(Math.round(T.scroll.y*T.scrollratio.y)))}),T.cancelEvent(e)}T.checkarea=0},N.cantouch||M.emulatetouch)T.onpreventclick=function(e){if(T.preventclick)return T.preventclick.tg.onclick=T.preventclick.click,T.preventclick=!1,T.cancelEvent(e)},T.onclick=!N.isios&&function(e){return!T.lastmouseup||(T.lastmouseup=!1,T.cancelEvent(e))},M.grabcursorenabled&&N.cursorgrabvalue&&(T.css(T.ispage?T.doc:T.win,{cursor:N.cursorgrabvalue}),T.css(T.rail,{cursor:N.cursorgrabvalue}));else{var L=function(e){if(T.selectiondrag){if(e){var o=T.win.outerHeight(),t=e.pageY-T.selectiondrag.top;t>0&&t=o&&(t-=o),T.selectiondrag.df=t}if(0!==T.selectiondrag.df){var r=-2*T.selectiondrag.df/6|0;T.doScrollBy(r),T.debounced("doselectionscroll",function(){L()},50)}}};T.hasTextSelected="getSelection"in l?function(){return l.getSelection().rangeCount>0}:"selection"in l?function(){return"None"!=l.selection.type}:function(){return!1},T.onselectionstart=function(e){T.ispage||(T.selectiondrag=T.win.offset())},T.onselectionend=function(e){T.selectiondrag=!1},T.onselectiondrag=function(e){T.selectiondrag&&T.hasTextSelected()&&T.debounced("selectionscroll",function(){L(e)},250)}}if(N.hasw3ctouch?(T.css(T.ispage?n("html"):T.win,{"touch-action":"none"}),T.css(T.rail,{"touch-action":"none"}),T.css(T.cursor,{"touch-action":"none"}),T.bind(T.win,"pointerdown",T.ontouchstart),T.bind(l,"pointerup",T.ontouchend),T.delegate(l,"pointermove",T.ontouchmove)):N.hasmstouch?(T.css(T.ispage?n("html"):T.win,{"-ms-touch-action":"none"}),T.css(T.rail,{"-ms-touch-action":"none"}),T.css(T.cursor,{"-ms-touch-action":"none"}),T.bind(T.win,"MSPointerDown",T.ontouchstart),T.bind(l,"MSPointerUp",T.ontouchend),T.delegate(l,"MSPointerMove",T.ontouchmove),T.bind(T.cursor,"MSGestureHold",function(e){e.preventDefault()}),T.bind(T.cursor,"contextmenu",function(e){e.preventDefault()})):N.cantouch&&(T.bind(T.win,"touchstart",T.ontouchstart,!1,!0),T.bind(l,"touchend",T.ontouchend,!1,!0),T.bind(l,"touchcancel",T.ontouchend,!1,!0),T.delegate(l,"touchmove",T.ontouchmove,!1,!0)),M.emulatetouch&&(T.bind(T.win,"mousedown",T.ontouchstart,!1,!0),T.bind(l,"mouseup",T.ontouchend,!1,!0),T.bind(l,"mousemove",T.ontouchmove,!1,!0)),(M.cursordragontouch||!N.cantouch&&!M.emulatetouch)&&(T.rail.css({cursor:"default"}),T.railh&&T.railh.css({cursor:"default"}),T.jqbind(T.rail,"mouseenter",function(){if(!T.ispage&&!T.win.is(":visible"))return!1;T.canshowonmouseevent&&T.showCursor(),T.rail.active=!0}),T.jqbind(T.rail,"mouseleave",function(){T.rail.active=!1,T.rail.drag||T.hideCursor()}),M.sensitiverail&&(T.bind(T.rail,"click",function(e){T.doRailClick(e,!1,!1)}),T.bind(T.rail,"dblclick",function(e){T.doRailClick(e,!0,!1)}),T.bind(T.cursor,"click",function(e){T.cancelEvent(e)}),T.bind(T.cursor,"dblclick",function(e){T.cancelEvent(e)})),T.railh&&(T.jqbind(T.railh,"mouseenter",function(){if(!T.ispage&&!T.win.is(":visible"))return!1;T.canshowonmouseevent&&T.showCursor(),T.rail.active=!0}),T.jqbind(T.railh,"mouseleave",function(){T.rail.active=!1,T.rail.drag||T.hideCursor()}),M.sensitiverail&&(T.bind(T.railh,"click",function(e){T.doRailClick(e,!1,!0)}),T.bind(T.railh,"dblclick",function(e){T.doRailClick(e,!0,!0)}),T.bind(T.cursorh,"click",function(e){T.cancelEvent(e)}),T.bind(T.cursorh,"dblclick",function(e){T.cancelEvent(e)})))),M.cursordragontouch&&(this.istouchcapable||N.cantouch)&&(T.bind(T.cursor,"touchstart",T.ontouchstartCursor),T.bind(T.cursor,"touchmove",T.ontouchmoveCursor),T.bind(T.cursor,"touchend",T.ontouchendCursor),T.cursorh&&T.bind(T.cursorh,"touchstart",function(e){T.ontouchstartCursor(e,!0)}),T.cursorh&&T.bind(T.cursorh,"touchmove",T.ontouchmoveCursor),T.cursorh&&T.bind(T.cursorh,"touchend",T.ontouchendCursor)),N.cantouch||M.emulatetouch?(T.bind(N.hasmousecapture?T.win:l,"mouseup",T.ontouchend),T.onclick&&T.bind(l,"click",T.onclick),M.cursordragontouch?(T.bind(T.cursor,"mousedown",T.onmousedown),T.bind(T.cursor,"mouseup",T.onmouseup),T.cursorh&&T.bind(T.cursorh,"mousedown",function(e){T.onmousedown(e,!0)}),T.cursorh&&T.bind(T.cursorh,"mouseup",T.onmouseup)):(T.bind(T.rail,"mousedown",function(e){e.preventDefault()}),T.railh&&T.bind(T.railh,"mousedown",function(e){e.preventDefault()}))):(T.bind(N.hasmousecapture?T.win:l,"mouseup",T.onmouseup),T.bind(l,"mousemove",T.onmousemove),T.onclick&&T.bind(l,"click",T.onclick),T.bind(T.cursor,"mousedown",T.onmousedown),T.bind(T.cursor,"mouseup",T.onmouseup),T.railh&&(T.bind(T.cursorh,"mousedown",function(e){T.onmousedown(e,!0)}),T.bind(T.cursorh,"mouseup",T.onmouseup)),!T.ispage&&M.enablescrollonselection&&(T.bind(T.win[0],"mousedown",T.onselectionstart),T.bind(l,"mouseup",T.onselectionend),T.bind(T.cursor,"mouseup",T.onselectionend),T.cursorh&&T.bind(T.cursorh,"mouseup",T.onselectionend),T.bind(l,"mousemove",T.onselectiondrag)),T.zoom&&(T.jqbind(T.zoom,"mouseenter",function(){T.canshowonmouseevent&&T.showCursor(),T.rail.active=!0}),T.jqbind(T.zoom,"mouseleave",function(){T.rail.active=!1,T.rail.drag||T.hideCursor()}))),M.enablemousewheel&&(T.isiframe||T.mousewheel(N.isie&&T.ispage?l:T.win,T.onmousewheel),T.mousewheel(T.rail,T.onmousewheel),T.railh&&T.mousewheel(T.railh,T.onmousewheelhr)),T.ispage||N.cantouch||/HTML|^BODY/.test(T.win[0].nodeName)||(T.win.attr("tabindex")||T.win.attr({tabindex:++r}),T.bind(T.win,"focus",function(e){o=T.getTarget(e).id||T.getTarget(e)||!1,T.hasfocus=!0,T.canshowonmouseevent&&T.noticeCursor()}),T.bind(T.win,"blur",function(e){o=!1,T.hasfocus=!1}),T.bind(T.win,"mouseenter",function(e){t=T.getTarget(e).id||T.getTarget(e)||!1,T.hasmousefocus=!0,T.canshowonmouseevent&&T.noticeCursor()}),T.bind(T.win,"mouseleave",function(e){t=!1,T.hasmousefocus=!1,T.rail.drag||T.hideCursor()})),T.onkeypress=function(e){if(T.railslocked&&0===T.page.maxh)return!0;e=e||a.event;var r=T.getTarget(e);if(r&&/INPUT|TEXTAREA|SELECT|OPTION/.test(r.nodeName)&&(!(r.getAttribute("type")||r.type||!1)||!/submit|button|cancel/i.tp))return!0;if(n(r).attr("contenteditable"))return!0;if(T.hasfocus||T.hasmousefocus&&!o||T.ispage&&!o&&!t){var i=e.keyCode;if(T.railslocked&&27!=i)return T.cancelEvent(e);var s=e.ctrlKey||!1,l=e.shiftKey||!1,c=!1;switch(i){case 38:case 63233:T.doScrollBy(72),c=!0;break;case 40:case 63235:T.doScrollBy(-72),c=!0;break;case 37:case 63232:T.railh&&(s?T.doScrollLeft(0):T.doScrollLeftBy(72),c=!0);break;case 39:case 63234:T.railh&&(s?T.doScrollLeft(T.page.maxw):T.doScrollLeftBy(-72),c=!0);break;case 33:case 63276:T.doScrollBy(T.view.h),c=!0;break;case 34:case 63277:T.doScrollBy(-T.view.h),c=!0;break;case 36:case 63273:T.railh&&s?T.doScrollPos(0,0):T.doScrollTo(0),c=!0;break;case 35:case 63275:T.railh&&s?T.doScrollPos(T.page.maxw,T.page.maxh):T.doScrollTo(T.page.maxh),c=!0;break;case 32:M.spacebarenabled&&(l?T.doScrollBy(T.view.h):T.doScrollBy(-T.view.h),c=!0);break;case 27:T.zoomactive&&(T.doZoom(),c=!0)}if(c)return T.cancelEvent(e)}},M.enablekeyboard&&T.bind(l,N.isopera&&!N.isopera12?"keypress":"keydown",T.onkeypress),T.bind(l,"keydown",function(e){(e.ctrlKey||!1)&&(T.wheelprevented=!0)}),T.bind(l,"keyup",function(e){e.ctrlKey||!1||(T.wheelprevented=!1)}),T.bind(a,"blur",function(e){T.wheelprevented=!1}),T.bind(a,"resize",T.onscreenresize),T.bind(a,"orientationchange",T.onscreenresize),T.bind(a,"load",T.lazyResize),N.ischrome&&!T.ispage&&!T.haswrapper){var C=T.win.attr("style"),P=parseFloat(T.win.css("width"))+1;T.win.css("width",P),T.synched("chromefix",function(){T.win.attr("style",C)})}T.onAttributeChange=function(e){T.lazyResize(T.isieold?250:30)},M.enableobserver&&(T.isie11||!1===m||(T.observerbody=new m(function(e){if(e.forEach(function(e){if("attributes"==e.type)return E.hasClass("modal-open")&&E.hasClass("modal-dialog")&&!n.contains(n(".modal-dialog")[0],T.doc[0])?T.hide():T.show()}),T.me.clientWidth!=T.page.width||T.me.clientHeight!=T.page.height)return T.lazyResize(30)}),T.observerbody.observe(l.body,{childList:!0,subtree:!0,characterData:!1,attributes:!0,attributeFilter:["class"]})),T.ispage||T.haswrapper||(!1!==m?(T.observer=new m(function(e){e.forEach(T.onAttributeChange)}),T.observer.observe(T.win[0],{childList:!0,characterData:!1,attributes:!0,subtree:!1}),T.observerremover=new m(function(e){e.forEach(function(e){if(e.removedNodes.length>0)for(var o in e.removedNodes)if(T&&e.removedNodes[o]==T.win[0])return T.remove()})}),T.observerremover.observe(T.win[0].parentNode,{childList:!0,characterData:!1,attributes:!1,subtree:!1})):(T.bind(T.win,N.isie&&!N.isie9?"propertychange":"DOMAttrModified",T.onAttributeChange),N.isie9&&T.win[0].attachEvent("onpropertychange",T.onAttributeChange),T.bind(T.win,"DOMNodeRemoved",function(e){e.target==T.win[0]&&T.remove()})))),!T.ispage&&M.boxzoom&&T.bind(a,"resize",T.resizeZoom),T.istextarea&&(T.bind(T.win,"keydown",T.lazyResize),T.bind(T.win,"mouseup",T.lazyResize)),T.lazyResize(30)}if("IFRAME"==this.doc[0].nodeName){var R=function(){T.iframexd=!1;var o;try{(o="contentDocument"in this?this.contentDocument:this.contentWindow._doc).domain}catch(e){T.iframexd=!0,o=!1}if(T.iframexd)return"console"in a&&console.log("NiceScroll error: policy restriced iframe"),!0;if(T.forcescreen=!0,T.isiframe&&(T.iframe={doc:n(o),html:T.doc.contents().find("html")[0],body:T.doc.contents().find("body")[0]},T.getContentSize=function(){return{w:Math.max(T.iframe.html.scrollWidth,T.iframe.body.scrollWidth),h:Math.max(T.iframe.html.scrollHeight,T.iframe.body.scrollHeight)}},T.docscroll=n(T.iframe.body)),!N.isios&&M.iframeautoresize&&!T.isiframe){T.win.scrollTop(0),T.doc.height("");var t=Math.max(o.getElementsByTagName("html")[0].scrollHeight,o.body.scrollHeight);T.doc.height(t)}T.lazyResize(30),T.css(n(T.iframe.body),e),N.isios&&T.haswrapper&&T.css(n(o.body),{"-webkit-transform":"translate3d(0,0,0)"}),"contentWindow"in this?T.bind(this.contentWindow,"scroll",T.onscroll):T.bind(o,"scroll",T.onscroll),M.enablemousewheel&&T.mousewheel(o,T.onmousewheel),M.enablekeyboard&&T.bind(o,N.isopera?"keypress":"keydown",T.onkeypress),N.cantouch?(T.bind(o,"touchstart",T.ontouchstart),T.bind(o,"touchmove",T.ontouchmove)):M.emulatetouch&&(T.bind(o,"mousedown",T.ontouchstart),T.bind(o,"mousemove",function(e){return T.ontouchmove(e,!0)}),M.grabcursorenabled&&N.cursorgrabvalue&&T.css(n(o.body),{cursor:N.cursorgrabvalue})),T.bind(o,"mouseup",T.ontouchend),T.zoom&&(M.dblclickzoom&&T.bind(o,"dblclick",T.doZoom),T.ongesturezoom&&T.bind(o,"gestureend",T.ongesturezoom))};this.doc[0].readyState&&"complete"===this.doc[0].readyState&&setTimeout(function(){R.call(T.doc[0],!1)},500),T.bind(this.doc,"load",R)}},this.showCursor=function(e,o){if(T.cursortimeout&&(clearTimeout(T.cursortimeout),T.cursortimeout=0),T.rail){if(T.autohidedom&&(T.autohidedom.stop().css({opacity:M.cursoropacitymax}),T.cursoractive=!0),T.rail.drag&&1==T.rail.drag.pt||(void 0!==e&&!1!==e&&(T.scroll.y=e/T.scrollratio.y|0),void 0!==o&&(T.scroll.x=o/T.scrollratio.x|0)),T.cursor.css({height:T.cursorheight,top:T.scroll.y}),T.cursorh){var t=T.hasreversehr?T.scrollvaluemaxw-T.scroll.x:T.scroll.x;T.cursorh.css({width:T.cursorwidth,left:!T.rail.align&&T.rail.visibility?t+T.rail.width:t}),T.cursoractive=!0}T.zoom&&T.zoom.stop().css({opacity:M.cursoropacitymax})}},this.hideCursor=function(e){T.cursortimeout||T.rail&&T.autohidedom&&(T.hasmousefocus&&"leave"===M.autohidemode||(T.cursortimeout=setTimeout(function(){T.rail.active&&T.showonmouseevent||(T.autohidedom.stop().animate({opacity:M.cursoropacitymin}),T.zoom&&T.zoom.stop().animate({opacity:M.cursoropacitymin}),T.cursoractive=!1),T.cursortimeout=0},e||M.hidecursordelay)))},this.noticeCursor=function(e,o,t){T.showCursor(o,t),T.rail.active||T.hideCursor(e)},this.getContentSize=T.ispage?function(){return{w:Math.max(l.body.scrollWidth,l.documentElement.scrollWidth),h:Math.max(l.body.scrollHeight,l.documentElement.scrollHeight)}}:T.haswrapper?function(){return{w:T.doc[0].offsetWidth,h:T.doc[0].offsetHeight}}:function(){return{w:T.docscroll[0].scrollWidth,h:T.docscroll[0].scrollHeight}},this.onResize=function(e,o){if(!T||!T.win)return!1;var t=T.page.maxh,r=T.page.maxw,i=T.view.h,s=T.view.w;if(T.view={w:T.ispage?T.win.width():T.win[0].clientWidth,h:T.ispage?T.win.height():T.win[0].clientHeight},T.page=o||T.getContentSize(),T.page.maxh=Math.max(0,T.page.h-T.view.h),T.page.maxw=Math.max(0,T.page.w-T.view.w),T.page.maxh==t&&T.page.maxw==r&&T.view.w==s&&T.view.h==i){if(T.ispage)return T;var n=T.win.offset();if(T.lastposition){var l=T.lastposition;if(l.top==n.top&&l.left==n.left)return T}T.lastposition=n}return 0===T.page.maxh?(T.hideRail(),T.scrollvaluemax=0,T.scroll.y=0,T.scrollratio.y=0,T.cursorheight=0,T.setScrollTop(0),T.rail&&(T.rail.scrollable=!1)):(T.page.maxh-=M.railpadding.top+M.railpadding.bottom,T.rail.scrollable=!0),0===T.page.maxw?(T.hideRailHr(),T.scrollvaluemaxw=0,T.scroll.x=0,T.scrollratio.x=0,T.cursorwidth=0,T.setScrollLeft(0),T.railh&&(T.railh.scrollable=!1)):(T.page.maxw-=M.railpadding.left+M.railpadding.right,T.railh&&(T.railh.scrollable=M.horizrailenabled)),T.railslocked=T.locked||0===T.page.maxh&&0===T.page.maxw,T.railslocked?(T.ispage||T.updateScrollBar(T.view),!1):(T.hidden||T.visibility?!T.railh||T.hidden||T.railh.visibility||T.showRailHr():T.showRail().showRailHr(),T.istextarea&&T.win.css("resize")&&"none"!=T.win.css("resize")&&(T.view.h-=20),T.cursorheight=Math.min(T.view.h,Math.round(T.view.h*(T.view.h/T.page.h))),T.cursorheight=M.cursorfixedheight?M.cursorfixedheight:Math.max(M.cursorminheight,T.cursorheight),T.cursorwidth=Math.min(T.view.w,Math.round(T.view.w*(T.view.w/T.page.w))),T.cursorwidth=M.cursorfixedheight?M.cursorfixedheight:Math.max(M.cursorminheight,T.cursorwidth),T.scrollvaluemax=T.view.h-T.cursorheight-(M.railpadding.top+M.railpadding.bottom),T.hasborderbox||(T.scrollvaluemax-=T.cursor[0].offsetHeight-T.cursor[0].clientHeight),T.railh&&(T.railh.width=T.page.maxh>0?T.view.w-T.rail.width:T.view.w,T.scrollvaluemaxw=T.railh.width-T.cursorwidth-(M.railpadding.left+M.railpadding.right)),T.ispage||T.updateScrollBar(T.view),T.scrollratio={x:T.page.maxw/T.scrollvaluemaxw,y:T.page.maxh/T.scrollvaluemax},T.getScrollTop()>T.page.maxh?T.doScrollTop(T.page.maxh):(T.scroll.y=T.getScrollTop()/T.scrollratio.y|0,T.scroll.x=T.getScrollLeft()/T.scrollratio.x|0,T.cursoractive&&T.noticeCursor()),T.scroll.y&&0===T.getScrollTop()&&T.doScrollTo(T.scroll.y*T.scrollratio.y|0),T)},this.resize=T.onResize;var O=0;this.onscreenresize=function(e){clearTimeout(O);var o=!T.ispage&&!T.haswrapper;o&&T.hideRails(),O=setTimeout(function(){T&&(o&&T.showRails(),T.resize()),O=0},120)},this.lazyResize=function(e){return clearTimeout(O),O=setTimeout(function(){T&&T.resize(),O=0},e||240),T},this.jqbind=function(e,o,t){T.events.push({e:e,n:o,f:t,q:!0}),n(e).on(o,t)},this.mousewheel=function(e,o,t){var r="jquery"in e?e[0]:e;if("onwheel"in l.createElement("div"))T._bind(r,"wheel",o,t||!1);else{var i=void 0!==l.onmousewheel?"mousewheel":"DOMMouseScroll";S(r,i,o,t||!1),"DOMMouseScroll"==i&&S(r,"MozMousePixelScroll",o,t||!1)}};var Y=!1;if(N.haseventlistener){try{var H=Object.defineProperty({},"passive",{get:function(){Y=!0}});a.addEventListener("test",null,H)}catch(e){}this.stopPropagation=function(e){return!!e&&((e=e.original?e.original:e).stopPropagation(),!1)},this.cancelEvent=function(e){return e.cancelable&&e.preventDefault(),e.stopImmediatePropagation(),e.preventManipulation&&e.preventManipulation(),!1}}else Event.prototype.preventDefault=function(){this.returnValue=!1},Event.prototype.stopPropagation=function(){this.cancelBubble=!0},a.constructor.prototype.addEventListener=l.constructor.prototype.addEventListener=Element.prototype.addEventListener=function(e,o,t){this.attachEvent("on"+e,o)},a.constructor.prototype.removeEventListener=l.constructor.prototype.removeEventListener=Element.prototype.removeEventListener=function(e,o,t){this.detachEvent("on"+e,o)},this.cancelEvent=function(e){return(e=e||a.event)&&(e.cancelBubble=!0,e.cancel=!0,e.returnValue=!1),!1},this.stopPropagation=function(e){return(e=e||a.event)&&(e.cancelBubble=!0),!1};this.delegate=function(e,o,t,r,i){var s=d[o]||!1;s||(s={a:[],l:[],f:function(e){for(var o=s.l,t=!1,r=o.length-1;r>=0;r--)if(!1===(t=o[r].call(e.target,e)))return!1;return t}},T.bind(e,o,s.f,r,i),d[o]=s),T.ispage?(s.a=[T.id].concat(s.a),s.l=[t].concat(s.l)):(s.a.push(T.id),s.l.push(t))},this.undelegate=function(e,o,t,r,i){var s=d[o]||!1;if(s)for(var n=0,l=s.l.length;n0)return t;o=!!o.parentNode&&o.parentNode}return!1},this.triggerScrollStart=function(e,o,t,r,i){if(T.onscrollstart){var s={type:"scrollstart",current:{x:e,y:o},request:{x:t,y:r},end:{x:T.newscrollx,y:T.newscrolly},speed:i};T.onscrollstart.call(T,s)}},this.triggerScrollEnd=function(){if(T.onscrollend){var e=T.getScrollLeft(),o=T.getScrollTop(),t={type:"scrollend",current:{x:e,y:o},end:{x:e,y:o}};T.onscrollend.call(T,t)}};var B=0,X=0,D=0,A=1,q=!1;if(this.onmousewheel=function(e){if(T.wheelprevented||T.locked)return!1;if(T.railslocked)return T.debounced("checkunlock",T.resize,250),!1;if(T.rail.drag)return T.cancelEvent(e);if("auto"===M.oneaxismousemode&&0!==e.deltaX&&(M.oneaxismousemode=!1),M.oneaxismousemode&&0===e.deltaX&&!T.rail.scrollable)return!T.railh||!T.railh.scrollable||T.onmousewheelhr(e);var o=f(),t=!1;if(M.preservenativescrolling&&T.checkarea+600T.page.maxh&&(o=T.page.maxh+(o-T.page.maxh)/2|0),e<0?e=e/2|0:e>T.page.maxw&&(e=T.page.maxw+(e-T.page.maxw)/2|0)):(o<0?o=0:o>T.page.maxh&&(o=T.page.maxh),e<0?e=0:e>T.page.maxw&&(e=T.page.maxw)),T.scrollrunning&&e==T.newscrollx&&o==T.newscrolly)return!1;T.newscrolly=o,T.newscrollx=e;var s=T.getScrollTop(),n=T.getScrollLeft(),l={};l.x=e-n,l.y=o-s;var a=0|Math.sqrt(l.x*l.x+l.y*l.y),c=T.prepareTransition(a);T.scrollrunning||(T.scrollrunning=!0,T.triggerScrollStart(n,s,e,o,c),T.cursorupdate.start()),T.scrollendtrapped=!0,N.transitionend||(T.scrollendtrapped&&clearTimeout(T.scrollendtrapped),T.scrollendtrapped=setTimeout(T.onScrollTransitionEnd,c)),T.setScrollTop(T.newscrolly),T.setScrollLeft(T.newscrollx)},this.cancelScroll=function(){if(!T.scrollendtrapped)return!0;var e=T.getScrollTop(),o=T.getScrollLeft();return T.scrollrunning=!1,N.transitionend||clearTimeout(N.transitionend),T.scrollendtrapped=!1,T.resetTransition(),T.setScrollTop(e),T.railh&&T.setScrollLeft(o),T.timerscroll&&T.timerscroll.tm&&clearInterval(T.timerscroll.tm),T.timerscroll=!1,T.cursorfreezed=!1,T.cursorupdate.stop(),T.showCursor(e,o),T},this.onScrollTransitionEnd=function(){if(T.scrollendtrapped){var e=T.getScrollTop(),o=T.getScrollLeft();if(e<0?e=0:e>T.page.maxh&&(e=T.page.maxh),o<0?o=0:o>T.page.maxw&&(o=T.page.maxw),e!=T.newscrolly||o!=T.newscrollx)return T.doScrollPos(o,e,M.snapbackspeed);T.scrollrunning&&T.triggerScrollEnd(),T.scrollrunning=!1,T.scrollendtrapped=!1,T.resetTransition(),T.timerscroll=!1,T.setScrollTop(e),T.railh&&T.setScrollLeft(o),T.cursorupdate.stop(),T.noticeCursor(!1,e,o),T.cursorfreezed=!1}}}else this.doScrollLeft=function(e,o){var t=T.scrollrunning?T.newscrolly:T.getScrollTop();T.doScrollPos(e,t,o)},this.doScrollTop=function(e,o){var t=T.scrollrunning?T.newscrollx:T.getScrollLeft();T.doScrollPos(t,e,o)},this.doScrollPos=function(e,o,t){var r=T.getScrollTop(),i=T.getScrollLeft();((T.newscrolly-r)*(o-r)<0||(T.newscrollx-i)*(e-i)<0)&&T.cancelScroll();var s=!1;if(T.bouncescroll&&T.rail.visibility||(o<0?(o=0,s=!0):o>T.page.maxh&&(o=T.page.maxh,s=!0)),T.bouncescroll&&T.railh.visibility||(e<0?(e=0,s=!0):e>T.page.maxw&&(e=T.page.maxw,s=!0)),T.scrollrunning&&T.newscrolly===o&&T.newscrollx===e)return!0;T.newscrolly=o,T.newscrollx=e,T.dst={},T.dst.x=e-i,T.dst.y=o-r,T.dst.px=i,T.dst.py=r;var n=0|Math.sqrt(T.dst.x*T.dst.x+T.dst.y*T.dst.y),l=T.getTransitionSpeed(n);T.bzscroll={};var a=s?1:.58;T.bzscroll.x=new R(i,T.newscrollx,l,0,0,a,1),T.bzscroll.y=new R(r,T.newscrolly,l,0,0,a,1);f();var c=function(){if(T.scrollrunning){var e=T.bzscroll.y.getPos();T.setScrollLeft(T.bzscroll.x.getNow()),T.setScrollTop(T.bzscroll.y.getNow()),e<=1?T.timer=u(c):(T.scrollrunning=!1,T.timer=0,T.triggerScrollEnd())}};T.scrollrunning||(T.triggerScrollStart(i,r,e,o,l),T.scrollrunning=!0,T.timer=u(c))},this.cancelScroll=function(){return T.timer&&h(T.timer),T.timer=0,T.bzscroll=!1,T.scrollrunning=!1,T};else this.doScrollLeft=function(e,o){var t=T.getScrollTop();T.doScrollPos(e,t,o)},this.doScrollTop=function(e,o){var t=T.getScrollLeft();T.doScrollPos(t,e,o)},this.doScrollPos=function(e,o,t){var r=e>T.page.maxw?T.page.maxw:e;r<0&&(r=0);var i=o>T.page.maxh?T.page.maxh:o;i<0&&(i=0),T.synched("scroll",function(){T.setScrollTop(i),T.setScrollLeft(r)})},this.cancelScroll=function(){};this.doScrollBy=function(e,o){z(0,e)},this.doScrollLeftBy=function(e,o){z(e,0)},this.doScrollTo=function(e,o){var t=o?Math.round(e*T.scrollratio.y):e;t<0?t=0:t>T.page.maxh&&(t=T.page.maxh),T.cursorfreezed=!1,T.doScrollTop(e)},this.checkContentSize=function(){var e=T.getContentSize();e.h==T.page.h&&e.w==T.page.w||T.resize(!1,e)},T.onscroll=function(e){T.rail.drag||T.cursorfreezed||T.synched("scroll",function(){T.scroll.y=Math.round(T.getScrollTop()/T.scrollratio.y),T.railh&&(T.scroll.x=Math.round(T.getScrollLeft()/T.scrollratio.x)),T.noticeCursor()})},T.bind(T.docscroll,"scroll",T.onscroll),this.doZoomIn=function(e){if(!T.zoomactive){T.zoomactive=!0,T.zoomrestore={style:{}};var o=["position","top","left","zIndex","backgroundColor","marginTop","marginBottom","marginLeft","marginRight"],t=T.win[0].style;for(var r in o){var i=o[r];T.zoomrestore.style[i]=void 0!==t[i]?t[i]:""}T.zoomrestore.style.width=T.win.css("width"),T.zoomrestore.style.height=T.win.css("height"),T.zoomrestore.padding={w:T.win.outerWidth()-T.win.width(),h:T.win.outerHeight()-T.win.height()},N.isios4&&(T.zoomrestore.scrollTop=c.scrollTop(),c.scrollTop(0)),T.win.css({position:N.isios4?"absolute":"fixed",top:0,left:0,zIndex:s+100,margin:0});var n=T.win.css("backgroundColor");return(""===n||/transparent|rgba\(0, 0, 0, 0\)|rgba\(0,0,0,0\)/.test(n))&&T.win.css("backgroundColor","#fff"),T.rail.css({zIndex:s+101}),T.zoom.css({zIndex:s+102}),T.zoom.css("backgroundPosition","0 -18px"),T.resizeZoom(),T.onzoomin&&T.onzoomin.call(T),T.cancelEvent(e)}},this.doZoomOut=function(e){if(T.zoomactive)return T.zoomactive=!1,T.win.css("margin",""),T.win.css(T.zoomrestore.style),N.isios4&&c.scrollTop(T.zoomrestore.scrollTop),T.rail.css({"z-index":T.zindex}),T.zoom.css({"z-index":T.zindex}),T.zoomrestore=!1,T.zoom.css("backgroundPosition","0 0"),T.onResize(),T.onzoomout&&T.onzoomout.call(T),T.cancelEvent(e)},this.doZoom=function(e){return T.zoomactive?T.doZoomOut(e):T.doZoomIn(e)},this.resizeZoom=function(){if(T.zoomactive){var e=T.getScrollTop();T.win.css({width:c.width()-T.zoomrestore.padding.w+"px",height:c.height()-T.zoomrestore.padding.h+"px"}),T.onResize(),T.setScrollTop(Math.min(T.page.maxh,e))}},this.init(),n.nicescroll.push(this)},y=function(e){var o=this;this.nc=e,this.lastx=0,this.lasty=0,this.speedx=0,this.speedy=0,this.lasttime=0,this.steptime=0,this.snapx=!1,this.snapy=!1,this.demulx=0,this.demuly=0,this.lastscrollx=-1,this.lastscrolly=-1,this.chkx=0,this.chky=0,this.timer=0,this.reset=function(e,t){o.stop(),o.steptime=0,o.lasttime=f(),o.speedx=0,o.speedy=0,o.lastx=e,o.lasty=t,o.lastscrollx=-1,o.lastscrolly=-1},this.update=function(e,t){var r=f();o.steptime=r-o.lasttime,o.lasttime=r;var i=t-o.lasty,s=e-o.lastx,n=o.nc.getScrollTop()+i,l=o.nc.getScrollLeft()+s;o.snapx=l<0||l>o.nc.page.maxw,o.snapy=n<0||n>o.nc.page.maxh,o.speedx=s,o.speedy=i,o.lastx=e,o.lasty=t},this.stop=function(){o.nc.unsynched("domomentum2d"),o.timer&&clearTimeout(o.timer),o.timer=0,o.lastscrollx=-1,o.lastscrolly=-1},this.doSnapy=function(e,t){var r=!1;t<0?(t=0,r=!0):t>o.nc.page.maxh&&(t=o.nc.page.maxh,r=!0),e<0?(e=0,r=!0):e>o.nc.page.maxw&&(e=o.nc.page.maxw,r=!0),r?o.nc.doScrollPos(e,t,o.nc.opt.snapbackspeed):o.nc.triggerScrollEnd()},this.doMomentum=function(e){var t=f(),r=e?t+e:o.lasttime,i=o.nc.getScrollLeft(),s=o.nc.getScrollTop(),n=o.nc.page.maxh,l=o.nc.page.maxw;o.speedx=l>0?Math.min(60,o.speedx):0,o.speedy=n>0?Math.min(60,o.speedy):0;var a=r&&t-r<=60;(s<0||s>n||i<0||i>l)&&(a=!1);var c=!(!o.speedy||!a)&&o.speedy,d=!(!o.speedx||!a)&&o.speedx;if(c||d){var u=Math.max(16,o.steptime);if(u>50){var h=u/50;o.speedx*=h,o.speedy*=h,u=50}o.demulxy=0,o.lastscrollx=o.nc.getScrollLeft(),o.chkx=o.lastscrollx,o.lastscrolly=o.nc.getScrollTop(),o.chky=o.lastscrolly;var p=o.lastscrollx,m=o.lastscrolly,g=function(){var e=f()-t>600?.04:.02;o.speedx&&(p=Math.floor(o.lastscrollx-o.speedx*(1-o.demulxy)),o.lastscrollx=p,(p<0||p>l)&&(e=.1)),o.speedy&&(m=Math.floor(o.lastscrolly-o.speedy*(1-o.demulxy)),o.lastscrolly=m,(m<0||m>n)&&(e=.1)),o.demulxy=Math.min(1,o.demulxy+e),o.nc.synched("domomentum2d",function(){if(o.speedx){o.nc.getScrollLeft();o.chkx=p,o.nc.setScrollLeft(p)}if(o.speedy){o.nc.getScrollTop();o.chky=m,o.nc.setScrollTop(m)}o.timer||(o.nc.hideCursor(),o.doSnapy(p,m))}),o.demulxy<1?o.timer=setTimeout(g,u):(o.stop(),o.nc.hideCursor(),o.doSnapy(p,m))};g()}else o.doSnapy(o.nc.getScrollLeft(),o.nc.getScrollTop())}},x=e.fn.scrollTop;e.cssHooks.pageYOffset={get:function(e,o,t){var r=n.data(e,"__nicescroll")||!1;return r&&r.ishwscroll?r.getScrollTop():x.call(e)},set:function(e,o){var t=n.data(e,"__nicescroll")||!1;return t&&t.ishwscroll?t.setScrollTop(parseInt(o)):x.call(e,o),this}},e.fn.scrollTop=function(e){if(void 0===e){var o=!!this[0]&&(n.data(this[0],"__nicescroll")||!1);return o&&o.ishwscroll?o.getScrollTop():x.call(this)}return this.each(function(){var o=n.data(this,"__nicescroll")||!1;o&&o.ishwscroll?o.setScrollTop(parseInt(e)):x.call(n(this),e)})};var S=e.fn.scrollLeft;n.cssHooks.pageXOffset={get:function(e,o,t){var r=n.data(e,"__nicescroll")||!1;return r&&r.ishwscroll?r.getScrollLeft():S.call(e)},set:function(e,o){var t=n.data(e,"__nicescroll")||!1;return t&&t.ishwscroll?t.setScrollLeft(parseInt(o)):S.call(e,o),this}},e.fn.scrollLeft=function(e){if(void 0===e){var o=!!this[0]&&(n.data(this[0],"__nicescroll")||!1);return o&&o.ishwscroll?o.getScrollLeft():S.call(this)}return this.each(function(){var o=n.data(this,"__nicescroll")||!1;o&&o.ishwscroll?o.setScrollLeft(parseInt(e)):S.call(n(this),e)})};var z=function(e){var o=this;if(this.length=0,this.name="nicescrollarray",this.each=function(e){return n.each(o,e),o},this.push=function(e){o[o.length]=e,o.length++},this.eq=function(e){return o[e]},e)for(var t=0;t1?n(e,r):s,i.win=r}!("doc"in i)||"win"in i||(i.win=r);var l=r.data("__nicescroll")||!1;l||(i.doc=i.doc||r,l=new b(i,r),r.data("__nicescroll",l)),t.push(l)}),1===t.length?t[0]:t},a.NiceScroll={getjQuery:function(){return e}},n.nicescroll||(n.nicescroll=new z,n.nicescroll.options=g)}); \ No newline at end of file +/* jquery.nicescroll v 3.7.4-d [DEV REL] - InuYaksa*2017 - MIT - https://nicescroll.areaaperta.com/ */ +!function(e){"function"==typeof define&&define.amd?define(["jquery"],e):"object"==typeof exports?module.exports=e(require("jquery")):e(jQuery)}(function(e){"use strict";var o=!1,t=!1,r=0,i=2e3,s=0,n=e,l=document,a=window,c=n(a),d=[],u=a.requestAnimationFrame||a.webkitRequestAnimationFrame||a.mozRequestAnimationFrame||!1,h=a.cancelAnimationFrame||a.webkitCancelAnimationFrame||a.mozCancelAnimationFrame||!1;if(u)a.cancelAnimationFrame||(h=function(e){});else{var p=0;u=function(e,o){var t=(new Date).getTime(),r=Math.max(0,16-(t-p)),i=a.setTimeout(function(){e(t+r)},r);return p=t+r,i},h=function(e){a.clearTimeout(e)}}var m=a.MutationObserver||a.WebKitMutationObserver||!1,f=Date.now||function(){return(new Date).getTime()},g={zindex:"auto",cursoropacitymin:0,cursoropacitymax:1,cursorcolor:"#424242",cursorwidth:"6px",cursorborder:"1px solid #fff",cursorborderradius:"5px",scrollspeed:40,mousescrollstep:27,touchbehavior:!1,emulatetouch:!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 e=l.currentScript||function(){var e=l.getElementsByTagName("script");return!!e.length&&e[e.length-1]}(),o=e?e.src.split("?")[0]:"";return o.split("/").length>0?o.split("/").slice(0,-1).join("/")+"/":""}(),preventmultitouchscrolling:!0,disablemutationobserver:!1,enableobserver:!0,scrollbarid:!1},v=!1,w=function(){if(v)return v;var e=l.createElement("DIV"),o=e.style,t=navigator.userAgent,r=navigator.platform,i={};return i.haspointerlock="pointerLockElement"in l||"webkitPointerLockElement"in l||"mozPointerLockElement"in l,i.isopera="opera"in a,i.isopera12=i.isopera&&"getUserMedia"in navigator,i.isoperamini="[object OperaMini]"===Object.prototype.toString.call(a.operamini),i.isie="all"in l&&"attachEvent"in e&&!i.isopera,i.isieold=i.isie&&!("msInterpolationMode"in o),i.isie7=i.isie&&!i.isieold&&(!("documentMode"in l)||7===l.documentMode),i.isie8=i.isie&&"documentMode"in l&&8===l.documentMode,i.isie9=i.isie&&"performance"in a&&9===l.documentMode,i.isie10=i.isie&&"performance"in a&&10===l.documentMode,i.isie11="msRequestFullscreen"in e&&l.documentMode>=11,i.ismsedge="msCredentials"in a,i.ismozilla="MozAppearance"in o,i.iswebkit=!i.ismsedge&&"WebkitAppearance"in o,i.ischrome=i.iswebkit&&"chrome"in a,i.ischrome38=i.ischrome&&"touchAction"in o,i.ischrome22=!i.ischrome38&&i.ischrome&&i.haspointerlock,i.ischrome26=!i.ischrome38&&i.ischrome&&"transition"in o,i.cantouch="ontouchstart"in l.documentElement||"ontouchstart"in a,i.hasw3ctouch=(a.PointerEvent||!1)&&(navigator.MaxTouchPoints>0||navigator.msMaxTouchPoints>0),i.hasmstouch=!i.hasw3ctouch&&(a.MSPointerEvent||!1),i.ismac=/^mac$/i.test(r),i.isios=i.cantouch&&/iphone|ipad|ipod/i.test(r),i.isios4=i.isios&&!("seal"in Object),i.isios7=i.isios&&"webkitHidden"in l,i.isios8=i.isios&&"hidden"in l,i.isios10=i.isios&&a.Proxy,i.isandroid=/android/i.test(t),i.haseventlistener="addEventListener"in e,i.trstyle=!1,i.hastransform=!1,i.hastranslate3d=!1,i.transitionstyle=!1,i.hastransition=!1,i.transitionend=!1,i.trstyle="transform",i.hastransform="transform"in o||function(){for(var e=["msTransform","webkitTransform","MozTransform","OTransform"],t=0,r=e.length;t0;){if(9==e[0].nodeType)return!1;var o=e.css("zIndex");if(!isNaN(o)&&0!==o)return parseInt(o);e=e.parent()}return!1}function x(e,o,t){var r=e.css(o),i=parseFloat(r);if(isNaN(i)){var s=3==(i=I[r]||0)?t?T.win.outerHeight()-T.win.innerHeight():T.win.outerWidth()-T.win.innerWidth():1;return T.isie8&&i&&(i+=1),s?i:0}return i}function S(e,o,t,r){T._bind(e,o,function(r){var i={original:r=r||a.event,target:r.target||r.srcElement,type:"wheel",deltaMode:"MozMousePixelScroll"==r.type?0:1,deltaX:0,deltaZ:0,preventDefault:function(){return r.preventDefault?r.preventDefault():r.returnValue=!1,!1},stopImmediatePropagation:function(){r.stopImmediatePropagation?r.stopImmediatePropagation():r.cancelBubble=!0}};return"mousewheel"==o?(r.wheelDeltaX&&(i.deltaX=-.025*r.wheelDeltaX),r.wheelDeltaY&&(i.deltaY=-.025*r.wheelDeltaY),!i.deltaY&&!i.deltaX&&(i.deltaY=-.025*r.wheelDelta)):i.deltaY=r.detail,t.call(e,i)},r)}function z(e,o,t,r){T.scrollrunning||(T.newscrolly=T.getScrollTop(),T.newscrollx=T.getScrollLeft(),D=f());var i=f()-D;if(D=f(),i>350?A=1:A+=(2-A)/10,e=e*A|0,o=o*A|0,e){if(r)if(e<0){if(T.getScrollLeft()>=T.page.maxw)return!0}else if(T.getScrollLeft()<=0)return!0;var s=e>0?1:-1;X!==s&&(T.scrollmom&&T.scrollmom.stop(),T.newscrollx=T.getScrollLeft(),X=s),T.lastdeltax-=e}if(o){if(function(){var e=T.getScrollTop();if(o<0){if(e>=T.page.maxh)return!0}else if(e<=0)return!0}()){if(M.nativeparentscrolling&&t&&!T.ispage&&!T.zoomactive)return!0;var n=T.view.h>>1;T.newscrolly<-n?(T.newscrolly=-n,o=-1):T.newscrolly>T.page.maxh+n?(T.newscrolly=T.page.maxh+n,o=1):o=0}var l=o>0?1:-1;B!==l&&(T.scrollmom&&T.scrollmom.stop(),T.newscrolly=T.getScrollTop(),B=l),T.lastdeltay-=o}(o||e)&&T.synched("relativexy",function(){var e=T.lastdeltay+T.newscrolly;T.lastdeltay=0;var o=T.lastdeltax+T.newscrollx;T.lastdeltax=0,T.rail.drag||T.doScrollPos(o,e)})}function k(e,o,t){var r,i;return!(t||!q)||(0===e.deltaMode?(r=-e.deltaX*(M.mousescrollstep/54)|0,i=-e.deltaY*(M.mousescrollstep/54)|0):1===e.deltaMode&&(r=-e.deltaX*M.mousescrollstep*50/80|0,i=-e.deltaY*M.mousescrollstep*50/80|0),o&&M.oneaxismousemode&&0===r&&i&&(r=i,i=0,t&&(r<0?T.getScrollLeft()>=T.page.maxw:T.getScrollLeft()<=0)&&(i=r,r=0)),T.isrtlmode&&(r=-r),z(r,i,t,!0)?void(t&&(q=!0)):(q=!1,e.stopImmediatePropagation(),e.preventDefault()))}var T=this;this.version="3.7.5-b",this.name="nicescroll",this.me=p;var E=n("body"),M=this.opt={doc:E,win:!1};if(n.extend(M,g),M.snapbackspeed=80,e)for(var L in M)void 0!==e[L]&&(M[L]=e[L]);if(M.disablemutationobserver&&(m=!1),this.doc=M.doc,this.iddoc=this.doc&&this.doc[0]?this.doc[0].id||"":"",this.ispage=/^BODY|HTML/.test(M.win?M.win[0].nodeName:this.doc[0].nodeName),this.haswrapper=!1!==M.win,this.win=M.win||(this.ispage?c:this.doc),this.docscroll=this.ispage&&!this.haswrapper?c:this.win,this.body=E,this.viewport=!1,this.isfixed=!1,this.iframe=!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"!=M.autohidemode,this.onmousedown=!1,this.onmouseup=!1,this.onmousemove=!1,this.onmousewheel=!1,this.onkeypress=!1,this.ongesturezoom=!1,this.onclick=!1,this.onscrollstart=!1,this.onscrollend=!1,this.onscrollcancel=!1,this.onzoomin=!1,this.onzoomout=!1,this.view=!1,this.page=!1,this.scroll={x:0,y:0},this.scrollratio={x:0,y:0},this.cursorheight=20,this.scrollvaluemax=0,"auto"==M.rtlmode){var C=this.win[0]==a?this.body:this.win,P=C.css("writing-mode")||C.css("-webkit-writing-mode")||C.css("-ms-writing-mode")||C.css("-moz-writing-mode");"horizontal-tb"==P||"lr-tb"==P||""===P?(this.isrtlmode="rtl"==C.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===M.rtlmode,this.isvertical=!1;if(this.scrollrunning=!1,this.scrollmom=!1,this.observer=!1,this.observerremover=!1,this.observerbody=!1,!1!==M.scrollbarid)this.id=M.scrollbarid;else do{this.id="ascrail"+i++}while(l.getElementById(this.id));this.rail=!1,this.cursor=!1,this.cursorfreezed=!1,this.selectiondrag=!1,this.zoom=!1,this.zoomactive=!1,this.hasfocus=!1,this.hasmousefocus=!1,this.railslocked=!1,this.locked=!1,this.hidden=!1,this.cursoractive=!0,this.wheelprevented=!1,this.overflowx=M.overflowx,this.overflowy=M.overflowy,this.nativescrollingarea=!1,this.checkarea=0,this.events=[],this.saved={},this.delaylist={},this.synclist={},this.lastdeltax=0,this.lastdeltay=0,this.detected=w();var N=n.extend({},this.detected);this.canhwscroll=N.hastransform&&M.hwacceleration,this.ishwscroll=this.canhwscroll&&T.haswrapper,this.isrtlmode?this.isvertical?this.hasreversehr=!(N.iswebkit||N.isie||N.isie11):this.hasreversehr=!(N.iswebkit||N.isie&&!N.isie10&&!N.isie11):this.hasreversehr=!1,this.istouchcapable=!1,N.cantouch||!N.hasw3ctouch&&!N.hasmstouch?!N.cantouch||N.isios||N.isandroid||!N.iswebkit&&!N.ismozilla||(this.istouchcapable=!0):this.istouchcapable=!0,M.enablemouselockapi||(N.hasmousecapture=!1,N.haspointerlock=!1),this.debounced=function(e,o,t){T&&(T.delaylist[e]||!1||(T.delaylist[e]={h:u(function(){T.delaylist[e].fn.call(T),T.delaylist[e]=!1},t)},o.call(T)),T.delaylist[e].fn=o)},this.synched=function(e,o){T.synclist[e]?T.synclist[e]=o:(T.synclist[e]=o,u(function(){T&&(T.synclist[e]&&T.synclist[e].call(T),T.synclist[e]=null)}))},this.unsynched=function(e){T.synclist[e]&&(T.synclist[e]=!1)},this.css=function(e,o){for(var t in o)T.saved.css.push([e,t,e.css(t)]),e.css(t,o[t])},this.scrollTop=function(e){return void 0===e?T.getScrollTop():T.setScrollTop(e)},this.scrollLeft=function(e){return void 0===e?T.getScrollLeft():T.setScrollLeft(e)};var R=function(e,o,t,r,i,s,n){this.st=e,this.ed=o,this.spd=t,this.p1=r||0,this.p2=i||1,this.p3=s||0,this.p4=n||1,this.ts=f(),this.df=o-e};if(R.prototype={B2:function(e){return 3*(1-e)*(1-e)*e},B3:function(e){return 3*(1-e)*e*e},B4:function(e){return e*e*e},getPos:function(){return(f()-this.ts)/this.spd},getNow:function(){var e=(f()-this.ts)/this.spd,o=this.B2(e)+this.B3(e)+this.B4(e);return e>=1?this.ed:this.st+this.df*o|0},update:function(e,o){return this.st=this.getNow(),this.ed=e,this.spd=o,this.ts=f(),this.df=this.ed-this.st,this}},this.ishwscroll){this.doc.translate={x:0,y:0,tx:"0px",ty:"0px"},N.hastranslate3d&&N.isios&&this.doc.css("-webkit-backface-visibility","hidden"),this.getScrollTop=function(e){if(!e){var o=v();if(o)return 16==o.length?-o[13]:-o[5];if(T.timerscroll&&T.timerscroll.bz)return T.timerscroll.bz.getNow()}return T.doc.translate.y},this.getScrollLeft=function(e){if(!e){var o=v();if(o)return 16==o.length?-o[12]:-o[4];if(T.timerscroll&&T.timerscroll.bh)return T.timerscroll.bh.getNow()}return T.doc.translate.x},this.notifyScrollEvent=function(e){var o=l.createEvent("UIEvents");o.initUIEvent("scroll",!1,!1,a,1),o.niceevent=!0,e.dispatchEvent(o)};var _=this.isrtlmode?1:-1;N.hastranslate3d&&M.enabletranslate3d?(this.setScrollTop=function(e,o){T.doc.translate.y=e,T.doc.translate.ty=-1*e+"px",T.doc.css(N.trstyle,"translate3d("+T.doc.translate.tx+","+T.doc.translate.ty+",0)"),o||T.notifyScrollEvent(T.win[0])},this.setScrollLeft=function(e,o){T.doc.translate.x=e,T.doc.translate.tx=e*_+"px",T.doc.css(N.trstyle,"translate3d("+T.doc.translate.tx+","+T.doc.translate.ty+",0)"),o||T.notifyScrollEvent(T.win[0])}):(this.setScrollTop=function(e,o){T.doc.translate.y=e,T.doc.translate.ty=-1*e+"px",T.doc.css(N.trstyle,"translate("+T.doc.translate.tx+","+T.doc.translate.ty+")"),o||T.notifyScrollEvent(T.win[0])},this.setScrollLeft=function(e,o){T.doc.translate.x=e,T.doc.translate.tx=e*_+"px",T.doc.css(N.trstyle,"translate("+T.doc.translate.tx+","+T.doc.translate.ty+")"),o||T.notifyScrollEvent(T.win[0])})}else this.getScrollTop=function(){return T.docscroll.scrollTop()},this.setScrollTop=function(e){T.docscroll.scrollTop(e)},this.getScrollLeft=function(){return T.hasreversehr?T.detected.ismozilla?T.page.maxw-Math.abs(T.docscroll.scrollLeft()):T.page.maxw-T.docscroll.scrollLeft():T.docscroll.scrollLeft()},this.setScrollLeft=function(e){return setTimeout(function(){if(T)return T.hasreversehr&&(e=T.detected.ismozilla?-(T.page.maxw-e):T.page.maxw-e),T.docscroll.scrollLeft(e)},1)};this.getTarget=function(e){return!!e&&(e.target?e.target:!!e.srcElement&&e.srcElement)},this.hasParent=function(e,o){if(!e)return!1;for(var t=e.target||e.srcElement||e||!1;t&&t.id!=o;)t=t.parentNode||!1;return!1!==t};var I={thin:1,medium:3,thick:5};this.getDocumentScrollOffset=function(){return{top:a.pageYOffset||l.documentElement.scrollTop,left:a.pageXOffset||l.documentElement.scrollLeft}},this.getOffset=function(){if(T.isfixed){var e=T.win.offset(),o=T.getDocumentScrollOffset();return e.top-=o.top,e.left-=o.left,e}var t=T.win.offset();if(!T.viewport)return t;var r=T.viewport.offset();return{top:t.top-r.top,left:t.left-r.left}},this.updateScrollBar=function(e){var o,t;if(T.ishwscroll)T.rail.css({height:T.win.innerHeight()-(M.railpadding.top+M.railpadding.bottom)}),T.railh&&T.railh.css({width:T.win.innerWidth()-(M.railpadding.left+M.railpadding.right)});else{var r=T.getOffset();if(o={top:r.top,left:r.left-(M.railpadding.left+M.railpadding.right)},o.top+=x(T.win,"border-top-width",!0),o.left+=T.rail.align?T.win.outerWidth()-x(T.win,"border-right-width")-T.rail.width:x(T.win,"border-left-width"),(t=M.railoffset)&&(t.top&&(o.top+=t.top),t.left&&(o.left+=t.left)),T.railslocked||T.rail.css({top:o.top,left:o.left,height:(e?e.h:T.win.innerHeight())-(M.railpadding.top+M.railpadding.bottom)}),T.zoom&&T.zoom.css({top:o.top+1,left:1==T.rail.align?o.left-20:o.left+T.rail.width+4}),T.railh&&!T.railslocked){o={top:r.top,left:r.left},(t=M.railhoffset)&&(t.top&&(o.top+=t.top),t.left&&(o.left+=t.left));var i=T.railh.align?o.top+x(T.win,"border-top-width",!0)+T.win.innerHeight()-T.railh.height:o.top+x(T.win,"border-top-width",!0),s=o.left+x(T.win,"border-left-width");T.railh.css({top:i-(M.railpadding.top+M.railpadding.bottom),left:s,width:T.railh.width})}}},this.doRailClick=function(e,o,t){var r,i,s,n;T.railslocked||(T.cancelEvent(e),"pageY"in e||(e.pageX=e.clientX+l.documentElement.scrollLeft,e.pageY=e.clientY+l.documentElement.scrollTop),o?(r=t?T.doScrollLeft:T.doScrollTop,s=t?(e.pageX-T.railh.offset().left-T.cursorwidth/2)*T.scrollratio.x:(e.pageY-T.rail.offset().top-T.cursorheight/2)*T.scrollratio.y,T.unsynched("relativexy"),r(0|s)):(r=t?T.doScrollLeftBy:T.doScrollBy,s=t?T.scroll.x:T.scroll.y,n=t?e.pageX-T.railh.offset().left:e.pageY-T.rail.offset().top,i=t?T.view.w:T.view.h,r(s>=n?i:-i)))},T.newscrolly=T.newscrollx=0,T.hasanimationframe="requestAnimationFrame"in a,T.hascancelanimationframe="cancelAnimationFrame"in a,T.hasborderbox=!1,this.init=function(){if(T.saved.css=[],N.isoperamini)return!0;if(N.isandroid&&!("hidden"in l))return!0;M.emulatetouch=M.emulatetouch||M.touchbehavior,T.hasborderbox=a.getComputedStyle&&"border-box"===a.getComputedStyle(l.body)["box-sizing"];var e={"overflow-y":"hidden"};if((N.isie11||N.isie10)&&(e["-ms-overflow-style"]="none"),T.ishwscroll&&(this.doc.css(N.transitionstyle,N.prefixstyle+"transform 0ms ease-out"),N.transitionend&&T.bind(T.doc,N.transitionend,T.onScrollTransitionEnd,!1)),T.zindex="auto",T.ispage||"auto"!=M.zindex?T.zindex=M.zindex:T.zindex=b()||"auto",!T.ispage&&"auto"!=T.zindex&&T.zindex>s&&(s=T.zindex),T.isie&&0===T.zindex&&"auto"==M.zindex&&(T.zindex="auto"),!T.ispage||!N.isieold){var i=T.docscroll;T.ispage&&(i=T.haswrapper?T.win:T.doc),T.css(i,e),T.ispage&&(N.isie11||N.isie)&&T.css(n("html"),e),!N.isios||T.ispage||T.haswrapper||T.css(E,{"-webkit-overflow-scrolling":"touch"});var d=n(l.createElement("div"));d.css({position:"relative",top:0,float:"right",width:M.cursorwidth,height:0,"background-color":M.cursorcolor,border:M.cursorborder,"background-clip":"padding-box","-webkit-border-radius":M.cursorborderradius,"-moz-border-radius":M.cursorborderradius,"border-radius":M.cursorborderradius}),d.addClass("nicescroll-cursors"),T.cursor=d;var u=n(l.createElement("div"));u.attr("id",T.id),u.addClass("nicescroll-rails nicescroll-rails-vr");var h,p,f=["left","right","top","bottom"];for(var g in f)p=f[g],(h=M.railpadding[p]||0)&&u.css("padding-"+p,h+"px");u.append(d),u.width=Math.max(parseFloat(M.cursorwidth),d.outerWidth()),u.css({width:u.width+"px",zIndex:T.zindex,background:M.background,cursor:"default"}),u.visibility=!0,u.scrollable=!0,u.align="left"==M.railalign?0:1,T.rail=u,T.rail.drag=!1;var v=!1;!M.boxzoom||T.ispage||N.isieold||(v=l.createElement("div"),T.bind(v,"click",T.doZoom),T.bind(v,"mouseenter",function(){T.zoom.css("opacity",M.cursoropacitymax)}),T.bind(v,"mouseleave",function(){T.zoom.css("opacity",M.cursoropacitymin)}),T.zoom=n(v),T.zoom.css({cursor:"pointer",zIndex:T.zindex,backgroundImage:"url("+M.scriptpath+"zoomico.png)",height:18,width:18,backgroundPosition:"0 0"}),M.dblclickzoom&&T.bind(T.win,"dblclick",T.doZoom),N.cantouch&&M.gesturezoom&&(T.ongesturezoom=function(e){return e.scale>1.5&&T.doZoomIn(e),e.scale<.8&&T.doZoomOut(e),T.cancelEvent(e)},T.bind(T.win,"gestureend",T.ongesturezoom))),T.railh=!1;var w;if(M.horizrailenabled&&(T.css(i,{overflowX:"hidden"}),(d=n(l.createElement("div"))).css({position:"absolute",top:0,height:M.cursorwidth,width:0,backgroundColor:M.cursorcolor,border:M.cursorborder,backgroundClip:"padding-box","-webkit-border-radius":M.cursorborderradius,"-moz-border-radius":M.cursorborderradius,"border-radius":M.cursorborderradius}),N.isieold&&d.css("overflow","hidden"),d.addClass("nicescroll-cursors"),T.cursorh=d,(w=n(l.createElement("div"))).attr("id",T.id+"-hr"),w.addClass("nicescroll-rails nicescroll-rails-hr"),w.height=Math.max(parseFloat(M.cursorwidth),d.outerHeight()),w.css({height:w.height+"px",zIndex:T.zindex,background:M.background}),w.append(d),w.visibility=!0,w.scrollable=!0,w.align="top"==M.railvalign?0:1,T.railh=w,T.railh.drag=!1),T.ispage)u.css({position:"fixed",top:0,height:"100%"}),u.css(u.align?{right:0}:{left:0}),T.body.append(u),T.railh&&(w.css({position:"fixed",left:0,width:"100%"}),w.css(w.align?{bottom:0}:{top:0}),T.body.append(w));else{if(T.ishwscroll){"static"==T.win.css("position")&&T.css(T.win,{position:"relative"});var x="HTML"==T.win[0].nodeName?T.body:T.win;n(x).scrollTop(0).scrollLeft(0),T.zoom&&(T.zoom.css({position:"absolute",top:1,right:0,"margin-right":u.width+4}),x.append(T.zoom)),u.css({position:"absolute",top:0}),u.css(u.align?{right:0}:{left:0}),x.append(u),w&&(w.css({position:"absolute",left:0,bottom:0}),w.css(w.align?{bottom:0}:{top:0}),x.append(w))}else{T.isfixed="fixed"==T.win.css("position");var S=T.isfixed?"fixed":"absolute";T.isfixed||(T.viewport=T.getViewport(T.win[0])),T.viewport&&(T.body=T.viewport,/fixed|absolute/.test(T.viewport.css("position"))||T.css(T.viewport,{position:"relative"})),u.css({position:S}),T.zoom&&T.zoom.css({position:S}),T.updateScrollBar(),T.body.append(u),T.zoom&&T.body.append(T.zoom),T.railh&&(w.css({position:S}),T.body.append(w))}N.isios&&T.css(T.win,{"-webkit-tap-highlight-color":"rgba(0,0,0,0)","-webkit-touch-callout":"none"}),M.disableoutline&&(N.isie&&T.win.attr("hideFocus","true"),N.iswebkit&&T.win.css("outline","none"))}if(!1===M.autohidemode?(T.autohidedom=!1,T.rail.css({opacity:M.cursoropacitymax}),T.railh&&T.railh.css({opacity:M.cursoropacitymax})):!0===M.autohidemode||"leave"===M.autohidemode?(T.autohidedom=n().add(T.rail),N.isie8&&(T.autohidedom=T.autohidedom.add(T.cursor)),T.railh&&(T.autohidedom=T.autohidedom.add(T.railh)),T.railh&&N.isie8&&(T.autohidedom=T.autohidedom.add(T.cursorh))):"scroll"==M.autohidemode?(T.autohidedom=n().add(T.rail),T.railh&&(T.autohidedom=T.autohidedom.add(T.railh))):"cursor"==M.autohidemode?(T.autohidedom=n().add(T.cursor),T.railh&&(T.autohidedom=T.autohidedom.add(T.cursorh))):"hidden"==M.autohidemode&&(T.autohidedom=!1,T.hide(),T.railslocked=!1),N.cantouch||T.istouchcapable||M.emulatetouch||N.hasmstouch){T.scrollmom=new y(T);T.ontouchstart=function(e){if(T.locked)return!1;if(e.pointerType&&("mouse"===e.pointerType||e.pointerType===e.MSPOINTER_TYPE_MOUSE))return!1;if(T.hasmoving=!1,T.scrollmom.timer&&(T.triggerScrollEnd(),T.scrollmom.stop()),!T.railslocked){var o=T.getTarget(e);if(o&&/INPUT/i.test(o.nodeName)&&/range/i.test(o.type))return T.stopPropagation(e);var t="mousedown"===e.type;if(!("clientX"in e)&&"changedTouches"in e&&(e.clientX=e.changedTouches[0].clientX,e.clientY=e.changedTouches[0].clientY),T.forcescreen){var r=e;(e={original:e.original?e.original:e}).clientX=r.screenX,e.clientY=r.screenY}if(T.rail.drag={x:e.clientX,y:e.clientY,sx:T.scroll.x,sy:T.scroll.y,st:T.getScrollTop(),sl:T.getScrollLeft(),pt:2,dl:!1,tg:o},T.ispage||!M.directionlockdeadzone)T.rail.drag.dl="f";else{var i={w:c.width(),h:c.height()},s=T.getContentSize(),l=s.h-i.h,a=s.w-i.w;T.rail.scrollable&&!T.railh.scrollable?T.rail.drag.ck=l>0&&"v":!T.rail.scrollable&&T.railh.scrollable?T.rail.drag.ck=a>0&&"h":T.rail.drag.ck=!1}if(M.emulatetouch&&T.isiframe&&N.isie){var d=T.win.position();T.rail.drag.x+=d.left,T.rail.drag.y+=d.top}if(T.hasmoving=!1,T.lastmouseup=!1,T.scrollmom.reset(e.clientX,e.clientY),o&&t){if(!/INPUT|SELECT|BUTTON|TEXTAREA/i.test(o.nodeName))return N.hasmousecapture&&o.setCapture(),M.emulatetouch?(o.onclick&&!o._onclick&&(o._onclick=o.onclick,o.onclick=function(e){if(T.hasmoving)return!1;o._onclick.call(this,e)}),T.cancelEvent(e)):T.stopPropagation(e);/SUBMIT|CANCEL|BUTTON/i.test(n(o).attr("type"))&&(T.preventclick={tg:o,click:!1})}}},T.ontouchend=function(e){if(!T.rail.drag)return!0;if(2==T.rail.drag.pt){if(e.pointerType&&("mouse"===e.pointerType||e.pointerType===e.MSPOINTER_TYPE_MOUSE))return!1;T.rail.drag=!1;var o="mouseup"===e.type;if(T.hasmoving&&(T.scrollmom.doMomentum(),T.lastmouseup=!0,T.hideCursor(),N.hasmousecapture&&l.releaseCapture(),o))return T.cancelEvent(e)}else if(1==T.rail.drag.pt)return T.onmouseup(e)};var z=M.emulatetouch&&T.isiframe&&!N.hasmousecapture,k=.3*M.directionlockdeadzone|0;T.ontouchmove=function(e,o){if(!T.rail.drag)return!0;if(e.targetTouches&&M.preventmultitouchscrolling&&e.targetTouches.length>1)return!0;if(e.pointerType&&("mouse"===e.pointerType||e.pointerType===e.MSPOINTER_TYPE_MOUSE))return!0;if(2==T.rail.drag.pt){"changedTouches"in e&&(e.clientX=e.changedTouches[0].clientX,e.clientY=e.changedTouches[0].clientY);var t,r;if(r=t=0,z&&!o){var i=T.win.position();r=-i.left,t=-i.top}var s=e.clientY+t,n=s-T.rail.drag.y,a=e.clientX+r,c=a-T.rail.drag.x,d=T.rail.drag.st-n;if(T.ishwscroll&&M.bouncescroll)d<0?d=Math.round(d/2):d>T.page.maxh&&(d=T.page.maxh+Math.round((d-T.page.maxh)/2));else if(d<0?(d=0,s=0):d>T.page.maxh&&(d=T.page.maxh,s=0),0===s&&!T.hasmoving)return T.ispage||(T.rail.drag=!1),!0;var u=T.getScrollLeft();if(T.railh&&T.railh.scrollable&&(u=T.isrtlmode?c-T.rail.drag.sl:T.rail.drag.sl-c,T.ishwscroll&&M.bouncescroll?u<0?u=Math.round(u/2):u>T.page.maxw&&(u=T.page.maxw+Math.round((u-T.page.maxw)/2)):(u<0&&(u=0,a=0),u>T.page.maxw&&(u=T.page.maxw,a=0))),!T.hasmoving){if(T.rail.drag.y===e.clientY&&T.rail.drag.x===e.clientX)return T.cancelEvent(e);var h=Math.abs(n),p=Math.abs(c),m=M.directionlockdeadzone;if(T.rail.drag.ck?"v"==T.rail.drag.ck?p>m&&h<=k?T.rail.drag=!1:h>m&&(T.rail.drag.dl="v"):"h"==T.rail.drag.ck&&(h>m&&p<=k?T.rail.drag=!1:p>m&&(T.rail.drag.dl="h")):h>m&&p>m?T.rail.drag.dl="f":h>m?T.rail.drag.dl=p>k?"f":"v":p>m&&(T.rail.drag.dl=h>k?"f":"h"),!T.rail.drag.dl)return T.cancelEvent(e);T.triggerScrollStart(e.clientX,e.clientY,0,0,0),T.hasmoving=!0}return T.preventclick&&!T.preventclick.click&&(T.preventclick.click=T.preventclick.tg.onclick||!1,T.preventclick.tg.onclick=T.onpreventclick),T.rail.drag.dl&&("v"==T.rail.drag.dl?u=T.rail.drag.sl:"h"==T.rail.drag.dl&&(d=T.rail.drag.st)),T.synched("touchmove",function(){T.rail.drag&&2==T.rail.drag.pt&&(T.prepareTransition&&T.resetTransition(),T.rail.scrollable&&T.setScrollTop(d),T.scrollmom.update(a,s),T.railh&&T.railh.scrollable?(T.setScrollLeft(u),T.showCursor(d,u)):T.showCursor(d),N.isie10&&l.selection.clear())}),T.cancelEvent(e)}return 1==T.rail.drag.pt?T.onmousemove(e):void 0},T.ontouchstartCursor=function(e,o){if(!T.rail.drag||3==T.rail.drag.pt){if(T.locked)return T.cancelEvent(e);T.cancelScroll(),T.rail.drag={x:e.touches[0].clientX,y:e.touches[0].clientY,sx:T.scroll.x,sy:T.scroll.y,pt:3,hr:!!o};var t=T.getTarget(e);return!T.ispage&&N.hasmousecapture&&t.setCapture(),T.isiframe&&!N.hasmousecapture&&(T.saved.csspointerevents=T.doc.css("pointer-events"),T.css(T.doc,{"pointer-events":"none"})),T.cancelEvent(e)}},T.ontouchendCursor=function(e){if(T.rail.drag){if(N.hasmousecapture&&l.releaseCapture(),T.isiframe&&!N.hasmousecapture&&T.doc.css("pointer-events",T.saved.csspointerevents),3!=T.rail.drag.pt)return;return T.rail.drag=!1,T.cancelEvent(e)}},T.ontouchmoveCursor=function(e){if(T.rail.drag){if(3!=T.rail.drag.pt)return;if(T.cursorfreezed=!0,T.rail.drag.hr){T.scroll.x=T.rail.drag.sx+(e.touches[0].clientX-T.rail.drag.x),T.scroll.x<0&&(T.scroll.x=0);var o=T.scrollvaluemaxw;T.scroll.x>o&&(T.scroll.x=o)}else{T.scroll.y=T.rail.drag.sy+(e.touches[0].clientY-T.rail.drag.y),T.scroll.y<0&&(T.scroll.y=0);var t=T.scrollvaluemax;T.scroll.y>t&&(T.scroll.y=t)}return T.synched("touchmove",function(){T.rail.drag&&3==T.rail.drag.pt&&(T.showCursor(),T.rail.drag.hr?T.doScrollLeft(Math.round(T.scroll.x*T.scrollratio.x),M.cursordragspeed):T.doScrollTop(Math.round(T.scroll.y*T.scrollratio.y),M.cursordragspeed))}),T.cancelEvent(e)}}}if(T.onmousedown=function(e,o){if(!T.rail.drag||1==T.rail.drag.pt){if(T.railslocked)return T.cancelEvent(e);T.cancelScroll(),T.rail.drag={x:e.clientX,y:e.clientY,sx:T.scroll.x,sy:T.scroll.y,pt:1,hr:o||!1};var t=T.getTarget(e);return N.hasmousecapture&&t.setCapture(),T.isiframe&&!N.hasmousecapture&&(T.saved.csspointerevents=T.doc.css("pointer-events"),T.css(T.doc,{"pointer-events":"none"})),T.hasmoving=!1,T.cancelEvent(e)}},T.onmouseup=function(e){if(T.rail.drag)return 1!=T.rail.drag.pt||(N.hasmousecapture&&l.releaseCapture(),T.isiframe&&!N.hasmousecapture&&T.doc.css("pointer-events",T.saved.csspointerevents),T.rail.drag=!1,T.cursorfreezed=!1,T.hasmoving&&T.triggerScrollEnd(),T.cancelEvent(e))},T.onmousemove=function(e){if(T.rail.drag){if(1!==T.rail.drag.pt)return;if(N.ischrome&&0===e.which)return T.onmouseup(e);if(T.cursorfreezed=!0,T.hasmoving||T.triggerScrollStart(e.clientX,e.clientY,0,0,0),T.hasmoving=!0,T.rail.drag.hr){T.scroll.x=T.rail.drag.sx+(e.clientX-T.rail.drag.x),T.scroll.x<0&&(T.scroll.x=0);var o=T.scrollvaluemaxw;T.scroll.x>o&&(T.scroll.x=o)}else{T.scroll.y=T.rail.drag.sy+(e.clientY-T.rail.drag.y),T.scroll.y<0&&(T.scroll.y=0);var t=T.scrollvaluemax;T.scroll.y>t&&(T.scroll.y=t)}return T.synched("mousemove",function(){T.cursorfreezed&&(T.showCursor(),T.rail.drag.hr?T.scrollLeft(Math.round(T.scroll.x*T.scrollratio.x)):T.scrollTop(Math.round(T.scroll.y*T.scrollratio.y)))}),T.cancelEvent(e)}T.checkarea=0},N.cantouch||M.emulatetouch)T.onpreventclick=function(e){if(T.preventclick)return T.preventclick.tg.onclick=T.preventclick.click,T.preventclick=!1,T.cancelEvent(e)},T.onclick=!N.isios&&function(e){return!T.lastmouseup||(T.lastmouseup=!1,T.cancelEvent(e))},M.grabcursorenabled&&N.cursorgrabvalue&&(T.css(T.ispage?T.doc:T.win,{cursor:N.cursorgrabvalue}),T.css(T.rail,{cursor:N.cursorgrabvalue}));else{var L=function(e){if(T.selectiondrag){if(e){var o=T.win.outerHeight(),t=e.pageY-T.selectiondrag.top;t>0&&t=o&&(t-=o),T.selectiondrag.df=t}if(0!==T.selectiondrag.df){var r=-2*T.selectiondrag.df/6|0;T.doScrollBy(r),T.debounced("doselectionscroll",function(){L()},50)}}};T.hasTextSelected="getSelection"in l?function(){return l.getSelection().rangeCount>0}:"selection"in l?function(){return"None"!=l.selection.type}:function(){return!1},T.onselectionstart=function(e){T.ispage||(T.selectiondrag=T.win.offset())},T.onselectionend=function(e){T.selectiondrag=!1},T.onselectiondrag=function(e){T.selectiondrag&&T.hasTextSelected()&&T.debounced("selectionscroll",function(){L(e)},250)}}if(N.hasw3ctouch?(T.css(T.ispage?n("html"):T.win,{"touch-action":"none"}),T.css(T.rail,{"touch-action":"none"}),T.css(T.cursor,{"touch-action":"none"}),T.bind(T.win,"pointerdown",T.ontouchstart),T.bind(l,"pointerup",T.ontouchend),T.delegate(l,"pointermove",T.ontouchmove)):N.hasmstouch?(T.css(T.ispage?n("html"):T.win,{"-ms-touch-action":"none"}),T.css(T.rail,{"-ms-touch-action":"none"}),T.css(T.cursor,{"-ms-touch-action":"none"}),T.bind(T.win,"MSPointerDown",T.ontouchstart),T.bind(l,"MSPointerUp",T.ontouchend),T.delegate(l,"MSPointerMove",T.ontouchmove),T.bind(T.cursor,"MSGestureHold",function(e){e.preventDefault()}),T.bind(T.cursor,"contextmenu",function(e){e.preventDefault()})):N.cantouch&&(T.bind(T.win,"touchstart",T.ontouchstart,!1,!0),T.bind(l,"touchend",T.ontouchend,!1,!0),T.bind(l,"touchcancel",T.ontouchend,!1,!0),T.delegate(l,"touchmove",T.ontouchmove,!1,!0)),M.emulatetouch&&(T.bind(T.win,"mousedown",T.ontouchstart,!1,!0),T.bind(l,"mouseup",T.ontouchend,!1,!0),T.bind(l,"mousemove",T.ontouchmove,!1,!0)),(M.cursordragontouch||!N.cantouch&&!M.emulatetouch)&&(T.rail.css({cursor:"default"}),T.railh&&T.railh.css({cursor:"default"}),T.jqbind(T.rail,"mouseenter",function(){if(!T.ispage&&!T.win.is(":visible"))return!1;T.canshowonmouseevent&&T.showCursor(),T.rail.active=!0}),T.jqbind(T.rail,"mouseleave",function(){T.rail.active=!1,T.rail.drag||T.hideCursor()}),M.sensitiverail&&(T.bind(T.rail,"click",function(e){T.doRailClick(e,!1,!1)}),T.bind(T.rail,"dblclick",function(e){T.doRailClick(e,!0,!1)}),T.bind(T.cursor,"click",function(e){T.cancelEvent(e)}),T.bind(T.cursor,"dblclick",function(e){T.cancelEvent(e)})),T.railh&&(T.jqbind(T.railh,"mouseenter",function(){if(!T.ispage&&!T.win.is(":visible"))return!1;T.canshowonmouseevent&&T.showCursor(),T.rail.active=!0}),T.jqbind(T.railh,"mouseleave",function(){T.rail.active=!1,T.rail.drag||T.hideCursor()}),M.sensitiverail&&(T.bind(T.railh,"click",function(e){T.doRailClick(e,!1,!0)}),T.bind(T.railh,"dblclick",function(e){T.doRailClick(e,!0,!0)}),T.bind(T.cursorh,"click",function(e){T.cancelEvent(e)}),T.bind(T.cursorh,"dblclick",function(e){T.cancelEvent(e)})))),M.cursordragontouch&&(this.istouchcapable||N.cantouch)&&(T.bind(T.cursor,"touchstart",T.ontouchstartCursor),T.bind(T.cursor,"touchmove",T.ontouchmoveCursor),T.bind(T.cursor,"touchend",T.ontouchendCursor),T.cursorh&&T.bind(T.cursorh,"touchstart",function(e){T.ontouchstartCursor(e,!0)}),T.cursorh&&T.bind(T.cursorh,"touchmove",T.ontouchmoveCursor),T.cursorh&&T.bind(T.cursorh,"touchend",T.ontouchendCursor)),M.emulatetouch||N.isandroid||N.isios?(T.bind(N.hasmousecapture?T.win:l,"mouseup",T.ontouchend),T.onclick&&T.bind(l,"click",T.onclick),M.cursordragontouch?(T.bind(T.cursor,"mousedown",T.onmousedown),T.bind(T.cursor,"mouseup",T.onmouseup),T.cursorh&&T.bind(T.cursorh,"mousedown",function(e){T.onmousedown(e,!0)}),T.cursorh&&T.bind(T.cursorh,"mouseup",T.onmouseup)):(T.bind(T.rail,"mousedown",function(e){e.preventDefault()}),T.railh&&T.bind(T.railh,"mousedown",function(e){e.preventDefault()}))):(T.bind(N.hasmousecapture?T.win:l,"mouseup",T.onmouseup),T.bind(l,"mousemove",T.onmousemove),T.onclick&&T.bind(l,"click",T.onclick),T.bind(T.cursor,"mousedown",T.onmousedown),T.bind(T.cursor,"mouseup",T.onmouseup),T.railh&&(T.bind(T.cursorh,"mousedown",function(e){T.onmousedown(e,!0)}),T.bind(T.cursorh,"mouseup",T.onmouseup)),!T.ispage&&M.enablescrollonselection&&(T.bind(T.win[0],"mousedown",T.onselectionstart),T.bind(l,"mouseup",T.onselectionend),T.bind(T.cursor,"mouseup",T.onselectionend),T.cursorh&&T.bind(T.cursorh,"mouseup",T.onselectionend),T.bind(l,"mousemove",T.onselectiondrag)),T.zoom&&(T.jqbind(T.zoom,"mouseenter",function(){T.canshowonmouseevent&&T.showCursor(),T.rail.active=!0}),T.jqbind(T.zoom,"mouseleave",function(){T.rail.active=!1,T.rail.drag||T.hideCursor()}))),M.enablemousewheel&&(T.isiframe||T.mousewheel(N.isie&&T.ispage?l:T.win,T.onmousewheel),T.mousewheel(T.rail,T.onmousewheel),T.railh&&T.mousewheel(T.railh,T.onmousewheelhr)),T.ispage||N.cantouch||/HTML|^BODY/.test(T.win[0].nodeName)||(T.win.attr("tabindex")||T.win.attr({tabindex:++r}),T.bind(T.win,"focus",function(e){o=T.getTarget(e).id||T.getTarget(e)||!1,T.hasfocus=!0,T.canshowonmouseevent&&T.noticeCursor()}),T.bind(T.win,"blur",function(e){o=!1,T.hasfocus=!1}),T.bind(T.win,"mouseenter",function(e){t=T.getTarget(e).id||T.getTarget(e)||!1,T.hasmousefocus=!0,T.canshowonmouseevent&&T.noticeCursor()}),T.bind(T.win,"mouseleave",function(e){t=!1,T.hasmousefocus=!1,T.rail.drag||T.hideCursor()})),T.onkeypress=function(e){if(T.railslocked&&0===T.page.maxh)return!0;e=e||a.event;var r=T.getTarget(e);if(r&&/INPUT|TEXTAREA|SELECT|OPTION/.test(r.nodeName)&&(!(r.getAttribute("type")||r.type||!1)||!/submit|button|cancel/i.tp))return!0;if(n(r).attr("contenteditable"))return!0;if(T.hasfocus||T.hasmousefocus&&!o||T.ispage&&!o&&!t){var i=e.keyCode;if(T.railslocked&&27!=i)return T.cancelEvent(e);var s=e.ctrlKey||!1,l=e.shiftKey||!1,c=!1;switch(i){case 38:case 63233:T.doScrollBy(72),c=!0;break;case 40:case 63235:T.doScrollBy(-72),c=!0;break;case 37:case 63232:T.railh&&(s?T.doScrollLeft(0):T.doScrollLeftBy(72),c=!0);break;case 39:case 63234:T.railh&&(s?T.doScrollLeft(T.page.maxw):T.doScrollLeftBy(-72),c=!0);break;case 33:case 63276:T.doScrollBy(T.view.h),c=!0;break;case 34:case 63277:T.doScrollBy(-T.view.h),c=!0;break;case 36:case 63273:T.railh&&s?T.doScrollPos(0,0):T.doScrollTo(0),c=!0;break;case 35:case 63275:T.railh&&s?T.doScrollPos(T.page.maxw,T.page.maxh):T.doScrollTo(T.page.maxh),c=!0;break;case 32:M.spacebarenabled&&(l?T.doScrollBy(T.view.h):T.doScrollBy(-T.view.h),c=!0);break;case 27:T.zoomactive&&(T.doZoom(),c=!0)}if(c)return T.cancelEvent(e)}},M.enablekeyboard&&T.bind(l,N.isopera&&!N.isopera12?"keypress":"keydown",T.onkeypress),T.bind(l,"keydown",function(e){(e.ctrlKey||!1)&&(T.wheelprevented=!0)}),T.bind(l,"keyup",function(e){e.ctrlKey||!1||(T.wheelprevented=!1)}),T.bind(a,"blur",function(e){T.wheelprevented=!1}),T.bind(a,"resize",T.onscreenresize),T.bind(a,"orientationchange",T.onscreenresize),T.bind(a,"load",T.lazyResize),N.ischrome&&!T.ispage&&!T.haswrapper){var C=T.win.attr("style"),P=parseFloat(T.win.css("width"))+1;T.win.css("width",P),T.synched("chromefix",function(){T.win.attr("style",C)})}T.onAttributeChange=function(e){T.lazyResize(T.isieold?250:30)},M.enableobserver&&(T.isie11||!1===m||(T.observerbody=new m(function(e){if(e.forEach(function(e){if("attributes"==e.type)return E.hasClass("modal-open")&&E.hasClass("modal-dialog")&&!n.contains(n(".modal-dialog")[0],T.doc[0])?T.hide():T.show()}),T.me.clientWidth!=T.page.width||T.me.clientHeight!=T.page.height)return T.lazyResize(30)}),T.observerbody.observe(l.body,{childList:!0,subtree:!0,characterData:!1,attributes:!0,attributeFilter:["class"]})),T.ispage||T.haswrapper||(!1!==m?(T.observer=new m(function(e){e.forEach(T.onAttributeChange)}),T.observer.observe(T.win[0],{childList:!0,characterData:!1,attributes:!0,subtree:!1}),T.observerremover=new m(function(e){e.forEach(function(e){if(e.removedNodes.length>0)for(var o in e.removedNodes)if(T&&e.removedNodes[o]==T.win[0])return T.remove()})}),T.observerremover.observe(T.win[0].parentNode,{childList:!0,characterData:!1,attributes:!1,subtree:!1})):(T.bind(T.win,N.isie&&!N.isie9?"propertychange":"DOMAttrModified",T.onAttributeChange),N.isie9&&T.win[0].attachEvent("onpropertychange",T.onAttributeChange),T.bind(T.win,"DOMNodeRemoved",function(e){e.target==T.win[0]&&T.remove()})))),!T.ispage&&M.boxzoom&&T.bind(a,"resize",T.resizeZoom),T.istextarea&&(T.bind(T.win,"keydown",T.lazyResize),T.bind(T.win,"mouseup",T.lazyResize)),T.lazyResize(30)}if("IFRAME"==this.doc[0].nodeName){var R=function(){T.iframexd=!1;var o;try{(o="contentDocument"in this?this.contentDocument:this.contentWindow._doc).domain}catch(e){T.iframexd=!0,o=!1}if(T.iframexd)return"console"in a&&console.log("NiceScroll error: policy restriced iframe"),!0;if(T.forcescreen=!0,T.isiframe&&(T.iframe={doc:n(o),html:T.doc.contents().find("html")[0],body:T.doc.contents().find("body")[0]},T.getContentSize=function(){return{w:Math.max(T.iframe.html.scrollWidth,T.iframe.body.scrollWidth),h:Math.max(T.iframe.html.scrollHeight,T.iframe.body.scrollHeight)}},T.docscroll=n(T.iframe.body)),!N.isios&&M.iframeautoresize&&!T.isiframe){T.win.scrollTop(0),T.doc.height("");var t=Math.max(o.getElementsByTagName("html")[0].scrollHeight,o.body.scrollHeight);T.doc.height(t)}T.lazyResize(30),T.css(n(T.iframe.body),e),N.isios&&T.haswrapper&&T.css(n(o.body),{"-webkit-transform":"translate3d(0,0,0)"}),"contentWindow"in this?T.bind(this.contentWindow,"scroll",T.onscroll):T.bind(o,"scroll",T.onscroll),M.enablemousewheel&&T.mousewheel(o,T.onmousewheel),M.enablekeyboard&&T.bind(o,N.isopera?"keypress":"keydown",T.onkeypress),N.cantouch?(T.bind(o,"touchstart",T.ontouchstart),T.bind(o,"touchmove",T.ontouchmove)):M.emulatetouch&&(T.bind(o,"mousedown",T.ontouchstart),T.bind(o,"mousemove",function(e){return T.ontouchmove(e,!0)}),M.grabcursorenabled&&N.cursorgrabvalue&&T.css(n(o.body),{cursor:N.cursorgrabvalue})),T.bind(o,"mouseup",T.ontouchend),T.zoom&&(M.dblclickzoom&&T.bind(o,"dblclick",T.doZoom),T.ongesturezoom&&T.bind(o,"gestureend",T.ongesturezoom))};this.doc[0].readyState&&"complete"===this.doc[0].readyState&&setTimeout(function(){R.call(T.doc[0],!1)},500),T.bind(this.doc,"load",R)}},this.showCursor=function(e,o){if(T.cursortimeout&&(clearTimeout(T.cursortimeout),T.cursortimeout=0),T.rail){if(T.autohidedom&&(T.autohidedom.stop().css({opacity:M.cursoropacitymax}),T.cursoractive=!0),T.rail.drag&&1==T.rail.drag.pt||(void 0!==e&&!1!==e&&(T.scroll.y=e/T.scrollratio.y|0),void 0!==o&&(T.scroll.x=o/T.scrollratio.x|0)),T.cursor.css({height:T.cursorheight,top:T.scroll.y}),T.cursorh){var t=T.hasreversehr?T.scrollvaluemaxw-T.scroll.x:T.scroll.x;T.cursorh.css({width:T.cursorwidth,left:!T.rail.align&&T.rail.visibility?t+T.rail.width:t}),T.cursoractive=!0}T.zoom&&T.zoom.stop().css({opacity:M.cursoropacitymax})}},this.hideCursor=function(e){T.cursortimeout||T.rail&&T.autohidedom&&(T.hasmousefocus&&"leave"===M.autohidemode||(T.cursortimeout=setTimeout(function(){T.rail.active&&T.showonmouseevent||(T.autohidedom.stop().animate({opacity:M.cursoropacitymin}),T.zoom&&T.zoom.stop().animate({opacity:M.cursoropacitymin}),T.cursoractive=!1),T.cursortimeout=0},e||M.hidecursordelay)))},this.noticeCursor=function(e,o,t){T.showCursor(o,t),T.rail.active||T.hideCursor(e)},this.getContentSize=T.ispage?function(){return{w:Math.max(l.body.scrollWidth,l.documentElement.scrollWidth),h:Math.max(l.body.scrollHeight,l.documentElement.scrollHeight)}}:T.haswrapper?function(){return{w:T.doc[0].offsetWidth,h:T.doc[0].offsetHeight}}:function(){return{w:T.docscroll[0].scrollWidth,h:T.docscroll[0].scrollHeight}},this.onResize=function(e,o){if(!T||!T.win)return!1;var t=T.page.maxh,r=T.page.maxw,i=T.view.h,s=T.view.w;if(T.view={w:T.ispage?T.win.width():T.win[0].clientWidth,h:T.ispage?T.win.height():T.win[0].clientHeight},T.page=o||T.getContentSize(),T.page.maxh=Math.max(0,T.page.h-T.view.h),T.page.maxw=Math.max(0,T.page.w-T.view.w),T.page.maxh==t&&T.page.maxw==r&&T.view.w==s&&T.view.h==i){if(T.ispage)return T;var n=T.win.offset();if(T.lastposition){var l=T.lastposition;if(l.top==n.top&&l.left==n.left)return T}T.lastposition=n}return 0===T.page.maxh?(T.hideRail(),T.scrollvaluemax=0,T.scroll.y=0,T.scrollratio.y=0,T.cursorheight=0,T.setScrollTop(0),T.rail&&(T.rail.scrollable=!1)):(T.page.maxh-=M.railpadding.top+M.railpadding.bottom,T.rail.scrollable=!0),0===T.page.maxw?(T.hideRailHr(),T.scrollvaluemaxw=0,T.scroll.x=0,T.scrollratio.x=0,T.cursorwidth=0,T.setScrollLeft(0),T.railh&&(T.railh.scrollable=!1)):(T.page.maxw-=M.railpadding.left+M.railpadding.right,T.railh&&(T.railh.scrollable=M.horizrailenabled)),T.railslocked=T.locked||0===T.page.maxh&&0===T.page.maxw,T.railslocked?(T.ispage||T.updateScrollBar(T.view),!1):(T.hidden||(T.rail.visibility||T.showRail(),T.railh&&!T.railh.visibility&&T.showRailHr()),T.istextarea&&T.win.css("resize")&&"none"!=T.win.css("resize")&&(T.view.h-=20),T.cursorheight=Math.min(T.view.h,Math.round(T.view.h*(T.view.h/T.page.h))),T.cursorheight=M.cursorfixedheight?M.cursorfixedheight:Math.max(M.cursorminheight,T.cursorheight),T.cursorwidth=Math.min(T.view.w,Math.round(T.view.w*(T.view.w/T.page.w))),T.cursorwidth=M.cursorfixedheight?M.cursorfixedheight:Math.max(M.cursorminheight,T.cursorwidth),T.scrollvaluemax=T.view.h-T.cursorheight-(M.railpadding.top+M.railpadding.bottom),T.hasborderbox||(T.scrollvaluemax-=T.cursor[0].offsetHeight-T.cursor[0].clientHeight),T.railh&&(T.railh.width=T.page.maxh>0?T.view.w-T.rail.width:T.view.w,T.scrollvaluemaxw=T.railh.width-T.cursorwidth-(M.railpadding.left+M.railpadding.right)),T.ispage||T.updateScrollBar(T.view),T.scrollratio={x:T.page.maxw/T.scrollvaluemaxw,y:T.page.maxh/T.scrollvaluemax},T.getScrollTop()>T.page.maxh?T.doScrollTop(T.page.maxh):(T.scroll.y=T.getScrollTop()/T.scrollratio.y|0,T.scroll.x=T.getScrollLeft()/T.scrollratio.x|0,T.cursoractive&&T.noticeCursor()),T.scroll.y&&0===T.getScrollTop()&&T.doScrollTo(T.scroll.y*T.scrollratio.y|0),T)},this.resize=T.onResize;var O=0;this.onscreenresize=function(e){clearTimeout(O);var o=!T.ispage&&!T.haswrapper;o&&T.hideRails(),O=setTimeout(function(){T&&(o&&T.showRails(),T.resize()),O=0},120)},this.lazyResize=function(e){return clearTimeout(O),O=setTimeout(function(){T&&T.resize(),O=0},e||240),T},this.jqbind=function(e,o,t){T.events.push({e:e,n:o,f:t,q:!0}),n(e).on(o,t)},this.mousewheel=function(e,o,t){var r="jquery"in e?e[0]:e;if("onwheel"in l.createElement("div"))T._bind(r,"wheel",o,t||!1);else{var i=void 0!==l.onmousewheel?"mousewheel":"DOMMouseScroll";S(r,i,o,t||!1),"DOMMouseScroll"==i&&S(r,"MozMousePixelScroll",o,t||!1)}};var Y=!1;if(N.haseventlistener){try{var H=Object.defineProperty({},"passive",{get:function(){Y=!0}});a.addEventListener("test",null,H)}catch(e){}this.stopPropagation=function(e){return!!e&&((e=e.original?e.original:e).stopPropagation(),!1)},this.cancelEvent=function(e){return e.cancelable&&e.preventDefault(),e.stopImmediatePropagation(),e.preventManipulation&&e.preventManipulation(),!1}}else Event.prototype.preventDefault=function(){this.returnValue=!1},Event.prototype.stopPropagation=function(){this.cancelBubble=!0},a.constructor.prototype.addEventListener=l.constructor.prototype.addEventListener=Element.prototype.addEventListener=function(e,o,t){this.attachEvent("on"+e,o)},a.constructor.prototype.removeEventListener=l.constructor.prototype.removeEventListener=Element.prototype.removeEventListener=function(e,o,t){this.detachEvent("on"+e,o)},this.cancelEvent=function(e){return(e=e||a.event)&&(e.cancelBubble=!0,e.cancel=!0,e.returnValue=!1),!1},this.stopPropagation=function(e){return(e=e||a.event)&&(e.cancelBubble=!0),!1};this.delegate=function(e,o,t,r,i){var s=d[o]||!1;s||(s={a:[],l:[],f:function(e){for(var o=s.l,t=!1,r=o.length-1;r>=0;r--)if(!1===(t=o[r].call(e.target,e)))return!1;return t}},T.bind(e,o,s.f,r,i),d[o]=s),T.ispage?(s.a=[T.id].concat(s.a),s.l=[t].concat(s.l)):(s.a.push(T.id),s.l.push(t))},this.undelegate=function(e,o,t,r,i){var s=d[o]||!1;if(s)for(var n=0,l=s.l.length;n0)return t;o=!!o.parentNode&&o.parentNode}return!1},this.triggerScrollStart=function(e,o,t,r,i){if(T.onscrollstart){var s={type:"scrollstart",current:{x:e,y:o},request:{x:t,y:r},end:{x:T.newscrollx,y:T.newscrolly},speed:i};T.onscrollstart.call(T,s)}},this.triggerScrollEnd=function(){if(T.onscrollend){var e=T.getScrollLeft(),o=T.getScrollTop(),t={type:"scrollend",current:{x:e,y:o},end:{x:e,y:o}};T.onscrollend.call(T,t)}};var B=0,X=0,D=0,A=1,q=!1;if(this.onmousewheel=function(e){if(T.wheelprevented||T.locked)return!1;if(T.railslocked)return T.debounced("checkunlock",T.resize,250),!1;if(T.rail.drag)return T.cancelEvent(e);if("auto"===M.oneaxismousemode&&0!==e.deltaX&&(M.oneaxismousemode=!1),M.oneaxismousemode&&0===e.deltaX&&!T.rail.scrollable)return!T.railh||!T.railh.scrollable||T.onmousewheelhr(e);var o=f(),t=!1;if(M.preservenativescrolling&&T.checkarea+600T.page.maxh&&(o=T.page.maxh+(o-T.page.maxh)/2|0),e<0?e=e/2|0:e>T.page.maxw&&(e=T.page.maxw+(e-T.page.maxw)/2|0)):(o<0?o=0:o>T.page.maxh&&(o=T.page.maxh),e<0?e=0:e>T.page.maxw&&(e=T.page.maxw)),T.scrollrunning&&e==T.newscrollx&&o==T.newscrolly)return!1;T.newscrolly=o,T.newscrollx=e;var s=T.getScrollTop(),n=T.getScrollLeft(),l={};l.x=e-n,l.y=o-s;var a=0|Math.sqrt(l.x*l.x+l.y*l.y),c=T.prepareTransition(a);T.scrollrunning||(T.scrollrunning=!0,T.triggerScrollStart(n,s,e,o,c),T.cursorupdate.start()),T.scrollendtrapped=!0,N.transitionend||(T.scrollendtrapped&&clearTimeout(T.scrollendtrapped),T.scrollendtrapped=setTimeout(T.onScrollTransitionEnd,c)),T.setScrollTop(T.newscrolly),T.setScrollLeft(T.newscrollx)},this.cancelScroll=function(){if(!T.scrollendtrapped)return!0;var e=T.getScrollTop(),o=T.getScrollLeft();return T.scrollrunning=!1,N.transitionend||clearTimeout(N.transitionend),T.scrollendtrapped=!1,T.resetTransition(),T.setScrollTop(e),T.railh&&T.setScrollLeft(o),T.timerscroll&&T.timerscroll.tm&&clearInterval(T.timerscroll.tm),T.timerscroll=!1,T.cursorfreezed=!1,T.cursorupdate.stop(),T.showCursor(e,o),T},this.onScrollTransitionEnd=function(){if(T.scrollendtrapped){var e=T.getScrollTop(),o=T.getScrollLeft();if(e<0?e=0:e>T.page.maxh&&(e=T.page.maxh),o<0?o=0:o>T.page.maxw&&(o=T.page.maxw),e!=T.newscrolly||o!=T.newscrollx)return T.doScrollPos(o,e,M.snapbackspeed);T.scrollrunning&&T.triggerScrollEnd(),T.scrollrunning=!1,T.scrollendtrapped=!1,T.resetTransition(),T.timerscroll=!1,T.setScrollTop(e),T.railh&&T.setScrollLeft(o),T.cursorupdate.stop(),T.noticeCursor(!1,e,o),T.cursorfreezed=!1}}}else this.doScrollLeft=function(e,o){var t=T.scrollrunning?T.newscrolly:T.getScrollTop();T.doScrollPos(e,t,o)},this.doScrollTop=function(e,o){var t=T.scrollrunning?T.newscrollx:T.getScrollLeft();T.doScrollPos(t,e,o)},this.doScrollPos=function(e,o,t){var r=T.getScrollTop(),i=T.getScrollLeft();((T.newscrolly-r)*(o-r)<0||(T.newscrollx-i)*(e-i)<0)&&T.cancelScroll();var s=!1;if(T.bouncescroll&&T.rail.visibility||(o<0?(o=0,s=!0):o>T.page.maxh&&(o=T.page.maxh,s=!0)),T.bouncescroll&&T.railh.visibility||(e<0?(e=0,s=!0):e>T.page.maxw&&(e=T.page.maxw,s=!0)),T.scrollrunning&&T.newscrolly===o&&T.newscrollx===e)return!0;T.newscrolly=o,T.newscrollx=e,T.dst={},T.dst.x=e-i,T.dst.y=o-r,T.dst.px=i,T.dst.py=r;var n=0|Math.sqrt(T.dst.x*T.dst.x+T.dst.y*T.dst.y),l=T.getTransitionSpeed(n);T.bzscroll={};var a=s?1:.58;T.bzscroll.x=new R(i,T.newscrollx,l,0,0,a,1),T.bzscroll.y=new R(r,T.newscrolly,l,0,0,a,1);f();var c=function(){if(T.scrollrunning){var e=T.bzscroll.y.getPos();T.setScrollLeft(T.bzscroll.x.getNow()),T.setScrollTop(T.bzscroll.y.getNow()),e<=1?T.timer=u(c):(T.scrollrunning=!1,T.timer=0,T.triggerScrollEnd())}};T.scrollrunning||(T.triggerScrollStart(i,r,e,o,l),T.scrollrunning=!0,T.timer=u(c))},this.cancelScroll=function(){return T.timer&&h(T.timer),T.timer=0,T.bzscroll=!1,T.scrollrunning=!1,T};else this.doScrollLeft=function(e,o){var t=T.getScrollTop();T.doScrollPos(e,t,o)},this.doScrollTop=function(e,o){var t=T.getScrollLeft();T.doScrollPos(t,e,o)},this.doScrollPos=function(e,o,t){var r=e>T.page.maxw?T.page.maxw:e;r<0&&(r=0);var i=o>T.page.maxh?T.page.maxh:o;i<0&&(i=0),T.synched("scroll",function(){T.setScrollTop(i),T.setScrollLeft(r)})},this.cancelScroll=function(){};this.doScrollBy=function(e,o){z(0,e)},this.doScrollLeftBy=function(e,o){z(e,0)},this.doScrollTo=function(e,o){var t=o?Math.round(e*T.scrollratio.y):e;t<0?t=0:t>T.page.maxh&&(t=T.page.maxh),T.cursorfreezed=!1,T.doScrollTop(e)},this.checkContentSize=function(){var e=T.getContentSize();e.h==T.page.h&&e.w==T.page.w||T.resize(!1,e)},T.onscroll=function(e){T.rail.drag||T.cursorfreezed||T.synched("scroll",function(){T.scroll.y=Math.round(T.getScrollTop()/T.scrollratio.y),T.railh&&(T.scroll.x=Math.round(T.getScrollLeft()/T.scrollratio.x)),T.noticeCursor()})},T.bind(T.docscroll,"scroll",T.onscroll),this.doZoomIn=function(e){if(!T.zoomactive){T.zoomactive=!0,T.zoomrestore={style:{}};var o=["position","top","left","zIndex","backgroundColor","marginTop","marginBottom","marginLeft","marginRight"],t=T.win[0].style;for(var r in o){var i=o[r];T.zoomrestore.style[i]=void 0!==t[i]?t[i]:""}T.zoomrestore.style.width=T.win.css("width"),T.zoomrestore.style.height=T.win.css("height"),T.zoomrestore.padding={w:T.win.outerWidth()-T.win.width(),h:T.win.outerHeight()-T.win.height()},N.isios4&&(T.zoomrestore.scrollTop=c.scrollTop(),c.scrollTop(0)),T.win.css({position:N.isios4?"absolute":"fixed",top:0,left:0,zIndex:s+100,margin:0});var n=T.win.css("backgroundColor");return(""===n||/transparent|rgba\(0, 0, 0, 0\)|rgba\(0,0,0,0\)/.test(n))&&T.win.css("backgroundColor","#fff"),T.rail.css({zIndex:s+101}),T.zoom.css({zIndex:s+102}),T.zoom.css("backgroundPosition","0 -18px"),T.resizeZoom(),T.onzoomin&&T.onzoomin.call(T),T.cancelEvent(e)}},this.doZoomOut=function(e){if(T.zoomactive)return T.zoomactive=!1,T.win.css("margin",""),T.win.css(T.zoomrestore.style),N.isios4&&c.scrollTop(T.zoomrestore.scrollTop),T.rail.css({"z-index":T.zindex}),T.zoom.css({"z-index":T.zindex}),T.zoomrestore=!1,T.zoom.css("backgroundPosition","0 0"),T.onResize(),T.onzoomout&&T.onzoomout.call(T),T.cancelEvent(e)},this.doZoom=function(e){return T.zoomactive?T.doZoomOut(e):T.doZoomIn(e)},this.resizeZoom=function(){if(T.zoomactive){var e=T.getScrollTop();T.win.css({width:c.width()-T.zoomrestore.padding.w+"px",height:c.height()-T.zoomrestore.padding.h+"px"}),T.onResize(),T.setScrollTop(Math.min(T.page.maxh,e))}},this.init(),n.nicescroll.push(this)},y=function(e){var o=this;this.nc=e,this.lastx=0,this.lasty=0,this.speedx=0,this.speedy=0,this.lasttime=0,this.steptime=0,this.snapx=!1,this.snapy=!1,this.demulx=0,this.demuly=0,this.lastscrollx=-1,this.lastscrolly=-1,this.chkx=0,this.chky=0,this.timer=0,this.reset=function(e,t){o.stop(),o.steptime=0,o.lasttime=f(),o.speedx=0,o.speedy=0,o.lastx=e,o.lasty=t,o.lastscrollx=-1,o.lastscrolly=-1},this.update=function(e,t){var r=f();o.steptime=r-o.lasttime,o.lasttime=r;var i=t-o.lasty,s=e-o.lastx,n=o.nc.getScrollTop()+i,l=o.nc.getScrollLeft()+s;o.snapx=l<0||l>o.nc.page.maxw,o.snapy=n<0||n>o.nc.page.maxh,o.speedx=s,o.speedy=i,o.lastx=e,o.lasty=t},this.stop=function(){o.nc.unsynched("domomentum2d"),o.timer&&clearTimeout(o.timer),o.timer=0,o.lastscrollx=-1,o.lastscrolly=-1},this.doSnapy=function(e,t){var r=!1;t<0?(t=0,r=!0):t>o.nc.page.maxh&&(t=o.nc.page.maxh,r=!0),e<0?(e=0,r=!0):e>o.nc.page.maxw&&(e=o.nc.page.maxw,r=!0),r?o.nc.doScrollPos(e,t,o.nc.opt.snapbackspeed):o.nc.triggerScrollEnd()},this.doMomentum=function(e){var t=f(),r=e?t+e:o.lasttime,i=o.nc.getScrollLeft(),s=o.nc.getScrollTop(),n=o.nc.page.maxh,l=o.nc.page.maxw;o.speedx=l>0?Math.min(60,o.speedx):0,o.speedy=n>0?Math.min(60,o.speedy):0;var a=r&&t-r<=60;(s<0||s>n||i<0||i>l)&&(a=!1);var c=!(!o.speedy||!a)&&o.speedy,d=!(!o.speedx||!a)&&o.speedx;if(c||d){var u=Math.max(16,o.steptime);if(u>50){var h=u/50;o.speedx*=h,o.speedy*=h,u=50}o.demulxy=0,o.lastscrollx=o.nc.getScrollLeft(),o.chkx=o.lastscrollx,o.lastscrolly=o.nc.getScrollTop(),o.chky=o.lastscrolly;var p=o.lastscrollx,m=o.lastscrolly,g=function(){var e=f()-t>600?.04:.02;o.speedx&&(p=Math.floor(o.lastscrollx-o.speedx*(1-o.demulxy)),o.lastscrollx=p,(p<0||p>l)&&(e=.1)),o.speedy&&(m=Math.floor(o.lastscrolly-o.speedy*(1-o.demulxy)),o.lastscrolly=m,(m<0||m>n)&&(e=.1)),o.demulxy=Math.min(1,o.demulxy+e),o.nc.synched("domomentum2d",function(){if(o.speedx){o.nc.getScrollLeft();o.chkx=p,o.nc.setScrollLeft(p)}if(o.speedy){o.nc.getScrollTop();o.chky=m,o.nc.setScrollTop(m)}o.timer||(o.nc.hideCursor(),o.doSnapy(p,m))}),o.demulxy<1?o.timer=setTimeout(g,u):(o.stop(),o.nc.hideCursor(),o.doSnapy(p,m))};g()}else o.doSnapy(o.nc.getScrollLeft(),o.nc.getScrollTop())}},x=e.fn.scrollTop;e.cssHooks.pageYOffset={get:function(e,o,t){var r=n.data(e,"__nicescroll")||!1;return r&&r.ishwscroll?r.getScrollTop():x.call(e)},set:function(e,o){var t=n.data(e,"__nicescroll")||!1;return t&&t.ishwscroll?t.setScrollTop(parseInt(o)):x.call(e,o),this}},e.fn.scrollTop=function(e){if(void 0===e){var o=!!this[0]&&(n.data(this[0],"__nicescroll")||!1);return o&&o.ishwscroll?o.getScrollTop():x.call(this)}return this.each(function(){var o=n.data(this,"__nicescroll")||!1;o&&o.ishwscroll?o.setScrollTop(parseInt(e)):x.call(n(this),e)})};var S=e.fn.scrollLeft;n.cssHooks.pageXOffset={get:function(e,o,t){var r=n.data(e,"__nicescroll")||!1;return r&&r.ishwscroll?r.getScrollLeft():S.call(e)},set:function(e,o){var t=n.data(e,"__nicescroll")||!1;return t&&t.ishwscroll?t.setScrollLeft(parseInt(o)):S.call(e,o),this}},e.fn.scrollLeft=function(e){if(void 0===e){var o=!!this[0]&&(n.data(this[0],"__nicescroll")||!1);return o&&o.ishwscroll?o.getScrollLeft():S.call(this)}return this.each(function(){var o=n.data(this,"__nicescroll")||!1;o&&o.ishwscroll?o.setScrollLeft(parseInt(e)):S.call(n(this),e)})};var z=function(e){var o=this;if(this.length=0,this.name="nicescrollarray",this.each=function(e){return n.each(o,e),o},this.push=function(e){o[o.length]=e,o.length++},this.eq=function(e){return o[e]},e)for(var t=0;t1?n(e,r):s,i.win=r}!("doc"in i)||"win"in i||(i.win=r);var l=r.data("__nicescroll")||!1;l||(i.doc=i.doc||r,l=new b(i,r),r.data("__nicescroll",l)),t.push(l)}),1===t.length?t[0]:t},a.NiceScroll={getjQuery:function(){return e}},n.nicescroll||(n.nicescroll=new z,n.nicescroll.options=g)}); \ No newline at end of file From 3dfc32986cce87f01259f790f505aec9132b14a5 Mon Sep 17 00:00:00 2001 From: InuYaksa Date: Mon, 10 Jul 2017 12:02:46 +0200 Subject: [PATCH 10/14] 3.7.5-b label fixed --- jquery.nicescroll.min.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jquery.nicescroll.min.js b/jquery.nicescroll.min.js index 1a58f1d..b96602c 100644 --- a/jquery.nicescroll.min.js +++ b/jquery.nicescroll.min.js @@ -1,2 +1,2 @@ -/* jquery.nicescroll v 3.7.4-d [DEV REL] - InuYaksa*2017 - MIT - https://nicescroll.areaaperta.com/ */ +/* jquery.nicescroll v 3.7.5-b [DEV REL] - InuYaksa*2017 - MIT - https://nicescroll.areaaperta.com/ */ !function(e){"function"==typeof define&&define.amd?define(["jquery"],e):"object"==typeof exports?module.exports=e(require("jquery")):e(jQuery)}(function(e){"use strict";var o=!1,t=!1,r=0,i=2e3,s=0,n=e,l=document,a=window,c=n(a),d=[],u=a.requestAnimationFrame||a.webkitRequestAnimationFrame||a.mozRequestAnimationFrame||!1,h=a.cancelAnimationFrame||a.webkitCancelAnimationFrame||a.mozCancelAnimationFrame||!1;if(u)a.cancelAnimationFrame||(h=function(e){});else{var p=0;u=function(e,o){var t=(new Date).getTime(),r=Math.max(0,16-(t-p)),i=a.setTimeout(function(){e(t+r)},r);return p=t+r,i},h=function(e){a.clearTimeout(e)}}var m=a.MutationObserver||a.WebKitMutationObserver||!1,f=Date.now||function(){return(new Date).getTime()},g={zindex:"auto",cursoropacitymin:0,cursoropacitymax:1,cursorcolor:"#424242",cursorwidth:"6px",cursorborder:"1px solid #fff",cursorborderradius:"5px",scrollspeed:40,mousescrollstep:27,touchbehavior:!1,emulatetouch:!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 e=l.currentScript||function(){var e=l.getElementsByTagName("script");return!!e.length&&e[e.length-1]}(),o=e?e.src.split("?")[0]:"";return o.split("/").length>0?o.split("/").slice(0,-1).join("/")+"/":""}(),preventmultitouchscrolling:!0,disablemutationobserver:!1,enableobserver:!0,scrollbarid:!1},v=!1,w=function(){if(v)return v;var e=l.createElement("DIV"),o=e.style,t=navigator.userAgent,r=navigator.platform,i={};return i.haspointerlock="pointerLockElement"in l||"webkitPointerLockElement"in l||"mozPointerLockElement"in l,i.isopera="opera"in a,i.isopera12=i.isopera&&"getUserMedia"in navigator,i.isoperamini="[object OperaMini]"===Object.prototype.toString.call(a.operamini),i.isie="all"in l&&"attachEvent"in e&&!i.isopera,i.isieold=i.isie&&!("msInterpolationMode"in o),i.isie7=i.isie&&!i.isieold&&(!("documentMode"in l)||7===l.documentMode),i.isie8=i.isie&&"documentMode"in l&&8===l.documentMode,i.isie9=i.isie&&"performance"in a&&9===l.documentMode,i.isie10=i.isie&&"performance"in a&&10===l.documentMode,i.isie11="msRequestFullscreen"in e&&l.documentMode>=11,i.ismsedge="msCredentials"in a,i.ismozilla="MozAppearance"in o,i.iswebkit=!i.ismsedge&&"WebkitAppearance"in o,i.ischrome=i.iswebkit&&"chrome"in a,i.ischrome38=i.ischrome&&"touchAction"in o,i.ischrome22=!i.ischrome38&&i.ischrome&&i.haspointerlock,i.ischrome26=!i.ischrome38&&i.ischrome&&"transition"in o,i.cantouch="ontouchstart"in l.documentElement||"ontouchstart"in a,i.hasw3ctouch=(a.PointerEvent||!1)&&(navigator.MaxTouchPoints>0||navigator.msMaxTouchPoints>0),i.hasmstouch=!i.hasw3ctouch&&(a.MSPointerEvent||!1),i.ismac=/^mac$/i.test(r),i.isios=i.cantouch&&/iphone|ipad|ipod/i.test(r),i.isios4=i.isios&&!("seal"in Object),i.isios7=i.isios&&"webkitHidden"in l,i.isios8=i.isios&&"hidden"in l,i.isios10=i.isios&&a.Proxy,i.isandroid=/android/i.test(t),i.haseventlistener="addEventListener"in e,i.trstyle=!1,i.hastransform=!1,i.hastranslate3d=!1,i.transitionstyle=!1,i.hastransition=!1,i.transitionend=!1,i.trstyle="transform",i.hastransform="transform"in o||function(){for(var e=["msTransform","webkitTransform","MozTransform","OTransform"],t=0,r=e.length;t0;){if(9==e[0].nodeType)return!1;var o=e.css("zIndex");if(!isNaN(o)&&0!==o)return parseInt(o);e=e.parent()}return!1}function x(e,o,t){var r=e.css(o),i=parseFloat(r);if(isNaN(i)){var s=3==(i=I[r]||0)?t?T.win.outerHeight()-T.win.innerHeight():T.win.outerWidth()-T.win.innerWidth():1;return T.isie8&&i&&(i+=1),s?i:0}return i}function S(e,o,t,r){T._bind(e,o,function(r){var i={original:r=r||a.event,target:r.target||r.srcElement,type:"wheel",deltaMode:"MozMousePixelScroll"==r.type?0:1,deltaX:0,deltaZ:0,preventDefault:function(){return r.preventDefault?r.preventDefault():r.returnValue=!1,!1},stopImmediatePropagation:function(){r.stopImmediatePropagation?r.stopImmediatePropagation():r.cancelBubble=!0}};return"mousewheel"==o?(r.wheelDeltaX&&(i.deltaX=-.025*r.wheelDeltaX),r.wheelDeltaY&&(i.deltaY=-.025*r.wheelDeltaY),!i.deltaY&&!i.deltaX&&(i.deltaY=-.025*r.wheelDelta)):i.deltaY=r.detail,t.call(e,i)},r)}function z(e,o,t,r){T.scrollrunning||(T.newscrolly=T.getScrollTop(),T.newscrollx=T.getScrollLeft(),D=f());var i=f()-D;if(D=f(),i>350?A=1:A+=(2-A)/10,e=e*A|0,o=o*A|0,e){if(r)if(e<0){if(T.getScrollLeft()>=T.page.maxw)return!0}else if(T.getScrollLeft()<=0)return!0;var s=e>0?1:-1;X!==s&&(T.scrollmom&&T.scrollmom.stop(),T.newscrollx=T.getScrollLeft(),X=s),T.lastdeltax-=e}if(o){if(function(){var e=T.getScrollTop();if(o<0){if(e>=T.page.maxh)return!0}else if(e<=0)return!0}()){if(M.nativeparentscrolling&&t&&!T.ispage&&!T.zoomactive)return!0;var n=T.view.h>>1;T.newscrolly<-n?(T.newscrolly=-n,o=-1):T.newscrolly>T.page.maxh+n?(T.newscrolly=T.page.maxh+n,o=1):o=0}var l=o>0?1:-1;B!==l&&(T.scrollmom&&T.scrollmom.stop(),T.newscrolly=T.getScrollTop(),B=l),T.lastdeltay-=o}(o||e)&&T.synched("relativexy",function(){var e=T.lastdeltay+T.newscrolly;T.lastdeltay=0;var o=T.lastdeltax+T.newscrollx;T.lastdeltax=0,T.rail.drag||T.doScrollPos(o,e)})}function k(e,o,t){var r,i;return!(t||!q)||(0===e.deltaMode?(r=-e.deltaX*(M.mousescrollstep/54)|0,i=-e.deltaY*(M.mousescrollstep/54)|0):1===e.deltaMode&&(r=-e.deltaX*M.mousescrollstep*50/80|0,i=-e.deltaY*M.mousescrollstep*50/80|0),o&&M.oneaxismousemode&&0===r&&i&&(r=i,i=0,t&&(r<0?T.getScrollLeft()>=T.page.maxw:T.getScrollLeft()<=0)&&(i=r,r=0)),T.isrtlmode&&(r=-r),z(r,i,t,!0)?void(t&&(q=!0)):(q=!1,e.stopImmediatePropagation(),e.preventDefault()))}var T=this;this.version="3.7.5-b",this.name="nicescroll",this.me=p;var E=n("body"),M=this.opt={doc:E,win:!1};if(n.extend(M,g),M.snapbackspeed=80,e)for(var L in M)void 0!==e[L]&&(M[L]=e[L]);if(M.disablemutationobserver&&(m=!1),this.doc=M.doc,this.iddoc=this.doc&&this.doc[0]?this.doc[0].id||"":"",this.ispage=/^BODY|HTML/.test(M.win?M.win[0].nodeName:this.doc[0].nodeName),this.haswrapper=!1!==M.win,this.win=M.win||(this.ispage?c:this.doc),this.docscroll=this.ispage&&!this.haswrapper?c:this.win,this.body=E,this.viewport=!1,this.isfixed=!1,this.iframe=!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"!=M.autohidemode,this.onmousedown=!1,this.onmouseup=!1,this.onmousemove=!1,this.onmousewheel=!1,this.onkeypress=!1,this.ongesturezoom=!1,this.onclick=!1,this.onscrollstart=!1,this.onscrollend=!1,this.onscrollcancel=!1,this.onzoomin=!1,this.onzoomout=!1,this.view=!1,this.page=!1,this.scroll={x:0,y:0},this.scrollratio={x:0,y:0},this.cursorheight=20,this.scrollvaluemax=0,"auto"==M.rtlmode){var C=this.win[0]==a?this.body:this.win,P=C.css("writing-mode")||C.css("-webkit-writing-mode")||C.css("-ms-writing-mode")||C.css("-moz-writing-mode");"horizontal-tb"==P||"lr-tb"==P||""===P?(this.isrtlmode="rtl"==C.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===M.rtlmode,this.isvertical=!1;if(this.scrollrunning=!1,this.scrollmom=!1,this.observer=!1,this.observerremover=!1,this.observerbody=!1,!1!==M.scrollbarid)this.id=M.scrollbarid;else do{this.id="ascrail"+i++}while(l.getElementById(this.id));this.rail=!1,this.cursor=!1,this.cursorfreezed=!1,this.selectiondrag=!1,this.zoom=!1,this.zoomactive=!1,this.hasfocus=!1,this.hasmousefocus=!1,this.railslocked=!1,this.locked=!1,this.hidden=!1,this.cursoractive=!0,this.wheelprevented=!1,this.overflowx=M.overflowx,this.overflowy=M.overflowy,this.nativescrollingarea=!1,this.checkarea=0,this.events=[],this.saved={},this.delaylist={},this.synclist={},this.lastdeltax=0,this.lastdeltay=0,this.detected=w();var N=n.extend({},this.detected);this.canhwscroll=N.hastransform&&M.hwacceleration,this.ishwscroll=this.canhwscroll&&T.haswrapper,this.isrtlmode?this.isvertical?this.hasreversehr=!(N.iswebkit||N.isie||N.isie11):this.hasreversehr=!(N.iswebkit||N.isie&&!N.isie10&&!N.isie11):this.hasreversehr=!1,this.istouchcapable=!1,N.cantouch||!N.hasw3ctouch&&!N.hasmstouch?!N.cantouch||N.isios||N.isandroid||!N.iswebkit&&!N.ismozilla||(this.istouchcapable=!0):this.istouchcapable=!0,M.enablemouselockapi||(N.hasmousecapture=!1,N.haspointerlock=!1),this.debounced=function(e,o,t){T&&(T.delaylist[e]||!1||(T.delaylist[e]={h:u(function(){T.delaylist[e].fn.call(T),T.delaylist[e]=!1},t)},o.call(T)),T.delaylist[e].fn=o)},this.synched=function(e,o){T.synclist[e]?T.synclist[e]=o:(T.synclist[e]=o,u(function(){T&&(T.synclist[e]&&T.synclist[e].call(T),T.synclist[e]=null)}))},this.unsynched=function(e){T.synclist[e]&&(T.synclist[e]=!1)},this.css=function(e,o){for(var t in o)T.saved.css.push([e,t,e.css(t)]),e.css(t,o[t])},this.scrollTop=function(e){return void 0===e?T.getScrollTop():T.setScrollTop(e)},this.scrollLeft=function(e){return void 0===e?T.getScrollLeft():T.setScrollLeft(e)};var R=function(e,o,t,r,i,s,n){this.st=e,this.ed=o,this.spd=t,this.p1=r||0,this.p2=i||1,this.p3=s||0,this.p4=n||1,this.ts=f(),this.df=o-e};if(R.prototype={B2:function(e){return 3*(1-e)*(1-e)*e},B3:function(e){return 3*(1-e)*e*e},B4:function(e){return e*e*e},getPos:function(){return(f()-this.ts)/this.spd},getNow:function(){var e=(f()-this.ts)/this.spd,o=this.B2(e)+this.B3(e)+this.B4(e);return e>=1?this.ed:this.st+this.df*o|0},update:function(e,o){return this.st=this.getNow(),this.ed=e,this.spd=o,this.ts=f(),this.df=this.ed-this.st,this}},this.ishwscroll){this.doc.translate={x:0,y:0,tx:"0px",ty:"0px"},N.hastranslate3d&&N.isios&&this.doc.css("-webkit-backface-visibility","hidden"),this.getScrollTop=function(e){if(!e){var o=v();if(o)return 16==o.length?-o[13]:-o[5];if(T.timerscroll&&T.timerscroll.bz)return T.timerscroll.bz.getNow()}return T.doc.translate.y},this.getScrollLeft=function(e){if(!e){var o=v();if(o)return 16==o.length?-o[12]:-o[4];if(T.timerscroll&&T.timerscroll.bh)return T.timerscroll.bh.getNow()}return T.doc.translate.x},this.notifyScrollEvent=function(e){var o=l.createEvent("UIEvents");o.initUIEvent("scroll",!1,!1,a,1),o.niceevent=!0,e.dispatchEvent(o)};var _=this.isrtlmode?1:-1;N.hastranslate3d&&M.enabletranslate3d?(this.setScrollTop=function(e,o){T.doc.translate.y=e,T.doc.translate.ty=-1*e+"px",T.doc.css(N.trstyle,"translate3d("+T.doc.translate.tx+","+T.doc.translate.ty+",0)"),o||T.notifyScrollEvent(T.win[0])},this.setScrollLeft=function(e,o){T.doc.translate.x=e,T.doc.translate.tx=e*_+"px",T.doc.css(N.trstyle,"translate3d("+T.doc.translate.tx+","+T.doc.translate.ty+",0)"),o||T.notifyScrollEvent(T.win[0])}):(this.setScrollTop=function(e,o){T.doc.translate.y=e,T.doc.translate.ty=-1*e+"px",T.doc.css(N.trstyle,"translate("+T.doc.translate.tx+","+T.doc.translate.ty+")"),o||T.notifyScrollEvent(T.win[0])},this.setScrollLeft=function(e,o){T.doc.translate.x=e,T.doc.translate.tx=e*_+"px",T.doc.css(N.trstyle,"translate("+T.doc.translate.tx+","+T.doc.translate.ty+")"),o||T.notifyScrollEvent(T.win[0])})}else this.getScrollTop=function(){return T.docscroll.scrollTop()},this.setScrollTop=function(e){T.docscroll.scrollTop(e)},this.getScrollLeft=function(){return T.hasreversehr?T.detected.ismozilla?T.page.maxw-Math.abs(T.docscroll.scrollLeft()):T.page.maxw-T.docscroll.scrollLeft():T.docscroll.scrollLeft()},this.setScrollLeft=function(e){return setTimeout(function(){if(T)return T.hasreversehr&&(e=T.detected.ismozilla?-(T.page.maxw-e):T.page.maxw-e),T.docscroll.scrollLeft(e)},1)};this.getTarget=function(e){return!!e&&(e.target?e.target:!!e.srcElement&&e.srcElement)},this.hasParent=function(e,o){if(!e)return!1;for(var t=e.target||e.srcElement||e||!1;t&&t.id!=o;)t=t.parentNode||!1;return!1!==t};var I={thin:1,medium:3,thick:5};this.getDocumentScrollOffset=function(){return{top:a.pageYOffset||l.documentElement.scrollTop,left:a.pageXOffset||l.documentElement.scrollLeft}},this.getOffset=function(){if(T.isfixed){var e=T.win.offset(),o=T.getDocumentScrollOffset();return e.top-=o.top,e.left-=o.left,e}var t=T.win.offset();if(!T.viewport)return t;var r=T.viewport.offset();return{top:t.top-r.top,left:t.left-r.left}},this.updateScrollBar=function(e){var o,t;if(T.ishwscroll)T.rail.css({height:T.win.innerHeight()-(M.railpadding.top+M.railpadding.bottom)}),T.railh&&T.railh.css({width:T.win.innerWidth()-(M.railpadding.left+M.railpadding.right)});else{var r=T.getOffset();if(o={top:r.top,left:r.left-(M.railpadding.left+M.railpadding.right)},o.top+=x(T.win,"border-top-width",!0),o.left+=T.rail.align?T.win.outerWidth()-x(T.win,"border-right-width")-T.rail.width:x(T.win,"border-left-width"),(t=M.railoffset)&&(t.top&&(o.top+=t.top),t.left&&(o.left+=t.left)),T.railslocked||T.rail.css({top:o.top,left:o.left,height:(e?e.h:T.win.innerHeight())-(M.railpadding.top+M.railpadding.bottom)}),T.zoom&&T.zoom.css({top:o.top+1,left:1==T.rail.align?o.left-20:o.left+T.rail.width+4}),T.railh&&!T.railslocked){o={top:r.top,left:r.left},(t=M.railhoffset)&&(t.top&&(o.top+=t.top),t.left&&(o.left+=t.left));var i=T.railh.align?o.top+x(T.win,"border-top-width",!0)+T.win.innerHeight()-T.railh.height:o.top+x(T.win,"border-top-width",!0),s=o.left+x(T.win,"border-left-width");T.railh.css({top:i-(M.railpadding.top+M.railpadding.bottom),left:s,width:T.railh.width})}}},this.doRailClick=function(e,o,t){var r,i,s,n;T.railslocked||(T.cancelEvent(e),"pageY"in e||(e.pageX=e.clientX+l.documentElement.scrollLeft,e.pageY=e.clientY+l.documentElement.scrollTop),o?(r=t?T.doScrollLeft:T.doScrollTop,s=t?(e.pageX-T.railh.offset().left-T.cursorwidth/2)*T.scrollratio.x:(e.pageY-T.rail.offset().top-T.cursorheight/2)*T.scrollratio.y,T.unsynched("relativexy"),r(0|s)):(r=t?T.doScrollLeftBy:T.doScrollBy,s=t?T.scroll.x:T.scroll.y,n=t?e.pageX-T.railh.offset().left:e.pageY-T.rail.offset().top,i=t?T.view.w:T.view.h,r(s>=n?i:-i)))},T.newscrolly=T.newscrollx=0,T.hasanimationframe="requestAnimationFrame"in a,T.hascancelanimationframe="cancelAnimationFrame"in a,T.hasborderbox=!1,this.init=function(){if(T.saved.css=[],N.isoperamini)return!0;if(N.isandroid&&!("hidden"in l))return!0;M.emulatetouch=M.emulatetouch||M.touchbehavior,T.hasborderbox=a.getComputedStyle&&"border-box"===a.getComputedStyle(l.body)["box-sizing"];var e={"overflow-y":"hidden"};if((N.isie11||N.isie10)&&(e["-ms-overflow-style"]="none"),T.ishwscroll&&(this.doc.css(N.transitionstyle,N.prefixstyle+"transform 0ms ease-out"),N.transitionend&&T.bind(T.doc,N.transitionend,T.onScrollTransitionEnd,!1)),T.zindex="auto",T.ispage||"auto"!=M.zindex?T.zindex=M.zindex:T.zindex=b()||"auto",!T.ispage&&"auto"!=T.zindex&&T.zindex>s&&(s=T.zindex),T.isie&&0===T.zindex&&"auto"==M.zindex&&(T.zindex="auto"),!T.ispage||!N.isieold){var i=T.docscroll;T.ispage&&(i=T.haswrapper?T.win:T.doc),T.css(i,e),T.ispage&&(N.isie11||N.isie)&&T.css(n("html"),e),!N.isios||T.ispage||T.haswrapper||T.css(E,{"-webkit-overflow-scrolling":"touch"});var d=n(l.createElement("div"));d.css({position:"relative",top:0,float:"right",width:M.cursorwidth,height:0,"background-color":M.cursorcolor,border:M.cursorborder,"background-clip":"padding-box","-webkit-border-radius":M.cursorborderradius,"-moz-border-radius":M.cursorborderradius,"border-radius":M.cursorborderradius}),d.addClass("nicescroll-cursors"),T.cursor=d;var u=n(l.createElement("div"));u.attr("id",T.id),u.addClass("nicescroll-rails nicescroll-rails-vr");var h,p,f=["left","right","top","bottom"];for(var g in f)p=f[g],(h=M.railpadding[p]||0)&&u.css("padding-"+p,h+"px");u.append(d),u.width=Math.max(parseFloat(M.cursorwidth),d.outerWidth()),u.css({width:u.width+"px",zIndex:T.zindex,background:M.background,cursor:"default"}),u.visibility=!0,u.scrollable=!0,u.align="left"==M.railalign?0:1,T.rail=u,T.rail.drag=!1;var v=!1;!M.boxzoom||T.ispage||N.isieold||(v=l.createElement("div"),T.bind(v,"click",T.doZoom),T.bind(v,"mouseenter",function(){T.zoom.css("opacity",M.cursoropacitymax)}),T.bind(v,"mouseleave",function(){T.zoom.css("opacity",M.cursoropacitymin)}),T.zoom=n(v),T.zoom.css({cursor:"pointer",zIndex:T.zindex,backgroundImage:"url("+M.scriptpath+"zoomico.png)",height:18,width:18,backgroundPosition:"0 0"}),M.dblclickzoom&&T.bind(T.win,"dblclick",T.doZoom),N.cantouch&&M.gesturezoom&&(T.ongesturezoom=function(e){return e.scale>1.5&&T.doZoomIn(e),e.scale<.8&&T.doZoomOut(e),T.cancelEvent(e)},T.bind(T.win,"gestureend",T.ongesturezoom))),T.railh=!1;var w;if(M.horizrailenabled&&(T.css(i,{overflowX:"hidden"}),(d=n(l.createElement("div"))).css({position:"absolute",top:0,height:M.cursorwidth,width:0,backgroundColor:M.cursorcolor,border:M.cursorborder,backgroundClip:"padding-box","-webkit-border-radius":M.cursorborderradius,"-moz-border-radius":M.cursorborderradius,"border-radius":M.cursorborderradius}),N.isieold&&d.css("overflow","hidden"),d.addClass("nicescroll-cursors"),T.cursorh=d,(w=n(l.createElement("div"))).attr("id",T.id+"-hr"),w.addClass("nicescroll-rails nicescroll-rails-hr"),w.height=Math.max(parseFloat(M.cursorwidth),d.outerHeight()),w.css({height:w.height+"px",zIndex:T.zindex,background:M.background}),w.append(d),w.visibility=!0,w.scrollable=!0,w.align="top"==M.railvalign?0:1,T.railh=w,T.railh.drag=!1),T.ispage)u.css({position:"fixed",top:0,height:"100%"}),u.css(u.align?{right:0}:{left:0}),T.body.append(u),T.railh&&(w.css({position:"fixed",left:0,width:"100%"}),w.css(w.align?{bottom:0}:{top:0}),T.body.append(w));else{if(T.ishwscroll){"static"==T.win.css("position")&&T.css(T.win,{position:"relative"});var x="HTML"==T.win[0].nodeName?T.body:T.win;n(x).scrollTop(0).scrollLeft(0),T.zoom&&(T.zoom.css({position:"absolute",top:1,right:0,"margin-right":u.width+4}),x.append(T.zoom)),u.css({position:"absolute",top:0}),u.css(u.align?{right:0}:{left:0}),x.append(u),w&&(w.css({position:"absolute",left:0,bottom:0}),w.css(w.align?{bottom:0}:{top:0}),x.append(w))}else{T.isfixed="fixed"==T.win.css("position");var S=T.isfixed?"fixed":"absolute";T.isfixed||(T.viewport=T.getViewport(T.win[0])),T.viewport&&(T.body=T.viewport,/fixed|absolute/.test(T.viewport.css("position"))||T.css(T.viewport,{position:"relative"})),u.css({position:S}),T.zoom&&T.zoom.css({position:S}),T.updateScrollBar(),T.body.append(u),T.zoom&&T.body.append(T.zoom),T.railh&&(w.css({position:S}),T.body.append(w))}N.isios&&T.css(T.win,{"-webkit-tap-highlight-color":"rgba(0,0,0,0)","-webkit-touch-callout":"none"}),M.disableoutline&&(N.isie&&T.win.attr("hideFocus","true"),N.iswebkit&&T.win.css("outline","none"))}if(!1===M.autohidemode?(T.autohidedom=!1,T.rail.css({opacity:M.cursoropacitymax}),T.railh&&T.railh.css({opacity:M.cursoropacitymax})):!0===M.autohidemode||"leave"===M.autohidemode?(T.autohidedom=n().add(T.rail),N.isie8&&(T.autohidedom=T.autohidedom.add(T.cursor)),T.railh&&(T.autohidedom=T.autohidedom.add(T.railh)),T.railh&&N.isie8&&(T.autohidedom=T.autohidedom.add(T.cursorh))):"scroll"==M.autohidemode?(T.autohidedom=n().add(T.rail),T.railh&&(T.autohidedom=T.autohidedom.add(T.railh))):"cursor"==M.autohidemode?(T.autohidedom=n().add(T.cursor),T.railh&&(T.autohidedom=T.autohidedom.add(T.cursorh))):"hidden"==M.autohidemode&&(T.autohidedom=!1,T.hide(),T.railslocked=!1),N.cantouch||T.istouchcapable||M.emulatetouch||N.hasmstouch){T.scrollmom=new y(T);T.ontouchstart=function(e){if(T.locked)return!1;if(e.pointerType&&("mouse"===e.pointerType||e.pointerType===e.MSPOINTER_TYPE_MOUSE))return!1;if(T.hasmoving=!1,T.scrollmom.timer&&(T.triggerScrollEnd(),T.scrollmom.stop()),!T.railslocked){var o=T.getTarget(e);if(o&&/INPUT/i.test(o.nodeName)&&/range/i.test(o.type))return T.stopPropagation(e);var t="mousedown"===e.type;if(!("clientX"in e)&&"changedTouches"in e&&(e.clientX=e.changedTouches[0].clientX,e.clientY=e.changedTouches[0].clientY),T.forcescreen){var r=e;(e={original:e.original?e.original:e}).clientX=r.screenX,e.clientY=r.screenY}if(T.rail.drag={x:e.clientX,y:e.clientY,sx:T.scroll.x,sy:T.scroll.y,st:T.getScrollTop(),sl:T.getScrollLeft(),pt:2,dl:!1,tg:o},T.ispage||!M.directionlockdeadzone)T.rail.drag.dl="f";else{var i={w:c.width(),h:c.height()},s=T.getContentSize(),l=s.h-i.h,a=s.w-i.w;T.rail.scrollable&&!T.railh.scrollable?T.rail.drag.ck=l>0&&"v":!T.rail.scrollable&&T.railh.scrollable?T.rail.drag.ck=a>0&&"h":T.rail.drag.ck=!1}if(M.emulatetouch&&T.isiframe&&N.isie){var d=T.win.position();T.rail.drag.x+=d.left,T.rail.drag.y+=d.top}if(T.hasmoving=!1,T.lastmouseup=!1,T.scrollmom.reset(e.clientX,e.clientY),o&&t){if(!/INPUT|SELECT|BUTTON|TEXTAREA/i.test(o.nodeName))return N.hasmousecapture&&o.setCapture(),M.emulatetouch?(o.onclick&&!o._onclick&&(o._onclick=o.onclick,o.onclick=function(e){if(T.hasmoving)return!1;o._onclick.call(this,e)}),T.cancelEvent(e)):T.stopPropagation(e);/SUBMIT|CANCEL|BUTTON/i.test(n(o).attr("type"))&&(T.preventclick={tg:o,click:!1})}}},T.ontouchend=function(e){if(!T.rail.drag)return!0;if(2==T.rail.drag.pt){if(e.pointerType&&("mouse"===e.pointerType||e.pointerType===e.MSPOINTER_TYPE_MOUSE))return!1;T.rail.drag=!1;var o="mouseup"===e.type;if(T.hasmoving&&(T.scrollmom.doMomentum(),T.lastmouseup=!0,T.hideCursor(),N.hasmousecapture&&l.releaseCapture(),o))return T.cancelEvent(e)}else if(1==T.rail.drag.pt)return T.onmouseup(e)};var z=M.emulatetouch&&T.isiframe&&!N.hasmousecapture,k=.3*M.directionlockdeadzone|0;T.ontouchmove=function(e,o){if(!T.rail.drag)return!0;if(e.targetTouches&&M.preventmultitouchscrolling&&e.targetTouches.length>1)return!0;if(e.pointerType&&("mouse"===e.pointerType||e.pointerType===e.MSPOINTER_TYPE_MOUSE))return!0;if(2==T.rail.drag.pt){"changedTouches"in e&&(e.clientX=e.changedTouches[0].clientX,e.clientY=e.changedTouches[0].clientY);var t,r;if(r=t=0,z&&!o){var i=T.win.position();r=-i.left,t=-i.top}var s=e.clientY+t,n=s-T.rail.drag.y,a=e.clientX+r,c=a-T.rail.drag.x,d=T.rail.drag.st-n;if(T.ishwscroll&&M.bouncescroll)d<0?d=Math.round(d/2):d>T.page.maxh&&(d=T.page.maxh+Math.round((d-T.page.maxh)/2));else if(d<0?(d=0,s=0):d>T.page.maxh&&(d=T.page.maxh,s=0),0===s&&!T.hasmoving)return T.ispage||(T.rail.drag=!1),!0;var u=T.getScrollLeft();if(T.railh&&T.railh.scrollable&&(u=T.isrtlmode?c-T.rail.drag.sl:T.rail.drag.sl-c,T.ishwscroll&&M.bouncescroll?u<0?u=Math.round(u/2):u>T.page.maxw&&(u=T.page.maxw+Math.round((u-T.page.maxw)/2)):(u<0&&(u=0,a=0),u>T.page.maxw&&(u=T.page.maxw,a=0))),!T.hasmoving){if(T.rail.drag.y===e.clientY&&T.rail.drag.x===e.clientX)return T.cancelEvent(e);var h=Math.abs(n),p=Math.abs(c),m=M.directionlockdeadzone;if(T.rail.drag.ck?"v"==T.rail.drag.ck?p>m&&h<=k?T.rail.drag=!1:h>m&&(T.rail.drag.dl="v"):"h"==T.rail.drag.ck&&(h>m&&p<=k?T.rail.drag=!1:p>m&&(T.rail.drag.dl="h")):h>m&&p>m?T.rail.drag.dl="f":h>m?T.rail.drag.dl=p>k?"f":"v":p>m&&(T.rail.drag.dl=h>k?"f":"h"),!T.rail.drag.dl)return T.cancelEvent(e);T.triggerScrollStart(e.clientX,e.clientY,0,0,0),T.hasmoving=!0}return T.preventclick&&!T.preventclick.click&&(T.preventclick.click=T.preventclick.tg.onclick||!1,T.preventclick.tg.onclick=T.onpreventclick),T.rail.drag.dl&&("v"==T.rail.drag.dl?u=T.rail.drag.sl:"h"==T.rail.drag.dl&&(d=T.rail.drag.st)),T.synched("touchmove",function(){T.rail.drag&&2==T.rail.drag.pt&&(T.prepareTransition&&T.resetTransition(),T.rail.scrollable&&T.setScrollTop(d),T.scrollmom.update(a,s),T.railh&&T.railh.scrollable?(T.setScrollLeft(u),T.showCursor(d,u)):T.showCursor(d),N.isie10&&l.selection.clear())}),T.cancelEvent(e)}return 1==T.rail.drag.pt?T.onmousemove(e):void 0},T.ontouchstartCursor=function(e,o){if(!T.rail.drag||3==T.rail.drag.pt){if(T.locked)return T.cancelEvent(e);T.cancelScroll(),T.rail.drag={x:e.touches[0].clientX,y:e.touches[0].clientY,sx:T.scroll.x,sy:T.scroll.y,pt:3,hr:!!o};var t=T.getTarget(e);return!T.ispage&&N.hasmousecapture&&t.setCapture(),T.isiframe&&!N.hasmousecapture&&(T.saved.csspointerevents=T.doc.css("pointer-events"),T.css(T.doc,{"pointer-events":"none"})),T.cancelEvent(e)}},T.ontouchendCursor=function(e){if(T.rail.drag){if(N.hasmousecapture&&l.releaseCapture(),T.isiframe&&!N.hasmousecapture&&T.doc.css("pointer-events",T.saved.csspointerevents),3!=T.rail.drag.pt)return;return T.rail.drag=!1,T.cancelEvent(e)}},T.ontouchmoveCursor=function(e){if(T.rail.drag){if(3!=T.rail.drag.pt)return;if(T.cursorfreezed=!0,T.rail.drag.hr){T.scroll.x=T.rail.drag.sx+(e.touches[0].clientX-T.rail.drag.x),T.scroll.x<0&&(T.scroll.x=0);var o=T.scrollvaluemaxw;T.scroll.x>o&&(T.scroll.x=o)}else{T.scroll.y=T.rail.drag.sy+(e.touches[0].clientY-T.rail.drag.y),T.scroll.y<0&&(T.scroll.y=0);var t=T.scrollvaluemax;T.scroll.y>t&&(T.scroll.y=t)}return T.synched("touchmove",function(){T.rail.drag&&3==T.rail.drag.pt&&(T.showCursor(),T.rail.drag.hr?T.doScrollLeft(Math.round(T.scroll.x*T.scrollratio.x),M.cursordragspeed):T.doScrollTop(Math.round(T.scroll.y*T.scrollratio.y),M.cursordragspeed))}),T.cancelEvent(e)}}}if(T.onmousedown=function(e,o){if(!T.rail.drag||1==T.rail.drag.pt){if(T.railslocked)return T.cancelEvent(e);T.cancelScroll(),T.rail.drag={x:e.clientX,y:e.clientY,sx:T.scroll.x,sy:T.scroll.y,pt:1,hr:o||!1};var t=T.getTarget(e);return N.hasmousecapture&&t.setCapture(),T.isiframe&&!N.hasmousecapture&&(T.saved.csspointerevents=T.doc.css("pointer-events"),T.css(T.doc,{"pointer-events":"none"})),T.hasmoving=!1,T.cancelEvent(e)}},T.onmouseup=function(e){if(T.rail.drag)return 1!=T.rail.drag.pt||(N.hasmousecapture&&l.releaseCapture(),T.isiframe&&!N.hasmousecapture&&T.doc.css("pointer-events",T.saved.csspointerevents),T.rail.drag=!1,T.cursorfreezed=!1,T.hasmoving&&T.triggerScrollEnd(),T.cancelEvent(e))},T.onmousemove=function(e){if(T.rail.drag){if(1!==T.rail.drag.pt)return;if(N.ischrome&&0===e.which)return T.onmouseup(e);if(T.cursorfreezed=!0,T.hasmoving||T.triggerScrollStart(e.clientX,e.clientY,0,0,0),T.hasmoving=!0,T.rail.drag.hr){T.scroll.x=T.rail.drag.sx+(e.clientX-T.rail.drag.x),T.scroll.x<0&&(T.scroll.x=0);var o=T.scrollvaluemaxw;T.scroll.x>o&&(T.scroll.x=o)}else{T.scroll.y=T.rail.drag.sy+(e.clientY-T.rail.drag.y),T.scroll.y<0&&(T.scroll.y=0);var t=T.scrollvaluemax;T.scroll.y>t&&(T.scroll.y=t)}return T.synched("mousemove",function(){T.cursorfreezed&&(T.showCursor(),T.rail.drag.hr?T.scrollLeft(Math.round(T.scroll.x*T.scrollratio.x)):T.scrollTop(Math.round(T.scroll.y*T.scrollratio.y)))}),T.cancelEvent(e)}T.checkarea=0},N.cantouch||M.emulatetouch)T.onpreventclick=function(e){if(T.preventclick)return T.preventclick.tg.onclick=T.preventclick.click,T.preventclick=!1,T.cancelEvent(e)},T.onclick=!N.isios&&function(e){return!T.lastmouseup||(T.lastmouseup=!1,T.cancelEvent(e))},M.grabcursorenabled&&N.cursorgrabvalue&&(T.css(T.ispage?T.doc:T.win,{cursor:N.cursorgrabvalue}),T.css(T.rail,{cursor:N.cursorgrabvalue}));else{var L=function(e){if(T.selectiondrag){if(e){var o=T.win.outerHeight(),t=e.pageY-T.selectiondrag.top;t>0&&t=o&&(t-=o),T.selectiondrag.df=t}if(0!==T.selectiondrag.df){var r=-2*T.selectiondrag.df/6|0;T.doScrollBy(r),T.debounced("doselectionscroll",function(){L()},50)}}};T.hasTextSelected="getSelection"in l?function(){return l.getSelection().rangeCount>0}:"selection"in l?function(){return"None"!=l.selection.type}:function(){return!1},T.onselectionstart=function(e){T.ispage||(T.selectiondrag=T.win.offset())},T.onselectionend=function(e){T.selectiondrag=!1},T.onselectiondrag=function(e){T.selectiondrag&&T.hasTextSelected()&&T.debounced("selectionscroll",function(){L(e)},250)}}if(N.hasw3ctouch?(T.css(T.ispage?n("html"):T.win,{"touch-action":"none"}),T.css(T.rail,{"touch-action":"none"}),T.css(T.cursor,{"touch-action":"none"}),T.bind(T.win,"pointerdown",T.ontouchstart),T.bind(l,"pointerup",T.ontouchend),T.delegate(l,"pointermove",T.ontouchmove)):N.hasmstouch?(T.css(T.ispage?n("html"):T.win,{"-ms-touch-action":"none"}),T.css(T.rail,{"-ms-touch-action":"none"}),T.css(T.cursor,{"-ms-touch-action":"none"}),T.bind(T.win,"MSPointerDown",T.ontouchstart),T.bind(l,"MSPointerUp",T.ontouchend),T.delegate(l,"MSPointerMove",T.ontouchmove),T.bind(T.cursor,"MSGestureHold",function(e){e.preventDefault()}),T.bind(T.cursor,"contextmenu",function(e){e.preventDefault()})):N.cantouch&&(T.bind(T.win,"touchstart",T.ontouchstart,!1,!0),T.bind(l,"touchend",T.ontouchend,!1,!0),T.bind(l,"touchcancel",T.ontouchend,!1,!0),T.delegate(l,"touchmove",T.ontouchmove,!1,!0)),M.emulatetouch&&(T.bind(T.win,"mousedown",T.ontouchstart,!1,!0),T.bind(l,"mouseup",T.ontouchend,!1,!0),T.bind(l,"mousemove",T.ontouchmove,!1,!0)),(M.cursordragontouch||!N.cantouch&&!M.emulatetouch)&&(T.rail.css({cursor:"default"}),T.railh&&T.railh.css({cursor:"default"}),T.jqbind(T.rail,"mouseenter",function(){if(!T.ispage&&!T.win.is(":visible"))return!1;T.canshowonmouseevent&&T.showCursor(),T.rail.active=!0}),T.jqbind(T.rail,"mouseleave",function(){T.rail.active=!1,T.rail.drag||T.hideCursor()}),M.sensitiverail&&(T.bind(T.rail,"click",function(e){T.doRailClick(e,!1,!1)}),T.bind(T.rail,"dblclick",function(e){T.doRailClick(e,!0,!1)}),T.bind(T.cursor,"click",function(e){T.cancelEvent(e)}),T.bind(T.cursor,"dblclick",function(e){T.cancelEvent(e)})),T.railh&&(T.jqbind(T.railh,"mouseenter",function(){if(!T.ispage&&!T.win.is(":visible"))return!1;T.canshowonmouseevent&&T.showCursor(),T.rail.active=!0}),T.jqbind(T.railh,"mouseleave",function(){T.rail.active=!1,T.rail.drag||T.hideCursor()}),M.sensitiverail&&(T.bind(T.railh,"click",function(e){T.doRailClick(e,!1,!0)}),T.bind(T.railh,"dblclick",function(e){T.doRailClick(e,!0,!0)}),T.bind(T.cursorh,"click",function(e){T.cancelEvent(e)}),T.bind(T.cursorh,"dblclick",function(e){T.cancelEvent(e)})))),M.cursordragontouch&&(this.istouchcapable||N.cantouch)&&(T.bind(T.cursor,"touchstart",T.ontouchstartCursor),T.bind(T.cursor,"touchmove",T.ontouchmoveCursor),T.bind(T.cursor,"touchend",T.ontouchendCursor),T.cursorh&&T.bind(T.cursorh,"touchstart",function(e){T.ontouchstartCursor(e,!0)}),T.cursorh&&T.bind(T.cursorh,"touchmove",T.ontouchmoveCursor),T.cursorh&&T.bind(T.cursorh,"touchend",T.ontouchendCursor)),M.emulatetouch||N.isandroid||N.isios?(T.bind(N.hasmousecapture?T.win:l,"mouseup",T.ontouchend),T.onclick&&T.bind(l,"click",T.onclick),M.cursordragontouch?(T.bind(T.cursor,"mousedown",T.onmousedown),T.bind(T.cursor,"mouseup",T.onmouseup),T.cursorh&&T.bind(T.cursorh,"mousedown",function(e){T.onmousedown(e,!0)}),T.cursorh&&T.bind(T.cursorh,"mouseup",T.onmouseup)):(T.bind(T.rail,"mousedown",function(e){e.preventDefault()}),T.railh&&T.bind(T.railh,"mousedown",function(e){e.preventDefault()}))):(T.bind(N.hasmousecapture?T.win:l,"mouseup",T.onmouseup),T.bind(l,"mousemove",T.onmousemove),T.onclick&&T.bind(l,"click",T.onclick),T.bind(T.cursor,"mousedown",T.onmousedown),T.bind(T.cursor,"mouseup",T.onmouseup),T.railh&&(T.bind(T.cursorh,"mousedown",function(e){T.onmousedown(e,!0)}),T.bind(T.cursorh,"mouseup",T.onmouseup)),!T.ispage&&M.enablescrollonselection&&(T.bind(T.win[0],"mousedown",T.onselectionstart),T.bind(l,"mouseup",T.onselectionend),T.bind(T.cursor,"mouseup",T.onselectionend),T.cursorh&&T.bind(T.cursorh,"mouseup",T.onselectionend),T.bind(l,"mousemove",T.onselectiondrag)),T.zoom&&(T.jqbind(T.zoom,"mouseenter",function(){T.canshowonmouseevent&&T.showCursor(),T.rail.active=!0}),T.jqbind(T.zoom,"mouseleave",function(){T.rail.active=!1,T.rail.drag||T.hideCursor()}))),M.enablemousewheel&&(T.isiframe||T.mousewheel(N.isie&&T.ispage?l:T.win,T.onmousewheel),T.mousewheel(T.rail,T.onmousewheel),T.railh&&T.mousewheel(T.railh,T.onmousewheelhr)),T.ispage||N.cantouch||/HTML|^BODY/.test(T.win[0].nodeName)||(T.win.attr("tabindex")||T.win.attr({tabindex:++r}),T.bind(T.win,"focus",function(e){o=T.getTarget(e).id||T.getTarget(e)||!1,T.hasfocus=!0,T.canshowonmouseevent&&T.noticeCursor()}),T.bind(T.win,"blur",function(e){o=!1,T.hasfocus=!1}),T.bind(T.win,"mouseenter",function(e){t=T.getTarget(e).id||T.getTarget(e)||!1,T.hasmousefocus=!0,T.canshowonmouseevent&&T.noticeCursor()}),T.bind(T.win,"mouseleave",function(e){t=!1,T.hasmousefocus=!1,T.rail.drag||T.hideCursor()})),T.onkeypress=function(e){if(T.railslocked&&0===T.page.maxh)return!0;e=e||a.event;var r=T.getTarget(e);if(r&&/INPUT|TEXTAREA|SELECT|OPTION/.test(r.nodeName)&&(!(r.getAttribute("type")||r.type||!1)||!/submit|button|cancel/i.tp))return!0;if(n(r).attr("contenteditable"))return!0;if(T.hasfocus||T.hasmousefocus&&!o||T.ispage&&!o&&!t){var i=e.keyCode;if(T.railslocked&&27!=i)return T.cancelEvent(e);var s=e.ctrlKey||!1,l=e.shiftKey||!1,c=!1;switch(i){case 38:case 63233:T.doScrollBy(72),c=!0;break;case 40:case 63235:T.doScrollBy(-72),c=!0;break;case 37:case 63232:T.railh&&(s?T.doScrollLeft(0):T.doScrollLeftBy(72),c=!0);break;case 39:case 63234:T.railh&&(s?T.doScrollLeft(T.page.maxw):T.doScrollLeftBy(-72),c=!0);break;case 33:case 63276:T.doScrollBy(T.view.h),c=!0;break;case 34:case 63277:T.doScrollBy(-T.view.h),c=!0;break;case 36:case 63273:T.railh&&s?T.doScrollPos(0,0):T.doScrollTo(0),c=!0;break;case 35:case 63275:T.railh&&s?T.doScrollPos(T.page.maxw,T.page.maxh):T.doScrollTo(T.page.maxh),c=!0;break;case 32:M.spacebarenabled&&(l?T.doScrollBy(T.view.h):T.doScrollBy(-T.view.h),c=!0);break;case 27:T.zoomactive&&(T.doZoom(),c=!0)}if(c)return T.cancelEvent(e)}},M.enablekeyboard&&T.bind(l,N.isopera&&!N.isopera12?"keypress":"keydown",T.onkeypress),T.bind(l,"keydown",function(e){(e.ctrlKey||!1)&&(T.wheelprevented=!0)}),T.bind(l,"keyup",function(e){e.ctrlKey||!1||(T.wheelprevented=!1)}),T.bind(a,"blur",function(e){T.wheelprevented=!1}),T.bind(a,"resize",T.onscreenresize),T.bind(a,"orientationchange",T.onscreenresize),T.bind(a,"load",T.lazyResize),N.ischrome&&!T.ispage&&!T.haswrapper){var C=T.win.attr("style"),P=parseFloat(T.win.css("width"))+1;T.win.css("width",P),T.synched("chromefix",function(){T.win.attr("style",C)})}T.onAttributeChange=function(e){T.lazyResize(T.isieold?250:30)},M.enableobserver&&(T.isie11||!1===m||(T.observerbody=new m(function(e){if(e.forEach(function(e){if("attributes"==e.type)return E.hasClass("modal-open")&&E.hasClass("modal-dialog")&&!n.contains(n(".modal-dialog")[0],T.doc[0])?T.hide():T.show()}),T.me.clientWidth!=T.page.width||T.me.clientHeight!=T.page.height)return T.lazyResize(30)}),T.observerbody.observe(l.body,{childList:!0,subtree:!0,characterData:!1,attributes:!0,attributeFilter:["class"]})),T.ispage||T.haswrapper||(!1!==m?(T.observer=new m(function(e){e.forEach(T.onAttributeChange)}),T.observer.observe(T.win[0],{childList:!0,characterData:!1,attributes:!0,subtree:!1}),T.observerremover=new m(function(e){e.forEach(function(e){if(e.removedNodes.length>0)for(var o in e.removedNodes)if(T&&e.removedNodes[o]==T.win[0])return T.remove()})}),T.observerremover.observe(T.win[0].parentNode,{childList:!0,characterData:!1,attributes:!1,subtree:!1})):(T.bind(T.win,N.isie&&!N.isie9?"propertychange":"DOMAttrModified",T.onAttributeChange),N.isie9&&T.win[0].attachEvent("onpropertychange",T.onAttributeChange),T.bind(T.win,"DOMNodeRemoved",function(e){e.target==T.win[0]&&T.remove()})))),!T.ispage&&M.boxzoom&&T.bind(a,"resize",T.resizeZoom),T.istextarea&&(T.bind(T.win,"keydown",T.lazyResize),T.bind(T.win,"mouseup",T.lazyResize)),T.lazyResize(30)}if("IFRAME"==this.doc[0].nodeName){var R=function(){T.iframexd=!1;var o;try{(o="contentDocument"in this?this.contentDocument:this.contentWindow._doc).domain}catch(e){T.iframexd=!0,o=!1}if(T.iframexd)return"console"in a&&console.log("NiceScroll error: policy restriced iframe"),!0;if(T.forcescreen=!0,T.isiframe&&(T.iframe={doc:n(o),html:T.doc.contents().find("html")[0],body:T.doc.contents().find("body")[0]},T.getContentSize=function(){return{w:Math.max(T.iframe.html.scrollWidth,T.iframe.body.scrollWidth),h:Math.max(T.iframe.html.scrollHeight,T.iframe.body.scrollHeight)}},T.docscroll=n(T.iframe.body)),!N.isios&&M.iframeautoresize&&!T.isiframe){T.win.scrollTop(0),T.doc.height("");var t=Math.max(o.getElementsByTagName("html")[0].scrollHeight,o.body.scrollHeight);T.doc.height(t)}T.lazyResize(30),T.css(n(T.iframe.body),e),N.isios&&T.haswrapper&&T.css(n(o.body),{"-webkit-transform":"translate3d(0,0,0)"}),"contentWindow"in this?T.bind(this.contentWindow,"scroll",T.onscroll):T.bind(o,"scroll",T.onscroll),M.enablemousewheel&&T.mousewheel(o,T.onmousewheel),M.enablekeyboard&&T.bind(o,N.isopera?"keypress":"keydown",T.onkeypress),N.cantouch?(T.bind(o,"touchstart",T.ontouchstart),T.bind(o,"touchmove",T.ontouchmove)):M.emulatetouch&&(T.bind(o,"mousedown",T.ontouchstart),T.bind(o,"mousemove",function(e){return T.ontouchmove(e,!0)}),M.grabcursorenabled&&N.cursorgrabvalue&&T.css(n(o.body),{cursor:N.cursorgrabvalue})),T.bind(o,"mouseup",T.ontouchend),T.zoom&&(M.dblclickzoom&&T.bind(o,"dblclick",T.doZoom),T.ongesturezoom&&T.bind(o,"gestureend",T.ongesturezoom))};this.doc[0].readyState&&"complete"===this.doc[0].readyState&&setTimeout(function(){R.call(T.doc[0],!1)},500),T.bind(this.doc,"load",R)}},this.showCursor=function(e,o){if(T.cursortimeout&&(clearTimeout(T.cursortimeout),T.cursortimeout=0),T.rail){if(T.autohidedom&&(T.autohidedom.stop().css({opacity:M.cursoropacitymax}),T.cursoractive=!0),T.rail.drag&&1==T.rail.drag.pt||(void 0!==e&&!1!==e&&(T.scroll.y=e/T.scrollratio.y|0),void 0!==o&&(T.scroll.x=o/T.scrollratio.x|0)),T.cursor.css({height:T.cursorheight,top:T.scroll.y}),T.cursorh){var t=T.hasreversehr?T.scrollvaluemaxw-T.scroll.x:T.scroll.x;T.cursorh.css({width:T.cursorwidth,left:!T.rail.align&&T.rail.visibility?t+T.rail.width:t}),T.cursoractive=!0}T.zoom&&T.zoom.stop().css({opacity:M.cursoropacitymax})}},this.hideCursor=function(e){T.cursortimeout||T.rail&&T.autohidedom&&(T.hasmousefocus&&"leave"===M.autohidemode||(T.cursortimeout=setTimeout(function(){T.rail.active&&T.showonmouseevent||(T.autohidedom.stop().animate({opacity:M.cursoropacitymin}),T.zoom&&T.zoom.stop().animate({opacity:M.cursoropacitymin}),T.cursoractive=!1),T.cursortimeout=0},e||M.hidecursordelay)))},this.noticeCursor=function(e,o,t){T.showCursor(o,t),T.rail.active||T.hideCursor(e)},this.getContentSize=T.ispage?function(){return{w:Math.max(l.body.scrollWidth,l.documentElement.scrollWidth),h:Math.max(l.body.scrollHeight,l.documentElement.scrollHeight)}}:T.haswrapper?function(){return{w:T.doc[0].offsetWidth,h:T.doc[0].offsetHeight}}:function(){return{w:T.docscroll[0].scrollWidth,h:T.docscroll[0].scrollHeight}},this.onResize=function(e,o){if(!T||!T.win)return!1;var t=T.page.maxh,r=T.page.maxw,i=T.view.h,s=T.view.w;if(T.view={w:T.ispage?T.win.width():T.win[0].clientWidth,h:T.ispage?T.win.height():T.win[0].clientHeight},T.page=o||T.getContentSize(),T.page.maxh=Math.max(0,T.page.h-T.view.h),T.page.maxw=Math.max(0,T.page.w-T.view.w),T.page.maxh==t&&T.page.maxw==r&&T.view.w==s&&T.view.h==i){if(T.ispage)return T;var n=T.win.offset();if(T.lastposition){var l=T.lastposition;if(l.top==n.top&&l.left==n.left)return T}T.lastposition=n}return 0===T.page.maxh?(T.hideRail(),T.scrollvaluemax=0,T.scroll.y=0,T.scrollratio.y=0,T.cursorheight=0,T.setScrollTop(0),T.rail&&(T.rail.scrollable=!1)):(T.page.maxh-=M.railpadding.top+M.railpadding.bottom,T.rail.scrollable=!0),0===T.page.maxw?(T.hideRailHr(),T.scrollvaluemaxw=0,T.scroll.x=0,T.scrollratio.x=0,T.cursorwidth=0,T.setScrollLeft(0),T.railh&&(T.railh.scrollable=!1)):(T.page.maxw-=M.railpadding.left+M.railpadding.right,T.railh&&(T.railh.scrollable=M.horizrailenabled)),T.railslocked=T.locked||0===T.page.maxh&&0===T.page.maxw,T.railslocked?(T.ispage||T.updateScrollBar(T.view),!1):(T.hidden||(T.rail.visibility||T.showRail(),T.railh&&!T.railh.visibility&&T.showRailHr()),T.istextarea&&T.win.css("resize")&&"none"!=T.win.css("resize")&&(T.view.h-=20),T.cursorheight=Math.min(T.view.h,Math.round(T.view.h*(T.view.h/T.page.h))),T.cursorheight=M.cursorfixedheight?M.cursorfixedheight:Math.max(M.cursorminheight,T.cursorheight),T.cursorwidth=Math.min(T.view.w,Math.round(T.view.w*(T.view.w/T.page.w))),T.cursorwidth=M.cursorfixedheight?M.cursorfixedheight:Math.max(M.cursorminheight,T.cursorwidth),T.scrollvaluemax=T.view.h-T.cursorheight-(M.railpadding.top+M.railpadding.bottom),T.hasborderbox||(T.scrollvaluemax-=T.cursor[0].offsetHeight-T.cursor[0].clientHeight),T.railh&&(T.railh.width=T.page.maxh>0?T.view.w-T.rail.width:T.view.w,T.scrollvaluemaxw=T.railh.width-T.cursorwidth-(M.railpadding.left+M.railpadding.right)),T.ispage||T.updateScrollBar(T.view),T.scrollratio={x:T.page.maxw/T.scrollvaluemaxw,y:T.page.maxh/T.scrollvaluemax},T.getScrollTop()>T.page.maxh?T.doScrollTop(T.page.maxh):(T.scroll.y=T.getScrollTop()/T.scrollratio.y|0,T.scroll.x=T.getScrollLeft()/T.scrollratio.x|0,T.cursoractive&&T.noticeCursor()),T.scroll.y&&0===T.getScrollTop()&&T.doScrollTo(T.scroll.y*T.scrollratio.y|0),T)},this.resize=T.onResize;var O=0;this.onscreenresize=function(e){clearTimeout(O);var o=!T.ispage&&!T.haswrapper;o&&T.hideRails(),O=setTimeout(function(){T&&(o&&T.showRails(),T.resize()),O=0},120)},this.lazyResize=function(e){return clearTimeout(O),O=setTimeout(function(){T&&T.resize(),O=0},e||240),T},this.jqbind=function(e,o,t){T.events.push({e:e,n:o,f:t,q:!0}),n(e).on(o,t)},this.mousewheel=function(e,o,t){var r="jquery"in e?e[0]:e;if("onwheel"in l.createElement("div"))T._bind(r,"wheel",o,t||!1);else{var i=void 0!==l.onmousewheel?"mousewheel":"DOMMouseScroll";S(r,i,o,t||!1),"DOMMouseScroll"==i&&S(r,"MozMousePixelScroll",o,t||!1)}};var Y=!1;if(N.haseventlistener){try{var H=Object.defineProperty({},"passive",{get:function(){Y=!0}});a.addEventListener("test",null,H)}catch(e){}this.stopPropagation=function(e){return!!e&&((e=e.original?e.original:e).stopPropagation(),!1)},this.cancelEvent=function(e){return e.cancelable&&e.preventDefault(),e.stopImmediatePropagation(),e.preventManipulation&&e.preventManipulation(),!1}}else Event.prototype.preventDefault=function(){this.returnValue=!1},Event.prototype.stopPropagation=function(){this.cancelBubble=!0},a.constructor.prototype.addEventListener=l.constructor.prototype.addEventListener=Element.prototype.addEventListener=function(e,o,t){this.attachEvent("on"+e,o)},a.constructor.prototype.removeEventListener=l.constructor.prototype.removeEventListener=Element.prototype.removeEventListener=function(e,o,t){this.detachEvent("on"+e,o)},this.cancelEvent=function(e){return(e=e||a.event)&&(e.cancelBubble=!0,e.cancel=!0,e.returnValue=!1),!1},this.stopPropagation=function(e){return(e=e||a.event)&&(e.cancelBubble=!0),!1};this.delegate=function(e,o,t,r,i){var s=d[o]||!1;s||(s={a:[],l:[],f:function(e){for(var o=s.l,t=!1,r=o.length-1;r>=0;r--)if(!1===(t=o[r].call(e.target,e)))return!1;return t}},T.bind(e,o,s.f,r,i),d[o]=s),T.ispage?(s.a=[T.id].concat(s.a),s.l=[t].concat(s.l)):(s.a.push(T.id),s.l.push(t))},this.undelegate=function(e,o,t,r,i){var s=d[o]||!1;if(s)for(var n=0,l=s.l.length;n0)return t;o=!!o.parentNode&&o.parentNode}return!1},this.triggerScrollStart=function(e,o,t,r,i){if(T.onscrollstart){var s={type:"scrollstart",current:{x:e,y:o},request:{x:t,y:r},end:{x:T.newscrollx,y:T.newscrolly},speed:i};T.onscrollstart.call(T,s)}},this.triggerScrollEnd=function(){if(T.onscrollend){var e=T.getScrollLeft(),o=T.getScrollTop(),t={type:"scrollend",current:{x:e,y:o},end:{x:e,y:o}};T.onscrollend.call(T,t)}};var B=0,X=0,D=0,A=1,q=!1;if(this.onmousewheel=function(e){if(T.wheelprevented||T.locked)return!1;if(T.railslocked)return T.debounced("checkunlock",T.resize,250),!1;if(T.rail.drag)return T.cancelEvent(e);if("auto"===M.oneaxismousemode&&0!==e.deltaX&&(M.oneaxismousemode=!1),M.oneaxismousemode&&0===e.deltaX&&!T.rail.scrollable)return!T.railh||!T.railh.scrollable||T.onmousewheelhr(e);var o=f(),t=!1;if(M.preservenativescrolling&&T.checkarea+600T.page.maxh&&(o=T.page.maxh+(o-T.page.maxh)/2|0),e<0?e=e/2|0:e>T.page.maxw&&(e=T.page.maxw+(e-T.page.maxw)/2|0)):(o<0?o=0:o>T.page.maxh&&(o=T.page.maxh),e<0?e=0:e>T.page.maxw&&(e=T.page.maxw)),T.scrollrunning&&e==T.newscrollx&&o==T.newscrolly)return!1;T.newscrolly=o,T.newscrollx=e;var s=T.getScrollTop(),n=T.getScrollLeft(),l={};l.x=e-n,l.y=o-s;var a=0|Math.sqrt(l.x*l.x+l.y*l.y),c=T.prepareTransition(a);T.scrollrunning||(T.scrollrunning=!0,T.triggerScrollStart(n,s,e,o,c),T.cursorupdate.start()),T.scrollendtrapped=!0,N.transitionend||(T.scrollendtrapped&&clearTimeout(T.scrollendtrapped),T.scrollendtrapped=setTimeout(T.onScrollTransitionEnd,c)),T.setScrollTop(T.newscrolly),T.setScrollLeft(T.newscrollx)},this.cancelScroll=function(){if(!T.scrollendtrapped)return!0;var e=T.getScrollTop(),o=T.getScrollLeft();return T.scrollrunning=!1,N.transitionend||clearTimeout(N.transitionend),T.scrollendtrapped=!1,T.resetTransition(),T.setScrollTop(e),T.railh&&T.setScrollLeft(o),T.timerscroll&&T.timerscroll.tm&&clearInterval(T.timerscroll.tm),T.timerscroll=!1,T.cursorfreezed=!1,T.cursorupdate.stop(),T.showCursor(e,o),T},this.onScrollTransitionEnd=function(){if(T.scrollendtrapped){var e=T.getScrollTop(),o=T.getScrollLeft();if(e<0?e=0:e>T.page.maxh&&(e=T.page.maxh),o<0?o=0:o>T.page.maxw&&(o=T.page.maxw),e!=T.newscrolly||o!=T.newscrollx)return T.doScrollPos(o,e,M.snapbackspeed);T.scrollrunning&&T.triggerScrollEnd(),T.scrollrunning=!1,T.scrollendtrapped=!1,T.resetTransition(),T.timerscroll=!1,T.setScrollTop(e),T.railh&&T.setScrollLeft(o),T.cursorupdate.stop(),T.noticeCursor(!1,e,o),T.cursorfreezed=!1}}}else this.doScrollLeft=function(e,o){var t=T.scrollrunning?T.newscrolly:T.getScrollTop();T.doScrollPos(e,t,o)},this.doScrollTop=function(e,o){var t=T.scrollrunning?T.newscrollx:T.getScrollLeft();T.doScrollPos(t,e,o)},this.doScrollPos=function(e,o,t){var r=T.getScrollTop(),i=T.getScrollLeft();((T.newscrolly-r)*(o-r)<0||(T.newscrollx-i)*(e-i)<0)&&T.cancelScroll();var s=!1;if(T.bouncescroll&&T.rail.visibility||(o<0?(o=0,s=!0):o>T.page.maxh&&(o=T.page.maxh,s=!0)),T.bouncescroll&&T.railh.visibility||(e<0?(e=0,s=!0):e>T.page.maxw&&(e=T.page.maxw,s=!0)),T.scrollrunning&&T.newscrolly===o&&T.newscrollx===e)return!0;T.newscrolly=o,T.newscrollx=e,T.dst={},T.dst.x=e-i,T.dst.y=o-r,T.dst.px=i,T.dst.py=r;var n=0|Math.sqrt(T.dst.x*T.dst.x+T.dst.y*T.dst.y),l=T.getTransitionSpeed(n);T.bzscroll={};var a=s?1:.58;T.bzscroll.x=new R(i,T.newscrollx,l,0,0,a,1),T.bzscroll.y=new R(r,T.newscrolly,l,0,0,a,1);f();var c=function(){if(T.scrollrunning){var e=T.bzscroll.y.getPos();T.setScrollLeft(T.bzscroll.x.getNow()),T.setScrollTop(T.bzscroll.y.getNow()),e<=1?T.timer=u(c):(T.scrollrunning=!1,T.timer=0,T.triggerScrollEnd())}};T.scrollrunning||(T.triggerScrollStart(i,r,e,o,l),T.scrollrunning=!0,T.timer=u(c))},this.cancelScroll=function(){return T.timer&&h(T.timer),T.timer=0,T.bzscroll=!1,T.scrollrunning=!1,T};else this.doScrollLeft=function(e,o){var t=T.getScrollTop();T.doScrollPos(e,t,o)},this.doScrollTop=function(e,o){var t=T.getScrollLeft();T.doScrollPos(t,e,o)},this.doScrollPos=function(e,o,t){var r=e>T.page.maxw?T.page.maxw:e;r<0&&(r=0);var i=o>T.page.maxh?T.page.maxh:o;i<0&&(i=0),T.synched("scroll",function(){T.setScrollTop(i),T.setScrollLeft(r)})},this.cancelScroll=function(){};this.doScrollBy=function(e,o){z(0,e)},this.doScrollLeftBy=function(e,o){z(e,0)},this.doScrollTo=function(e,o){var t=o?Math.round(e*T.scrollratio.y):e;t<0?t=0:t>T.page.maxh&&(t=T.page.maxh),T.cursorfreezed=!1,T.doScrollTop(e)},this.checkContentSize=function(){var e=T.getContentSize();e.h==T.page.h&&e.w==T.page.w||T.resize(!1,e)},T.onscroll=function(e){T.rail.drag||T.cursorfreezed||T.synched("scroll",function(){T.scroll.y=Math.round(T.getScrollTop()/T.scrollratio.y),T.railh&&(T.scroll.x=Math.round(T.getScrollLeft()/T.scrollratio.x)),T.noticeCursor()})},T.bind(T.docscroll,"scroll",T.onscroll),this.doZoomIn=function(e){if(!T.zoomactive){T.zoomactive=!0,T.zoomrestore={style:{}};var o=["position","top","left","zIndex","backgroundColor","marginTop","marginBottom","marginLeft","marginRight"],t=T.win[0].style;for(var r in o){var i=o[r];T.zoomrestore.style[i]=void 0!==t[i]?t[i]:""}T.zoomrestore.style.width=T.win.css("width"),T.zoomrestore.style.height=T.win.css("height"),T.zoomrestore.padding={w:T.win.outerWidth()-T.win.width(),h:T.win.outerHeight()-T.win.height()},N.isios4&&(T.zoomrestore.scrollTop=c.scrollTop(),c.scrollTop(0)),T.win.css({position:N.isios4?"absolute":"fixed",top:0,left:0,zIndex:s+100,margin:0});var n=T.win.css("backgroundColor");return(""===n||/transparent|rgba\(0, 0, 0, 0\)|rgba\(0,0,0,0\)/.test(n))&&T.win.css("backgroundColor","#fff"),T.rail.css({zIndex:s+101}),T.zoom.css({zIndex:s+102}),T.zoom.css("backgroundPosition","0 -18px"),T.resizeZoom(),T.onzoomin&&T.onzoomin.call(T),T.cancelEvent(e)}},this.doZoomOut=function(e){if(T.zoomactive)return T.zoomactive=!1,T.win.css("margin",""),T.win.css(T.zoomrestore.style),N.isios4&&c.scrollTop(T.zoomrestore.scrollTop),T.rail.css({"z-index":T.zindex}),T.zoom.css({"z-index":T.zindex}),T.zoomrestore=!1,T.zoom.css("backgroundPosition","0 0"),T.onResize(),T.onzoomout&&T.onzoomout.call(T),T.cancelEvent(e)},this.doZoom=function(e){return T.zoomactive?T.doZoomOut(e):T.doZoomIn(e)},this.resizeZoom=function(){if(T.zoomactive){var e=T.getScrollTop();T.win.css({width:c.width()-T.zoomrestore.padding.w+"px",height:c.height()-T.zoomrestore.padding.h+"px"}),T.onResize(),T.setScrollTop(Math.min(T.page.maxh,e))}},this.init(),n.nicescroll.push(this)},y=function(e){var o=this;this.nc=e,this.lastx=0,this.lasty=0,this.speedx=0,this.speedy=0,this.lasttime=0,this.steptime=0,this.snapx=!1,this.snapy=!1,this.demulx=0,this.demuly=0,this.lastscrollx=-1,this.lastscrolly=-1,this.chkx=0,this.chky=0,this.timer=0,this.reset=function(e,t){o.stop(),o.steptime=0,o.lasttime=f(),o.speedx=0,o.speedy=0,o.lastx=e,o.lasty=t,o.lastscrollx=-1,o.lastscrolly=-1},this.update=function(e,t){var r=f();o.steptime=r-o.lasttime,o.lasttime=r;var i=t-o.lasty,s=e-o.lastx,n=o.nc.getScrollTop()+i,l=o.nc.getScrollLeft()+s;o.snapx=l<0||l>o.nc.page.maxw,o.snapy=n<0||n>o.nc.page.maxh,o.speedx=s,o.speedy=i,o.lastx=e,o.lasty=t},this.stop=function(){o.nc.unsynched("domomentum2d"),o.timer&&clearTimeout(o.timer),o.timer=0,o.lastscrollx=-1,o.lastscrolly=-1},this.doSnapy=function(e,t){var r=!1;t<0?(t=0,r=!0):t>o.nc.page.maxh&&(t=o.nc.page.maxh,r=!0),e<0?(e=0,r=!0):e>o.nc.page.maxw&&(e=o.nc.page.maxw,r=!0),r?o.nc.doScrollPos(e,t,o.nc.opt.snapbackspeed):o.nc.triggerScrollEnd()},this.doMomentum=function(e){var t=f(),r=e?t+e:o.lasttime,i=o.nc.getScrollLeft(),s=o.nc.getScrollTop(),n=o.nc.page.maxh,l=o.nc.page.maxw;o.speedx=l>0?Math.min(60,o.speedx):0,o.speedy=n>0?Math.min(60,o.speedy):0;var a=r&&t-r<=60;(s<0||s>n||i<0||i>l)&&(a=!1);var c=!(!o.speedy||!a)&&o.speedy,d=!(!o.speedx||!a)&&o.speedx;if(c||d){var u=Math.max(16,o.steptime);if(u>50){var h=u/50;o.speedx*=h,o.speedy*=h,u=50}o.demulxy=0,o.lastscrollx=o.nc.getScrollLeft(),o.chkx=o.lastscrollx,o.lastscrolly=o.nc.getScrollTop(),o.chky=o.lastscrolly;var p=o.lastscrollx,m=o.lastscrolly,g=function(){var e=f()-t>600?.04:.02;o.speedx&&(p=Math.floor(o.lastscrollx-o.speedx*(1-o.demulxy)),o.lastscrollx=p,(p<0||p>l)&&(e=.1)),o.speedy&&(m=Math.floor(o.lastscrolly-o.speedy*(1-o.demulxy)),o.lastscrolly=m,(m<0||m>n)&&(e=.1)),o.demulxy=Math.min(1,o.demulxy+e),o.nc.synched("domomentum2d",function(){if(o.speedx){o.nc.getScrollLeft();o.chkx=p,o.nc.setScrollLeft(p)}if(o.speedy){o.nc.getScrollTop();o.chky=m,o.nc.setScrollTop(m)}o.timer||(o.nc.hideCursor(),o.doSnapy(p,m))}),o.demulxy<1?o.timer=setTimeout(g,u):(o.stop(),o.nc.hideCursor(),o.doSnapy(p,m))};g()}else o.doSnapy(o.nc.getScrollLeft(),o.nc.getScrollTop())}},x=e.fn.scrollTop;e.cssHooks.pageYOffset={get:function(e,o,t){var r=n.data(e,"__nicescroll")||!1;return r&&r.ishwscroll?r.getScrollTop():x.call(e)},set:function(e,o){var t=n.data(e,"__nicescroll")||!1;return t&&t.ishwscroll?t.setScrollTop(parseInt(o)):x.call(e,o),this}},e.fn.scrollTop=function(e){if(void 0===e){var o=!!this[0]&&(n.data(this[0],"__nicescroll")||!1);return o&&o.ishwscroll?o.getScrollTop():x.call(this)}return this.each(function(){var o=n.data(this,"__nicescroll")||!1;o&&o.ishwscroll?o.setScrollTop(parseInt(e)):x.call(n(this),e)})};var S=e.fn.scrollLeft;n.cssHooks.pageXOffset={get:function(e,o,t){var r=n.data(e,"__nicescroll")||!1;return r&&r.ishwscroll?r.getScrollLeft():S.call(e)},set:function(e,o){var t=n.data(e,"__nicescroll")||!1;return t&&t.ishwscroll?t.setScrollLeft(parseInt(o)):S.call(e,o),this}},e.fn.scrollLeft=function(e){if(void 0===e){var o=!!this[0]&&(n.data(this[0],"__nicescroll")||!1);return o&&o.ishwscroll?o.getScrollLeft():S.call(this)}return this.each(function(){var o=n.data(this,"__nicescroll")||!1;o&&o.ishwscroll?o.setScrollLeft(parseInt(e)):S.call(n(this),e)})};var z=function(e){var o=this;if(this.length=0,this.name="nicescrollarray",this.each=function(e){return n.each(o,e),o},this.push=function(e){o[o.length]=e,o.length++},this.eq=function(e){return o[e]},e)for(var t=0;t1?n(e,r):s,i.win=r}!("doc"in i)||"win"in i||(i.win=r);var l=r.data("__nicescroll")||!1;l||(i.doc=i.doc||r,l=new b(i,r),r.data("__nicescroll",l)),t.push(l)}),1===t.length?t[0]:t},a.NiceScroll={getjQuery:function(){return e}},n.nicescroll||(n.nicescroll=new z,n.nicescroll.options=g)}); \ No newline at end of file From 3232047a3ffa22a6442e78b876f324da9647a214 Mon Sep 17 00:00:00 2001 From: InuYaksa Date: Mon, 10 Jul 2017 12:32:32 +0200 Subject: [PATCH 11/14] 3.7.5-c [DEV] Fixes - Calling .remove() throws an error after update to v. 3.7.4 #681 - more robust hybrid system support mouse + touch events aka no drag and scroll #676 - typos on navigator.maxTouchPoints Changes - remove outdated self.visibility --- changelog_3.7.5.txt | 1 + jquery.nicescroll.js | 6 +++--- jquery.nicescroll.min.js | 4 ++-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/changelog_3.7.5.txt b/changelog_3.7.5.txt index 66d01ec..8a395bd 100644 --- a/changelog_3.7.5.txt +++ b/changelog_3.7.5.txt @@ -7,6 +7,7 @@ https://github.com/inuyaksa/jquery.nicescroll Fixes - Calling .remove() throws an error after update to v. 3.7.4 #681 - more robust hybrid system support mouse + touch events aka no drag and scroll #676 +- typos on navigator.maxTouchPoints Changes - remove outdated self.visibility \ No newline at end of file diff --git a/jquery.nicescroll.js b/jquery.nicescroll.js index 3510e9e..90dbd1e 100644 --- a/jquery.nicescroll.js +++ b/jquery.nicescroll.js @@ -1,5 +1,5 @@ /* jquery.nicescroll --- version 3.7.5-b +-- version 3.7.5-c -- copyright 2017-07-02 InuYaksa*2017 -- licensed under the MIT -- @@ -171,7 +171,7 @@ d.ischrome26 = (!d.ischrome38) && (d.ischrome && ("transition" in _style)); // issue with transform detection (maintain prefix) d.cantouch = ("ontouchstart" in _doc.documentElement) || ("ontouchstart" in _win); // with detection for Chrome Touch Emulation - d.hasw3ctouch = (_win.PointerEvent || false) && ((navigator.MaxTouchPoints > 0) || (navigator.msMaxTouchPoints > 0)); //IE11 pointer events, following W3C Pointer Events spec + d.hasw3ctouch = (_win.PointerEvent || false) && ((navigator.maxTouchPoints > 0) || (navigator.msMaxTouchPoints > 0)); //IE11 pointer events, following W3C Pointer Events spec d.hasmstouch = (!d.hasw3ctouch) && (_win.MSPointerEvent || false); // IE10 pointer events d.ismac = /^mac$/i.test(_platform); @@ -261,7 +261,7 @@ var self = this; - this.version = '3.7.5-b'; + this.version = '3.7.5-c'; this.name = 'nicescroll'; this.me = me; diff --git a/jquery.nicescroll.min.js b/jquery.nicescroll.min.js index b96602c..4cc30a2 100644 --- a/jquery.nicescroll.min.js +++ b/jquery.nicescroll.min.js @@ -1,2 +1,2 @@ -/* jquery.nicescroll v 3.7.5-b [DEV REL] - InuYaksa*2017 - MIT - https://nicescroll.areaaperta.com/ */ -!function(e){"function"==typeof define&&define.amd?define(["jquery"],e):"object"==typeof exports?module.exports=e(require("jquery")):e(jQuery)}(function(e){"use strict";var o=!1,t=!1,r=0,i=2e3,s=0,n=e,l=document,a=window,c=n(a),d=[],u=a.requestAnimationFrame||a.webkitRequestAnimationFrame||a.mozRequestAnimationFrame||!1,h=a.cancelAnimationFrame||a.webkitCancelAnimationFrame||a.mozCancelAnimationFrame||!1;if(u)a.cancelAnimationFrame||(h=function(e){});else{var p=0;u=function(e,o){var t=(new Date).getTime(),r=Math.max(0,16-(t-p)),i=a.setTimeout(function(){e(t+r)},r);return p=t+r,i},h=function(e){a.clearTimeout(e)}}var m=a.MutationObserver||a.WebKitMutationObserver||!1,f=Date.now||function(){return(new Date).getTime()},g={zindex:"auto",cursoropacitymin:0,cursoropacitymax:1,cursorcolor:"#424242",cursorwidth:"6px",cursorborder:"1px solid #fff",cursorborderradius:"5px",scrollspeed:40,mousescrollstep:27,touchbehavior:!1,emulatetouch:!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 e=l.currentScript||function(){var e=l.getElementsByTagName("script");return!!e.length&&e[e.length-1]}(),o=e?e.src.split("?")[0]:"";return o.split("/").length>0?o.split("/").slice(0,-1).join("/")+"/":""}(),preventmultitouchscrolling:!0,disablemutationobserver:!1,enableobserver:!0,scrollbarid:!1},v=!1,w=function(){if(v)return v;var e=l.createElement("DIV"),o=e.style,t=navigator.userAgent,r=navigator.platform,i={};return i.haspointerlock="pointerLockElement"in l||"webkitPointerLockElement"in l||"mozPointerLockElement"in l,i.isopera="opera"in a,i.isopera12=i.isopera&&"getUserMedia"in navigator,i.isoperamini="[object OperaMini]"===Object.prototype.toString.call(a.operamini),i.isie="all"in l&&"attachEvent"in e&&!i.isopera,i.isieold=i.isie&&!("msInterpolationMode"in o),i.isie7=i.isie&&!i.isieold&&(!("documentMode"in l)||7===l.documentMode),i.isie8=i.isie&&"documentMode"in l&&8===l.documentMode,i.isie9=i.isie&&"performance"in a&&9===l.documentMode,i.isie10=i.isie&&"performance"in a&&10===l.documentMode,i.isie11="msRequestFullscreen"in e&&l.documentMode>=11,i.ismsedge="msCredentials"in a,i.ismozilla="MozAppearance"in o,i.iswebkit=!i.ismsedge&&"WebkitAppearance"in o,i.ischrome=i.iswebkit&&"chrome"in a,i.ischrome38=i.ischrome&&"touchAction"in o,i.ischrome22=!i.ischrome38&&i.ischrome&&i.haspointerlock,i.ischrome26=!i.ischrome38&&i.ischrome&&"transition"in o,i.cantouch="ontouchstart"in l.documentElement||"ontouchstart"in a,i.hasw3ctouch=(a.PointerEvent||!1)&&(navigator.MaxTouchPoints>0||navigator.msMaxTouchPoints>0),i.hasmstouch=!i.hasw3ctouch&&(a.MSPointerEvent||!1),i.ismac=/^mac$/i.test(r),i.isios=i.cantouch&&/iphone|ipad|ipod/i.test(r),i.isios4=i.isios&&!("seal"in Object),i.isios7=i.isios&&"webkitHidden"in l,i.isios8=i.isios&&"hidden"in l,i.isios10=i.isios&&a.Proxy,i.isandroid=/android/i.test(t),i.haseventlistener="addEventListener"in e,i.trstyle=!1,i.hastransform=!1,i.hastranslate3d=!1,i.transitionstyle=!1,i.hastransition=!1,i.transitionend=!1,i.trstyle="transform",i.hastransform="transform"in o||function(){for(var e=["msTransform","webkitTransform","MozTransform","OTransform"],t=0,r=e.length;t0;){if(9==e[0].nodeType)return!1;var o=e.css("zIndex");if(!isNaN(o)&&0!==o)return parseInt(o);e=e.parent()}return!1}function x(e,o,t){var r=e.css(o),i=parseFloat(r);if(isNaN(i)){var s=3==(i=I[r]||0)?t?T.win.outerHeight()-T.win.innerHeight():T.win.outerWidth()-T.win.innerWidth():1;return T.isie8&&i&&(i+=1),s?i:0}return i}function S(e,o,t,r){T._bind(e,o,function(r){var i={original:r=r||a.event,target:r.target||r.srcElement,type:"wheel",deltaMode:"MozMousePixelScroll"==r.type?0:1,deltaX:0,deltaZ:0,preventDefault:function(){return r.preventDefault?r.preventDefault():r.returnValue=!1,!1},stopImmediatePropagation:function(){r.stopImmediatePropagation?r.stopImmediatePropagation():r.cancelBubble=!0}};return"mousewheel"==o?(r.wheelDeltaX&&(i.deltaX=-.025*r.wheelDeltaX),r.wheelDeltaY&&(i.deltaY=-.025*r.wheelDeltaY),!i.deltaY&&!i.deltaX&&(i.deltaY=-.025*r.wheelDelta)):i.deltaY=r.detail,t.call(e,i)},r)}function z(e,o,t,r){T.scrollrunning||(T.newscrolly=T.getScrollTop(),T.newscrollx=T.getScrollLeft(),D=f());var i=f()-D;if(D=f(),i>350?A=1:A+=(2-A)/10,e=e*A|0,o=o*A|0,e){if(r)if(e<0){if(T.getScrollLeft()>=T.page.maxw)return!0}else if(T.getScrollLeft()<=0)return!0;var s=e>0?1:-1;X!==s&&(T.scrollmom&&T.scrollmom.stop(),T.newscrollx=T.getScrollLeft(),X=s),T.lastdeltax-=e}if(o){if(function(){var e=T.getScrollTop();if(o<0){if(e>=T.page.maxh)return!0}else if(e<=0)return!0}()){if(M.nativeparentscrolling&&t&&!T.ispage&&!T.zoomactive)return!0;var n=T.view.h>>1;T.newscrolly<-n?(T.newscrolly=-n,o=-1):T.newscrolly>T.page.maxh+n?(T.newscrolly=T.page.maxh+n,o=1):o=0}var l=o>0?1:-1;B!==l&&(T.scrollmom&&T.scrollmom.stop(),T.newscrolly=T.getScrollTop(),B=l),T.lastdeltay-=o}(o||e)&&T.synched("relativexy",function(){var e=T.lastdeltay+T.newscrolly;T.lastdeltay=0;var o=T.lastdeltax+T.newscrollx;T.lastdeltax=0,T.rail.drag||T.doScrollPos(o,e)})}function k(e,o,t){var r,i;return!(t||!q)||(0===e.deltaMode?(r=-e.deltaX*(M.mousescrollstep/54)|0,i=-e.deltaY*(M.mousescrollstep/54)|0):1===e.deltaMode&&(r=-e.deltaX*M.mousescrollstep*50/80|0,i=-e.deltaY*M.mousescrollstep*50/80|0),o&&M.oneaxismousemode&&0===r&&i&&(r=i,i=0,t&&(r<0?T.getScrollLeft()>=T.page.maxw:T.getScrollLeft()<=0)&&(i=r,r=0)),T.isrtlmode&&(r=-r),z(r,i,t,!0)?void(t&&(q=!0)):(q=!1,e.stopImmediatePropagation(),e.preventDefault()))}var T=this;this.version="3.7.5-b",this.name="nicescroll",this.me=p;var E=n("body"),M=this.opt={doc:E,win:!1};if(n.extend(M,g),M.snapbackspeed=80,e)for(var L in M)void 0!==e[L]&&(M[L]=e[L]);if(M.disablemutationobserver&&(m=!1),this.doc=M.doc,this.iddoc=this.doc&&this.doc[0]?this.doc[0].id||"":"",this.ispage=/^BODY|HTML/.test(M.win?M.win[0].nodeName:this.doc[0].nodeName),this.haswrapper=!1!==M.win,this.win=M.win||(this.ispage?c:this.doc),this.docscroll=this.ispage&&!this.haswrapper?c:this.win,this.body=E,this.viewport=!1,this.isfixed=!1,this.iframe=!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"!=M.autohidemode,this.onmousedown=!1,this.onmouseup=!1,this.onmousemove=!1,this.onmousewheel=!1,this.onkeypress=!1,this.ongesturezoom=!1,this.onclick=!1,this.onscrollstart=!1,this.onscrollend=!1,this.onscrollcancel=!1,this.onzoomin=!1,this.onzoomout=!1,this.view=!1,this.page=!1,this.scroll={x:0,y:0},this.scrollratio={x:0,y:0},this.cursorheight=20,this.scrollvaluemax=0,"auto"==M.rtlmode){var C=this.win[0]==a?this.body:this.win,P=C.css("writing-mode")||C.css("-webkit-writing-mode")||C.css("-ms-writing-mode")||C.css("-moz-writing-mode");"horizontal-tb"==P||"lr-tb"==P||""===P?(this.isrtlmode="rtl"==C.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===M.rtlmode,this.isvertical=!1;if(this.scrollrunning=!1,this.scrollmom=!1,this.observer=!1,this.observerremover=!1,this.observerbody=!1,!1!==M.scrollbarid)this.id=M.scrollbarid;else do{this.id="ascrail"+i++}while(l.getElementById(this.id));this.rail=!1,this.cursor=!1,this.cursorfreezed=!1,this.selectiondrag=!1,this.zoom=!1,this.zoomactive=!1,this.hasfocus=!1,this.hasmousefocus=!1,this.railslocked=!1,this.locked=!1,this.hidden=!1,this.cursoractive=!0,this.wheelprevented=!1,this.overflowx=M.overflowx,this.overflowy=M.overflowy,this.nativescrollingarea=!1,this.checkarea=0,this.events=[],this.saved={},this.delaylist={},this.synclist={},this.lastdeltax=0,this.lastdeltay=0,this.detected=w();var N=n.extend({},this.detected);this.canhwscroll=N.hastransform&&M.hwacceleration,this.ishwscroll=this.canhwscroll&&T.haswrapper,this.isrtlmode?this.isvertical?this.hasreversehr=!(N.iswebkit||N.isie||N.isie11):this.hasreversehr=!(N.iswebkit||N.isie&&!N.isie10&&!N.isie11):this.hasreversehr=!1,this.istouchcapable=!1,N.cantouch||!N.hasw3ctouch&&!N.hasmstouch?!N.cantouch||N.isios||N.isandroid||!N.iswebkit&&!N.ismozilla||(this.istouchcapable=!0):this.istouchcapable=!0,M.enablemouselockapi||(N.hasmousecapture=!1,N.haspointerlock=!1),this.debounced=function(e,o,t){T&&(T.delaylist[e]||!1||(T.delaylist[e]={h:u(function(){T.delaylist[e].fn.call(T),T.delaylist[e]=!1},t)},o.call(T)),T.delaylist[e].fn=o)},this.synched=function(e,o){T.synclist[e]?T.synclist[e]=o:(T.synclist[e]=o,u(function(){T&&(T.synclist[e]&&T.synclist[e].call(T),T.synclist[e]=null)}))},this.unsynched=function(e){T.synclist[e]&&(T.synclist[e]=!1)},this.css=function(e,o){for(var t in o)T.saved.css.push([e,t,e.css(t)]),e.css(t,o[t])},this.scrollTop=function(e){return void 0===e?T.getScrollTop():T.setScrollTop(e)},this.scrollLeft=function(e){return void 0===e?T.getScrollLeft():T.setScrollLeft(e)};var R=function(e,o,t,r,i,s,n){this.st=e,this.ed=o,this.spd=t,this.p1=r||0,this.p2=i||1,this.p3=s||0,this.p4=n||1,this.ts=f(),this.df=o-e};if(R.prototype={B2:function(e){return 3*(1-e)*(1-e)*e},B3:function(e){return 3*(1-e)*e*e},B4:function(e){return e*e*e},getPos:function(){return(f()-this.ts)/this.spd},getNow:function(){var e=(f()-this.ts)/this.spd,o=this.B2(e)+this.B3(e)+this.B4(e);return e>=1?this.ed:this.st+this.df*o|0},update:function(e,o){return this.st=this.getNow(),this.ed=e,this.spd=o,this.ts=f(),this.df=this.ed-this.st,this}},this.ishwscroll){this.doc.translate={x:0,y:0,tx:"0px",ty:"0px"},N.hastranslate3d&&N.isios&&this.doc.css("-webkit-backface-visibility","hidden"),this.getScrollTop=function(e){if(!e){var o=v();if(o)return 16==o.length?-o[13]:-o[5];if(T.timerscroll&&T.timerscroll.bz)return T.timerscroll.bz.getNow()}return T.doc.translate.y},this.getScrollLeft=function(e){if(!e){var o=v();if(o)return 16==o.length?-o[12]:-o[4];if(T.timerscroll&&T.timerscroll.bh)return T.timerscroll.bh.getNow()}return T.doc.translate.x},this.notifyScrollEvent=function(e){var o=l.createEvent("UIEvents");o.initUIEvent("scroll",!1,!1,a,1),o.niceevent=!0,e.dispatchEvent(o)};var _=this.isrtlmode?1:-1;N.hastranslate3d&&M.enabletranslate3d?(this.setScrollTop=function(e,o){T.doc.translate.y=e,T.doc.translate.ty=-1*e+"px",T.doc.css(N.trstyle,"translate3d("+T.doc.translate.tx+","+T.doc.translate.ty+",0)"),o||T.notifyScrollEvent(T.win[0])},this.setScrollLeft=function(e,o){T.doc.translate.x=e,T.doc.translate.tx=e*_+"px",T.doc.css(N.trstyle,"translate3d("+T.doc.translate.tx+","+T.doc.translate.ty+",0)"),o||T.notifyScrollEvent(T.win[0])}):(this.setScrollTop=function(e,o){T.doc.translate.y=e,T.doc.translate.ty=-1*e+"px",T.doc.css(N.trstyle,"translate("+T.doc.translate.tx+","+T.doc.translate.ty+")"),o||T.notifyScrollEvent(T.win[0])},this.setScrollLeft=function(e,o){T.doc.translate.x=e,T.doc.translate.tx=e*_+"px",T.doc.css(N.trstyle,"translate("+T.doc.translate.tx+","+T.doc.translate.ty+")"),o||T.notifyScrollEvent(T.win[0])})}else this.getScrollTop=function(){return T.docscroll.scrollTop()},this.setScrollTop=function(e){T.docscroll.scrollTop(e)},this.getScrollLeft=function(){return T.hasreversehr?T.detected.ismozilla?T.page.maxw-Math.abs(T.docscroll.scrollLeft()):T.page.maxw-T.docscroll.scrollLeft():T.docscroll.scrollLeft()},this.setScrollLeft=function(e){return setTimeout(function(){if(T)return T.hasreversehr&&(e=T.detected.ismozilla?-(T.page.maxw-e):T.page.maxw-e),T.docscroll.scrollLeft(e)},1)};this.getTarget=function(e){return!!e&&(e.target?e.target:!!e.srcElement&&e.srcElement)},this.hasParent=function(e,o){if(!e)return!1;for(var t=e.target||e.srcElement||e||!1;t&&t.id!=o;)t=t.parentNode||!1;return!1!==t};var I={thin:1,medium:3,thick:5};this.getDocumentScrollOffset=function(){return{top:a.pageYOffset||l.documentElement.scrollTop,left:a.pageXOffset||l.documentElement.scrollLeft}},this.getOffset=function(){if(T.isfixed){var e=T.win.offset(),o=T.getDocumentScrollOffset();return e.top-=o.top,e.left-=o.left,e}var t=T.win.offset();if(!T.viewport)return t;var r=T.viewport.offset();return{top:t.top-r.top,left:t.left-r.left}},this.updateScrollBar=function(e){var o,t;if(T.ishwscroll)T.rail.css({height:T.win.innerHeight()-(M.railpadding.top+M.railpadding.bottom)}),T.railh&&T.railh.css({width:T.win.innerWidth()-(M.railpadding.left+M.railpadding.right)});else{var r=T.getOffset();if(o={top:r.top,left:r.left-(M.railpadding.left+M.railpadding.right)},o.top+=x(T.win,"border-top-width",!0),o.left+=T.rail.align?T.win.outerWidth()-x(T.win,"border-right-width")-T.rail.width:x(T.win,"border-left-width"),(t=M.railoffset)&&(t.top&&(o.top+=t.top),t.left&&(o.left+=t.left)),T.railslocked||T.rail.css({top:o.top,left:o.left,height:(e?e.h:T.win.innerHeight())-(M.railpadding.top+M.railpadding.bottom)}),T.zoom&&T.zoom.css({top:o.top+1,left:1==T.rail.align?o.left-20:o.left+T.rail.width+4}),T.railh&&!T.railslocked){o={top:r.top,left:r.left},(t=M.railhoffset)&&(t.top&&(o.top+=t.top),t.left&&(o.left+=t.left));var i=T.railh.align?o.top+x(T.win,"border-top-width",!0)+T.win.innerHeight()-T.railh.height:o.top+x(T.win,"border-top-width",!0),s=o.left+x(T.win,"border-left-width");T.railh.css({top:i-(M.railpadding.top+M.railpadding.bottom),left:s,width:T.railh.width})}}},this.doRailClick=function(e,o,t){var r,i,s,n;T.railslocked||(T.cancelEvent(e),"pageY"in e||(e.pageX=e.clientX+l.documentElement.scrollLeft,e.pageY=e.clientY+l.documentElement.scrollTop),o?(r=t?T.doScrollLeft:T.doScrollTop,s=t?(e.pageX-T.railh.offset().left-T.cursorwidth/2)*T.scrollratio.x:(e.pageY-T.rail.offset().top-T.cursorheight/2)*T.scrollratio.y,T.unsynched("relativexy"),r(0|s)):(r=t?T.doScrollLeftBy:T.doScrollBy,s=t?T.scroll.x:T.scroll.y,n=t?e.pageX-T.railh.offset().left:e.pageY-T.rail.offset().top,i=t?T.view.w:T.view.h,r(s>=n?i:-i)))},T.newscrolly=T.newscrollx=0,T.hasanimationframe="requestAnimationFrame"in a,T.hascancelanimationframe="cancelAnimationFrame"in a,T.hasborderbox=!1,this.init=function(){if(T.saved.css=[],N.isoperamini)return!0;if(N.isandroid&&!("hidden"in l))return!0;M.emulatetouch=M.emulatetouch||M.touchbehavior,T.hasborderbox=a.getComputedStyle&&"border-box"===a.getComputedStyle(l.body)["box-sizing"];var e={"overflow-y":"hidden"};if((N.isie11||N.isie10)&&(e["-ms-overflow-style"]="none"),T.ishwscroll&&(this.doc.css(N.transitionstyle,N.prefixstyle+"transform 0ms ease-out"),N.transitionend&&T.bind(T.doc,N.transitionend,T.onScrollTransitionEnd,!1)),T.zindex="auto",T.ispage||"auto"!=M.zindex?T.zindex=M.zindex:T.zindex=b()||"auto",!T.ispage&&"auto"!=T.zindex&&T.zindex>s&&(s=T.zindex),T.isie&&0===T.zindex&&"auto"==M.zindex&&(T.zindex="auto"),!T.ispage||!N.isieold){var i=T.docscroll;T.ispage&&(i=T.haswrapper?T.win:T.doc),T.css(i,e),T.ispage&&(N.isie11||N.isie)&&T.css(n("html"),e),!N.isios||T.ispage||T.haswrapper||T.css(E,{"-webkit-overflow-scrolling":"touch"});var d=n(l.createElement("div"));d.css({position:"relative",top:0,float:"right",width:M.cursorwidth,height:0,"background-color":M.cursorcolor,border:M.cursorborder,"background-clip":"padding-box","-webkit-border-radius":M.cursorborderradius,"-moz-border-radius":M.cursorborderradius,"border-radius":M.cursorborderradius}),d.addClass("nicescroll-cursors"),T.cursor=d;var u=n(l.createElement("div"));u.attr("id",T.id),u.addClass("nicescroll-rails nicescroll-rails-vr");var h,p,f=["left","right","top","bottom"];for(var g in f)p=f[g],(h=M.railpadding[p]||0)&&u.css("padding-"+p,h+"px");u.append(d),u.width=Math.max(parseFloat(M.cursorwidth),d.outerWidth()),u.css({width:u.width+"px",zIndex:T.zindex,background:M.background,cursor:"default"}),u.visibility=!0,u.scrollable=!0,u.align="left"==M.railalign?0:1,T.rail=u,T.rail.drag=!1;var v=!1;!M.boxzoom||T.ispage||N.isieold||(v=l.createElement("div"),T.bind(v,"click",T.doZoom),T.bind(v,"mouseenter",function(){T.zoom.css("opacity",M.cursoropacitymax)}),T.bind(v,"mouseleave",function(){T.zoom.css("opacity",M.cursoropacitymin)}),T.zoom=n(v),T.zoom.css({cursor:"pointer",zIndex:T.zindex,backgroundImage:"url("+M.scriptpath+"zoomico.png)",height:18,width:18,backgroundPosition:"0 0"}),M.dblclickzoom&&T.bind(T.win,"dblclick",T.doZoom),N.cantouch&&M.gesturezoom&&(T.ongesturezoom=function(e){return e.scale>1.5&&T.doZoomIn(e),e.scale<.8&&T.doZoomOut(e),T.cancelEvent(e)},T.bind(T.win,"gestureend",T.ongesturezoom))),T.railh=!1;var w;if(M.horizrailenabled&&(T.css(i,{overflowX:"hidden"}),(d=n(l.createElement("div"))).css({position:"absolute",top:0,height:M.cursorwidth,width:0,backgroundColor:M.cursorcolor,border:M.cursorborder,backgroundClip:"padding-box","-webkit-border-radius":M.cursorborderradius,"-moz-border-radius":M.cursorborderradius,"border-radius":M.cursorborderradius}),N.isieold&&d.css("overflow","hidden"),d.addClass("nicescroll-cursors"),T.cursorh=d,(w=n(l.createElement("div"))).attr("id",T.id+"-hr"),w.addClass("nicescroll-rails nicescroll-rails-hr"),w.height=Math.max(parseFloat(M.cursorwidth),d.outerHeight()),w.css({height:w.height+"px",zIndex:T.zindex,background:M.background}),w.append(d),w.visibility=!0,w.scrollable=!0,w.align="top"==M.railvalign?0:1,T.railh=w,T.railh.drag=!1),T.ispage)u.css({position:"fixed",top:0,height:"100%"}),u.css(u.align?{right:0}:{left:0}),T.body.append(u),T.railh&&(w.css({position:"fixed",left:0,width:"100%"}),w.css(w.align?{bottom:0}:{top:0}),T.body.append(w));else{if(T.ishwscroll){"static"==T.win.css("position")&&T.css(T.win,{position:"relative"});var x="HTML"==T.win[0].nodeName?T.body:T.win;n(x).scrollTop(0).scrollLeft(0),T.zoom&&(T.zoom.css({position:"absolute",top:1,right:0,"margin-right":u.width+4}),x.append(T.zoom)),u.css({position:"absolute",top:0}),u.css(u.align?{right:0}:{left:0}),x.append(u),w&&(w.css({position:"absolute",left:0,bottom:0}),w.css(w.align?{bottom:0}:{top:0}),x.append(w))}else{T.isfixed="fixed"==T.win.css("position");var S=T.isfixed?"fixed":"absolute";T.isfixed||(T.viewport=T.getViewport(T.win[0])),T.viewport&&(T.body=T.viewport,/fixed|absolute/.test(T.viewport.css("position"))||T.css(T.viewport,{position:"relative"})),u.css({position:S}),T.zoom&&T.zoom.css({position:S}),T.updateScrollBar(),T.body.append(u),T.zoom&&T.body.append(T.zoom),T.railh&&(w.css({position:S}),T.body.append(w))}N.isios&&T.css(T.win,{"-webkit-tap-highlight-color":"rgba(0,0,0,0)","-webkit-touch-callout":"none"}),M.disableoutline&&(N.isie&&T.win.attr("hideFocus","true"),N.iswebkit&&T.win.css("outline","none"))}if(!1===M.autohidemode?(T.autohidedom=!1,T.rail.css({opacity:M.cursoropacitymax}),T.railh&&T.railh.css({opacity:M.cursoropacitymax})):!0===M.autohidemode||"leave"===M.autohidemode?(T.autohidedom=n().add(T.rail),N.isie8&&(T.autohidedom=T.autohidedom.add(T.cursor)),T.railh&&(T.autohidedom=T.autohidedom.add(T.railh)),T.railh&&N.isie8&&(T.autohidedom=T.autohidedom.add(T.cursorh))):"scroll"==M.autohidemode?(T.autohidedom=n().add(T.rail),T.railh&&(T.autohidedom=T.autohidedom.add(T.railh))):"cursor"==M.autohidemode?(T.autohidedom=n().add(T.cursor),T.railh&&(T.autohidedom=T.autohidedom.add(T.cursorh))):"hidden"==M.autohidemode&&(T.autohidedom=!1,T.hide(),T.railslocked=!1),N.cantouch||T.istouchcapable||M.emulatetouch||N.hasmstouch){T.scrollmom=new y(T);T.ontouchstart=function(e){if(T.locked)return!1;if(e.pointerType&&("mouse"===e.pointerType||e.pointerType===e.MSPOINTER_TYPE_MOUSE))return!1;if(T.hasmoving=!1,T.scrollmom.timer&&(T.triggerScrollEnd(),T.scrollmom.stop()),!T.railslocked){var o=T.getTarget(e);if(o&&/INPUT/i.test(o.nodeName)&&/range/i.test(o.type))return T.stopPropagation(e);var t="mousedown"===e.type;if(!("clientX"in e)&&"changedTouches"in e&&(e.clientX=e.changedTouches[0].clientX,e.clientY=e.changedTouches[0].clientY),T.forcescreen){var r=e;(e={original:e.original?e.original:e}).clientX=r.screenX,e.clientY=r.screenY}if(T.rail.drag={x:e.clientX,y:e.clientY,sx:T.scroll.x,sy:T.scroll.y,st:T.getScrollTop(),sl:T.getScrollLeft(),pt:2,dl:!1,tg:o},T.ispage||!M.directionlockdeadzone)T.rail.drag.dl="f";else{var i={w:c.width(),h:c.height()},s=T.getContentSize(),l=s.h-i.h,a=s.w-i.w;T.rail.scrollable&&!T.railh.scrollable?T.rail.drag.ck=l>0&&"v":!T.rail.scrollable&&T.railh.scrollable?T.rail.drag.ck=a>0&&"h":T.rail.drag.ck=!1}if(M.emulatetouch&&T.isiframe&&N.isie){var d=T.win.position();T.rail.drag.x+=d.left,T.rail.drag.y+=d.top}if(T.hasmoving=!1,T.lastmouseup=!1,T.scrollmom.reset(e.clientX,e.clientY),o&&t){if(!/INPUT|SELECT|BUTTON|TEXTAREA/i.test(o.nodeName))return N.hasmousecapture&&o.setCapture(),M.emulatetouch?(o.onclick&&!o._onclick&&(o._onclick=o.onclick,o.onclick=function(e){if(T.hasmoving)return!1;o._onclick.call(this,e)}),T.cancelEvent(e)):T.stopPropagation(e);/SUBMIT|CANCEL|BUTTON/i.test(n(o).attr("type"))&&(T.preventclick={tg:o,click:!1})}}},T.ontouchend=function(e){if(!T.rail.drag)return!0;if(2==T.rail.drag.pt){if(e.pointerType&&("mouse"===e.pointerType||e.pointerType===e.MSPOINTER_TYPE_MOUSE))return!1;T.rail.drag=!1;var o="mouseup"===e.type;if(T.hasmoving&&(T.scrollmom.doMomentum(),T.lastmouseup=!0,T.hideCursor(),N.hasmousecapture&&l.releaseCapture(),o))return T.cancelEvent(e)}else if(1==T.rail.drag.pt)return T.onmouseup(e)};var z=M.emulatetouch&&T.isiframe&&!N.hasmousecapture,k=.3*M.directionlockdeadzone|0;T.ontouchmove=function(e,o){if(!T.rail.drag)return!0;if(e.targetTouches&&M.preventmultitouchscrolling&&e.targetTouches.length>1)return!0;if(e.pointerType&&("mouse"===e.pointerType||e.pointerType===e.MSPOINTER_TYPE_MOUSE))return!0;if(2==T.rail.drag.pt){"changedTouches"in e&&(e.clientX=e.changedTouches[0].clientX,e.clientY=e.changedTouches[0].clientY);var t,r;if(r=t=0,z&&!o){var i=T.win.position();r=-i.left,t=-i.top}var s=e.clientY+t,n=s-T.rail.drag.y,a=e.clientX+r,c=a-T.rail.drag.x,d=T.rail.drag.st-n;if(T.ishwscroll&&M.bouncescroll)d<0?d=Math.round(d/2):d>T.page.maxh&&(d=T.page.maxh+Math.round((d-T.page.maxh)/2));else if(d<0?(d=0,s=0):d>T.page.maxh&&(d=T.page.maxh,s=0),0===s&&!T.hasmoving)return T.ispage||(T.rail.drag=!1),!0;var u=T.getScrollLeft();if(T.railh&&T.railh.scrollable&&(u=T.isrtlmode?c-T.rail.drag.sl:T.rail.drag.sl-c,T.ishwscroll&&M.bouncescroll?u<0?u=Math.round(u/2):u>T.page.maxw&&(u=T.page.maxw+Math.round((u-T.page.maxw)/2)):(u<0&&(u=0,a=0),u>T.page.maxw&&(u=T.page.maxw,a=0))),!T.hasmoving){if(T.rail.drag.y===e.clientY&&T.rail.drag.x===e.clientX)return T.cancelEvent(e);var h=Math.abs(n),p=Math.abs(c),m=M.directionlockdeadzone;if(T.rail.drag.ck?"v"==T.rail.drag.ck?p>m&&h<=k?T.rail.drag=!1:h>m&&(T.rail.drag.dl="v"):"h"==T.rail.drag.ck&&(h>m&&p<=k?T.rail.drag=!1:p>m&&(T.rail.drag.dl="h")):h>m&&p>m?T.rail.drag.dl="f":h>m?T.rail.drag.dl=p>k?"f":"v":p>m&&(T.rail.drag.dl=h>k?"f":"h"),!T.rail.drag.dl)return T.cancelEvent(e);T.triggerScrollStart(e.clientX,e.clientY,0,0,0),T.hasmoving=!0}return T.preventclick&&!T.preventclick.click&&(T.preventclick.click=T.preventclick.tg.onclick||!1,T.preventclick.tg.onclick=T.onpreventclick),T.rail.drag.dl&&("v"==T.rail.drag.dl?u=T.rail.drag.sl:"h"==T.rail.drag.dl&&(d=T.rail.drag.st)),T.synched("touchmove",function(){T.rail.drag&&2==T.rail.drag.pt&&(T.prepareTransition&&T.resetTransition(),T.rail.scrollable&&T.setScrollTop(d),T.scrollmom.update(a,s),T.railh&&T.railh.scrollable?(T.setScrollLeft(u),T.showCursor(d,u)):T.showCursor(d),N.isie10&&l.selection.clear())}),T.cancelEvent(e)}return 1==T.rail.drag.pt?T.onmousemove(e):void 0},T.ontouchstartCursor=function(e,o){if(!T.rail.drag||3==T.rail.drag.pt){if(T.locked)return T.cancelEvent(e);T.cancelScroll(),T.rail.drag={x:e.touches[0].clientX,y:e.touches[0].clientY,sx:T.scroll.x,sy:T.scroll.y,pt:3,hr:!!o};var t=T.getTarget(e);return!T.ispage&&N.hasmousecapture&&t.setCapture(),T.isiframe&&!N.hasmousecapture&&(T.saved.csspointerevents=T.doc.css("pointer-events"),T.css(T.doc,{"pointer-events":"none"})),T.cancelEvent(e)}},T.ontouchendCursor=function(e){if(T.rail.drag){if(N.hasmousecapture&&l.releaseCapture(),T.isiframe&&!N.hasmousecapture&&T.doc.css("pointer-events",T.saved.csspointerevents),3!=T.rail.drag.pt)return;return T.rail.drag=!1,T.cancelEvent(e)}},T.ontouchmoveCursor=function(e){if(T.rail.drag){if(3!=T.rail.drag.pt)return;if(T.cursorfreezed=!0,T.rail.drag.hr){T.scroll.x=T.rail.drag.sx+(e.touches[0].clientX-T.rail.drag.x),T.scroll.x<0&&(T.scroll.x=0);var o=T.scrollvaluemaxw;T.scroll.x>o&&(T.scroll.x=o)}else{T.scroll.y=T.rail.drag.sy+(e.touches[0].clientY-T.rail.drag.y),T.scroll.y<0&&(T.scroll.y=0);var t=T.scrollvaluemax;T.scroll.y>t&&(T.scroll.y=t)}return T.synched("touchmove",function(){T.rail.drag&&3==T.rail.drag.pt&&(T.showCursor(),T.rail.drag.hr?T.doScrollLeft(Math.round(T.scroll.x*T.scrollratio.x),M.cursordragspeed):T.doScrollTop(Math.round(T.scroll.y*T.scrollratio.y),M.cursordragspeed))}),T.cancelEvent(e)}}}if(T.onmousedown=function(e,o){if(!T.rail.drag||1==T.rail.drag.pt){if(T.railslocked)return T.cancelEvent(e);T.cancelScroll(),T.rail.drag={x:e.clientX,y:e.clientY,sx:T.scroll.x,sy:T.scroll.y,pt:1,hr:o||!1};var t=T.getTarget(e);return N.hasmousecapture&&t.setCapture(),T.isiframe&&!N.hasmousecapture&&(T.saved.csspointerevents=T.doc.css("pointer-events"),T.css(T.doc,{"pointer-events":"none"})),T.hasmoving=!1,T.cancelEvent(e)}},T.onmouseup=function(e){if(T.rail.drag)return 1!=T.rail.drag.pt||(N.hasmousecapture&&l.releaseCapture(),T.isiframe&&!N.hasmousecapture&&T.doc.css("pointer-events",T.saved.csspointerevents),T.rail.drag=!1,T.cursorfreezed=!1,T.hasmoving&&T.triggerScrollEnd(),T.cancelEvent(e))},T.onmousemove=function(e){if(T.rail.drag){if(1!==T.rail.drag.pt)return;if(N.ischrome&&0===e.which)return T.onmouseup(e);if(T.cursorfreezed=!0,T.hasmoving||T.triggerScrollStart(e.clientX,e.clientY,0,0,0),T.hasmoving=!0,T.rail.drag.hr){T.scroll.x=T.rail.drag.sx+(e.clientX-T.rail.drag.x),T.scroll.x<0&&(T.scroll.x=0);var o=T.scrollvaluemaxw;T.scroll.x>o&&(T.scroll.x=o)}else{T.scroll.y=T.rail.drag.sy+(e.clientY-T.rail.drag.y),T.scroll.y<0&&(T.scroll.y=0);var t=T.scrollvaluemax;T.scroll.y>t&&(T.scroll.y=t)}return T.synched("mousemove",function(){T.cursorfreezed&&(T.showCursor(),T.rail.drag.hr?T.scrollLeft(Math.round(T.scroll.x*T.scrollratio.x)):T.scrollTop(Math.round(T.scroll.y*T.scrollratio.y)))}),T.cancelEvent(e)}T.checkarea=0},N.cantouch||M.emulatetouch)T.onpreventclick=function(e){if(T.preventclick)return T.preventclick.tg.onclick=T.preventclick.click,T.preventclick=!1,T.cancelEvent(e)},T.onclick=!N.isios&&function(e){return!T.lastmouseup||(T.lastmouseup=!1,T.cancelEvent(e))},M.grabcursorenabled&&N.cursorgrabvalue&&(T.css(T.ispage?T.doc:T.win,{cursor:N.cursorgrabvalue}),T.css(T.rail,{cursor:N.cursorgrabvalue}));else{var L=function(e){if(T.selectiondrag){if(e){var o=T.win.outerHeight(),t=e.pageY-T.selectiondrag.top;t>0&&t=o&&(t-=o),T.selectiondrag.df=t}if(0!==T.selectiondrag.df){var r=-2*T.selectiondrag.df/6|0;T.doScrollBy(r),T.debounced("doselectionscroll",function(){L()},50)}}};T.hasTextSelected="getSelection"in l?function(){return l.getSelection().rangeCount>0}:"selection"in l?function(){return"None"!=l.selection.type}:function(){return!1},T.onselectionstart=function(e){T.ispage||(T.selectiondrag=T.win.offset())},T.onselectionend=function(e){T.selectiondrag=!1},T.onselectiondrag=function(e){T.selectiondrag&&T.hasTextSelected()&&T.debounced("selectionscroll",function(){L(e)},250)}}if(N.hasw3ctouch?(T.css(T.ispage?n("html"):T.win,{"touch-action":"none"}),T.css(T.rail,{"touch-action":"none"}),T.css(T.cursor,{"touch-action":"none"}),T.bind(T.win,"pointerdown",T.ontouchstart),T.bind(l,"pointerup",T.ontouchend),T.delegate(l,"pointermove",T.ontouchmove)):N.hasmstouch?(T.css(T.ispage?n("html"):T.win,{"-ms-touch-action":"none"}),T.css(T.rail,{"-ms-touch-action":"none"}),T.css(T.cursor,{"-ms-touch-action":"none"}),T.bind(T.win,"MSPointerDown",T.ontouchstart),T.bind(l,"MSPointerUp",T.ontouchend),T.delegate(l,"MSPointerMove",T.ontouchmove),T.bind(T.cursor,"MSGestureHold",function(e){e.preventDefault()}),T.bind(T.cursor,"contextmenu",function(e){e.preventDefault()})):N.cantouch&&(T.bind(T.win,"touchstart",T.ontouchstart,!1,!0),T.bind(l,"touchend",T.ontouchend,!1,!0),T.bind(l,"touchcancel",T.ontouchend,!1,!0),T.delegate(l,"touchmove",T.ontouchmove,!1,!0)),M.emulatetouch&&(T.bind(T.win,"mousedown",T.ontouchstart,!1,!0),T.bind(l,"mouseup",T.ontouchend,!1,!0),T.bind(l,"mousemove",T.ontouchmove,!1,!0)),(M.cursordragontouch||!N.cantouch&&!M.emulatetouch)&&(T.rail.css({cursor:"default"}),T.railh&&T.railh.css({cursor:"default"}),T.jqbind(T.rail,"mouseenter",function(){if(!T.ispage&&!T.win.is(":visible"))return!1;T.canshowonmouseevent&&T.showCursor(),T.rail.active=!0}),T.jqbind(T.rail,"mouseleave",function(){T.rail.active=!1,T.rail.drag||T.hideCursor()}),M.sensitiverail&&(T.bind(T.rail,"click",function(e){T.doRailClick(e,!1,!1)}),T.bind(T.rail,"dblclick",function(e){T.doRailClick(e,!0,!1)}),T.bind(T.cursor,"click",function(e){T.cancelEvent(e)}),T.bind(T.cursor,"dblclick",function(e){T.cancelEvent(e)})),T.railh&&(T.jqbind(T.railh,"mouseenter",function(){if(!T.ispage&&!T.win.is(":visible"))return!1;T.canshowonmouseevent&&T.showCursor(),T.rail.active=!0}),T.jqbind(T.railh,"mouseleave",function(){T.rail.active=!1,T.rail.drag||T.hideCursor()}),M.sensitiverail&&(T.bind(T.railh,"click",function(e){T.doRailClick(e,!1,!0)}),T.bind(T.railh,"dblclick",function(e){T.doRailClick(e,!0,!0)}),T.bind(T.cursorh,"click",function(e){T.cancelEvent(e)}),T.bind(T.cursorh,"dblclick",function(e){T.cancelEvent(e)})))),M.cursordragontouch&&(this.istouchcapable||N.cantouch)&&(T.bind(T.cursor,"touchstart",T.ontouchstartCursor),T.bind(T.cursor,"touchmove",T.ontouchmoveCursor),T.bind(T.cursor,"touchend",T.ontouchendCursor),T.cursorh&&T.bind(T.cursorh,"touchstart",function(e){T.ontouchstartCursor(e,!0)}),T.cursorh&&T.bind(T.cursorh,"touchmove",T.ontouchmoveCursor),T.cursorh&&T.bind(T.cursorh,"touchend",T.ontouchendCursor)),M.emulatetouch||N.isandroid||N.isios?(T.bind(N.hasmousecapture?T.win:l,"mouseup",T.ontouchend),T.onclick&&T.bind(l,"click",T.onclick),M.cursordragontouch?(T.bind(T.cursor,"mousedown",T.onmousedown),T.bind(T.cursor,"mouseup",T.onmouseup),T.cursorh&&T.bind(T.cursorh,"mousedown",function(e){T.onmousedown(e,!0)}),T.cursorh&&T.bind(T.cursorh,"mouseup",T.onmouseup)):(T.bind(T.rail,"mousedown",function(e){e.preventDefault()}),T.railh&&T.bind(T.railh,"mousedown",function(e){e.preventDefault()}))):(T.bind(N.hasmousecapture?T.win:l,"mouseup",T.onmouseup),T.bind(l,"mousemove",T.onmousemove),T.onclick&&T.bind(l,"click",T.onclick),T.bind(T.cursor,"mousedown",T.onmousedown),T.bind(T.cursor,"mouseup",T.onmouseup),T.railh&&(T.bind(T.cursorh,"mousedown",function(e){T.onmousedown(e,!0)}),T.bind(T.cursorh,"mouseup",T.onmouseup)),!T.ispage&&M.enablescrollonselection&&(T.bind(T.win[0],"mousedown",T.onselectionstart),T.bind(l,"mouseup",T.onselectionend),T.bind(T.cursor,"mouseup",T.onselectionend),T.cursorh&&T.bind(T.cursorh,"mouseup",T.onselectionend),T.bind(l,"mousemove",T.onselectiondrag)),T.zoom&&(T.jqbind(T.zoom,"mouseenter",function(){T.canshowonmouseevent&&T.showCursor(),T.rail.active=!0}),T.jqbind(T.zoom,"mouseleave",function(){T.rail.active=!1,T.rail.drag||T.hideCursor()}))),M.enablemousewheel&&(T.isiframe||T.mousewheel(N.isie&&T.ispage?l:T.win,T.onmousewheel),T.mousewheel(T.rail,T.onmousewheel),T.railh&&T.mousewheel(T.railh,T.onmousewheelhr)),T.ispage||N.cantouch||/HTML|^BODY/.test(T.win[0].nodeName)||(T.win.attr("tabindex")||T.win.attr({tabindex:++r}),T.bind(T.win,"focus",function(e){o=T.getTarget(e).id||T.getTarget(e)||!1,T.hasfocus=!0,T.canshowonmouseevent&&T.noticeCursor()}),T.bind(T.win,"blur",function(e){o=!1,T.hasfocus=!1}),T.bind(T.win,"mouseenter",function(e){t=T.getTarget(e).id||T.getTarget(e)||!1,T.hasmousefocus=!0,T.canshowonmouseevent&&T.noticeCursor()}),T.bind(T.win,"mouseleave",function(e){t=!1,T.hasmousefocus=!1,T.rail.drag||T.hideCursor()})),T.onkeypress=function(e){if(T.railslocked&&0===T.page.maxh)return!0;e=e||a.event;var r=T.getTarget(e);if(r&&/INPUT|TEXTAREA|SELECT|OPTION/.test(r.nodeName)&&(!(r.getAttribute("type")||r.type||!1)||!/submit|button|cancel/i.tp))return!0;if(n(r).attr("contenteditable"))return!0;if(T.hasfocus||T.hasmousefocus&&!o||T.ispage&&!o&&!t){var i=e.keyCode;if(T.railslocked&&27!=i)return T.cancelEvent(e);var s=e.ctrlKey||!1,l=e.shiftKey||!1,c=!1;switch(i){case 38:case 63233:T.doScrollBy(72),c=!0;break;case 40:case 63235:T.doScrollBy(-72),c=!0;break;case 37:case 63232:T.railh&&(s?T.doScrollLeft(0):T.doScrollLeftBy(72),c=!0);break;case 39:case 63234:T.railh&&(s?T.doScrollLeft(T.page.maxw):T.doScrollLeftBy(-72),c=!0);break;case 33:case 63276:T.doScrollBy(T.view.h),c=!0;break;case 34:case 63277:T.doScrollBy(-T.view.h),c=!0;break;case 36:case 63273:T.railh&&s?T.doScrollPos(0,0):T.doScrollTo(0),c=!0;break;case 35:case 63275:T.railh&&s?T.doScrollPos(T.page.maxw,T.page.maxh):T.doScrollTo(T.page.maxh),c=!0;break;case 32:M.spacebarenabled&&(l?T.doScrollBy(T.view.h):T.doScrollBy(-T.view.h),c=!0);break;case 27:T.zoomactive&&(T.doZoom(),c=!0)}if(c)return T.cancelEvent(e)}},M.enablekeyboard&&T.bind(l,N.isopera&&!N.isopera12?"keypress":"keydown",T.onkeypress),T.bind(l,"keydown",function(e){(e.ctrlKey||!1)&&(T.wheelprevented=!0)}),T.bind(l,"keyup",function(e){e.ctrlKey||!1||(T.wheelprevented=!1)}),T.bind(a,"blur",function(e){T.wheelprevented=!1}),T.bind(a,"resize",T.onscreenresize),T.bind(a,"orientationchange",T.onscreenresize),T.bind(a,"load",T.lazyResize),N.ischrome&&!T.ispage&&!T.haswrapper){var C=T.win.attr("style"),P=parseFloat(T.win.css("width"))+1;T.win.css("width",P),T.synched("chromefix",function(){T.win.attr("style",C)})}T.onAttributeChange=function(e){T.lazyResize(T.isieold?250:30)},M.enableobserver&&(T.isie11||!1===m||(T.observerbody=new m(function(e){if(e.forEach(function(e){if("attributes"==e.type)return E.hasClass("modal-open")&&E.hasClass("modal-dialog")&&!n.contains(n(".modal-dialog")[0],T.doc[0])?T.hide():T.show()}),T.me.clientWidth!=T.page.width||T.me.clientHeight!=T.page.height)return T.lazyResize(30)}),T.observerbody.observe(l.body,{childList:!0,subtree:!0,characterData:!1,attributes:!0,attributeFilter:["class"]})),T.ispage||T.haswrapper||(!1!==m?(T.observer=new m(function(e){e.forEach(T.onAttributeChange)}),T.observer.observe(T.win[0],{childList:!0,characterData:!1,attributes:!0,subtree:!1}),T.observerremover=new m(function(e){e.forEach(function(e){if(e.removedNodes.length>0)for(var o in e.removedNodes)if(T&&e.removedNodes[o]==T.win[0])return T.remove()})}),T.observerremover.observe(T.win[0].parentNode,{childList:!0,characterData:!1,attributes:!1,subtree:!1})):(T.bind(T.win,N.isie&&!N.isie9?"propertychange":"DOMAttrModified",T.onAttributeChange),N.isie9&&T.win[0].attachEvent("onpropertychange",T.onAttributeChange),T.bind(T.win,"DOMNodeRemoved",function(e){e.target==T.win[0]&&T.remove()})))),!T.ispage&&M.boxzoom&&T.bind(a,"resize",T.resizeZoom),T.istextarea&&(T.bind(T.win,"keydown",T.lazyResize),T.bind(T.win,"mouseup",T.lazyResize)),T.lazyResize(30)}if("IFRAME"==this.doc[0].nodeName){var R=function(){T.iframexd=!1;var o;try{(o="contentDocument"in this?this.contentDocument:this.contentWindow._doc).domain}catch(e){T.iframexd=!0,o=!1}if(T.iframexd)return"console"in a&&console.log("NiceScroll error: policy restriced iframe"),!0;if(T.forcescreen=!0,T.isiframe&&(T.iframe={doc:n(o),html:T.doc.contents().find("html")[0],body:T.doc.contents().find("body")[0]},T.getContentSize=function(){return{w:Math.max(T.iframe.html.scrollWidth,T.iframe.body.scrollWidth),h:Math.max(T.iframe.html.scrollHeight,T.iframe.body.scrollHeight)}},T.docscroll=n(T.iframe.body)),!N.isios&&M.iframeautoresize&&!T.isiframe){T.win.scrollTop(0),T.doc.height("");var t=Math.max(o.getElementsByTagName("html")[0].scrollHeight,o.body.scrollHeight);T.doc.height(t)}T.lazyResize(30),T.css(n(T.iframe.body),e),N.isios&&T.haswrapper&&T.css(n(o.body),{"-webkit-transform":"translate3d(0,0,0)"}),"contentWindow"in this?T.bind(this.contentWindow,"scroll",T.onscroll):T.bind(o,"scroll",T.onscroll),M.enablemousewheel&&T.mousewheel(o,T.onmousewheel),M.enablekeyboard&&T.bind(o,N.isopera?"keypress":"keydown",T.onkeypress),N.cantouch?(T.bind(o,"touchstart",T.ontouchstart),T.bind(o,"touchmove",T.ontouchmove)):M.emulatetouch&&(T.bind(o,"mousedown",T.ontouchstart),T.bind(o,"mousemove",function(e){return T.ontouchmove(e,!0)}),M.grabcursorenabled&&N.cursorgrabvalue&&T.css(n(o.body),{cursor:N.cursorgrabvalue})),T.bind(o,"mouseup",T.ontouchend),T.zoom&&(M.dblclickzoom&&T.bind(o,"dblclick",T.doZoom),T.ongesturezoom&&T.bind(o,"gestureend",T.ongesturezoom))};this.doc[0].readyState&&"complete"===this.doc[0].readyState&&setTimeout(function(){R.call(T.doc[0],!1)},500),T.bind(this.doc,"load",R)}},this.showCursor=function(e,o){if(T.cursortimeout&&(clearTimeout(T.cursortimeout),T.cursortimeout=0),T.rail){if(T.autohidedom&&(T.autohidedom.stop().css({opacity:M.cursoropacitymax}),T.cursoractive=!0),T.rail.drag&&1==T.rail.drag.pt||(void 0!==e&&!1!==e&&(T.scroll.y=e/T.scrollratio.y|0),void 0!==o&&(T.scroll.x=o/T.scrollratio.x|0)),T.cursor.css({height:T.cursorheight,top:T.scroll.y}),T.cursorh){var t=T.hasreversehr?T.scrollvaluemaxw-T.scroll.x:T.scroll.x;T.cursorh.css({width:T.cursorwidth,left:!T.rail.align&&T.rail.visibility?t+T.rail.width:t}),T.cursoractive=!0}T.zoom&&T.zoom.stop().css({opacity:M.cursoropacitymax})}},this.hideCursor=function(e){T.cursortimeout||T.rail&&T.autohidedom&&(T.hasmousefocus&&"leave"===M.autohidemode||(T.cursortimeout=setTimeout(function(){T.rail.active&&T.showonmouseevent||(T.autohidedom.stop().animate({opacity:M.cursoropacitymin}),T.zoom&&T.zoom.stop().animate({opacity:M.cursoropacitymin}),T.cursoractive=!1),T.cursortimeout=0},e||M.hidecursordelay)))},this.noticeCursor=function(e,o,t){T.showCursor(o,t),T.rail.active||T.hideCursor(e)},this.getContentSize=T.ispage?function(){return{w:Math.max(l.body.scrollWidth,l.documentElement.scrollWidth),h:Math.max(l.body.scrollHeight,l.documentElement.scrollHeight)}}:T.haswrapper?function(){return{w:T.doc[0].offsetWidth,h:T.doc[0].offsetHeight}}:function(){return{w:T.docscroll[0].scrollWidth,h:T.docscroll[0].scrollHeight}},this.onResize=function(e,o){if(!T||!T.win)return!1;var t=T.page.maxh,r=T.page.maxw,i=T.view.h,s=T.view.w;if(T.view={w:T.ispage?T.win.width():T.win[0].clientWidth,h:T.ispage?T.win.height():T.win[0].clientHeight},T.page=o||T.getContentSize(),T.page.maxh=Math.max(0,T.page.h-T.view.h),T.page.maxw=Math.max(0,T.page.w-T.view.w),T.page.maxh==t&&T.page.maxw==r&&T.view.w==s&&T.view.h==i){if(T.ispage)return T;var n=T.win.offset();if(T.lastposition){var l=T.lastposition;if(l.top==n.top&&l.left==n.left)return T}T.lastposition=n}return 0===T.page.maxh?(T.hideRail(),T.scrollvaluemax=0,T.scroll.y=0,T.scrollratio.y=0,T.cursorheight=0,T.setScrollTop(0),T.rail&&(T.rail.scrollable=!1)):(T.page.maxh-=M.railpadding.top+M.railpadding.bottom,T.rail.scrollable=!0),0===T.page.maxw?(T.hideRailHr(),T.scrollvaluemaxw=0,T.scroll.x=0,T.scrollratio.x=0,T.cursorwidth=0,T.setScrollLeft(0),T.railh&&(T.railh.scrollable=!1)):(T.page.maxw-=M.railpadding.left+M.railpadding.right,T.railh&&(T.railh.scrollable=M.horizrailenabled)),T.railslocked=T.locked||0===T.page.maxh&&0===T.page.maxw,T.railslocked?(T.ispage||T.updateScrollBar(T.view),!1):(T.hidden||(T.rail.visibility||T.showRail(),T.railh&&!T.railh.visibility&&T.showRailHr()),T.istextarea&&T.win.css("resize")&&"none"!=T.win.css("resize")&&(T.view.h-=20),T.cursorheight=Math.min(T.view.h,Math.round(T.view.h*(T.view.h/T.page.h))),T.cursorheight=M.cursorfixedheight?M.cursorfixedheight:Math.max(M.cursorminheight,T.cursorheight),T.cursorwidth=Math.min(T.view.w,Math.round(T.view.w*(T.view.w/T.page.w))),T.cursorwidth=M.cursorfixedheight?M.cursorfixedheight:Math.max(M.cursorminheight,T.cursorwidth),T.scrollvaluemax=T.view.h-T.cursorheight-(M.railpadding.top+M.railpadding.bottom),T.hasborderbox||(T.scrollvaluemax-=T.cursor[0].offsetHeight-T.cursor[0].clientHeight),T.railh&&(T.railh.width=T.page.maxh>0?T.view.w-T.rail.width:T.view.w,T.scrollvaluemaxw=T.railh.width-T.cursorwidth-(M.railpadding.left+M.railpadding.right)),T.ispage||T.updateScrollBar(T.view),T.scrollratio={x:T.page.maxw/T.scrollvaluemaxw,y:T.page.maxh/T.scrollvaluemax},T.getScrollTop()>T.page.maxh?T.doScrollTop(T.page.maxh):(T.scroll.y=T.getScrollTop()/T.scrollratio.y|0,T.scroll.x=T.getScrollLeft()/T.scrollratio.x|0,T.cursoractive&&T.noticeCursor()),T.scroll.y&&0===T.getScrollTop()&&T.doScrollTo(T.scroll.y*T.scrollratio.y|0),T)},this.resize=T.onResize;var O=0;this.onscreenresize=function(e){clearTimeout(O);var o=!T.ispage&&!T.haswrapper;o&&T.hideRails(),O=setTimeout(function(){T&&(o&&T.showRails(),T.resize()),O=0},120)},this.lazyResize=function(e){return clearTimeout(O),O=setTimeout(function(){T&&T.resize(),O=0},e||240),T},this.jqbind=function(e,o,t){T.events.push({e:e,n:o,f:t,q:!0}),n(e).on(o,t)},this.mousewheel=function(e,o,t){var r="jquery"in e?e[0]:e;if("onwheel"in l.createElement("div"))T._bind(r,"wheel",o,t||!1);else{var i=void 0!==l.onmousewheel?"mousewheel":"DOMMouseScroll";S(r,i,o,t||!1),"DOMMouseScroll"==i&&S(r,"MozMousePixelScroll",o,t||!1)}};var Y=!1;if(N.haseventlistener){try{var H=Object.defineProperty({},"passive",{get:function(){Y=!0}});a.addEventListener("test",null,H)}catch(e){}this.stopPropagation=function(e){return!!e&&((e=e.original?e.original:e).stopPropagation(),!1)},this.cancelEvent=function(e){return e.cancelable&&e.preventDefault(),e.stopImmediatePropagation(),e.preventManipulation&&e.preventManipulation(),!1}}else Event.prototype.preventDefault=function(){this.returnValue=!1},Event.prototype.stopPropagation=function(){this.cancelBubble=!0},a.constructor.prototype.addEventListener=l.constructor.prototype.addEventListener=Element.prototype.addEventListener=function(e,o,t){this.attachEvent("on"+e,o)},a.constructor.prototype.removeEventListener=l.constructor.prototype.removeEventListener=Element.prototype.removeEventListener=function(e,o,t){this.detachEvent("on"+e,o)},this.cancelEvent=function(e){return(e=e||a.event)&&(e.cancelBubble=!0,e.cancel=!0,e.returnValue=!1),!1},this.stopPropagation=function(e){return(e=e||a.event)&&(e.cancelBubble=!0),!1};this.delegate=function(e,o,t,r,i){var s=d[o]||!1;s||(s={a:[],l:[],f:function(e){for(var o=s.l,t=!1,r=o.length-1;r>=0;r--)if(!1===(t=o[r].call(e.target,e)))return!1;return t}},T.bind(e,o,s.f,r,i),d[o]=s),T.ispage?(s.a=[T.id].concat(s.a),s.l=[t].concat(s.l)):(s.a.push(T.id),s.l.push(t))},this.undelegate=function(e,o,t,r,i){var s=d[o]||!1;if(s)for(var n=0,l=s.l.length;n0)return t;o=!!o.parentNode&&o.parentNode}return!1},this.triggerScrollStart=function(e,o,t,r,i){if(T.onscrollstart){var s={type:"scrollstart",current:{x:e,y:o},request:{x:t,y:r},end:{x:T.newscrollx,y:T.newscrolly},speed:i};T.onscrollstart.call(T,s)}},this.triggerScrollEnd=function(){if(T.onscrollend){var e=T.getScrollLeft(),o=T.getScrollTop(),t={type:"scrollend",current:{x:e,y:o},end:{x:e,y:o}};T.onscrollend.call(T,t)}};var B=0,X=0,D=0,A=1,q=!1;if(this.onmousewheel=function(e){if(T.wheelprevented||T.locked)return!1;if(T.railslocked)return T.debounced("checkunlock",T.resize,250),!1;if(T.rail.drag)return T.cancelEvent(e);if("auto"===M.oneaxismousemode&&0!==e.deltaX&&(M.oneaxismousemode=!1),M.oneaxismousemode&&0===e.deltaX&&!T.rail.scrollable)return!T.railh||!T.railh.scrollable||T.onmousewheelhr(e);var o=f(),t=!1;if(M.preservenativescrolling&&T.checkarea+600T.page.maxh&&(o=T.page.maxh+(o-T.page.maxh)/2|0),e<0?e=e/2|0:e>T.page.maxw&&(e=T.page.maxw+(e-T.page.maxw)/2|0)):(o<0?o=0:o>T.page.maxh&&(o=T.page.maxh),e<0?e=0:e>T.page.maxw&&(e=T.page.maxw)),T.scrollrunning&&e==T.newscrollx&&o==T.newscrolly)return!1;T.newscrolly=o,T.newscrollx=e;var s=T.getScrollTop(),n=T.getScrollLeft(),l={};l.x=e-n,l.y=o-s;var a=0|Math.sqrt(l.x*l.x+l.y*l.y),c=T.prepareTransition(a);T.scrollrunning||(T.scrollrunning=!0,T.triggerScrollStart(n,s,e,o,c),T.cursorupdate.start()),T.scrollendtrapped=!0,N.transitionend||(T.scrollendtrapped&&clearTimeout(T.scrollendtrapped),T.scrollendtrapped=setTimeout(T.onScrollTransitionEnd,c)),T.setScrollTop(T.newscrolly),T.setScrollLeft(T.newscrollx)},this.cancelScroll=function(){if(!T.scrollendtrapped)return!0;var e=T.getScrollTop(),o=T.getScrollLeft();return T.scrollrunning=!1,N.transitionend||clearTimeout(N.transitionend),T.scrollendtrapped=!1,T.resetTransition(),T.setScrollTop(e),T.railh&&T.setScrollLeft(o),T.timerscroll&&T.timerscroll.tm&&clearInterval(T.timerscroll.tm),T.timerscroll=!1,T.cursorfreezed=!1,T.cursorupdate.stop(),T.showCursor(e,o),T},this.onScrollTransitionEnd=function(){if(T.scrollendtrapped){var e=T.getScrollTop(),o=T.getScrollLeft();if(e<0?e=0:e>T.page.maxh&&(e=T.page.maxh),o<0?o=0:o>T.page.maxw&&(o=T.page.maxw),e!=T.newscrolly||o!=T.newscrollx)return T.doScrollPos(o,e,M.snapbackspeed);T.scrollrunning&&T.triggerScrollEnd(),T.scrollrunning=!1,T.scrollendtrapped=!1,T.resetTransition(),T.timerscroll=!1,T.setScrollTop(e),T.railh&&T.setScrollLeft(o),T.cursorupdate.stop(),T.noticeCursor(!1,e,o),T.cursorfreezed=!1}}}else this.doScrollLeft=function(e,o){var t=T.scrollrunning?T.newscrolly:T.getScrollTop();T.doScrollPos(e,t,o)},this.doScrollTop=function(e,o){var t=T.scrollrunning?T.newscrollx:T.getScrollLeft();T.doScrollPos(t,e,o)},this.doScrollPos=function(e,o,t){var r=T.getScrollTop(),i=T.getScrollLeft();((T.newscrolly-r)*(o-r)<0||(T.newscrollx-i)*(e-i)<0)&&T.cancelScroll();var s=!1;if(T.bouncescroll&&T.rail.visibility||(o<0?(o=0,s=!0):o>T.page.maxh&&(o=T.page.maxh,s=!0)),T.bouncescroll&&T.railh.visibility||(e<0?(e=0,s=!0):e>T.page.maxw&&(e=T.page.maxw,s=!0)),T.scrollrunning&&T.newscrolly===o&&T.newscrollx===e)return!0;T.newscrolly=o,T.newscrollx=e,T.dst={},T.dst.x=e-i,T.dst.y=o-r,T.dst.px=i,T.dst.py=r;var n=0|Math.sqrt(T.dst.x*T.dst.x+T.dst.y*T.dst.y),l=T.getTransitionSpeed(n);T.bzscroll={};var a=s?1:.58;T.bzscroll.x=new R(i,T.newscrollx,l,0,0,a,1),T.bzscroll.y=new R(r,T.newscrolly,l,0,0,a,1);f();var c=function(){if(T.scrollrunning){var e=T.bzscroll.y.getPos();T.setScrollLeft(T.bzscroll.x.getNow()),T.setScrollTop(T.bzscroll.y.getNow()),e<=1?T.timer=u(c):(T.scrollrunning=!1,T.timer=0,T.triggerScrollEnd())}};T.scrollrunning||(T.triggerScrollStart(i,r,e,o,l),T.scrollrunning=!0,T.timer=u(c))},this.cancelScroll=function(){return T.timer&&h(T.timer),T.timer=0,T.bzscroll=!1,T.scrollrunning=!1,T};else this.doScrollLeft=function(e,o){var t=T.getScrollTop();T.doScrollPos(e,t,o)},this.doScrollTop=function(e,o){var t=T.getScrollLeft();T.doScrollPos(t,e,o)},this.doScrollPos=function(e,o,t){var r=e>T.page.maxw?T.page.maxw:e;r<0&&(r=0);var i=o>T.page.maxh?T.page.maxh:o;i<0&&(i=0),T.synched("scroll",function(){T.setScrollTop(i),T.setScrollLeft(r)})},this.cancelScroll=function(){};this.doScrollBy=function(e,o){z(0,e)},this.doScrollLeftBy=function(e,o){z(e,0)},this.doScrollTo=function(e,o){var t=o?Math.round(e*T.scrollratio.y):e;t<0?t=0:t>T.page.maxh&&(t=T.page.maxh),T.cursorfreezed=!1,T.doScrollTop(e)},this.checkContentSize=function(){var e=T.getContentSize();e.h==T.page.h&&e.w==T.page.w||T.resize(!1,e)},T.onscroll=function(e){T.rail.drag||T.cursorfreezed||T.synched("scroll",function(){T.scroll.y=Math.round(T.getScrollTop()/T.scrollratio.y),T.railh&&(T.scroll.x=Math.round(T.getScrollLeft()/T.scrollratio.x)),T.noticeCursor()})},T.bind(T.docscroll,"scroll",T.onscroll),this.doZoomIn=function(e){if(!T.zoomactive){T.zoomactive=!0,T.zoomrestore={style:{}};var o=["position","top","left","zIndex","backgroundColor","marginTop","marginBottom","marginLeft","marginRight"],t=T.win[0].style;for(var r in o){var i=o[r];T.zoomrestore.style[i]=void 0!==t[i]?t[i]:""}T.zoomrestore.style.width=T.win.css("width"),T.zoomrestore.style.height=T.win.css("height"),T.zoomrestore.padding={w:T.win.outerWidth()-T.win.width(),h:T.win.outerHeight()-T.win.height()},N.isios4&&(T.zoomrestore.scrollTop=c.scrollTop(),c.scrollTop(0)),T.win.css({position:N.isios4?"absolute":"fixed",top:0,left:0,zIndex:s+100,margin:0});var n=T.win.css("backgroundColor");return(""===n||/transparent|rgba\(0, 0, 0, 0\)|rgba\(0,0,0,0\)/.test(n))&&T.win.css("backgroundColor","#fff"),T.rail.css({zIndex:s+101}),T.zoom.css({zIndex:s+102}),T.zoom.css("backgroundPosition","0 -18px"),T.resizeZoom(),T.onzoomin&&T.onzoomin.call(T),T.cancelEvent(e)}},this.doZoomOut=function(e){if(T.zoomactive)return T.zoomactive=!1,T.win.css("margin",""),T.win.css(T.zoomrestore.style),N.isios4&&c.scrollTop(T.zoomrestore.scrollTop),T.rail.css({"z-index":T.zindex}),T.zoom.css({"z-index":T.zindex}),T.zoomrestore=!1,T.zoom.css("backgroundPosition","0 0"),T.onResize(),T.onzoomout&&T.onzoomout.call(T),T.cancelEvent(e)},this.doZoom=function(e){return T.zoomactive?T.doZoomOut(e):T.doZoomIn(e)},this.resizeZoom=function(){if(T.zoomactive){var e=T.getScrollTop();T.win.css({width:c.width()-T.zoomrestore.padding.w+"px",height:c.height()-T.zoomrestore.padding.h+"px"}),T.onResize(),T.setScrollTop(Math.min(T.page.maxh,e))}},this.init(),n.nicescroll.push(this)},y=function(e){var o=this;this.nc=e,this.lastx=0,this.lasty=0,this.speedx=0,this.speedy=0,this.lasttime=0,this.steptime=0,this.snapx=!1,this.snapy=!1,this.demulx=0,this.demuly=0,this.lastscrollx=-1,this.lastscrolly=-1,this.chkx=0,this.chky=0,this.timer=0,this.reset=function(e,t){o.stop(),o.steptime=0,o.lasttime=f(),o.speedx=0,o.speedy=0,o.lastx=e,o.lasty=t,o.lastscrollx=-1,o.lastscrolly=-1},this.update=function(e,t){var r=f();o.steptime=r-o.lasttime,o.lasttime=r;var i=t-o.lasty,s=e-o.lastx,n=o.nc.getScrollTop()+i,l=o.nc.getScrollLeft()+s;o.snapx=l<0||l>o.nc.page.maxw,o.snapy=n<0||n>o.nc.page.maxh,o.speedx=s,o.speedy=i,o.lastx=e,o.lasty=t},this.stop=function(){o.nc.unsynched("domomentum2d"),o.timer&&clearTimeout(o.timer),o.timer=0,o.lastscrollx=-1,o.lastscrolly=-1},this.doSnapy=function(e,t){var r=!1;t<0?(t=0,r=!0):t>o.nc.page.maxh&&(t=o.nc.page.maxh,r=!0),e<0?(e=0,r=!0):e>o.nc.page.maxw&&(e=o.nc.page.maxw,r=!0),r?o.nc.doScrollPos(e,t,o.nc.opt.snapbackspeed):o.nc.triggerScrollEnd()},this.doMomentum=function(e){var t=f(),r=e?t+e:o.lasttime,i=o.nc.getScrollLeft(),s=o.nc.getScrollTop(),n=o.nc.page.maxh,l=o.nc.page.maxw;o.speedx=l>0?Math.min(60,o.speedx):0,o.speedy=n>0?Math.min(60,o.speedy):0;var a=r&&t-r<=60;(s<0||s>n||i<0||i>l)&&(a=!1);var c=!(!o.speedy||!a)&&o.speedy,d=!(!o.speedx||!a)&&o.speedx;if(c||d){var u=Math.max(16,o.steptime);if(u>50){var h=u/50;o.speedx*=h,o.speedy*=h,u=50}o.demulxy=0,o.lastscrollx=o.nc.getScrollLeft(),o.chkx=o.lastscrollx,o.lastscrolly=o.nc.getScrollTop(),o.chky=o.lastscrolly;var p=o.lastscrollx,m=o.lastscrolly,g=function(){var e=f()-t>600?.04:.02;o.speedx&&(p=Math.floor(o.lastscrollx-o.speedx*(1-o.demulxy)),o.lastscrollx=p,(p<0||p>l)&&(e=.1)),o.speedy&&(m=Math.floor(o.lastscrolly-o.speedy*(1-o.demulxy)),o.lastscrolly=m,(m<0||m>n)&&(e=.1)),o.demulxy=Math.min(1,o.demulxy+e),o.nc.synched("domomentum2d",function(){if(o.speedx){o.nc.getScrollLeft();o.chkx=p,o.nc.setScrollLeft(p)}if(o.speedy){o.nc.getScrollTop();o.chky=m,o.nc.setScrollTop(m)}o.timer||(o.nc.hideCursor(),o.doSnapy(p,m))}),o.demulxy<1?o.timer=setTimeout(g,u):(o.stop(),o.nc.hideCursor(),o.doSnapy(p,m))};g()}else o.doSnapy(o.nc.getScrollLeft(),o.nc.getScrollTop())}},x=e.fn.scrollTop;e.cssHooks.pageYOffset={get:function(e,o,t){var r=n.data(e,"__nicescroll")||!1;return r&&r.ishwscroll?r.getScrollTop():x.call(e)},set:function(e,o){var t=n.data(e,"__nicescroll")||!1;return t&&t.ishwscroll?t.setScrollTop(parseInt(o)):x.call(e,o),this}},e.fn.scrollTop=function(e){if(void 0===e){var o=!!this[0]&&(n.data(this[0],"__nicescroll")||!1);return o&&o.ishwscroll?o.getScrollTop():x.call(this)}return this.each(function(){var o=n.data(this,"__nicescroll")||!1;o&&o.ishwscroll?o.setScrollTop(parseInt(e)):x.call(n(this),e)})};var S=e.fn.scrollLeft;n.cssHooks.pageXOffset={get:function(e,o,t){var r=n.data(e,"__nicescroll")||!1;return r&&r.ishwscroll?r.getScrollLeft():S.call(e)},set:function(e,o){var t=n.data(e,"__nicescroll")||!1;return t&&t.ishwscroll?t.setScrollLeft(parseInt(o)):S.call(e,o),this}},e.fn.scrollLeft=function(e){if(void 0===e){var o=!!this[0]&&(n.data(this[0],"__nicescroll")||!1);return o&&o.ishwscroll?o.getScrollLeft():S.call(this)}return this.each(function(){var o=n.data(this,"__nicescroll")||!1;o&&o.ishwscroll?o.setScrollLeft(parseInt(e)):S.call(n(this),e)})};var z=function(e){var o=this;if(this.length=0,this.name="nicescrollarray",this.each=function(e){return n.each(o,e),o},this.push=function(e){o[o.length]=e,o.length++},this.eq=function(e){return o[e]},e)for(var t=0;t1?n(e,r):s,i.win=r}!("doc"in i)||"win"in i||(i.win=r);var l=r.data("__nicescroll")||!1;l||(i.doc=i.doc||r,l=new b(i,r),r.data("__nicescroll",l)),t.push(l)}),1===t.length?t[0]:t},a.NiceScroll={getjQuery:function(){return e}},n.nicescroll||(n.nicescroll=new z,n.nicescroll.options=g)}); \ No newline at end of file +/* jquery.nicescroll v 3.7.5-c [DEV REL] - InuYaksa*2017 - MIT - https://nicescroll.areaaperta.com/ */ +!function(e){"function"==typeof define&&define.amd?define(["jquery"],e):"object"==typeof exports?module.exports=e(require("jquery")):e(jQuery)}(function(e){"use strict";var o=!1,t=!1,r=0,i=2e3,s=0,n=e,l=document,a=window,c=n(a),d=[],u=a.requestAnimationFrame||a.webkitRequestAnimationFrame||a.mozRequestAnimationFrame||!1,h=a.cancelAnimationFrame||a.webkitCancelAnimationFrame||a.mozCancelAnimationFrame||!1;if(u)a.cancelAnimationFrame||(h=function(e){});else{var p=0;u=function(e,o){var t=(new Date).getTime(),r=Math.max(0,16-(t-p)),i=a.setTimeout(function(){e(t+r)},r);return p=t+r,i},h=function(e){a.clearTimeout(e)}}var m=a.MutationObserver||a.WebKitMutationObserver||!1,f=Date.now||function(){return(new Date).getTime()},g={zindex:"auto",cursoropacitymin:0,cursoropacitymax:1,cursorcolor:"#424242",cursorwidth:"6px",cursorborder:"1px solid #fff",cursorborderradius:"5px",scrollspeed:40,mousescrollstep:27,touchbehavior:!1,emulatetouch:!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 e=l.currentScript||function(){var e=l.getElementsByTagName("script");return!!e.length&&e[e.length-1]}(),o=e?e.src.split("?")[0]:"";return o.split("/").length>0?o.split("/").slice(0,-1).join("/")+"/":""}(),preventmultitouchscrolling:!0,disablemutationobserver:!1,enableobserver:!0,scrollbarid:!1},v=!1,w=function(){if(v)return v;var e=l.createElement("DIV"),o=e.style,t=navigator.userAgent,r=navigator.platform,i={};return i.haspointerlock="pointerLockElement"in l||"webkitPointerLockElement"in l||"mozPointerLockElement"in l,i.isopera="opera"in a,i.isopera12=i.isopera&&"getUserMedia"in navigator,i.isoperamini="[object OperaMini]"===Object.prototype.toString.call(a.operamini),i.isie="all"in l&&"attachEvent"in e&&!i.isopera,i.isieold=i.isie&&!("msInterpolationMode"in o),i.isie7=i.isie&&!i.isieold&&(!("documentMode"in l)||7===l.documentMode),i.isie8=i.isie&&"documentMode"in l&&8===l.documentMode,i.isie9=i.isie&&"performance"in a&&9===l.documentMode,i.isie10=i.isie&&"performance"in a&&10===l.documentMode,i.isie11="msRequestFullscreen"in e&&l.documentMode>=11,i.ismsedge="msCredentials"in a,i.ismozilla="MozAppearance"in o,i.iswebkit=!i.ismsedge&&"WebkitAppearance"in o,i.ischrome=i.iswebkit&&"chrome"in a,i.ischrome38=i.ischrome&&"touchAction"in o,i.ischrome22=!i.ischrome38&&i.ischrome&&i.haspointerlock,i.ischrome26=!i.ischrome38&&i.ischrome&&"transition"in o,i.cantouch="ontouchstart"in l.documentElement||"ontouchstart"in a,i.hasw3ctouch=(a.PointerEvent||!1)&&(navigator.maxTouchPoints>0||navigator.msMaxTouchPoints>0),i.hasmstouch=!i.hasw3ctouch&&(a.MSPointerEvent||!1),i.ismac=/^mac$/i.test(r),i.isios=i.cantouch&&/iphone|ipad|ipod/i.test(r),i.isios4=i.isios&&!("seal"in Object),i.isios7=i.isios&&"webkitHidden"in l,i.isios8=i.isios&&"hidden"in l,i.isios10=i.isios&&a.Proxy,i.isandroid=/android/i.test(t),i.haseventlistener="addEventListener"in e,i.trstyle=!1,i.hastransform=!1,i.hastranslate3d=!1,i.transitionstyle=!1,i.hastransition=!1,i.transitionend=!1,i.trstyle="transform",i.hastransform="transform"in o||function(){for(var e=["msTransform","webkitTransform","MozTransform","OTransform"],t=0,r=e.length;t0;){if(9==e[0].nodeType)return!1;var o=e.css("zIndex");if(!isNaN(o)&&0!==o)return parseInt(o);e=e.parent()}return!1}function x(e,o,t){var r=e.css(o),i=parseFloat(r);if(isNaN(i)){var s=3==(i=I[r]||0)?t?T.win.outerHeight()-T.win.innerHeight():T.win.outerWidth()-T.win.innerWidth():1;return T.isie8&&i&&(i+=1),s?i:0}return i}function S(e,o,t,r){T._bind(e,o,function(r){var i={original:r=r||a.event,target:r.target||r.srcElement,type:"wheel",deltaMode:"MozMousePixelScroll"==r.type?0:1,deltaX:0,deltaZ:0,preventDefault:function(){return r.preventDefault?r.preventDefault():r.returnValue=!1,!1},stopImmediatePropagation:function(){r.stopImmediatePropagation?r.stopImmediatePropagation():r.cancelBubble=!0}};return"mousewheel"==o?(r.wheelDeltaX&&(i.deltaX=-.025*r.wheelDeltaX),r.wheelDeltaY&&(i.deltaY=-.025*r.wheelDeltaY),!i.deltaY&&!i.deltaX&&(i.deltaY=-.025*r.wheelDelta)):i.deltaY=r.detail,t.call(e,i)},r)}function z(e,o,t,r){T.scrollrunning||(T.newscrolly=T.getScrollTop(),T.newscrollx=T.getScrollLeft(),D=f());var i=f()-D;if(D=f(),i>350?A=1:A+=(2-A)/10,e=e*A|0,o=o*A|0,e){if(r)if(e<0){if(T.getScrollLeft()>=T.page.maxw)return!0}else if(T.getScrollLeft()<=0)return!0;var s=e>0?1:-1;X!==s&&(T.scrollmom&&T.scrollmom.stop(),T.newscrollx=T.getScrollLeft(),X=s),T.lastdeltax-=e}if(o){if(function(){var e=T.getScrollTop();if(o<0){if(e>=T.page.maxh)return!0}else if(e<=0)return!0}()){if(M.nativeparentscrolling&&t&&!T.ispage&&!T.zoomactive)return!0;var n=T.view.h>>1;T.newscrolly<-n?(T.newscrolly=-n,o=-1):T.newscrolly>T.page.maxh+n?(T.newscrolly=T.page.maxh+n,o=1):o=0}var l=o>0?1:-1;B!==l&&(T.scrollmom&&T.scrollmom.stop(),T.newscrolly=T.getScrollTop(),B=l),T.lastdeltay-=o}(o||e)&&T.synched("relativexy",function(){var e=T.lastdeltay+T.newscrolly;T.lastdeltay=0;var o=T.lastdeltax+T.newscrollx;T.lastdeltax=0,T.rail.drag||T.doScrollPos(o,e)})}function k(e,o,t){var r,i;return!(t||!q)||(0===e.deltaMode?(r=-e.deltaX*(M.mousescrollstep/54)|0,i=-e.deltaY*(M.mousescrollstep/54)|0):1===e.deltaMode&&(r=-e.deltaX*M.mousescrollstep*50/80|0,i=-e.deltaY*M.mousescrollstep*50/80|0),o&&M.oneaxismousemode&&0===r&&i&&(r=i,i=0,t&&(r<0?T.getScrollLeft()>=T.page.maxw:T.getScrollLeft()<=0)&&(i=r,r=0)),T.isrtlmode&&(r=-r),z(r,i,t,!0)?void(t&&(q=!0)):(q=!1,e.stopImmediatePropagation(),e.preventDefault()))}var T=this;this.version="3.7.5-c",this.name="nicescroll",this.me=p;var E=n("body"),M=this.opt={doc:E,win:!1};if(n.extend(M,g),M.snapbackspeed=80,e)for(var L in M)void 0!==e[L]&&(M[L]=e[L]);if(M.disablemutationobserver&&(m=!1),this.doc=M.doc,this.iddoc=this.doc&&this.doc[0]?this.doc[0].id||"":"",this.ispage=/^BODY|HTML/.test(M.win?M.win[0].nodeName:this.doc[0].nodeName),this.haswrapper=!1!==M.win,this.win=M.win||(this.ispage?c:this.doc),this.docscroll=this.ispage&&!this.haswrapper?c:this.win,this.body=E,this.viewport=!1,this.isfixed=!1,this.iframe=!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"!=M.autohidemode,this.onmousedown=!1,this.onmouseup=!1,this.onmousemove=!1,this.onmousewheel=!1,this.onkeypress=!1,this.ongesturezoom=!1,this.onclick=!1,this.onscrollstart=!1,this.onscrollend=!1,this.onscrollcancel=!1,this.onzoomin=!1,this.onzoomout=!1,this.view=!1,this.page=!1,this.scroll={x:0,y:0},this.scrollratio={x:0,y:0},this.cursorheight=20,this.scrollvaluemax=0,"auto"==M.rtlmode){var C=this.win[0]==a?this.body:this.win,P=C.css("writing-mode")||C.css("-webkit-writing-mode")||C.css("-ms-writing-mode")||C.css("-moz-writing-mode");"horizontal-tb"==P||"lr-tb"==P||""===P?(this.isrtlmode="rtl"==C.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===M.rtlmode,this.isvertical=!1;if(this.scrollrunning=!1,this.scrollmom=!1,this.observer=!1,this.observerremover=!1,this.observerbody=!1,!1!==M.scrollbarid)this.id=M.scrollbarid;else do{this.id="ascrail"+i++}while(l.getElementById(this.id));this.rail=!1,this.cursor=!1,this.cursorfreezed=!1,this.selectiondrag=!1,this.zoom=!1,this.zoomactive=!1,this.hasfocus=!1,this.hasmousefocus=!1,this.railslocked=!1,this.locked=!1,this.hidden=!1,this.cursoractive=!0,this.wheelprevented=!1,this.overflowx=M.overflowx,this.overflowy=M.overflowy,this.nativescrollingarea=!1,this.checkarea=0,this.events=[],this.saved={},this.delaylist={},this.synclist={},this.lastdeltax=0,this.lastdeltay=0,this.detected=w();var N=n.extend({},this.detected);this.canhwscroll=N.hastransform&&M.hwacceleration,this.ishwscroll=this.canhwscroll&&T.haswrapper,this.isrtlmode?this.isvertical?this.hasreversehr=!(N.iswebkit||N.isie||N.isie11):this.hasreversehr=!(N.iswebkit||N.isie&&!N.isie10&&!N.isie11):this.hasreversehr=!1,this.istouchcapable=!1,N.cantouch||!N.hasw3ctouch&&!N.hasmstouch?!N.cantouch||N.isios||N.isandroid||!N.iswebkit&&!N.ismozilla||(this.istouchcapable=!0):this.istouchcapable=!0,M.enablemouselockapi||(N.hasmousecapture=!1,N.haspointerlock=!1),this.debounced=function(e,o,t){T&&(T.delaylist[e]||!1||(T.delaylist[e]={h:u(function(){T.delaylist[e].fn.call(T),T.delaylist[e]=!1},t)},o.call(T)),T.delaylist[e].fn=o)},this.synched=function(e,o){T.synclist[e]?T.synclist[e]=o:(T.synclist[e]=o,u(function(){T&&(T.synclist[e]&&T.synclist[e].call(T),T.synclist[e]=null)}))},this.unsynched=function(e){T.synclist[e]&&(T.synclist[e]=!1)},this.css=function(e,o){for(var t in o)T.saved.css.push([e,t,e.css(t)]),e.css(t,o[t])},this.scrollTop=function(e){return void 0===e?T.getScrollTop():T.setScrollTop(e)},this.scrollLeft=function(e){return void 0===e?T.getScrollLeft():T.setScrollLeft(e)};var R=function(e,o,t,r,i,s,n){this.st=e,this.ed=o,this.spd=t,this.p1=r||0,this.p2=i||1,this.p3=s||0,this.p4=n||1,this.ts=f(),this.df=o-e};if(R.prototype={B2:function(e){return 3*(1-e)*(1-e)*e},B3:function(e){return 3*(1-e)*e*e},B4:function(e){return e*e*e},getPos:function(){return(f()-this.ts)/this.spd},getNow:function(){var e=(f()-this.ts)/this.spd,o=this.B2(e)+this.B3(e)+this.B4(e);return e>=1?this.ed:this.st+this.df*o|0},update:function(e,o){return this.st=this.getNow(),this.ed=e,this.spd=o,this.ts=f(),this.df=this.ed-this.st,this}},this.ishwscroll){this.doc.translate={x:0,y:0,tx:"0px",ty:"0px"},N.hastranslate3d&&N.isios&&this.doc.css("-webkit-backface-visibility","hidden"),this.getScrollTop=function(e){if(!e){var o=v();if(o)return 16==o.length?-o[13]:-o[5];if(T.timerscroll&&T.timerscroll.bz)return T.timerscroll.bz.getNow()}return T.doc.translate.y},this.getScrollLeft=function(e){if(!e){var o=v();if(o)return 16==o.length?-o[12]:-o[4];if(T.timerscroll&&T.timerscroll.bh)return T.timerscroll.bh.getNow()}return T.doc.translate.x},this.notifyScrollEvent=function(e){var o=l.createEvent("UIEvents");o.initUIEvent("scroll",!1,!1,a,1),o.niceevent=!0,e.dispatchEvent(o)};var _=this.isrtlmode?1:-1;N.hastranslate3d&&M.enabletranslate3d?(this.setScrollTop=function(e,o){T.doc.translate.y=e,T.doc.translate.ty=-1*e+"px",T.doc.css(N.trstyle,"translate3d("+T.doc.translate.tx+","+T.doc.translate.ty+",0)"),o||T.notifyScrollEvent(T.win[0])},this.setScrollLeft=function(e,o){T.doc.translate.x=e,T.doc.translate.tx=e*_+"px",T.doc.css(N.trstyle,"translate3d("+T.doc.translate.tx+","+T.doc.translate.ty+",0)"),o||T.notifyScrollEvent(T.win[0])}):(this.setScrollTop=function(e,o){T.doc.translate.y=e,T.doc.translate.ty=-1*e+"px",T.doc.css(N.trstyle,"translate("+T.doc.translate.tx+","+T.doc.translate.ty+")"),o||T.notifyScrollEvent(T.win[0])},this.setScrollLeft=function(e,o){T.doc.translate.x=e,T.doc.translate.tx=e*_+"px",T.doc.css(N.trstyle,"translate("+T.doc.translate.tx+","+T.doc.translate.ty+")"),o||T.notifyScrollEvent(T.win[0])})}else this.getScrollTop=function(){return T.docscroll.scrollTop()},this.setScrollTop=function(e){T.docscroll.scrollTop(e)},this.getScrollLeft=function(){return T.hasreversehr?T.detected.ismozilla?T.page.maxw-Math.abs(T.docscroll.scrollLeft()):T.page.maxw-T.docscroll.scrollLeft():T.docscroll.scrollLeft()},this.setScrollLeft=function(e){return setTimeout(function(){if(T)return T.hasreversehr&&(e=T.detected.ismozilla?-(T.page.maxw-e):T.page.maxw-e),T.docscroll.scrollLeft(e)},1)};this.getTarget=function(e){return!!e&&(e.target?e.target:!!e.srcElement&&e.srcElement)},this.hasParent=function(e,o){if(!e)return!1;for(var t=e.target||e.srcElement||e||!1;t&&t.id!=o;)t=t.parentNode||!1;return!1!==t};var I={thin:1,medium:3,thick:5};this.getDocumentScrollOffset=function(){return{top:a.pageYOffset||l.documentElement.scrollTop,left:a.pageXOffset||l.documentElement.scrollLeft}},this.getOffset=function(){if(T.isfixed){var e=T.win.offset(),o=T.getDocumentScrollOffset();return e.top-=o.top,e.left-=o.left,e}var t=T.win.offset();if(!T.viewport)return t;var r=T.viewport.offset();return{top:t.top-r.top,left:t.left-r.left}},this.updateScrollBar=function(e){var o,t;if(T.ishwscroll)T.rail.css({height:T.win.innerHeight()-(M.railpadding.top+M.railpadding.bottom)}),T.railh&&T.railh.css({width:T.win.innerWidth()-(M.railpadding.left+M.railpadding.right)});else{var r=T.getOffset();if(o={top:r.top,left:r.left-(M.railpadding.left+M.railpadding.right)},o.top+=x(T.win,"border-top-width",!0),o.left+=T.rail.align?T.win.outerWidth()-x(T.win,"border-right-width")-T.rail.width:x(T.win,"border-left-width"),(t=M.railoffset)&&(t.top&&(o.top+=t.top),t.left&&(o.left+=t.left)),T.railslocked||T.rail.css({top:o.top,left:o.left,height:(e?e.h:T.win.innerHeight())-(M.railpadding.top+M.railpadding.bottom)}),T.zoom&&T.zoom.css({top:o.top+1,left:1==T.rail.align?o.left-20:o.left+T.rail.width+4}),T.railh&&!T.railslocked){o={top:r.top,left:r.left},(t=M.railhoffset)&&(t.top&&(o.top+=t.top),t.left&&(o.left+=t.left));var i=T.railh.align?o.top+x(T.win,"border-top-width",!0)+T.win.innerHeight()-T.railh.height:o.top+x(T.win,"border-top-width",!0),s=o.left+x(T.win,"border-left-width");T.railh.css({top:i-(M.railpadding.top+M.railpadding.bottom),left:s,width:T.railh.width})}}},this.doRailClick=function(e,o,t){var r,i,s,n;T.railslocked||(T.cancelEvent(e),"pageY"in e||(e.pageX=e.clientX+l.documentElement.scrollLeft,e.pageY=e.clientY+l.documentElement.scrollTop),o?(r=t?T.doScrollLeft:T.doScrollTop,s=t?(e.pageX-T.railh.offset().left-T.cursorwidth/2)*T.scrollratio.x:(e.pageY-T.rail.offset().top-T.cursorheight/2)*T.scrollratio.y,T.unsynched("relativexy"),r(0|s)):(r=t?T.doScrollLeftBy:T.doScrollBy,s=t?T.scroll.x:T.scroll.y,n=t?e.pageX-T.railh.offset().left:e.pageY-T.rail.offset().top,i=t?T.view.w:T.view.h,r(s>=n?i:-i)))},T.newscrolly=T.newscrollx=0,T.hasanimationframe="requestAnimationFrame"in a,T.hascancelanimationframe="cancelAnimationFrame"in a,T.hasborderbox=!1,this.init=function(){if(T.saved.css=[],N.isoperamini)return!0;if(N.isandroid&&!("hidden"in l))return!0;M.emulatetouch=M.emulatetouch||M.touchbehavior,T.hasborderbox=a.getComputedStyle&&"border-box"===a.getComputedStyle(l.body)["box-sizing"];var e={"overflow-y":"hidden"};if((N.isie11||N.isie10)&&(e["-ms-overflow-style"]="none"),T.ishwscroll&&(this.doc.css(N.transitionstyle,N.prefixstyle+"transform 0ms ease-out"),N.transitionend&&T.bind(T.doc,N.transitionend,T.onScrollTransitionEnd,!1)),T.zindex="auto",T.ispage||"auto"!=M.zindex?T.zindex=M.zindex:T.zindex=b()||"auto",!T.ispage&&"auto"!=T.zindex&&T.zindex>s&&(s=T.zindex),T.isie&&0===T.zindex&&"auto"==M.zindex&&(T.zindex="auto"),!T.ispage||!N.isieold){var i=T.docscroll;T.ispage&&(i=T.haswrapper?T.win:T.doc),T.css(i,e),T.ispage&&(N.isie11||N.isie)&&T.css(n("html"),e),!N.isios||T.ispage||T.haswrapper||T.css(E,{"-webkit-overflow-scrolling":"touch"});var d=n(l.createElement("div"));d.css({position:"relative",top:0,float:"right",width:M.cursorwidth,height:0,"background-color":M.cursorcolor,border:M.cursorborder,"background-clip":"padding-box","-webkit-border-radius":M.cursorborderradius,"-moz-border-radius":M.cursorborderradius,"border-radius":M.cursorborderradius}),d.addClass("nicescroll-cursors"),T.cursor=d;var u=n(l.createElement("div"));u.attr("id",T.id),u.addClass("nicescroll-rails nicescroll-rails-vr");var h,p,f=["left","right","top","bottom"];for(var g in f)p=f[g],(h=M.railpadding[p]||0)&&u.css("padding-"+p,h+"px");u.append(d),u.width=Math.max(parseFloat(M.cursorwidth),d.outerWidth()),u.css({width:u.width+"px",zIndex:T.zindex,background:M.background,cursor:"default"}),u.visibility=!0,u.scrollable=!0,u.align="left"==M.railalign?0:1,T.rail=u,T.rail.drag=!1;var v=!1;!M.boxzoom||T.ispage||N.isieold||(v=l.createElement("div"),T.bind(v,"click",T.doZoom),T.bind(v,"mouseenter",function(){T.zoom.css("opacity",M.cursoropacitymax)}),T.bind(v,"mouseleave",function(){T.zoom.css("opacity",M.cursoropacitymin)}),T.zoom=n(v),T.zoom.css({cursor:"pointer",zIndex:T.zindex,backgroundImage:"url("+M.scriptpath+"zoomico.png)",height:18,width:18,backgroundPosition:"0 0"}),M.dblclickzoom&&T.bind(T.win,"dblclick",T.doZoom),N.cantouch&&M.gesturezoom&&(T.ongesturezoom=function(e){return e.scale>1.5&&T.doZoomIn(e),e.scale<.8&&T.doZoomOut(e),T.cancelEvent(e)},T.bind(T.win,"gestureend",T.ongesturezoom))),T.railh=!1;var w;if(M.horizrailenabled&&(T.css(i,{overflowX:"hidden"}),(d=n(l.createElement("div"))).css({position:"absolute",top:0,height:M.cursorwidth,width:0,backgroundColor:M.cursorcolor,border:M.cursorborder,backgroundClip:"padding-box","-webkit-border-radius":M.cursorborderradius,"-moz-border-radius":M.cursorborderradius,"border-radius":M.cursorborderradius}),N.isieold&&d.css("overflow","hidden"),d.addClass("nicescroll-cursors"),T.cursorh=d,(w=n(l.createElement("div"))).attr("id",T.id+"-hr"),w.addClass("nicescroll-rails nicescroll-rails-hr"),w.height=Math.max(parseFloat(M.cursorwidth),d.outerHeight()),w.css({height:w.height+"px",zIndex:T.zindex,background:M.background}),w.append(d),w.visibility=!0,w.scrollable=!0,w.align="top"==M.railvalign?0:1,T.railh=w,T.railh.drag=!1),T.ispage)u.css({position:"fixed",top:0,height:"100%"}),u.css(u.align?{right:0}:{left:0}),T.body.append(u),T.railh&&(w.css({position:"fixed",left:0,width:"100%"}),w.css(w.align?{bottom:0}:{top:0}),T.body.append(w));else{if(T.ishwscroll){"static"==T.win.css("position")&&T.css(T.win,{position:"relative"});var x="HTML"==T.win[0].nodeName?T.body:T.win;n(x).scrollTop(0).scrollLeft(0),T.zoom&&(T.zoom.css({position:"absolute",top:1,right:0,"margin-right":u.width+4}),x.append(T.zoom)),u.css({position:"absolute",top:0}),u.css(u.align?{right:0}:{left:0}),x.append(u),w&&(w.css({position:"absolute",left:0,bottom:0}),w.css(w.align?{bottom:0}:{top:0}),x.append(w))}else{T.isfixed="fixed"==T.win.css("position");var S=T.isfixed?"fixed":"absolute";T.isfixed||(T.viewport=T.getViewport(T.win[0])),T.viewport&&(T.body=T.viewport,/fixed|absolute/.test(T.viewport.css("position"))||T.css(T.viewport,{position:"relative"})),u.css({position:S}),T.zoom&&T.zoom.css({position:S}),T.updateScrollBar(),T.body.append(u),T.zoom&&T.body.append(T.zoom),T.railh&&(w.css({position:S}),T.body.append(w))}N.isios&&T.css(T.win,{"-webkit-tap-highlight-color":"rgba(0,0,0,0)","-webkit-touch-callout":"none"}),M.disableoutline&&(N.isie&&T.win.attr("hideFocus","true"),N.iswebkit&&T.win.css("outline","none"))}if(!1===M.autohidemode?(T.autohidedom=!1,T.rail.css({opacity:M.cursoropacitymax}),T.railh&&T.railh.css({opacity:M.cursoropacitymax})):!0===M.autohidemode||"leave"===M.autohidemode?(T.autohidedom=n().add(T.rail),N.isie8&&(T.autohidedom=T.autohidedom.add(T.cursor)),T.railh&&(T.autohidedom=T.autohidedom.add(T.railh)),T.railh&&N.isie8&&(T.autohidedom=T.autohidedom.add(T.cursorh))):"scroll"==M.autohidemode?(T.autohidedom=n().add(T.rail),T.railh&&(T.autohidedom=T.autohidedom.add(T.railh))):"cursor"==M.autohidemode?(T.autohidedom=n().add(T.cursor),T.railh&&(T.autohidedom=T.autohidedom.add(T.cursorh))):"hidden"==M.autohidemode&&(T.autohidedom=!1,T.hide(),T.railslocked=!1),N.cantouch||T.istouchcapable||M.emulatetouch||N.hasmstouch){T.scrollmom=new y(T);T.ontouchstart=function(e){if(T.locked)return!1;if(e.pointerType&&("mouse"===e.pointerType||e.pointerType===e.MSPOINTER_TYPE_MOUSE))return!1;if(T.hasmoving=!1,T.scrollmom.timer&&(T.triggerScrollEnd(),T.scrollmom.stop()),!T.railslocked){var o=T.getTarget(e);if(o&&/INPUT/i.test(o.nodeName)&&/range/i.test(o.type))return T.stopPropagation(e);var t="mousedown"===e.type;if(!("clientX"in e)&&"changedTouches"in e&&(e.clientX=e.changedTouches[0].clientX,e.clientY=e.changedTouches[0].clientY),T.forcescreen){var r=e;(e={original:e.original?e.original:e}).clientX=r.screenX,e.clientY=r.screenY}if(T.rail.drag={x:e.clientX,y:e.clientY,sx:T.scroll.x,sy:T.scroll.y,st:T.getScrollTop(),sl:T.getScrollLeft(),pt:2,dl:!1,tg:o},T.ispage||!M.directionlockdeadzone)T.rail.drag.dl="f";else{var i={w:c.width(),h:c.height()},s=T.getContentSize(),l=s.h-i.h,a=s.w-i.w;T.rail.scrollable&&!T.railh.scrollable?T.rail.drag.ck=l>0&&"v":!T.rail.scrollable&&T.railh.scrollable?T.rail.drag.ck=a>0&&"h":T.rail.drag.ck=!1}if(M.emulatetouch&&T.isiframe&&N.isie){var d=T.win.position();T.rail.drag.x+=d.left,T.rail.drag.y+=d.top}if(T.hasmoving=!1,T.lastmouseup=!1,T.scrollmom.reset(e.clientX,e.clientY),o&&t){if(!/INPUT|SELECT|BUTTON|TEXTAREA/i.test(o.nodeName))return N.hasmousecapture&&o.setCapture(),M.emulatetouch?(o.onclick&&!o._onclick&&(o._onclick=o.onclick,o.onclick=function(e){if(T.hasmoving)return!1;o._onclick.call(this,e)}),T.cancelEvent(e)):T.stopPropagation(e);/SUBMIT|CANCEL|BUTTON/i.test(n(o).attr("type"))&&(T.preventclick={tg:o,click:!1})}}},T.ontouchend=function(e){if(!T.rail.drag)return!0;if(2==T.rail.drag.pt){if(e.pointerType&&("mouse"===e.pointerType||e.pointerType===e.MSPOINTER_TYPE_MOUSE))return!1;T.rail.drag=!1;var o="mouseup"===e.type;if(T.hasmoving&&(T.scrollmom.doMomentum(),T.lastmouseup=!0,T.hideCursor(),N.hasmousecapture&&l.releaseCapture(),o))return T.cancelEvent(e)}else if(1==T.rail.drag.pt)return T.onmouseup(e)};var z=M.emulatetouch&&T.isiframe&&!N.hasmousecapture,k=.3*M.directionlockdeadzone|0;T.ontouchmove=function(e,o){if(!T.rail.drag)return!0;if(e.targetTouches&&M.preventmultitouchscrolling&&e.targetTouches.length>1)return!0;if(e.pointerType&&("mouse"===e.pointerType||e.pointerType===e.MSPOINTER_TYPE_MOUSE))return!0;if(2==T.rail.drag.pt){"changedTouches"in e&&(e.clientX=e.changedTouches[0].clientX,e.clientY=e.changedTouches[0].clientY);var t,r;if(r=t=0,z&&!o){var i=T.win.position();r=-i.left,t=-i.top}var s=e.clientY+t,n=s-T.rail.drag.y,a=e.clientX+r,c=a-T.rail.drag.x,d=T.rail.drag.st-n;if(T.ishwscroll&&M.bouncescroll)d<0?d=Math.round(d/2):d>T.page.maxh&&(d=T.page.maxh+Math.round((d-T.page.maxh)/2));else if(d<0?(d=0,s=0):d>T.page.maxh&&(d=T.page.maxh,s=0),0===s&&!T.hasmoving)return T.ispage||(T.rail.drag=!1),!0;var u=T.getScrollLeft();if(T.railh&&T.railh.scrollable&&(u=T.isrtlmode?c-T.rail.drag.sl:T.rail.drag.sl-c,T.ishwscroll&&M.bouncescroll?u<0?u=Math.round(u/2):u>T.page.maxw&&(u=T.page.maxw+Math.round((u-T.page.maxw)/2)):(u<0&&(u=0,a=0),u>T.page.maxw&&(u=T.page.maxw,a=0))),!T.hasmoving){if(T.rail.drag.y===e.clientY&&T.rail.drag.x===e.clientX)return T.cancelEvent(e);var h=Math.abs(n),p=Math.abs(c),m=M.directionlockdeadzone;if(T.rail.drag.ck?"v"==T.rail.drag.ck?p>m&&h<=k?T.rail.drag=!1:h>m&&(T.rail.drag.dl="v"):"h"==T.rail.drag.ck&&(h>m&&p<=k?T.rail.drag=!1:p>m&&(T.rail.drag.dl="h")):h>m&&p>m?T.rail.drag.dl="f":h>m?T.rail.drag.dl=p>k?"f":"v":p>m&&(T.rail.drag.dl=h>k?"f":"h"),!T.rail.drag.dl)return T.cancelEvent(e);T.triggerScrollStart(e.clientX,e.clientY,0,0,0),T.hasmoving=!0}return T.preventclick&&!T.preventclick.click&&(T.preventclick.click=T.preventclick.tg.onclick||!1,T.preventclick.tg.onclick=T.onpreventclick),T.rail.drag.dl&&("v"==T.rail.drag.dl?u=T.rail.drag.sl:"h"==T.rail.drag.dl&&(d=T.rail.drag.st)),T.synched("touchmove",function(){T.rail.drag&&2==T.rail.drag.pt&&(T.prepareTransition&&T.resetTransition(),T.rail.scrollable&&T.setScrollTop(d),T.scrollmom.update(a,s),T.railh&&T.railh.scrollable?(T.setScrollLeft(u),T.showCursor(d,u)):T.showCursor(d),N.isie10&&l.selection.clear())}),T.cancelEvent(e)}return 1==T.rail.drag.pt?T.onmousemove(e):void 0},T.ontouchstartCursor=function(e,o){if(!T.rail.drag||3==T.rail.drag.pt){if(T.locked)return T.cancelEvent(e);T.cancelScroll(),T.rail.drag={x:e.touches[0].clientX,y:e.touches[0].clientY,sx:T.scroll.x,sy:T.scroll.y,pt:3,hr:!!o};var t=T.getTarget(e);return!T.ispage&&N.hasmousecapture&&t.setCapture(),T.isiframe&&!N.hasmousecapture&&(T.saved.csspointerevents=T.doc.css("pointer-events"),T.css(T.doc,{"pointer-events":"none"})),T.cancelEvent(e)}},T.ontouchendCursor=function(e){if(T.rail.drag){if(N.hasmousecapture&&l.releaseCapture(),T.isiframe&&!N.hasmousecapture&&T.doc.css("pointer-events",T.saved.csspointerevents),3!=T.rail.drag.pt)return;return T.rail.drag=!1,T.cancelEvent(e)}},T.ontouchmoveCursor=function(e){if(T.rail.drag){if(3!=T.rail.drag.pt)return;if(T.cursorfreezed=!0,T.rail.drag.hr){T.scroll.x=T.rail.drag.sx+(e.touches[0].clientX-T.rail.drag.x),T.scroll.x<0&&(T.scroll.x=0);var o=T.scrollvaluemaxw;T.scroll.x>o&&(T.scroll.x=o)}else{T.scroll.y=T.rail.drag.sy+(e.touches[0].clientY-T.rail.drag.y),T.scroll.y<0&&(T.scroll.y=0);var t=T.scrollvaluemax;T.scroll.y>t&&(T.scroll.y=t)}return T.synched("touchmove",function(){T.rail.drag&&3==T.rail.drag.pt&&(T.showCursor(),T.rail.drag.hr?T.doScrollLeft(Math.round(T.scroll.x*T.scrollratio.x),M.cursordragspeed):T.doScrollTop(Math.round(T.scroll.y*T.scrollratio.y),M.cursordragspeed))}),T.cancelEvent(e)}}}if(T.onmousedown=function(e,o){if(!T.rail.drag||1==T.rail.drag.pt){if(T.railslocked)return T.cancelEvent(e);T.cancelScroll(),T.rail.drag={x:e.clientX,y:e.clientY,sx:T.scroll.x,sy:T.scroll.y,pt:1,hr:o||!1};var t=T.getTarget(e);return N.hasmousecapture&&t.setCapture(),T.isiframe&&!N.hasmousecapture&&(T.saved.csspointerevents=T.doc.css("pointer-events"),T.css(T.doc,{"pointer-events":"none"})),T.hasmoving=!1,T.cancelEvent(e)}},T.onmouseup=function(e){if(T.rail.drag)return 1!=T.rail.drag.pt||(N.hasmousecapture&&l.releaseCapture(),T.isiframe&&!N.hasmousecapture&&T.doc.css("pointer-events",T.saved.csspointerevents),T.rail.drag=!1,T.cursorfreezed=!1,T.hasmoving&&T.triggerScrollEnd(),T.cancelEvent(e))},T.onmousemove=function(e){if(T.rail.drag){if(1!==T.rail.drag.pt)return;if(N.ischrome&&0===e.which)return T.onmouseup(e);if(T.cursorfreezed=!0,T.hasmoving||T.triggerScrollStart(e.clientX,e.clientY,0,0,0),T.hasmoving=!0,T.rail.drag.hr){T.scroll.x=T.rail.drag.sx+(e.clientX-T.rail.drag.x),T.scroll.x<0&&(T.scroll.x=0);var o=T.scrollvaluemaxw;T.scroll.x>o&&(T.scroll.x=o)}else{T.scroll.y=T.rail.drag.sy+(e.clientY-T.rail.drag.y),T.scroll.y<0&&(T.scroll.y=0);var t=T.scrollvaluemax;T.scroll.y>t&&(T.scroll.y=t)}return T.synched("mousemove",function(){T.cursorfreezed&&(T.showCursor(),T.rail.drag.hr?T.scrollLeft(Math.round(T.scroll.x*T.scrollratio.x)):T.scrollTop(Math.round(T.scroll.y*T.scrollratio.y)))}),T.cancelEvent(e)}T.checkarea=0},N.cantouch||M.emulatetouch)T.onpreventclick=function(e){if(T.preventclick)return T.preventclick.tg.onclick=T.preventclick.click,T.preventclick=!1,T.cancelEvent(e)},T.onclick=!N.isios&&function(e){return!T.lastmouseup||(T.lastmouseup=!1,T.cancelEvent(e))},M.grabcursorenabled&&N.cursorgrabvalue&&(T.css(T.ispage?T.doc:T.win,{cursor:N.cursorgrabvalue}),T.css(T.rail,{cursor:N.cursorgrabvalue}));else{var L=function(e){if(T.selectiondrag){if(e){var o=T.win.outerHeight(),t=e.pageY-T.selectiondrag.top;t>0&&t=o&&(t-=o),T.selectiondrag.df=t}if(0!==T.selectiondrag.df){var r=-2*T.selectiondrag.df/6|0;T.doScrollBy(r),T.debounced("doselectionscroll",function(){L()},50)}}};T.hasTextSelected="getSelection"in l?function(){return l.getSelection().rangeCount>0}:"selection"in l?function(){return"None"!=l.selection.type}:function(){return!1},T.onselectionstart=function(e){T.ispage||(T.selectiondrag=T.win.offset())},T.onselectionend=function(e){T.selectiondrag=!1},T.onselectiondrag=function(e){T.selectiondrag&&T.hasTextSelected()&&T.debounced("selectionscroll",function(){L(e)},250)}}if(N.hasw3ctouch?(T.css(T.ispage?n("html"):T.win,{"touch-action":"none"}),T.css(T.rail,{"touch-action":"none"}),T.css(T.cursor,{"touch-action":"none"}),T.bind(T.win,"pointerdown",T.ontouchstart),T.bind(l,"pointerup",T.ontouchend),T.delegate(l,"pointermove",T.ontouchmove)):N.hasmstouch?(T.css(T.ispage?n("html"):T.win,{"-ms-touch-action":"none"}),T.css(T.rail,{"-ms-touch-action":"none"}),T.css(T.cursor,{"-ms-touch-action":"none"}),T.bind(T.win,"MSPointerDown",T.ontouchstart),T.bind(l,"MSPointerUp",T.ontouchend),T.delegate(l,"MSPointerMove",T.ontouchmove),T.bind(T.cursor,"MSGestureHold",function(e){e.preventDefault()}),T.bind(T.cursor,"contextmenu",function(e){e.preventDefault()})):N.cantouch&&(T.bind(T.win,"touchstart",T.ontouchstart,!1,!0),T.bind(l,"touchend",T.ontouchend,!1,!0),T.bind(l,"touchcancel",T.ontouchend,!1,!0),T.delegate(l,"touchmove",T.ontouchmove,!1,!0)),M.emulatetouch&&(T.bind(T.win,"mousedown",T.ontouchstart,!1,!0),T.bind(l,"mouseup",T.ontouchend,!1,!0),T.bind(l,"mousemove",T.ontouchmove,!1,!0)),(M.cursordragontouch||!N.cantouch&&!M.emulatetouch)&&(T.rail.css({cursor:"default"}),T.railh&&T.railh.css({cursor:"default"}),T.jqbind(T.rail,"mouseenter",function(){if(!T.ispage&&!T.win.is(":visible"))return!1;T.canshowonmouseevent&&T.showCursor(),T.rail.active=!0}),T.jqbind(T.rail,"mouseleave",function(){T.rail.active=!1,T.rail.drag||T.hideCursor()}),M.sensitiverail&&(T.bind(T.rail,"click",function(e){T.doRailClick(e,!1,!1)}),T.bind(T.rail,"dblclick",function(e){T.doRailClick(e,!0,!1)}),T.bind(T.cursor,"click",function(e){T.cancelEvent(e)}),T.bind(T.cursor,"dblclick",function(e){T.cancelEvent(e)})),T.railh&&(T.jqbind(T.railh,"mouseenter",function(){if(!T.ispage&&!T.win.is(":visible"))return!1;T.canshowonmouseevent&&T.showCursor(),T.rail.active=!0}),T.jqbind(T.railh,"mouseleave",function(){T.rail.active=!1,T.rail.drag||T.hideCursor()}),M.sensitiverail&&(T.bind(T.railh,"click",function(e){T.doRailClick(e,!1,!0)}),T.bind(T.railh,"dblclick",function(e){T.doRailClick(e,!0,!0)}),T.bind(T.cursorh,"click",function(e){T.cancelEvent(e)}),T.bind(T.cursorh,"dblclick",function(e){T.cancelEvent(e)})))),M.cursordragontouch&&(this.istouchcapable||N.cantouch)&&(T.bind(T.cursor,"touchstart",T.ontouchstartCursor),T.bind(T.cursor,"touchmove",T.ontouchmoveCursor),T.bind(T.cursor,"touchend",T.ontouchendCursor),T.cursorh&&T.bind(T.cursorh,"touchstart",function(e){T.ontouchstartCursor(e,!0)}),T.cursorh&&T.bind(T.cursorh,"touchmove",T.ontouchmoveCursor),T.cursorh&&T.bind(T.cursorh,"touchend",T.ontouchendCursor)),M.emulatetouch||N.isandroid||N.isios?(T.bind(N.hasmousecapture?T.win:l,"mouseup",T.ontouchend),T.onclick&&T.bind(l,"click",T.onclick),M.cursordragontouch?(T.bind(T.cursor,"mousedown",T.onmousedown),T.bind(T.cursor,"mouseup",T.onmouseup),T.cursorh&&T.bind(T.cursorh,"mousedown",function(e){T.onmousedown(e,!0)}),T.cursorh&&T.bind(T.cursorh,"mouseup",T.onmouseup)):(T.bind(T.rail,"mousedown",function(e){e.preventDefault()}),T.railh&&T.bind(T.railh,"mousedown",function(e){e.preventDefault()}))):(T.bind(N.hasmousecapture?T.win:l,"mouseup",T.onmouseup),T.bind(l,"mousemove",T.onmousemove),T.onclick&&T.bind(l,"click",T.onclick),T.bind(T.cursor,"mousedown",T.onmousedown),T.bind(T.cursor,"mouseup",T.onmouseup),T.railh&&(T.bind(T.cursorh,"mousedown",function(e){T.onmousedown(e,!0)}),T.bind(T.cursorh,"mouseup",T.onmouseup)),!T.ispage&&M.enablescrollonselection&&(T.bind(T.win[0],"mousedown",T.onselectionstart),T.bind(l,"mouseup",T.onselectionend),T.bind(T.cursor,"mouseup",T.onselectionend),T.cursorh&&T.bind(T.cursorh,"mouseup",T.onselectionend),T.bind(l,"mousemove",T.onselectiondrag)),T.zoom&&(T.jqbind(T.zoom,"mouseenter",function(){T.canshowonmouseevent&&T.showCursor(),T.rail.active=!0}),T.jqbind(T.zoom,"mouseleave",function(){T.rail.active=!1,T.rail.drag||T.hideCursor()}))),M.enablemousewheel&&(T.isiframe||T.mousewheel(N.isie&&T.ispage?l:T.win,T.onmousewheel),T.mousewheel(T.rail,T.onmousewheel),T.railh&&T.mousewheel(T.railh,T.onmousewheelhr)),T.ispage||N.cantouch||/HTML|^BODY/.test(T.win[0].nodeName)||(T.win.attr("tabindex")||T.win.attr({tabindex:++r}),T.bind(T.win,"focus",function(e){o=T.getTarget(e).id||T.getTarget(e)||!1,T.hasfocus=!0,T.canshowonmouseevent&&T.noticeCursor()}),T.bind(T.win,"blur",function(e){o=!1,T.hasfocus=!1}),T.bind(T.win,"mouseenter",function(e){t=T.getTarget(e).id||T.getTarget(e)||!1,T.hasmousefocus=!0,T.canshowonmouseevent&&T.noticeCursor()}),T.bind(T.win,"mouseleave",function(e){t=!1,T.hasmousefocus=!1,T.rail.drag||T.hideCursor()})),T.onkeypress=function(e){if(T.railslocked&&0===T.page.maxh)return!0;e=e||a.event;var r=T.getTarget(e);if(r&&/INPUT|TEXTAREA|SELECT|OPTION/.test(r.nodeName)&&(!(r.getAttribute("type")||r.type||!1)||!/submit|button|cancel/i.tp))return!0;if(n(r).attr("contenteditable"))return!0;if(T.hasfocus||T.hasmousefocus&&!o||T.ispage&&!o&&!t){var i=e.keyCode;if(T.railslocked&&27!=i)return T.cancelEvent(e);var s=e.ctrlKey||!1,l=e.shiftKey||!1,c=!1;switch(i){case 38:case 63233:T.doScrollBy(72),c=!0;break;case 40:case 63235:T.doScrollBy(-72),c=!0;break;case 37:case 63232:T.railh&&(s?T.doScrollLeft(0):T.doScrollLeftBy(72),c=!0);break;case 39:case 63234:T.railh&&(s?T.doScrollLeft(T.page.maxw):T.doScrollLeftBy(-72),c=!0);break;case 33:case 63276:T.doScrollBy(T.view.h),c=!0;break;case 34:case 63277:T.doScrollBy(-T.view.h),c=!0;break;case 36:case 63273:T.railh&&s?T.doScrollPos(0,0):T.doScrollTo(0),c=!0;break;case 35:case 63275:T.railh&&s?T.doScrollPos(T.page.maxw,T.page.maxh):T.doScrollTo(T.page.maxh),c=!0;break;case 32:M.spacebarenabled&&(l?T.doScrollBy(T.view.h):T.doScrollBy(-T.view.h),c=!0);break;case 27:T.zoomactive&&(T.doZoom(),c=!0)}if(c)return T.cancelEvent(e)}},M.enablekeyboard&&T.bind(l,N.isopera&&!N.isopera12?"keypress":"keydown",T.onkeypress),T.bind(l,"keydown",function(e){(e.ctrlKey||!1)&&(T.wheelprevented=!0)}),T.bind(l,"keyup",function(e){e.ctrlKey||!1||(T.wheelprevented=!1)}),T.bind(a,"blur",function(e){T.wheelprevented=!1}),T.bind(a,"resize",T.onscreenresize),T.bind(a,"orientationchange",T.onscreenresize),T.bind(a,"load",T.lazyResize),N.ischrome&&!T.ispage&&!T.haswrapper){var C=T.win.attr("style"),P=parseFloat(T.win.css("width"))+1;T.win.css("width",P),T.synched("chromefix",function(){T.win.attr("style",C)})}T.onAttributeChange=function(e){T.lazyResize(T.isieold?250:30)},M.enableobserver&&(T.isie11||!1===m||(T.observerbody=new m(function(e){if(e.forEach(function(e){if("attributes"==e.type)return E.hasClass("modal-open")&&E.hasClass("modal-dialog")&&!n.contains(n(".modal-dialog")[0],T.doc[0])?T.hide():T.show()}),T.me.clientWidth!=T.page.width||T.me.clientHeight!=T.page.height)return T.lazyResize(30)}),T.observerbody.observe(l.body,{childList:!0,subtree:!0,characterData:!1,attributes:!0,attributeFilter:["class"]})),T.ispage||T.haswrapper||(!1!==m?(T.observer=new m(function(e){e.forEach(T.onAttributeChange)}),T.observer.observe(T.win[0],{childList:!0,characterData:!1,attributes:!0,subtree:!1}),T.observerremover=new m(function(e){e.forEach(function(e){if(e.removedNodes.length>0)for(var o in e.removedNodes)if(T&&e.removedNodes[o]==T.win[0])return T.remove()})}),T.observerremover.observe(T.win[0].parentNode,{childList:!0,characterData:!1,attributes:!1,subtree:!1})):(T.bind(T.win,N.isie&&!N.isie9?"propertychange":"DOMAttrModified",T.onAttributeChange),N.isie9&&T.win[0].attachEvent("onpropertychange",T.onAttributeChange),T.bind(T.win,"DOMNodeRemoved",function(e){e.target==T.win[0]&&T.remove()})))),!T.ispage&&M.boxzoom&&T.bind(a,"resize",T.resizeZoom),T.istextarea&&(T.bind(T.win,"keydown",T.lazyResize),T.bind(T.win,"mouseup",T.lazyResize)),T.lazyResize(30)}if("IFRAME"==this.doc[0].nodeName){var R=function(){T.iframexd=!1;var o;try{(o="contentDocument"in this?this.contentDocument:this.contentWindow._doc).domain}catch(e){T.iframexd=!0,o=!1}if(T.iframexd)return"console"in a&&console.log("NiceScroll error: policy restriced iframe"),!0;if(T.forcescreen=!0,T.isiframe&&(T.iframe={doc:n(o),html:T.doc.contents().find("html")[0],body:T.doc.contents().find("body")[0]},T.getContentSize=function(){return{w:Math.max(T.iframe.html.scrollWidth,T.iframe.body.scrollWidth),h:Math.max(T.iframe.html.scrollHeight,T.iframe.body.scrollHeight)}},T.docscroll=n(T.iframe.body)),!N.isios&&M.iframeautoresize&&!T.isiframe){T.win.scrollTop(0),T.doc.height("");var t=Math.max(o.getElementsByTagName("html")[0].scrollHeight,o.body.scrollHeight);T.doc.height(t)}T.lazyResize(30),T.css(n(T.iframe.body),e),N.isios&&T.haswrapper&&T.css(n(o.body),{"-webkit-transform":"translate3d(0,0,0)"}),"contentWindow"in this?T.bind(this.contentWindow,"scroll",T.onscroll):T.bind(o,"scroll",T.onscroll),M.enablemousewheel&&T.mousewheel(o,T.onmousewheel),M.enablekeyboard&&T.bind(o,N.isopera?"keypress":"keydown",T.onkeypress),N.cantouch?(T.bind(o,"touchstart",T.ontouchstart),T.bind(o,"touchmove",T.ontouchmove)):M.emulatetouch&&(T.bind(o,"mousedown",T.ontouchstart),T.bind(o,"mousemove",function(e){return T.ontouchmove(e,!0)}),M.grabcursorenabled&&N.cursorgrabvalue&&T.css(n(o.body),{cursor:N.cursorgrabvalue})),T.bind(o,"mouseup",T.ontouchend),T.zoom&&(M.dblclickzoom&&T.bind(o,"dblclick",T.doZoom),T.ongesturezoom&&T.bind(o,"gestureend",T.ongesturezoom))};this.doc[0].readyState&&"complete"===this.doc[0].readyState&&setTimeout(function(){R.call(T.doc[0],!1)},500),T.bind(this.doc,"load",R)}},this.showCursor=function(e,o){if(T.cursortimeout&&(clearTimeout(T.cursortimeout),T.cursortimeout=0),T.rail){if(T.autohidedom&&(T.autohidedom.stop().css({opacity:M.cursoropacitymax}),T.cursoractive=!0),T.rail.drag&&1==T.rail.drag.pt||(void 0!==e&&!1!==e&&(T.scroll.y=e/T.scrollratio.y|0),void 0!==o&&(T.scroll.x=o/T.scrollratio.x|0)),T.cursor.css({height:T.cursorheight,top:T.scroll.y}),T.cursorh){var t=T.hasreversehr?T.scrollvaluemaxw-T.scroll.x:T.scroll.x;T.cursorh.css({width:T.cursorwidth,left:!T.rail.align&&T.rail.visibility?t+T.rail.width:t}),T.cursoractive=!0}T.zoom&&T.zoom.stop().css({opacity:M.cursoropacitymax})}},this.hideCursor=function(e){T.cursortimeout||T.rail&&T.autohidedom&&(T.hasmousefocus&&"leave"===M.autohidemode||(T.cursortimeout=setTimeout(function(){T.rail.active&&T.showonmouseevent||(T.autohidedom.stop().animate({opacity:M.cursoropacitymin}),T.zoom&&T.zoom.stop().animate({opacity:M.cursoropacitymin}),T.cursoractive=!1),T.cursortimeout=0},e||M.hidecursordelay)))},this.noticeCursor=function(e,o,t){T.showCursor(o,t),T.rail.active||T.hideCursor(e)},this.getContentSize=T.ispage?function(){return{w:Math.max(l.body.scrollWidth,l.documentElement.scrollWidth),h:Math.max(l.body.scrollHeight,l.documentElement.scrollHeight)}}:T.haswrapper?function(){return{w:T.doc[0].offsetWidth,h:T.doc[0].offsetHeight}}:function(){return{w:T.docscroll[0].scrollWidth,h:T.docscroll[0].scrollHeight}},this.onResize=function(e,o){if(!T||!T.win)return!1;var t=T.page.maxh,r=T.page.maxw,i=T.view.h,s=T.view.w;if(T.view={w:T.ispage?T.win.width():T.win[0].clientWidth,h:T.ispage?T.win.height():T.win[0].clientHeight},T.page=o||T.getContentSize(),T.page.maxh=Math.max(0,T.page.h-T.view.h),T.page.maxw=Math.max(0,T.page.w-T.view.w),T.page.maxh==t&&T.page.maxw==r&&T.view.w==s&&T.view.h==i){if(T.ispage)return T;var n=T.win.offset();if(T.lastposition){var l=T.lastposition;if(l.top==n.top&&l.left==n.left)return T}T.lastposition=n}return 0===T.page.maxh?(T.hideRail(),T.scrollvaluemax=0,T.scroll.y=0,T.scrollratio.y=0,T.cursorheight=0,T.setScrollTop(0),T.rail&&(T.rail.scrollable=!1)):(T.page.maxh-=M.railpadding.top+M.railpadding.bottom,T.rail.scrollable=!0),0===T.page.maxw?(T.hideRailHr(),T.scrollvaluemaxw=0,T.scroll.x=0,T.scrollratio.x=0,T.cursorwidth=0,T.setScrollLeft(0),T.railh&&(T.railh.scrollable=!1)):(T.page.maxw-=M.railpadding.left+M.railpadding.right,T.railh&&(T.railh.scrollable=M.horizrailenabled)),T.railslocked=T.locked||0===T.page.maxh&&0===T.page.maxw,T.railslocked?(T.ispage||T.updateScrollBar(T.view),!1):(T.hidden||(T.rail.visibility||T.showRail(),T.railh&&!T.railh.visibility&&T.showRailHr()),T.istextarea&&T.win.css("resize")&&"none"!=T.win.css("resize")&&(T.view.h-=20),T.cursorheight=Math.min(T.view.h,Math.round(T.view.h*(T.view.h/T.page.h))),T.cursorheight=M.cursorfixedheight?M.cursorfixedheight:Math.max(M.cursorminheight,T.cursorheight),T.cursorwidth=Math.min(T.view.w,Math.round(T.view.w*(T.view.w/T.page.w))),T.cursorwidth=M.cursorfixedheight?M.cursorfixedheight:Math.max(M.cursorminheight,T.cursorwidth),T.scrollvaluemax=T.view.h-T.cursorheight-(M.railpadding.top+M.railpadding.bottom),T.hasborderbox||(T.scrollvaluemax-=T.cursor[0].offsetHeight-T.cursor[0].clientHeight),T.railh&&(T.railh.width=T.page.maxh>0?T.view.w-T.rail.width:T.view.w,T.scrollvaluemaxw=T.railh.width-T.cursorwidth-(M.railpadding.left+M.railpadding.right)),T.ispage||T.updateScrollBar(T.view),T.scrollratio={x:T.page.maxw/T.scrollvaluemaxw,y:T.page.maxh/T.scrollvaluemax},T.getScrollTop()>T.page.maxh?T.doScrollTop(T.page.maxh):(T.scroll.y=T.getScrollTop()/T.scrollratio.y|0,T.scroll.x=T.getScrollLeft()/T.scrollratio.x|0,T.cursoractive&&T.noticeCursor()),T.scroll.y&&0===T.getScrollTop()&&T.doScrollTo(T.scroll.y*T.scrollratio.y|0),T)},this.resize=T.onResize;var O=0;this.onscreenresize=function(e){clearTimeout(O);var o=!T.ispage&&!T.haswrapper;o&&T.hideRails(),O=setTimeout(function(){T&&(o&&T.showRails(),T.resize()),O=0},120)},this.lazyResize=function(e){return clearTimeout(O),O=setTimeout(function(){T&&T.resize(),O=0},e||240),T},this.jqbind=function(e,o,t){T.events.push({e:e,n:o,f:t,q:!0}),n(e).on(o,t)},this.mousewheel=function(e,o,t){var r="jquery"in e?e[0]:e;if("onwheel"in l.createElement("div"))T._bind(r,"wheel",o,t||!1);else{var i=void 0!==l.onmousewheel?"mousewheel":"DOMMouseScroll";S(r,i,o,t||!1),"DOMMouseScroll"==i&&S(r,"MozMousePixelScroll",o,t||!1)}};var Y=!1;if(N.haseventlistener){try{var H=Object.defineProperty({},"passive",{get:function(){Y=!0}});a.addEventListener("test",null,H)}catch(e){}this.stopPropagation=function(e){return!!e&&((e=e.original?e.original:e).stopPropagation(),!1)},this.cancelEvent=function(e){return e.cancelable&&e.preventDefault(),e.stopImmediatePropagation(),e.preventManipulation&&e.preventManipulation(),!1}}else Event.prototype.preventDefault=function(){this.returnValue=!1},Event.prototype.stopPropagation=function(){this.cancelBubble=!0},a.constructor.prototype.addEventListener=l.constructor.prototype.addEventListener=Element.prototype.addEventListener=function(e,o,t){this.attachEvent("on"+e,o)},a.constructor.prototype.removeEventListener=l.constructor.prototype.removeEventListener=Element.prototype.removeEventListener=function(e,o,t){this.detachEvent("on"+e,o)},this.cancelEvent=function(e){return(e=e||a.event)&&(e.cancelBubble=!0,e.cancel=!0,e.returnValue=!1),!1},this.stopPropagation=function(e){return(e=e||a.event)&&(e.cancelBubble=!0),!1};this.delegate=function(e,o,t,r,i){var s=d[o]||!1;s||(s={a:[],l:[],f:function(e){for(var o=s.l,t=!1,r=o.length-1;r>=0;r--)if(!1===(t=o[r].call(e.target,e)))return!1;return t}},T.bind(e,o,s.f,r,i),d[o]=s),T.ispage?(s.a=[T.id].concat(s.a),s.l=[t].concat(s.l)):(s.a.push(T.id),s.l.push(t))},this.undelegate=function(e,o,t,r,i){var s=d[o]||!1;if(s)for(var n=0,l=s.l.length;n0)return t;o=!!o.parentNode&&o.parentNode}return!1},this.triggerScrollStart=function(e,o,t,r,i){if(T.onscrollstart){var s={type:"scrollstart",current:{x:e,y:o},request:{x:t,y:r},end:{x:T.newscrollx,y:T.newscrolly},speed:i};T.onscrollstart.call(T,s)}},this.triggerScrollEnd=function(){if(T.onscrollend){var e=T.getScrollLeft(),o=T.getScrollTop(),t={type:"scrollend",current:{x:e,y:o},end:{x:e,y:o}};T.onscrollend.call(T,t)}};var B=0,X=0,D=0,A=1,q=!1;if(this.onmousewheel=function(e){if(T.wheelprevented||T.locked)return!1;if(T.railslocked)return T.debounced("checkunlock",T.resize,250),!1;if(T.rail.drag)return T.cancelEvent(e);if("auto"===M.oneaxismousemode&&0!==e.deltaX&&(M.oneaxismousemode=!1),M.oneaxismousemode&&0===e.deltaX&&!T.rail.scrollable)return!T.railh||!T.railh.scrollable||T.onmousewheelhr(e);var o=f(),t=!1;if(M.preservenativescrolling&&T.checkarea+600T.page.maxh&&(o=T.page.maxh+(o-T.page.maxh)/2|0),e<0?e=e/2|0:e>T.page.maxw&&(e=T.page.maxw+(e-T.page.maxw)/2|0)):(o<0?o=0:o>T.page.maxh&&(o=T.page.maxh),e<0?e=0:e>T.page.maxw&&(e=T.page.maxw)),T.scrollrunning&&e==T.newscrollx&&o==T.newscrolly)return!1;T.newscrolly=o,T.newscrollx=e;var s=T.getScrollTop(),n=T.getScrollLeft(),l={};l.x=e-n,l.y=o-s;var a=0|Math.sqrt(l.x*l.x+l.y*l.y),c=T.prepareTransition(a);T.scrollrunning||(T.scrollrunning=!0,T.triggerScrollStart(n,s,e,o,c),T.cursorupdate.start()),T.scrollendtrapped=!0,N.transitionend||(T.scrollendtrapped&&clearTimeout(T.scrollendtrapped),T.scrollendtrapped=setTimeout(T.onScrollTransitionEnd,c)),T.setScrollTop(T.newscrolly),T.setScrollLeft(T.newscrollx)},this.cancelScroll=function(){if(!T.scrollendtrapped)return!0;var e=T.getScrollTop(),o=T.getScrollLeft();return T.scrollrunning=!1,N.transitionend||clearTimeout(N.transitionend),T.scrollendtrapped=!1,T.resetTransition(),T.setScrollTop(e),T.railh&&T.setScrollLeft(o),T.timerscroll&&T.timerscroll.tm&&clearInterval(T.timerscroll.tm),T.timerscroll=!1,T.cursorfreezed=!1,T.cursorupdate.stop(),T.showCursor(e,o),T},this.onScrollTransitionEnd=function(){if(T.scrollendtrapped){var e=T.getScrollTop(),o=T.getScrollLeft();if(e<0?e=0:e>T.page.maxh&&(e=T.page.maxh),o<0?o=0:o>T.page.maxw&&(o=T.page.maxw),e!=T.newscrolly||o!=T.newscrollx)return T.doScrollPos(o,e,M.snapbackspeed);T.scrollrunning&&T.triggerScrollEnd(),T.scrollrunning=!1,T.scrollendtrapped=!1,T.resetTransition(),T.timerscroll=!1,T.setScrollTop(e),T.railh&&T.setScrollLeft(o),T.cursorupdate.stop(),T.noticeCursor(!1,e,o),T.cursorfreezed=!1}}}else this.doScrollLeft=function(e,o){var t=T.scrollrunning?T.newscrolly:T.getScrollTop();T.doScrollPos(e,t,o)},this.doScrollTop=function(e,o){var t=T.scrollrunning?T.newscrollx:T.getScrollLeft();T.doScrollPos(t,e,o)},this.doScrollPos=function(e,o,t){var r=T.getScrollTop(),i=T.getScrollLeft();((T.newscrolly-r)*(o-r)<0||(T.newscrollx-i)*(e-i)<0)&&T.cancelScroll();var s=!1;if(T.bouncescroll&&T.rail.visibility||(o<0?(o=0,s=!0):o>T.page.maxh&&(o=T.page.maxh,s=!0)),T.bouncescroll&&T.railh.visibility||(e<0?(e=0,s=!0):e>T.page.maxw&&(e=T.page.maxw,s=!0)),T.scrollrunning&&T.newscrolly===o&&T.newscrollx===e)return!0;T.newscrolly=o,T.newscrollx=e,T.dst={},T.dst.x=e-i,T.dst.y=o-r,T.dst.px=i,T.dst.py=r;var n=0|Math.sqrt(T.dst.x*T.dst.x+T.dst.y*T.dst.y),l=T.getTransitionSpeed(n);T.bzscroll={};var a=s?1:.58;T.bzscroll.x=new R(i,T.newscrollx,l,0,0,a,1),T.bzscroll.y=new R(r,T.newscrolly,l,0,0,a,1);f();var c=function(){if(T.scrollrunning){var e=T.bzscroll.y.getPos();T.setScrollLeft(T.bzscroll.x.getNow()),T.setScrollTop(T.bzscroll.y.getNow()),e<=1?T.timer=u(c):(T.scrollrunning=!1,T.timer=0,T.triggerScrollEnd())}};T.scrollrunning||(T.triggerScrollStart(i,r,e,o,l),T.scrollrunning=!0,T.timer=u(c))},this.cancelScroll=function(){return T.timer&&h(T.timer),T.timer=0,T.bzscroll=!1,T.scrollrunning=!1,T};else this.doScrollLeft=function(e,o){var t=T.getScrollTop();T.doScrollPos(e,t,o)},this.doScrollTop=function(e,o){var t=T.getScrollLeft();T.doScrollPos(t,e,o)},this.doScrollPos=function(e,o,t){var r=e>T.page.maxw?T.page.maxw:e;r<0&&(r=0);var i=o>T.page.maxh?T.page.maxh:o;i<0&&(i=0),T.synched("scroll",function(){T.setScrollTop(i),T.setScrollLeft(r)})},this.cancelScroll=function(){};this.doScrollBy=function(e,o){z(0,e)},this.doScrollLeftBy=function(e,o){z(e,0)},this.doScrollTo=function(e,o){var t=o?Math.round(e*T.scrollratio.y):e;t<0?t=0:t>T.page.maxh&&(t=T.page.maxh),T.cursorfreezed=!1,T.doScrollTop(e)},this.checkContentSize=function(){var e=T.getContentSize();e.h==T.page.h&&e.w==T.page.w||T.resize(!1,e)},T.onscroll=function(e){T.rail.drag||T.cursorfreezed||T.synched("scroll",function(){T.scroll.y=Math.round(T.getScrollTop()/T.scrollratio.y),T.railh&&(T.scroll.x=Math.round(T.getScrollLeft()/T.scrollratio.x)),T.noticeCursor()})},T.bind(T.docscroll,"scroll",T.onscroll),this.doZoomIn=function(e){if(!T.zoomactive){T.zoomactive=!0,T.zoomrestore={style:{}};var o=["position","top","left","zIndex","backgroundColor","marginTop","marginBottom","marginLeft","marginRight"],t=T.win[0].style;for(var r in o){var i=o[r];T.zoomrestore.style[i]=void 0!==t[i]?t[i]:""}T.zoomrestore.style.width=T.win.css("width"),T.zoomrestore.style.height=T.win.css("height"),T.zoomrestore.padding={w:T.win.outerWidth()-T.win.width(),h:T.win.outerHeight()-T.win.height()},N.isios4&&(T.zoomrestore.scrollTop=c.scrollTop(),c.scrollTop(0)),T.win.css({position:N.isios4?"absolute":"fixed",top:0,left:0,zIndex:s+100,margin:0});var n=T.win.css("backgroundColor");return(""===n||/transparent|rgba\(0, 0, 0, 0\)|rgba\(0,0,0,0\)/.test(n))&&T.win.css("backgroundColor","#fff"),T.rail.css({zIndex:s+101}),T.zoom.css({zIndex:s+102}),T.zoom.css("backgroundPosition","0 -18px"),T.resizeZoom(),T.onzoomin&&T.onzoomin.call(T),T.cancelEvent(e)}},this.doZoomOut=function(e){if(T.zoomactive)return T.zoomactive=!1,T.win.css("margin",""),T.win.css(T.zoomrestore.style),N.isios4&&c.scrollTop(T.zoomrestore.scrollTop),T.rail.css({"z-index":T.zindex}),T.zoom.css({"z-index":T.zindex}),T.zoomrestore=!1,T.zoom.css("backgroundPosition","0 0"),T.onResize(),T.onzoomout&&T.onzoomout.call(T),T.cancelEvent(e)},this.doZoom=function(e){return T.zoomactive?T.doZoomOut(e):T.doZoomIn(e)},this.resizeZoom=function(){if(T.zoomactive){var e=T.getScrollTop();T.win.css({width:c.width()-T.zoomrestore.padding.w+"px",height:c.height()-T.zoomrestore.padding.h+"px"}),T.onResize(),T.setScrollTop(Math.min(T.page.maxh,e))}},this.init(),n.nicescroll.push(this)},y=function(e){var o=this;this.nc=e,this.lastx=0,this.lasty=0,this.speedx=0,this.speedy=0,this.lasttime=0,this.steptime=0,this.snapx=!1,this.snapy=!1,this.demulx=0,this.demuly=0,this.lastscrollx=-1,this.lastscrolly=-1,this.chkx=0,this.chky=0,this.timer=0,this.reset=function(e,t){o.stop(),o.steptime=0,o.lasttime=f(),o.speedx=0,o.speedy=0,o.lastx=e,o.lasty=t,o.lastscrollx=-1,o.lastscrolly=-1},this.update=function(e,t){var r=f();o.steptime=r-o.lasttime,o.lasttime=r;var i=t-o.lasty,s=e-o.lastx,n=o.nc.getScrollTop()+i,l=o.nc.getScrollLeft()+s;o.snapx=l<0||l>o.nc.page.maxw,o.snapy=n<0||n>o.nc.page.maxh,o.speedx=s,o.speedy=i,o.lastx=e,o.lasty=t},this.stop=function(){o.nc.unsynched("domomentum2d"),o.timer&&clearTimeout(o.timer),o.timer=0,o.lastscrollx=-1,o.lastscrolly=-1},this.doSnapy=function(e,t){var r=!1;t<0?(t=0,r=!0):t>o.nc.page.maxh&&(t=o.nc.page.maxh,r=!0),e<0?(e=0,r=!0):e>o.nc.page.maxw&&(e=o.nc.page.maxw,r=!0),r?o.nc.doScrollPos(e,t,o.nc.opt.snapbackspeed):o.nc.triggerScrollEnd()},this.doMomentum=function(e){var t=f(),r=e?t+e:o.lasttime,i=o.nc.getScrollLeft(),s=o.nc.getScrollTop(),n=o.nc.page.maxh,l=o.nc.page.maxw;o.speedx=l>0?Math.min(60,o.speedx):0,o.speedy=n>0?Math.min(60,o.speedy):0;var a=r&&t-r<=60;(s<0||s>n||i<0||i>l)&&(a=!1);var c=!(!o.speedy||!a)&&o.speedy,d=!(!o.speedx||!a)&&o.speedx;if(c||d){var u=Math.max(16,o.steptime);if(u>50){var h=u/50;o.speedx*=h,o.speedy*=h,u=50}o.demulxy=0,o.lastscrollx=o.nc.getScrollLeft(),o.chkx=o.lastscrollx,o.lastscrolly=o.nc.getScrollTop(),o.chky=o.lastscrolly;var p=o.lastscrollx,m=o.lastscrolly,g=function(){var e=f()-t>600?.04:.02;o.speedx&&(p=Math.floor(o.lastscrollx-o.speedx*(1-o.demulxy)),o.lastscrollx=p,(p<0||p>l)&&(e=.1)),o.speedy&&(m=Math.floor(o.lastscrolly-o.speedy*(1-o.demulxy)),o.lastscrolly=m,(m<0||m>n)&&(e=.1)),o.demulxy=Math.min(1,o.demulxy+e),o.nc.synched("domomentum2d",function(){if(o.speedx){o.nc.getScrollLeft();o.chkx=p,o.nc.setScrollLeft(p)}if(o.speedy){o.nc.getScrollTop();o.chky=m,o.nc.setScrollTop(m)}o.timer||(o.nc.hideCursor(),o.doSnapy(p,m))}),o.demulxy<1?o.timer=setTimeout(g,u):(o.stop(),o.nc.hideCursor(),o.doSnapy(p,m))};g()}else o.doSnapy(o.nc.getScrollLeft(),o.nc.getScrollTop())}},x=e.fn.scrollTop;e.cssHooks.pageYOffset={get:function(e,o,t){var r=n.data(e,"__nicescroll")||!1;return r&&r.ishwscroll?r.getScrollTop():x.call(e)},set:function(e,o){var t=n.data(e,"__nicescroll")||!1;return t&&t.ishwscroll?t.setScrollTop(parseInt(o)):x.call(e,o),this}},e.fn.scrollTop=function(e){if(void 0===e){var o=!!this[0]&&(n.data(this[0],"__nicescroll")||!1);return o&&o.ishwscroll?o.getScrollTop():x.call(this)}return this.each(function(){var o=n.data(this,"__nicescroll")||!1;o&&o.ishwscroll?o.setScrollTop(parseInt(e)):x.call(n(this),e)})};var S=e.fn.scrollLeft;n.cssHooks.pageXOffset={get:function(e,o,t){var r=n.data(e,"__nicescroll")||!1;return r&&r.ishwscroll?r.getScrollLeft():S.call(e)},set:function(e,o){var t=n.data(e,"__nicescroll")||!1;return t&&t.ishwscroll?t.setScrollLeft(parseInt(o)):S.call(e,o),this}},e.fn.scrollLeft=function(e){if(void 0===e){var o=!!this[0]&&(n.data(this[0],"__nicescroll")||!1);return o&&o.ishwscroll?o.getScrollLeft():S.call(this)}return this.each(function(){var o=n.data(this,"__nicescroll")||!1;o&&o.ishwscroll?o.setScrollLeft(parseInt(e)):S.call(n(this),e)})};var z=function(e){var o=this;if(this.length=0,this.name="nicescrollarray",this.each=function(e){return n.each(o,e),o},this.push=function(e){o[o.length]=e,o.length++},this.eq=function(e){return o[e]},e)for(var t=0;t1?n(e,r):s,i.win=r}!("doc"in i)||"win"in i||(i.win=r);var l=r.data("__nicescroll")||!1;l||(i.doc=i.doc||r,l=new b(i,r),r.data("__nicescroll",l)),t.push(l)}),1===t.length?t[0]:t},a.NiceScroll={getjQuery:function(){return e}},n.nicescroll||(n.nicescroll=new z,n.nicescroll.options=g)}); \ No newline at end of file From e55fc6e792086727b6c2f48e9cc6d806239460f8 Mon Sep 17 00:00:00 2001 From: InuYaksa Date: Mon, 10 Jul 2017 21:37:32 +0200 Subject: [PATCH 12/14] 3.7.5-c minor code optimization --- jquery.nicescroll.js | 16 +++++++++------- jquery.nicescroll.min.js | 4 ++-- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/jquery.nicescroll.js b/jquery.nicescroll.js index 90dbd1e..bb850e1 100644 --- a/jquery.nicescroll.js +++ b/jquery.nicescroll.js @@ -1989,10 +1989,12 @@ if (!self.ispage && !self.haswrapper) { // redesigned MutationObserver for Chrome18+/Firefox14+/iOS6+ with support for: remove div, add/remove content if (ClsMutationObserver !== false) { + var _dom = self.win[0]; + self.observer = new ClsMutationObserver(function (mutations) { mutations.forEach(self.onAttributeChange); }); - self.observer.observe(self.win[0], { + self.observer.observe(_dom, { childList: true, characterData: false, attributes: true, @@ -2002,22 +2004,22 @@ mutations.forEach(function (mo) { if (mo.removedNodes.length > 0) { for (var dd in mo.removedNodes) { - if (!!self && (mo.removedNodes[dd] == self.win[0])) return self.remove(); + if (!!self && (mo.removedNodes[dd] === _dom)) return self.remove(); } } }); }); - self.observerremover.observe(self.win[0].parentNode, { + self.observerremover.observe(_dom.parentNode, { childList: true, characterData: false, attributes: false, subtree: false }); } else { - self.bind(self.win, (cap.isie && !cap.isie9) ? "propertychange" : "DOMAttrModified", self.onAttributeChange); - if (cap.isie9) self.win[0].attachEvent("onpropertychange", self.onAttributeChange); //IE9 DOMAttrModified bug - self.bind(self.win, "DOMNodeRemoved", function (e) { - if (e.target == self.win[0]) self.remove(); + self.bind(_dom, (cap.isie && !cap.isie9) ? "propertychange" : "DOMAttrModified", self.onAttributeChange); + if (cap.isie9) _dom.attachEvent("onpropertychange", self.onAttributeChange); //IE9 DOMAttrModified bug + self.bind(_dom, "DOMNodeRemoved", function (e) { + if (e.target === _dom) self.remove(); }); } } diff --git a/jquery.nicescroll.min.js b/jquery.nicescroll.min.js index 4cc30a2..d4befc8 100644 --- a/jquery.nicescroll.min.js +++ b/jquery.nicescroll.min.js @@ -1,2 +1,2 @@ -/* jquery.nicescroll v 3.7.5-c [DEV REL] - InuYaksa*2017 - MIT - https://nicescroll.areaaperta.com/ */ -!function(e){"function"==typeof define&&define.amd?define(["jquery"],e):"object"==typeof exports?module.exports=e(require("jquery")):e(jQuery)}(function(e){"use strict";var o=!1,t=!1,r=0,i=2e3,s=0,n=e,l=document,a=window,c=n(a),d=[],u=a.requestAnimationFrame||a.webkitRequestAnimationFrame||a.mozRequestAnimationFrame||!1,h=a.cancelAnimationFrame||a.webkitCancelAnimationFrame||a.mozCancelAnimationFrame||!1;if(u)a.cancelAnimationFrame||(h=function(e){});else{var p=0;u=function(e,o){var t=(new Date).getTime(),r=Math.max(0,16-(t-p)),i=a.setTimeout(function(){e(t+r)},r);return p=t+r,i},h=function(e){a.clearTimeout(e)}}var m=a.MutationObserver||a.WebKitMutationObserver||!1,f=Date.now||function(){return(new Date).getTime()},g={zindex:"auto",cursoropacitymin:0,cursoropacitymax:1,cursorcolor:"#424242",cursorwidth:"6px",cursorborder:"1px solid #fff",cursorborderradius:"5px",scrollspeed:40,mousescrollstep:27,touchbehavior:!1,emulatetouch:!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 e=l.currentScript||function(){var e=l.getElementsByTagName("script");return!!e.length&&e[e.length-1]}(),o=e?e.src.split("?")[0]:"";return o.split("/").length>0?o.split("/").slice(0,-1).join("/")+"/":""}(),preventmultitouchscrolling:!0,disablemutationobserver:!1,enableobserver:!0,scrollbarid:!1},v=!1,w=function(){if(v)return v;var e=l.createElement("DIV"),o=e.style,t=navigator.userAgent,r=navigator.platform,i={};return i.haspointerlock="pointerLockElement"in l||"webkitPointerLockElement"in l||"mozPointerLockElement"in l,i.isopera="opera"in a,i.isopera12=i.isopera&&"getUserMedia"in navigator,i.isoperamini="[object OperaMini]"===Object.prototype.toString.call(a.operamini),i.isie="all"in l&&"attachEvent"in e&&!i.isopera,i.isieold=i.isie&&!("msInterpolationMode"in o),i.isie7=i.isie&&!i.isieold&&(!("documentMode"in l)||7===l.documentMode),i.isie8=i.isie&&"documentMode"in l&&8===l.documentMode,i.isie9=i.isie&&"performance"in a&&9===l.documentMode,i.isie10=i.isie&&"performance"in a&&10===l.documentMode,i.isie11="msRequestFullscreen"in e&&l.documentMode>=11,i.ismsedge="msCredentials"in a,i.ismozilla="MozAppearance"in o,i.iswebkit=!i.ismsedge&&"WebkitAppearance"in o,i.ischrome=i.iswebkit&&"chrome"in a,i.ischrome38=i.ischrome&&"touchAction"in o,i.ischrome22=!i.ischrome38&&i.ischrome&&i.haspointerlock,i.ischrome26=!i.ischrome38&&i.ischrome&&"transition"in o,i.cantouch="ontouchstart"in l.documentElement||"ontouchstart"in a,i.hasw3ctouch=(a.PointerEvent||!1)&&(navigator.maxTouchPoints>0||navigator.msMaxTouchPoints>0),i.hasmstouch=!i.hasw3ctouch&&(a.MSPointerEvent||!1),i.ismac=/^mac$/i.test(r),i.isios=i.cantouch&&/iphone|ipad|ipod/i.test(r),i.isios4=i.isios&&!("seal"in Object),i.isios7=i.isios&&"webkitHidden"in l,i.isios8=i.isios&&"hidden"in l,i.isios10=i.isios&&a.Proxy,i.isandroid=/android/i.test(t),i.haseventlistener="addEventListener"in e,i.trstyle=!1,i.hastransform=!1,i.hastranslate3d=!1,i.transitionstyle=!1,i.hastransition=!1,i.transitionend=!1,i.trstyle="transform",i.hastransform="transform"in o||function(){for(var e=["msTransform","webkitTransform","MozTransform","OTransform"],t=0,r=e.length;t0;){if(9==e[0].nodeType)return!1;var o=e.css("zIndex");if(!isNaN(o)&&0!==o)return parseInt(o);e=e.parent()}return!1}function x(e,o,t){var r=e.css(o),i=parseFloat(r);if(isNaN(i)){var s=3==(i=I[r]||0)?t?T.win.outerHeight()-T.win.innerHeight():T.win.outerWidth()-T.win.innerWidth():1;return T.isie8&&i&&(i+=1),s?i:0}return i}function S(e,o,t,r){T._bind(e,o,function(r){var i={original:r=r||a.event,target:r.target||r.srcElement,type:"wheel",deltaMode:"MozMousePixelScroll"==r.type?0:1,deltaX:0,deltaZ:0,preventDefault:function(){return r.preventDefault?r.preventDefault():r.returnValue=!1,!1},stopImmediatePropagation:function(){r.stopImmediatePropagation?r.stopImmediatePropagation():r.cancelBubble=!0}};return"mousewheel"==o?(r.wheelDeltaX&&(i.deltaX=-.025*r.wheelDeltaX),r.wheelDeltaY&&(i.deltaY=-.025*r.wheelDeltaY),!i.deltaY&&!i.deltaX&&(i.deltaY=-.025*r.wheelDelta)):i.deltaY=r.detail,t.call(e,i)},r)}function z(e,o,t,r){T.scrollrunning||(T.newscrolly=T.getScrollTop(),T.newscrollx=T.getScrollLeft(),D=f());var i=f()-D;if(D=f(),i>350?A=1:A+=(2-A)/10,e=e*A|0,o=o*A|0,e){if(r)if(e<0){if(T.getScrollLeft()>=T.page.maxw)return!0}else if(T.getScrollLeft()<=0)return!0;var s=e>0?1:-1;X!==s&&(T.scrollmom&&T.scrollmom.stop(),T.newscrollx=T.getScrollLeft(),X=s),T.lastdeltax-=e}if(o){if(function(){var e=T.getScrollTop();if(o<0){if(e>=T.page.maxh)return!0}else if(e<=0)return!0}()){if(M.nativeparentscrolling&&t&&!T.ispage&&!T.zoomactive)return!0;var n=T.view.h>>1;T.newscrolly<-n?(T.newscrolly=-n,o=-1):T.newscrolly>T.page.maxh+n?(T.newscrolly=T.page.maxh+n,o=1):o=0}var l=o>0?1:-1;B!==l&&(T.scrollmom&&T.scrollmom.stop(),T.newscrolly=T.getScrollTop(),B=l),T.lastdeltay-=o}(o||e)&&T.synched("relativexy",function(){var e=T.lastdeltay+T.newscrolly;T.lastdeltay=0;var o=T.lastdeltax+T.newscrollx;T.lastdeltax=0,T.rail.drag||T.doScrollPos(o,e)})}function k(e,o,t){var r,i;return!(t||!q)||(0===e.deltaMode?(r=-e.deltaX*(M.mousescrollstep/54)|0,i=-e.deltaY*(M.mousescrollstep/54)|0):1===e.deltaMode&&(r=-e.deltaX*M.mousescrollstep*50/80|0,i=-e.deltaY*M.mousescrollstep*50/80|0),o&&M.oneaxismousemode&&0===r&&i&&(r=i,i=0,t&&(r<0?T.getScrollLeft()>=T.page.maxw:T.getScrollLeft()<=0)&&(i=r,r=0)),T.isrtlmode&&(r=-r),z(r,i,t,!0)?void(t&&(q=!0)):(q=!1,e.stopImmediatePropagation(),e.preventDefault()))}var T=this;this.version="3.7.5-c",this.name="nicescroll",this.me=p;var E=n("body"),M=this.opt={doc:E,win:!1};if(n.extend(M,g),M.snapbackspeed=80,e)for(var L in M)void 0!==e[L]&&(M[L]=e[L]);if(M.disablemutationobserver&&(m=!1),this.doc=M.doc,this.iddoc=this.doc&&this.doc[0]?this.doc[0].id||"":"",this.ispage=/^BODY|HTML/.test(M.win?M.win[0].nodeName:this.doc[0].nodeName),this.haswrapper=!1!==M.win,this.win=M.win||(this.ispage?c:this.doc),this.docscroll=this.ispage&&!this.haswrapper?c:this.win,this.body=E,this.viewport=!1,this.isfixed=!1,this.iframe=!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"!=M.autohidemode,this.onmousedown=!1,this.onmouseup=!1,this.onmousemove=!1,this.onmousewheel=!1,this.onkeypress=!1,this.ongesturezoom=!1,this.onclick=!1,this.onscrollstart=!1,this.onscrollend=!1,this.onscrollcancel=!1,this.onzoomin=!1,this.onzoomout=!1,this.view=!1,this.page=!1,this.scroll={x:0,y:0},this.scrollratio={x:0,y:0},this.cursorheight=20,this.scrollvaluemax=0,"auto"==M.rtlmode){var C=this.win[0]==a?this.body:this.win,P=C.css("writing-mode")||C.css("-webkit-writing-mode")||C.css("-ms-writing-mode")||C.css("-moz-writing-mode");"horizontal-tb"==P||"lr-tb"==P||""===P?(this.isrtlmode="rtl"==C.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===M.rtlmode,this.isvertical=!1;if(this.scrollrunning=!1,this.scrollmom=!1,this.observer=!1,this.observerremover=!1,this.observerbody=!1,!1!==M.scrollbarid)this.id=M.scrollbarid;else do{this.id="ascrail"+i++}while(l.getElementById(this.id));this.rail=!1,this.cursor=!1,this.cursorfreezed=!1,this.selectiondrag=!1,this.zoom=!1,this.zoomactive=!1,this.hasfocus=!1,this.hasmousefocus=!1,this.railslocked=!1,this.locked=!1,this.hidden=!1,this.cursoractive=!0,this.wheelprevented=!1,this.overflowx=M.overflowx,this.overflowy=M.overflowy,this.nativescrollingarea=!1,this.checkarea=0,this.events=[],this.saved={},this.delaylist={},this.synclist={},this.lastdeltax=0,this.lastdeltay=0,this.detected=w();var N=n.extend({},this.detected);this.canhwscroll=N.hastransform&&M.hwacceleration,this.ishwscroll=this.canhwscroll&&T.haswrapper,this.isrtlmode?this.isvertical?this.hasreversehr=!(N.iswebkit||N.isie||N.isie11):this.hasreversehr=!(N.iswebkit||N.isie&&!N.isie10&&!N.isie11):this.hasreversehr=!1,this.istouchcapable=!1,N.cantouch||!N.hasw3ctouch&&!N.hasmstouch?!N.cantouch||N.isios||N.isandroid||!N.iswebkit&&!N.ismozilla||(this.istouchcapable=!0):this.istouchcapable=!0,M.enablemouselockapi||(N.hasmousecapture=!1,N.haspointerlock=!1),this.debounced=function(e,o,t){T&&(T.delaylist[e]||!1||(T.delaylist[e]={h:u(function(){T.delaylist[e].fn.call(T),T.delaylist[e]=!1},t)},o.call(T)),T.delaylist[e].fn=o)},this.synched=function(e,o){T.synclist[e]?T.synclist[e]=o:(T.synclist[e]=o,u(function(){T&&(T.synclist[e]&&T.synclist[e].call(T),T.synclist[e]=null)}))},this.unsynched=function(e){T.synclist[e]&&(T.synclist[e]=!1)},this.css=function(e,o){for(var t in o)T.saved.css.push([e,t,e.css(t)]),e.css(t,o[t])},this.scrollTop=function(e){return void 0===e?T.getScrollTop():T.setScrollTop(e)},this.scrollLeft=function(e){return void 0===e?T.getScrollLeft():T.setScrollLeft(e)};var R=function(e,o,t,r,i,s,n){this.st=e,this.ed=o,this.spd=t,this.p1=r||0,this.p2=i||1,this.p3=s||0,this.p4=n||1,this.ts=f(),this.df=o-e};if(R.prototype={B2:function(e){return 3*(1-e)*(1-e)*e},B3:function(e){return 3*(1-e)*e*e},B4:function(e){return e*e*e},getPos:function(){return(f()-this.ts)/this.spd},getNow:function(){var e=(f()-this.ts)/this.spd,o=this.B2(e)+this.B3(e)+this.B4(e);return e>=1?this.ed:this.st+this.df*o|0},update:function(e,o){return this.st=this.getNow(),this.ed=e,this.spd=o,this.ts=f(),this.df=this.ed-this.st,this}},this.ishwscroll){this.doc.translate={x:0,y:0,tx:"0px",ty:"0px"},N.hastranslate3d&&N.isios&&this.doc.css("-webkit-backface-visibility","hidden"),this.getScrollTop=function(e){if(!e){var o=v();if(o)return 16==o.length?-o[13]:-o[5];if(T.timerscroll&&T.timerscroll.bz)return T.timerscroll.bz.getNow()}return T.doc.translate.y},this.getScrollLeft=function(e){if(!e){var o=v();if(o)return 16==o.length?-o[12]:-o[4];if(T.timerscroll&&T.timerscroll.bh)return T.timerscroll.bh.getNow()}return T.doc.translate.x},this.notifyScrollEvent=function(e){var o=l.createEvent("UIEvents");o.initUIEvent("scroll",!1,!1,a,1),o.niceevent=!0,e.dispatchEvent(o)};var _=this.isrtlmode?1:-1;N.hastranslate3d&&M.enabletranslate3d?(this.setScrollTop=function(e,o){T.doc.translate.y=e,T.doc.translate.ty=-1*e+"px",T.doc.css(N.trstyle,"translate3d("+T.doc.translate.tx+","+T.doc.translate.ty+",0)"),o||T.notifyScrollEvent(T.win[0])},this.setScrollLeft=function(e,o){T.doc.translate.x=e,T.doc.translate.tx=e*_+"px",T.doc.css(N.trstyle,"translate3d("+T.doc.translate.tx+","+T.doc.translate.ty+",0)"),o||T.notifyScrollEvent(T.win[0])}):(this.setScrollTop=function(e,o){T.doc.translate.y=e,T.doc.translate.ty=-1*e+"px",T.doc.css(N.trstyle,"translate("+T.doc.translate.tx+","+T.doc.translate.ty+")"),o||T.notifyScrollEvent(T.win[0])},this.setScrollLeft=function(e,o){T.doc.translate.x=e,T.doc.translate.tx=e*_+"px",T.doc.css(N.trstyle,"translate("+T.doc.translate.tx+","+T.doc.translate.ty+")"),o||T.notifyScrollEvent(T.win[0])})}else this.getScrollTop=function(){return T.docscroll.scrollTop()},this.setScrollTop=function(e){T.docscroll.scrollTop(e)},this.getScrollLeft=function(){return T.hasreversehr?T.detected.ismozilla?T.page.maxw-Math.abs(T.docscroll.scrollLeft()):T.page.maxw-T.docscroll.scrollLeft():T.docscroll.scrollLeft()},this.setScrollLeft=function(e){return setTimeout(function(){if(T)return T.hasreversehr&&(e=T.detected.ismozilla?-(T.page.maxw-e):T.page.maxw-e),T.docscroll.scrollLeft(e)},1)};this.getTarget=function(e){return!!e&&(e.target?e.target:!!e.srcElement&&e.srcElement)},this.hasParent=function(e,o){if(!e)return!1;for(var t=e.target||e.srcElement||e||!1;t&&t.id!=o;)t=t.parentNode||!1;return!1!==t};var I={thin:1,medium:3,thick:5};this.getDocumentScrollOffset=function(){return{top:a.pageYOffset||l.documentElement.scrollTop,left:a.pageXOffset||l.documentElement.scrollLeft}},this.getOffset=function(){if(T.isfixed){var e=T.win.offset(),o=T.getDocumentScrollOffset();return e.top-=o.top,e.left-=o.left,e}var t=T.win.offset();if(!T.viewport)return t;var r=T.viewport.offset();return{top:t.top-r.top,left:t.left-r.left}},this.updateScrollBar=function(e){var o,t;if(T.ishwscroll)T.rail.css({height:T.win.innerHeight()-(M.railpadding.top+M.railpadding.bottom)}),T.railh&&T.railh.css({width:T.win.innerWidth()-(M.railpadding.left+M.railpadding.right)});else{var r=T.getOffset();if(o={top:r.top,left:r.left-(M.railpadding.left+M.railpadding.right)},o.top+=x(T.win,"border-top-width",!0),o.left+=T.rail.align?T.win.outerWidth()-x(T.win,"border-right-width")-T.rail.width:x(T.win,"border-left-width"),(t=M.railoffset)&&(t.top&&(o.top+=t.top),t.left&&(o.left+=t.left)),T.railslocked||T.rail.css({top:o.top,left:o.left,height:(e?e.h:T.win.innerHeight())-(M.railpadding.top+M.railpadding.bottom)}),T.zoom&&T.zoom.css({top:o.top+1,left:1==T.rail.align?o.left-20:o.left+T.rail.width+4}),T.railh&&!T.railslocked){o={top:r.top,left:r.left},(t=M.railhoffset)&&(t.top&&(o.top+=t.top),t.left&&(o.left+=t.left));var i=T.railh.align?o.top+x(T.win,"border-top-width",!0)+T.win.innerHeight()-T.railh.height:o.top+x(T.win,"border-top-width",!0),s=o.left+x(T.win,"border-left-width");T.railh.css({top:i-(M.railpadding.top+M.railpadding.bottom),left:s,width:T.railh.width})}}},this.doRailClick=function(e,o,t){var r,i,s,n;T.railslocked||(T.cancelEvent(e),"pageY"in e||(e.pageX=e.clientX+l.documentElement.scrollLeft,e.pageY=e.clientY+l.documentElement.scrollTop),o?(r=t?T.doScrollLeft:T.doScrollTop,s=t?(e.pageX-T.railh.offset().left-T.cursorwidth/2)*T.scrollratio.x:(e.pageY-T.rail.offset().top-T.cursorheight/2)*T.scrollratio.y,T.unsynched("relativexy"),r(0|s)):(r=t?T.doScrollLeftBy:T.doScrollBy,s=t?T.scroll.x:T.scroll.y,n=t?e.pageX-T.railh.offset().left:e.pageY-T.rail.offset().top,i=t?T.view.w:T.view.h,r(s>=n?i:-i)))},T.newscrolly=T.newscrollx=0,T.hasanimationframe="requestAnimationFrame"in a,T.hascancelanimationframe="cancelAnimationFrame"in a,T.hasborderbox=!1,this.init=function(){if(T.saved.css=[],N.isoperamini)return!0;if(N.isandroid&&!("hidden"in l))return!0;M.emulatetouch=M.emulatetouch||M.touchbehavior,T.hasborderbox=a.getComputedStyle&&"border-box"===a.getComputedStyle(l.body)["box-sizing"];var e={"overflow-y":"hidden"};if((N.isie11||N.isie10)&&(e["-ms-overflow-style"]="none"),T.ishwscroll&&(this.doc.css(N.transitionstyle,N.prefixstyle+"transform 0ms ease-out"),N.transitionend&&T.bind(T.doc,N.transitionend,T.onScrollTransitionEnd,!1)),T.zindex="auto",T.ispage||"auto"!=M.zindex?T.zindex=M.zindex:T.zindex=b()||"auto",!T.ispage&&"auto"!=T.zindex&&T.zindex>s&&(s=T.zindex),T.isie&&0===T.zindex&&"auto"==M.zindex&&(T.zindex="auto"),!T.ispage||!N.isieold){var i=T.docscroll;T.ispage&&(i=T.haswrapper?T.win:T.doc),T.css(i,e),T.ispage&&(N.isie11||N.isie)&&T.css(n("html"),e),!N.isios||T.ispage||T.haswrapper||T.css(E,{"-webkit-overflow-scrolling":"touch"});var d=n(l.createElement("div"));d.css({position:"relative",top:0,float:"right",width:M.cursorwidth,height:0,"background-color":M.cursorcolor,border:M.cursorborder,"background-clip":"padding-box","-webkit-border-radius":M.cursorborderradius,"-moz-border-radius":M.cursorborderradius,"border-radius":M.cursorborderradius}),d.addClass("nicescroll-cursors"),T.cursor=d;var u=n(l.createElement("div"));u.attr("id",T.id),u.addClass("nicescroll-rails nicescroll-rails-vr");var h,p,f=["left","right","top","bottom"];for(var g in f)p=f[g],(h=M.railpadding[p]||0)&&u.css("padding-"+p,h+"px");u.append(d),u.width=Math.max(parseFloat(M.cursorwidth),d.outerWidth()),u.css({width:u.width+"px",zIndex:T.zindex,background:M.background,cursor:"default"}),u.visibility=!0,u.scrollable=!0,u.align="left"==M.railalign?0:1,T.rail=u,T.rail.drag=!1;var v=!1;!M.boxzoom||T.ispage||N.isieold||(v=l.createElement("div"),T.bind(v,"click",T.doZoom),T.bind(v,"mouseenter",function(){T.zoom.css("opacity",M.cursoropacitymax)}),T.bind(v,"mouseleave",function(){T.zoom.css("opacity",M.cursoropacitymin)}),T.zoom=n(v),T.zoom.css({cursor:"pointer",zIndex:T.zindex,backgroundImage:"url("+M.scriptpath+"zoomico.png)",height:18,width:18,backgroundPosition:"0 0"}),M.dblclickzoom&&T.bind(T.win,"dblclick",T.doZoom),N.cantouch&&M.gesturezoom&&(T.ongesturezoom=function(e){return e.scale>1.5&&T.doZoomIn(e),e.scale<.8&&T.doZoomOut(e),T.cancelEvent(e)},T.bind(T.win,"gestureend",T.ongesturezoom))),T.railh=!1;var w;if(M.horizrailenabled&&(T.css(i,{overflowX:"hidden"}),(d=n(l.createElement("div"))).css({position:"absolute",top:0,height:M.cursorwidth,width:0,backgroundColor:M.cursorcolor,border:M.cursorborder,backgroundClip:"padding-box","-webkit-border-radius":M.cursorborderradius,"-moz-border-radius":M.cursorborderradius,"border-radius":M.cursorborderradius}),N.isieold&&d.css("overflow","hidden"),d.addClass("nicescroll-cursors"),T.cursorh=d,(w=n(l.createElement("div"))).attr("id",T.id+"-hr"),w.addClass("nicescroll-rails nicescroll-rails-hr"),w.height=Math.max(parseFloat(M.cursorwidth),d.outerHeight()),w.css({height:w.height+"px",zIndex:T.zindex,background:M.background}),w.append(d),w.visibility=!0,w.scrollable=!0,w.align="top"==M.railvalign?0:1,T.railh=w,T.railh.drag=!1),T.ispage)u.css({position:"fixed",top:0,height:"100%"}),u.css(u.align?{right:0}:{left:0}),T.body.append(u),T.railh&&(w.css({position:"fixed",left:0,width:"100%"}),w.css(w.align?{bottom:0}:{top:0}),T.body.append(w));else{if(T.ishwscroll){"static"==T.win.css("position")&&T.css(T.win,{position:"relative"});var x="HTML"==T.win[0].nodeName?T.body:T.win;n(x).scrollTop(0).scrollLeft(0),T.zoom&&(T.zoom.css({position:"absolute",top:1,right:0,"margin-right":u.width+4}),x.append(T.zoom)),u.css({position:"absolute",top:0}),u.css(u.align?{right:0}:{left:0}),x.append(u),w&&(w.css({position:"absolute",left:0,bottom:0}),w.css(w.align?{bottom:0}:{top:0}),x.append(w))}else{T.isfixed="fixed"==T.win.css("position");var S=T.isfixed?"fixed":"absolute";T.isfixed||(T.viewport=T.getViewport(T.win[0])),T.viewport&&(T.body=T.viewport,/fixed|absolute/.test(T.viewport.css("position"))||T.css(T.viewport,{position:"relative"})),u.css({position:S}),T.zoom&&T.zoom.css({position:S}),T.updateScrollBar(),T.body.append(u),T.zoom&&T.body.append(T.zoom),T.railh&&(w.css({position:S}),T.body.append(w))}N.isios&&T.css(T.win,{"-webkit-tap-highlight-color":"rgba(0,0,0,0)","-webkit-touch-callout":"none"}),M.disableoutline&&(N.isie&&T.win.attr("hideFocus","true"),N.iswebkit&&T.win.css("outline","none"))}if(!1===M.autohidemode?(T.autohidedom=!1,T.rail.css({opacity:M.cursoropacitymax}),T.railh&&T.railh.css({opacity:M.cursoropacitymax})):!0===M.autohidemode||"leave"===M.autohidemode?(T.autohidedom=n().add(T.rail),N.isie8&&(T.autohidedom=T.autohidedom.add(T.cursor)),T.railh&&(T.autohidedom=T.autohidedom.add(T.railh)),T.railh&&N.isie8&&(T.autohidedom=T.autohidedom.add(T.cursorh))):"scroll"==M.autohidemode?(T.autohidedom=n().add(T.rail),T.railh&&(T.autohidedom=T.autohidedom.add(T.railh))):"cursor"==M.autohidemode?(T.autohidedom=n().add(T.cursor),T.railh&&(T.autohidedom=T.autohidedom.add(T.cursorh))):"hidden"==M.autohidemode&&(T.autohidedom=!1,T.hide(),T.railslocked=!1),N.cantouch||T.istouchcapable||M.emulatetouch||N.hasmstouch){T.scrollmom=new y(T);T.ontouchstart=function(e){if(T.locked)return!1;if(e.pointerType&&("mouse"===e.pointerType||e.pointerType===e.MSPOINTER_TYPE_MOUSE))return!1;if(T.hasmoving=!1,T.scrollmom.timer&&(T.triggerScrollEnd(),T.scrollmom.stop()),!T.railslocked){var o=T.getTarget(e);if(o&&/INPUT/i.test(o.nodeName)&&/range/i.test(o.type))return T.stopPropagation(e);var t="mousedown"===e.type;if(!("clientX"in e)&&"changedTouches"in e&&(e.clientX=e.changedTouches[0].clientX,e.clientY=e.changedTouches[0].clientY),T.forcescreen){var r=e;(e={original:e.original?e.original:e}).clientX=r.screenX,e.clientY=r.screenY}if(T.rail.drag={x:e.clientX,y:e.clientY,sx:T.scroll.x,sy:T.scroll.y,st:T.getScrollTop(),sl:T.getScrollLeft(),pt:2,dl:!1,tg:o},T.ispage||!M.directionlockdeadzone)T.rail.drag.dl="f";else{var i={w:c.width(),h:c.height()},s=T.getContentSize(),l=s.h-i.h,a=s.w-i.w;T.rail.scrollable&&!T.railh.scrollable?T.rail.drag.ck=l>0&&"v":!T.rail.scrollable&&T.railh.scrollable?T.rail.drag.ck=a>0&&"h":T.rail.drag.ck=!1}if(M.emulatetouch&&T.isiframe&&N.isie){var d=T.win.position();T.rail.drag.x+=d.left,T.rail.drag.y+=d.top}if(T.hasmoving=!1,T.lastmouseup=!1,T.scrollmom.reset(e.clientX,e.clientY),o&&t){if(!/INPUT|SELECT|BUTTON|TEXTAREA/i.test(o.nodeName))return N.hasmousecapture&&o.setCapture(),M.emulatetouch?(o.onclick&&!o._onclick&&(o._onclick=o.onclick,o.onclick=function(e){if(T.hasmoving)return!1;o._onclick.call(this,e)}),T.cancelEvent(e)):T.stopPropagation(e);/SUBMIT|CANCEL|BUTTON/i.test(n(o).attr("type"))&&(T.preventclick={tg:o,click:!1})}}},T.ontouchend=function(e){if(!T.rail.drag)return!0;if(2==T.rail.drag.pt){if(e.pointerType&&("mouse"===e.pointerType||e.pointerType===e.MSPOINTER_TYPE_MOUSE))return!1;T.rail.drag=!1;var o="mouseup"===e.type;if(T.hasmoving&&(T.scrollmom.doMomentum(),T.lastmouseup=!0,T.hideCursor(),N.hasmousecapture&&l.releaseCapture(),o))return T.cancelEvent(e)}else if(1==T.rail.drag.pt)return T.onmouseup(e)};var z=M.emulatetouch&&T.isiframe&&!N.hasmousecapture,k=.3*M.directionlockdeadzone|0;T.ontouchmove=function(e,o){if(!T.rail.drag)return!0;if(e.targetTouches&&M.preventmultitouchscrolling&&e.targetTouches.length>1)return!0;if(e.pointerType&&("mouse"===e.pointerType||e.pointerType===e.MSPOINTER_TYPE_MOUSE))return!0;if(2==T.rail.drag.pt){"changedTouches"in e&&(e.clientX=e.changedTouches[0].clientX,e.clientY=e.changedTouches[0].clientY);var t,r;if(r=t=0,z&&!o){var i=T.win.position();r=-i.left,t=-i.top}var s=e.clientY+t,n=s-T.rail.drag.y,a=e.clientX+r,c=a-T.rail.drag.x,d=T.rail.drag.st-n;if(T.ishwscroll&&M.bouncescroll)d<0?d=Math.round(d/2):d>T.page.maxh&&(d=T.page.maxh+Math.round((d-T.page.maxh)/2));else if(d<0?(d=0,s=0):d>T.page.maxh&&(d=T.page.maxh,s=0),0===s&&!T.hasmoving)return T.ispage||(T.rail.drag=!1),!0;var u=T.getScrollLeft();if(T.railh&&T.railh.scrollable&&(u=T.isrtlmode?c-T.rail.drag.sl:T.rail.drag.sl-c,T.ishwscroll&&M.bouncescroll?u<0?u=Math.round(u/2):u>T.page.maxw&&(u=T.page.maxw+Math.round((u-T.page.maxw)/2)):(u<0&&(u=0,a=0),u>T.page.maxw&&(u=T.page.maxw,a=0))),!T.hasmoving){if(T.rail.drag.y===e.clientY&&T.rail.drag.x===e.clientX)return T.cancelEvent(e);var h=Math.abs(n),p=Math.abs(c),m=M.directionlockdeadzone;if(T.rail.drag.ck?"v"==T.rail.drag.ck?p>m&&h<=k?T.rail.drag=!1:h>m&&(T.rail.drag.dl="v"):"h"==T.rail.drag.ck&&(h>m&&p<=k?T.rail.drag=!1:p>m&&(T.rail.drag.dl="h")):h>m&&p>m?T.rail.drag.dl="f":h>m?T.rail.drag.dl=p>k?"f":"v":p>m&&(T.rail.drag.dl=h>k?"f":"h"),!T.rail.drag.dl)return T.cancelEvent(e);T.triggerScrollStart(e.clientX,e.clientY,0,0,0),T.hasmoving=!0}return T.preventclick&&!T.preventclick.click&&(T.preventclick.click=T.preventclick.tg.onclick||!1,T.preventclick.tg.onclick=T.onpreventclick),T.rail.drag.dl&&("v"==T.rail.drag.dl?u=T.rail.drag.sl:"h"==T.rail.drag.dl&&(d=T.rail.drag.st)),T.synched("touchmove",function(){T.rail.drag&&2==T.rail.drag.pt&&(T.prepareTransition&&T.resetTransition(),T.rail.scrollable&&T.setScrollTop(d),T.scrollmom.update(a,s),T.railh&&T.railh.scrollable?(T.setScrollLeft(u),T.showCursor(d,u)):T.showCursor(d),N.isie10&&l.selection.clear())}),T.cancelEvent(e)}return 1==T.rail.drag.pt?T.onmousemove(e):void 0},T.ontouchstartCursor=function(e,o){if(!T.rail.drag||3==T.rail.drag.pt){if(T.locked)return T.cancelEvent(e);T.cancelScroll(),T.rail.drag={x:e.touches[0].clientX,y:e.touches[0].clientY,sx:T.scroll.x,sy:T.scroll.y,pt:3,hr:!!o};var t=T.getTarget(e);return!T.ispage&&N.hasmousecapture&&t.setCapture(),T.isiframe&&!N.hasmousecapture&&(T.saved.csspointerevents=T.doc.css("pointer-events"),T.css(T.doc,{"pointer-events":"none"})),T.cancelEvent(e)}},T.ontouchendCursor=function(e){if(T.rail.drag){if(N.hasmousecapture&&l.releaseCapture(),T.isiframe&&!N.hasmousecapture&&T.doc.css("pointer-events",T.saved.csspointerevents),3!=T.rail.drag.pt)return;return T.rail.drag=!1,T.cancelEvent(e)}},T.ontouchmoveCursor=function(e){if(T.rail.drag){if(3!=T.rail.drag.pt)return;if(T.cursorfreezed=!0,T.rail.drag.hr){T.scroll.x=T.rail.drag.sx+(e.touches[0].clientX-T.rail.drag.x),T.scroll.x<0&&(T.scroll.x=0);var o=T.scrollvaluemaxw;T.scroll.x>o&&(T.scroll.x=o)}else{T.scroll.y=T.rail.drag.sy+(e.touches[0].clientY-T.rail.drag.y),T.scroll.y<0&&(T.scroll.y=0);var t=T.scrollvaluemax;T.scroll.y>t&&(T.scroll.y=t)}return T.synched("touchmove",function(){T.rail.drag&&3==T.rail.drag.pt&&(T.showCursor(),T.rail.drag.hr?T.doScrollLeft(Math.round(T.scroll.x*T.scrollratio.x),M.cursordragspeed):T.doScrollTop(Math.round(T.scroll.y*T.scrollratio.y),M.cursordragspeed))}),T.cancelEvent(e)}}}if(T.onmousedown=function(e,o){if(!T.rail.drag||1==T.rail.drag.pt){if(T.railslocked)return T.cancelEvent(e);T.cancelScroll(),T.rail.drag={x:e.clientX,y:e.clientY,sx:T.scroll.x,sy:T.scroll.y,pt:1,hr:o||!1};var t=T.getTarget(e);return N.hasmousecapture&&t.setCapture(),T.isiframe&&!N.hasmousecapture&&(T.saved.csspointerevents=T.doc.css("pointer-events"),T.css(T.doc,{"pointer-events":"none"})),T.hasmoving=!1,T.cancelEvent(e)}},T.onmouseup=function(e){if(T.rail.drag)return 1!=T.rail.drag.pt||(N.hasmousecapture&&l.releaseCapture(),T.isiframe&&!N.hasmousecapture&&T.doc.css("pointer-events",T.saved.csspointerevents),T.rail.drag=!1,T.cursorfreezed=!1,T.hasmoving&&T.triggerScrollEnd(),T.cancelEvent(e))},T.onmousemove=function(e){if(T.rail.drag){if(1!==T.rail.drag.pt)return;if(N.ischrome&&0===e.which)return T.onmouseup(e);if(T.cursorfreezed=!0,T.hasmoving||T.triggerScrollStart(e.clientX,e.clientY,0,0,0),T.hasmoving=!0,T.rail.drag.hr){T.scroll.x=T.rail.drag.sx+(e.clientX-T.rail.drag.x),T.scroll.x<0&&(T.scroll.x=0);var o=T.scrollvaluemaxw;T.scroll.x>o&&(T.scroll.x=o)}else{T.scroll.y=T.rail.drag.sy+(e.clientY-T.rail.drag.y),T.scroll.y<0&&(T.scroll.y=0);var t=T.scrollvaluemax;T.scroll.y>t&&(T.scroll.y=t)}return T.synched("mousemove",function(){T.cursorfreezed&&(T.showCursor(),T.rail.drag.hr?T.scrollLeft(Math.round(T.scroll.x*T.scrollratio.x)):T.scrollTop(Math.round(T.scroll.y*T.scrollratio.y)))}),T.cancelEvent(e)}T.checkarea=0},N.cantouch||M.emulatetouch)T.onpreventclick=function(e){if(T.preventclick)return T.preventclick.tg.onclick=T.preventclick.click,T.preventclick=!1,T.cancelEvent(e)},T.onclick=!N.isios&&function(e){return!T.lastmouseup||(T.lastmouseup=!1,T.cancelEvent(e))},M.grabcursorenabled&&N.cursorgrabvalue&&(T.css(T.ispage?T.doc:T.win,{cursor:N.cursorgrabvalue}),T.css(T.rail,{cursor:N.cursorgrabvalue}));else{var L=function(e){if(T.selectiondrag){if(e){var o=T.win.outerHeight(),t=e.pageY-T.selectiondrag.top;t>0&&t=o&&(t-=o),T.selectiondrag.df=t}if(0!==T.selectiondrag.df){var r=-2*T.selectiondrag.df/6|0;T.doScrollBy(r),T.debounced("doselectionscroll",function(){L()},50)}}};T.hasTextSelected="getSelection"in l?function(){return l.getSelection().rangeCount>0}:"selection"in l?function(){return"None"!=l.selection.type}:function(){return!1},T.onselectionstart=function(e){T.ispage||(T.selectiondrag=T.win.offset())},T.onselectionend=function(e){T.selectiondrag=!1},T.onselectiondrag=function(e){T.selectiondrag&&T.hasTextSelected()&&T.debounced("selectionscroll",function(){L(e)},250)}}if(N.hasw3ctouch?(T.css(T.ispage?n("html"):T.win,{"touch-action":"none"}),T.css(T.rail,{"touch-action":"none"}),T.css(T.cursor,{"touch-action":"none"}),T.bind(T.win,"pointerdown",T.ontouchstart),T.bind(l,"pointerup",T.ontouchend),T.delegate(l,"pointermove",T.ontouchmove)):N.hasmstouch?(T.css(T.ispage?n("html"):T.win,{"-ms-touch-action":"none"}),T.css(T.rail,{"-ms-touch-action":"none"}),T.css(T.cursor,{"-ms-touch-action":"none"}),T.bind(T.win,"MSPointerDown",T.ontouchstart),T.bind(l,"MSPointerUp",T.ontouchend),T.delegate(l,"MSPointerMove",T.ontouchmove),T.bind(T.cursor,"MSGestureHold",function(e){e.preventDefault()}),T.bind(T.cursor,"contextmenu",function(e){e.preventDefault()})):N.cantouch&&(T.bind(T.win,"touchstart",T.ontouchstart,!1,!0),T.bind(l,"touchend",T.ontouchend,!1,!0),T.bind(l,"touchcancel",T.ontouchend,!1,!0),T.delegate(l,"touchmove",T.ontouchmove,!1,!0)),M.emulatetouch&&(T.bind(T.win,"mousedown",T.ontouchstart,!1,!0),T.bind(l,"mouseup",T.ontouchend,!1,!0),T.bind(l,"mousemove",T.ontouchmove,!1,!0)),(M.cursordragontouch||!N.cantouch&&!M.emulatetouch)&&(T.rail.css({cursor:"default"}),T.railh&&T.railh.css({cursor:"default"}),T.jqbind(T.rail,"mouseenter",function(){if(!T.ispage&&!T.win.is(":visible"))return!1;T.canshowonmouseevent&&T.showCursor(),T.rail.active=!0}),T.jqbind(T.rail,"mouseleave",function(){T.rail.active=!1,T.rail.drag||T.hideCursor()}),M.sensitiverail&&(T.bind(T.rail,"click",function(e){T.doRailClick(e,!1,!1)}),T.bind(T.rail,"dblclick",function(e){T.doRailClick(e,!0,!1)}),T.bind(T.cursor,"click",function(e){T.cancelEvent(e)}),T.bind(T.cursor,"dblclick",function(e){T.cancelEvent(e)})),T.railh&&(T.jqbind(T.railh,"mouseenter",function(){if(!T.ispage&&!T.win.is(":visible"))return!1;T.canshowonmouseevent&&T.showCursor(),T.rail.active=!0}),T.jqbind(T.railh,"mouseleave",function(){T.rail.active=!1,T.rail.drag||T.hideCursor()}),M.sensitiverail&&(T.bind(T.railh,"click",function(e){T.doRailClick(e,!1,!0)}),T.bind(T.railh,"dblclick",function(e){T.doRailClick(e,!0,!0)}),T.bind(T.cursorh,"click",function(e){T.cancelEvent(e)}),T.bind(T.cursorh,"dblclick",function(e){T.cancelEvent(e)})))),M.cursordragontouch&&(this.istouchcapable||N.cantouch)&&(T.bind(T.cursor,"touchstart",T.ontouchstartCursor),T.bind(T.cursor,"touchmove",T.ontouchmoveCursor),T.bind(T.cursor,"touchend",T.ontouchendCursor),T.cursorh&&T.bind(T.cursorh,"touchstart",function(e){T.ontouchstartCursor(e,!0)}),T.cursorh&&T.bind(T.cursorh,"touchmove",T.ontouchmoveCursor),T.cursorh&&T.bind(T.cursorh,"touchend",T.ontouchendCursor)),M.emulatetouch||N.isandroid||N.isios?(T.bind(N.hasmousecapture?T.win:l,"mouseup",T.ontouchend),T.onclick&&T.bind(l,"click",T.onclick),M.cursordragontouch?(T.bind(T.cursor,"mousedown",T.onmousedown),T.bind(T.cursor,"mouseup",T.onmouseup),T.cursorh&&T.bind(T.cursorh,"mousedown",function(e){T.onmousedown(e,!0)}),T.cursorh&&T.bind(T.cursorh,"mouseup",T.onmouseup)):(T.bind(T.rail,"mousedown",function(e){e.preventDefault()}),T.railh&&T.bind(T.railh,"mousedown",function(e){e.preventDefault()}))):(T.bind(N.hasmousecapture?T.win:l,"mouseup",T.onmouseup),T.bind(l,"mousemove",T.onmousemove),T.onclick&&T.bind(l,"click",T.onclick),T.bind(T.cursor,"mousedown",T.onmousedown),T.bind(T.cursor,"mouseup",T.onmouseup),T.railh&&(T.bind(T.cursorh,"mousedown",function(e){T.onmousedown(e,!0)}),T.bind(T.cursorh,"mouseup",T.onmouseup)),!T.ispage&&M.enablescrollonselection&&(T.bind(T.win[0],"mousedown",T.onselectionstart),T.bind(l,"mouseup",T.onselectionend),T.bind(T.cursor,"mouseup",T.onselectionend),T.cursorh&&T.bind(T.cursorh,"mouseup",T.onselectionend),T.bind(l,"mousemove",T.onselectiondrag)),T.zoom&&(T.jqbind(T.zoom,"mouseenter",function(){T.canshowonmouseevent&&T.showCursor(),T.rail.active=!0}),T.jqbind(T.zoom,"mouseleave",function(){T.rail.active=!1,T.rail.drag||T.hideCursor()}))),M.enablemousewheel&&(T.isiframe||T.mousewheel(N.isie&&T.ispage?l:T.win,T.onmousewheel),T.mousewheel(T.rail,T.onmousewheel),T.railh&&T.mousewheel(T.railh,T.onmousewheelhr)),T.ispage||N.cantouch||/HTML|^BODY/.test(T.win[0].nodeName)||(T.win.attr("tabindex")||T.win.attr({tabindex:++r}),T.bind(T.win,"focus",function(e){o=T.getTarget(e).id||T.getTarget(e)||!1,T.hasfocus=!0,T.canshowonmouseevent&&T.noticeCursor()}),T.bind(T.win,"blur",function(e){o=!1,T.hasfocus=!1}),T.bind(T.win,"mouseenter",function(e){t=T.getTarget(e).id||T.getTarget(e)||!1,T.hasmousefocus=!0,T.canshowonmouseevent&&T.noticeCursor()}),T.bind(T.win,"mouseleave",function(e){t=!1,T.hasmousefocus=!1,T.rail.drag||T.hideCursor()})),T.onkeypress=function(e){if(T.railslocked&&0===T.page.maxh)return!0;e=e||a.event;var r=T.getTarget(e);if(r&&/INPUT|TEXTAREA|SELECT|OPTION/.test(r.nodeName)&&(!(r.getAttribute("type")||r.type||!1)||!/submit|button|cancel/i.tp))return!0;if(n(r).attr("contenteditable"))return!0;if(T.hasfocus||T.hasmousefocus&&!o||T.ispage&&!o&&!t){var i=e.keyCode;if(T.railslocked&&27!=i)return T.cancelEvent(e);var s=e.ctrlKey||!1,l=e.shiftKey||!1,c=!1;switch(i){case 38:case 63233:T.doScrollBy(72),c=!0;break;case 40:case 63235:T.doScrollBy(-72),c=!0;break;case 37:case 63232:T.railh&&(s?T.doScrollLeft(0):T.doScrollLeftBy(72),c=!0);break;case 39:case 63234:T.railh&&(s?T.doScrollLeft(T.page.maxw):T.doScrollLeftBy(-72),c=!0);break;case 33:case 63276:T.doScrollBy(T.view.h),c=!0;break;case 34:case 63277:T.doScrollBy(-T.view.h),c=!0;break;case 36:case 63273:T.railh&&s?T.doScrollPos(0,0):T.doScrollTo(0),c=!0;break;case 35:case 63275:T.railh&&s?T.doScrollPos(T.page.maxw,T.page.maxh):T.doScrollTo(T.page.maxh),c=!0;break;case 32:M.spacebarenabled&&(l?T.doScrollBy(T.view.h):T.doScrollBy(-T.view.h),c=!0);break;case 27:T.zoomactive&&(T.doZoom(),c=!0)}if(c)return T.cancelEvent(e)}},M.enablekeyboard&&T.bind(l,N.isopera&&!N.isopera12?"keypress":"keydown",T.onkeypress),T.bind(l,"keydown",function(e){(e.ctrlKey||!1)&&(T.wheelprevented=!0)}),T.bind(l,"keyup",function(e){e.ctrlKey||!1||(T.wheelprevented=!1)}),T.bind(a,"blur",function(e){T.wheelprevented=!1}),T.bind(a,"resize",T.onscreenresize),T.bind(a,"orientationchange",T.onscreenresize),T.bind(a,"load",T.lazyResize),N.ischrome&&!T.ispage&&!T.haswrapper){var C=T.win.attr("style"),P=parseFloat(T.win.css("width"))+1;T.win.css("width",P),T.synched("chromefix",function(){T.win.attr("style",C)})}T.onAttributeChange=function(e){T.lazyResize(T.isieold?250:30)},M.enableobserver&&(T.isie11||!1===m||(T.observerbody=new m(function(e){if(e.forEach(function(e){if("attributes"==e.type)return E.hasClass("modal-open")&&E.hasClass("modal-dialog")&&!n.contains(n(".modal-dialog")[0],T.doc[0])?T.hide():T.show()}),T.me.clientWidth!=T.page.width||T.me.clientHeight!=T.page.height)return T.lazyResize(30)}),T.observerbody.observe(l.body,{childList:!0,subtree:!0,characterData:!1,attributes:!0,attributeFilter:["class"]})),T.ispage||T.haswrapper||(!1!==m?(T.observer=new m(function(e){e.forEach(T.onAttributeChange)}),T.observer.observe(T.win[0],{childList:!0,characterData:!1,attributes:!0,subtree:!1}),T.observerremover=new m(function(e){e.forEach(function(e){if(e.removedNodes.length>0)for(var o in e.removedNodes)if(T&&e.removedNodes[o]==T.win[0])return T.remove()})}),T.observerremover.observe(T.win[0].parentNode,{childList:!0,characterData:!1,attributes:!1,subtree:!1})):(T.bind(T.win,N.isie&&!N.isie9?"propertychange":"DOMAttrModified",T.onAttributeChange),N.isie9&&T.win[0].attachEvent("onpropertychange",T.onAttributeChange),T.bind(T.win,"DOMNodeRemoved",function(e){e.target==T.win[0]&&T.remove()})))),!T.ispage&&M.boxzoom&&T.bind(a,"resize",T.resizeZoom),T.istextarea&&(T.bind(T.win,"keydown",T.lazyResize),T.bind(T.win,"mouseup",T.lazyResize)),T.lazyResize(30)}if("IFRAME"==this.doc[0].nodeName){var R=function(){T.iframexd=!1;var o;try{(o="contentDocument"in this?this.contentDocument:this.contentWindow._doc).domain}catch(e){T.iframexd=!0,o=!1}if(T.iframexd)return"console"in a&&console.log("NiceScroll error: policy restriced iframe"),!0;if(T.forcescreen=!0,T.isiframe&&(T.iframe={doc:n(o),html:T.doc.contents().find("html")[0],body:T.doc.contents().find("body")[0]},T.getContentSize=function(){return{w:Math.max(T.iframe.html.scrollWidth,T.iframe.body.scrollWidth),h:Math.max(T.iframe.html.scrollHeight,T.iframe.body.scrollHeight)}},T.docscroll=n(T.iframe.body)),!N.isios&&M.iframeautoresize&&!T.isiframe){T.win.scrollTop(0),T.doc.height("");var t=Math.max(o.getElementsByTagName("html")[0].scrollHeight,o.body.scrollHeight);T.doc.height(t)}T.lazyResize(30),T.css(n(T.iframe.body),e),N.isios&&T.haswrapper&&T.css(n(o.body),{"-webkit-transform":"translate3d(0,0,0)"}),"contentWindow"in this?T.bind(this.contentWindow,"scroll",T.onscroll):T.bind(o,"scroll",T.onscroll),M.enablemousewheel&&T.mousewheel(o,T.onmousewheel),M.enablekeyboard&&T.bind(o,N.isopera?"keypress":"keydown",T.onkeypress),N.cantouch?(T.bind(o,"touchstart",T.ontouchstart),T.bind(o,"touchmove",T.ontouchmove)):M.emulatetouch&&(T.bind(o,"mousedown",T.ontouchstart),T.bind(o,"mousemove",function(e){return T.ontouchmove(e,!0)}),M.grabcursorenabled&&N.cursorgrabvalue&&T.css(n(o.body),{cursor:N.cursorgrabvalue})),T.bind(o,"mouseup",T.ontouchend),T.zoom&&(M.dblclickzoom&&T.bind(o,"dblclick",T.doZoom),T.ongesturezoom&&T.bind(o,"gestureend",T.ongesturezoom))};this.doc[0].readyState&&"complete"===this.doc[0].readyState&&setTimeout(function(){R.call(T.doc[0],!1)},500),T.bind(this.doc,"load",R)}},this.showCursor=function(e,o){if(T.cursortimeout&&(clearTimeout(T.cursortimeout),T.cursortimeout=0),T.rail){if(T.autohidedom&&(T.autohidedom.stop().css({opacity:M.cursoropacitymax}),T.cursoractive=!0),T.rail.drag&&1==T.rail.drag.pt||(void 0!==e&&!1!==e&&(T.scroll.y=e/T.scrollratio.y|0),void 0!==o&&(T.scroll.x=o/T.scrollratio.x|0)),T.cursor.css({height:T.cursorheight,top:T.scroll.y}),T.cursorh){var t=T.hasreversehr?T.scrollvaluemaxw-T.scroll.x:T.scroll.x;T.cursorh.css({width:T.cursorwidth,left:!T.rail.align&&T.rail.visibility?t+T.rail.width:t}),T.cursoractive=!0}T.zoom&&T.zoom.stop().css({opacity:M.cursoropacitymax})}},this.hideCursor=function(e){T.cursortimeout||T.rail&&T.autohidedom&&(T.hasmousefocus&&"leave"===M.autohidemode||(T.cursortimeout=setTimeout(function(){T.rail.active&&T.showonmouseevent||(T.autohidedom.stop().animate({opacity:M.cursoropacitymin}),T.zoom&&T.zoom.stop().animate({opacity:M.cursoropacitymin}),T.cursoractive=!1),T.cursortimeout=0},e||M.hidecursordelay)))},this.noticeCursor=function(e,o,t){T.showCursor(o,t),T.rail.active||T.hideCursor(e)},this.getContentSize=T.ispage?function(){return{w:Math.max(l.body.scrollWidth,l.documentElement.scrollWidth),h:Math.max(l.body.scrollHeight,l.documentElement.scrollHeight)}}:T.haswrapper?function(){return{w:T.doc[0].offsetWidth,h:T.doc[0].offsetHeight}}:function(){return{w:T.docscroll[0].scrollWidth,h:T.docscroll[0].scrollHeight}},this.onResize=function(e,o){if(!T||!T.win)return!1;var t=T.page.maxh,r=T.page.maxw,i=T.view.h,s=T.view.w;if(T.view={w:T.ispage?T.win.width():T.win[0].clientWidth,h:T.ispage?T.win.height():T.win[0].clientHeight},T.page=o||T.getContentSize(),T.page.maxh=Math.max(0,T.page.h-T.view.h),T.page.maxw=Math.max(0,T.page.w-T.view.w),T.page.maxh==t&&T.page.maxw==r&&T.view.w==s&&T.view.h==i){if(T.ispage)return T;var n=T.win.offset();if(T.lastposition){var l=T.lastposition;if(l.top==n.top&&l.left==n.left)return T}T.lastposition=n}return 0===T.page.maxh?(T.hideRail(),T.scrollvaluemax=0,T.scroll.y=0,T.scrollratio.y=0,T.cursorheight=0,T.setScrollTop(0),T.rail&&(T.rail.scrollable=!1)):(T.page.maxh-=M.railpadding.top+M.railpadding.bottom,T.rail.scrollable=!0),0===T.page.maxw?(T.hideRailHr(),T.scrollvaluemaxw=0,T.scroll.x=0,T.scrollratio.x=0,T.cursorwidth=0,T.setScrollLeft(0),T.railh&&(T.railh.scrollable=!1)):(T.page.maxw-=M.railpadding.left+M.railpadding.right,T.railh&&(T.railh.scrollable=M.horizrailenabled)),T.railslocked=T.locked||0===T.page.maxh&&0===T.page.maxw,T.railslocked?(T.ispage||T.updateScrollBar(T.view),!1):(T.hidden||(T.rail.visibility||T.showRail(),T.railh&&!T.railh.visibility&&T.showRailHr()),T.istextarea&&T.win.css("resize")&&"none"!=T.win.css("resize")&&(T.view.h-=20),T.cursorheight=Math.min(T.view.h,Math.round(T.view.h*(T.view.h/T.page.h))),T.cursorheight=M.cursorfixedheight?M.cursorfixedheight:Math.max(M.cursorminheight,T.cursorheight),T.cursorwidth=Math.min(T.view.w,Math.round(T.view.w*(T.view.w/T.page.w))),T.cursorwidth=M.cursorfixedheight?M.cursorfixedheight:Math.max(M.cursorminheight,T.cursorwidth),T.scrollvaluemax=T.view.h-T.cursorheight-(M.railpadding.top+M.railpadding.bottom),T.hasborderbox||(T.scrollvaluemax-=T.cursor[0].offsetHeight-T.cursor[0].clientHeight),T.railh&&(T.railh.width=T.page.maxh>0?T.view.w-T.rail.width:T.view.w,T.scrollvaluemaxw=T.railh.width-T.cursorwidth-(M.railpadding.left+M.railpadding.right)),T.ispage||T.updateScrollBar(T.view),T.scrollratio={x:T.page.maxw/T.scrollvaluemaxw,y:T.page.maxh/T.scrollvaluemax},T.getScrollTop()>T.page.maxh?T.doScrollTop(T.page.maxh):(T.scroll.y=T.getScrollTop()/T.scrollratio.y|0,T.scroll.x=T.getScrollLeft()/T.scrollratio.x|0,T.cursoractive&&T.noticeCursor()),T.scroll.y&&0===T.getScrollTop()&&T.doScrollTo(T.scroll.y*T.scrollratio.y|0),T)},this.resize=T.onResize;var O=0;this.onscreenresize=function(e){clearTimeout(O);var o=!T.ispage&&!T.haswrapper;o&&T.hideRails(),O=setTimeout(function(){T&&(o&&T.showRails(),T.resize()),O=0},120)},this.lazyResize=function(e){return clearTimeout(O),O=setTimeout(function(){T&&T.resize(),O=0},e||240),T},this.jqbind=function(e,o,t){T.events.push({e:e,n:o,f:t,q:!0}),n(e).on(o,t)},this.mousewheel=function(e,o,t){var r="jquery"in e?e[0]:e;if("onwheel"in l.createElement("div"))T._bind(r,"wheel",o,t||!1);else{var i=void 0!==l.onmousewheel?"mousewheel":"DOMMouseScroll";S(r,i,o,t||!1),"DOMMouseScroll"==i&&S(r,"MozMousePixelScroll",o,t||!1)}};var Y=!1;if(N.haseventlistener){try{var H=Object.defineProperty({},"passive",{get:function(){Y=!0}});a.addEventListener("test",null,H)}catch(e){}this.stopPropagation=function(e){return!!e&&((e=e.original?e.original:e).stopPropagation(),!1)},this.cancelEvent=function(e){return e.cancelable&&e.preventDefault(),e.stopImmediatePropagation(),e.preventManipulation&&e.preventManipulation(),!1}}else Event.prototype.preventDefault=function(){this.returnValue=!1},Event.prototype.stopPropagation=function(){this.cancelBubble=!0},a.constructor.prototype.addEventListener=l.constructor.prototype.addEventListener=Element.prototype.addEventListener=function(e,o,t){this.attachEvent("on"+e,o)},a.constructor.prototype.removeEventListener=l.constructor.prototype.removeEventListener=Element.prototype.removeEventListener=function(e,o,t){this.detachEvent("on"+e,o)},this.cancelEvent=function(e){return(e=e||a.event)&&(e.cancelBubble=!0,e.cancel=!0,e.returnValue=!1),!1},this.stopPropagation=function(e){return(e=e||a.event)&&(e.cancelBubble=!0),!1};this.delegate=function(e,o,t,r,i){var s=d[o]||!1;s||(s={a:[],l:[],f:function(e){for(var o=s.l,t=!1,r=o.length-1;r>=0;r--)if(!1===(t=o[r].call(e.target,e)))return!1;return t}},T.bind(e,o,s.f,r,i),d[o]=s),T.ispage?(s.a=[T.id].concat(s.a),s.l=[t].concat(s.l)):(s.a.push(T.id),s.l.push(t))},this.undelegate=function(e,o,t,r,i){var s=d[o]||!1;if(s)for(var n=0,l=s.l.length;n0)return t;o=!!o.parentNode&&o.parentNode}return!1},this.triggerScrollStart=function(e,o,t,r,i){if(T.onscrollstart){var s={type:"scrollstart",current:{x:e,y:o},request:{x:t,y:r},end:{x:T.newscrollx,y:T.newscrolly},speed:i};T.onscrollstart.call(T,s)}},this.triggerScrollEnd=function(){if(T.onscrollend){var e=T.getScrollLeft(),o=T.getScrollTop(),t={type:"scrollend",current:{x:e,y:o},end:{x:e,y:o}};T.onscrollend.call(T,t)}};var B=0,X=0,D=0,A=1,q=!1;if(this.onmousewheel=function(e){if(T.wheelprevented||T.locked)return!1;if(T.railslocked)return T.debounced("checkunlock",T.resize,250),!1;if(T.rail.drag)return T.cancelEvent(e);if("auto"===M.oneaxismousemode&&0!==e.deltaX&&(M.oneaxismousemode=!1),M.oneaxismousemode&&0===e.deltaX&&!T.rail.scrollable)return!T.railh||!T.railh.scrollable||T.onmousewheelhr(e);var o=f(),t=!1;if(M.preservenativescrolling&&T.checkarea+600T.page.maxh&&(o=T.page.maxh+(o-T.page.maxh)/2|0),e<0?e=e/2|0:e>T.page.maxw&&(e=T.page.maxw+(e-T.page.maxw)/2|0)):(o<0?o=0:o>T.page.maxh&&(o=T.page.maxh),e<0?e=0:e>T.page.maxw&&(e=T.page.maxw)),T.scrollrunning&&e==T.newscrollx&&o==T.newscrolly)return!1;T.newscrolly=o,T.newscrollx=e;var s=T.getScrollTop(),n=T.getScrollLeft(),l={};l.x=e-n,l.y=o-s;var a=0|Math.sqrt(l.x*l.x+l.y*l.y),c=T.prepareTransition(a);T.scrollrunning||(T.scrollrunning=!0,T.triggerScrollStart(n,s,e,o,c),T.cursorupdate.start()),T.scrollendtrapped=!0,N.transitionend||(T.scrollendtrapped&&clearTimeout(T.scrollendtrapped),T.scrollendtrapped=setTimeout(T.onScrollTransitionEnd,c)),T.setScrollTop(T.newscrolly),T.setScrollLeft(T.newscrollx)},this.cancelScroll=function(){if(!T.scrollendtrapped)return!0;var e=T.getScrollTop(),o=T.getScrollLeft();return T.scrollrunning=!1,N.transitionend||clearTimeout(N.transitionend),T.scrollendtrapped=!1,T.resetTransition(),T.setScrollTop(e),T.railh&&T.setScrollLeft(o),T.timerscroll&&T.timerscroll.tm&&clearInterval(T.timerscroll.tm),T.timerscroll=!1,T.cursorfreezed=!1,T.cursorupdate.stop(),T.showCursor(e,o),T},this.onScrollTransitionEnd=function(){if(T.scrollendtrapped){var e=T.getScrollTop(),o=T.getScrollLeft();if(e<0?e=0:e>T.page.maxh&&(e=T.page.maxh),o<0?o=0:o>T.page.maxw&&(o=T.page.maxw),e!=T.newscrolly||o!=T.newscrollx)return T.doScrollPos(o,e,M.snapbackspeed);T.scrollrunning&&T.triggerScrollEnd(),T.scrollrunning=!1,T.scrollendtrapped=!1,T.resetTransition(),T.timerscroll=!1,T.setScrollTop(e),T.railh&&T.setScrollLeft(o),T.cursorupdate.stop(),T.noticeCursor(!1,e,o),T.cursorfreezed=!1}}}else this.doScrollLeft=function(e,o){var t=T.scrollrunning?T.newscrolly:T.getScrollTop();T.doScrollPos(e,t,o)},this.doScrollTop=function(e,o){var t=T.scrollrunning?T.newscrollx:T.getScrollLeft();T.doScrollPos(t,e,o)},this.doScrollPos=function(e,o,t){var r=T.getScrollTop(),i=T.getScrollLeft();((T.newscrolly-r)*(o-r)<0||(T.newscrollx-i)*(e-i)<0)&&T.cancelScroll();var s=!1;if(T.bouncescroll&&T.rail.visibility||(o<0?(o=0,s=!0):o>T.page.maxh&&(o=T.page.maxh,s=!0)),T.bouncescroll&&T.railh.visibility||(e<0?(e=0,s=!0):e>T.page.maxw&&(e=T.page.maxw,s=!0)),T.scrollrunning&&T.newscrolly===o&&T.newscrollx===e)return!0;T.newscrolly=o,T.newscrollx=e,T.dst={},T.dst.x=e-i,T.dst.y=o-r,T.dst.px=i,T.dst.py=r;var n=0|Math.sqrt(T.dst.x*T.dst.x+T.dst.y*T.dst.y),l=T.getTransitionSpeed(n);T.bzscroll={};var a=s?1:.58;T.bzscroll.x=new R(i,T.newscrollx,l,0,0,a,1),T.bzscroll.y=new R(r,T.newscrolly,l,0,0,a,1);f();var c=function(){if(T.scrollrunning){var e=T.bzscroll.y.getPos();T.setScrollLeft(T.bzscroll.x.getNow()),T.setScrollTop(T.bzscroll.y.getNow()),e<=1?T.timer=u(c):(T.scrollrunning=!1,T.timer=0,T.triggerScrollEnd())}};T.scrollrunning||(T.triggerScrollStart(i,r,e,o,l),T.scrollrunning=!0,T.timer=u(c))},this.cancelScroll=function(){return T.timer&&h(T.timer),T.timer=0,T.bzscroll=!1,T.scrollrunning=!1,T};else this.doScrollLeft=function(e,o){var t=T.getScrollTop();T.doScrollPos(e,t,o)},this.doScrollTop=function(e,o){var t=T.getScrollLeft();T.doScrollPos(t,e,o)},this.doScrollPos=function(e,o,t){var r=e>T.page.maxw?T.page.maxw:e;r<0&&(r=0);var i=o>T.page.maxh?T.page.maxh:o;i<0&&(i=0),T.synched("scroll",function(){T.setScrollTop(i),T.setScrollLeft(r)})},this.cancelScroll=function(){};this.doScrollBy=function(e,o){z(0,e)},this.doScrollLeftBy=function(e,o){z(e,0)},this.doScrollTo=function(e,o){var t=o?Math.round(e*T.scrollratio.y):e;t<0?t=0:t>T.page.maxh&&(t=T.page.maxh),T.cursorfreezed=!1,T.doScrollTop(e)},this.checkContentSize=function(){var e=T.getContentSize();e.h==T.page.h&&e.w==T.page.w||T.resize(!1,e)},T.onscroll=function(e){T.rail.drag||T.cursorfreezed||T.synched("scroll",function(){T.scroll.y=Math.round(T.getScrollTop()/T.scrollratio.y),T.railh&&(T.scroll.x=Math.round(T.getScrollLeft()/T.scrollratio.x)),T.noticeCursor()})},T.bind(T.docscroll,"scroll",T.onscroll),this.doZoomIn=function(e){if(!T.zoomactive){T.zoomactive=!0,T.zoomrestore={style:{}};var o=["position","top","left","zIndex","backgroundColor","marginTop","marginBottom","marginLeft","marginRight"],t=T.win[0].style;for(var r in o){var i=o[r];T.zoomrestore.style[i]=void 0!==t[i]?t[i]:""}T.zoomrestore.style.width=T.win.css("width"),T.zoomrestore.style.height=T.win.css("height"),T.zoomrestore.padding={w:T.win.outerWidth()-T.win.width(),h:T.win.outerHeight()-T.win.height()},N.isios4&&(T.zoomrestore.scrollTop=c.scrollTop(),c.scrollTop(0)),T.win.css({position:N.isios4?"absolute":"fixed",top:0,left:0,zIndex:s+100,margin:0});var n=T.win.css("backgroundColor");return(""===n||/transparent|rgba\(0, 0, 0, 0\)|rgba\(0,0,0,0\)/.test(n))&&T.win.css("backgroundColor","#fff"),T.rail.css({zIndex:s+101}),T.zoom.css({zIndex:s+102}),T.zoom.css("backgroundPosition","0 -18px"),T.resizeZoom(),T.onzoomin&&T.onzoomin.call(T),T.cancelEvent(e)}},this.doZoomOut=function(e){if(T.zoomactive)return T.zoomactive=!1,T.win.css("margin",""),T.win.css(T.zoomrestore.style),N.isios4&&c.scrollTop(T.zoomrestore.scrollTop),T.rail.css({"z-index":T.zindex}),T.zoom.css({"z-index":T.zindex}),T.zoomrestore=!1,T.zoom.css("backgroundPosition","0 0"),T.onResize(),T.onzoomout&&T.onzoomout.call(T),T.cancelEvent(e)},this.doZoom=function(e){return T.zoomactive?T.doZoomOut(e):T.doZoomIn(e)},this.resizeZoom=function(){if(T.zoomactive){var e=T.getScrollTop();T.win.css({width:c.width()-T.zoomrestore.padding.w+"px",height:c.height()-T.zoomrestore.padding.h+"px"}),T.onResize(),T.setScrollTop(Math.min(T.page.maxh,e))}},this.init(),n.nicescroll.push(this)},y=function(e){var o=this;this.nc=e,this.lastx=0,this.lasty=0,this.speedx=0,this.speedy=0,this.lasttime=0,this.steptime=0,this.snapx=!1,this.snapy=!1,this.demulx=0,this.demuly=0,this.lastscrollx=-1,this.lastscrolly=-1,this.chkx=0,this.chky=0,this.timer=0,this.reset=function(e,t){o.stop(),o.steptime=0,o.lasttime=f(),o.speedx=0,o.speedy=0,o.lastx=e,o.lasty=t,o.lastscrollx=-1,o.lastscrolly=-1},this.update=function(e,t){var r=f();o.steptime=r-o.lasttime,o.lasttime=r;var i=t-o.lasty,s=e-o.lastx,n=o.nc.getScrollTop()+i,l=o.nc.getScrollLeft()+s;o.snapx=l<0||l>o.nc.page.maxw,o.snapy=n<0||n>o.nc.page.maxh,o.speedx=s,o.speedy=i,o.lastx=e,o.lasty=t},this.stop=function(){o.nc.unsynched("domomentum2d"),o.timer&&clearTimeout(o.timer),o.timer=0,o.lastscrollx=-1,o.lastscrolly=-1},this.doSnapy=function(e,t){var r=!1;t<0?(t=0,r=!0):t>o.nc.page.maxh&&(t=o.nc.page.maxh,r=!0),e<0?(e=0,r=!0):e>o.nc.page.maxw&&(e=o.nc.page.maxw,r=!0),r?o.nc.doScrollPos(e,t,o.nc.opt.snapbackspeed):o.nc.triggerScrollEnd()},this.doMomentum=function(e){var t=f(),r=e?t+e:o.lasttime,i=o.nc.getScrollLeft(),s=o.nc.getScrollTop(),n=o.nc.page.maxh,l=o.nc.page.maxw;o.speedx=l>0?Math.min(60,o.speedx):0,o.speedy=n>0?Math.min(60,o.speedy):0;var a=r&&t-r<=60;(s<0||s>n||i<0||i>l)&&(a=!1);var c=!(!o.speedy||!a)&&o.speedy,d=!(!o.speedx||!a)&&o.speedx;if(c||d){var u=Math.max(16,o.steptime);if(u>50){var h=u/50;o.speedx*=h,o.speedy*=h,u=50}o.demulxy=0,o.lastscrollx=o.nc.getScrollLeft(),o.chkx=o.lastscrollx,o.lastscrolly=o.nc.getScrollTop(),o.chky=o.lastscrolly;var p=o.lastscrollx,m=o.lastscrolly,g=function(){var e=f()-t>600?.04:.02;o.speedx&&(p=Math.floor(o.lastscrollx-o.speedx*(1-o.demulxy)),o.lastscrollx=p,(p<0||p>l)&&(e=.1)),o.speedy&&(m=Math.floor(o.lastscrolly-o.speedy*(1-o.demulxy)),o.lastscrolly=m,(m<0||m>n)&&(e=.1)),o.demulxy=Math.min(1,o.demulxy+e),o.nc.synched("domomentum2d",function(){if(o.speedx){o.nc.getScrollLeft();o.chkx=p,o.nc.setScrollLeft(p)}if(o.speedy){o.nc.getScrollTop();o.chky=m,o.nc.setScrollTop(m)}o.timer||(o.nc.hideCursor(),o.doSnapy(p,m))}),o.demulxy<1?o.timer=setTimeout(g,u):(o.stop(),o.nc.hideCursor(),o.doSnapy(p,m))};g()}else o.doSnapy(o.nc.getScrollLeft(),o.nc.getScrollTop())}},x=e.fn.scrollTop;e.cssHooks.pageYOffset={get:function(e,o,t){var r=n.data(e,"__nicescroll")||!1;return r&&r.ishwscroll?r.getScrollTop():x.call(e)},set:function(e,o){var t=n.data(e,"__nicescroll")||!1;return t&&t.ishwscroll?t.setScrollTop(parseInt(o)):x.call(e,o),this}},e.fn.scrollTop=function(e){if(void 0===e){var o=!!this[0]&&(n.data(this[0],"__nicescroll")||!1);return o&&o.ishwscroll?o.getScrollTop():x.call(this)}return this.each(function(){var o=n.data(this,"__nicescroll")||!1;o&&o.ishwscroll?o.setScrollTop(parseInt(e)):x.call(n(this),e)})};var S=e.fn.scrollLeft;n.cssHooks.pageXOffset={get:function(e,o,t){var r=n.data(e,"__nicescroll")||!1;return r&&r.ishwscroll?r.getScrollLeft():S.call(e)},set:function(e,o){var t=n.data(e,"__nicescroll")||!1;return t&&t.ishwscroll?t.setScrollLeft(parseInt(o)):S.call(e,o),this}},e.fn.scrollLeft=function(e){if(void 0===e){var o=!!this[0]&&(n.data(this[0],"__nicescroll")||!1);return o&&o.ishwscroll?o.getScrollLeft():S.call(this)}return this.each(function(){var o=n.data(this,"__nicescroll")||!1;o&&o.ishwscroll?o.setScrollLeft(parseInt(e)):S.call(n(this),e)})};var z=function(e){var o=this;if(this.length=0,this.name="nicescrollarray",this.each=function(e){return n.each(o,e),o},this.push=function(e){o[o.length]=e,o.length++},this.eq=function(e){return o[e]},e)for(var t=0;t1?n(e,r):s,i.win=r}!("doc"in i)||"win"in i||(i.win=r);var l=r.data("__nicescroll")||!1;l||(i.doc=i.doc||r,l=new b(i,r),r.data("__nicescroll",l)),t.push(l)}),1===t.length?t[0]:t},a.NiceScroll={getjQuery:function(){return e}},n.nicescroll||(n.nicescroll=new z,n.nicescroll.options=g)}); \ No newline at end of file +/* jquery.nicescroll v3.7.5-c [DEV] InuYaksa - MIT - https://nicescroll.areaaperta.com */ +!function(e){"function"==typeof define&&define.amd?define(["jquery"],e):"object"==typeof exports?module.exports=e(require("jquery")):e(jQuery)}(function(e){"use strict";var o=!1,t=!1,r=0,i=2e3,s=0,n=e,l=document,a=window,c=n(a),d=[],u=a.requestAnimationFrame||a.webkitRequestAnimationFrame||a.mozRequestAnimationFrame||!1,h=a.cancelAnimationFrame||a.webkitCancelAnimationFrame||a.mozCancelAnimationFrame||!1;if(u)a.cancelAnimationFrame||(h=function(e){});else{var p=0;u=function(e,o){var t=(new Date).getTime(),r=Math.max(0,16-(t-p)),i=a.setTimeout(function(){e(t+r)},r);return p=t+r,i},h=function(e){a.clearTimeout(e)}}var m=a.MutationObserver||a.WebKitMutationObserver||!1,f=Date.now||function(){return(new Date).getTime()},g={zindex:"auto",cursoropacitymin:0,cursoropacitymax:1,cursorcolor:"#424242",cursorwidth:"6px",cursorborder:"1px solid #fff",cursorborderradius:"5px",scrollspeed:40,mousescrollstep:27,touchbehavior:!1,emulatetouch:!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 e=l.currentScript||function(){var e=l.getElementsByTagName("script");return!!e.length&&e[e.length-1]}(),o=e?e.src.split("?")[0]:"";return o.split("/").length>0?o.split("/").slice(0,-1).join("/")+"/":""}(),preventmultitouchscrolling:!0,disablemutationobserver:!1,enableobserver:!0,scrollbarid:!1},v=!1,w=function(){if(v)return v;var e=l.createElement("DIV"),o=e.style,t=navigator.userAgent,r=navigator.platform,i={};return i.haspointerlock="pointerLockElement"in l||"webkitPointerLockElement"in l||"mozPointerLockElement"in l,i.isopera="opera"in a,i.isopera12=i.isopera&&"getUserMedia"in navigator,i.isoperamini="[object OperaMini]"===Object.prototype.toString.call(a.operamini),i.isie="all"in l&&"attachEvent"in e&&!i.isopera,i.isieold=i.isie&&!("msInterpolationMode"in o),i.isie7=i.isie&&!i.isieold&&(!("documentMode"in l)||7===l.documentMode),i.isie8=i.isie&&"documentMode"in l&&8===l.documentMode,i.isie9=i.isie&&"performance"in a&&9===l.documentMode,i.isie10=i.isie&&"performance"in a&&10===l.documentMode,i.isie11="msRequestFullscreen"in e&&l.documentMode>=11,i.ismsedge="msCredentials"in a,i.ismozilla="MozAppearance"in o,i.iswebkit=!i.ismsedge&&"WebkitAppearance"in o,i.ischrome=i.iswebkit&&"chrome"in a,i.ischrome38=i.ischrome&&"touchAction"in o,i.ischrome22=!i.ischrome38&&i.ischrome&&i.haspointerlock,i.ischrome26=!i.ischrome38&&i.ischrome&&"transition"in o,i.cantouch="ontouchstart"in l.documentElement||"ontouchstart"in a,i.hasw3ctouch=(a.PointerEvent||!1)&&(navigator.maxTouchPoints>0||navigator.msMaxTouchPoints>0),i.hasmstouch=!i.hasw3ctouch&&(a.MSPointerEvent||!1),i.ismac=/^mac$/i.test(r),i.isios=i.cantouch&&/iphone|ipad|ipod/i.test(r),i.isios4=i.isios&&!("seal"in Object),i.isios7=i.isios&&"webkitHidden"in l,i.isios8=i.isios&&"hidden"in l,i.isios10=i.isios&&a.Proxy,i.isandroid=/android/i.test(t),i.haseventlistener="addEventListener"in e,i.trstyle=!1,i.hastransform=!1,i.hastranslate3d=!1,i.transitionstyle=!1,i.hastransition=!1,i.transitionend=!1,i.trstyle="transform",i.hastransform="transform"in o||function(){for(var e=["msTransform","webkitTransform","MozTransform","OTransform"],t=0,r=e.length;t0;){if(9==e[0].nodeType)return!1;var o=e.css("zIndex");if(!isNaN(o)&&0!==o)return parseInt(o);e=e.parent()}return!1}function x(e,o,t){var r=e.css(o),i=parseFloat(r);if(isNaN(i)){var s=3==(i=I[r]||0)?t?T.win.outerHeight()-T.win.innerHeight():T.win.outerWidth()-T.win.innerWidth():1;return T.isie8&&i&&(i+=1),s?i:0}return i}function S(e,o,t,r){T._bind(e,o,function(r){var i={original:r=r||a.event,target:r.target||r.srcElement,type:"wheel",deltaMode:"MozMousePixelScroll"==r.type?0:1,deltaX:0,deltaZ:0,preventDefault:function(){return r.preventDefault?r.preventDefault():r.returnValue=!1,!1},stopImmediatePropagation:function(){r.stopImmediatePropagation?r.stopImmediatePropagation():r.cancelBubble=!0}};return"mousewheel"==o?(r.wheelDeltaX&&(i.deltaX=-.025*r.wheelDeltaX),r.wheelDeltaY&&(i.deltaY=-.025*r.wheelDeltaY),!i.deltaY&&!i.deltaX&&(i.deltaY=-.025*r.wheelDelta)):i.deltaY=r.detail,t.call(e,i)},r)}function z(e,o,t,r){T.scrollrunning||(T.newscrolly=T.getScrollTop(),T.newscrollx=T.getScrollLeft(),D=f());var i=f()-D;if(D=f(),i>350?A=1:A+=(2-A)/10,e=e*A|0,o=o*A|0,e){if(r)if(e<0){if(T.getScrollLeft()>=T.page.maxw)return!0}else if(T.getScrollLeft()<=0)return!0;var s=e>0?1:-1;X!==s&&(T.scrollmom&&T.scrollmom.stop(),T.newscrollx=T.getScrollLeft(),X=s),T.lastdeltax-=e}if(o){if(function(){var e=T.getScrollTop();if(o<0){if(e>=T.page.maxh)return!0}else if(e<=0)return!0}()){if(M.nativeparentscrolling&&t&&!T.ispage&&!T.zoomactive)return!0;var n=T.view.h>>1;T.newscrolly<-n?(T.newscrolly=-n,o=-1):T.newscrolly>T.page.maxh+n?(T.newscrolly=T.page.maxh+n,o=1):o=0}var l=o>0?1:-1;B!==l&&(T.scrollmom&&T.scrollmom.stop(),T.newscrolly=T.getScrollTop(),B=l),T.lastdeltay-=o}(o||e)&&T.synched("relativexy",function(){var e=T.lastdeltay+T.newscrolly;T.lastdeltay=0;var o=T.lastdeltax+T.newscrollx;T.lastdeltax=0,T.rail.drag||T.doScrollPos(o,e)})}function k(e,o,t){var r,i;return!(t||!q)||(0===e.deltaMode?(r=-e.deltaX*(M.mousescrollstep/54)|0,i=-e.deltaY*(M.mousescrollstep/54)|0):1===e.deltaMode&&(r=-e.deltaX*M.mousescrollstep*50/80|0,i=-e.deltaY*M.mousescrollstep*50/80|0),o&&M.oneaxismousemode&&0===r&&i&&(r=i,i=0,t&&(r<0?T.getScrollLeft()>=T.page.maxw:T.getScrollLeft()<=0)&&(i=r,r=0)),T.isrtlmode&&(r=-r),z(r,i,t,!0)?void(t&&(q=!0)):(q=!1,e.stopImmediatePropagation(),e.preventDefault()))}var T=this;this.version="3.7.5-c",this.name="nicescroll",this.me=p;var E=n("body"),M=this.opt={doc:E,win:!1};if(n.extend(M,g),M.snapbackspeed=80,e)for(var L in M)void 0!==e[L]&&(M[L]=e[L]);if(M.disablemutationobserver&&(m=!1),this.doc=M.doc,this.iddoc=this.doc&&this.doc[0]?this.doc[0].id||"":"",this.ispage=/^BODY|HTML/.test(M.win?M.win[0].nodeName:this.doc[0].nodeName),this.haswrapper=!1!==M.win,this.win=M.win||(this.ispage?c:this.doc),this.docscroll=this.ispage&&!this.haswrapper?c:this.win,this.body=E,this.viewport=!1,this.isfixed=!1,this.iframe=!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"!=M.autohidemode,this.onmousedown=!1,this.onmouseup=!1,this.onmousemove=!1,this.onmousewheel=!1,this.onkeypress=!1,this.ongesturezoom=!1,this.onclick=!1,this.onscrollstart=!1,this.onscrollend=!1,this.onscrollcancel=!1,this.onzoomin=!1,this.onzoomout=!1,this.view=!1,this.page=!1,this.scroll={x:0,y:0},this.scrollratio={x:0,y:0},this.cursorheight=20,this.scrollvaluemax=0,"auto"==M.rtlmode){var C=this.win[0]==a?this.body:this.win,P=C.css("writing-mode")||C.css("-webkit-writing-mode")||C.css("-ms-writing-mode")||C.css("-moz-writing-mode");"horizontal-tb"==P||"lr-tb"==P||""===P?(this.isrtlmode="rtl"==C.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===M.rtlmode,this.isvertical=!1;if(this.scrollrunning=!1,this.scrollmom=!1,this.observer=!1,this.observerremover=!1,this.observerbody=!1,!1!==M.scrollbarid)this.id=M.scrollbarid;else do{this.id="ascrail"+i++}while(l.getElementById(this.id));this.rail=!1,this.cursor=!1,this.cursorfreezed=!1,this.selectiondrag=!1,this.zoom=!1,this.zoomactive=!1,this.hasfocus=!1,this.hasmousefocus=!1,this.railslocked=!1,this.locked=!1,this.hidden=!1,this.cursoractive=!0,this.wheelprevented=!1,this.overflowx=M.overflowx,this.overflowy=M.overflowy,this.nativescrollingarea=!1,this.checkarea=0,this.events=[],this.saved={},this.delaylist={},this.synclist={},this.lastdeltax=0,this.lastdeltay=0,this.detected=w();var N=n.extend({},this.detected);this.canhwscroll=N.hastransform&&M.hwacceleration,this.ishwscroll=this.canhwscroll&&T.haswrapper,this.isrtlmode?this.isvertical?this.hasreversehr=!(N.iswebkit||N.isie||N.isie11):this.hasreversehr=!(N.iswebkit||N.isie&&!N.isie10&&!N.isie11):this.hasreversehr=!1,this.istouchcapable=!1,N.cantouch||!N.hasw3ctouch&&!N.hasmstouch?!N.cantouch||N.isios||N.isandroid||!N.iswebkit&&!N.ismozilla||(this.istouchcapable=!0):this.istouchcapable=!0,M.enablemouselockapi||(N.hasmousecapture=!1,N.haspointerlock=!1),this.debounced=function(e,o,t){T&&(T.delaylist[e]||!1||(T.delaylist[e]={h:u(function(){T.delaylist[e].fn.call(T),T.delaylist[e]=!1},t)},o.call(T)),T.delaylist[e].fn=o)},this.synched=function(e,o){T.synclist[e]?T.synclist[e]=o:(T.synclist[e]=o,u(function(){T&&(T.synclist[e]&&T.synclist[e].call(T),T.synclist[e]=null)}))},this.unsynched=function(e){T.synclist[e]&&(T.synclist[e]=!1)},this.css=function(e,o){for(var t in o)T.saved.css.push([e,t,e.css(t)]),e.css(t,o[t])},this.scrollTop=function(e){return void 0===e?T.getScrollTop():T.setScrollTop(e)},this.scrollLeft=function(e){return void 0===e?T.getScrollLeft():T.setScrollLeft(e)};var R=function(e,o,t,r,i,s,n){this.st=e,this.ed=o,this.spd=t,this.p1=r||0,this.p2=i||1,this.p3=s||0,this.p4=n||1,this.ts=f(),this.df=o-e};if(R.prototype={B2:function(e){return 3*(1-e)*(1-e)*e},B3:function(e){return 3*(1-e)*e*e},B4:function(e){return e*e*e},getPos:function(){return(f()-this.ts)/this.spd},getNow:function(){var e=(f()-this.ts)/this.spd,o=this.B2(e)+this.B3(e)+this.B4(e);return e>=1?this.ed:this.st+this.df*o|0},update:function(e,o){return this.st=this.getNow(),this.ed=e,this.spd=o,this.ts=f(),this.df=this.ed-this.st,this}},this.ishwscroll){this.doc.translate={x:0,y:0,tx:"0px",ty:"0px"},N.hastranslate3d&&N.isios&&this.doc.css("-webkit-backface-visibility","hidden"),this.getScrollTop=function(e){if(!e){var o=v();if(o)return 16==o.length?-o[13]:-o[5];if(T.timerscroll&&T.timerscroll.bz)return T.timerscroll.bz.getNow()}return T.doc.translate.y},this.getScrollLeft=function(e){if(!e){var o=v();if(o)return 16==o.length?-o[12]:-o[4];if(T.timerscroll&&T.timerscroll.bh)return T.timerscroll.bh.getNow()}return T.doc.translate.x},this.notifyScrollEvent=function(e){var o=l.createEvent("UIEvents");o.initUIEvent("scroll",!1,!1,a,1),o.niceevent=!0,e.dispatchEvent(o)};var _=this.isrtlmode?1:-1;N.hastranslate3d&&M.enabletranslate3d?(this.setScrollTop=function(e,o){T.doc.translate.y=e,T.doc.translate.ty=-1*e+"px",T.doc.css(N.trstyle,"translate3d("+T.doc.translate.tx+","+T.doc.translate.ty+",0)"),o||T.notifyScrollEvent(T.win[0])},this.setScrollLeft=function(e,o){T.doc.translate.x=e,T.doc.translate.tx=e*_+"px",T.doc.css(N.trstyle,"translate3d("+T.doc.translate.tx+","+T.doc.translate.ty+",0)"),o||T.notifyScrollEvent(T.win[0])}):(this.setScrollTop=function(e,o){T.doc.translate.y=e,T.doc.translate.ty=-1*e+"px",T.doc.css(N.trstyle,"translate("+T.doc.translate.tx+","+T.doc.translate.ty+")"),o||T.notifyScrollEvent(T.win[0])},this.setScrollLeft=function(e,o){T.doc.translate.x=e,T.doc.translate.tx=e*_+"px",T.doc.css(N.trstyle,"translate("+T.doc.translate.tx+","+T.doc.translate.ty+")"),o||T.notifyScrollEvent(T.win[0])})}else this.getScrollTop=function(){return T.docscroll.scrollTop()},this.setScrollTop=function(e){T.docscroll.scrollTop(e)},this.getScrollLeft=function(){return T.hasreversehr?T.detected.ismozilla?T.page.maxw-Math.abs(T.docscroll.scrollLeft()):T.page.maxw-T.docscroll.scrollLeft():T.docscroll.scrollLeft()},this.setScrollLeft=function(e){return setTimeout(function(){if(T)return T.hasreversehr&&(e=T.detected.ismozilla?-(T.page.maxw-e):T.page.maxw-e),T.docscroll.scrollLeft(e)},1)};this.getTarget=function(e){return!!e&&(e.target?e.target:!!e.srcElement&&e.srcElement)},this.hasParent=function(e,o){if(!e)return!1;for(var t=e.target||e.srcElement||e||!1;t&&t.id!=o;)t=t.parentNode||!1;return!1!==t};var I={thin:1,medium:3,thick:5};this.getDocumentScrollOffset=function(){return{top:a.pageYOffset||l.documentElement.scrollTop,left:a.pageXOffset||l.documentElement.scrollLeft}},this.getOffset=function(){if(T.isfixed){var e=T.win.offset(),o=T.getDocumentScrollOffset();return e.top-=o.top,e.left-=o.left,e}var t=T.win.offset();if(!T.viewport)return t;var r=T.viewport.offset();return{top:t.top-r.top,left:t.left-r.left}},this.updateScrollBar=function(e){var o,t;if(T.ishwscroll)T.rail.css({height:T.win.innerHeight()-(M.railpadding.top+M.railpadding.bottom)}),T.railh&&T.railh.css({width:T.win.innerWidth()-(M.railpadding.left+M.railpadding.right)});else{var r=T.getOffset();if(o={top:r.top,left:r.left-(M.railpadding.left+M.railpadding.right)},o.top+=x(T.win,"border-top-width",!0),o.left+=T.rail.align?T.win.outerWidth()-x(T.win,"border-right-width")-T.rail.width:x(T.win,"border-left-width"),(t=M.railoffset)&&(t.top&&(o.top+=t.top),t.left&&(o.left+=t.left)),T.railslocked||T.rail.css({top:o.top,left:o.left,height:(e?e.h:T.win.innerHeight())-(M.railpadding.top+M.railpadding.bottom)}),T.zoom&&T.zoom.css({top:o.top+1,left:1==T.rail.align?o.left-20:o.left+T.rail.width+4}),T.railh&&!T.railslocked){o={top:r.top,left:r.left},(t=M.railhoffset)&&(t.top&&(o.top+=t.top),t.left&&(o.left+=t.left));var i=T.railh.align?o.top+x(T.win,"border-top-width",!0)+T.win.innerHeight()-T.railh.height:o.top+x(T.win,"border-top-width",!0),s=o.left+x(T.win,"border-left-width");T.railh.css({top:i-(M.railpadding.top+M.railpadding.bottom),left:s,width:T.railh.width})}}},this.doRailClick=function(e,o,t){var r,i,s,n;T.railslocked||(T.cancelEvent(e),"pageY"in e||(e.pageX=e.clientX+l.documentElement.scrollLeft,e.pageY=e.clientY+l.documentElement.scrollTop),o?(r=t?T.doScrollLeft:T.doScrollTop,s=t?(e.pageX-T.railh.offset().left-T.cursorwidth/2)*T.scrollratio.x:(e.pageY-T.rail.offset().top-T.cursorheight/2)*T.scrollratio.y,T.unsynched("relativexy"),r(0|s)):(r=t?T.doScrollLeftBy:T.doScrollBy,s=t?T.scroll.x:T.scroll.y,n=t?e.pageX-T.railh.offset().left:e.pageY-T.rail.offset().top,i=t?T.view.w:T.view.h,r(s>=n?i:-i)))},T.newscrolly=T.newscrollx=0,T.hasanimationframe="requestAnimationFrame"in a,T.hascancelanimationframe="cancelAnimationFrame"in a,T.hasborderbox=!1,this.init=function(){if(T.saved.css=[],N.isoperamini)return!0;if(N.isandroid&&!("hidden"in l))return!0;M.emulatetouch=M.emulatetouch||M.touchbehavior,T.hasborderbox=a.getComputedStyle&&"border-box"===a.getComputedStyle(l.body)["box-sizing"];var e={"overflow-y":"hidden"};if((N.isie11||N.isie10)&&(e["-ms-overflow-style"]="none"),T.ishwscroll&&(this.doc.css(N.transitionstyle,N.prefixstyle+"transform 0ms ease-out"),N.transitionend&&T.bind(T.doc,N.transitionend,T.onScrollTransitionEnd,!1)),T.zindex="auto",T.ispage||"auto"!=M.zindex?T.zindex=M.zindex:T.zindex=b()||"auto",!T.ispage&&"auto"!=T.zindex&&T.zindex>s&&(s=T.zindex),T.isie&&0===T.zindex&&"auto"==M.zindex&&(T.zindex="auto"),!T.ispage||!N.isieold){var i=T.docscroll;T.ispage&&(i=T.haswrapper?T.win:T.doc),T.css(i,e),T.ispage&&(N.isie11||N.isie)&&T.css(n("html"),e),!N.isios||T.ispage||T.haswrapper||T.css(E,{"-webkit-overflow-scrolling":"touch"});var d=n(l.createElement("div"));d.css({position:"relative",top:0,float:"right",width:M.cursorwidth,height:0,"background-color":M.cursorcolor,border:M.cursorborder,"background-clip":"padding-box","-webkit-border-radius":M.cursorborderradius,"-moz-border-radius":M.cursorborderradius,"border-radius":M.cursorborderradius}),d.addClass("nicescroll-cursors"),T.cursor=d;var u=n(l.createElement("div"));u.attr("id",T.id),u.addClass("nicescroll-rails nicescroll-rails-vr");var h,p,f=["left","right","top","bottom"];for(var g in f)p=f[g],(h=M.railpadding[p]||0)&&u.css("padding-"+p,h+"px");u.append(d),u.width=Math.max(parseFloat(M.cursorwidth),d.outerWidth()),u.css({width:u.width+"px",zIndex:T.zindex,background:M.background,cursor:"default"}),u.visibility=!0,u.scrollable=!0,u.align="left"==M.railalign?0:1,T.rail=u,T.rail.drag=!1;var v=!1;!M.boxzoom||T.ispage||N.isieold||(v=l.createElement("div"),T.bind(v,"click",T.doZoom),T.bind(v,"mouseenter",function(){T.zoom.css("opacity",M.cursoropacitymax)}),T.bind(v,"mouseleave",function(){T.zoom.css("opacity",M.cursoropacitymin)}),T.zoom=n(v),T.zoom.css({cursor:"pointer",zIndex:T.zindex,backgroundImage:"url("+M.scriptpath+"zoomico.png)",height:18,width:18,backgroundPosition:"0 0"}),M.dblclickzoom&&T.bind(T.win,"dblclick",T.doZoom),N.cantouch&&M.gesturezoom&&(T.ongesturezoom=function(e){return e.scale>1.5&&T.doZoomIn(e),e.scale<.8&&T.doZoomOut(e),T.cancelEvent(e)},T.bind(T.win,"gestureend",T.ongesturezoom))),T.railh=!1;var w;if(M.horizrailenabled&&(T.css(i,{overflowX:"hidden"}),(d=n(l.createElement("div"))).css({position:"absolute",top:0,height:M.cursorwidth,width:0,backgroundColor:M.cursorcolor,border:M.cursorborder,backgroundClip:"padding-box","-webkit-border-radius":M.cursorborderradius,"-moz-border-radius":M.cursorborderradius,"border-radius":M.cursorborderradius}),N.isieold&&d.css("overflow","hidden"),d.addClass("nicescroll-cursors"),T.cursorh=d,(w=n(l.createElement("div"))).attr("id",T.id+"-hr"),w.addClass("nicescroll-rails nicescroll-rails-hr"),w.height=Math.max(parseFloat(M.cursorwidth),d.outerHeight()),w.css({height:w.height+"px",zIndex:T.zindex,background:M.background}),w.append(d),w.visibility=!0,w.scrollable=!0,w.align="top"==M.railvalign?0:1,T.railh=w,T.railh.drag=!1),T.ispage)u.css({position:"fixed",top:0,height:"100%"}),u.css(u.align?{right:0}:{left:0}),T.body.append(u),T.railh&&(w.css({position:"fixed",left:0,width:"100%"}),w.css(w.align?{bottom:0}:{top:0}),T.body.append(w));else{if(T.ishwscroll){"static"==T.win.css("position")&&T.css(T.win,{position:"relative"});var x="HTML"==T.win[0].nodeName?T.body:T.win;n(x).scrollTop(0).scrollLeft(0),T.zoom&&(T.zoom.css({position:"absolute",top:1,right:0,"margin-right":u.width+4}),x.append(T.zoom)),u.css({position:"absolute",top:0}),u.css(u.align?{right:0}:{left:0}),x.append(u),w&&(w.css({position:"absolute",left:0,bottom:0}),w.css(w.align?{bottom:0}:{top:0}),x.append(w))}else{T.isfixed="fixed"==T.win.css("position");var S=T.isfixed?"fixed":"absolute";T.isfixed||(T.viewport=T.getViewport(T.win[0])),T.viewport&&(T.body=T.viewport,/fixed|absolute/.test(T.viewport.css("position"))||T.css(T.viewport,{position:"relative"})),u.css({position:S}),T.zoom&&T.zoom.css({position:S}),T.updateScrollBar(),T.body.append(u),T.zoom&&T.body.append(T.zoom),T.railh&&(w.css({position:S}),T.body.append(w))}N.isios&&T.css(T.win,{"-webkit-tap-highlight-color":"rgba(0,0,0,0)","-webkit-touch-callout":"none"}),M.disableoutline&&(N.isie&&T.win.attr("hideFocus","true"),N.iswebkit&&T.win.css("outline","none"))}if(!1===M.autohidemode?(T.autohidedom=!1,T.rail.css({opacity:M.cursoropacitymax}),T.railh&&T.railh.css({opacity:M.cursoropacitymax})):!0===M.autohidemode||"leave"===M.autohidemode?(T.autohidedom=n().add(T.rail),N.isie8&&(T.autohidedom=T.autohidedom.add(T.cursor)),T.railh&&(T.autohidedom=T.autohidedom.add(T.railh)),T.railh&&N.isie8&&(T.autohidedom=T.autohidedom.add(T.cursorh))):"scroll"==M.autohidemode?(T.autohidedom=n().add(T.rail),T.railh&&(T.autohidedom=T.autohidedom.add(T.railh))):"cursor"==M.autohidemode?(T.autohidedom=n().add(T.cursor),T.railh&&(T.autohidedom=T.autohidedom.add(T.cursorh))):"hidden"==M.autohidemode&&(T.autohidedom=!1,T.hide(),T.railslocked=!1),N.cantouch||T.istouchcapable||M.emulatetouch||N.hasmstouch){T.scrollmom=new y(T);T.ontouchstart=function(e){if(T.locked)return!1;if(e.pointerType&&("mouse"===e.pointerType||e.pointerType===e.MSPOINTER_TYPE_MOUSE))return!1;if(T.hasmoving=!1,T.scrollmom.timer&&(T.triggerScrollEnd(),T.scrollmom.stop()),!T.railslocked){var o=T.getTarget(e);if(o&&/INPUT/i.test(o.nodeName)&&/range/i.test(o.type))return T.stopPropagation(e);var t="mousedown"===e.type;if(!("clientX"in e)&&"changedTouches"in e&&(e.clientX=e.changedTouches[0].clientX,e.clientY=e.changedTouches[0].clientY),T.forcescreen){var r=e;(e={original:e.original?e.original:e}).clientX=r.screenX,e.clientY=r.screenY}if(T.rail.drag={x:e.clientX,y:e.clientY,sx:T.scroll.x,sy:T.scroll.y,st:T.getScrollTop(),sl:T.getScrollLeft(),pt:2,dl:!1,tg:o},T.ispage||!M.directionlockdeadzone)T.rail.drag.dl="f";else{var i={w:c.width(),h:c.height()},s=T.getContentSize(),l=s.h-i.h,a=s.w-i.w;T.rail.scrollable&&!T.railh.scrollable?T.rail.drag.ck=l>0&&"v":!T.rail.scrollable&&T.railh.scrollable?T.rail.drag.ck=a>0&&"h":T.rail.drag.ck=!1}if(M.emulatetouch&&T.isiframe&&N.isie){var d=T.win.position();T.rail.drag.x+=d.left,T.rail.drag.y+=d.top}if(T.hasmoving=!1,T.lastmouseup=!1,T.scrollmom.reset(e.clientX,e.clientY),o&&t){if(!/INPUT|SELECT|BUTTON|TEXTAREA/i.test(o.nodeName))return N.hasmousecapture&&o.setCapture(),M.emulatetouch?(o.onclick&&!o._onclick&&(o._onclick=o.onclick,o.onclick=function(e){if(T.hasmoving)return!1;o._onclick.call(this,e)}),T.cancelEvent(e)):T.stopPropagation(e);/SUBMIT|CANCEL|BUTTON/i.test(n(o).attr("type"))&&(T.preventclick={tg:o,click:!1})}}},T.ontouchend=function(e){if(!T.rail.drag)return!0;if(2==T.rail.drag.pt){if(e.pointerType&&("mouse"===e.pointerType||e.pointerType===e.MSPOINTER_TYPE_MOUSE))return!1;T.rail.drag=!1;var o="mouseup"===e.type;if(T.hasmoving&&(T.scrollmom.doMomentum(),T.lastmouseup=!0,T.hideCursor(),N.hasmousecapture&&l.releaseCapture(),o))return T.cancelEvent(e)}else if(1==T.rail.drag.pt)return T.onmouseup(e)};var z=M.emulatetouch&&T.isiframe&&!N.hasmousecapture,k=.3*M.directionlockdeadzone|0;T.ontouchmove=function(e,o){if(!T.rail.drag)return!0;if(e.targetTouches&&M.preventmultitouchscrolling&&e.targetTouches.length>1)return!0;if(e.pointerType&&("mouse"===e.pointerType||e.pointerType===e.MSPOINTER_TYPE_MOUSE))return!0;if(2==T.rail.drag.pt){"changedTouches"in e&&(e.clientX=e.changedTouches[0].clientX,e.clientY=e.changedTouches[0].clientY);var t,r;if(r=t=0,z&&!o){var i=T.win.position();r=-i.left,t=-i.top}var s=e.clientY+t,n=s-T.rail.drag.y,a=e.clientX+r,c=a-T.rail.drag.x,d=T.rail.drag.st-n;if(T.ishwscroll&&M.bouncescroll)d<0?d=Math.round(d/2):d>T.page.maxh&&(d=T.page.maxh+Math.round((d-T.page.maxh)/2));else if(d<0?(d=0,s=0):d>T.page.maxh&&(d=T.page.maxh,s=0),0===s&&!T.hasmoving)return T.ispage||(T.rail.drag=!1),!0;var u=T.getScrollLeft();if(T.railh&&T.railh.scrollable&&(u=T.isrtlmode?c-T.rail.drag.sl:T.rail.drag.sl-c,T.ishwscroll&&M.bouncescroll?u<0?u=Math.round(u/2):u>T.page.maxw&&(u=T.page.maxw+Math.round((u-T.page.maxw)/2)):(u<0&&(u=0,a=0),u>T.page.maxw&&(u=T.page.maxw,a=0))),!T.hasmoving){if(T.rail.drag.y===e.clientY&&T.rail.drag.x===e.clientX)return T.cancelEvent(e);var h=Math.abs(n),p=Math.abs(c),m=M.directionlockdeadzone;if(T.rail.drag.ck?"v"==T.rail.drag.ck?p>m&&h<=k?T.rail.drag=!1:h>m&&(T.rail.drag.dl="v"):"h"==T.rail.drag.ck&&(h>m&&p<=k?T.rail.drag=!1:p>m&&(T.rail.drag.dl="h")):h>m&&p>m?T.rail.drag.dl="f":h>m?T.rail.drag.dl=p>k?"f":"v":p>m&&(T.rail.drag.dl=h>k?"f":"h"),!T.rail.drag.dl)return T.cancelEvent(e);T.triggerScrollStart(e.clientX,e.clientY,0,0,0),T.hasmoving=!0}return T.preventclick&&!T.preventclick.click&&(T.preventclick.click=T.preventclick.tg.onclick||!1,T.preventclick.tg.onclick=T.onpreventclick),T.rail.drag.dl&&("v"==T.rail.drag.dl?u=T.rail.drag.sl:"h"==T.rail.drag.dl&&(d=T.rail.drag.st)),T.synched("touchmove",function(){T.rail.drag&&2==T.rail.drag.pt&&(T.prepareTransition&&T.resetTransition(),T.rail.scrollable&&T.setScrollTop(d),T.scrollmom.update(a,s),T.railh&&T.railh.scrollable?(T.setScrollLeft(u),T.showCursor(d,u)):T.showCursor(d),N.isie10&&l.selection.clear())}),T.cancelEvent(e)}return 1==T.rail.drag.pt?T.onmousemove(e):void 0},T.ontouchstartCursor=function(e,o){if(!T.rail.drag||3==T.rail.drag.pt){if(T.locked)return T.cancelEvent(e);T.cancelScroll(),T.rail.drag={x:e.touches[0].clientX,y:e.touches[0].clientY,sx:T.scroll.x,sy:T.scroll.y,pt:3,hr:!!o};var t=T.getTarget(e);return!T.ispage&&N.hasmousecapture&&t.setCapture(),T.isiframe&&!N.hasmousecapture&&(T.saved.csspointerevents=T.doc.css("pointer-events"),T.css(T.doc,{"pointer-events":"none"})),T.cancelEvent(e)}},T.ontouchendCursor=function(e){if(T.rail.drag){if(N.hasmousecapture&&l.releaseCapture(),T.isiframe&&!N.hasmousecapture&&T.doc.css("pointer-events",T.saved.csspointerevents),3!=T.rail.drag.pt)return;return T.rail.drag=!1,T.cancelEvent(e)}},T.ontouchmoveCursor=function(e){if(T.rail.drag){if(3!=T.rail.drag.pt)return;if(T.cursorfreezed=!0,T.rail.drag.hr){T.scroll.x=T.rail.drag.sx+(e.touches[0].clientX-T.rail.drag.x),T.scroll.x<0&&(T.scroll.x=0);var o=T.scrollvaluemaxw;T.scroll.x>o&&(T.scroll.x=o)}else{T.scroll.y=T.rail.drag.sy+(e.touches[0].clientY-T.rail.drag.y),T.scroll.y<0&&(T.scroll.y=0);var t=T.scrollvaluemax;T.scroll.y>t&&(T.scroll.y=t)}return T.synched("touchmove",function(){T.rail.drag&&3==T.rail.drag.pt&&(T.showCursor(),T.rail.drag.hr?T.doScrollLeft(Math.round(T.scroll.x*T.scrollratio.x),M.cursordragspeed):T.doScrollTop(Math.round(T.scroll.y*T.scrollratio.y),M.cursordragspeed))}),T.cancelEvent(e)}}}if(T.onmousedown=function(e,o){if(!T.rail.drag||1==T.rail.drag.pt){if(T.railslocked)return T.cancelEvent(e);T.cancelScroll(),T.rail.drag={x:e.clientX,y:e.clientY,sx:T.scroll.x,sy:T.scroll.y,pt:1,hr:o||!1};var t=T.getTarget(e);return N.hasmousecapture&&t.setCapture(),T.isiframe&&!N.hasmousecapture&&(T.saved.csspointerevents=T.doc.css("pointer-events"),T.css(T.doc,{"pointer-events":"none"})),T.hasmoving=!1,T.cancelEvent(e)}},T.onmouseup=function(e){if(T.rail.drag)return 1!=T.rail.drag.pt||(N.hasmousecapture&&l.releaseCapture(),T.isiframe&&!N.hasmousecapture&&T.doc.css("pointer-events",T.saved.csspointerevents),T.rail.drag=!1,T.cursorfreezed=!1,T.hasmoving&&T.triggerScrollEnd(),T.cancelEvent(e))},T.onmousemove=function(e){if(T.rail.drag){if(1!==T.rail.drag.pt)return;if(N.ischrome&&0===e.which)return T.onmouseup(e);if(T.cursorfreezed=!0,T.hasmoving||T.triggerScrollStart(e.clientX,e.clientY,0,0,0),T.hasmoving=!0,T.rail.drag.hr){T.scroll.x=T.rail.drag.sx+(e.clientX-T.rail.drag.x),T.scroll.x<0&&(T.scroll.x=0);var o=T.scrollvaluemaxw;T.scroll.x>o&&(T.scroll.x=o)}else{T.scroll.y=T.rail.drag.sy+(e.clientY-T.rail.drag.y),T.scroll.y<0&&(T.scroll.y=0);var t=T.scrollvaluemax;T.scroll.y>t&&(T.scroll.y=t)}return T.synched("mousemove",function(){T.cursorfreezed&&(T.showCursor(),T.rail.drag.hr?T.scrollLeft(Math.round(T.scroll.x*T.scrollratio.x)):T.scrollTop(Math.round(T.scroll.y*T.scrollratio.y)))}),T.cancelEvent(e)}T.checkarea=0},N.cantouch||M.emulatetouch)T.onpreventclick=function(e){if(T.preventclick)return T.preventclick.tg.onclick=T.preventclick.click,T.preventclick=!1,T.cancelEvent(e)},T.onclick=!N.isios&&function(e){return!T.lastmouseup||(T.lastmouseup=!1,T.cancelEvent(e))},M.grabcursorenabled&&N.cursorgrabvalue&&(T.css(T.ispage?T.doc:T.win,{cursor:N.cursorgrabvalue}),T.css(T.rail,{cursor:N.cursorgrabvalue}));else{var L=function(e){if(T.selectiondrag){if(e){var o=T.win.outerHeight(),t=e.pageY-T.selectiondrag.top;t>0&&t=o&&(t-=o),T.selectiondrag.df=t}if(0!==T.selectiondrag.df){var r=-2*T.selectiondrag.df/6|0;T.doScrollBy(r),T.debounced("doselectionscroll",function(){L()},50)}}};T.hasTextSelected="getSelection"in l?function(){return l.getSelection().rangeCount>0}:"selection"in l?function(){return"None"!=l.selection.type}:function(){return!1},T.onselectionstart=function(e){T.ispage||(T.selectiondrag=T.win.offset())},T.onselectionend=function(e){T.selectiondrag=!1},T.onselectiondrag=function(e){T.selectiondrag&&T.hasTextSelected()&&T.debounced("selectionscroll",function(){L(e)},250)}}if(N.hasw3ctouch?(T.css(T.ispage?n("html"):T.win,{"touch-action":"none"}),T.css(T.rail,{"touch-action":"none"}),T.css(T.cursor,{"touch-action":"none"}),T.bind(T.win,"pointerdown",T.ontouchstart),T.bind(l,"pointerup",T.ontouchend),T.delegate(l,"pointermove",T.ontouchmove)):N.hasmstouch?(T.css(T.ispage?n("html"):T.win,{"-ms-touch-action":"none"}),T.css(T.rail,{"-ms-touch-action":"none"}),T.css(T.cursor,{"-ms-touch-action":"none"}),T.bind(T.win,"MSPointerDown",T.ontouchstart),T.bind(l,"MSPointerUp",T.ontouchend),T.delegate(l,"MSPointerMove",T.ontouchmove),T.bind(T.cursor,"MSGestureHold",function(e){e.preventDefault()}),T.bind(T.cursor,"contextmenu",function(e){e.preventDefault()})):N.cantouch&&(T.bind(T.win,"touchstart",T.ontouchstart,!1,!0),T.bind(l,"touchend",T.ontouchend,!1,!0),T.bind(l,"touchcancel",T.ontouchend,!1,!0),T.delegate(l,"touchmove",T.ontouchmove,!1,!0)),M.emulatetouch&&(T.bind(T.win,"mousedown",T.ontouchstart,!1,!0),T.bind(l,"mouseup",T.ontouchend,!1,!0),T.bind(l,"mousemove",T.ontouchmove,!1,!0)),(M.cursordragontouch||!N.cantouch&&!M.emulatetouch)&&(T.rail.css({cursor:"default"}),T.railh&&T.railh.css({cursor:"default"}),T.jqbind(T.rail,"mouseenter",function(){if(!T.ispage&&!T.win.is(":visible"))return!1;T.canshowonmouseevent&&T.showCursor(),T.rail.active=!0}),T.jqbind(T.rail,"mouseleave",function(){T.rail.active=!1,T.rail.drag||T.hideCursor()}),M.sensitiverail&&(T.bind(T.rail,"click",function(e){T.doRailClick(e,!1,!1)}),T.bind(T.rail,"dblclick",function(e){T.doRailClick(e,!0,!1)}),T.bind(T.cursor,"click",function(e){T.cancelEvent(e)}),T.bind(T.cursor,"dblclick",function(e){T.cancelEvent(e)})),T.railh&&(T.jqbind(T.railh,"mouseenter",function(){if(!T.ispage&&!T.win.is(":visible"))return!1;T.canshowonmouseevent&&T.showCursor(),T.rail.active=!0}),T.jqbind(T.railh,"mouseleave",function(){T.rail.active=!1,T.rail.drag||T.hideCursor()}),M.sensitiverail&&(T.bind(T.railh,"click",function(e){T.doRailClick(e,!1,!0)}),T.bind(T.railh,"dblclick",function(e){T.doRailClick(e,!0,!0)}),T.bind(T.cursorh,"click",function(e){T.cancelEvent(e)}),T.bind(T.cursorh,"dblclick",function(e){T.cancelEvent(e)})))),M.cursordragontouch&&(this.istouchcapable||N.cantouch)&&(T.bind(T.cursor,"touchstart",T.ontouchstartCursor),T.bind(T.cursor,"touchmove",T.ontouchmoveCursor),T.bind(T.cursor,"touchend",T.ontouchendCursor),T.cursorh&&T.bind(T.cursorh,"touchstart",function(e){T.ontouchstartCursor(e,!0)}),T.cursorh&&T.bind(T.cursorh,"touchmove",T.ontouchmoveCursor),T.cursorh&&T.bind(T.cursorh,"touchend",T.ontouchendCursor)),M.emulatetouch||N.isandroid||N.isios?(T.bind(N.hasmousecapture?T.win:l,"mouseup",T.ontouchend),T.onclick&&T.bind(l,"click",T.onclick),M.cursordragontouch?(T.bind(T.cursor,"mousedown",T.onmousedown),T.bind(T.cursor,"mouseup",T.onmouseup),T.cursorh&&T.bind(T.cursorh,"mousedown",function(e){T.onmousedown(e,!0)}),T.cursorh&&T.bind(T.cursorh,"mouseup",T.onmouseup)):(T.bind(T.rail,"mousedown",function(e){e.preventDefault()}),T.railh&&T.bind(T.railh,"mousedown",function(e){e.preventDefault()}))):(T.bind(N.hasmousecapture?T.win:l,"mouseup",T.onmouseup),T.bind(l,"mousemove",T.onmousemove),T.onclick&&T.bind(l,"click",T.onclick),T.bind(T.cursor,"mousedown",T.onmousedown),T.bind(T.cursor,"mouseup",T.onmouseup),T.railh&&(T.bind(T.cursorh,"mousedown",function(e){T.onmousedown(e,!0)}),T.bind(T.cursorh,"mouseup",T.onmouseup)),!T.ispage&&M.enablescrollonselection&&(T.bind(T.win[0],"mousedown",T.onselectionstart),T.bind(l,"mouseup",T.onselectionend),T.bind(T.cursor,"mouseup",T.onselectionend),T.cursorh&&T.bind(T.cursorh,"mouseup",T.onselectionend),T.bind(l,"mousemove",T.onselectiondrag)),T.zoom&&(T.jqbind(T.zoom,"mouseenter",function(){T.canshowonmouseevent&&T.showCursor(),T.rail.active=!0}),T.jqbind(T.zoom,"mouseleave",function(){T.rail.active=!1,T.rail.drag||T.hideCursor()}))),M.enablemousewheel&&(T.isiframe||T.mousewheel(N.isie&&T.ispage?l:T.win,T.onmousewheel),T.mousewheel(T.rail,T.onmousewheel),T.railh&&T.mousewheel(T.railh,T.onmousewheelhr)),T.ispage||N.cantouch||/HTML|^BODY/.test(T.win[0].nodeName)||(T.win.attr("tabindex")||T.win.attr({tabindex:++r}),T.bind(T.win,"focus",function(e){o=T.getTarget(e).id||T.getTarget(e)||!1,T.hasfocus=!0,T.canshowonmouseevent&&T.noticeCursor()}),T.bind(T.win,"blur",function(e){o=!1,T.hasfocus=!1}),T.bind(T.win,"mouseenter",function(e){t=T.getTarget(e).id||T.getTarget(e)||!1,T.hasmousefocus=!0,T.canshowonmouseevent&&T.noticeCursor()}),T.bind(T.win,"mouseleave",function(e){t=!1,T.hasmousefocus=!1,T.rail.drag||T.hideCursor()})),T.onkeypress=function(e){if(T.railslocked&&0===T.page.maxh)return!0;e=e||a.event;var r=T.getTarget(e);if(r&&/INPUT|TEXTAREA|SELECT|OPTION/.test(r.nodeName)&&(!(r.getAttribute("type")||r.type||!1)||!/submit|button|cancel/i.tp))return!0;if(n(r).attr("contenteditable"))return!0;if(T.hasfocus||T.hasmousefocus&&!o||T.ispage&&!o&&!t){var i=e.keyCode;if(T.railslocked&&27!=i)return T.cancelEvent(e);var s=e.ctrlKey||!1,l=e.shiftKey||!1,c=!1;switch(i){case 38:case 63233:T.doScrollBy(72),c=!0;break;case 40:case 63235:T.doScrollBy(-72),c=!0;break;case 37:case 63232:T.railh&&(s?T.doScrollLeft(0):T.doScrollLeftBy(72),c=!0);break;case 39:case 63234:T.railh&&(s?T.doScrollLeft(T.page.maxw):T.doScrollLeftBy(-72),c=!0);break;case 33:case 63276:T.doScrollBy(T.view.h),c=!0;break;case 34:case 63277:T.doScrollBy(-T.view.h),c=!0;break;case 36:case 63273:T.railh&&s?T.doScrollPos(0,0):T.doScrollTo(0),c=!0;break;case 35:case 63275:T.railh&&s?T.doScrollPos(T.page.maxw,T.page.maxh):T.doScrollTo(T.page.maxh),c=!0;break;case 32:M.spacebarenabled&&(l?T.doScrollBy(T.view.h):T.doScrollBy(-T.view.h),c=!0);break;case 27:T.zoomactive&&(T.doZoom(),c=!0)}if(c)return T.cancelEvent(e)}},M.enablekeyboard&&T.bind(l,N.isopera&&!N.isopera12?"keypress":"keydown",T.onkeypress),T.bind(l,"keydown",function(e){(e.ctrlKey||!1)&&(T.wheelprevented=!0)}),T.bind(l,"keyup",function(e){e.ctrlKey||!1||(T.wheelprevented=!1)}),T.bind(a,"blur",function(e){T.wheelprevented=!1}),T.bind(a,"resize",T.onscreenresize),T.bind(a,"orientationchange",T.onscreenresize),T.bind(a,"load",T.lazyResize),N.ischrome&&!T.ispage&&!T.haswrapper){var C=T.win.attr("style"),P=parseFloat(T.win.css("width"))+1;T.win.css("width",P),T.synched("chromefix",function(){T.win.attr("style",C)})}if(T.onAttributeChange=function(e){T.lazyResize(T.isieold?250:30)},M.enableobserver&&(T.isie11||!1===m||(T.observerbody=new m(function(e){if(e.forEach(function(e){if("attributes"==e.type)return E.hasClass("modal-open")&&E.hasClass("modal-dialog")&&!n.contains(n(".modal-dialog")[0],T.doc[0])?T.hide():T.show()}),T.me.clientWidth!=T.page.width||T.me.clientHeight!=T.page.height)return T.lazyResize(30)}),T.observerbody.observe(l.body,{childList:!0,subtree:!0,characterData:!1,attributes:!0,attributeFilter:["class"]})),!T.ispage&&!T.haswrapper))if(!1!==m){var R=T.win[0];T.observer=new m(function(e){e.forEach(T.onAttributeChange)}),T.observer.observe(R,{childList:!0,characterData:!1,attributes:!0,subtree:!1}),T.observerremover=new m(function(e){e.forEach(function(e){if(e.removedNodes.length>0)for(var o in e.removedNodes)if(T&&e.removedNodes[o]===R)return T.remove()})}),T.observerremover.observe(R.parentNode,{childList:!0,characterData:!1,attributes:!1,subtree:!1})}else T.bind(R,N.isie&&!N.isie9?"propertychange":"DOMAttrModified",T.onAttributeChange),N.isie9&&R.attachEvent("onpropertychange",T.onAttributeChange),T.bind(R,"DOMNodeRemoved",function(e){e.target===R&&T.remove()});!T.ispage&&M.boxzoom&&T.bind(a,"resize",T.resizeZoom),T.istextarea&&(T.bind(T.win,"keydown",T.lazyResize),T.bind(T.win,"mouseup",T.lazyResize)),T.lazyResize(30)}if("IFRAME"==this.doc[0].nodeName){var _=function(){T.iframexd=!1;var o;try{(o="contentDocument"in this?this.contentDocument:this.contentWindow._doc).domain}catch(e){T.iframexd=!0,o=!1}if(T.iframexd)return"console"in a&&console.log("NiceScroll error: policy restriced iframe"),!0;if(T.forcescreen=!0,T.isiframe&&(T.iframe={doc:n(o),html:T.doc.contents().find("html")[0],body:T.doc.contents().find("body")[0]},T.getContentSize=function(){return{w:Math.max(T.iframe.html.scrollWidth,T.iframe.body.scrollWidth),h:Math.max(T.iframe.html.scrollHeight,T.iframe.body.scrollHeight)}},T.docscroll=n(T.iframe.body)),!N.isios&&M.iframeautoresize&&!T.isiframe){T.win.scrollTop(0),T.doc.height("");var t=Math.max(o.getElementsByTagName("html")[0].scrollHeight,o.body.scrollHeight);T.doc.height(t)}T.lazyResize(30),T.css(n(T.iframe.body),e),N.isios&&T.haswrapper&&T.css(n(o.body),{"-webkit-transform":"translate3d(0,0,0)"}),"contentWindow"in this?T.bind(this.contentWindow,"scroll",T.onscroll):T.bind(o,"scroll",T.onscroll),M.enablemousewheel&&T.mousewheel(o,T.onmousewheel),M.enablekeyboard&&T.bind(o,N.isopera?"keypress":"keydown",T.onkeypress),N.cantouch?(T.bind(o,"touchstart",T.ontouchstart),T.bind(o,"touchmove",T.ontouchmove)):M.emulatetouch&&(T.bind(o,"mousedown",T.ontouchstart),T.bind(o,"mousemove",function(e){return T.ontouchmove(e,!0)}),M.grabcursorenabled&&N.cursorgrabvalue&&T.css(n(o.body),{cursor:N.cursorgrabvalue})),T.bind(o,"mouseup",T.ontouchend),T.zoom&&(M.dblclickzoom&&T.bind(o,"dblclick",T.doZoom),T.ongesturezoom&&T.bind(o,"gestureend",T.ongesturezoom))};this.doc[0].readyState&&"complete"===this.doc[0].readyState&&setTimeout(function(){_.call(T.doc[0],!1)},500),T.bind(this.doc,"load",_)}},this.showCursor=function(e,o){if(T.cursortimeout&&(clearTimeout(T.cursortimeout),T.cursortimeout=0),T.rail){if(T.autohidedom&&(T.autohidedom.stop().css({opacity:M.cursoropacitymax}),T.cursoractive=!0),T.rail.drag&&1==T.rail.drag.pt||(void 0!==e&&!1!==e&&(T.scroll.y=e/T.scrollratio.y|0),void 0!==o&&(T.scroll.x=o/T.scrollratio.x|0)),T.cursor.css({height:T.cursorheight,top:T.scroll.y}),T.cursorh){var t=T.hasreversehr?T.scrollvaluemaxw-T.scroll.x:T.scroll.x;T.cursorh.css({width:T.cursorwidth,left:!T.rail.align&&T.rail.visibility?t+T.rail.width:t}),T.cursoractive=!0}T.zoom&&T.zoom.stop().css({opacity:M.cursoropacitymax})}},this.hideCursor=function(e){T.cursortimeout||T.rail&&T.autohidedom&&(T.hasmousefocus&&"leave"===M.autohidemode||(T.cursortimeout=setTimeout(function(){T.rail.active&&T.showonmouseevent||(T.autohidedom.stop().animate({opacity:M.cursoropacitymin}),T.zoom&&T.zoom.stop().animate({opacity:M.cursoropacitymin}),T.cursoractive=!1),T.cursortimeout=0},e||M.hidecursordelay)))},this.noticeCursor=function(e,o,t){T.showCursor(o,t),T.rail.active||T.hideCursor(e)},this.getContentSize=T.ispage?function(){return{w:Math.max(l.body.scrollWidth,l.documentElement.scrollWidth),h:Math.max(l.body.scrollHeight,l.documentElement.scrollHeight)}}:T.haswrapper?function(){return{w:T.doc[0].offsetWidth,h:T.doc[0].offsetHeight}}:function(){return{w:T.docscroll[0].scrollWidth,h:T.docscroll[0].scrollHeight}},this.onResize=function(e,o){if(!T||!T.win)return!1;var t=T.page.maxh,r=T.page.maxw,i=T.view.h,s=T.view.w;if(T.view={w:T.ispage?T.win.width():T.win[0].clientWidth,h:T.ispage?T.win.height():T.win[0].clientHeight},T.page=o||T.getContentSize(),T.page.maxh=Math.max(0,T.page.h-T.view.h),T.page.maxw=Math.max(0,T.page.w-T.view.w),T.page.maxh==t&&T.page.maxw==r&&T.view.w==s&&T.view.h==i){if(T.ispage)return T;var n=T.win.offset();if(T.lastposition){var l=T.lastposition;if(l.top==n.top&&l.left==n.left)return T}T.lastposition=n}return 0===T.page.maxh?(T.hideRail(),T.scrollvaluemax=0,T.scroll.y=0,T.scrollratio.y=0,T.cursorheight=0,T.setScrollTop(0),T.rail&&(T.rail.scrollable=!1)):(T.page.maxh-=M.railpadding.top+M.railpadding.bottom,T.rail.scrollable=!0),0===T.page.maxw?(T.hideRailHr(),T.scrollvaluemaxw=0,T.scroll.x=0,T.scrollratio.x=0,T.cursorwidth=0,T.setScrollLeft(0),T.railh&&(T.railh.scrollable=!1)):(T.page.maxw-=M.railpadding.left+M.railpadding.right,T.railh&&(T.railh.scrollable=M.horizrailenabled)),T.railslocked=T.locked||0===T.page.maxh&&0===T.page.maxw,T.railslocked?(T.ispage||T.updateScrollBar(T.view),!1):(T.hidden||(T.rail.visibility||T.showRail(),T.railh&&!T.railh.visibility&&T.showRailHr()),T.istextarea&&T.win.css("resize")&&"none"!=T.win.css("resize")&&(T.view.h-=20),T.cursorheight=Math.min(T.view.h,Math.round(T.view.h*(T.view.h/T.page.h))),T.cursorheight=M.cursorfixedheight?M.cursorfixedheight:Math.max(M.cursorminheight,T.cursorheight),T.cursorwidth=Math.min(T.view.w,Math.round(T.view.w*(T.view.w/T.page.w))),T.cursorwidth=M.cursorfixedheight?M.cursorfixedheight:Math.max(M.cursorminheight,T.cursorwidth),T.scrollvaluemax=T.view.h-T.cursorheight-(M.railpadding.top+M.railpadding.bottom),T.hasborderbox||(T.scrollvaluemax-=T.cursor[0].offsetHeight-T.cursor[0].clientHeight),T.railh&&(T.railh.width=T.page.maxh>0?T.view.w-T.rail.width:T.view.w,T.scrollvaluemaxw=T.railh.width-T.cursorwidth-(M.railpadding.left+M.railpadding.right)),T.ispage||T.updateScrollBar(T.view),T.scrollratio={x:T.page.maxw/T.scrollvaluemaxw,y:T.page.maxh/T.scrollvaluemax},T.getScrollTop()>T.page.maxh?T.doScrollTop(T.page.maxh):(T.scroll.y=T.getScrollTop()/T.scrollratio.y|0,T.scroll.x=T.getScrollLeft()/T.scrollratio.x|0,T.cursoractive&&T.noticeCursor()),T.scroll.y&&0===T.getScrollTop()&&T.doScrollTo(T.scroll.y*T.scrollratio.y|0),T)},this.resize=T.onResize;var O=0;this.onscreenresize=function(e){clearTimeout(O);var o=!T.ispage&&!T.haswrapper;o&&T.hideRails(),O=setTimeout(function(){T&&(o&&T.showRails(),T.resize()),O=0},120)},this.lazyResize=function(e){return clearTimeout(O),O=setTimeout(function(){T&&T.resize(),O=0},e||240),T},this.jqbind=function(e,o,t){T.events.push({e:e,n:o,f:t,q:!0}),n(e).on(o,t)},this.mousewheel=function(e,o,t){var r="jquery"in e?e[0]:e;if("onwheel"in l.createElement("div"))T._bind(r,"wheel",o,t||!1);else{var i=void 0!==l.onmousewheel?"mousewheel":"DOMMouseScroll";S(r,i,o,t||!1),"DOMMouseScroll"==i&&S(r,"MozMousePixelScroll",o,t||!1)}};var Y=!1;if(N.haseventlistener){try{var H=Object.defineProperty({},"passive",{get:function(){Y=!0}});a.addEventListener("test",null,H)}catch(e){}this.stopPropagation=function(e){return!!e&&((e=e.original?e.original:e).stopPropagation(),!1)},this.cancelEvent=function(e){return e.cancelable&&e.preventDefault(),e.stopImmediatePropagation(),e.preventManipulation&&e.preventManipulation(),!1}}else Event.prototype.preventDefault=function(){this.returnValue=!1},Event.prototype.stopPropagation=function(){this.cancelBubble=!0},a.constructor.prototype.addEventListener=l.constructor.prototype.addEventListener=Element.prototype.addEventListener=function(e,o,t){this.attachEvent("on"+e,o)},a.constructor.prototype.removeEventListener=l.constructor.prototype.removeEventListener=Element.prototype.removeEventListener=function(e,o,t){this.detachEvent("on"+e,o)},this.cancelEvent=function(e){return(e=e||a.event)&&(e.cancelBubble=!0,e.cancel=!0,e.returnValue=!1),!1},this.stopPropagation=function(e){return(e=e||a.event)&&(e.cancelBubble=!0),!1};this.delegate=function(e,o,t,r,i){var s=d[o]||!1;s||(s={a:[],l:[],f:function(e){for(var o=s.l,t=!1,r=o.length-1;r>=0;r--)if(!1===(t=o[r].call(e.target,e)))return!1;return t}},T.bind(e,o,s.f,r,i),d[o]=s),T.ispage?(s.a=[T.id].concat(s.a),s.l=[t].concat(s.l)):(s.a.push(T.id),s.l.push(t))},this.undelegate=function(e,o,t,r,i){var s=d[o]||!1;if(s)for(var n=0,l=s.l.length;n0)return t;o=!!o.parentNode&&o.parentNode}return!1},this.triggerScrollStart=function(e,o,t,r,i){if(T.onscrollstart){var s={type:"scrollstart",current:{x:e,y:o},request:{x:t,y:r},end:{x:T.newscrollx,y:T.newscrolly},speed:i};T.onscrollstart.call(T,s)}},this.triggerScrollEnd=function(){if(T.onscrollend){var e=T.getScrollLeft(),o=T.getScrollTop(),t={type:"scrollend",current:{x:e,y:o},end:{x:e,y:o}};T.onscrollend.call(T,t)}};var B=0,X=0,D=0,A=1,q=!1;if(this.onmousewheel=function(e){if(T.wheelprevented||T.locked)return!1;if(T.railslocked)return T.debounced("checkunlock",T.resize,250),!1;if(T.rail.drag)return T.cancelEvent(e);if("auto"===M.oneaxismousemode&&0!==e.deltaX&&(M.oneaxismousemode=!1),M.oneaxismousemode&&0===e.deltaX&&!T.rail.scrollable)return!T.railh||!T.railh.scrollable||T.onmousewheelhr(e);var o=f(),t=!1;if(M.preservenativescrolling&&T.checkarea+600T.page.maxh&&(o=T.page.maxh+(o-T.page.maxh)/2|0),e<0?e=e/2|0:e>T.page.maxw&&(e=T.page.maxw+(e-T.page.maxw)/2|0)):(o<0?o=0:o>T.page.maxh&&(o=T.page.maxh),e<0?e=0:e>T.page.maxw&&(e=T.page.maxw)),T.scrollrunning&&e==T.newscrollx&&o==T.newscrolly)return!1;T.newscrolly=o,T.newscrollx=e;var s=T.getScrollTop(),n=T.getScrollLeft(),l={};l.x=e-n,l.y=o-s;var a=0|Math.sqrt(l.x*l.x+l.y*l.y),c=T.prepareTransition(a);T.scrollrunning||(T.scrollrunning=!0,T.triggerScrollStart(n,s,e,o,c),T.cursorupdate.start()),T.scrollendtrapped=!0,N.transitionend||(T.scrollendtrapped&&clearTimeout(T.scrollendtrapped),T.scrollendtrapped=setTimeout(T.onScrollTransitionEnd,c)),T.setScrollTop(T.newscrolly),T.setScrollLeft(T.newscrollx)},this.cancelScroll=function(){if(!T.scrollendtrapped)return!0;var e=T.getScrollTop(),o=T.getScrollLeft();return T.scrollrunning=!1,N.transitionend||clearTimeout(N.transitionend),T.scrollendtrapped=!1,T.resetTransition(),T.setScrollTop(e),T.railh&&T.setScrollLeft(o),T.timerscroll&&T.timerscroll.tm&&clearInterval(T.timerscroll.tm),T.timerscroll=!1,T.cursorfreezed=!1,T.cursorupdate.stop(),T.showCursor(e,o),T},this.onScrollTransitionEnd=function(){if(T.scrollendtrapped){var e=T.getScrollTop(),o=T.getScrollLeft();if(e<0?e=0:e>T.page.maxh&&(e=T.page.maxh),o<0?o=0:o>T.page.maxw&&(o=T.page.maxw),e!=T.newscrolly||o!=T.newscrollx)return T.doScrollPos(o,e,M.snapbackspeed);T.scrollrunning&&T.triggerScrollEnd(),T.scrollrunning=!1,T.scrollendtrapped=!1,T.resetTransition(),T.timerscroll=!1,T.setScrollTop(e),T.railh&&T.setScrollLeft(o),T.cursorupdate.stop(),T.noticeCursor(!1,e,o),T.cursorfreezed=!1}}}else this.doScrollLeft=function(e,o){var t=T.scrollrunning?T.newscrolly:T.getScrollTop();T.doScrollPos(e,t,o)},this.doScrollTop=function(e,o){var t=T.scrollrunning?T.newscrollx:T.getScrollLeft();T.doScrollPos(t,e,o)},this.doScrollPos=function(e,o,t){var r=T.getScrollTop(),i=T.getScrollLeft();((T.newscrolly-r)*(o-r)<0||(T.newscrollx-i)*(e-i)<0)&&T.cancelScroll();var s=!1;if(T.bouncescroll&&T.rail.visibility||(o<0?(o=0,s=!0):o>T.page.maxh&&(o=T.page.maxh,s=!0)),T.bouncescroll&&T.railh.visibility||(e<0?(e=0,s=!0):e>T.page.maxw&&(e=T.page.maxw,s=!0)),T.scrollrunning&&T.newscrolly===o&&T.newscrollx===e)return!0;T.newscrolly=o,T.newscrollx=e,T.dst={},T.dst.x=e-i,T.dst.y=o-r,T.dst.px=i,T.dst.py=r;var n=0|Math.sqrt(T.dst.x*T.dst.x+T.dst.y*T.dst.y),l=T.getTransitionSpeed(n);T.bzscroll={};var a=s?1:.58;T.bzscroll.x=new R(i,T.newscrollx,l,0,0,a,1),T.bzscroll.y=new R(r,T.newscrolly,l,0,0,a,1);f();var c=function(){if(T.scrollrunning){var e=T.bzscroll.y.getPos();T.setScrollLeft(T.bzscroll.x.getNow()),T.setScrollTop(T.bzscroll.y.getNow()),e<=1?T.timer=u(c):(T.scrollrunning=!1,T.timer=0,T.triggerScrollEnd())}};T.scrollrunning||(T.triggerScrollStart(i,r,e,o,l),T.scrollrunning=!0,T.timer=u(c))},this.cancelScroll=function(){return T.timer&&h(T.timer),T.timer=0,T.bzscroll=!1,T.scrollrunning=!1,T};else this.doScrollLeft=function(e,o){var t=T.getScrollTop();T.doScrollPos(e,t,o)},this.doScrollTop=function(e,o){var t=T.getScrollLeft();T.doScrollPos(t,e,o)},this.doScrollPos=function(e,o,t){var r=e>T.page.maxw?T.page.maxw:e;r<0&&(r=0);var i=o>T.page.maxh?T.page.maxh:o;i<0&&(i=0),T.synched("scroll",function(){T.setScrollTop(i),T.setScrollLeft(r)})},this.cancelScroll=function(){};this.doScrollBy=function(e,o){z(0,e)},this.doScrollLeftBy=function(e,o){z(e,0)},this.doScrollTo=function(e,o){var t=o?Math.round(e*T.scrollratio.y):e;t<0?t=0:t>T.page.maxh&&(t=T.page.maxh),T.cursorfreezed=!1,T.doScrollTop(e)},this.checkContentSize=function(){var e=T.getContentSize();e.h==T.page.h&&e.w==T.page.w||T.resize(!1,e)},T.onscroll=function(e){T.rail.drag||T.cursorfreezed||T.synched("scroll",function(){T.scroll.y=Math.round(T.getScrollTop()/T.scrollratio.y),T.railh&&(T.scroll.x=Math.round(T.getScrollLeft()/T.scrollratio.x)),T.noticeCursor()})},T.bind(T.docscroll,"scroll",T.onscroll),this.doZoomIn=function(e){if(!T.zoomactive){T.zoomactive=!0,T.zoomrestore={style:{}};var o=["position","top","left","zIndex","backgroundColor","marginTop","marginBottom","marginLeft","marginRight"],t=T.win[0].style;for(var r in o){var i=o[r];T.zoomrestore.style[i]=void 0!==t[i]?t[i]:""}T.zoomrestore.style.width=T.win.css("width"),T.zoomrestore.style.height=T.win.css("height"),T.zoomrestore.padding={w:T.win.outerWidth()-T.win.width(),h:T.win.outerHeight()-T.win.height()},N.isios4&&(T.zoomrestore.scrollTop=c.scrollTop(),c.scrollTop(0)),T.win.css({position:N.isios4?"absolute":"fixed",top:0,left:0,zIndex:s+100,margin:0});var n=T.win.css("backgroundColor");return(""===n||/transparent|rgba\(0, 0, 0, 0\)|rgba\(0,0,0,0\)/.test(n))&&T.win.css("backgroundColor","#fff"),T.rail.css({zIndex:s+101}),T.zoom.css({zIndex:s+102}),T.zoom.css("backgroundPosition","0 -18px"),T.resizeZoom(),T.onzoomin&&T.onzoomin.call(T),T.cancelEvent(e)}},this.doZoomOut=function(e){if(T.zoomactive)return T.zoomactive=!1,T.win.css("margin",""),T.win.css(T.zoomrestore.style),N.isios4&&c.scrollTop(T.zoomrestore.scrollTop),T.rail.css({"z-index":T.zindex}),T.zoom.css({"z-index":T.zindex}),T.zoomrestore=!1,T.zoom.css("backgroundPosition","0 0"),T.onResize(),T.onzoomout&&T.onzoomout.call(T),T.cancelEvent(e)},this.doZoom=function(e){return T.zoomactive?T.doZoomOut(e):T.doZoomIn(e)},this.resizeZoom=function(){if(T.zoomactive){var e=T.getScrollTop();T.win.css({width:c.width()-T.zoomrestore.padding.w+"px",height:c.height()-T.zoomrestore.padding.h+"px"}),T.onResize(),T.setScrollTop(Math.min(T.page.maxh,e))}},this.init(),n.nicescroll.push(this)},y=function(e){var o=this;this.nc=e,this.lastx=0,this.lasty=0,this.speedx=0,this.speedy=0,this.lasttime=0,this.steptime=0,this.snapx=!1,this.snapy=!1,this.demulx=0,this.demuly=0,this.lastscrollx=-1,this.lastscrolly=-1,this.chkx=0,this.chky=0,this.timer=0,this.reset=function(e,t){o.stop(),o.steptime=0,o.lasttime=f(),o.speedx=0,o.speedy=0,o.lastx=e,o.lasty=t,o.lastscrollx=-1,o.lastscrolly=-1},this.update=function(e,t){var r=f();o.steptime=r-o.lasttime,o.lasttime=r;var i=t-o.lasty,s=e-o.lastx,n=o.nc.getScrollTop()+i,l=o.nc.getScrollLeft()+s;o.snapx=l<0||l>o.nc.page.maxw,o.snapy=n<0||n>o.nc.page.maxh,o.speedx=s,o.speedy=i,o.lastx=e,o.lasty=t},this.stop=function(){o.nc.unsynched("domomentum2d"),o.timer&&clearTimeout(o.timer),o.timer=0,o.lastscrollx=-1,o.lastscrolly=-1},this.doSnapy=function(e,t){var r=!1;t<0?(t=0,r=!0):t>o.nc.page.maxh&&(t=o.nc.page.maxh,r=!0),e<0?(e=0,r=!0):e>o.nc.page.maxw&&(e=o.nc.page.maxw,r=!0),r?o.nc.doScrollPos(e,t,o.nc.opt.snapbackspeed):o.nc.triggerScrollEnd()},this.doMomentum=function(e){var t=f(),r=e?t+e:o.lasttime,i=o.nc.getScrollLeft(),s=o.nc.getScrollTop(),n=o.nc.page.maxh,l=o.nc.page.maxw;o.speedx=l>0?Math.min(60,o.speedx):0,o.speedy=n>0?Math.min(60,o.speedy):0;var a=r&&t-r<=60;(s<0||s>n||i<0||i>l)&&(a=!1);var c=!(!o.speedy||!a)&&o.speedy,d=!(!o.speedx||!a)&&o.speedx;if(c||d){var u=Math.max(16,o.steptime);if(u>50){var h=u/50;o.speedx*=h,o.speedy*=h,u=50}o.demulxy=0,o.lastscrollx=o.nc.getScrollLeft(),o.chkx=o.lastscrollx,o.lastscrolly=o.nc.getScrollTop(),o.chky=o.lastscrolly;var p=o.lastscrollx,m=o.lastscrolly,g=function(){var e=f()-t>600?.04:.02;o.speedx&&(p=Math.floor(o.lastscrollx-o.speedx*(1-o.demulxy)),o.lastscrollx=p,(p<0||p>l)&&(e=.1)),o.speedy&&(m=Math.floor(o.lastscrolly-o.speedy*(1-o.demulxy)),o.lastscrolly=m,(m<0||m>n)&&(e=.1)),o.demulxy=Math.min(1,o.demulxy+e),o.nc.synched("domomentum2d",function(){if(o.speedx){o.nc.getScrollLeft();o.chkx=p,o.nc.setScrollLeft(p)}if(o.speedy){o.nc.getScrollTop();o.chky=m,o.nc.setScrollTop(m)}o.timer||(o.nc.hideCursor(),o.doSnapy(p,m))}),o.demulxy<1?o.timer=setTimeout(g,u):(o.stop(),o.nc.hideCursor(),o.doSnapy(p,m))};g()}else o.doSnapy(o.nc.getScrollLeft(),o.nc.getScrollTop())}},x=e.fn.scrollTop;e.cssHooks.pageYOffset={get:function(e,o,t){var r=n.data(e,"__nicescroll")||!1;return r&&r.ishwscroll?r.getScrollTop():x.call(e)},set:function(e,o){var t=n.data(e,"__nicescroll")||!1;return t&&t.ishwscroll?t.setScrollTop(parseInt(o)):x.call(e,o),this}},e.fn.scrollTop=function(e){if(void 0===e){var o=!!this[0]&&(n.data(this[0],"__nicescroll")||!1);return o&&o.ishwscroll?o.getScrollTop():x.call(this)}return this.each(function(){var o=n.data(this,"__nicescroll")||!1;o&&o.ishwscroll?o.setScrollTop(parseInt(e)):x.call(n(this),e)})};var S=e.fn.scrollLeft;n.cssHooks.pageXOffset={get:function(e,o,t){var r=n.data(e,"__nicescroll")||!1;return r&&r.ishwscroll?r.getScrollLeft():S.call(e)},set:function(e,o){var t=n.data(e,"__nicescroll")||!1;return t&&t.ishwscroll?t.setScrollLeft(parseInt(o)):S.call(e,o),this}},e.fn.scrollLeft=function(e){if(void 0===e){var o=!!this[0]&&(n.data(this[0],"__nicescroll")||!1);return o&&o.ishwscroll?o.getScrollLeft():S.call(this)}return this.each(function(){var o=n.data(this,"__nicescroll")||!1;o&&o.ishwscroll?o.setScrollLeft(parseInt(e)):S.call(n(this),e)})};var z=function(e){var o=this;if(this.length=0,this.name="nicescrollarray",this.each=function(e){return n.each(o,e),o},this.push=function(e){o[o.length]=e,o.length++},this.eq=function(e){return o[e]},e)for(var t=0;t1?n(e,r):s,i.win=r}!("doc"in i)||"win"in i||(i.win=r);var l=r.data("__nicescroll")||!1;l||(i.doc=i.doc||r,l=new b(i,r),r.data("__nicescroll",l)),t.push(l)}),1===t.length?t[0]:t},a.NiceScroll={getjQuery:function(){return e}},n.nicescroll||(n.nicescroll=new z,n.nicescroll.options=g)}); \ No newline at end of file From 269556235a5c57b40dea08f25e015dcf602bf4b1 Mon Sep 17 00:00:00 2001 From: InuYaksa Date: Tue, 11 Jul 2017 15:57:37 +0200 Subject: [PATCH 13/14] [DEV] 3.7.5-d micro fix on DOM observer --- jquery.nicescroll.js | 17 ++++++++++------- jquery.nicescroll.min.js | 4 ++-- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/jquery.nicescroll.js b/jquery.nicescroll.js index bb850e1..50bc270 100644 --- a/jquery.nicescroll.js +++ b/jquery.nicescroll.js @@ -1,6 +1,6 @@ /* jquery.nicescroll --- version 3.7.5-c --- copyright 2017-07-02 InuYaksa*2017 +-- version 3.7.5-d +-- copyright 2017-07-11 InuYaksa*2017 -- licensed under the MIT -- -- https://nicescroll.areaaperta.com/ @@ -261,7 +261,7 @@ var self = this; - this.version = '3.7.5-c'; + this.version = '3.7.5-d'; this.name = 'nicescroll'; this.me = me; @@ -1987,10 +1987,11 @@ } if (!self.ispage && !self.haswrapper) { + + var _dom = self.win[0]; + // redesigned MutationObserver for Chrome18+/Firefox14+/iOS6+ with support for: remove div, add/remove content if (ClsMutationObserver !== false) { - var _dom = self.win[0]; - self.observer = new ClsMutationObserver(function (mutations) { mutations.forEach(self.onAttributeChange); }); @@ -2350,10 +2351,12 @@ clearTimeout(hlazyresize); + tm = isNaN(tm) ? 240 : tm; + hlazyresize = setTimeout(function () { - if (self) self.resize(); + self && self.resize(); hlazyresize=0; - }, tm||240); + }, tm); return self; diff --git a/jquery.nicescroll.min.js b/jquery.nicescroll.min.js index d4befc8..b6c0885 100644 --- a/jquery.nicescroll.min.js +++ b/jquery.nicescroll.min.js @@ -1,2 +1,2 @@ -/* jquery.nicescroll v3.7.5-c [DEV] InuYaksa - MIT - https://nicescroll.areaaperta.com */ -!function(e){"function"==typeof define&&define.amd?define(["jquery"],e):"object"==typeof exports?module.exports=e(require("jquery")):e(jQuery)}(function(e){"use strict";var o=!1,t=!1,r=0,i=2e3,s=0,n=e,l=document,a=window,c=n(a),d=[],u=a.requestAnimationFrame||a.webkitRequestAnimationFrame||a.mozRequestAnimationFrame||!1,h=a.cancelAnimationFrame||a.webkitCancelAnimationFrame||a.mozCancelAnimationFrame||!1;if(u)a.cancelAnimationFrame||(h=function(e){});else{var p=0;u=function(e,o){var t=(new Date).getTime(),r=Math.max(0,16-(t-p)),i=a.setTimeout(function(){e(t+r)},r);return p=t+r,i},h=function(e){a.clearTimeout(e)}}var m=a.MutationObserver||a.WebKitMutationObserver||!1,f=Date.now||function(){return(new Date).getTime()},g={zindex:"auto",cursoropacitymin:0,cursoropacitymax:1,cursorcolor:"#424242",cursorwidth:"6px",cursorborder:"1px solid #fff",cursorborderradius:"5px",scrollspeed:40,mousescrollstep:27,touchbehavior:!1,emulatetouch:!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 e=l.currentScript||function(){var e=l.getElementsByTagName("script");return!!e.length&&e[e.length-1]}(),o=e?e.src.split("?")[0]:"";return o.split("/").length>0?o.split("/").slice(0,-1).join("/")+"/":""}(),preventmultitouchscrolling:!0,disablemutationobserver:!1,enableobserver:!0,scrollbarid:!1},v=!1,w=function(){if(v)return v;var e=l.createElement("DIV"),o=e.style,t=navigator.userAgent,r=navigator.platform,i={};return i.haspointerlock="pointerLockElement"in l||"webkitPointerLockElement"in l||"mozPointerLockElement"in l,i.isopera="opera"in a,i.isopera12=i.isopera&&"getUserMedia"in navigator,i.isoperamini="[object OperaMini]"===Object.prototype.toString.call(a.operamini),i.isie="all"in l&&"attachEvent"in e&&!i.isopera,i.isieold=i.isie&&!("msInterpolationMode"in o),i.isie7=i.isie&&!i.isieold&&(!("documentMode"in l)||7===l.documentMode),i.isie8=i.isie&&"documentMode"in l&&8===l.documentMode,i.isie9=i.isie&&"performance"in a&&9===l.documentMode,i.isie10=i.isie&&"performance"in a&&10===l.documentMode,i.isie11="msRequestFullscreen"in e&&l.documentMode>=11,i.ismsedge="msCredentials"in a,i.ismozilla="MozAppearance"in o,i.iswebkit=!i.ismsedge&&"WebkitAppearance"in o,i.ischrome=i.iswebkit&&"chrome"in a,i.ischrome38=i.ischrome&&"touchAction"in o,i.ischrome22=!i.ischrome38&&i.ischrome&&i.haspointerlock,i.ischrome26=!i.ischrome38&&i.ischrome&&"transition"in o,i.cantouch="ontouchstart"in l.documentElement||"ontouchstart"in a,i.hasw3ctouch=(a.PointerEvent||!1)&&(navigator.maxTouchPoints>0||navigator.msMaxTouchPoints>0),i.hasmstouch=!i.hasw3ctouch&&(a.MSPointerEvent||!1),i.ismac=/^mac$/i.test(r),i.isios=i.cantouch&&/iphone|ipad|ipod/i.test(r),i.isios4=i.isios&&!("seal"in Object),i.isios7=i.isios&&"webkitHidden"in l,i.isios8=i.isios&&"hidden"in l,i.isios10=i.isios&&a.Proxy,i.isandroid=/android/i.test(t),i.haseventlistener="addEventListener"in e,i.trstyle=!1,i.hastransform=!1,i.hastranslate3d=!1,i.transitionstyle=!1,i.hastransition=!1,i.transitionend=!1,i.trstyle="transform",i.hastransform="transform"in o||function(){for(var e=["msTransform","webkitTransform","MozTransform","OTransform"],t=0,r=e.length;t0;){if(9==e[0].nodeType)return!1;var o=e.css("zIndex");if(!isNaN(o)&&0!==o)return parseInt(o);e=e.parent()}return!1}function x(e,o,t){var r=e.css(o),i=parseFloat(r);if(isNaN(i)){var s=3==(i=I[r]||0)?t?T.win.outerHeight()-T.win.innerHeight():T.win.outerWidth()-T.win.innerWidth():1;return T.isie8&&i&&(i+=1),s?i:0}return i}function S(e,o,t,r){T._bind(e,o,function(r){var i={original:r=r||a.event,target:r.target||r.srcElement,type:"wheel",deltaMode:"MozMousePixelScroll"==r.type?0:1,deltaX:0,deltaZ:0,preventDefault:function(){return r.preventDefault?r.preventDefault():r.returnValue=!1,!1},stopImmediatePropagation:function(){r.stopImmediatePropagation?r.stopImmediatePropagation():r.cancelBubble=!0}};return"mousewheel"==o?(r.wheelDeltaX&&(i.deltaX=-.025*r.wheelDeltaX),r.wheelDeltaY&&(i.deltaY=-.025*r.wheelDeltaY),!i.deltaY&&!i.deltaX&&(i.deltaY=-.025*r.wheelDelta)):i.deltaY=r.detail,t.call(e,i)},r)}function z(e,o,t,r){T.scrollrunning||(T.newscrolly=T.getScrollTop(),T.newscrollx=T.getScrollLeft(),D=f());var i=f()-D;if(D=f(),i>350?A=1:A+=(2-A)/10,e=e*A|0,o=o*A|0,e){if(r)if(e<0){if(T.getScrollLeft()>=T.page.maxw)return!0}else if(T.getScrollLeft()<=0)return!0;var s=e>0?1:-1;X!==s&&(T.scrollmom&&T.scrollmom.stop(),T.newscrollx=T.getScrollLeft(),X=s),T.lastdeltax-=e}if(o){if(function(){var e=T.getScrollTop();if(o<0){if(e>=T.page.maxh)return!0}else if(e<=0)return!0}()){if(M.nativeparentscrolling&&t&&!T.ispage&&!T.zoomactive)return!0;var n=T.view.h>>1;T.newscrolly<-n?(T.newscrolly=-n,o=-1):T.newscrolly>T.page.maxh+n?(T.newscrolly=T.page.maxh+n,o=1):o=0}var l=o>0?1:-1;B!==l&&(T.scrollmom&&T.scrollmom.stop(),T.newscrolly=T.getScrollTop(),B=l),T.lastdeltay-=o}(o||e)&&T.synched("relativexy",function(){var e=T.lastdeltay+T.newscrolly;T.lastdeltay=0;var o=T.lastdeltax+T.newscrollx;T.lastdeltax=0,T.rail.drag||T.doScrollPos(o,e)})}function k(e,o,t){var r,i;return!(t||!q)||(0===e.deltaMode?(r=-e.deltaX*(M.mousescrollstep/54)|0,i=-e.deltaY*(M.mousescrollstep/54)|0):1===e.deltaMode&&(r=-e.deltaX*M.mousescrollstep*50/80|0,i=-e.deltaY*M.mousescrollstep*50/80|0),o&&M.oneaxismousemode&&0===r&&i&&(r=i,i=0,t&&(r<0?T.getScrollLeft()>=T.page.maxw:T.getScrollLeft()<=0)&&(i=r,r=0)),T.isrtlmode&&(r=-r),z(r,i,t,!0)?void(t&&(q=!0)):(q=!1,e.stopImmediatePropagation(),e.preventDefault()))}var T=this;this.version="3.7.5-c",this.name="nicescroll",this.me=p;var E=n("body"),M=this.opt={doc:E,win:!1};if(n.extend(M,g),M.snapbackspeed=80,e)for(var L in M)void 0!==e[L]&&(M[L]=e[L]);if(M.disablemutationobserver&&(m=!1),this.doc=M.doc,this.iddoc=this.doc&&this.doc[0]?this.doc[0].id||"":"",this.ispage=/^BODY|HTML/.test(M.win?M.win[0].nodeName:this.doc[0].nodeName),this.haswrapper=!1!==M.win,this.win=M.win||(this.ispage?c:this.doc),this.docscroll=this.ispage&&!this.haswrapper?c:this.win,this.body=E,this.viewport=!1,this.isfixed=!1,this.iframe=!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"!=M.autohidemode,this.onmousedown=!1,this.onmouseup=!1,this.onmousemove=!1,this.onmousewheel=!1,this.onkeypress=!1,this.ongesturezoom=!1,this.onclick=!1,this.onscrollstart=!1,this.onscrollend=!1,this.onscrollcancel=!1,this.onzoomin=!1,this.onzoomout=!1,this.view=!1,this.page=!1,this.scroll={x:0,y:0},this.scrollratio={x:0,y:0},this.cursorheight=20,this.scrollvaluemax=0,"auto"==M.rtlmode){var C=this.win[0]==a?this.body:this.win,P=C.css("writing-mode")||C.css("-webkit-writing-mode")||C.css("-ms-writing-mode")||C.css("-moz-writing-mode");"horizontal-tb"==P||"lr-tb"==P||""===P?(this.isrtlmode="rtl"==C.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===M.rtlmode,this.isvertical=!1;if(this.scrollrunning=!1,this.scrollmom=!1,this.observer=!1,this.observerremover=!1,this.observerbody=!1,!1!==M.scrollbarid)this.id=M.scrollbarid;else do{this.id="ascrail"+i++}while(l.getElementById(this.id));this.rail=!1,this.cursor=!1,this.cursorfreezed=!1,this.selectiondrag=!1,this.zoom=!1,this.zoomactive=!1,this.hasfocus=!1,this.hasmousefocus=!1,this.railslocked=!1,this.locked=!1,this.hidden=!1,this.cursoractive=!0,this.wheelprevented=!1,this.overflowx=M.overflowx,this.overflowy=M.overflowy,this.nativescrollingarea=!1,this.checkarea=0,this.events=[],this.saved={},this.delaylist={},this.synclist={},this.lastdeltax=0,this.lastdeltay=0,this.detected=w();var N=n.extend({},this.detected);this.canhwscroll=N.hastransform&&M.hwacceleration,this.ishwscroll=this.canhwscroll&&T.haswrapper,this.isrtlmode?this.isvertical?this.hasreversehr=!(N.iswebkit||N.isie||N.isie11):this.hasreversehr=!(N.iswebkit||N.isie&&!N.isie10&&!N.isie11):this.hasreversehr=!1,this.istouchcapable=!1,N.cantouch||!N.hasw3ctouch&&!N.hasmstouch?!N.cantouch||N.isios||N.isandroid||!N.iswebkit&&!N.ismozilla||(this.istouchcapable=!0):this.istouchcapable=!0,M.enablemouselockapi||(N.hasmousecapture=!1,N.haspointerlock=!1),this.debounced=function(e,o,t){T&&(T.delaylist[e]||!1||(T.delaylist[e]={h:u(function(){T.delaylist[e].fn.call(T),T.delaylist[e]=!1},t)},o.call(T)),T.delaylist[e].fn=o)},this.synched=function(e,o){T.synclist[e]?T.synclist[e]=o:(T.synclist[e]=o,u(function(){T&&(T.synclist[e]&&T.synclist[e].call(T),T.synclist[e]=null)}))},this.unsynched=function(e){T.synclist[e]&&(T.synclist[e]=!1)},this.css=function(e,o){for(var t in o)T.saved.css.push([e,t,e.css(t)]),e.css(t,o[t])},this.scrollTop=function(e){return void 0===e?T.getScrollTop():T.setScrollTop(e)},this.scrollLeft=function(e){return void 0===e?T.getScrollLeft():T.setScrollLeft(e)};var R=function(e,o,t,r,i,s,n){this.st=e,this.ed=o,this.spd=t,this.p1=r||0,this.p2=i||1,this.p3=s||0,this.p4=n||1,this.ts=f(),this.df=o-e};if(R.prototype={B2:function(e){return 3*(1-e)*(1-e)*e},B3:function(e){return 3*(1-e)*e*e},B4:function(e){return e*e*e},getPos:function(){return(f()-this.ts)/this.spd},getNow:function(){var e=(f()-this.ts)/this.spd,o=this.B2(e)+this.B3(e)+this.B4(e);return e>=1?this.ed:this.st+this.df*o|0},update:function(e,o){return this.st=this.getNow(),this.ed=e,this.spd=o,this.ts=f(),this.df=this.ed-this.st,this}},this.ishwscroll){this.doc.translate={x:0,y:0,tx:"0px",ty:"0px"},N.hastranslate3d&&N.isios&&this.doc.css("-webkit-backface-visibility","hidden"),this.getScrollTop=function(e){if(!e){var o=v();if(o)return 16==o.length?-o[13]:-o[5];if(T.timerscroll&&T.timerscroll.bz)return T.timerscroll.bz.getNow()}return T.doc.translate.y},this.getScrollLeft=function(e){if(!e){var o=v();if(o)return 16==o.length?-o[12]:-o[4];if(T.timerscroll&&T.timerscroll.bh)return T.timerscroll.bh.getNow()}return T.doc.translate.x},this.notifyScrollEvent=function(e){var o=l.createEvent("UIEvents");o.initUIEvent("scroll",!1,!1,a,1),o.niceevent=!0,e.dispatchEvent(o)};var _=this.isrtlmode?1:-1;N.hastranslate3d&&M.enabletranslate3d?(this.setScrollTop=function(e,o){T.doc.translate.y=e,T.doc.translate.ty=-1*e+"px",T.doc.css(N.trstyle,"translate3d("+T.doc.translate.tx+","+T.doc.translate.ty+",0)"),o||T.notifyScrollEvent(T.win[0])},this.setScrollLeft=function(e,o){T.doc.translate.x=e,T.doc.translate.tx=e*_+"px",T.doc.css(N.trstyle,"translate3d("+T.doc.translate.tx+","+T.doc.translate.ty+",0)"),o||T.notifyScrollEvent(T.win[0])}):(this.setScrollTop=function(e,o){T.doc.translate.y=e,T.doc.translate.ty=-1*e+"px",T.doc.css(N.trstyle,"translate("+T.doc.translate.tx+","+T.doc.translate.ty+")"),o||T.notifyScrollEvent(T.win[0])},this.setScrollLeft=function(e,o){T.doc.translate.x=e,T.doc.translate.tx=e*_+"px",T.doc.css(N.trstyle,"translate("+T.doc.translate.tx+","+T.doc.translate.ty+")"),o||T.notifyScrollEvent(T.win[0])})}else this.getScrollTop=function(){return T.docscroll.scrollTop()},this.setScrollTop=function(e){T.docscroll.scrollTop(e)},this.getScrollLeft=function(){return T.hasreversehr?T.detected.ismozilla?T.page.maxw-Math.abs(T.docscroll.scrollLeft()):T.page.maxw-T.docscroll.scrollLeft():T.docscroll.scrollLeft()},this.setScrollLeft=function(e){return setTimeout(function(){if(T)return T.hasreversehr&&(e=T.detected.ismozilla?-(T.page.maxw-e):T.page.maxw-e),T.docscroll.scrollLeft(e)},1)};this.getTarget=function(e){return!!e&&(e.target?e.target:!!e.srcElement&&e.srcElement)},this.hasParent=function(e,o){if(!e)return!1;for(var t=e.target||e.srcElement||e||!1;t&&t.id!=o;)t=t.parentNode||!1;return!1!==t};var I={thin:1,medium:3,thick:5};this.getDocumentScrollOffset=function(){return{top:a.pageYOffset||l.documentElement.scrollTop,left:a.pageXOffset||l.documentElement.scrollLeft}},this.getOffset=function(){if(T.isfixed){var e=T.win.offset(),o=T.getDocumentScrollOffset();return e.top-=o.top,e.left-=o.left,e}var t=T.win.offset();if(!T.viewport)return t;var r=T.viewport.offset();return{top:t.top-r.top,left:t.left-r.left}},this.updateScrollBar=function(e){var o,t;if(T.ishwscroll)T.rail.css({height:T.win.innerHeight()-(M.railpadding.top+M.railpadding.bottom)}),T.railh&&T.railh.css({width:T.win.innerWidth()-(M.railpadding.left+M.railpadding.right)});else{var r=T.getOffset();if(o={top:r.top,left:r.left-(M.railpadding.left+M.railpadding.right)},o.top+=x(T.win,"border-top-width",!0),o.left+=T.rail.align?T.win.outerWidth()-x(T.win,"border-right-width")-T.rail.width:x(T.win,"border-left-width"),(t=M.railoffset)&&(t.top&&(o.top+=t.top),t.left&&(o.left+=t.left)),T.railslocked||T.rail.css({top:o.top,left:o.left,height:(e?e.h:T.win.innerHeight())-(M.railpadding.top+M.railpadding.bottom)}),T.zoom&&T.zoom.css({top:o.top+1,left:1==T.rail.align?o.left-20:o.left+T.rail.width+4}),T.railh&&!T.railslocked){o={top:r.top,left:r.left},(t=M.railhoffset)&&(t.top&&(o.top+=t.top),t.left&&(o.left+=t.left));var i=T.railh.align?o.top+x(T.win,"border-top-width",!0)+T.win.innerHeight()-T.railh.height:o.top+x(T.win,"border-top-width",!0),s=o.left+x(T.win,"border-left-width");T.railh.css({top:i-(M.railpadding.top+M.railpadding.bottom),left:s,width:T.railh.width})}}},this.doRailClick=function(e,o,t){var r,i,s,n;T.railslocked||(T.cancelEvent(e),"pageY"in e||(e.pageX=e.clientX+l.documentElement.scrollLeft,e.pageY=e.clientY+l.documentElement.scrollTop),o?(r=t?T.doScrollLeft:T.doScrollTop,s=t?(e.pageX-T.railh.offset().left-T.cursorwidth/2)*T.scrollratio.x:(e.pageY-T.rail.offset().top-T.cursorheight/2)*T.scrollratio.y,T.unsynched("relativexy"),r(0|s)):(r=t?T.doScrollLeftBy:T.doScrollBy,s=t?T.scroll.x:T.scroll.y,n=t?e.pageX-T.railh.offset().left:e.pageY-T.rail.offset().top,i=t?T.view.w:T.view.h,r(s>=n?i:-i)))},T.newscrolly=T.newscrollx=0,T.hasanimationframe="requestAnimationFrame"in a,T.hascancelanimationframe="cancelAnimationFrame"in a,T.hasborderbox=!1,this.init=function(){if(T.saved.css=[],N.isoperamini)return!0;if(N.isandroid&&!("hidden"in l))return!0;M.emulatetouch=M.emulatetouch||M.touchbehavior,T.hasborderbox=a.getComputedStyle&&"border-box"===a.getComputedStyle(l.body)["box-sizing"];var e={"overflow-y":"hidden"};if((N.isie11||N.isie10)&&(e["-ms-overflow-style"]="none"),T.ishwscroll&&(this.doc.css(N.transitionstyle,N.prefixstyle+"transform 0ms ease-out"),N.transitionend&&T.bind(T.doc,N.transitionend,T.onScrollTransitionEnd,!1)),T.zindex="auto",T.ispage||"auto"!=M.zindex?T.zindex=M.zindex:T.zindex=b()||"auto",!T.ispage&&"auto"!=T.zindex&&T.zindex>s&&(s=T.zindex),T.isie&&0===T.zindex&&"auto"==M.zindex&&(T.zindex="auto"),!T.ispage||!N.isieold){var i=T.docscroll;T.ispage&&(i=T.haswrapper?T.win:T.doc),T.css(i,e),T.ispage&&(N.isie11||N.isie)&&T.css(n("html"),e),!N.isios||T.ispage||T.haswrapper||T.css(E,{"-webkit-overflow-scrolling":"touch"});var d=n(l.createElement("div"));d.css({position:"relative",top:0,float:"right",width:M.cursorwidth,height:0,"background-color":M.cursorcolor,border:M.cursorborder,"background-clip":"padding-box","-webkit-border-radius":M.cursorborderradius,"-moz-border-radius":M.cursorborderradius,"border-radius":M.cursorborderradius}),d.addClass("nicescroll-cursors"),T.cursor=d;var u=n(l.createElement("div"));u.attr("id",T.id),u.addClass("nicescroll-rails nicescroll-rails-vr");var h,p,f=["left","right","top","bottom"];for(var g in f)p=f[g],(h=M.railpadding[p]||0)&&u.css("padding-"+p,h+"px");u.append(d),u.width=Math.max(parseFloat(M.cursorwidth),d.outerWidth()),u.css({width:u.width+"px",zIndex:T.zindex,background:M.background,cursor:"default"}),u.visibility=!0,u.scrollable=!0,u.align="left"==M.railalign?0:1,T.rail=u,T.rail.drag=!1;var v=!1;!M.boxzoom||T.ispage||N.isieold||(v=l.createElement("div"),T.bind(v,"click",T.doZoom),T.bind(v,"mouseenter",function(){T.zoom.css("opacity",M.cursoropacitymax)}),T.bind(v,"mouseleave",function(){T.zoom.css("opacity",M.cursoropacitymin)}),T.zoom=n(v),T.zoom.css({cursor:"pointer",zIndex:T.zindex,backgroundImage:"url("+M.scriptpath+"zoomico.png)",height:18,width:18,backgroundPosition:"0 0"}),M.dblclickzoom&&T.bind(T.win,"dblclick",T.doZoom),N.cantouch&&M.gesturezoom&&(T.ongesturezoom=function(e){return e.scale>1.5&&T.doZoomIn(e),e.scale<.8&&T.doZoomOut(e),T.cancelEvent(e)},T.bind(T.win,"gestureend",T.ongesturezoom))),T.railh=!1;var w;if(M.horizrailenabled&&(T.css(i,{overflowX:"hidden"}),(d=n(l.createElement("div"))).css({position:"absolute",top:0,height:M.cursorwidth,width:0,backgroundColor:M.cursorcolor,border:M.cursorborder,backgroundClip:"padding-box","-webkit-border-radius":M.cursorborderradius,"-moz-border-radius":M.cursorborderradius,"border-radius":M.cursorborderradius}),N.isieold&&d.css("overflow","hidden"),d.addClass("nicescroll-cursors"),T.cursorh=d,(w=n(l.createElement("div"))).attr("id",T.id+"-hr"),w.addClass("nicescroll-rails nicescroll-rails-hr"),w.height=Math.max(parseFloat(M.cursorwidth),d.outerHeight()),w.css({height:w.height+"px",zIndex:T.zindex,background:M.background}),w.append(d),w.visibility=!0,w.scrollable=!0,w.align="top"==M.railvalign?0:1,T.railh=w,T.railh.drag=!1),T.ispage)u.css({position:"fixed",top:0,height:"100%"}),u.css(u.align?{right:0}:{left:0}),T.body.append(u),T.railh&&(w.css({position:"fixed",left:0,width:"100%"}),w.css(w.align?{bottom:0}:{top:0}),T.body.append(w));else{if(T.ishwscroll){"static"==T.win.css("position")&&T.css(T.win,{position:"relative"});var x="HTML"==T.win[0].nodeName?T.body:T.win;n(x).scrollTop(0).scrollLeft(0),T.zoom&&(T.zoom.css({position:"absolute",top:1,right:0,"margin-right":u.width+4}),x.append(T.zoom)),u.css({position:"absolute",top:0}),u.css(u.align?{right:0}:{left:0}),x.append(u),w&&(w.css({position:"absolute",left:0,bottom:0}),w.css(w.align?{bottom:0}:{top:0}),x.append(w))}else{T.isfixed="fixed"==T.win.css("position");var S=T.isfixed?"fixed":"absolute";T.isfixed||(T.viewport=T.getViewport(T.win[0])),T.viewport&&(T.body=T.viewport,/fixed|absolute/.test(T.viewport.css("position"))||T.css(T.viewport,{position:"relative"})),u.css({position:S}),T.zoom&&T.zoom.css({position:S}),T.updateScrollBar(),T.body.append(u),T.zoom&&T.body.append(T.zoom),T.railh&&(w.css({position:S}),T.body.append(w))}N.isios&&T.css(T.win,{"-webkit-tap-highlight-color":"rgba(0,0,0,0)","-webkit-touch-callout":"none"}),M.disableoutline&&(N.isie&&T.win.attr("hideFocus","true"),N.iswebkit&&T.win.css("outline","none"))}if(!1===M.autohidemode?(T.autohidedom=!1,T.rail.css({opacity:M.cursoropacitymax}),T.railh&&T.railh.css({opacity:M.cursoropacitymax})):!0===M.autohidemode||"leave"===M.autohidemode?(T.autohidedom=n().add(T.rail),N.isie8&&(T.autohidedom=T.autohidedom.add(T.cursor)),T.railh&&(T.autohidedom=T.autohidedom.add(T.railh)),T.railh&&N.isie8&&(T.autohidedom=T.autohidedom.add(T.cursorh))):"scroll"==M.autohidemode?(T.autohidedom=n().add(T.rail),T.railh&&(T.autohidedom=T.autohidedom.add(T.railh))):"cursor"==M.autohidemode?(T.autohidedom=n().add(T.cursor),T.railh&&(T.autohidedom=T.autohidedom.add(T.cursorh))):"hidden"==M.autohidemode&&(T.autohidedom=!1,T.hide(),T.railslocked=!1),N.cantouch||T.istouchcapable||M.emulatetouch||N.hasmstouch){T.scrollmom=new y(T);T.ontouchstart=function(e){if(T.locked)return!1;if(e.pointerType&&("mouse"===e.pointerType||e.pointerType===e.MSPOINTER_TYPE_MOUSE))return!1;if(T.hasmoving=!1,T.scrollmom.timer&&(T.triggerScrollEnd(),T.scrollmom.stop()),!T.railslocked){var o=T.getTarget(e);if(o&&/INPUT/i.test(o.nodeName)&&/range/i.test(o.type))return T.stopPropagation(e);var t="mousedown"===e.type;if(!("clientX"in e)&&"changedTouches"in e&&(e.clientX=e.changedTouches[0].clientX,e.clientY=e.changedTouches[0].clientY),T.forcescreen){var r=e;(e={original:e.original?e.original:e}).clientX=r.screenX,e.clientY=r.screenY}if(T.rail.drag={x:e.clientX,y:e.clientY,sx:T.scroll.x,sy:T.scroll.y,st:T.getScrollTop(),sl:T.getScrollLeft(),pt:2,dl:!1,tg:o},T.ispage||!M.directionlockdeadzone)T.rail.drag.dl="f";else{var i={w:c.width(),h:c.height()},s=T.getContentSize(),l=s.h-i.h,a=s.w-i.w;T.rail.scrollable&&!T.railh.scrollable?T.rail.drag.ck=l>0&&"v":!T.rail.scrollable&&T.railh.scrollable?T.rail.drag.ck=a>0&&"h":T.rail.drag.ck=!1}if(M.emulatetouch&&T.isiframe&&N.isie){var d=T.win.position();T.rail.drag.x+=d.left,T.rail.drag.y+=d.top}if(T.hasmoving=!1,T.lastmouseup=!1,T.scrollmom.reset(e.clientX,e.clientY),o&&t){if(!/INPUT|SELECT|BUTTON|TEXTAREA/i.test(o.nodeName))return N.hasmousecapture&&o.setCapture(),M.emulatetouch?(o.onclick&&!o._onclick&&(o._onclick=o.onclick,o.onclick=function(e){if(T.hasmoving)return!1;o._onclick.call(this,e)}),T.cancelEvent(e)):T.stopPropagation(e);/SUBMIT|CANCEL|BUTTON/i.test(n(o).attr("type"))&&(T.preventclick={tg:o,click:!1})}}},T.ontouchend=function(e){if(!T.rail.drag)return!0;if(2==T.rail.drag.pt){if(e.pointerType&&("mouse"===e.pointerType||e.pointerType===e.MSPOINTER_TYPE_MOUSE))return!1;T.rail.drag=!1;var o="mouseup"===e.type;if(T.hasmoving&&(T.scrollmom.doMomentum(),T.lastmouseup=!0,T.hideCursor(),N.hasmousecapture&&l.releaseCapture(),o))return T.cancelEvent(e)}else if(1==T.rail.drag.pt)return T.onmouseup(e)};var z=M.emulatetouch&&T.isiframe&&!N.hasmousecapture,k=.3*M.directionlockdeadzone|0;T.ontouchmove=function(e,o){if(!T.rail.drag)return!0;if(e.targetTouches&&M.preventmultitouchscrolling&&e.targetTouches.length>1)return!0;if(e.pointerType&&("mouse"===e.pointerType||e.pointerType===e.MSPOINTER_TYPE_MOUSE))return!0;if(2==T.rail.drag.pt){"changedTouches"in e&&(e.clientX=e.changedTouches[0].clientX,e.clientY=e.changedTouches[0].clientY);var t,r;if(r=t=0,z&&!o){var i=T.win.position();r=-i.left,t=-i.top}var s=e.clientY+t,n=s-T.rail.drag.y,a=e.clientX+r,c=a-T.rail.drag.x,d=T.rail.drag.st-n;if(T.ishwscroll&&M.bouncescroll)d<0?d=Math.round(d/2):d>T.page.maxh&&(d=T.page.maxh+Math.round((d-T.page.maxh)/2));else if(d<0?(d=0,s=0):d>T.page.maxh&&(d=T.page.maxh,s=0),0===s&&!T.hasmoving)return T.ispage||(T.rail.drag=!1),!0;var u=T.getScrollLeft();if(T.railh&&T.railh.scrollable&&(u=T.isrtlmode?c-T.rail.drag.sl:T.rail.drag.sl-c,T.ishwscroll&&M.bouncescroll?u<0?u=Math.round(u/2):u>T.page.maxw&&(u=T.page.maxw+Math.round((u-T.page.maxw)/2)):(u<0&&(u=0,a=0),u>T.page.maxw&&(u=T.page.maxw,a=0))),!T.hasmoving){if(T.rail.drag.y===e.clientY&&T.rail.drag.x===e.clientX)return T.cancelEvent(e);var h=Math.abs(n),p=Math.abs(c),m=M.directionlockdeadzone;if(T.rail.drag.ck?"v"==T.rail.drag.ck?p>m&&h<=k?T.rail.drag=!1:h>m&&(T.rail.drag.dl="v"):"h"==T.rail.drag.ck&&(h>m&&p<=k?T.rail.drag=!1:p>m&&(T.rail.drag.dl="h")):h>m&&p>m?T.rail.drag.dl="f":h>m?T.rail.drag.dl=p>k?"f":"v":p>m&&(T.rail.drag.dl=h>k?"f":"h"),!T.rail.drag.dl)return T.cancelEvent(e);T.triggerScrollStart(e.clientX,e.clientY,0,0,0),T.hasmoving=!0}return T.preventclick&&!T.preventclick.click&&(T.preventclick.click=T.preventclick.tg.onclick||!1,T.preventclick.tg.onclick=T.onpreventclick),T.rail.drag.dl&&("v"==T.rail.drag.dl?u=T.rail.drag.sl:"h"==T.rail.drag.dl&&(d=T.rail.drag.st)),T.synched("touchmove",function(){T.rail.drag&&2==T.rail.drag.pt&&(T.prepareTransition&&T.resetTransition(),T.rail.scrollable&&T.setScrollTop(d),T.scrollmom.update(a,s),T.railh&&T.railh.scrollable?(T.setScrollLeft(u),T.showCursor(d,u)):T.showCursor(d),N.isie10&&l.selection.clear())}),T.cancelEvent(e)}return 1==T.rail.drag.pt?T.onmousemove(e):void 0},T.ontouchstartCursor=function(e,o){if(!T.rail.drag||3==T.rail.drag.pt){if(T.locked)return T.cancelEvent(e);T.cancelScroll(),T.rail.drag={x:e.touches[0].clientX,y:e.touches[0].clientY,sx:T.scroll.x,sy:T.scroll.y,pt:3,hr:!!o};var t=T.getTarget(e);return!T.ispage&&N.hasmousecapture&&t.setCapture(),T.isiframe&&!N.hasmousecapture&&(T.saved.csspointerevents=T.doc.css("pointer-events"),T.css(T.doc,{"pointer-events":"none"})),T.cancelEvent(e)}},T.ontouchendCursor=function(e){if(T.rail.drag){if(N.hasmousecapture&&l.releaseCapture(),T.isiframe&&!N.hasmousecapture&&T.doc.css("pointer-events",T.saved.csspointerevents),3!=T.rail.drag.pt)return;return T.rail.drag=!1,T.cancelEvent(e)}},T.ontouchmoveCursor=function(e){if(T.rail.drag){if(3!=T.rail.drag.pt)return;if(T.cursorfreezed=!0,T.rail.drag.hr){T.scroll.x=T.rail.drag.sx+(e.touches[0].clientX-T.rail.drag.x),T.scroll.x<0&&(T.scroll.x=0);var o=T.scrollvaluemaxw;T.scroll.x>o&&(T.scroll.x=o)}else{T.scroll.y=T.rail.drag.sy+(e.touches[0].clientY-T.rail.drag.y),T.scroll.y<0&&(T.scroll.y=0);var t=T.scrollvaluemax;T.scroll.y>t&&(T.scroll.y=t)}return T.synched("touchmove",function(){T.rail.drag&&3==T.rail.drag.pt&&(T.showCursor(),T.rail.drag.hr?T.doScrollLeft(Math.round(T.scroll.x*T.scrollratio.x),M.cursordragspeed):T.doScrollTop(Math.round(T.scroll.y*T.scrollratio.y),M.cursordragspeed))}),T.cancelEvent(e)}}}if(T.onmousedown=function(e,o){if(!T.rail.drag||1==T.rail.drag.pt){if(T.railslocked)return T.cancelEvent(e);T.cancelScroll(),T.rail.drag={x:e.clientX,y:e.clientY,sx:T.scroll.x,sy:T.scroll.y,pt:1,hr:o||!1};var t=T.getTarget(e);return N.hasmousecapture&&t.setCapture(),T.isiframe&&!N.hasmousecapture&&(T.saved.csspointerevents=T.doc.css("pointer-events"),T.css(T.doc,{"pointer-events":"none"})),T.hasmoving=!1,T.cancelEvent(e)}},T.onmouseup=function(e){if(T.rail.drag)return 1!=T.rail.drag.pt||(N.hasmousecapture&&l.releaseCapture(),T.isiframe&&!N.hasmousecapture&&T.doc.css("pointer-events",T.saved.csspointerevents),T.rail.drag=!1,T.cursorfreezed=!1,T.hasmoving&&T.triggerScrollEnd(),T.cancelEvent(e))},T.onmousemove=function(e){if(T.rail.drag){if(1!==T.rail.drag.pt)return;if(N.ischrome&&0===e.which)return T.onmouseup(e);if(T.cursorfreezed=!0,T.hasmoving||T.triggerScrollStart(e.clientX,e.clientY,0,0,0),T.hasmoving=!0,T.rail.drag.hr){T.scroll.x=T.rail.drag.sx+(e.clientX-T.rail.drag.x),T.scroll.x<0&&(T.scroll.x=0);var o=T.scrollvaluemaxw;T.scroll.x>o&&(T.scroll.x=o)}else{T.scroll.y=T.rail.drag.sy+(e.clientY-T.rail.drag.y),T.scroll.y<0&&(T.scroll.y=0);var t=T.scrollvaluemax;T.scroll.y>t&&(T.scroll.y=t)}return T.synched("mousemove",function(){T.cursorfreezed&&(T.showCursor(),T.rail.drag.hr?T.scrollLeft(Math.round(T.scroll.x*T.scrollratio.x)):T.scrollTop(Math.round(T.scroll.y*T.scrollratio.y)))}),T.cancelEvent(e)}T.checkarea=0},N.cantouch||M.emulatetouch)T.onpreventclick=function(e){if(T.preventclick)return T.preventclick.tg.onclick=T.preventclick.click,T.preventclick=!1,T.cancelEvent(e)},T.onclick=!N.isios&&function(e){return!T.lastmouseup||(T.lastmouseup=!1,T.cancelEvent(e))},M.grabcursorenabled&&N.cursorgrabvalue&&(T.css(T.ispage?T.doc:T.win,{cursor:N.cursorgrabvalue}),T.css(T.rail,{cursor:N.cursorgrabvalue}));else{var L=function(e){if(T.selectiondrag){if(e){var o=T.win.outerHeight(),t=e.pageY-T.selectiondrag.top;t>0&&t=o&&(t-=o),T.selectiondrag.df=t}if(0!==T.selectiondrag.df){var r=-2*T.selectiondrag.df/6|0;T.doScrollBy(r),T.debounced("doselectionscroll",function(){L()},50)}}};T.hasTextSelected="getSelection"in l?function(){return l.getSelection().rangeCount>0}:"selection"in l?function(){return"None"!=l.selection.type}:function(){return!1},T.onselectionstart=function(e){T.ispage||(T.selectiondrag=T.win.offset())},T.onselectionend=function(e){T.selectiondrag=!1},T.onselectiondrag=function(e){T.selectiondrag&&T.hasTextSelected()&&T.debounced("selectionscroll",function(){L(e)},250)}}if(N.hasw3ctouch?(T.css(T.ispage?n("html"):T.win,{"touch-action":"none"}),T.css(T.rail,{"touch-action":"none"}),T.css(T.cursor,{"touch-action":"none"}),T.bind(T.win,"pointerdown",T.ontouchstart),T.bind(l,"pointerup",T.ontouchend),T.delegate(l,"pointermove",T.ontouchmove)):N.hasmstouch?(T.css(T.ispage?n("html"):T.win,{"-ms-touch-action":"none"}),T.css(T.rail,{"-ms-touch-action":"none"}),T.css(T.cursor,{"-ms-touch-action":"none"}),T.bind(T.win,"MSPointerDown",T.ontouchstart),T.bind(l,"MSPointerUp",T.ontouchend),T.delegate(l,"MSPointerMove",T.ontouchmove),T.bind(T.cursor,"MSGestureHold",function(e){e.preventDefault()}),T.bind(T.cursor,"contextmenu",function(e){e.preventDefault()})):N.cantouch&&(T.bind(T.win,"touchstart",T.ontouchstart,!1,!0),T.bind(l,"touchend",T.ontouchend,!1,!0),T.bind(l,"touchcancel",T.ontouchend,!1,!0),T.delegate(l,"touchmove",T.ontouchmove,!1,!0)),M.emulatetouch&&(T.bind(T.win,"mousedown",T.ontouchstart,!1,!0),T.bind(l,"mouseup",T.ontouchend,!1,!0),T.bind(l,"mousemove",T.ontouchmove,!1,!0)),(M.cursordragontouch||!N.cantouch&&!M.emulatetouch)&&(T.rail.css({cursor:"default"}),T.railh&&T.railh.css({cursor:"default"}),T.jqbind(T.rail,"mouseenter",function(){if(!T.ispage&&!T.win.is(":visible"))return!1;T.canshowonmouseevent&&T.showCursor(),T.rail.active=!0}),T.jqbind(T.rail,"mouseleave",function(){T.rail.active=!1,T.rail.drag||T.hideCursor()}),M.sensitiverail&&(T.bind(T.rail,"click",function(e){T.doRailClick(e,!1,!1)}),T.bind(T.rail,"dblclick",function(e){T.doRailClick(e,!0,!1)}),T.bind(T.cursor,"click",function(e){T.cancelEvent(e)}),T.bind(T.cursor,"dblclick",function(e){T.cancelEvent(e)})),T.railh&&(T.jqbind(T.railh,"mouseenter",function(){if(!T.ispage&&!T.win.is(":visible"))return!1;T.canshowonmouseevent&&T.showCursor(),T.rail.active=!0}),T.jqbind(T.railh,"mouseleave",function(){T.rail.active=!1,T.rail.drag||T.hideCursor()}),M.sensitiverail&&(T.bind(T.railh,"click",function(e){T.doRailClick(e,!1,!0)}),T.bind(T.railh,"dblclick",function(e){T.doRailClick(e,!0,!0)}),T.bind(T.cursorh,"click",function(e){T.cancelEvent(e)}),T.bind(T.cursorh,"dblclick",function(e){T.cancelEvent(e)})))),M.cursordragontouch&&(this.istouchcapable||N.cantouch)&&(T.bind(T.cursor,"touchstart",T.ontouchstartCursor),T.bind(T.cursor,"touchmove",T.ontouchmoveCursor),T.bind(T.cursor,"touchend",T.ontouchendCursor),T.cursorh&&T.bind(T.cursorh,"touchstart",function(e){T.ontouchstartCursor(e,!0)}),T.cursorh&&T.bind(T.cursorh,"touchmove",T.ontouchmoveCursor),T.cursorh&&T.bind(T.cursorh,"touchend",T.ontouchendCursor)),M.emulatetouch||N.isandroid||N.isios?(T.bind(N.hasmousecapture?T.win:l,"mouseup",T.ontouchend),T.onclick&&T.bind(l,"click",T.onclick),M.cursordragontouch?(T.bind(T.cursor,"mousedown",T.onmousedown),T.bind(T.cursor,"mouseup",T.onmouseup),T.cursorh&&T.bind(T.cursorh,"mousedown",function(e){T.onmousedown(e,!0)}),T.cursorh&&T.bind(T.cursorh,"mouseup",T.onmouseup)):(T.bind(T.rail,"mousedown",function(e){e.preventDefault()}),T.railh&&T.bind(T.railh,"mousedown",function(e){e.preventDefault()}))):(T.bind(N.hasmousecapture?T.win:l,"mouseup",T.onmouseup),T.bind(l,"mousemove",T.onmousemove),T.onclick&&T.bind(l,"click",T.onclick),T.bind(T.cursor,"mousedown",T.onmousedown),T.bind(T.cursor,"mouseup",T.onmouseup),T.railh&&(T.bind(T.cursorh,"mousedown",function(e){T.onmousedown(e,!0)}),T.bind(T.cursorh,"mouseup",T.onmouseup)),!T.ispage&&M.enablescrollonselection&&(T.bind(T.win[0],"mousedown",T.onselectionstart),T.bind(l,"mouseup",T.onselectionend),T.bind(T.cursor,"mouseup",T.onselectionend),T.cursorh&&T.bind(T.cursorh,"mouseup",T.onselectionend),T.bind(l,"mousemove",T.onselectiondrag)),T.zoom&&(T.jqbind(T.zoom,"mouseenter",function(){T.canshowonmouseevent&&T.showCursor(),T.rail.active=!0}),T.jqbind(T.zoom,"mouseleave",function(){T.rail.active=!1,T.rail.drag||T.hideCursor()}))),M.enablemousewheel&&(T.isiframe||T.mousewheel(N.isie&&T.ispage?l:T.win,T.onmousewheel),T.mousewheel(T.rail,T.onmousewheel),T.railh&&T.mousewheel(T.railh,T.onmousewheelhr)),T.ispage||N.cantouch||/HTML|^BODY/.test(T.win[0].nodeName)||(T.win.attr("tabindex")||T.win.attr({tabindex:++r}),T.bind(T.win,"focus",function(e){o=T.getTarget(e).id||T.getTarget(e)||!1,T.hasfocus=!0,T.canshowonmouseevent&&T.noticeCursor()}),T.bind(T.win,"blur",function(e){o=!1,T.hasfocus=!1}),T.bind(T.win,"mouseenter",function(e){t=T.getTarget(e).id||T.getTarget(e)||!1,T.hasmousefocus=!0,T.canshowonmouseevent&&T.noticeCursor()}),T.bind(T.win,"mouseleave",function(e){t=!1,T.hasmousefocus=!1,T.rail.drag||T.hideCursor()})),T.onkeypress=function(e){if(T.railslocked&&0===T.page.maxh)return!0;e=e||a.event;var r=T.getTarget(e);if(r&&/INPUT|TEXTAREA|SELECT|OPTION/.test(r.nodeName)&&(!(r.getAttribute("type")||r.type||!1)||!/submit|button|cancel/i.tp))return!0;if(n(r).attr("contenteditable"))return!0;if(T.hasfocus||T.hasmousefocus&&!o||T.ispage&&!o&&!t){var i=e.keyCode;if(T.railslocked&&27!=i)return T.cancelEvent(e);var s=e.ctrlKey||!1,l=e.shiftKey||!1,c=!1;switch(i){case 38:case 63233:T.doScrollBy(72),c=!0;break;case 40:case 63235:T.doScrollBy(-72),c=!0;break;case 37:case 63232:T.railh&&(s?T.doScrollLeft(0):T.doScrollLeftBy(72),c=!0);break;case 39:case 63234:T.railh&&(s?T.doScrollLeft(T.page.maxw):T.doScrollLeftBy(-72),c=!0);break;case 33:case 63276:T.doScrollBy(T.view.h),c=!0;break;case 34:case 63277:T.doScrollBy(-T.view.h),c=!0;break;case 36:case 63273:T.railh&&s?T.doScrollPos(0,0):T.doScrollTo(0),c=!0;break;case 35:case 63275:T.railh&&s?T.doScrollPos(T.page.maxw,T.page.maxh):T.doScrollTo(T.page.maxh),c=!0;break;case 32:M.spacebarenabled&&(l?T.doScrollBy(T.view.h):T.doScrollBy(-T.view.h),c=!0);break;case 27:T.zoomactive&&(T.doZoom(),c=!0)}if(c)return T.cancelEvent(e)}},M.enablekeyboard&&T.bind(l,N.isopera&&!N.isopera12?"keypress":"keydown",T.onkeypress),T.bind(l,"keydown",function(e){(e.ctrlKey||!1)&&(T.wheelprevented=!0)}),T.bind(l,"keyup",function(e){e.ctrlKey||!1||(T.wheelprevented=!1)}),T.bind(a,"blur",function(e){T.wheelprevented=!1}),T.bind(a,"resize",T.onscreenresize),T.bind(a,"orientationchange",T.onscreenresize),T.bind(a,"load",T.lazyResize),N.ischrome&&!T.ispage&&!T.haswrapper){var C=T.win.attr("style"),P=parseFloat(T.win.css("width"))+1;T.win.css("width",P),T.synched("chromefix",function(){T.win.attr("style",C)})}if(T.onAttributeChange=function(e){T.lazyResize(T.isieold?250:30)},M.enableobserver&&(T.isie11||!1===m||(T.observerbody=new m(function(e){if(e.forEach(function(e){if("attributes"==e.type)return E.hasClass("modal-open")&&E.hasClass("modal-dialog")&&!n.contains(n(".modal-dialog")[0],T.doc[0])?T.hide():T.show()}),T.me.clientWidth!=T.page.width||T.me.clientHeight!=T.page.height)return T.lazyResize(30)}),T.observerbody.observe(l.body,{childList:!0,subtree:!0,characterData:!1,attributes:!0,attributeFilter:["class"]})),!T.ispage&&!T.haswrapper))if(!1!==m){var R=T.win[0];T.observer=new m(function(e){e.forEach(T.onAttributeChange)}),T.observer.observe(R,{childList:!0,characterData:!1,attributes:!0,subtree:!1}),T.observerremover=new m(function(e){e.forEach(function(e){if(e.removedNodes.length>0)for(var o in e.removedNodes)if(T&&e.removedNodes[o]===R)return T.remove()})}),T.observerremover.observe(R.parentNode,{childList:!0,characterData:!1,attributes:!1,subtree:!1})}else T.bind(R,N.isie&&!N.isie9?"propertychange":"DOMAttrModified",T.onAttributeChange),N.isie9&&R.attachEvent("onpropertychange",T.onAttributeChange),T.bind(R,"DOMNodeRemoved",function(e){e.target===R&&T.remove()});!T.ispage&&M.boxzoom&&T.bind(a,"resize",T.resizeZoom),T.istextarea&&(T.bind(T.win,"keydown",T.lazyResize),T.bind(T.win,"mouseup",T.lazyResize)),T.lazyResize(30)}if("IFRAME"==this.doc[0].nodeName){var _=function(){T.iframexd=!1;var o;try{(o="contentDocument"in this?this.contentDocument:this.contentWindow._doc).domain}catch(e){T.iframexd=!0,o=!1}if(T.iframexd)return"console"in a&&console.log("NiceScroll error: policy restriced iframe"),!0;if(T.forcescreen=!0,T.isiframe&&(T.iframe={doc:n(o),html:T.doc.contents().find("html")[0],body:T.doc.contents().find("body")[0]},T.getContentSize=function(){return{w:Math.max(T.iframe.html.scrollWidth,T.iframe.body.scrollWidth),h:Math.max(T.iframe.html.scrollHeight,T.iframe.body.scrollHeight)}},T.docscroll=n(T.iframe.body)),!N.isios&&M.iframeautoresize&&!T.isiframe){T.win.scrollTop(0),T.doc.height("");var t=Math.max(o.getElementsByTagName("html")[0].scrollHeight,o.body.scrollHeight);T.doc.height(t)}T.lazyResize(30),T.css(n(T.iframe.body),e),N.isios&&T.haswrapper&&T.css(n(o.body),{"-webkit-transform":"translate3d(0,0,0)"}),"contentWindow"in this?T.bind(this.contentWindow,"scroll",T.onscroll):T.bind(o,"scroll",T.onscroll),M.enablemousewheel&&T.mousewheel(o,T.onmousewheel),M.enablekeyboard&&T.bind(o,N.isopera?"keypress":"keydown",T.onkeypress),N.cantouch?(T.bind(o,"touchstart",T.ontouchstart),T.bind(o,"touchmove",T.ontouchmove)):M.emulatetouch&&(T.bind(o,"mousedown",T.ontouchstart),T.bind(o,"mousemove",function(e){return T.ontouchmove(e,!0)}),M.grabcursorenabled&&N.cursorgrabvalue&&T.css(n(o.body),{cursor:N.cursorgrabvalue})),T.bind(o,"mouseup",T.ontouchend),T.zoom&&(M.dblclickzoom&&T.bind(o,"dblclick",T.doZoom),T.ongesturezoom&&T.bind(o,"gestureend",T.ongesturezoom))};this.doc[0].readyState&&"complete"===this.doc[0].readyState&&setTimeout(function(){_.call(T.doc[0],!1)},500),T.bind(this.doc,"load",_)}},this.showCursor=function(e,o){if(T.cursortimeout&&(clearTimeout(T.cursortimeout),T.cursortimeout=0),T.rail){if(T.autohidedom&&(T.autohidedom.stop().css({opacity:M.cursoropacitymax}),T.cursoractive=!0),T.rail.drag&&1==T.rail.drag.pt||(void 0!==e&&!1!==e&&(T.scroll.y=e/T.scrollratio.y|0),void 0!==o&&(T.scroll.x=o/T.scrollratio.x|0)),T.cursor.css({height:T.cursorheight,top:T.scroll.y}),T.cursorh){var t=T.hasreversehr?T.scrollvaluemaxw-T.scroll.x:T.scroll.x;T.cursorh.css({width:T.cursorwidth,left:!T.rail.align&&T.rail.visibility?t+T.rail.width:t}),T.cursoractive=!0}T.zoom&&T.zoom.stop().css({opacity:M.cursoropacitymax})}},this.hideCursor=function(e){T.cursortimeout||T.rail&&T.autohidedom&&(T.hasmousefocus&&"leave"===M.autohidemode||(T.cursortimeout=setTimeout(function(){T.rail.active&&T.showonmouseevent||(T.autohidedom.stop().animate({opacity:M.cursoropacitymin}),T.zoom&&T.zoom.stop().animate({opacity:M.cursoropacitymin}),T.cursoractive=!1),T.cursortimeout=0},e||M.hidecursordelay)))},this.noticeCursor=function(e,o,t){T.showCursor(o,t),T.rail.active||T.hideCursor(e)},this.getContentSize=T.ispage?function(){return{w:Math.max(l.body.scrollWidth,l.documentElement.scrollWidth),h:Math.max(l.body.scrollHeight,l.documentElement.scrollHeight)}}:T.haswrapper?function(){return{w:T.doc[0].offsetWidth,h:T.doc[0].offsetHeight}}:function(){return{w:T.docscroll[0].scrollWidth,h:T.docscroll[0].scrollHeight}},this.onResize=function(e,o){if(!T||!T.win)return!1;var t=T.page.maxh,r=T.page.maxw,i=T.view.h,s=T.view.w;if(T.view={w:T.ispage?T.win.width():T.win[0].clientWidth,h:T.ispage?T.win.height():T.win[0].clientHeight},T.page=o||T.getContentSize(),T.page.maxh=Math.max(0,T.page.h-T.view.h),T.page.maxw=Math.max(0,T.page.w-T.view.w),T.page.maxh==t&&T.page.maxw==r&&T.view.w==s&&T.view.h==i){if(T.ispage)return T;var n=T.win.offset();if(T.lastposition){var l=T.lastposition;if(l.top==n.top&&l.left==n.left)return T}T.lastposition=n}return 0===T.page.maxh?(T.hideRail(),T.scrollvaluemax=0,T.scroll.y=0,T.scrollratio.y=0,T.cursorheight=0,T.setScrollTop(0),T.rail&&(T.rail.scrollable=!1)):(T.page.maxh-=M.railpadding.top+M.railpadding.bottom,T.rail.scrollable=!0),0===T.page.maxw?(T.hideRailHr(),T.scrollvaluemaxw=0,T.scroll.x=0,T.scrollratio.x=0,T.cursorwidth=0,T.setScrollLeft(0),T.railh&&(T.railh.scrollable=!1)):(T.page.maxw-=M.railpadding.left+M.railpadding.right,T.railh&&(T.railh.scrollable=M.horizrailenabled)),T.railslocked=T.locked||0===T.page.maxh&&0===T.page.maxw,T.railslocked?(T.ispage||T.updateScrollBar(T.view),!1):(T.hidden||(T.rail.visibility||T.showRail(),T.railh&&!T.railh.visibility&&T.showRailHr()),T.istextarea&&T.win.css("resize")&&"none"!=T.win.css("resize")&&(T.view.h-=20),T.cursorheight=Math.min(T.view.h,Math.round(T.view.h*(T.view.h/T.page.h))),T.cursorheight=M.cursorfixedheight?M.cursorfixedheight:Math.max(M.cursorminheight,T.cursorheight),T.cursorwidth=Math.min(T.view.w,Math.round(T.view.w*(T.view.w/T.page.w))),T.cursorwidth=M.cursorfixedheight?M.cursorfixedheight:Math.max(M.cursorminheight,T.cursorwidth),T.scrollvaluemax=T.view.h-T.cursorheight-(M.railpadding.top+M.railpadding.bottom),T.hasborderbox||(T.scrollvaluemax-=T.cursor[0].offsetHeight-T.cursor[0].clientHeight),T.railh&&(T.railh.width=T.page.maxh>0?T.view.w-T.rail.width:T.view.w,T.scrollvaluemaxw=T.railh.width-T.cursorwidth-(M.railpadding.left+M.railpadding.right)),T.ispage||T.updateScrollBar(T.view),T.scrollratio={x:T.page.maxw/T.scrollvaluemaxw,y:T.page.maxh/T.scrollvaluemax},T.getScrollTop()>T.page.maxh?T.doScrollTop(T.page.maxh):(T.scroll.y=T.getScrollTop()/T.scrollratio.y|0,T.scroll.x=T.getScrollLeft()/T.scrollratio.x|0,T.cursoractive&&T.noticeCursor()),T.scroll.y&&0===T.getScrollTop()&&T.doScrollTo(T.scroll.y*T.scrollratio.y|0),T)},this.resize=T.onResize;var O=0;this.onscreenresize=function(e){clearTimeout(O);var o=!T.ispage&&!T.haswrapper;o&&T.hideRails(),O=setTimeout(function(){T&&(o&&T.showRails(),T.resize()),O=0},120)},this.lazyResize=function(e){return clearTimeout(O),O=setTimeout(function(){T&&T.resize(),O=0},e||240),T},this.jqbind=function(e,o,t){T.events.push({e:e,n:o,f:t,q:!0}),n(e).on(o,t)},this.mousewheel=function(e,o,t){var r="jquery"in e?e[0]:e;if("onwheel"in l.createElement("div"))T._bind(r,"wheel",o,t||!1);else{var i=void 0!==l.onmousewheel?"mousewheel":"DOMMouseScroll";S(r,i,o,t||!1),"DOMMouseScroll"==i&&S(r,"MozMousePixelScroll",o,t||!1)}};var Y=!1;if(N.haseventlistener){try{var H=Object.defineProperty({},"passive",{get:function(){Y=!0}});a.addEventListener("test",null,H)}catch(e){}this.stopPropagation=function(e){return!!e&&((e=e.original?e.original:e).stopPropagation(),!1)},this.cancelEvent=function(e){return e.cancelable&&e.preventDefault(),e.stopImmediatePropagation(),e.preventManipulation&&e.preventManipulation(),!1}}else Event.prototype.preventDefault=function(){this.returnValue=!1},Event.prototype.stopPropagation=function(){this.cancelBubble=!0},a.constructor.prototype.addEventListener=l.constructor.prototype.addEventListener=Element.prototype.addEventListener=function(e,o,t){this.attachEvent("on"+e,o)},a.constructor.prototype.removeEventListener=l.constructor.prototype.removeEventListener=Element.prototype.removeEventListener=function(e,o,t){this.detachEvent("on"+e,o)},this.cancelEvent=function(e){return(e=e||a.event)&&(e.cancelBubble=!0,e.cancel=!0,e.returnValue=!1),!1},this.stopPropagation=function(e){return(e=e||a.event)&&(e.cancelBubble=!0),!1};this.delegate=function(e,o,t,r,i){var s=d[o]||!1;s||(s={a:[],l:[],f:function(e){for(var o=s.l,t=!1,r=o.length-1;r>=0;r--)if(!1===(t=o[r].call(e.target,e)))return!1;return t}},T.bind(e,o,s.f,r,i),d[o]=s),T.ispage?(s.a=[T.id].concat(s.a),s.l=[t].concat(s.l)):(s.a.push(T.id),s.l.push(t))},this.undelegate=function(e,o,t,r,i){var s=d[o]||!1;if(s)for(var n=0,l=s.l.length;n0)return t;o=!!o.parentNode&&o.parentNode}return!1},this.triggerScrollStart=function(e,o,t,r,i){if(T.onscrollstart){var s={type:"scrollstart",current:{x:e,y:o},request:{x:t,y:r},end:{x:T.newscrollx,y:T.newscrolly},speed:i};T.onscrollstart.call(T,s)}},this.triggerScrollEnd=function(){if(T.onscrollend){var e=T.getScrollLeft(),o=T.getScrollTop(),t={type:"scrollend",current:{x:e,y:o},end:{x:e,y:o}};T.onscrollend.call(T,t)}};var B=0,X=0,D=0,A=1,q=!1;if(this.onmousewheel=function(e){if(T.wheelprevented||T.locked)return!1;if(T.railslocked)return T.debounced("checkunlock",T.resize,250),!1;if(T.rail.drag)return T.cancelEvent(e);if("auto"===M.oneaxismousemode&&0!==e.deltaX&&(M.oneaxismousemode=!1),M.oneaxismousemode&&0===e.deltaX&&!T.rail.scrollable)return!T.railh||!T.railh.scrollable||T.onmousewheelhr(e);var o=f(),t=!1;if(M.preservenativescrolling&&T.checkarea+600T.page.maxh&&(o=T.page.maxh+(o-T.page.maxh)/2|0),e<0?e=e/2|0:e>T.page.maxw&&(e=T.page.maxw+(e-T.page.maxw)/2|0)):(o<0?o=0:o>T.page.maxh&&(o=T.page.maxh),e<0?e=0:e>T.page.maxw&&(e=T.page.maxw)),T.scrollrunning&&e==T.newscrollx&&o==T.newscrolly)return!1;T.newscrolly=o,T.newscrollx=e;var s=T.getScrollTop(),n=T.getScrollLeft(),l={};l.x=e-n,l.y=o-s;var a=0|Math.sqrt(l.x*l.x+l.y*l.y),c=T.prepareTransition(a);T.scrollrunning||(T.scrollrunning=!0,T.triggerScrollStart(n,s,e,o,c),T.cursorupdate.start()),T.scrollendtrapped=!0,N.transitionend||(T.scrollendtrapped&&clearTimeout(T.scrollendtrapped),T.scrollendtrapped=setTimeout(T.onScrollTransitionEnd,c)),T.setScrollTop(T.newscrolly),T.setScrollLeft(T.newscrollx)},this.cancelScroll=function(){if(!T.scrollendtrapped)return!0;var e=T.getScrollTop(),o=T.getScrollLeft();return T.scrollrunning=!1,N.transitionend||clearTimeout(N.transitionend),T.scrollendtrapped=!1,T.resetTransition(),T.setScrollTop(e),T.railh&&T.setScrollLeft(o),T.timerscroll&&T.timerscroll.tm&&clearInterval(T.timerscroll.tm),T.timerscroll=!1,T.cursorfreezed=!1,T.cursorupdate.stop(),T.showCursor(e,o),T},this.onScrollTransitionEnd=function(){if(T.scrollendtrapped){var e=T.getScrollTop(),o=T.getScrollLeft();if(e<0?e=0:e>T.page.maxh&&(e=T.page.maxh),o<0?o=0:o>T.page.maxw&&(o=T.page.maxw),e!=T.newscrolly||o!=T.newscrollx)return T.doScrollPos(o,e,M.snapbackspeed);T.scrollrunning&&T.triggerScrollEnd(),T.scrollrunning=!1,T.scrollendtrapped=!1,T.resetTransition(),T.timerscroll=!1,T.setScrollTop(e),T.railh&&T.setScrollLeft(o),T.cursorupdate.stop(),T.noticeCursor(!1,e,o),T.cursorfreezed=!1}}}else this.doScrollLeft=function(e,o){var t=T.scrollrunning?T.newscrolly:T.getScrollTop();T.doScrollPos(e,t,o)},this.doScrollTop=function(e,o){var t=T.scrollrunning?T.newscrollx:T.getScrollLeft();T.doScrollPos(t,e,o)},this.doScrollPos=function(e,o,t){var r=T.getScrollTop(),i=T.getScrollLeft();((T.newscrolly-r)*(o-r)<0||(T.newscrollx-i)*(e-i)<0)&&T.cancelScroll();var s=!1;if(T.bouncescroll&&T.rail.visibility||(o<0?(o=0,s=!0):o>T.page.maxh&&(o=T.page.maxh,s=!0)),T.bouncescroll&&T.railh.visibility||(e<0?(e=0,s=!0):e>T.page.maxw&&(e=T.page.maxw,s=!0)),T.scrollrunning&&T.newscrolly===o&&T.newscrollx===e)return!0;T.newscrolly=o,T.newscrollx=e,T.dst={},T.dst.x=e-i,T.dst.y=o-r,T.dst.px=i,T.dst.py=r;var n=0|Math.sqrt(T.dst.x*T.dst.x+T.dst.y*T.dst.y),l=T.getTransitionSpeed(n);T.bzscroll={};var a=s?1:.58;T.bzscroll.x=new R(i,T.newscrollx,l,0,0,a,1),T.bzscroll.y=new R(r,T.newscrolly,l,0,0,a,1);f();var c=function(){if(T.scrollrunning){var e=T.bzscroll.y.getPos();T.setScrollLeft(T.bzscroll.x.getNow()),T.setScrollTop(T.bzscroll.y.getNow()),e<=1?T.timer=u(c):(T.scrollrunning=!1,T.timer=0,T.triggerScrollEnd())}};T.scrollrunning||(T.triggerScrollStart(i,r,e,o,l),T.scrollrunning=!0,T.timer=u(c))},this.cancelScroll=function(){return T.timer&&h(T.timer),T.timer=0,T.bzscroll=!1,T.scrollrunning=!1,T};else this.doScrollLeft=function(e,o){var t=T.getScrollTop();T.doScrollPos(e,t,o)},this.doScrollTop=function(e,o){var t=T.getScrollLeft();T.doScrollPos(t,e,o)},this.doScrollPos=function(e,o,t){var r=e>T.page.maxw?T.page.maxw:e;r<0&&(r=0);var i=o>T.page.maxh?T.page.maxh:o;i<0&&(i=0),T.synched("scroll",function(){T.setScrollTop(i),T.setScrollLeft(r)})},this.cancelScroll=function(){};this.doScrollBy=function(e,o){z(0,e)},this.doScrollLeftBy=function(e,o){z(e,0)},this.doScrollTo=function(e,o){var t=o?Math.round(e*T.scrollratio.y):e;t<0?t=0:t>T.page.maxh&&(t=T.page.maxh),T.cursorfreezed=!1,T.doScrollTop(e)},this.checkContentSize=function(){var e=T.getContentSize();e.h==T.page.h&&e.w==T.page.w||T.resize(!1,e)},T.onscroll=function(e){T.rail.drag||T.cursorfreezed||T.synched("scroll",function(){T.scroll.y=Math.round(T.getScrollTop()/T.scrollratio.y),T.railh&&(T.scroll.x=Math.round(T.getScrollLeft()/T.scrollratio.x)),T.noticeCursor()})},T.bind(T.docscroll,"scroll",T.onscroll),this.doZoomIn=function(e){if(!T.zoomactive){T.zoomactive=!0,T.zoomrestore={style:{}};var o=["position","top","left","zIndex","backgroundColor","marginTop","marginBottom","marginLeft","marginRight"],t=T.win[0].style;for(var r in o){var i=o[r];T.zoomrestore.style[i]=void 0!==t[i]?t[i]:""}T.zoomrestore.style.width=T.win.css("width"),T.zoomrestore.style.height=T.win.css("height"),T.zoomrestore.padding={w:T.win.outerWidth()-T.win.width(),h:T.win.outerHeight()-T.win.height()},N.isios4&&(T.zoomrestore.scrollTop=c.scrollTop(),c.scrollTop(0)),T.win.css({position:N.isios4?"absolute":"fixed",top:0,left:0,zIndex:s+100,margin:0});var n=T.win.css("backgroundColor");return(""===n||/transparent|rgba\(0, 0, 0, 0\)|rgba\(0,0,0,0\)/.test(n))&&T.win.css("backgroundColor","#fff"),T.rail.css({zIndex:s+101}),T.zoom.css({zIndex:s+102}),T.zoom.css("backgroundPosition","0 -18px"),T.resizeZoom(),T.onzoomin&&T.onzoomin.call(T),T.cancelEvent(e)}},this.doZoomOut=function(e){if(T.zoomactive)return T.zoomactive=!1,T.win.css("margin",""),T.win.css(T.zoomrestore.style),N.isios4&&c.scrollTop(T.zoomrestore.scrollTop),T.rail.css({"z-index":T.zindex}),T.zoom.css({"z-index":T.zindex}),T.zoomrestore=!1,T.zoom.css("backgroundPosition","0 0"),T.onResize(),T.onzoomout&&T.onzoomout.call(T),T.cancelEvent(e)},this.doZoom=function(e){return T.zoomactive?T.doZoomOut(e):T.doZoomIn(e)},this.resizeZoom=function(){if(T.zoomactive){var e=T.getScrollTop();T.win.css({width:c.width()-T.zoomrestore.padding.w+"px",height:c.height()-T.zoomrestore.padding.h+"px"}),T.onResize(),T.setScrollTop(Math.min(T.page.maxh,e))}},this.init(),n.nicescroll.push(this)},y=function(e){var o=this;this.nc=e,this.lastx=0,this.lasty=0,this.speedx=0,this.speedy=0,this.lasttime=0,this.steptime=0,this.snapx=!1,this.snapy=!1,this.demulx=0,this.demuly=0,this.lastscrollx=-1,this.lastscrolly=-1,this.chkx=0,this.chky=0,this.timer=0,this.reset=function(e,t){o.stop(),o.steptime=0,o.lasttime=f(),o.speedx=0,o.speedy=0,o.lastx=e,o.lasty=t,o.lastscrollx=-1,o.lastscrolly=-1},this.update=function(e,t){var r=f();o.steptime=r-o.lasttime,o.lasttime=r;var i=t-o.lasty,s=e-o.lastx,n=o.nc.getScrollTop()+i,l=o.nc.getScrollLeft()+s;o.snapx=l<0||l>o.nc.page.maxw,o.snapy=n<0||n>o.nc.page.maxh,o.speedx=s,o.speedy=i,o.lastx=e,o.lasty=t},this.stop=function(){o.nc.unsynched("domomentum2d"),o.timer&&clearTimeout(o.timer),o.timer=0,o.lastscrollx=-1,o.lastscrolly=-1},this.doSnapy=function(e,t){var r=!1;t<0?(t=0,r=!0):t>o.nc.page.maxh&&(t=o.nc.page.maxh,r=!0),e<0?(e=0,r=!0):e>o.nc.page.maxw&&(e=o.nc.page.maxw,r=!0),r?o.nc.doScrollPos(e,t,o.nc.opt.snapbackspeed):o.nc.triggerScrollEnd()},this.doMomentum=function(e){var t=f(),r=e?t+e:o.lasttime,i=o.nc.getScrollLeft(),s=o.nc.getScrollTop(),n=o.nc.page.maxh,l=o.nc.page.maxw;o.speedx=l>0?Math.min(60,o.speedx):0,o.speedy=n>0?Math.min(60,o.speedy):0;var a=r&&t-r<=60;(s<0||s>n||i<0||i>l)&&(a=!1);var c=!(!o.speedy||!a)&&o.speedy,d=!(!o.speedx||!a)&&o.speedx;if(c||d){var u=Math.max(16,o.steptime);if(u>50){var h=u/50;o.speedx*=h,o.speedy*=h,u=50}o.demulxy=0,o.lastscrollx=o.nc.getScrollLeft(),o.chkx=o.lastscrollx,o.lastscrolly=o.nc.getScrollTop(),o.chky=o.lastscrolly;var p=o.lastscrollx,m=o.lastscrolly,g=function(){var e=f()-t>600?.04:.02;o.speedx&&(p=Math.floor(o.lastscrollx-o.speedx*(1-o.demulxy)),o.lastscrollx=p,(p<0||p>l)&&(e=.1)),o.speedy&&(m=Math.floor(o.lastscrolly-o.speedy*(1-o.demulxy)),o.lastscrolly=m,(m<0||m>n)&&(e=.1)),o.demulxy=Math.min(1,o.demulxy+e),o.nc.synched("domomentum2d",function(){if(o.speedx){o.nc.getScrollLeft();o.chkx=p,o.nc.setScrollLeft(p)}if(o.speedy){o.nc.getScrollTop();o.chky=m,o.nc.setScrollTop(m)}o.timer||(o.nc.hideCursor(),o.doSnapy(p,m))}),o.demulxy<1?o.timer=setTimeout(g,u):(o.stop(),o.nc.hideCursor(),o.doSnapy(p,m))};g()}else o.doSnapy(o.nc.getScrollLeft(),o.nc.getScrollTop())}},x=e.fn.scrollTop;e.cssHooks.pageYOffset={get:function(e,o,t){var r=n.data(e,"__nicescroll")||!1;return r&&r.ishwscroll?r.getScrollTop():x.call(e)},set:function(e,o){var t=n.data(e,"__nicescroll")||!1;return t&&t.ishwscroll?t.setScrollTop(parseInt(o)):x.call(e,o),this}},e.fn.scrollTop=function(e){if(void 0===e){var o=!!this[0]&&(n.data(this[0],"__nicescroll")||!1);return o&&o.ishwscroll?o.getScrollTop():x.call(this)}return this.each(function(){var o=n.data(this,"__nicescroll")||!1;o&&o.ishwscroll?o.setScrollTop(parseInt(e)):x.call(n(this),e)})};var S=e.fn.scrollLeft;n.cssHooks.pageXOffset={get:function(e,o,t){var r=n.data(e,"__nicescroll")||!1;return r&&r.ishwscroll?r.getScrollLeft():S.call(e)},set:function(e,o){var t=n.data(e,"__nicescroll")||!1;return t&&t.ishwscroll?t.setScrollLeft(parseInt(o)):S.call(e,o),this}},e.fn.scrollLeft=function(e){if(void 0===e){var o=!!this[0]&&(n.data(this[0],"__nicescroll")||!1);return o&&o.ishwscroll?o.getScrollLeft():S.call(this)}return this.each(function(){var o=n.data(this,"__nicescroll")||!1;o&&o.ishwscroll?o.setScrollLeft(parseInt(e)):S.call(n(this),e)})};var z=function(e){var o=this;if(this.length=0,this.name="nicescrollarray",this.each=function(e){return n.each(o,e),o},this.push=function(e){o[o.length]=e,o.length++},this.eq=function(e){return o[e]},e)for(var t=0;t1?n(e,r):s,i.win=r}!("doc"in i)||"win"in i||(i.win=r);var l=r.data("__nicescroll")||!1;l||(i.doc=i.doc||r,l=new b(i,r),r.data("__nicescroll",l)),t.push(l)}),1===t.length?t[0]:t},a.NiceScroll={getjQuery:function(){return e}},n.nicescroll||(n.nicescroll=new z,n.nicescroll.options=g)}); \ No newline at end of file +/* jquery.nicescroll v 3.7.5-d [DEV] - InuYaksa*2017 - MIT - https://nicescroll.areaaperta.com/ */ +!function(e){"function"==typeof define&&define.amd?define(["jquery"],e):"object"==typeof exports?module.exports=e(require("jquery")):e(jQuery)}(function(e){"use strict";var o=!1,t=!1,r=0,i=2e3,s=0,n=e,l=document,a=window,c=n(a),d=[],u=a.requestAnimationFrame||a.webkitRequestAnimationFrame||a.mozRequestAnimationFrame||!1,h=a.cancelAnimationFrame||a.webkitCancelAnimationFrame||a.mozCancelAnimationFrame||!1;if(u)a.cancelAnimationFrame||(h=function(e){});else{var p=0;u=function(e,o){var t=(new Date).getTime(),r=Math.max(0,16-(t-p)),i=a.setTimeout(function(){e(t+r)},r);return p=t+r,i},h=function(e){a.clearTimeout(e)}}var m=a.MutationObserver||a.WebKitMutationObserver||!1,f=Date.now||function(){return(new Date).getTime()},g={zindex:"auto",cursoropacitymin:0,cursoropacitymax:1,cursorcolor:"#424242",cursorwidth:"6px",cursorborder:"1px solid #fff",cursorborderradius:"5px",scrollspeed:40,mousescrollstep:27,touchbehavior:!1,emulatetouch:!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 e=l.currentScript||function(){var e=l.getElementsByTagName("script");return!!e.length&&e[e.length-1]}(),o=e?e.src.split("?")[0]:"";return o.split("/").length>0?o.split("/").slice(0,-1).join("/")+"/":""}(),preventmultitouchscrolling:!0,disablemutationobserver:!1,enableobserver:!0,scrollbarid:!1},v=!1,w=function(){if(v)return v;var e=l.createElement("DIV"),o=e.style,t=navigator.userAgent,r=navigator.platform,i={};return i.haspointerlock="pointerLockElement"in l||"webkitPointerLockElement"in l||"mozPointerLockElement"in l,i.isopera="opera"in a,i.isopera12=i.isopera&&"getUserMedia"in navigator,i.isoperamini="[object OperaMini]"===Object.prototype.toString.call(a.operamini),i.isie="all"in l&&"attachEvent"in e&&!i.isopera,i.isieold=i.isie&&!("msInterpolationMode"in o),i.isie7=i.isie&&!i.isieold&&(!("documentMode"in l)||7===l.documentMode),i.isie8=i.isie&&"documentMode"in l&&8===l.documentMode,i.isie9=i.isie&&"performance"in a&&9===l.documentMode,i.isie10=i.isie&&"performance"in a&&10===l.documentMode,i.isie11="msRequestFullscreen"in e&&l.documentMode>=11,i.ismsedge="msCredentials"in a,i.ismozilla="MozAppearance"in o,i.iswebkit=!i.ismsedge&&"WebkitAppearance"in o,i.ischrome=i.iswebkit&&"chrome"in a,i.ischrome38=i.ischrome&&"touchAction"in o,i.ischrome22=!i.ischrome38&&i.ischrome&&i.haspointerlock,i.ischrome26=!i.ischrome38&&i.ischrome&&"transition"in o,i.cantouch="ontouchstart"in l.documentElement||"ontouchstart"in a,i.hasw3ctouch=(a.PointerEvent||!1)&&(navigator.maxTouchPoints>0||navigator.msMaxTouchPoints>0),i.hasmstouch=!i.hasw3ctouch&&(a.MSPointerEvent||!1),i.ismac=/^mac$/i.test(r),i.isios=i.cantouch&&/iphone|ipad|ipod/i.test(r),i.isios4=i.isios&&!("seal"in Object),i.isios7=i.isios&&"webkitHidden"in l,i.isios8=i.isios&&"hidden"in l,i.isios10=i.isios&&a.Proxy,i.isandroid=/android/i.test(t),i.haseventlistener="addEventListener"in e,i.trstyle=!1,i.hastransform=!1,i.hastranslate3d=!1,i.transitionstyle=!1,i.hastransition=!1,i.transitionend=!1,i.trstyle="transform",i.hastransform="transform"in o||function(){for(var e=["msTransform","webkitTransform","MozTransform","OTransform"],t=0,r=e.length;t0;){if(9==e[0].nodeType)return!1;var o=e.css("zIndex");if(!isNaN(o)&&0!==o)return parseInt(o);e=e.parent()}return!1}function x(e,o,t){var r=e.css(o),i=parseFloat(r);if(isNaN(i)){var s=3==(i=I[r]||0)?t?T.win.outerHeight()-T.win.innerHeight():T.win.outerWidth()-T.win.innerWidth():1;return T.isie8&&i&&(i+=1),s?i:0}return i}function S(e,o,t,r){T._bind(e,o,function(r){var i={original:r=r||a.event,target:r.target||r.srcElement,type:"wheel",deltaMode:"MozMousePixelScroll"==r.type?0:1,deltaX:0,deltaZ:0,preventDefault:function(){return r.preventDefault?r.preventDefault():r.returnValue=!1,!1},stopImmediatePropagation:function(){r.stopImmediatePropagation?r.stopImmediatePropagation():r.cancelBubble=!0}};return"mousewheel"==o?(r.wheelDeltaX&&(i.deltaX=-.025*r.wheelDeltaX),r.wheelDeltaY&&(i.deltaY=-.025*r.wheelDeltaY),!i.deltaY&&!i.deltaX&&(i.deltaY=-.025*r.wheelDelta)):i.deltaY=r.detail,t.call(e,i)},r)}function z(e,o,t,r){T.scrollrunning||(T.newscrolly=T.getScrollTop(),T.newscrollx=T.getScrollLeft(),D=f());var i=f()-D;if(D=f(),i>350?A=1:A+=(2-A)/10,e=e*A|0,o=o*A|0,e){if(r)if(e<0){if(T.getScrollLeft()>=T.page.maxw)return!0}else if(T.getScrollLeft()<=0)return!0;var s=e>0?1:-1;X!==s&&(T.scrollmom&&T.scrollmom.stop(),T.newscrollx=T.getScrollLeft(),X=s),T.lastdeltax-=e}if(o){if(function(){var e=T.getScrollTop();if(o<0){if(e>=T.page.maxh)return!0}else if(e<=0)return!0}()){if(M.nativeparentscrolling&&t&&!T.ispage&&!T.zoomactive)return!0;var n=T.view.h>>1;T.newscrolly<-n?(T.newscrolly=-n,o=-1):T.newscrolly>T.page.maxh+n?(T.newscrolly=T.page.maxh+n,o=1):o=0}var l=o>0?1:-1;B!==l&&(T.scrollmom&&T.scrollmom.stop(),T.newscrolly=T.getScrollTop(),B=l),T.lastdeltay-=o}(o||e)&&T.synched("relativexy",function(){var e=T.lastdeltay+T.newscrolly;T.lastdeltay=0;var o=T.lastdeltax+T.newscrollx;T.lastdeltax=0,T.rail.drag||T.doScrollPos(o,e)})}function k(e,o,t){var r,i;return!(t||!q)||(0===e.deltaMode?(r=-e.deltaX*(M.mousescrollstep/54)|0,i=-e.deltaY*(M.mousescrollstep/54)|0):1===e.deltaMode&&(r=-e.deltaX*M.mousescrollstep*50/80|0,i=-e.deltaY*M.mousescrollstep*50/80|0),o&&M.oneaxismousemode&&0===r&&i&&(r=i,i=0,t&&(r<0?T.getScrollLeft()>=T.page.maxw:T.getScrollLeft()<=0)&&(i=r,r=0)),T.isrtlmode&&(r=-r),z(r,i,t,!0)?void(t&&(q=!0)):(q=!1,e.stopImmediatePropagation(),e.preventDefault()))}var T=this;this.version="3.7.5-d",this.name="nicescroll",this.me=p;var E=n("body"),M=this.opt={doc:E,win:!1};if(n.extend(M,g),M.snapbackspeed=80,e)for(var L in M)void 0!==e[L]&&(M[L]=e[L]);if(M.disablemutationobserver&&(m=!1),this.doc=M.doc,this.iddoc=this.doc&&this.doc[0]?this.doc[0].id||"":"",this.ispage=/^BODY|HTML/.test(M.win?M.win[0].nodeName:this.doc[0].nodeName),this.haswrapper=!1!==M.win,this.win=M.win||(this.ispage?c:this.doc),this.docscroll=this.ispage&&!this.haswrapper?c:this.win,this.body=E,this.viewport=!1,this.isfixed=!1,this.iframe=!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"!=M.autohidemode,this.onmousedown=!1,this.onmouseup=!1,this.onmousemove=!1,this.onmousewheel=!1,this.onkeypress=!1,this.ongesturezoom=!1,this.onclick=!1,this.onscrollstart=!1,this.onscrollend=!1,this.onscrollcancel=!1,this.onzoomin=!1,this.onzoomout=!1,this.view=!1,this.page=!1,this.scroll={x:0,y:0},this.scrollratio={x:0,y:0},this.cursorheight=20,this.scrollvaluemax=0,"auto"==M.rtlmode){var C=this.win[0]==a?this.body:this.win,N=C.css("writing-mode")||C.css("-webkit-writing-mode")||C.css("-ms-writing-mode")||C.css("-moz-writing-mode");"horizontal-tb"==N||"lr-tb"==N||""===N?(this.isrtlmode="rtl"==C.css("direction"),this.isvertical=!1):(this.isrtlmode="vertical-rl"==N||"tb"==N||"tb-rl"==N||"rl-tb"==N,this.isvertical="vertical-rl"==N||"tb"==N||"tb-rl"==N)}else this.isrtlmode=!0===M.rtlmode,this.isvertical=!1;if(this.scrollrunning=!1,this.scrollmom=!1,this.observer=!1,this.observerremover=!1,this.observerbody=!1,!1!==M.scrollbarid)this.id=M.scrollbarid;else do{this.id="ascrail"+i++}while(l.getElementById(this.id));this.rail=!1,this.cursor=!1,this.cursorfreezed=!1,this.selectiondrag=!1,this.zoom=!1,this.zoomactive=!1,this.hasfocus=!1,this.hasmousefocus=!1,this.railslocked=!1,this.locked=!1,this.hidden=!1,this.cursoractive=!0,this.wheelprevented=!1,this.overflowx=M.overflowx,this.overflowy=M.overflowy,this.nativescrollingarea=!1,this.checkarea=0,this.events=[],this.saved={},this.delaylist={},this.synclist={},this.lastdeltax=0,this.lastdeltay=0,this.detected=w();var P=n.extend({},this.detected);this.canhwscroll=P.hastransform&&M.hwacceleration,this.ishwscroll=this.canhwscroll&&T.haswrapper,this.isrtlmode?this.isvertical?this.hasreversehr=!(P.iswebkit||P.isie||P.isie11):this.hasreversehr=!(P.iswebkit||P.isie&&!P.isie10&&!P.isie11):this.hasreversehr=!1,this.istouchcapable=!1,P.cantouch||!P.hasw3ctouch&&!P.hasmstouch?!P.cantouch||P.isios||P.isandroid||!P.iswebkit&&!P.ismozilla||(this.istouchcapable=!0):this.istouchcapable=!0,M.enablemouselockapi||(P.hasmousecapture=!1,P.haspointerlock=!1),this.debounced=function(e,o,t){T&&(T.delaylist[e]||!1||(T.delaylist[e]={h:u(function(){T.delaylist[e].fn.call(T),T.delaylist[e]=!1},t)},o.call(T)),T.delaylist[e].fn=o)},this.synched=function(e,o){T.synclist[e]?T.synclist[e]=o:(T.synclist[e]=o,u(function(){T&&(T.synclist[e]&&T.synclist[e].call(T),T.synclist[e]=null)}))},this.unsynched=function(e){T.synclist[e]&&(T.synclist[e]=!1)},this.css=function(e,o){for(var t in o)T.saved.css.push([e,t,e.css(t)]),e.css(t,o[t])},this.scrollTop=function(e){return void 0===e?T.getScrollTop():T.setScrollTop(e)},this.scrollLeft=function(e){return void 0===e?T.getScrollLeft():T.setScrollLeft(e)};var R=function(e,o,t,r,i,s,n){this.st=e,this.ed=o,this.spd=t,this.p1=r||0,this.p2=i||1,this.p3=s||0,this.p4=n||1,this.ts=f(),this.df=o-e};if(R.prototype={B2:function(e){return 3*(1-e)*(1-e)*e},B3:function(e){return 3*(1-e)*e*e},B4:function(e){return e*e*e},getPos:function(){return(f()-this.ts)/this.spd},getNow:function(){var e=(f()-this.ts)/this.spd,o=this.B2(e)+this.B3(e)+this.B4(e);return e>=1?this.ed:this.st+this.df*o|0},update:function(e,o){return this.st=this.getNow(),this.ed=e,this.spd=o,this.ts=f(),this.df=this.ed-this.st,this}},this.ishwscroll){this.doc.translate={x:0,y:0,tx:"0px",ty:"0px"},P.hastranslate3d&&P.isios&&this.doc.css("-webkit-backface-visibility","hidden"),this.getScrollTop=function(e){if(!e){var o=v();if(o)return 16==o.length?-o[13]:-o[5];if(T.timerscroll&&T.timerscroll.bz)return T.timerscroll.bz.getNow()}return T.doc.translate.y},this.getScrollLeft=function(e){if(!e){var o=v();if(o)return 16==o.length?-o[12]:-o[4];if(T.timerscroll&&T.timerscroll.bh)return T.timerscroll.bh.getNow()}return T.doc.translate.x},this.notifyScrollEvent=function(e){var o=l.createEvent("UIEvents");o.initUIEvent("scroll",!1,!1,a,1),o.niceevent=!0,e.dispatchEvent(o)};var _=this.isrtlmode?1:-1;P.hastranslate3d&&M.enabletranslate3d?(this.setScrollTop=function(e,o){T.doc.translate.y=e,T.doc.translate.ty=-1*e+"px",T.doc.css(P.trstyle,"translate3d("+T.doc.translate.tx+","+T.doc.translate.ty+",0)"),o||T.notifyScrollEvent(T.win[0])},this.setScrollLeft=function(e,o){T.doc.translate.x=e,T.doc.translate.tx=e*_+"px",T.doc.css(P.trstyle,"translate3d("+T.doc.translate.tx+","+T.doc.translate.ty+",0)"),o||T.notifyScrollEvent(T.win[0])}):(this.setScrollTop=function(e,o){T.doc.translate.y=e,T.doc.translate.ty=-1*e+"px",T.doc.css(P.trstyle,"translate("+T.doc.translate.tx+","+T.doc.translate.ty+")"),o||T.notifyScrollEvent(T.win[0])},this.setScrollLeft=function(e,o){T.doc.translate.x=e,T.doc.translate.tx=e*_+"px",T.doc.css(P.trstyle,"translate("+T.doc.translate.tx+","+T.doc.translate.ty+")"),o||T.notifyScrollEvent(T.win[0])})}else this.getScrollTop=function(){return T.docscroll.scrollTop()},this.setScrollTop=function(e){T.docscroll.scrollTop(e)},this.getScrollLeft=function(){return T.hasreversehr?T.detected.ismozilla?T.page.maxw-Math.abs(T.docscroll.scrollLeft()):T.page.maxw-T.docscroll.scrollLeft():T.docscroll.scrollLeft()},this.setScrollLeft=function(e){return setTimeout(function(){if(T)return T.hasreversehr&&(e=T.detected.ismozilla?-(T.page.maxw-e):T.page.maxw-e),T.docscroll.scrollLeft(e)},1)};this.getTarget=function(e){return!!e&&(e.target?e.target:!!e.srcElement&&e.srcElement)},this.hasParent=function(e,o){if(!e)return!1;for(var t=e.target||e.srcElement||e||!1;t&&t.id!=o;)t=t.parentNode||!1;return!1!==t};var I={thin:1,medium:3,thick:5};this.getDocumentScrollOffset=function(){return{top:a.pageYOffset||l.documentElement.scrollTop,left:a.pageXOffset||l.documentElement.scrollLeft}},this.getOffset=function(){if(T.isfixed){var e=T.win.offset(),o=T.getDocumentScrollOffset();return e.top-=o.top,e.left-=o.left,e}var t=T.win.offset();if(!T.viewport)return t;var r=T.viewport.offset();return{top:t.top-r.top,left:t.left-r.left}},this.updateScrollBar=function(e){var o,t;if(T.ishwscroll)T.rail.css({height:T.win.innerHeight()-(M.railpadding.top+M.railpadding.bottom)}),T.railh&&T.railh.css({width:T.win.innerWidth()-(M.railpadding.left+M.railpadding.right)});else{var r=T.getOffset();if(o={top:r.top,left:r.left-(M.railpadding.left+M.railpadding.right)},o.top+=x(T.win,"border-top-width",!0),o.left+=T.rail.align?T.win.outerWidth()-x(T.win,"border-right-width")-T.rail.width:x(T.win,"border-left-width"),(t=M.railoffset)&&(t.top&&(o.top+=t.top),t.left&&(o.left+=t.left)),T.railslocked||T.rail.css({top:o.top,left:o.left,height:(e?e.h:T.win.innerHeight())-(M.railpadding.top+M.railpadding.bottom)}),T.zoom&&T.zoom.css({top:o.top+1,left:1==T.rail.align?o.left-20:o.left+T.rail.width+4}),T.railh&&!T.railslocked){o={top:r.top,left:r.left},(t=M.railhoffset)&&(t.top&&(o.top+=t.top),t.left&&(o.left+=t.left));var i=T.railh.align?o.top+x(T.win,"border-top-width",!0)+T.win.innerHeight()-T.railh.height:o.top+x(T.win,"border-top-width",!0),s=o.left+x(T.win,"border-left-width");T.railh.css({top:i-(M.railpadding.top+M.railpadding.bottom),left:s,width:T.railh.width})}}},this.doRailClick=function(e,o,t){var r,i,s,n;T.railslocked||(T.cancelEvent(e),"pageY"in e||(e.pageX=e.clientX+l.documentElement.scrollLeft,e.pageY=e.clientY+l.documentElement.scrollTop),o?(r=t?T.doScrollLeft:T.doScrollTop,s=t?(e.pageX-T.railh.offset().left-T.cursorwidth/2)*T.scrollratio.x:(e.pageY-T.rail.offset().top-T.cursorheight/2)*T.scrollratio.y,T.unsynched("relativexy"),r(0|s)):(r=t?T.doScrollLeftBy:T.doScrollBy,s=t?T.scroll.x:T.scroll.y,n=t?e.pageX-T.railh.offset().left:e.pageY-T.rail.offset().top,i=t?T.view.w:T.view.h,r(s>=n?i:-i)))},T.newscrolly=T.newscrollx=0,T.hasanimationframe="requestAnimationFrame"in a,T.hascancelanimationframe="cancelAnimationFrame"in a,T.hasborderbox=!1,this.init=function(){if(T.saved.css=[],P.isoperamini)return!0;if(P.isandroid&&!("hidden"in l))return!0;M.emulatetouch=M.emulatetouch||M.touchbehavior,T.hasborderbox=a.getComputedStyle&&"border-box"===a.getComputedStyle(l.body)["box-sizing"];var e={"overflow-y":"hidden"};if((P.isie11||P.isie10)&&(e["-ms-overflow-style"]="none"),T.ishwscroll&&(this.doc.css(P.transitionstyle,P.prefixstyle+"transform 0ms ease-out"),P.transitionend&&T.bind(T.doc,P.transitionend,T.onScrollTransitionEnd,!1)),T.zindex="auto",T.ispage||"auto"!=M.zindex?T.zindex=M.zindex:T.zindex=b()||"auto",!T.ispage&&"auto"!=T.zindex&&T.zindex>s&&(s=T.zindex),T.isie&&0===T.zindex&&"auto"==M.zindex&&(T.zindex="auto"),!T.ispage||!P.isieold){var i=T.docscroll;T.ispage&&(i=T.haswrapper?T.win:T.doc),T.css(i,e),T.ispage&&(P.isie11||P.isie)&&T.css(n("html"),e),!P.isios||T.ispage||T.haswrapper||T.css(E,{"-webkit-overflow-scrolling":"touch"});var d=n(l.createElement("div"));d.css({position:"relative",top:0,float:"right",width:M.cursorwidth,height:0,"background-color":M.cursorcolor,border:M.cursorborder,"background-clip":"padding-box","-webkit-border-radius":M.cursorborderradius,"-moz-border-radius":M.cursorborderradius,"border-radius":M.cursorborderradius}),d.addClass("nicescroll-cursors"),T.cursor=d;var u=n(l.createElement("div"));u.attr("id",T.id),u.addClass("nicescroll-rails nicescroll-rails-vr");var h,p,f=["left","right","top","bottom"];for(var g in f)p=f[g],(h=M.railpadding[p]||0)&&u.css("padding-"+p,h+"px");u.append(d),u.width=Math.max(parseFloat(M.cursorwidth),d.outerWidth()),u.css({width:u.width+"px",zIndex:T.zindex,background:M.background,cursor:"default"}),u.visibility=!0,u.scrollable=!0,u.align="left"==M.railalign?0:1,T.rail=u,T.rail.drag=!1;var v=!1;!M.boxzoom||T.ispage||P.isieold||(v=l.createElement("div"),T.bind(v,"click",T.doZoom),T.bind(v,"mouseenter",function(){T.zoom.css("opacity",M.cursoropacitymax)}),T.bind(v,"mouseleave",function(){T.zoom.css("opacity",M.cursoropacitymin)}),T.zoom=n(v),T.zoom.css({cursor:"pointer",zIndex:T.zindex,backgroundImage:"url("+M.scriptpath+"zoomico.png)",height:18,width:18,backgroundPosition:"0 0"}),M.dblclickzoom&&T.bind(T.win,"dblclick",T.doZoom),P.cantouch&&M.gesturezoom&&(T.ongesturezoom=function(e){return e.scale>1.5&&T.doZoomIn(e),e.scale<.8&&T.doZoomOut(e),T.cancelEvent(e)},T.bind(T.win,"gestureend",T.ongesturezoom))),T.railh=!1;var w;if(M.horizrailenabled&&(T.css(i,{overflowX:"hidden"}),(d=n(l.createElement("div"))).css({position:"absolute",top:0,height:M.cursorwidth,width:0,backgroundColor:M.cursorcolor,border:M.cursorborder,backgroundClip:"padding-box","-webkit-border-radius":M.cursorborderradius,"-moz-border-radius":M.cursorborderradius,"border-radius":M.cursorborderradius}),P.isieold&&d.css("overflow","hidden"),d.addClass("nicescroll-cursors"),T.cursorh=d,(w=n(l.createElement("div"))).attr("id",T.id+"-hr"),w.addClass("nicescroll-rails nicescroll-rails-hr"),w.height=Math.max(parseFloat(M.cursorwidth),d.outerHeight()),w.css({height:w.height+"px",zIndex:T.zindex,background:M.background}),w.append(d),w.visibility=!0,w.scrollable=!0,w.align="top"==M.railvalign?0:1,T.railh=w,T.railh.drag=!1),T.ispage)u.css({position:"fixed",top:0,height:"100%"}),u.css(u.align?{right:0}:{left:0}),T.body.append(u),T.railh&&(w.css({position:"fixed",left:0,width:"100%"}),w.css(w.align?{bottom:0}:{top:0}),T.body.append(w));else{if(T.ishwscroll){"static"==T.win.css("position")&&T.css(T.win,{position:"relative"});var x="HTML"==T.win[0].nodeName?T.body:T.win;n(x).scrollTop(0).scrollLeft(0),T.zoom&&(T.zoom.css({position:"absolute",top:1,right:0,"margin-right":u.width+4}),x.append(T.zoom)),u.css({position:"absolute",top:0}),u.css(u.align?{right:0}:{left:0}),x.append(u),w&&(w.css({position:"absolute",left:0,bottom:0}),w.css(w.align?{bottom:0}:{top:0}),x.append(w))}else{T.isfixed="fixed"==T.win.css("position");var S=T.isfixed?"fixed":"absolute";T.isfixed||(T.viewport=T.getViewport(T.win[0])),T.viewport&&(T.body=T.viewport,/fixed|absolute/.test(T.viewport.css("position"))||T.css(T.viewport,{position:"relative"})),u.css({position:S}),T.zoom&&T.zoom.css({position:S}),T.updateScrollBar(),T.body.append(u),T.zoom&&T.body.append(T.zoom),T.railh&&(w.css({position:S}),T.body.append(w))}P.isios&&T.css(T.win,{"-webkit-tap-highlight-color":"rgba(0,0,0,0)","-webkit-touch-callout":"none"}),M.disableoutline&&(P.isie&&T.win.attr("hideFocus","true"),P.iswebkit&&T.win.css("outline","none"))}if(!1===M.autohidemode?(T.autohidedom=!1,T.rail.css({opacity:M.cursoropacitymax}),T.railh&&T.railh.css({opacity:M.cursoropacitymax})):!0===M.autohidemode||"leave"===M.autohidemode?(T.autohidedom=n().add(T.rail),P.isie8&&(T.autohidedom=T.autohidedom.add(T.cursor)),T.railh&&(T.autohidedom=T.autohidedom.add(T.railh)),T.railh&&P.isie8&&(T.autohidedom=T.autohidedom.add(T.cursorh))):"scroll"==M.autohidemode?(T.autohidedom=n().add(T.rail),T.railh&&(T.autohidedom=T.autohidedom.add(T.railh))):"cursor"==M.autohidemode?(T.autohidedom=n().add(T.cursor),T.railh&&(T.autohidedom=T.autohidedom.add(T.cursorh))):"hidden"==M.autohidemode&&(T.autohidedom=!1,T.hide(),T.railslocked=!1),P.cantouch||T.istouchcapable||M.emulatetouch||P.hasmstouch){T.scrollmom=new y(T);T.ontouchstart=function(e){if(T.locked)return!1;if(e.pointerType&&("mouse"===e.pointerType||e.pointerType===e.MSPOINTER_TYPE_MOUSE))return!1;if(T.hasmoving=!1,T.scrollmom.timer&&(T.triggerScrollEnd(),T.scrollmom.stop()),!T.railslocked){var o=T.getTarget(e);if(o&&/INPUT/i.test(o.nodeName)&&/range/i.test(o.type))return T.stopPropagation(e);var t="mousedown"===e.type;if(!("clientX"in e)&&"changedTouches"in e&&(e.clientX=e.changedTouches[0].clientX,e.clientY=e.changedTouches[0].clientY),T.forcescreen){var r=e;(e={original:e.original?e.original:e}).clientX=r.screenX,e.clientY=r.screenY}if(T.rail.drag={x:e.clientX,y:e.clientY,sx:T.scroll.x,sy:T.scroll.y,st:T.getScrollTop(),sl:T.getScrollLeft(),pt:2,dl:!1,tg:o},T.ispage||!M.directionlockdeadzone)T.rail.drag.dl="f";else{var i={w:c.width(),h:c.height()},s=T.getContentSize(),l=s.h-i.h,a=s.w-i.w;T.rail.scrollable&&!T.railh.scrollable?T.rail.drag.ck=l>0&&"v":!T.rail.scrollable&&T.railh.scrollable?T.rail.drag.ck=a>0&&"h":T.rail.drag.ck=!1}if(M.emulatetouch&&T.isiframe&&P.isie){var d=T.win.position();T.rail.drag.x+=d.left,T.rail.drag.y+=d.top}if(T.hasmoving=!1,T.lastmouseup=!1,T.scrollmom.reset(e.clientX,e.clientY),o&&t){if(!/INPUT|SELECT|BUTTON|TEXTAREA/i.test(o.nodeName))return P.hasmousecapture&&o.setCapture(),M.emulatetouch?(o.onclick&&!o._onclick&&(o._onclick=o.onclick,o.onclick=function(e){if(T.hasmoving)return!1;o._onclick.call(this,e)}),T.cancelEvent(e)):T.stopPropagation(e);/SUBMIT|CANCEL|BUTTON/i.test(n(o).attr("type"))&&(T.preventclick={tg:o,click:!1})}}},T.ontouchend=function(e){if(!T.rail.drag)return!0;if(2==T.rail.drag.pt){if(e.pointerType&&("mouse"===e.pointerType||e.pointerType===e.MSPOINTER_TYPE_MOUSE))return!1;T.rail.drag=!1;var o="mouseup"===e.type;if(T.hasmoving&&(T.scrollmom.doMomentum(),T.lastmouseup=!0,T.hideCursor(),P.hasmousecapture&&l.releaseCapture(),o))return T.cancelEvent(e)}else if(1==T.rail.drag.pt)return T.onmouseup(e)};var z=M.emulatetouch&&T.isiframe&&!P.hasmousecapture,k=.3*M.directionlockdeadzone|0;T.ontouchmove=function(e,o){if(!T.rail.drag)return!0;if(e.targetTouches&&M.preventmultitouchscrolling&&e.targetTouches.length>1)return!0;if(e.pointerType&&("mouse"===e.pointerType||e.pointerType===e.MSPOINTER_TYPE_MOUSE))return!0;if(2==T.rail.drag.pt){"changedTouches"in e&&(e.clientX=e.changedTouches[0].clientX,e.clientY=e.changedTouches[0].clientY);var t,r;if(r=t=0,z&&!o){var i=T.win.position();r=-i.left,t=-i.top}var s=e.clientY+t,n=s-T.rail.drag.y,a=e.clientX+r,c=a-T.rail.drag.x,d=T.rail.drag.st-n;if(T.ishwscroll&&M.bouncescroll)d<0?d=Math.round(d/2):d>T.page.maxh&&(d=T.page.maxh+Math.round((d-T.page.maxh)/2));else if(d<0?(d=0,s=0):d>T.page.maxh&&(d=T.page.maxh,s=0),0===s&&!T.hasmoving)return T.ispage||(T.rail.drag=!1),!0;var u=T.getScrollLeft();if(T.railh&&T.railh.scrollable&&(u=T.isrtlmode?c-T.rail.drag.sl:T.rail.drag.sl-c,T.ishwscroll&&M.bouncescroll?u<0?u=Math.round(u/2):u>T.page.maxw&&(u=T.page.maxw+Math.round((u-T.page.maxw)/2)):(u<0&&(u=0,a=0),u>T.page.maxw&&(u=T.page.maxw,a=0))),!T.hasmoving){if(T.rail.drag.y===e.clientY&&T.rail.drag.x===e.clientX)return T.cancelEvent(e);var h=Math.abs(n),p=Math.abs(c),m=M.directionlockdeadzone;if(T.rail.drag.ck?"v"==T.rail.drag.ck?p>m&&h<=k?T.rail.drag=!1:h>m&&(T.rail.drag.dl="v"):"h"==T.rail.drag.ck&&(h>m&&p<=k?T.rail.drag=!1:p>m&&(T.rail.drag.dl="h")):h>m&&p>m?T.rail.drag.dl="f":h>m?T.rail.drag.dl=p>k?"f":"v":p>m&&(T.rail.drag.dl=h>k?"f":"h"),!T.rail.drag.dl)return T.cancelEvent(e);T.triggerScrollStart(e.clientX,e.clientY,0,0,0),T.hasmoving=!0}return T.preventclick&&!T.preventclick.click&&(T.preventclick.click=T.preventclick.tg.onclick||!1,T.preventclick.tg.onclick=T.onpreventclick),T.rail.drag.dl&&("v"==T.rail.drag.dl?u=T.rail.drag.sl:"h"==T.rail.drag.dl&&(d=T.rail.drag.st)),T.synched("touchmove",function(){T.rail.drag&&2==T.rail.drag.pt&&(T.prepareTransition&&T.resetTransition(),T.rail.scrollable&&T.setScrollTop(d),T.scrollmom.update(a,s),T.railh&&T.railh.scrollable?(T.setScrollLeft(u),T.showCursor(d,u)):T.showCursor(d),P.isie10&&l.selection.clear())}),T.cancelEvent(e)}return 1==T.rail.drag.pt?T.onmousemove(e):void 0},T.ontouchstartCursor=function(e,o){if(!T.rail.drag||3==T.rail.drag.pt){if(T.locked)return T.cancelEvent(e);T.cancelScroll(),T.rail.drag={x:e.touches[0].clientX,y:e.touches[0].clientY,sx:T.scroll.x,sy:T.scroll.y,pt:3,hr:!!o};var t=T.getTarget(e);return!T.ispage&&P.hasmousecapture&&t.setCapture(),T.isiframe&&!P.hasmousecapture&&(T.saved.csspointerevents=T.doc.css("pointer-events"),T.css(T.doc,{"pointer-events":"none"})),T.cancelEvent(e)}},T.ontouchendCursor=function(e){if(T.rail.drag){if(P.hasmousecapture&&l.releaseCapture(),T.isiframe&&!P.hasmousecapture&&T.doc.css("pointer-events",T.saved.csspointerevents),3!=T.rail.drag.pt)return;return T.rail.drag=!1,T.cancelEvent(e)}},T.ontouchmoveCursor=function(e){if(T.rail.drag){if(3!=T.rail.drag.pt)return;if(T.cursorfreezed=!0,T.rail.drag.hr){T.scroll.x=T.rail.drag.sx+(e.touches[0].clientX-T.rail.drag.x),T.scroll.x<0&&(T.scroll.x=0);var o=T.scrollvaluemaxw;T.scroll.x>o&&(T.scroll.x=o)}else{T.scroll.y=T.rail.drag.sy+(e.touches[0].clientY-T.rail.drag.y),T.scroll.y<0&&(T.scroll.y=0);var t=T.scrollvaluemax;T.scroll.y>t&&(T.scroll.y=t)}return T.synched("touchmove",function(){T.rail.drag&&3==T.rail.drag.pt&&(T.showCursor(),T.rail.drag.hr?T.doScrollLeft(Math.round(T.scroll.x*T.scrollratio.x),M.cursordragspeed):T.doScrollTop(Math.round(T.scroll.y*T.scrollratio.y),M.cursordragspeed))}),T.cancelEvent(e)}}}if(T.onmousedown=function(e,o){if(!T.rail.drag||1==T.rail.drag.pt){if(T.railslocked)return T.cancelEvent(e);T.cancelScroll(),T.rail.drag={x:e.clientX,y:e.clientY,sx:T.scroll.x,sy:T.scroll.y,pt:1,hr:o||!1};var t=T.getTarget(e);return P.hasmousecapture&&t.setCapture(),T.isiframe&&!P.hasmousecapture&&(T.saved.csspointerevents=T.doc.css("pointer-events"),T.css(T.doc,{"pointer-events":"none"})),T.hasmoving=!1,T.cancelEvent(e)}},T.onmouseup=function(e){if(T.rail.drag)return 1!=T.rail.drag.pt||(P.hasmousecapture&&l.releaseCapture(),T.isiframe&&!P.hasmousecapture&&T.doc.css("pointer-events",T.saved.csspointerevents),T.rail.drag=!1,T.cursorfreezed=!1,T.hasmoving&&T.triggerScrollEnd(),T.cancelEvent(e))},T.onmousemove=function(e){if(T.rail.drag){if(1!==T.rail.drag.pt)return;if(P.ischrome&&0===e.which)return T.onmouseup(e);if(T.cursorfreezed=!0,T.hasmoving||T.triggerScrollStart(e.clientX,e.clientY,0,0,0),T.hasmoving=!0,T.rail.drag.hr){T.scroll.x=T.rail.drag.sx+(e.clientX-T.rail.drag.x),T.scroll.x<0&&(T.scroll.x=0);var o=T.scrollvaluemaxw;T.scroll.x>o&&(T.scroll.x=o)}else{T.scroll.y=T.rail.drag.sy+(e.clientY-T.rail.drag.y),T.scroll.y<0&&(T.scroll.y=0);var t=T.scrollvaluemax;T.scroll.y>t&&(T.scroll.y=t)}return T.synched("mousemove",function(){T.cursorfreezed&&(T.showCursor(),T.rail.drag.hr?T.scrollLeft(Math.round(T.scroll.x*T.scrollratio.x)):T.scrollTop(Math.round(T.scroll.y*T.scrollratio.y)))}),T.cancelEvent(e)}T.checkarea=0},P.cantouch||M.emulatetouch)T.onpreventclick=function(e){if(T.preventclick)return T.preventclick.tg.onclick=T.preventclick.click,T.preventclick=!1,T.cancelEvent(e)},T.onclick=!P.isios&&function(e){return!T.lastmouseup||(T.lastmouseup=!1,T.cancelEvent(e))},M.grabcursorenabled&&P.cursorgrabvalue&&(T.css(T.ispage?T.doc:T.win,{cursor:P.cursorgrabvalue}),T.css(T.rail,{cursor:P.cursorgrabvalue}));else{var L=function(e){if(T.selectiondrag){if(e){var o=T.win.outerHeight(),t=e.pageY-T.selectiondrag.top;t>0&&t=o&&(t-=o),T.selectiondrag.df=t}if(0!==T.selectiondrag.df){var r=-2*T.selectiondrag.df/6|0;T.doScrollBy(r),T.debounced("doselectionscroll",function(){L()},50)}}};T.hasTextSelected="getSelection"in l?function(){return l.getSelection().rangeCount>0}:"selection"in l?function(){return"None"!=l.selection.type}:function(){return!1},T.onselectionstart=function(e){T.ispage||(T.selectiondrag=T.win.offset())},T.onselectionend=function(e){T.selectiondrag=!1},T.onselectiondrag=function(e){T.selectiondrag&&T.hasTextSelected()&&T.debounced("selectionscroll",function(){L(e)},250)}}if(P.hasw3ctouch?(T.css(T.ispage?n("html"):T.win,{"touch-action":"none"}),T.css(T.rail,{"touch-action":"none"}),T.css(T.cursor,{"touch-action":"none"}),T.bind(T.win,"pointerdown",T.ontouchstart),T.bind(l,"pointerup",T.ontouchend),T.delegate(l,"pointermove",T.ontouchmove)):P.hasmstouch?(T.css(T.ispage?n("html"):T.win,{"-ms-touch-action":"none"}),T.css(T.rail,{"-ms-touch-action":"none"}),T.css(T.cursor,{"-ms-touch-action":"none"}),T.bind(T.win,"MSPointerDown",T.ontouchstart),T.bind(l,"MSPointerUp",T.ontouchend),T.delegate(l,"MSPointerMove",T.ontouchmove),T.bind(T.cursor,"MSGestureHold",function(e){e.preventDefault()}),T.bind(T.cursor,"contextmenu",function(e){e.preventDefault()})):P.cantouch&&(T.bind(T.win,"touchstart",T.ontouchstart,!1,!0),T.bind(l,"touchend",T.ontouchend,!1,!0),T.bind(l,"touchcancel",T.ontouchend,!1,!0),T.delegate(l,"touchmove",T.ontouchmove,!1,!0)),M.emulatetouch&&(T.bind(T.win,"mousedown",T.ontouchstart,!1,!0),T.bind(l,"mouseup",T.ontouchend,!1,!0),T.bind(l,"mousemove",T.ontouchmove,!1,!0)),(M.cursordragontouch||!P.cantouch&&!M.emulatetouch)&&(T.rail.css({cursor:"default"}),T.railh&&T.railh.css({cursor:"default"}),T.jqbind(T.rail,"mouseenter",function(){if(!T.ispage&&!T.win.is(":visible"))return!1;T.canshowonmouseevent&&T.showCursor(),T.rail.active=!0}),T.jqbind(T.rail,"mouseleave",function(){T.rail.active=!1,T.rail.drag||T.hideCursor()}),M.sensitiverail&&(T.bind(T.rail,"click",function(e){T.doRailClick(e,!1,!1)}),T.bind(T.rail,"dblclick",function(e){T.doRailClick(e,!0,!1)}),T.bind(T.cursor,"click",function(e){T.cancelEvent(e)}),T.bind(T.cursor,"dblclick",function(e){T.cancelEvent(e)})),T.railh&&(T.jqbind(T.railh,"mouseenter",function(){if(!T.ispage&&!T.win.is(":visible"))return!1;T.canshowonmouseevent&&T.showCursor(),T.rail.active=!0}),T.jqbind(T.railh,"mouseleave",function(){T.rail.active=!1,T.rail.drag||T.hideCursor()}),M.sensitiverail&&(T.bind(T.railh,"click",function(e){T.doRailClick(e,!1,!0)}),T.bind(T.railh,"dblclick",function(e){T.doRailClick(e,!0,!0)}),T.bind(T.cursorh,"click",function(e){T.cancelEvent(e)}),T.bind(T.cursorh,"dblclick",function(e){T.cancelEvent(e)})))),M.cursordragontouch&&(this.istouchcapable||P.cantouch)&&(T.bind(T.cursor,"touchstart",T.ontouchstartCursor),T.bind(T.cursor,"touchmove",T.ontouchmoveCursor),T.bind(T.cursor,"touchend",T.ontouchendCursor),T.cursorh&&T.bind(T.cursorh,"touchstart",function(e){T.ontouchstartCursor(e,!0)}),T.cursorh&&T.bind(T.cursorh,"touchmove",T.ontouchmoveCursor),T.cursorh&&T.bind(T.cursorh,"touchend",T.ontouchendCursor)),M.emulatetouch||P.isandroid||P.isios?(T.bind(P.hasmousecapture?T.win:l,"mouseup",T.ontouchend),T.onclick&&T.bind(l,"click",T.onclick),M.cursordragontouch?(T.bind(T.cursor,"mousedown",T.onmousedown),T.bind(T.cursor,"mouseup",T.onmouseup),T.cursorh&&T.bind(T.cursorh,"mousedown",function(e){T.onmousedown(e,!0)}),T.cursorh&&T.bind(T.cursorh,"mouseup",T.onmouseup)):(T.bind(T.rail,"mousedown",function(e){e.preventDefault()}),T.railh&&T.bind(T.railh,"mousedown",function(e){e.preventDefault()}))):(T.bind(P.hasmousecapture?T.win:l,"mouseup",T.onmouseup),T.bind(l,"mousemove",T.onmousemove),T.onclick&&T.bind(l,"click",T.onclick),T.bind(T.cursor,"mousedown",T.onmousedown),T.bind(T.cursor,"mouseup",T.onmouseup),T.railh&&(T.bind(T.cursorh,"mousedown",function(e){T.onmousedown(e,!0)}),T.bind(T.cursorh,"mouseup",T.onmouseup)),!T.ispage&&M.enablescrollonselection&&(T.bind(T.win[0],"mousedown",T.onselectionstart),T.bind(l,"mouseup",T.onselectionend),T.bind(T.cursor,"mouseup",T.onselectionend),T.cursorh&&T.bind(T.cursorh,"mouseup",T.onselectionend),T.bind(l,"mousemove",T.onselectiondrag)),T.zoom&&(T.jqbind(T.zoom,"mouseenter",function(){T.canshowonmouseevent&&T.showCursor(),T.rail.active=!0}),T.jqbind(T.zoom,"mouseleave",function(){T.rail.active=!1,T.rail.drag||T.hideCursor()}))),M.enablemousewheel&&(T.isiframe||T.mousewheel(P.isie&&T.ispage?l:T.win,T.onmousewheel),T.mousewheel(T.rail,T.onmousewheel),T.railh&&T.mousewheel(T.railh,T.onmousewheelhr)),T.ispage||P.cantouch||/HTML|^BODY/.test(T.win[0].nodeName)||(T.win.attr("tabindex")||T.win.attr({tabindex:++r}),T.bind(T.win,"focus",function(e){o=T.getTarget(e).id||T.getTarget(e)||!1,T.hasfocus=!0,T.canshowonmouseevent&&T.noticeCursor()}),T.bind(T.win,"blur",function(e){o=!1,T.hasfocus=!1}),T.bind(T.win,"mouseenter",function(e){t=T.getTarget(e).id||T.getTarget(e)||!1,T.hasmousefocus=!0,T.canshowonmouseevent&&T.noticeCursor()}),T.bind(T.win,"mouseleave",function(e){t=!1,T.hasmousefocus=!1,T.rail.drag||T.hideCursor()})),T.onkeypress=function(e){if(T.railslocked&&0===T.page.maxh)return!0;e=e||a.event;var r=T.getTarget(e);if(r&&/INPUT|TEXTAREA|SELECT|OPTION/.test(r.nodeName)&&(!(r.getAttribute("type")||r.type||!1)||!/submit|button|cancel/i.tp))return!0;if(n(r).attr("contenteditable"))return!0;if(T.hasfocus||T.hasmousefocus&&!o||T.ispage&&!o&&!t){var i=e.keyCode;if(T.railslocked&&27!=i)return T.cancelEvent(e);var s=e.ctrlKey||!1,l=e.shiftKey||!1,c=!1;switch(i){case 38:case 63233:T.doScrollBy(72),c=!0;break;case 40:case 63235:T.doScrollBy(-72),c=!0;break;case 37:case 63232:T.railh&&(s?T.doScrollLeft(0):T.doScrollLeftBy(72),c=!0);break;case 39:case 63234:T.railh&&(s?T.doScrollLeft(T.page.maxw):T.doScrollLeftBy(-72),c=!0);break;case 33:case 63276:T.doScrollBy(T.view.h),c=!0;break;case 34:case 63277:T.doScrollBy(-T.view.h),c=!0;break;case 36:case 63273:T.railh&&s?T.doScrollPos(0,0):T.doScrollTo(0),c=!0;break;case 35:case 63275:T.railh&&s?T.doScrollPos(T.page.maxw,T.page.maxh):T.doScrollTo(T.page.maxh),c=!0;break;case 32:M.spacebarenabled&&(l?T.doScrollBy(T.view.h):T.doScrollBy(-T.view.h),c=!0);break;case 27:T.zoomactive&&(T.doZoom(),c=!0)}if(c)return T.cancelEvent(e)}},M.enablekeyboard&&T.bind(l,P.isopera&&!P.isopera12?"keypress":"keydown",T.onkeypress),T.bind(l,"keydown",function(e){(e.ctrlKey||!1)&&(T.wheelprevented=!0)}),T.bind(l,"keyup",function(e){e.ctrlKey||!1||(T.wheelprevented=!1)}),T.bind(a,"blur",function(e){T.wheelprevented=!1}),T.bind(a,"resize",T.onscreenresize),T.bind(a,"orientationchange",T.onscreenresize),T.bind(a,"load",T.lazyResize),P.ischrome&&!T.ispage&&!T.haswrapper){var C=T.win.attr("style"),N=parseFloat(T.win.css("width"))+1;T.win.css("width",N),T.synched("chromefix",function(){T.win.attr("style",C)})}if(T.onAttributeChange=function(e){T.lazyResize(T.isieold?250:30)},M.enableobserver&&(T.isie11||!1===m||(T.observerbody=new m(function(e){if(e.forEach(function(e){if("attributes"==e.type)return E.hasClass("modal-open")&&E.hasClass("modal-dialog")&&!n.contains(n(".modal-dialog")[0],T.doc[0])?T.hide():T.show()}),T.me.clientWidth!=T.page.width||T.me.clientHeight!=T.page.height)return T.lazyResize(30)}),T.observerbody.observe(l.body,{childList:!0,subtree:!0,characterData:!1,attributes:!0,attributeFilter:["class"]})),!T.ispage&&!T.haswrapper)){var R=T.win[0];!1!==m?(T.observer=new m(function(e){e.forEach(T.onAttributeChange)}),T.observer.observe(R,{childList:!0,characterData:!1,attributes:!0,subtree:!1}),T.observerremover=new m(function(e){e.forEach(function(e){if(e.removedNodes.length>0)for(var o in e.removedNodes)if(T&&e.removedNodes[o]===R)return T.remove()})}),T.observerremover.observe(R.parentNode,{childList:!0,characterData:!1,attributes:!1,subtree:!1})):(T.bind(R,P.isie&&!P.isie9?"propertychange":"DOMAttrModified",T.onAttributeChange),P.isie9&&R.attachEvent("onpropertychange",T.onAttributeChange),T.bind(R,"DOMNodeRemoved",function(e){e.target===R&&T.remove()}))}!T.ispage&&M.boxzoom&&T.bind(a,"resize",T.resizeZoom),T.istextarea&&(T.bind(T.win,"keydown",T.lazyResize),T.bind(T.win,"mouseup",T.lazyResize)),T.lazyResize(30)}if("IFRAME"==this.doc[0].nodeName){var _=function(){T.iframexd=!1;var o;try{(o="contentDocument"in this?this.contentDocument:this.contentWindow._doc).domain}catch(e){T.iframexd=!0,o=!1}if(T.iframexd)return"console"in a&&console.log("NiceScroll error: policy restriced iframe"),!0;if(T.forcescreen=!0,T.isiframe&&(T.iframe={doc:n(o),html:T.doc.contents().find("html")[0],body:T.doc.contents().find("body")[0]},T.getContentSize=function(){return{w:Math.max(T.iframe.html.scrollWidth,T.iframe.body.scrollWidth),h:Math.max(T.iframe.html.scrollHeight,T.iframe.body.scrollHeight)}},T.docscroll=n(T.iframe.body)),!P.isios&&M.iframeautoresize&&!T.isiframe){T.win.scrollTop(0),T.doc.height("");var t=Math.max(o.getElementsByTagName("html")[0].scrollHeight,o.body.scrollHeight);T.doc.height(t)}T.lazyResize(30),T.css(n(T.iframe.body),e),P.isios&&T.haswrapper&&T.css(n(o.body),{"-webkit-transform":"translate3d(0,0,0)"}),"contentWindow"in this?T.bind(this.contentWindow,"scroll",T.onscroll):T.bind(o,"scroll",T.onscroll),M.enablemousewheel&&T.mousewheel(o,T.onmousewheel),M.enablekeyboard&&T.bind(o,P.isopera?"keypress":"keydown",T.onkeypress),P.cantouch?(T.bind(o,"touchstart",T.ontouchstart),T.bind(o,"touchmove",T.ontouchmove)):M.emulatetouch&&(T.bind(o,"mousedown",T.ontouchstart),T.bind(o,"mousemove",function(e){return T.ontouchmove(e,!0)}),M.grabcursorenabled&&P.cursorgrabvalue&&T.css(n(o.body),{cursor:P.cursorgrabvalue})),T.bind(o,"mouseup",T.ontouchend),T.zoom&&(M.dblclickzoom&&T.bind(o,"dblclick",T.doZoom),T.ongesturezoom&&T.bind(o,"gestureend",T.ongesturezoom))};this.doc[0].readyState&&"complete"===this.doc[0].readyState&&setTimeout(function(){_.call(T.doc[0],!1)},500),T.bind(this.doc,"load",_)}},this.showCursor=function(e,o){if(T.cursortimeout&&(clearTimeout(T.cursortimeout),T.cursortimeout=0),T.rail){if(T.autohidedom&&(T.autohidedom.stop().css({opacity:M.cursoropacitymax}),T.cursoractive=!0),T.rail.drag&&1==T.rail.drag.pt||(void 0!==e&&!1!==e&&(T.scroll.y=e/T.scrollratio.y|0),void 0!==o&&(T.scroll.x=o/T.scrollratio.x|0)),T.cursor.css({height:T.cursorheight,top:T.scroll.y}),T.cursorh){var t=T.hasreversehr?T.scrollvaluemaxw-T.scroll.x:T.scroll.x;T.cursorh.css({width:T.cursorwidth,left:!T.rail.align&&T.rail.visibility?t+T.rail.width:t}),T.cursoractive=!0}T.zoom&&T.zoom.stop().css({opacity:M.cursoropacitymax})}},this.hideCursor=function(e){T.cursortimeout||T.rail&&T.autohidedom&&(T.hasmousefocus&&"leave"===M.autohidemode||(T.cursortimeout=setTimeout(function(){T.rail.active&&T.showonmouseevent||(T.autohidedom.stop().animate({opacity:M.cursoropacitymin}),T.zoom&&T.zoom.stop().animate({opacity:M.cursoropacitymin}),T.cursoractive=!1),T.cursortimeout=0},e||M.hidecursordelay)))},this.noticeCursor=function(e,o,t){T.showCursor(o,t),T.rail.active||T.hideCursor(e)},this.getContentSize=T.ispage?function(){return{w:Math.max(l.body.scrollWidth,l.documentElement.scrollWidth),h:Math.max(l.body.scrollHeight,l.documentElement.scrollHeight)}}:T.haswrapper?function(){return{w:T.doc[0].offsetWidth,h:T.doc[0].offsetHeight}}:function(){return{w:T.docscroll[0].scrollWidth,h:T.docscroll[0].scrollHeight}},this.onResize=function(e,o){if(!T||!T.win)return!1;var t=T.page.maxh,r=T.page.maxw,i=T.view.h,s=T.view.w;if(T.view={w:T.ispage?T.win.width():T.win[0].clientWidth,h:T.ispage?T.win.height():T.win[0].clientHeight},T.page=o||T.getContentSize(),T.page.maxh=Math.max(0,T.page.h-T.view.h),T.page.maxw=Math.max(0,T.page.w-T.view.w),T.page.maxh==t&&T.page.maxw==r&&T.view.w==s&&T.view.h==i){if(T.ispage)return T;var n=T.win.offset();if(T.lastposition){var l=T.lastposition;if(l.top==n.top&&l.left==n.left)return T}T.lastposition=n}return 0===T.page.maxh?(T.hideRail(),T.scrollvaluemax=0,T.scroll.y=0,T.scrollratio.y=0,T.cursorheight=0,T.setScrollTop(0),T.rail&&(T.rail.scrollable=!1)):(T.page.maxh-=M.railpadding.top+M.railpadding.bottom,T.rail.scrollable=!0),0===T.page.maxw?(T.hideRailHr(),T.scrollvaluemaxw=0,T.scroll.x=0,T.scrollratio.x=0,T.cursorwidth=0,T.setScrollLeft(0),T.railh&&(T.railh.scrollable=!1)):(T.page.maxw-=M.railpadding.left+M.railpadding.right,T.railh&&(T.railh.scrollable=M.horizrailenabled)),T.railslocked=T.locked||0===T.page.maxh&&0===T.page.maxw,T.railslocked?(T.ispage||T.updateScrollBar(T.view),!1):(T.hidden||(T.rail.visibility||T.showRail(),T.railh&&!T.railh.visibility&&T.showRailHr()),T.istextarea&&T.win.css("resize")&&"none"!=T.win.css("resize")&&(T.view.h-=20),T.cursorheight=Math.min(T.view.h,Math.round(T.view.h*(T.view.h/T.page.h))),T.cursorheight=M.cursorfixedheight?M.cursorfixedheight:Math.max(M.cursorminheight,T.cursorheight),T.cursorwidth=Math.min(T.view.w,Math.round(T.view.w*(T.view.w/T.page.w))),T.cursorwidth=M.cursorfixedheight?M.cursorfixedheight:Math.max(M.cursorminheight,T.cursorwidth),T.scrollvaluemax=T.view.h-T.cursorheight-(M.railpadding.top+M.railpadding.bottom),T.hasborderbox||(T.scrollvaluemax-=T.cursor[0].offsetHeight-T.cursor[0].clientHeight),T.railh&&(T.railh.width=T.page.maxh>0?T.view.w-T.rail.width:T.view.w,T.scrollvaluemaxw=T.railh.width-T.cursorwidth-(M.railpadding.left+M.railpadding.right)),T.ispage||T.updateScrollBar(T.view),T.scrollratio={x:T.page.maxw/T.scrollvaluemaxw,y:T.page.maxh/T.scrollvaluemax},T.getScrollTop()>T.page.maxh?T.doScrollTop(T.page.maxh):(T.scroll.y=T.getScrollTop()/T.scrollratio.y|0,T.scroll.x=T.getScrollLeft()/T.scrollratio.x|0,T.cursoractive&&T.noticeCursor()),T.scroll.y&&0===T.getScrollTop()&&T.doScrollTo(T.scroll.y*T.scrollratio.y|0),T)},this.resize=T.onResize;var O=0;this.onscreenresize=function(e){clearTimeout(O);var o=!T.ispage&&!T.haswrapper;o&&T.hideRails(),O=setTimeout(function(){T&&(o&&T.showRails(),T.resize()),O=0},120)},this.lazyResize=function(e){return clearTimeout(O),e=isNaN(e)?240:e,O=setTimeout(function(){T&&T.resize(),O=0},e),T},this.jqbind=function(e,o,t){T.events.push({e:e,n:o,f:t,q:!0}),n(e).on(o,t)},this.mousewheel=function(e,o,t){var r="jquery"in e?e[0]:e;if("onwheel"in l.createElement("div"))T._bind(r,"wheel",o,t||!1);else{var i=void 0!==l.onmousewheel?"mousewheel":"DOMMouseScroll";S(r,i,o,t||!1),"DOMMouseScroll"==i&&S(r,"MozMousePixelScroll",o,t||!1)}};var Y=!1;if(P.haseventlistener){try{var H=Object.defineProperty({},"passive",{get:function(){Y=!0}});a.addEventListener("test",null,H)}catch(e){}this.stopPropagation=function(e){return!!e&&((e=e.original?e.original:e).stopPropagation(),!1)},this.cancelEvent=function(e){return e.cancelable&&e.preventDefault(),e.stopImmediatePropagation(),e.preventManipulation&&e.preventManipulation(),!1}}else Event.prototype.preventDefault=function(){this.returnValue=!1},Event.prototype.stopPropagation=function(){this.cancelBubble=!0},a.constructor.prototype.addEventListener=l.constructor.prototype.addEventListener=Element.prototype.addEventListener=function(e,o,t){this.attachEvent("on"+e,o)},a.constructor.prototype.removeEventListener=l.constructor.prototype.removeEventListener=Element.prototype.removeEventListener=function(e,o,t){this.detachEvent("on"+e,o)},this.cancelEvent=function(e){return(e=e||a.event)&&(e.cancelBubble=!0,e.cancel=!0,e.returnValue=!1),!1},this.stopPropagation=function(e){return(e=e||a.event)&&(e.cancelBubble=!0),!1};this.delegate=function(e,o,t,r,i){var s=d[o]||!1;s||(s={a:[],l:[],f:function(e){for(var o=s.l,t=!1,r=o.length-1;r>=0;r--)if(!1===(t=o[r].call(e.target,e)))return!1;return t}},T.bind(e,o,s.f,r,i),d[o]=s),T.ispage?(s.a=[T.id].concat(s.a),s.l=[t].concat(s.l)):(s.a.push(T.id),s.l.push(t))},this.undelegate=function(e,o,t,r,i){var s=d[o]||!1;if(s)for(var n=0,l=s.l.length;n0)return t;o=!!o.parentNode&&o.parentNode}return!1},this.triggerScrollStart=function(e,o,t,r,i){if(T.onscrollstart){var s={type:"scrollstart",current:{x:e,y:o},request:{x:t,y:r},end:{x:T.newscrollx,y:T.newscrolly},speed:i};T.onscrollstart.call(T,s)}},this.triggerScrollEnd=function(){if(T.onscrollend){var e=T.getScrollLeft(),o=T.getScrollTop(),t={type:"scrollend",current:{x:e,y:o},end:{x:e,y:o}};T.onscrollend.call(T,t)}};var B=0,X=0,D=0,A=1,q=!1;if(this.onmousewheel=function(e){if(T.wheelprevented||T.locked)return!1;if(T.railslocked)return T.debounced("checkunlock",T.resize,250),!1;if(T.rail.drag)return T.cancelEvent(e);if("auto"===M.oneaxismousemode&&0!==e.deltaX&&(M.oneaxismousemode=!1),M.oneaxismousemode&&0===e.deltaX&&!T.rail.scrollable)return!T.railh||!T.railh.scrollable||T.onmousewheelhr(e);var o=f(),t=!1;if(M.preservenativescrolling&&T.checkarea+600T.page.maxh&&(o=T.page.maxh+(o-T.page.maxh)/2|0),e<0?e=e/2|0:e>T.page.maxw&&(e=T.page.maxw+(e-T.page.maxw)/2|0)):(o<0?o=0:o>T.page.maxh&&(o=T.page.maxh),e<0?e=0:e>T.page.maxw&&(e=T.page.maxw)),T.scrollrunning&&e==T.newscrollx&&o==T.newscrolly)return!1;T.newscrolly=o,T.newscrollx=e;var s=T.getScrollTop(),n=T.getScrollLeft(),l={};l.x=e-n,l.y=o-s;var a=0|Math.sqrt(l.x*l.x+l.y*l.y),c=T.prepareTransition(a);T.scrollrunning||(T.scrollrunning=!0,T.triggerScrollStart(n,s,e,o,c),T.cursorupdate.start()),T.scrollendtrapped=!0,P.transitionend||(T.scrollendtrapped&&clearTimeout(T.scrollendtrapped),T.scrollendtrapped=setTimeout(T.onScrollTransitionEnd,c)),T.setScrollTop(T.newscrolly),T.setScrollLeft(T.newscrollx)},this.cancelScroll=function(){if(!T.scrollendtrapped)return!0;var e=T.getScrollTop(),o=T.getScrollLeft();return T.scrollrunning=!1,P.transitionend||clearTimeout(P.transitionend),T.scrollendtrapped=!1,T.resetTransition(),T.setScrollTop(e),T.railh&&T.setScrollLeft(o),T.timerscroll&&T.timerscroll.tm&&clearInterval(T.timerscroll.tm),T.timerscroll=!1,T.cursorfreezed=!1,T.cursorupdate.stop(),T.showCursor(e,o),T},this.onScrollTransitionEnd=function(){if(T.scrollendtrapped){var e=T.getScrollTop(),o=T.getScrollLeft();if(e<0?e=0:e>T.page.maxh&&(e=T.page.maxh),o<0?o=0:o>T.page.maxw&&(o=T.page.maxw),e!=T.newscrolly||o!=T.newscrollx)return T.doScrollPos(o,e,M.snapbackspeed);T.scrollrunning&&T.triggerScrollEnd(),T.scrollrunning=!1,T.scrollendtrapped=!1,T.resetTransition(),T.timerscroll=!1,T.setScrollTop(e),T.railh&&T.setScrollLeft(o),T.cursorupdate.stop(),T.noticeCursor(!1,e,o),T.cursorfreezed=!1}}}else this.doScrollLeft=function(e,o){var t=T.scrollrunning?T.newscrolly:T.getScrollTop();T.doScrollPos(e,t,o)},this.doScrollTop=function(e,o){var t=T.scrollrunning?T.newscrollx:T.getScrollLeft();T.doScrollPos(t,e,o)},this.doScrollPos=function(e,o,t){var r=T.getScrollTop(),i=T.getScrollLeft();((T.newscrolly-r)*(o-r)<0||(T.newscrollx-i)*(e-i)<0)&&T.cancelScroll();var s=!1;if(T.bouncescroll&&T.rail.visibility||(o<0?(o=0,s=!0):o>T.page.maxh&&(o=T.page.maxh,s=!0)),T.bouncescroll&&T.railh.visibility||(e<0?(e=0,s=!0):e>T.page.maxw&&(e=T.page.maxw,s=!0)),T.scrollrunning&&T.newscrolly===o&&T.newscrollx===e)return!0;T.newscrolly=o,T.newscrollx=e,T.dst={},T.dst.x=e-i,T.dst.y=o-r,T.dst.px=i,T.dst.py=r;var n=0|Math.sqrt(T.dst.x*T.dst.x+T.dst.y*T.dst.y),l=T.getTransitionSpeed(n);T.bzscroll={};var a=s?1:.58;T.bzscroll.x=new R(i,T.newscrollx,l,0,0,a,1),T.bzscroll.y=new R(r,T.newscrolly,l,0,0,a,1);f();var c=function(){if(T.scrollrunning){var e=T.bzscroll.y.getPos();T.setScrollLeft(T.bzscroll.x.getNow()),T.setScrollTop(T.bzscroll.y.getNow()),e<=1?T.timer=u(c):(T.scrollrunning=!1,T.timer=0,T.triggerScrollEnd())}};T.scrollrunning||(T.triggerScrollStart(i,r,e,o,l),T.scrollrunning=!0,T.timer=u(c))},this.cancelScroll=function(){return T.timer&&h(T.timer),T.timer=0,T.bzscroll=!1,T.scrollrunning=!1,T};else this.doScrollLeft=function(e,o){var t=T.getScrollTop();T.doScrollPos(e,t,o)},this.doScrollTop=function(e,o){var t=T.getScrollLeft();T.doScrollPos(t,e,o)},this.doScrollPos=function(e,o,t){var r=e>T.page.maxw?T.page.maxw:e;r<0&&(r=0);var i=o>T.page.maxh?T.page.maxh:o;i<0&&(i=0),T.synched("scroll",function(){T.setScrollTop(i),T.setScrollLeft(r)})},this.cancelScroll=function(){};this.doScrollBy=function(e,o){z(0,e)},this.doScrollLeftBy=function(e,o){z(e,0)},this.doScrollTo=function(e,o){var t=o?Math.round(e*T.scrollratio.y):e;t<0?t=0:t>T.page.maxh&&(t=T.page.maxh),T.cursorfreezed=!1,T.doScrollTop(e)},this.checkContentSize=function(){var e=T.getContentSize();e.h==T.page.h&&e.w==T.page.w||T.resize(!1,e)},T.onscroll=function(e){T.rail.drag||T.cursorfreezed||T.synched("scroll",function(){T.scroll.y=Math.round(T.getScrollTop()/T.scrollratio.y),T.railh&&(T.scroll.x=Math.round(T.getScrollLeft()/T.scrollratio.x)),T.noticeCursor()})},T.bind(T.docscroll,"scroll",T.onscroll),this.doZoomIn=function(e){if(!T.zoomactive){T.zoomactive=!0,T.zoomrestore={style:{}};var o=["position","top","left","zIndex","backgroundColor","marginTop","marginBottom","marginLeft","marginRight"],t=T.win[0].style;for(var r in o){var i=o[r];T.zoomrestore.style[i]=void 0!==t[i]?t[i]:""}T.zoomrestore.style.width=T.win.css("width"),T.zoomrestore.style.height=T.win.css("height"),T.zoomrestore.padding={w:T.win.outerWidth()-T.win.width(),h:T.win.outerHeight()-T.win.height()},P.isios4&&(T.zoomrestore.scrollTop=c.scrollTop(),c.scrollTop(0)),T.win.css({position:P.isios4?"absolute":"fixed",top:0,left:0,zIndex:s+100,margin:0});var n=T.win.css("backgroundColor");return(""===n||/transparent|rgba\(0, 0, 0, 0\)|rgba\(0,0,0,0\)/.test(n))&&T.win.css("backgroundColor","#fff"),T.rail.css({zIndex:s+101}),T.zoom.css({zIndex:s+102}),T.zoom.css("backgroundPosition","0 -18px"),T.resizeZoom(),T.onzoomin&&T.onzoomin.call(T),T.cancelEvent(e)}},this.doZoomOut=function(e){if(T.zoomactive)return T.zoomactive=!1,T.win.css("margin",""),T.win.css(T.zoomrestore.style),P.isios4&&c.scrollTop(T.zoomrestore.scrollTop),T.rail.css({"z-index":T.zindex}),T.zoom.css({"z-index":T.zindex}),T.zoomrestore=!1,T.zoom.css("backgroundPosition","0 0"),T.onResize(),T.onzoomout&&T.onzoomout.call(T),T.cancelEvent(e)},this.doZoom=function(e){return T.zoomactive?T.doZoomOut(e):T.doZoomIn(e)},this.resizeZoom=function(){if(T.zoomactive){var e=T.getScrollTop();T.win.css({width:c.width()-T.zoomrestore.padding.w+"px",height:c.height()-T.zoomrestore.padding.h+"px"}),T.onResize(),T.setScrollTop(Math.min(T.page.maxh,e))}},this.init(),n.nicescroll.push(this)},y=function(e){var o=this;this.nc=e,this.lastx=0,this.lasty=0,this.speedx=0,this.speedy=0,this.lasttime=0,this.steptime=0,this.snapx=!1,this.snapy=!1,this.demulx=0,this.demuly=0,this.lastscrollx=-1,this.lastscrolly=-1,this.chkx=0,this.chky=0,this.timer=0,this.reset=function(e,t){o.stop(),o.steptime=0,o.lasttime=f(),o.speedx=0,o.speedy=0,o.lastx=e,o.lasty=t,o.lastscrollx=-1,o.lastscrolly=-1},this.update=function(e,t){var r=f();o.steptime=r-o.lasttime,o.lasttime=r;var i=t-o.lasty,s=e-o.lastx,n=o.nc.getScrollTop()+i,l=o.nc.getScrollLeft()+s;o.snapx=l<0||l>o.nc.page.maxw,o.snapy=n<0||n>o.nc.page.maxh,o.speedx=s,o.speedy=i,o.lastx=e,o.lasty=t},this.stop=function(){o.nc.unsynched("domomentum2d"),o.timer&&clearTimeout(o.timer),o.timer=0,o.lastscrollx=-1,o.lastscrolly=-1},this.doSnapy=function(e,t){var r=!1;t<0?(t=0,r=!0):t>o.nc.page.maxh&&(t=o.nc.page.maxh,r=!0),e<0?(e=0,r=!0):e>o.nc.page.maxw&&(e=o.nc.page.maxw,r=!0),r?o.nc.doScrollPos(e,t,o.nc.opt.snapbackspeed):o.nc.triggerScrollEnd()},this.doMomentum=function(e){var t=f(),r=e?t+e:o.lasttime,i=o.nc.getScrollLeft(),s=o.nc.getScrollTop(),n=o.nc.page.maxh,l=o.nc.page.maxw;o.speedx=l>0?Math.min(60,o.speedx):0,o.speedy=n>0?Math.min(60,o.speedy):0;var a=r&&t-r<=60;(s<0||s>n||i<0||i>l)&&(a=!1);var c=!(!o.speedy||!a)&&o.speedy,d=!(!o.speedx||!a)&&o.speedx;if(c||d){var u=Math.max(16,o.steptime);if(u>50){var h=u/50;o.speedx*=h,o.speedy*=h,u=50}o.demulxy=0,o.lastscrollx=o.nc.getScrollLeft(),o.chkx=o.lastscrollx,o.lastscrolly=o.nc.getScrollTop(),o.chky=o.lastscrolly;var p=o.lastscrollx,m=o.lastscrolly,g=function(){var e=f()-t>600?.04:.02;o.speedx&&(p=Math.floor(o.lastscrollx-o.speedx*(1-o.demulxy)),o.lastscrollx=p,(p<0||p>l)&&(e=.1)),o.speedy&&(m=Math.floor(o.lastscrolly-o.speedy*(1-o.demulxy)),o.lastscrolly=m,(m<0||m>n)&&(e=.1)),o.demulxy=Math.min(1,o.demulxy+e),o.nc.synched("domomentum2d",function(){if(o.speedx){o.nc.getScrollLeft();o.chkx=p,o.nc.setScrollLeft(p)}if(o.speedy){o.nc.getScrollTop();o.chky=m,o.nc.setScrollTop(m)}o.timer||(o.nc.hideCursor(),o.doSnapy(p,m))}),o.demulxy<1?o.timer=setTimeout(g,u):(o.stop(),o.nc.hideCursor(),o.doSnapy(p,m))};g()}else o.doSnapy(o.nc.getScrollLeft(),o.nc.getScrollTop())}},x=e.fn.scrollTop;e.cssHooks.pageYOffset={get:function(e,o,t){var r=n.data(e,"__nicescroll")||!1;return r&&r.ishwscroll?r.getScrollTop():x.call(e)},set:function(e,o){var t=n.data(e,"__nicescroll")||!1;return t&&t.ishwscroll?t.setScrollTop(parseInt(o)):x.call(e,o),this}},e.fn.scrollTop=function(e){if(void 0===e){var o=!!this[0]&&(n.data(this[0],"__nicescroll")||!1);return o&&o.ishwscroll?o.getScrollTop():x.call(this)}return this.each(function(){var o=n.data(this,"__nicescroll")||!1;o&&o.ishwscroll?o.setScrollTop(parseInt(e)):x.call(n(this),e)})};var S=e.fn.scrollLeft;n.cssHooks.pageXOffset={get:function(e,o,t){var r=n.data(e,"__nicescroll")||!1;return r&&r.ishwscroll?r.getScrollLeft():S.call(e)},set:function(e,o){var t=n.data(e,"__nicescroll")||!1;return t&&t.ishwscroll?t.setScrollLeft(parseInt(o)):S.call(e,o),this}},e.fn.scrollLeft=function(e){if(void 0===e){var o=!!this[0]&&(n.data(this[0],"__nicescroll")||!1);return o&&o.ishwscroll?o.getScrollLeft():S.call(this)}return this.each(function(){var o=n.data(this,"__nicescroll")||!1;o&&o.ishwscroll?o.setScrollLeft(parseInt(e)):S.call(n(this),e)})};var z=function(e){var o=this;if(this.length=0,this.name="nicescrollarray",this.each=function(e){return n.each(o,e),o},this.push=function(e){o[o.length]=e,o.length++},this.eq=function(e){return o[e]},e)for(var t=0;t1?n(e,r):s,i.win=r}!("doc"in i)||"win"in i||(i.win=r);var l=r.data("__nicescroll")||!1;l||(i.doc=i.doc||r,l=new b(i,r),r.data("__nicescroll",l)),t.push(l)}),1===t.length?t[0]:t},a.NiceScroll={getjQuery:function(){return e}},n.nicescroll||(n.nicescroll=new z,n.nicescroll.options=g)}); \ No newline at end of file From 9dbc313be68c249281691b622b43de0d8b065846 Mon Sep 17 00:00:00 2001 From: Arvind Rachuri Date: Thu, 12 Jul 2018 16:36:04 +0530 Subject: [PATCH 14/14] Added Additional Check for Mac In some Mac's like mine (MacBook Pro 2011) the `navigator.platform` property is `MacIntel` instead of `mac` thus the check `d.ismac = /^mac$/i.test(_platform)` returns `false`. Thus an extra check has been added. --- jquery.nicescroll.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/jquery.nicescroll.js b/jquery.nicescroll.js index 50bc270..3ce4423 100644 --- a/jquery.nicescroll.js +++ b/jquery.nicescroll.js @@ -174,7 +174,7 @@ d.hasw3ctouch = (_win.PointerEvent || false) && ((navigator.maxTouchPoints > 0) || (navigator.msMaxTouchPoints > 0)); //IE11 pointer events, following W3C Pointer Events spec d.hasmstouch = (!d.hasw3ctouch) && (_win.MSPointerEvent || false); // IE10 pointer events - d.ismac = /^mac$/i.test(_platform); + d.ismac = /^mac$/i.test(_platform) || /^MacIntel$/i.test(_platform); d.isios = d.cantouch && /iphone|ipad|ipod/i.test(_platform); d.isios4 = d.isios && !("seal" in Object); @@ -3717,4 +3717,4 @@ $.nicescroll.options = _globaloptions; } -})); \ No newline at end of file +}));