{"version":3,"sources":["webpack:///./src/static/scripts/plugins/svg4everybody.js","webpack:///./src/static/scripts/plugins/jquery.mousewheel.js","webpack:///./src/static/scripts/plugins/jquery.mCustomScrollbar.js","webpack:///(webpack)/buildin/amd-options.js","webpack:///./node_modules/jquery-mousewheel/jquery.mousewheel.js","webpack:///./src/static/scripts/plugins/jquery.fancybox.js","webpack:///./src/static/scripts/plugins/jquery.formstyler.js","webpack:///./src/static/scripts/plugins/jquery.dotdotdot.js","webpack:///./src/static/scripts/plugins/jquery.sticky.js","webpack:///./src/static/scripts/plugins/tooltipster.js","webpack:///./src/static/scripts/plugins/plyr.js","webpack:///./src/static/scripts/cover.js","webpack:///./src/static/scripts/auth.js","webpack:///./src/static/scripts/lk.js","webpack:///./src/static/scripts/puzzle.js","webpack:///./src/static/scripts/cosmodrome.js","webpack:///./src/static/scripts/helpers.js","webpack:///./src/static/scripts/script.js"],"names":["root","factory","define","svg4everybody","module","exports","embed","parent","svg","target","fragment","document","createDocumentFragment","viewBox","hasAttribute","getAttribute","setAttribute","clone","cloneNode","childNodes","length","appendChild","firstChild","loadreadystatechange","xhr","onreadystatechange","readyState","cachedDocument","_cachedDocument","implementation","createHTMLDocument","body","innerHTML","responseText","_cachedTarget","_embeds","splice","map","item","id","getElementById","rawopts","oninterval","index","uses","use","parentNode","getSVGAncestor","src","polyfill","opts","validate","removeChild","srcSplit","split","url","shift","join","requests","XMLHttpRequest","open","send","push","numberOfSvgUseElementsToBypass","requestAnimationFrame","Object","newerIEUA","webkitUA","olderEdgeUA","edgeUA","inIframe","window","top","self","test","navigator","userAgent","match","setTimeout","getElementsByTagName","node","nodeName","toLowerCase","jQuery","$","toFix","toBind","documentMode","slice","Array","prototype","nullLowestDeltaTimeout","lowestDelta","event","fixHooks","i","mouseHooks","special","mousewheel","version","setup","addEventListener","handler","onmousewheel","data","getLineHeight","getPageHeight","teardown","removeEventListener","removeData","elem","$elem","$parent","fn","parseInt","css","height","settings","adjustOldDeltas","normalizeOffset","extend","bind","trigger","unmousewheel","unbind","orgEvent","args","call","arguments","delta","deltaX","deltaY","absDelta","offsetX","offsetY","fix","type","detail","wheelDelta","wheelDeltaY","wheelDeltaX","axis","HORIZONTAL_AXIS","deltaMode","lineHeight","pageHeight","Math","max","abs","shouldAdjustOldDeltas","getBoundingClientRect","boundingRect","clientX","left","clientY","deltaFactor","unshift","clearTimeout","nullLowestDelta","dispatch","handle","apply","init","_rjs","_njs","_dlp","location","protocol","_url","require","append","decodeURI","pluginNS","pluginPfx","defaultSelector","defaults","setTop","setLeft","scrollbarPosition","scrollInertia","autoDraggerLength","alwaysShowScrollbar","snapOffset","mouseWheel","enable","scrollAmount","disableOver","scrollButtons","scrollType","keyboard","contentTouchScroll","documentTouchScroll","advanced","autoScrollOnFocus","updateOnContentResize","updateOnImageLoad","autoUpdateTimeout","theme","callbacks","onTotalScrollOffset","onTotalScrollBackOffset","alwaysTriggerOffsets","totalInstances","liveTimers","oldIE","attachEvent","touchActive","touchable","classes","methods","options","selector","_selector","live","liveSelector","$liveSelector","removeLiveTimers","mCustomScrollbar","setWidth","set_width","setHeight","set_height","horizontalScroll","_findAxis","preventDefault","normalizeDelta","invert","mouseWheelPixels","normalizeMouseWheelDelta","_findScrollButtonsType","_theme","each","$this","idx","opt","scrollRatio","y","x","overflowed","contentReset","bindEvents","tweenRunning","sequential","langDir","cbOffsets","poll","size","o","n","img","change","d","htmlDataAxis","htmlDataSbPos","htmlDataTheme","_pluginMarkup","onCreate","addClass","update","el","cb","mCSB_container","mCustomScrollBox","mCSB_dragger","_stop","onBeforeUpdate","hasClass","removeClass","_expandContentHorizontally","autoExpandHorizontalScroll","_contentWidth","_overflowed","_scrollbarVisibility","_setDraggerLength","_scrollRatio","_bindEvents","to","offsetTop","offsetLeft","_resetContentPosition","_unbindEvents","_scrollTo","toString","dir","dur","overwrite","width","onImageLoad","onSelectorChange","onUpdate","_autoUpdate","scrollTo","val","methodDefaults","scrollEasing","moveDragger","timeout","onStart","onComplete","methodOptions","_arr","_to","_isTabHidden","stop","disable","r","destroy","scrollbar","_delete","remove","find","replaceWith","contents","obj","fixedSizeScrollbarThemes","nonExpandedScrollbarThemes","disabledScrollButtonsThemes","enabledAutoHideScrollbarThemes","scrollbarPositionOutsideThemes","inArray","autoExpandScrollbar","autoHideScrollbar","expandClass","wrapperClass","scrollbars","contentWrapper","autoHideClass","scrollbarDirClass","wrapInner","after","wrap","_scrollButtons","scrollWidth","children","outerWidth","get","w","ceil","right","floor","unwrap","mCSB_scrollTools","tabindex","_isNumeric","btnHTML","btn","prepend","next","ratio","outerHeight","l","round","h","_onDragClasses","action","xpnd","closest","toggleClass","_draggable","contentHeight","contentWidth","scrollHeight","add","cx","dx","_contentDraggable","_selectable","_mwt","mousewheelTimeout","_mousewheel","_draggerRail","_wrapperScroll","_focus","_buttons","_keyboard","namespace","sb","sel","releaseDraggableSelectors","extraDraggableSelectors","_canAccessIFrame","_focusTimeout","step","onCompleteTimeout","disabled","content","_coordinates","e","t","ownerDocument","frameElement","offset","io","view","originalEvent","pageY","pageX","touch","touches","changedTouches","screenY","screenX","draggerId","draggable","dragY","dragX","rds","eds","stopImmediatePropagation","_mouseBtnLeft","onselectstart","_iframe","_drag","idleTimer","attr","drag","touchStartY","touchStartX","touchMoveY","touchMoveX","startTime","runningTime","endTime","distance","speed","amount","durA","durB","touchIntent","touchDrag","docDrag","iframe","events","touchAction","style","undefined","_onTouchstart","_onTouchmove","_onTouchstart2","_onTouchend","contentDocument","contentWindow","_pointerTouch","_getTime","easing","limit","prevent","limitX","preventX","slow","diff","absDistance","a","_m","md","ds","s","seq","wrapper","_sel","_seq","getSelection","selection","createRange","text","c","_sequentialScroll","_onMousewheel","_disableMousewheel","px","contentPos","draggerPos","dlt","webkitDirectionInvertedFromDevice","_canAccessIFrameCache","result","cacheKey","html","doc","err","evt","tag","tags","focusTags","is","mCSB_draggerContainer","clickable","clickDir","activeElement","nested","_focusTimer","_childPos","isVisible","scrollTop","scrollLeft","btnClass","editables","_onKeyboard","code","keyCode","which","keyboardDir","once","steplessSpeed","steppedSpeed","_on","_off","snapAmount","m","vals","contentLength","cssProp","jquery","indexOf","p","rem","autoUpdate","upd","parents","updateOnSelectorChange","sizesSum","doUpd","offsetHeight","offsetWidth","imgLoader","Image","createDelegate","contextObject","delegateMethod","imgOnLoad","onload","total","_snapAmount","_stopTween","totalScrollOffsets","totalScrollBackOffsets","_cb","onOverflowYNone","onOverflowXNone","mcs","onOverflowY","onOverflowX","property","tso","tsbo","totalScrollOffset","totalScrollBackOffset","_mcs","onInit","_tweenTo","onScrollStart","_cbOffsets","whileScrolling","onScroll","onTotalScroll","onTotalScrollBack","cp","dp","cl","pl","draggerTop","draggerLeft","topPct","leftPct","direction","prop","duration","_mTween","_delay","progress","from","elStyle","_request","tobj","_cancelTween","_startTween","_step","_tween","time","currVal","_ease","f","cancelAnimationFrame","b","sqrt","pow","ts","tc","performance","now","webkitNow","Date","getTime","props","pointerType","isNaN","parseFloat","isFinite","_getHiddenProp","pfx","method","error","expr","mcsInView","$el","cPos","mcsInSight","elD","wrapperView","pos","wrapperViewPct","pctVals","mcsOverflow","fancybox","console","log","loop","margin","gutter","arrows","infobar","toolbar","buttons","idleTime","smallBtn","protect","modal","image","preload","ajax","tpl","scrolling","defaultType","animationEffect","animationDuration","zoomOpacity","transitionEffect","transitionDuration","slideClass","baseClass","baseTpl","spinnerTpl","errorTpl","btnTpl","download","zoom","close","arrowLeft","arrowRight","parentEl","autoFocus","backFocus","trapFocus","fullScreen","autoStart","vertical","momentum","hash","media","slideShow","thumbs","hideOnClose","wheel","noop","beforeLoad","afterLoad","beforeShow","afterShow","beforeClose","afterClose","onActivate","onDeactivate","clickContent","current","clickSlide","clickOutside","dblclickContent","dblclickSlide","dblclickOutside","mobile","lang","i18n","CLOSE","NEXT","PREV","ERROR","PLAY_START","PLAY_STOP","FULL_SCREEN","THUMBS","DOWNLOAD","SHARE","ZOOM","$W","$D","called","isQuery","hasOwnProperty","requestAFrame","webkitRequestAnimationFrame","mozRequestAnimationFrame","oRequestAnimationFrame","callback","transitionEnd","createElement","transitions","forceRedraw","FancyBox","isMobile","isArray","group","currIndex","prevIndex","prevPos","currPos","firstRun","createGroup","$lastFocus","blur","slides","firstItem","firstItemOpts","scrollbarWidth","$scrollDiv","$container","buttonStr","getInstance","MSStream","innerHeight","appendTo","clientWidth","value","translate","replace","$refs","container","forEach","activate","jumpTo","str","arr","items","makeArray","$item","found","srcParts","isPlainObject","$orig","videoFormat","charAt","$thumb","caption","filter","addEvents","removeEvents","on","stopPropagation","previous","isScaledDown","stage","hide","show","instance","isClosing","has","focus","keycode","idleSecondsCounter","isIdle","showControls","idleInterval","setInterval","isDragging","hideControls","off","clearInterval","slide","canvasWidth","currentPos","transitionProps","groupLen","isAnimating","createSlide","updateControls","getTranslate","$slide","isMoved","forcedDuration","isNumeric","loadSlide","animate","removeAttr","complete","isLoaded","revealContent","isComplete","updateSlide","scaleToActual","$what","$content","imgPos","posX","posY","scaleX","scaleY","canvasHeight","newImgWidth","newImgHeight","hasError","updateCursor","SlideShow","isActive","scaleToFit","end","getFitPos","imgWidth","imgHeight","minRatio","min","key","setTranslate","centerSlide","opacity","nextWidth","nextHeight","isZoomable","fitPos","isFunction","rez","canPan","ajaxLoad","isLoading","setImage","setIframe","setContent","setError","showLoading","success","textStatus","jqXHR","one","abort","srcset","temp","pxRatio","windowWidth","devicePixelRatio","innerWidth","ret","trim","substring","postfix","sort","j","thumb","$ghost","setBigImage","$img","$image","timouts","naturalWidth","naturalHeight","hideLoading","$iframe","isReady","$wrap","frameWidth","frameHeight","$contents","$body","ignore","documentElement","empty","$placeholder","insertAfter","nodeType","$smallBtn","$spinner","first","button","effect","effectClassName","start","getThumbPos","isElementVisible","element","elementRect","parentRects","visibleInAllParents","parentElement","every","parentRect","visiblePixelX","visiblePixelY","bottom","thumbPos","slidePos","promise","siblings","prev","done","cleanUp","name","force","$caption","isHiddenControls","toggleControls","command","all","createTouch","use3d","div","getComputedStyle","getPropertyValue","matrix","eq","transRegex","transRez","exec","position","transform","leaveAnimationName","propertyName","_run","$target","currentTarget","isDefaultPrevented","format","params","param","youtube","matcher","autoplay","autohide","fs","rel","hd","wmode","enablejsapi","html5","paramPlace","vimeo","show_title","show_byline","show_portrait","fullscreen","api","metacafe","dailymotion","additionalInfos","vine","instagram","gmap_place","gmap_search","urlParams","paramObj","provider","providerName","providerOpts","decodeURIComponent","contentProvider","cancelAFrame","webkitCancelAnimationFrame","mozCancelAnimationFrame","oCancelAnimationFrame","pointers","point2","point1","what","isClickable","onclick","atts","attributes","substr","hasScrollbars","overflowY","overflowX","clientHeight","horizontal","isScrollable","Guestures","$bg","bg","$stage","proxy","ontouchstart","isTouchDevice","realPoints","startPoints","startEvent","canTap","isPanning","isSwiping","isZooming","isScrolling","sliderStartPos","sliderLastPos","contentStartPos","contentLastPos","distanceX","distanceY","onscroll","centerPointStartX","centerPointStartY","percentageOfImageAtPinchPointX","percentageOfImageAtPinchPointY","startDistanceBetweenFingers","ontouchmove","newPoints","onSwipe","onPan","onZoom","swiping","angle","atan2","PI","inTransition","requestId","limitMovement","currentOffsetX","currentOffsetY","currentWidth","currentHeight","minTranslateX","minTranslateY","maxTranslateX","maxTranslateY","newOffsetX","newOffsetY","limitPosition","newWidth","newHeight","endDistanceBetweenFingers","pinchRatio","translateFromZoomingX","translateFromZoomingY","centerPointEndX","centerPointEndY","translateFromTranslatingX","translateFromTranslatingY","newPos","ontouchend","dMs","panning","zooming","endPoints","onTap","velocityX","velocityY","speedX","endPanning","endZooming","endSwiping","len","reset","tapX","tapY","where","process","prefix","addBack","tapped","timer","$button","toggle","set","clear","keypress","hidden","fnMap","FullScreen","request","requestFullscreen","ALLOW_KEYBOARD_INPUT","exit","exitFullscreen","isFullscreen","Boolean","fullscreenElement","enabled","fullscreenEnabled","fullscreenchange","FancyThumbs","$grid","$list","Thumbs","second","create","list","thumbWidth","thumbHeight","widthRatio","heightRatio","share","escapeHtml","string","entityMap","String","encodeURIComponent","click","href","escapeSelector","rcssescape","fcssescape","ch","asCodePoint","charCodeAt","shouldCreateHistory","currentHash","timerID","parseUrl","pop","gallery","triggerFromUrl","getGalleryID","origHash","history","title","pathname","search","replaceState","prevTime","currTime","pluginName","idSuffix","filePlaceholder","fileBrowse","fileNumber","selectPlaceholder","selectSearch","selectSearchLimit","selectSearchNotFound","selectSearchPlaceholder","selectVisibleOptions","selectSmartPositioning","locale","locales","onSelectOpened","onSelectClosed","onFormStyled","Plugin","iOS","Android","Attributes","checkboxOutput","att","checkbox","prependTo","triggerHandler","before","radioOutput","radio","commonParents","cachedThis","commonParent","inputName","fileOutput","placeholder","browse","file","files","number","numberOutput","interval","Number","changeValue","spin","newValue","decimals","multiplier","selectboxOutput","preventScrolling","scrollDiff","option","makeList","op","li","liClass","liClasses","dataList","optionClass","optgroupClass","dataJqfsClass","selDis","k","doSelect","searchHTML","selectbox","selectzIndex","divSelect","divText","optionSelected","dropdown","ul","notFound","liWidthInner","liWidth","selClone","selCloneWidth","selectHeight","searchHeight","isMaxHeight","liSelected","liOuterHeight","win","liHeight","topOffset","bottomOffset","visible","minHeight","dropDown","maxHeightBottom","dropUp","maxHeightTop","zIndex","keyup","query","RegExp","hover","selectedText","liText","prevAll","mouseout","not","selectedIndex","onDocumentClick","registered","doMultipleSelect","ulHeight","clkd","ctrlKey","metaKey","shiftKey","nextAll","arrIndexes","returns","_PLUGIN_","_VERSION_","$dot","oldAPI","truncate","watch","uniqueId","ellipsis","tolerance","keep","watchTimeout","watchInterval","originalContent","originalStyle","maxHeight","_getMaxHeight","that","$inner","detach","_c","$e","$d","__getTextContent","isTruncated","_truncateNode","truncated","restore","unwatch","oldSizes","$wndw","_e","resize","_watchSizes","_api","re","forceEllipsis","reverse","_fits","$x","_truncateWord","txt","sep","__setTextContent","_truncateLetter","_addEllipsis","hgh","newSizes","initPlugin","_d","ddd","topSpacing","bottomSpacing","className","wrapperClassName","center","getWidthFrom","widthFromWrapper","responsiveWidth","$window","$document","sticked","windowHeight","scroller","documentHeight","dwh","extra","elementTop","stickyWrapper","etse","stickyElement","currentTop","newTop","padding","stickyWrapperContainer","unstick","resizer","stickyId","wrapperId","wrapAll","marginLeft","marginRight","setWrapperHeight","setupChangeListeners","MutationObserver","mutationObserver","mutations","addedNodes","removedNodes","observe","subtree","childList","unstickyElement","removeIdx","sticky","a0","animation","contentAsHTML","contentCloning","debug","delay","delayTouch","functionInit","functionBefore","functionReady","functionAfter","functionFormat","IEmin","interactive","multiple","plugins","repositionOnScroll","restoration","selfDestruction","trackerInterval","trackOrigin","trackTooltip","triggerClose","mouseleave","originClick","scroll","tap","touchleave","triggerOpen","mouseenter","touchstart","updateAnimation","env","hasTouchCapability","DocumentTouch","maxTouchPoints","hasTransitions","transitionSupport","IE","semVer","core","__$emitterPrivate","__$emitterPublic","__instancesLatestArr","__plugins","_env","__bridge","constructor","pluginInstance","__init","methodName","bridged","__setWindow","_getRuler","$tooltip","Ruler","_one","_plugin","plugin","Error","_trigger","instances","ns","instancesLatest","origins","toArray","setDefaults","tooltipster","Tooltipster","__callbacks","__closingTime","__Content","__contentBcr","__destroyed","__enabled","__garbageCollector","__Geometry","__lastPosition","__namespace","random","__options","__$originParents","__pointerIsOverOrigin","__previousThemes","__state","__timeouts","__touchEvents","__tracker","_$origin","_$tooltip","origin","__optionsFormat","initialTitle","__contentSet","__prepareOrigin","__prepareGC","_plug","_touchRecordEvent","__prepareTooltip","__contentInsert","formattedContent","__destroyError","__geometry","originIsArea","mapName","bcr","geo","available","scrollX","scrollY","fixedLineage","usemapImage","windowOffset","geoFixed","shape","coords","circleCenterLeft","circleCenterTop","circleRadius","areaTopOffset","areaLeftOffset","areaLeft","areaTop","areaRight","areaBottom","areaSmallestX","areaSmallestY","areaGreatestX","areaGreatestY","arrayAlternate","areaNumber","edit","geometry","tagName","grep","bodyContains","eventNames","_touchIsMeaningfulEvent","_open","_touchIsTouchEvent","_touchIsEmulatedEvent","_openShortly","merge","__scrollHandler","_close","reposition","overflows","coord","__stateSet","state","__timeoutsClear","__trackerStart","g","identical","areEqual","currentBcr","ok","finishCallbacks","necessary","newClosingTime","finish","clearQueue","queue","fadeOut","__destroying","extraTime","tooltip","fadeIn","$ae","contains","dismissable","$elements","eventNamesIn","eventNamesOut","_optionsExtract","defaultOptions","pluginOptions","optionName","isEmulated","_touchSwiped","swiped","_unplug","__destroy","fadeTo","elementOrigin","elementTooltip","tooltipIsDetached","helper","status","destroyed","contentCloningWarning","v","resp","multipleIsSet","contentIsSet","contentCloningIsSet","debugIsSet","go","constraints","__$tooltip","overflow","__forceRedraw","$p","constrain","display","free","measure","tooltipBcr","contentBcr","fits","same","_","$obj","uA","toUpperCase","__defaults","arrow","functionPosition","maxWidth","minIntersection","minWidth","side","viewportAware","__instance","__previousState","__close","__create","__reposition","$html","opposites","finalResult","targets","__targetFind","testResults","$clone","ruler","satisfied","takeTest","bool","results","__sideChange","mode","testResult","outerSize","whole","rulerConfigured","rulerResults","ai","bi","tooltipClone","tooltipParent","finalResultClone","arrowCoord","maxVal","originParentOffset","rects","getClientRects","targetRect","plyr","seekTime","volume","volumeMin","volumeMax","volumeStep","displayDuration","loadSprite","iconPrefix","iconUrl","blankUrl","clickToPlay","showPosterOnEnd","disableContextMenu","keyboardShorcuts","focused","global","tooltips","controls","seek","selectors","editable","labels","play","pause","restart","rewind","forward","mute","captions","input","buffer","played","currentTime","ready","videoWrapper","embedWrapper","stopped","playing","muted","loading","isIos","isTouch","active","fallback","tabFocus","defaultActive","allowAudio","storage","buffered","toggleMute","toggleCaptions","toggleFullscreen","frameTitle","types","urls","soundcloud","listeners","logPrefix","_browserSniff","ua","appName","fullVersion","appVersion","majorVersion","nameOffset","verOffset","ix","isIE","isFirefox","isChrome","isSafari","lastIndexOf","platform","isIphone","_supportMime","mimeType","canPlayType","_injectScript","source","querySelectorAll","firstScriptTag","insertBefore","_inArray","haystack","needle","_replaceAll","_wrap","elements","child","sibling","nextSibling","_remove","_prependChild","_setAttributes","_is","boolean","_insertElement","_getClassname","_toggleClass","classList","_hasClass","_matches","Element","matches","webkitMatchesSelector","mozMatchesSelector","msMatchesSelector","_proxyListener","eventName","userListener","defaultListener","useCapture","_toggleListener","eventList","NodeList","Node","_event","bubbles","properties","CustomEvent","dispatchEvent","_toggleState","_getPercentage","toFixed","_extend","objects","destination","object","array","nodeList","htmlElement","HTMLElement","function","_parseYouTubeId","regex","$2","_parseVimeoId","_fullscreen","supportsFullScreen","isFullScreen","requestFullScreen","cancelFullScreen","fullScreenEventName","browserPrefixes","il","msExitFullscreen","msFullscreenEnabled","mozFullScreenElement","_storage","supported","localStorage","setItem","getItem","removeItem","Plyr","config","timers","original","_triggerEvent","_console","_log","_warn","_getIconUrl","absolute","browser","_buildControls","iconPath","_setupFullscreen","full","nativeSupport","_inFrame","_focusTrap","_setupCaptions","_getElement","videoContainer","insertAdjacentHTML","usingTextTracks","textTracks","captionSrc","kind","captionExists","tracks","_showCaptions","track","activeCues","_setCaption","getCueAsHTML","currentCaption","req","lineSeparator","parts","redraw","_seekManualCaptions","_timecodeCommon","tcpair","_subTcSecs","_timecodeMin","_timecodeMax","tc1","tc2","seconds","subcount","captionsEnabled","_getElements","tabbables","last","_checkFocus","_insertChildElements","_injectControls","querySelector","label","_findElements","bar","_toggleNativeControls","_toggleStyleHook","removeAttribute","_setTitle","_setupStorage","_updateStorage","JSON","parse","stringify","_setupMedia","_setupEmbed","mediaId","mediaUrl","embedId","containers","YT","_youTubeReady","onYouTubeReadyCallbacks","onYouTubeIframeAPIReady","Vimeo","vimeoTimer","_vimeoReady","soundCloud","loaded","SC","soundCloudTimer","_soundcloudReady","_embedReady","_setupInterface","_ready","videoId","Player","playerVars","showinfo","iv_load_policy","cc_load_policy","cc_lang_pref","modestbranding","disablekb","onError","onReady","playVideo","paused","pauseVideo","stopVideo","getDuration","isMuted","getVideoData","buffering","getVideoLoadedFraction","lastBuffered","onStateChange","seeking","getCurrentTime","byline","portrait","transparent","buildUrlParameters","keys","then","percent","Widget","Events","READY","seekTo","getPosition","PLAY","PAUSE","PLAY_PROGRESS","currentPosition","LOAD_PROGRESS","loadProgress","FINISH","_play","_pause","_togglePlay","_rewind","_seek","_forward","targetTime","_getDuration","_updateSeekDisplay","setCurrentTime","mediaDuration","_checkPlaying","_toggleControls","_saveScrollPosition","pageXOffset","pageYOffset","_restoreScrollPosition","_toggleFullscreen","_toggleMute","_setVolume","setVolume","_increaseVolume","_decreaseVolume","_updateVolume","_toggleCaptions","_checkLoading","_updateProgress","pressed","_setProgress","_updateTimeDisplay","secs","mins","hours","displayHours","_displayDuration","_updateSeekTooltip","_timeUpdate","clientRect","isEnterFullscreen","_source","_updateSource","getVideoUrl","getCurrentSound","permalink_url","currentSrc","sources","_cancelRequests","firstSource","crossorigin","poster","load","_destroy","_updatePoster","onBodyClick","_controlListeners","inputEvent","togglePlay","hadTabFocus","getFocusElement","getKeyCode","checkTabFocus","allowed","count","handleKey","held","seekByKey","inverted","_mediaListeners","cursor","ended","concat","unload","replaceChild","_init","basic","controlsMissing","getOriginal","getContainer","getEmbed","getMedia","getType","getVolume","isPaused","support","isOldIE","audioSupport","videoSupport","players","hook","player","cancelable","createEvent","initCustomEvent","Event","PopupPage","refactoredUrl","refactorUrl","forced","working","indexInHierarchy","findInOpened","openedPopups","hideUpperThan","coverAnimation","TimelineMax","coverAnimationSpeed","coverAnimationDelay","popup","form","reg_errors","post","serialize","reload","validateForm","required","checked","alert","sendForm","mouseDown","piramidDragging","piramidPartCurrent","mousePos","piramidOrigin","draggableBlocks","rightBlock","rightTexts","leftTexts","doneBlocks","dropZones","wire","puzzle","getMousePos","mousedown","timeSize","mousemove","mouseDelta","mouseup","linkToPiramidCurrent","droppedTo","goodsDragging","rocketGood","rocketTrap","rocketGoodDragging","rocketGoodCurrent","mousePosLeft","mousePosTop","mouseDeltaLeft","mouseDeltaTop","goodInitialPosLeft","goodInitialPosTop","mouseover","rocketReady","rocketGoodsCounter","objectWidth","objectHeight","objectPosLeft","objectPosTop","cssLeft","cssTop","trapWidth","trapHeight","trapPosLeft","trapPosTop","formData","FormData","formParams","serializeArray","processData","contentType","dataType","shuffle","getCookie","cookie","setCookie","exp","expires","setTime","getTimezoneOffset","toUTCString","updatedCookie","propName","propValue","deleteCookie","Swiper","initScheduleScrollbar","scheduleScrollbar","baseFont","contentItems","fullOffset","parentWidth","parentLeft","shiftFromLeft","updateOnBrowserResize","closeBtn","dotdotdot","positionTracker","styler","section","resizeBlock","sectionStartWidth","sectionStartHeight","sectionEndWidth","sectionEndHeight","sectionResize","boxAspectsWidth","boxAspectsHeight","boxPosLeft","boxPosTop","box","boxEndWidth","boxEndHeight","boxEndPosLeft","boxEndPosTop","vector","moveToEndPoint","ox","oy","fx","fy","vnx","vny","vnd","vkx","vky","generateAnimations","animationSections","ease","Power2","easeInOut","clamp","num","hashName","indexFromHash","swiperRealIndex","swiperBackgroundSpeed","swiperContentSpeed","swiperBackground","fadeEffect","crossFade","initialSlide","navigation","prevEl","nextEl","allowTouchMove","pagination","swiperContent","simulateTouch","threshold","rearrangeBackgrounds","hashNavigation","watchState","slideTo","realIndex","projector","cartoonIds","getRandomProjectorSlide","swiper","ids","removeSlide","appendSlide","swiperProjector","slidesPerView","centeredSlides","disableOnInteraction","slideChangeTransitionEnd","slideNext","swiperProjectorMobile","video","tv","addSourceToVideo","points","tvTimings","currentPoint","ct","newPoint","tvButtonsResize","tvNav","tvPoint","photoAnimationActivity","photoWrapper","camera","photoAppear","photo","sourcePosLeft","sourcePosTop","currentPosLeft","photoWrapperStartWidth","currentPosTop","photoWrapperStartHeight","finalPosLeft","finalPosTop","photos","photoAnimationDelay","photoAnimationSpeed","photoAppearAnimation","fromTo","cameraCenterLeft","cameraCenterTop","scale","bezier","curviness","values","final","transformOrigin","rotation","photoStack","getRandomInt","photoStackAnimation","photoAppearComplete","photoStackComplete","photoLoad","currentPhotosSlice","elementDarkClass","elementLightClass","btnDarkClass","btnLightClass","launchRocket","rocketStarting","repeat","repeatDelay","lever","alpha","Expo","easeIn","swiperAward","loopFillGroupWithBlank","swiperPhoto","coverId","coverImg","coverSrc","URL","createObjectURL","field","nominationContent","setRequiredNominations","inputs","needed","participantsRandomAnimation","participants","participantsCount","baseHeight","base","baseData","baseHeader","baseTitle","baseDesc","baseActions","baseDescHeight","baseDataHeight","baseHeaderHeight","baseTitleHeight","baseActionsHeight","votingKey","star","selectedGroupSelector","selectedSelector","starSelected","checkJuryButtonActivity","itemsCount","selectedStars","selectedData","entry","nominationId","nomination","personId","initJuryStarSelection","rating","entryId","allRatingsForEntry","selected","allSameStars","allSelected","checkPeopleButtonActivity","groups","activeStars","votes","helpers","initPeopleStarSelection","wasActive","bindScheduleEvents","filteredId","pulsating","countdownNumber","countdownTitle","countdownContainer","countdownBreakpoints","breakpoint","declOfNum","titles","cases","recalculateTimer","fromStart","countdownInterval","fromEnd","vectorLength","p1","p2","plane","rotationAngle","timings","rotationSpeed","acceleration","clouds","baloon","appearance","appearanceDiff","pointIncrease","baloonCost","tabIsActive","creationIntervals","Game","Plane","pointsLabel","Cloud","createRepeatedly","Baloon","recalculateTabActivity","initialize","calculatePoints","appearanceMultiplier","move","keyPressed","calculateCenter","onkeydown","keydownHandler","onkeyup","keyupHandler","up","rotateUp","down","rotateDown","stabilize","TweenLite","Linear","none","eventCallback","rect","radius","layer","randomCloud","randomXPosition","randomYPosition","leftInitial","leftEnd","cloud","easeNone","randomTime","newCloud","collided","newBaloon","game","run","year","swiperLocation","freeMode","bindCartoonListEvents","cards","filteredCards","recalculateVisibleCartoons","resetForm","initYoutube","loadYoutubeAPI","getElementsByClassName","dataset","labnolThumb","labnolIframe"],"mappings":";;;;;;;AAAA,CAAC,UAASA,IAAT,EAAeC,OAAf,EAAwB;AACrB,YAA4C;AAC5CC,IAAA,iCAAO,EAAP,mCAAW,YAAW;AAClB,eAAOF,KAAKG,aAAL,GAAqBF,SAA5B;AACH,KAFD;AAAA,oGADA,GAGK,oBAAmBG,MAAnB,yCAAmBA,MAAnB,MAA6BA,OAAOC,OAApC,GAA8C;AACnD;AACA;AACA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,CAA6B5+C,MAA7B,EAAqC,IAArC;AACD;AACF,CA9BD,C","file":"script.js","sourcesContent":["!function(root, factory) {\r\n \"function\" == typeof define && define.amd ? // AMD. Register as an anonymous module unless amdModuleId is set\r\n define([], function() {\r\n return root.svg4everybody = factory();\r\n }) : \"object\" == typeof module && module.exports ? // Node. Does not work with strict CommonJS, but\r\n // only CommonJS-like environments that support module.exports,\r\n // like Node.\r\n module.exports = factory() : root.svg4everybody = factory();\r\n}(this, function() {\r\n /*! svg4everybody v2.1.7 | github.com/jonathantneal/svg4everybody */\r\n function embed(parent, svg, target) {\r\n // if the target exists\r\n if (target) {\r\n // create a document fragment to hold the contents of the target\r\n var fragment = document.createDocumentFragment(), viewBox = !svg.hasAttribute(\"viewBox\") && target.getAttribute(\"viewBox\");\r\n // conditionally set the viewBox on the svg\r\n viewBox && svg.setAttribute(\"viewBox\", viewBox);\r\n // copy the contents of the clone into the fragment\r\n for (// clone the target\r\n var clone = target.cloneNode(!0); clone.childNodes.length; ) {\r\n fragment.appendChild(clone.firstChild);\r\n }\r\n // append the fragment into the svg\r\n parent.appendChild(fragment);\r\n }\r\n }\r\n function loadreadystatechange(xhr) {\r\n // listen to changes in the request\r\n xhr.onreadystatechange = function() {\r\n // if the request is ready\r\n if (4 === xhr.readyState) {\r\n // get the cached html document\r\n var cachedDocument = xhr._cachedDocument;\r\n // ensure the cached html document based on the xhr response\r\n cachedDocument || (cachedDocument = xhr._cachedDocument = document.implementation.createHTMLDocument(\"\"), \r\n cachedDocument.body.innerHTML = xhr.responseText, xhr._cachedTarget = {}), // clear the xhr embeds list and embed each item\r\n xhr._embeds.splice(0).map(function(item) {\r\n // get the cached target\r\n var target = xhr._cachedTarget[item.id];\r\n // ensure the cached target\r\n target || (target = xhr._cachedTarget[item.id] = cachedDocument.getElementById(item.id)), \r\n // embed the target into the svg\r\n embed(item.parent, item.svg, target);\r\n });\r\n }\r\n }, // test the ready state change immediately\r\n xhr.onreadystatechange();\r\n }\r\n function svg4everybody(rawopts) {\r\n function oninterval() {\r\n // while the index exists in the live collection\r\n for (// get the cached index\r\n var index = 0; index < uses.length; ) {\r\n // get the current \r\n var use = uses[index], parent = use.parentNode, svg = getSVGAncestor(parent);\r\n if (svg) {\r\n var src = use.getAttribute(\"xlink:href\") || use.getAttribute(\"href\");\r\n if (polyfill) {\r\n if (!opts.validate || opts.validate(src, svg, use)) {\r\n // remove the element\r\n parent.removeChild(use);\r\n // parse the src and get the url and id\r\n var srcSplit = src.split(\"#\"), url = srcSplit.shift(), id = srcSplit.join(\"#\");\r\n // if the link is external\r\n if (url.length) {\r\n // get the cached xhr request\r\n var xhr = requests[url];\r\n // ensure the xhr request exists\r\n xhr || (xhr = requests[url] = new XMLHttpRequest(), xhr.open(\"GET\", url), xhr.send(), \r\n xhr._embeds = []), // add the svg and id as an item to the xhr embeds list\r\n xhr._embeds.push({\r\n parent: parent,\r\n svg: svg,\r\n id: id\r\n }), // prepare the xhr ready state change event\r\n loadreadystatechange(xhr);\r\n } else {\r\n // embed the local id into the svg\r\n embed(parent, svg, document.getElementById(id));\r\n }\r\n } else {\r\n // increase the index when the previous value was not \"valid\"\r\n ++index, ++numberOfSvgUseElementsToBypass;\r\n }\r\n }\r\n } else {\r\n // increase the index when the previous value was not \"valid\"\r\n ++index;\r\n }\r\n }\r\n // continue the interval\r\n (!uses.length || uses.length - numberOfSvgUseElementsToBypass > 0) && requestAnimationFrame(oninterval, 67);\r\n }\r\n var polyfill, opts = Object(rawopts), newerIEUA = /\\bTrident\\/[567]\\b|\\bMSIE (?:9|10)\\.0\\b/, webkitUA = /\\bAppleWebKit\\/(\\d+)\\b/, olderEdgeUA = /\\bEdge\\/12\\.(\\d+)\\b/, edgeUA = /\\bEdge\\/.(\\d+)\\b/, inIframe = window.top !== window.self;\r\n polyfill = \"polyfill\" in opts ? opts.polyfill : newerIEUA.test(navigator.userAgent) || (navigator.userAgent.match(olderEdgeUA) || [])[1] < 10547 || (navigator.userAgent.match(webkitUA) || [])[1] < 537 || edgeUA.test(navigator.userAgent) && inIframe;\r\n // create xhr requests object\r\n var requests = {}, requestAnimationFrame = window.requestAnimationFrame || setTimeout, uses = document.getElementsByTagName(\"use\"), numberOfSvgUseElementsToBypass = 0;\r\n // conditionally start the interval if the polyfill is active\r\n polyfill && oninterval();\r\n }\r\n function getSVGAncestor(node) {\r\n for (var svg = node; \"svg\" !== svg.nodeName.toLowerCase() && (svg = svg.parentNode); ) {}\r\n return svg;\r\n }\r\n return svg4everybody;\r\n});\n\n\n// WEBPACK FOOTER //\n// ./src/static/scripts/plugins/svg4everybody.js","/*!\r\n * jQuery Mousewheel 3.1.13\r\n *\r\n * Copyright jQuery Foundation and other contributors\r\n * Released under the MIT license\r\n * http://jquery.org/license\r\n */\r\n\r\n(function (factory) {\r\n if (typeof define === 'function' && define.amd) {\r\n // AMD. Register as an anonymous module.\r\n define(['jquery'], factory);\r\n } else if (typeof exports === 'object') {\r\n // Node/CommonJS style for Browserify\r\n module.exports = factory;\r\n } else {\r\n // Browser globals\r\n factory(jQuery);\r\n }\r\n}(function ($) {\r\n\r\n var toFix = ['wheel', 'mousewheel', 'DOMMouseScroll', 'MozMousePixelScroll'],\r\n toBind = ( 'onwheel' in document || document.documentMode >= 9 ) ?\r\n ['wheel'] : ['mousewheel', 'DomMouseScroll', 'MozMousePixelScroll'],\r\n slice = Array.prototype.slice,\r\n nullLowestDeltaTimeout, lowestDelta;\r\n\r\n if ($.event.fixHooks) {\r\n for (var i = toFix.length; i;) {\r\n $.event.fixHooks[toFix[--i]] = $.event.mouseHooks;\r\n }\r\n }\r\n\r\n var special = $.event.special.mousewheel = {\r\n version: '3.1.12',\r\n\r\n setup: function () {\r\n if (this.addEventListener) {\r\n for (var i = toBind.length; i;) {\r\n this.addEventListener(toBind[--i], handler, false);\r\n }\r\n } else {\r\n this.onmousewheel = handler;\r\n }\r\n // Store the line height and page height for this particular element\r\n $.data(this, 'mousewheel-line-height', special.getLineHeight(this));\r\n $.data(this, 'mousewheel-page-height', special.getPageHeight(this));\r\n },\r\n\r\n teardown: function () {\r\n if (this.removeEventListener) {\r\n for (var i = toBind.length; i;) {\r\n this.removeEventListener(toBind[--i], handler, false);\r\n }\r\n } else {\r\n this.onmousewheel = null;\r\n }\r\n // Clean up the data we added to the element\r\n $.removeData(this, 'mousewheel-line-height');\r\n $.removeData(this, 'mousewheel-page-height');\r\n },\r\n\r\n getLineHeight: function (elem) {\r\n var $elem = $(elem),\r\n $parent = $elem['offsetParent' in $.fn ? 'offsetParent' : 'parent']();\r\n if (!$parent.length) {\r\n $parent = $('body');\r\n }\r\n return parseInt($parent.css('fontSize'), 10) || parseInt($elem.css('fontSize'), 10) || 16;\r\n },\r\n\r\n getPageHeight: function (elem) {\r\n return $(elem).height();\r\n },\r\n\r\n settings: {\r\n adjustOldDeltas: true, // see shouldAdjustOldDeltas() below\r\n normalizeOffset: true // calls getBoundingClientRect for each event\r\n }\r\n };\r\n\r\n $.fn.extend({\r\n mousewheel: function (fn) {\r\n return fn ? this.bind('mousewheel', fn) : this.trigger('mousewheel');\r\n },\r\n\r\n unmousewheel: function (fn) {\r\n return this.unbind('mousewheel', fn);\r\n }\r\n });\r\n\r\n\r\n function handler(event) {\r\n var orgEvent = event || window.event,\r\n args = slice.call(arguments, 1),\r\n delta = 0,\r\n deltaX = 0,\r\n deltaY = 0,\r\n absDelta = 0,\r\n offsetX = 0,\r\n offsetY = 0;\r\n event = $.event.fix(orgEvent);\r\n event.type = 'mousewheel';\r\n\r\n // Old school scrollwheel delta\r\n if ('detail' in orgEvent) {\r\n deltaY = orgEvent.detail * -1;\r\n }\r\n if ('wheelDelta' in orgEvent) {\r\n deltaY = orgEvent.wheelDelta;\r\n }\r\n if ('wheelDeltaY' in orgEvent) {\r\n deltaY = orgEvent.wheelDeltaY;\r\n }\r\n if ('wheelDeltaX' in orgEvent) {\r\n deltaX = orgEvent.wheelDeltaX * -1;\r\n }\r\n\r\n // Firefox < 17 horizontal scrolling related to DOMMouseScroll event\r\n if ('axis' in orgEvent && orgEvent.axis === orgEvent.HORIZONTAL_AXIS) {\r\n deltaX = deltaY * -1;\r\n deltaY = 0;\r\n }\r\n\r\n // Set delta to be deltaY or deltaX if deltaY is 0 for backwards compatabilitiy\r\n delta = deltaY === 0 ? deltaX : deltaY;\r\n\r\n // New school wheel delta (wheel event)\r\n if ('deltaY' in orgEvent) {\r\n deltaY = orgEvent.deltaY * -1;\r\n delta = deltaY;\r\n }\r\n if ('deltaX' in orgEvent) {\r\n deltaX = orgEvent.deltaX;\r\n if (deltaY === 0) {\r\n delta = deltaX * -1;\r\n }\r\n }\r\n\r\n // No change actually happened, no reason to go any further\r\n if (deltaY === 0 && deltaX === 0) {\r\n return;\r\n }\r\n\r\n // Need to convert lines and pages to pixels if we aren't already in pixels\r\n // There are three delta modes:\r\n // * deltaMode 0 is by pixels, nothing to do\r\n // * deltaMode 1 is by lines\r\n // * deltaMode 2 is by pages\r\n if (orgEvent.deltaMode === 1) {\r\n var lineHeight = $.data(this, 'mousewheel-line-height');\r\n delta *= lineHeight;\r\n deltaY *= lineHeight;\r\n deltaX *= lineHeight;\r\n } else if (orgEvent.deltaMode === 2) {\r\n var pageHeight = $.data(this, 'mousewheel-page-height');\r\n delta *= pageHeight;\r\n deltaY *= pageHeight;\r\n deltaX *= pageHeight;\r\n }\r\n\r\n // Store lowest absolute delta to normalize the delta values\r\n absDelta = Math.max(Math.abs(deltaY), Math.abs(deltaX));\r\n\r\n if (!lowestDelta || absDelta < lowestDelta) {\r\n lowestDelta = absDelta;\r\n\r\n // Adjust older deltas if necessary\r\n if (shouldAdjustOldDeltas(orgEvent, absDelta)) {\r\n lowestDelta /= 40;\r\n }\r\n }\r\n\r\n // Adjust older deltas if necessary\r\n if (shouldAdjustOldDeltas(orgEvent, absDelta)) {\r\n // Divide all the things by 40!\r\n delta /= 40;\r\n deltaX /= 40;\r\n deltaY /= 40;\r\n }\r\n\r\n // Get a whole, normalized value for the deltas\r\n delta = Math[delta >= 1 ? 'floor' : 'ceil'](delta / lowestDelta);\r\n deltaX = Math[deltaX >= 1 ? 'floor' : 'ceil'](deltaX / lowestDelta);\r\n deltaY = Math[deltaY >= 1 ? 'floor' : 'ceil'](deltaY / lowestDelta);\r\n\r\n // Normalise offsetX and offsetY properties\r\n if (special.settings.normalizeOffset && this.getBoundingClientRect) {\r\n var boundingRect = this.getBoundingClientRect();\r\n offsetX = event.clientX - boundingRect.left;\r\n offsetY = event.clientY - boundingRect.top;\r\n }\r\n\r\n // Add information to the event object\r\n event.deltaX = deltaX;\r\n event.deltaY = deltaY;\r\n event.deltaFactor = lowestDelta;\r\n event.offsetX = offsetX;\r\n event.offsetY = offsetY;\r\n // Go ahead and set deltaMode to 0 since we converted to pixels\r\n // Although this is a little odd since we overwrite the deltaX/Y\r\n // properties with normalized deltas.\r\n event.deltaMode = 0;\r\n\r\n // Add event and delta to the front of the arguments\r\n args.unshift(event, delta, deltaX, deltaY);\r\n\r\n // Clearout lowestDelta after sometime to better\r\n // handle multiple device types that give different\r\n // a different lowestDelta\r\n // Ex: trackpad = 3 and mouse wheel = 120\r\n if (nullLowestDeltaTimeout) {\r\n clearTimeout(nullLowestDeltaTimeout);\r\n }\r\n nullLowestDeltaTimeout = setTimeout(nullLowestDelta, 200);\r\n\r\n return ($.event.dispatch || $.event.handle).apply(this, args);\r\n }\r\n\r\n function nullLowestDelta() {\r\n lowestDelta = null;\r\n }\r\n\r\n function shouldAdjustOldDeltas(orgEvent, absDelta) {\r\n // If this is an older event and the delta is divisable by 120,\r\n // then we are assuming that the browser is treating this as an\r\n // older mouse wheel event and that we should divide the deltas\r\n // by 40 to try and get a more usable deltaFactor.\r\n // Side note, this actually impacts the reported scroll distance\r\n // in older browsers and can cause scrolling to be slower than native.\r\n // Turn this off by setting $.event.special.mousewheel.settings.adjustOldDeltas to false.\r\n return special.settings.adjustOldDeltas && orgEvent.type === 'mousewheel' && absDelta % 120 === 0;\r\n }\r\n\r\n}));\r\n\n\n\n// WEBPACK FOOTER //\n// ./src/static/scripts/plugins/jquery.mousewheel.js","/*\r\n== malihu jquery custom scrollbar plugin ==\r\nVersion: 3.1.5\r\nPlugin URI: http://manos.malihu.gr/jquery-custom-content-scroller\r\nAuthor: malihu\r\nAuthor URI: http://manos.malihu.gr\r\nLicense: MIT License (MIT)\r\n*/\r\n\r\n/*\r\nCopyright Manos Malihutsakis (email: manos@malihu.gr)\r\n\r\nPermission is hereby granted, free of charge, to any person obtaining a copy\r\nof this software and associated documentation files (the \"Software\"), to deal\r\nin the Software without restriction, including without limitation the rights\r\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\r\ncopies of the Software, and to permit persons to whom the Software is\r\nfurnished to do so, subject to the following conditions:\r\n\r\nThe above copyright notice and this permission notice shall be included in\r\nall copies or substantial portions of the Software.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\r\nTHE SOFTWARE.\r\n*/\r\n\r\n/*\r\nThe code below is fairly long, fully commented and should be normally used in development.\r\nFor production, use either the minified jquery.mCustomScrollbar.min.js script or\r\nthe production-ready jquery.mCustomScrollbar.concat.min.js which contains the plugin\r\nand dependencies (minified).\r\n*/\r\n\r\n(function (factory) {\r\n if (typeof define === \"function\" && define.amd) {\r\n define([\"jquery\"], factory);\r\n } else if (typeof module !== \"undefined\" && module.exports) {\r\n module.exports = factory;\r\n } else {\r\n factory(jQuery, window, document);\r\n }\r\n}(function ($) {\r\n (function (init) {\r\n var _rjs = typeof define === \"function\" && define.amd, /* RequireJS */\r\n _njs = typeof module !== \"undefined\" && module.exports, /* NodeJS */\r\n _dlp = (\"https:\" == document.location.protocol) ? \"https:\" : \"http:\", /* location protocol */\r\n _url = \"cdnjs.cloudflare.com/ajax/libs/jquery-mousewheel/3.1.13/jquery.mousewheel.min.js\";\r\n if (!_rjs) {\r\n if (_njs) {\r\n require(\"jquery-mousewheel\")($);\r\n } else {\r\n /* load jquery-mousewheel plugin (via CDN) if it's not present or not loaded via RequireJS\r\n\t\t\t(works when mCustomScrollbar fn is called on window load) */\r\n $.event.special.mousewheel || $(\"head\").append(decodeURI(\"%3Cscript src=\" + _dlp + \"//\" + _url + \"%3E%3C/script%3E\"));\r\n }\r\n }\r\n init();\r\n }(function () {\r\n\r\n /*\r\n\t----------------------------------------\r\n\tPLUGIN NAMESPACE, PREFIX, DEFAULT SELECTOR(S)\r\n\t----------------------------------------\r\n\t*/\r\n\r\n var pluginNS = \"mCustomScrollbar\",\r\n pluginPfx = \"mCS\",\r\n defaultSelector = \".mCustomScrollbar\",\r\n\r\n\r\n /*\r\n\t----------------------------------------\r\n\tDEFAULT OPTIONS\r\n\t----------------------------------------\r\n\t*/\r\n\r\n defaults = {\r\n /*\r\n\t\t\tset element/content width/height programmatically\r\n\t\t\tvalues: boolean, pixels, percentage\r\n\t\t\t\toption\t\t\t\t\t\tdefault\r\n\t\t\t\t-------------------------------------\r\n\t\t\t\tsetWidth\t\t\t\t\tfalse\r\n\t\t\t\tsetHeight\t\t\t\t\tfalse\r\n\t\t\t*/\r\n /*\r\n\t\t\tset the initial css top property of content\r\n\t\t\tvalues: string (e.g. \"-100px\", \"10%\" etc.)\r\n\t\t\t*/\r\n setTop: 0,\r\n /*\r\n\t\t\tset the initial css left property of content\r\n\t\t\tvalues: string (e.g. \"-100px\", \"10%\" etc.)\r\n\t\t\t*/\r\n setLeft: 0,\r\n /*\r\n\t\t\tscrollbar axis (vertical and/or horizontal scrollbars)\r\n\t\t\tvalues (string): \"y\", \"x\", \"yx\"\r\n\t\t\t*/\r\n axis: \"y\",\r\n /*\r\n\t\t\tposition of scrollbar relative to content\r\n\t\t\tvalues (string): \"inside\", \"outside\" (\"outside\" requires elements with position:relative)\r\n\t\t\t*/\r\n scrollbarPosition: \"inside\",\r\n /*\r\n\t\t\tscrolling inertia\r\n\t\t\tvalues: integer (milliseconds)\r\n\t\t\t*/\r\n scrollInertia: 950,\r\n /*\r\n\t\t\tauto-adjust scrollbar dragger length\r\n\t\t\tvalues: boolean\r\n\t\t\t*/\r\n autoDraggerLength: true,\r\n /*\r\n\t\t\tauto-hide scrollbar when idle\r\n\t\t\tvalues: boolean\r\n\t\t\t\toption\t\t\t\t\t\tdefault\r\n\t\t\t\t-------------------------------------\r\n\t\t\t\tautoHideScrollbar\t\t\tfalse\r\n\t\t\t*/\r\n /*\r\n\t\t\tauto-expands scrollbar on mouse-over and dragging\r\n\t\t\tvalues: boolean\r\n\t\t\t\toption\t\t\t\t\t\tdefault\r\n\t\t\t\t-------------------------------------\r\n\t\t\t\tautoExpandScrollbar\t\t\tfalse\r\n\t\t\t*/\r\n /*\r\n\t\t\talways show scrollbar, even when there's nothing to scroll\r\n\t\t\tvalues: integer (0=disable, 1=always show dragger rail and buttons, 2=always show dragger rail, dragger and buttons), boolean\r\n\t\t\t*/\r\n alwaysShowScrollbar: 0,\r\n /*\r\n\t\t\tscrolling always snaps to a multiple of this number in pixels\r\n\t\t\tvalues: integer, array ([y,x])\r\n\t\t\t\toption\t\t\t\t\t\tdefault\r\n\t\t\t\t-------------------------------------\r\n\t\t\t\tsnapAmount\t\t\t\t\tnull\r\n\t\t\t*/\r\n /*\r\n\t\t\twhen snapping, snap with this number in pixels as an offset\r\n\t\t\tvalues: integer\r\n\t\t\t*/\r\n snapOffset: 0,\r\n /*\r\n\t\t\tmouse-wheel scrolling\r\n\t\t\t*/\r\n mouseWheel: {\r\n /*\r\n\t\t\t\tenable mouse-wheel scrolling\r\n\t\t\t\tvalues: boolean\r\n\t\t\t\t*/\r\n enable: true,\r\n /*\r\n\t\t\t\tscrolling amount in pixels\r\n\t\t\t\tvalues: \"auto\", integer\r\n\t\t\t\t*/\r\n scrollAmount: \"auto\",\r\n /*\r\n\t\t\t\tmouse-wheel scrolling axis\r\n\t\t\t\tthe default scrolling direction when both vertical and horizontal scrollbars are present\r\n\t\t\t\tvalues (string): \"y\", \"x\"\r\n\t\t\t\t*/\r\n axis: \"y\",\r\n /*\r\n\t\t\t\tprevent the default behaviour which automatically scrolls the parent element(s) when end of scrolling is reached\r\n\t\t\t\tvalues: boolean\r\n\t\t\t\t\toption\t\t\t\t\t\tdefault\r\n\t\t\t\t\t-------------------------------------\r\n\t\t\t\t\tpreventDefault\t\t\t\tnull\r\n\t\t\t\t*/\r\n /*\r\n\t\t\t\tthe reported mouse-wheel delta value. The number of lines (translated to pixels) one wheel notch scrolls.\r\n\t\t\t\tvalues: \"auto\", integer\r\n\t\t\t\t\"auto\" uses the default OS/browser value\r\n\t\t\t\t*/\r\n deltaFactor: \"auto\",\r\n /*\r\n\t\t\t\tnormalize mouse-wheel delta to -1 or 1 (disables mouse-wheel acceleration)\r\n\t\t\t\tvalues: boolean\r\n\t\t\t\t\toption\t\t\t\t\t\tdefault\r\n\t\t\t\t\t-------------------------------------\r\n\t\t\t\t\tnormalizeDelta\t\t\t\tnull\r\n\t\t\t\t*/\r\n /*\r\n\t\t\t\tinvert mouse-wheel scrolling direction\r\n\t\t\t\tvalues: boolean\r\n\t\t\t\t\toption\t\t\t\t\t\tdefault\r\n\t\t\t\t\t-------------------------------------\r\n\t\t\t\t\tinvert\t\t\t\t\t\tnull\r\n\t\t\t\t*/\r\n /*\r\n\t\t\t\tthe tags that disable mouse-wheel when cursor is over them\r\n\t\t\t\t*/\r\n disableOver: [\"select\", \"option\", \"keygen\", \"datalist\", \"textarea\"]\r\n },\r\n /*\r\n\t\t\tscrollbar buttons\r\n\t\t\t*/\r\n scrollButtons: {\r\n /*\r\n\t\t\t\tenable scrollbar buttons\r\n\t\t\t\tvalues: boolean\r\n\t\t\t\t\toption\t\t\t\t\t\tdefault\r\n\t\t\t\t\t-------------------------------------\r\n\t\t\t\t\tenable\t\t\t\t\t\tnull\r\n\t\t\t\t*/\r\n /*\r\n\t\t\t\tscrollbar buttons scrolling type\r\n\t\t\t\tvalues (string): \"stepless\", \"stepped\"\r\n\t\t\t\t*/\r\n scrollType: \"stepless\",\r\n /*\r\n\t\t\t\tscrolling amount in pixels\r\n\t\t\t\tvalues: \"auto\", integer\r\n\t\t\t\t*/\r\n scrollAmount: \"auto\"\r\n /*\r\n\t\t\t\ttabindex of the scrollbar buttons\r\n\t\t\t\tvalues: false, integer\r\n\t\t\t\t\toption\t\t\t\t\t\tdefault\r\n\t\t\t\t\t-------------------------------------\r\n\t\t\t\t\ttabindex\t\t\t\t\tnull\r\n\t\t\t\t*/\r\n },\r\n /*\r\n\t\t\tkeyboard scrolling\r\n\t\t\t*/\r\n keyboard: {\r\n /*\r\n\t\t\t\tenable scrolling via keyboard\r\n\t\t\t\tvalues: boolean\r\n\t\t\t\t*/\r\n enable: true,\r\n /*\r\n\t\t\t\tkeyboard scrolling type\r\n\t\t\t\tvalues (string): \"stepless\", \"stepped\"\r\n\t\t\t\t*/\r\n scrollType: \"stepless\",\r\n /*\r\n\t\t\t\tscrolling amount in pixels\r\n\t\t\t\tvalues: \"auto\", integer\r\n\t\t\t\t*/\r\n scrollAmount: \"auto\"\r\n },\r\n /*\r\n\t\t\tenable content touch-swipe scrolling\r\n\t\t\tvalues: boolean, integer, string (number)\r\n\t\t\tinteger values define the axis-specific minimum amount required for scrolling momentum\r\n\t\t\t*/\r\n contentTouchScroll: 25,\r\n /*\r\n\t\t\tenable/disable document (default) touch-swipe scrolling\r\n\t\t\t*/\r\n documentTouchScroll: true,\r\n /*\r\n\t\t\tadvanced option parameters\r\n\t\t\t*/\r\n advanced: {\r\n /*\r\n\t\t\t\tauto-expand content horizontally (for \"x\" or \"yx\" axis)\r\n\t\t\t\tvalues: boolean, integer (the value 2 forces the non scrollHeight/scrollWidth method, the value 3 forces the scrollHeight/scrollWidth method)\r\n\t\t\t\t\toption\t\t\t\t\t\tdefault\r\n\t\t\t\t\t-------------------------------------\r\n\t\t\t\t\tautoExpandHorizontalScroll\tnull\r\n\t\t\t\t*/\r\n /*\r\n\t\t\t\tauto-scroll to elements with focus\r\n\t\t\t\t*/\r\n autoScrollOnFocus: \"input,textarea,select,button,datalist,keygen,a[tabindex],area,object,[contenteditable='true']\",\r\n /*\r\n\t\t\t\tauto-update scrollbars on content, element or viewport resize\r\n\t\t\t\tshould be true for fluid layouts/elements, adding/removing content dynamically, hiding/showing elements, content with images etc.\r\n\t\t\t\tvalues: boolean\r\n\t\t\t\t*/\r\n updateOnContentResize: true,\r\n /*\r\n\t\t\t\tauto-update scrollbars each time each image inside the element is fully loaded\r\n\t\t\t\tvalues: \"auto\", boolean\r\n\t\t\t\t*/\r\n updateOnImageLoad: \"auto\",\r\n /*\r\n\t\t\t\tauto-update scrollbars based on the amount and size changes of specific selectors\r\n\t\t\t\tuseful when you need to update the scrollbar(s) automatically, each time a type of element is added, removed or changes its size\r\n\t\t\t\tvalues: boolean, string (e.g. \"ul li\" will auto-update scrollbars each time list-items inside the element are changed)\r\n\t\t\t\ta value of true (boolean) will auto-update scrollbars each time any element is changed\r\n\t\t\t\t\toption\t\t\t\t\t\tdefault\r\n\t\t\t\t\t-------------------------------------\r\n\t\t\t\t\tupdateOnSelectorChange\t\tnull\r\n\t\t\t\t*/\r\n /*\r\n\t\t\t\textra selectors that'll allow scrollbar dragging upon mousemove/up, pointermove/up, touchend etc. (e.g. \"selector-1, selector-2\")\r\n\t\t\t\t\toption\t\t\t\t\t\tdefault\r\n\t\t\t\t\t-------------------------------------\r\n\t\t\t\t\textraDraggableSelectors\t\tnull\r\n\t\t\t\t*/\r\n /*\r\n\t\t\t\textra selectors that'll release scrollbar dragging upon mouseup, pointerup, touchend etc. (e.g. \"selector-1, selector-2\")\r\n\t\t\t\t\toption\t\t\t\t\t\tdefault\r\n\t\t\t\t\t-------------------------------------\r\n\t\t\t\t\treleaseDraggableSelectors\tnull\r\n\t\t\t\t*/\r\n /*\r\n\t\t\t\tauto-update timeout\r\n\t\t\t\tvalues: integer (milliseconds)\r\n\t\t\t\t*/\r\n autoUpdateTimeout: 60\r\n },\r\n /*\r\n\t\t\tscrollbar theme\r\n\t\t\tvalues: string (see CSS/plugin URI for a list of ready-to-use themes)\r\n\t\t\t*/\r\n theme: \"light\",\r\n /*\r\n\t\t\tuser defined callback functions\r\n\t\t\t*/\r\n callbacks: {\r\n /*\r\n\t\t\t\tAvailable callbacks:\r\n\t\t\t\t\tcallback\t\t\t\t\tdefault\r\n\t\t\t\t\t-------------------------------------\r\n\t\t\t\t\tonCreate\t\t\t\t\tnull\r\n\t\t\t\t\tonInit\t\t\t\t\t\tnull\r\n\t\t\t\t\tonScrollStart\t\t\t\tnull\r\n\t\t\t\t\tonScroll\t\t\t\t\tnull\r\n\t\t\t\t\tonTotalScroll\t\t\t\tnull\r\n\t\t\t\t\tonTotalScrollBack\t\t\tnull\r\n\t\t\t\t\twhileScrolling\t\t\t\tnull\r\n\t\t\t\t\tonOverflowY\t\t\t\t\tnull\r\n\t\t\t\t\tonOverflowX\t\t\t\t\tnull\r\n\t\t\t\t\tonOverflowYNone\t\t\t\tnull\r\n\t\t\t\t\tonOverflowXNone\t\t\t\tnull\r\n\t\t\t\t\tonImageLoad\t\t\t\t\tnull\r\n\t\t\t\t\tonSelectorChange\t\t\tnull\r\n\t\t\t\t\tonBeforeUpdate\t\t\t\tnull\r\n\t\t\t\t\tonUpdate\t\t\t\t\tnull\r\n\t\t\t\t*/\r\n onTotalScrollOffset: 0,\r\n onTotalScrollBackOffset: 0,\r\n alwaysTriggerOffsets: true\r\n }\r\n /*\r\n\t\t\tadd scrollbar(s) on all elements matching the current selector, now and in the future\r\n\t\t\tvalues: boolean, string\r\n\t\t\tstring values: \"on\" (enable), \"once\" (disable after first invocation), \"off\" (disable)\r\n\t\t\tliveSelector values: string (selector)\r\n\t\t\t\toption\t\t\t\t\t\tdefault\r\n\t\t\t\t-------------------------------------\r\n\t\t\t\tlive\t\t\t\t\t\tfalse\r\n\t\t\t\tliveSelector\t\t\t\tnull\r\n\t\t\t*/\r\n },\r\n\r\n\r\n /*\r\n\t----------------------------------------\r\n\tVARS, CONSTANTS\r\n\t----------------------------------------\r\n\t*/\r\n\r\n totalInstances = 0, /* plugin instances amount */\r\n liveTimers = {}, /* live option timers */\r\n oldIE = (window.attachEvent && !window.addEventListener) ? 1 : 0, /* detect IE < 9 */\r\n touchActive = false, touchable, /* global touch vars (for touch and pointer events) */\r\n /* general plugin classes */\r\n classes = [\r\n \"mCSB_dragger_onDrag\", \"mCSB_scrollTools_onDrag\", \"mCS_img_loaded\", \"mCS_disabled\", \"mCS_destroyed\", \"mCS_no_scrollbar\",\r\n \"mCS-autoHide\", \"mCS-dir-rtl\", \"mCS_no_scrollbar_y\", \"mCS_no_scrollbar_x\", \"mCS_y_hidden\", \"mCS_x_hidden\", \"mCSB_draggerContainer\",\r\n \"mCSB_buttonUp\", \"mCSB_buttonDown\", \"mCSB_buttonLeft\", \"mCSB_buttonRight\"\r\n ],\r\n\r\n\r\n /*\r\n\t----------------------------------------\r\n\tMETHODS\r\n\t----------------------------------------\r\n\t*/\r\n\r\n methods = {\r\n\r\n /*\r\n\t\t\tplugin initialization method\r\n\t\t\tcreates the scrollbar(s), plugin data object and options\r\n\t\t\t----------------------------------------\r\n\t\t\t*/\r\n\r\n init: function (options) {\r\n\r\n var options = $.extend(true, {}, defaults, options),\r\n selector = _selector.call(this);\r\n /* validate selector */\r\n\r\n /*\r\n\t\t\t\tif live option is enabled, monitor for elements matching the current selector and\r\n\t\t\t\tapply scrollbar(s) when found (now and in the future)\r\n\t\t\t\t*/\r\n if (options.live) {\r\n var liveSelector = options.liveSelector || this.selector || defaultSelector, /* live selector(s) */\r\n $liveSelector = $(liveSelector);\r\n /* live selector(s) as jquery object */\r\n if (options.live === \"off\") {\r\n /*\r\n\t\t\t\t\t\tdisable live if requested\r\n\t\t\t\t\t\tusage: $(selector).mCustomScrollbar({live:\"off\"});\r\n\t\t\t\t\t\t*/\r\n removeLiveTimers(liveSelector);\r\n return;\r\n }\r\n liveTimers[liveSelector] = setTimeout(function () {\r\n /* call mCustomScrollbar fn on live selector(s) every half-second */\r\n $liveSelector.mCustomScrollbar(options);\r\n if (options.live === \"once\" && $liveSelector.length) {\r\n /* disable live after first invocation */\r\n removeLiveTimers(liveSelector);\r\n }\r\n }, 500);\r\n } else {\r\n removeLiveTimers(liveSelector);\r\n }\r\n\r\n /* options backward compatibility (for versions < 3.0.0) and normalization */\r\n options.setWidth = (options.set_width) ? options.set_width : options.setWidth;\r\n options.setHeight = (options.set_height) ? options.set_height : options.setHeight;\r\n options.axis = (options.horizontalScroll) ? \"x\" : _findAxis(options.axis);\r\n options.scrollInertia = options.scrollInertia > 0 && options.scrollInertia < 17 ? 17 : options.scrollInertia;\r\n if (typeof options.mouseWheel !== \"object\" && options.mouseWheel == true) { /* old school mouseWheel option (non-object) */\r\n options.mouseWheel = {\r\n enable: true,\r\n scrollAmount: \"auto\",\r\n axis: \"y\",\r\n preventDefault: false,\r\n deltaFactor: \"auto\",\r\n normalizeDelta: false,\r\n invert: false\r\n }\r\n }\r\n options.mouseWheel.scrollAmount = !options.mouseWheelPixels ? options.mouseWheel.scrollAmount : options.mouseWheelPixels;\r\n options.mouseWheel.normalizeDelta = !options.advanced.normalizeMouseWheelDelta ? options.mouseWheel.normalizeDelta : options.advanced.normalizeMouseWheelDelta;\r\n options.scrollButtons.scrollType = _findScrollButtonsType(options.scrollButtons.scrollType);\r\n\r\n _theme(options);\r\n /* theme-specific options */\r\n\r\n /* plugin constructor */\r\n return $(selector).each(function () {\r\n\r\n var $this = $(this);\r\n\r\n if (!$this.data(pluginPfx)) { /* prevent multiple instantiations */\r\n\r\n /* store options and create objects in jquery data */\r\n $this.data(pluginPfx, {\r\n idx: ++totalInstances, /* instance index */\r\n opt: options, /* options */\r\n scrollRatio: {y: null, x: null}, /* scrollbar to content ratio */\r\n overflowed: null, /* overflowed axis */\r\n contentReset: {y: null, x: null}, /* object to check when content resets */\r\n bindEvents: false, /* object to check if events are bound */\r\n tweenRunning: false, /* object to check if tween is running */\r\n sequential: {}, /* sequential scrolling object */\r\n langDir: $this.css(\"direction\"), /* detect/store direction (ltr or rtl) */\r\n cbOffsets: null, /* object to check whether callback offsets always trigger */\r\n /*\r\n\t\t\t\t\t\t\tobject to check how scrolling events where last triggered\r\n\t\t\t\t\t\t\t\"internal\" (default - triggered by this script), \"external\" (triggered by other scripts, e.g. via scrollTo method)\r\n\t\t\t\t\t\t\tusage: object.data(\"mCS\").trigger\r\n\t\t\t\t\t\t\t*/\r\n trigger: null,\r\n /*\r\n\t\t\t\t\t\t\tobject to check for changes in elements in order to call the update method automatically\r\n\t\t\t\t\t\t\t*/\r\n poll: {size: {o: 0, n: 0}, img: {o: 0, n: 0}, change: {o: 0, n: 0}}\r\n });\r\n\r\n var d = $this.data(pluginPfx), o = d.opt,\r\n /* HTML data attributes */\r\n htmlDataAxis = $this.data(\"mcs-axis\"), htmlDataSbPos = $this.data(\"mcs-scrollbar-position\"),\r\n htmlDataTheme = $this.data(\"mcs-theme\");\r\n\r\n if (htmlDataAxis) {\r\n o.axis = htmlDataAxis;\r\n }\r\n /* usage example: data-mcs-axis=\"y\" */\r\n if (htmlDataSbPos) {\r\n o.scrollbarPosition = htmlDataSbPos;\r\n }\r\n /* usage example: data-mcs-scrollbar-position=\"outside\" */\r\n if (htmlDataTheme) { /* usage example: data-mcs-theme=\"minimal\" */\r\n o.theme = htmlDataTheme;\r\n _theme(o);\r\n /* theme-specific options */\r\n }\r\n\r\n _pluginMarkup.call(this);\r\n /* add plugin markup */\r\n\r\n if (d && o.callbacks.onCreate && typeof o.callbacks.onCreate === \"function\") {\r\n o.callbacks.onCreate.call(this);\r\n }\r\n /* callbacks: onCreate */\r\n\r\n $(\"#mCSB_\" + d.idx + \"_container img:not(.\" + classes[2] + \")\").addClass(classes[2]);\r\n /* flag loaded images */\r\n\r\n methods.update.call(null, $this);\r\n /* call the update method */\r\n\r\n }\r\n\r\n });\r\n\r\n },\r\n /* ---------------------------------------- */\r\n\r\n\r\n\r\n /*\r\n\t\t\tplugin update method\r\n\t\t\tupdates content and scrollbar(s) values, events and status\r\n\t\t\t----------------------------------------\r\n\t\t\tusage: $(selector).mCustomScrollbar(\"update\");\r\n\t\t\t*/\r\n\r\n update: function (el, cb) {\r\n\r\n var selector = el || _selector.call(this);\r\n /* validate selector */\r\n\r\n return $(selector).each(function () {\r\n\r\n var $this = $(this);\r\n\r\n if ($this.data(pluginPfx)) { /* check if plugin has initialized */\r\n\r\n var d = $this.data(pluginPfx), o = d.opt,\r\n mCSB_container = $(\"#mCSB_\" + d.idx + \"_container\"),\r\n mCustomScrollBox = $(\"#mCSB_\" + d.idx),\r\n mCSB_dragger = [$(\"#mCSB_\" + d.idx + \"_dragger_vertical\"), $(\"#mCSB_\" + d.idx + \"_dragger_horizontal\")];\r\n\r\n if (!mCSB_container.length) {\r\n return;\r\n }\r\n\r\n if (d.tweenRunning) {\r\n _stop($this);\r\n }\r\n /* stop any running tweens while updating */\r\n\r\n if (cb && d && o.callbacks.onBeforeUpdate && typeof o.callbacks.onBeforeUpdate === \"function\") {\r\n o.callbacks.onBeforeUpdate.call(this);\r\n }\r\n /* callbacks: onBeforeUpdate */\r\n\r\n /* if element was disabled or destroyed, remove class(es) */\r\n if ($this.hasClass(classes[3])) {\r\n $this.removeClass(classes[3]);\r\n }\r\n if ($this.hasClass(classes[4])) {\r\n $this.removeClass(classes[4]);\r\n }\r\n\r\n /* css flexbox fix, detect/set max-height */\r\n mCustomScrollBox.css(\"max-height\", \"none\");\r\n if (mCustomScrollBox.height() !== $this.height()) {\r\n mCustomScrollBox.css(\"max-height\", $this.height());\r\n }\r\n\r\n _expandContentHorizontally.call(this);\r\n /* expand content horizontally */\r\n\r\n if (o.axis !== \"y\" && !o.advanced.autoExpandHorizontalScroll) {\r\n mCSB_container.css(\"width\", _contentWidth(mCSB_container));\r\n }\r\n\r\n d.overflowed = _overflowed.call(this);\r\n /* determine if scrolling is required */\r\n\r\n _scrollbarVisibility.call(this);\r\n /* show/hide scrollbar(s) */\r\n\r\n /* auto-adjust scrollbar dragger length analogous to content */\r\n if (o.autoDraggerLength) {\r\n _setDraggerLength.call(this);\r\n }\r\n\r\n _scrollRatio.call(this);\r\n /* calculate and store scrollbar to content ratio */\r\n\r\n _bindEvents.call(this);\r\n /* bind scrollbar events */\r\n\r\n /* reset scrolling position and/or events */\r\n var to = [Math.abs(mCSB_container[0].offsetTop), Math.abs(mCSB_container[0].offsetLeft)];\r\n if (o.axis !== \"x\") { /* y/yx axis */\r\n if (!d.overflowed[0]) { /* y scrolling is not required */\r\n _resetContentPosition.call(this);\r\n /* reset content position */\r\n if (o.axis === \"y\") {\r\n _unbindEvents.call(this);\r\n } else if (o.axis === \"yx\" && d.overflowed[1]) {\r\n _scrollTo($this, to[1].toString(), {dir: \"x\", dur: 0, overwrite: \"none\"});\r\n }\r\n } else if (mCSB_dragger[0].height() > mCSB_dragger[0].parent().height()) {\r\n _resetContentPosition.call(this);\r\n /* reset content position */\r\n } else { /* y scrolling is required */\r\n _scrollTo($this, to[0].toString(), {dir: \"y\", dur: 0, overwrite: \"none\"});\r\n d.contentReset.y = null;\r\n }\r\n }\r\n if (o.axis !== \"y\") { /* x/yx axis */\r\n if (!d.overflowed[1]) { /* x scrolling is not required */\r\n _resetContentPosition.call(this);\r\n /* reset content position */\r\n if (o.axis === \"x\") {\r\n _unbindEvents.call(this);\r\n } else if (o.axis === \"yx\" && d.overflowed[0]) {\r\n _scrollTo($this, to[0].toString(), {dir: \"y\", dur: 0, overwrite: \"none\"});\r\n }\r\n } else if (mCSB_dragger[1].width() > mCSB_dragger[1].parent().width()) {\r\n _resetContentPosition.call(this);\r\n /* reset content position */\r\n } else { /* x scrolling is required */\r\n _scrollTo($this, to[1].toString(), {dir: \"x\", dur: 0, overwrite: \"none\"});\r\n d.contentReset.x = null;\r\n }\r\n }\r\n\r\n /* callbacks: onImageLoad, onSelectorChange, onUpdate */\r\n if (cb && d) {\r\n if (cb === 2 && o.callbacks.onImageLoad && typeof o.callbacks.onImageLoad === \"function\") {\r\n o.callbacks.onImageLoad.call(this);\r\n } else if (cb === 3 && o.callbacks.onSelectorChange && typeof o.callbacks.onSelectorChange === \"function\") {\r\n o.callbacks.onSelectorChange.call(this);\r\n } else if (o.callbacks.onUpdate && typeof o.callbacks.onUpdate === \"function\") {\r\n o.callbacks.onUpdate.call(this);\r\n }\r\n }\r\n\r\n _autoUpdate.call(this);\r\n /* initialize automatic updating (for dynamic content, fluid layouts etc.) */\r\n\r\n }\r\n\r\n });\r\n\r\n },\r\n /* ---------------------------------------- */\r\n\r\n\r\n\r\n /*\r\n\t\t\tplugin scrollTo method\r\n\t\t\ttriggers a scrolling event to a specific value\r\n\t\t\t----------------------------------------\r\n\t\t\tusage: $(selector).mCustomScrollbar(\"scrollTo\",value,options);\r\n\t\t\t*/\r\n\r\n scrollTo: function (val, options) {\r\n\r\n /* prevent silly things like $(selector).mCustomScrollbar(\"scrollTo\",undefined); */\r\n if (typeof val == \"undefined\" || val == null) {\r\n return;\r\n }\r\n\r\n var selector = _selector.call(this);\r\n /* validate selector */\r\n\r\n return $(selector).each(function () {\r\n\r\n var $this = $(this);\r\n\r\n if ($this.data(pluginPfx)) { /* check if plugin has initialized */\r\n\r\n var d = $this.data(pluginPfx), o = d.opt,\r\n /* method default options */\r\n methodDefaults = {\r\n trigger: \"external\", /* method is by default triggered externally (e.g. from other scripts) */\r\n scrollInertia: o.scrollInertia, /* scrolling inertia (animation duration) */\r\n scrollEasing: \"mcsEaseInOut\", /* animation easing */\r\n moveDragger: false, /* move dragger instead of content */\r\n timeout: 60, /* scroll-to delay */\r\n callbacks: true, /* enable/disable callbacks */\r\n onStart: true,\r\n onUpdate: true,\r\n onComplete: true\r\n },\r\n methodOptions = $.extend(true, {}, methodDefaults, options),\r\n to = _arr.call(this, val),\r\n dur = methodOptions.scrollInertia > 0 && methodOptions.scrollInertia < 17 ? 17 : methodOptions.scrollInertia;\r\n\r\n /* translate yx values to actual scroll-to positions */\r\n to[0] = _to.call(this, to[0], \"y\");\r\n to[1] = _to.call(this, to[1], \"x\");\r\n\r\n /*\r\n\t\t\t\t\t\tcheck if scroll-to value moves the dragger instead of content.\r\n\t\t\t\t\t\tOnly pixel values apply on dragger (e.g. 100, \"100px\", \"-=100\" etc.)\r\n\t\t\t\t\t\t*/\r\n if (methodOptions.moveDragger) {\r\n to[0] *= d.scrollRatio.y;\r\n to[1] *= d.scrollRatio.x;\r\n }\r\n\r\n methodOptions.dur = _isTabHidden() ? 0 : dur; //skip animations if browser tab is hidden\r\n\r\n setTimeout(function () {\r\n /* do the scrolling */\r\n if (to[0] !== null && typeof to[0] !== \"undefined\" && o.axis !== \"x\" && d.overflowed[0]) { /* scroll y */\r\n methodOptions.dir = \"y\";\r\n methodOptions.overwrite = \"all\";\r\n _scrollTo($this, to[0].toString(), methodOptions);\r\n }\r\n if (to[1] !== null && typeof to[1] !== \"undefined\" && o.axis !== \"y\" && d.overflowed[1]) { /* scroll x */\r\n methodOptions.dir = \"x\";\r\n methodOptions.overwrite = \"none\";\r\n _scrollTo($this, to[1].toString(), methodOptions);\r\n }\r\n }, methodOptions.timeout);\r\n\r\n }\r\n\r\n });\r\n\r\n },\r\n /* ---------------------------------------- */\r\n\r\n\r\n\r\n /*\r\n\t\t\tplugin stop method\r\n\t\t\tstops scrolling animation\r\n\t\t\t----------------------------------------\r\n\t\t\tusage: $(selector).mCustomScrollbar(\"stop\");\r\n\t\t\t*/\r\n stop: function () {\r\n\r\n var selector = _selector.call(this);\r\n /* validate selector */\r\n\r\n return $(selector).each(function () {\r\n\r\n var $this = $(this);\r\n\r\n if ($this.data(pluginPfx)) { /* check if plugin has initialized */\r\n\r\n _stop($this);\r\n\r\n }\r\n\r\n });\r\n\r\n },\r\n /* ---------------------------------------- */\r\n\r\n\r\n\r\n /*\r\n\t\t\tplugin disable method\r\n\t\t\ttemporarily disables the scrollbar(s)\r\n\t\t\t----------------------------------------\r\n\t\t\tusage: $(selector).mCustomScrollbar(\"disable\",reset);\r\n\t\t\treset (boolean): resets content position to 0\r\n\t\t\t*/\r\n disable: function (r) {\r\n\r\n var selector = _selector.call(this);\r\n /* validate selector */\r\n\r\n return $(selector).each(function () {\r\n\r\n var $this = $(this);\r\n\r\n if ($this.data(pluginPfx)) { /* check if plugin has initialized */\r\n\r\n var d = $this.data(pluginPfx);\r\n\r\n _autoUpdate.call(this, \"remove\");\r\n /* remove automatic updating */\r\n\r\n _unbindEvents.call(this);\r\n /* unbind events */\r\n\r\n if (r) {\r\n _resetContentPosition.call(this);\r\n }\r\n /* reset content position */\r\n\r\n _scrollbarVisibility.call(this, true);\r\n /* show/hide scrollbar(s) */\r\n\r\n $this.addClass(classes[3]);\r\n /* add disable class */\r\n\r\n }\r\n\r\n });\r\n\r\n },\r\n /* ---------------------------------------- */\r\n\r\n\r\n\r\n /*\r\n\t\t\tplugin destroy method\r\n\t\t\tcompletely removes the scrollbar(s) and returns the element to its original state\r\n\t\t\t----------------------------------------\r\n\t\t\tusage: $(selector).mCustomScrollbar(\"destroy\");\r\n\t\t\t*/\r\n destroy: function () {\r\n\r\n var selector = _selector.call(this);\r\n /* validate selector */\r\n\r\n return $(selector).each(function () {\r\n\r\n var $this = $(this);\r\n\r\n if ($this.data(pluginPfx)) { /* check if plugin has initialized */\r\n\r\n var d = $this.data(pluginPfx), o = d.opt,\r\n mCustomScrollBox = $(\"#mCSB_\" + d.idx),\r\n mCSB_container = $(\"#mCSB_\" + d.idx + \"_container\"),\r\n scrollbar = $(\".mCSB_\" + d.idx + \"_scrollbar\");\r\n\r\n if (o.live) {\r\n removeLiveTimers(o.liveSelector || $(selector).selector);\r\n }\r\n /* remove live timers */\r\n\r\n _autoUpdate.call(this, \"remove\");\r\n /* remove automatic updating */\r\n\r\n _unbindEvents.call(this);\r\n /* unbind events */\r\n\r\n _resetContentPosition.call(this);\r\n /* reset content position */\r\n\r\n $this.removeData(pluginPfx);\r\n /* remove plugin data object */\r\n\r\n _delete(this, \"mcs\");\r\n /* delete callbacks object */\r\n\r\n /* remove plugin markup */\r\n scrollbar.remove();\r\n /* remove scrollbar(s) first (those can be either inside or outside plugin's inner wrapper) */\r\n mCSB_container.find(\"img.\" + classes[2]).removeClass(classes[2]);\r\n /* remove loaded images flag */\r\n mCustomScrollBox.replaceWith(mCSB_container.contents());\r\n /* replace plugin's inner wrapper with the original content */\r\n /* remove plugin classes from the element and add destroy class */\r\n $this.removeClass(pluginNS + \" _\" + pluginPfx + \"_\" + d.idx + \" \" + classes[6] + \" \" + classes[7] + \" \" + classes[5] + \" \" + classes[3]).addClass(classes[4]);\r\n\r\n }\r\n\r\n });\r\n\r\n }\r\n /* ---------------------------------------- */\r\n\r\n },\r\n\r\n\r\n /*\r\n\t----------------------------------------\r\n\tFUNCTIONS\r\n\t----------------------------------------\r\n\t*/\r\n\r\n /* validates selector (if selector is invalid or undefined uses the default one) */\r\n _selector = function () {\r\n return (typeof $(this) !== \"object\" || $(this).length < 1) ? defaultSelector : this;\r\n },\r\n /* -------------------- */\r\n\r\n\r\n /* changes options according to theme */\r\n _theme = function (obj) {\r\n var fixedSizeScrollbarThemes = [\"rounded\", \"rounded-dark\", \"rounded-dots\", \"rounded-dots-dark\"],\r\n nonExpandedScrollbarThemes = [\"rounded-dots\", \"rounded-dots-dark\", \"3d\", \"3d-dark\", \"3d-thick\", \"3d-thick-dark\", \"inset\", \"inset-dark\", \"inset-2\", \"inset-2-dark\", \"inset-3\", \"inset-3-dark\"],\r\n disabledScrollButtonsThemes = [\"minimal\", \"minimal-dark\"],\r\n enabledAutoHideScrollbarThemes = [\"minimal\", \"minimal-dark\"],\r\n scrollbarPositionOutsideThemes = [\"minimal\", \"minimal-dark\"];\r\n obj.autoDraggerLength = $.inArray(obj.theme, fixedSizeScrollbarThemes) > -1 ? false : obj.autoDraggerLength;\r\n obj.autoExpandScrollbar = $.inArray(obj.theme, nonExpandedScrollbarThemes) > -1 ? false : obj.autoExpandScrollbar;\r\n obj.scrollButtons.enable = $.inArray(obj.theme, disabledScrollButtonsThemes) > -1 ? false : obj.scrollButtons.enable;\r\n obj.autoHideScrollbar = $.inArray(obj.theme, enabledAutoHideScrollbarThemes) > -1 ? true : obj.autoHideScrollbar;\r\n obj.scrollbarPosition = $.inArray(obj.theme, scrollbarPositionOutsideThemes) > -1 ? \"outside\" : obj.scrollbarPosition;\r\n },\r\n /* -------------------- */\r\n\r\n\r\n /* live option timers removal */\r\n removeLiveTimers = function (selector) {\r\n if (liveTimers[selector]) {\r\n clearTimeout(liveTimers[selector]);\r\n _delete(liveTimers, selector);\r\n }\r\n },\r\n /* -------------------- */\r\n\r\n\r\n /* normalizes axis option to valid values: \"y\", \"x\", \"yx\" */\r\n _findAxis = function (val) {\r\n return (val === \"yx\" || val === \"xy\" || val === \"auto\") ? \"yx\" : (val === \"x\" || val === \"horizontal\") ? \"x\" : \"y\";\r\n },\r\n /* -------------------- */\r\n\r\n\r\n /* normalizes scrollButtons.scrollType option to valid values: \"stepless\", \"stepped\" */\r\n _findScrollButtonsType = function (val) {\r\n return (val === \"stepped\" || val === \"pixels\" || val === \"step\" || val === \"click\") ? \"stepped\" : \"stepless\";\r\n },\r\n /* -------------------- */\r\n\r\n\r\n /* generates plugin markup */\r\n _pluginMarkup = function () {\r\n var $this = $(this), d = $this.data(pluginPfx), o = d.opt,\r\n expandClass = o.autoExpandScrollbar ? \" \" + classes[1] + \"_expand\" : \"\",\r\n scrollbar = [\"
\", \"
\"],\r\n wrapperClass = o.axis === \"yx\" ? \"mCSB_vertical_horizontal\" : o.axis === \"x\" ? \"mCSB_horizontal\" : \"mCSB_vertical\",\r\n scrollbars = o.axis === \"yx\" ? scrollbar[0] + scrollbar[1] : o.axis === \"x\" ? scrollbar[1] : scrollbar[0],\r\n contentWrapper = o.axis === \"yx\" ? \"
\" : \"\",\r\n autoHideClass = o.autoHideScrollbar ? \" \" + classes[6] : \"\",\r\n scrollbarDirClass = (o.axis !== \"x\" && d.langDir === \"rtl\") ? \" \" + classes[7] : \"\";\r\n if (o.setWidth) {\r\n $this.css(\"width\", o.setWidth);\r\n }\r\n /* set element width */\r\n if (o.setHeight) {\r\n $this.css(\"height\", o.setHeight);\r\n }\r\n /* set element height */\r\n o.setLeft = (o.axis !== \"y\" && d.langDir === \"rtl\") ? \"989999px\" : o.setLeft;\r\n /* adjust left position for rtl direction */\r\n $this.addClass(pluginNS + \" _\" + pluginPfx + \"_\" + d.idx + autoHideClass + scrollbarDirClass).wrapInner(\"
\");\r\n var mCustomScrollBox = $(\"#mCSB_\" + d.idx),\r\n mCSB_container = $(\"#mCSB_\" + d.idx + \"_container\");\r\n if (o.axis !== \"y\" && !o.advanced.autoExpandHorizontalScroll) {\r\n mCSB_container.css(\"width\", _contentWidth(mCSB_container));\r\n }\r\n if (o.scrollbarPosition === \"outside\") {\r\n if ($this.css(\"position\") === \"static\") { /* requires elements with non-static position */\r\n $this.css(\"position\", \"relative\");\r\n }\r\n $this.css(\"overflow\", \"visible\");\r\n mCustomScrollBox.addClass(\"mCSB_outside\").after(scrollbars);\r\n } else {\r\n mCustomScrollBox.addClass(\"mCSB_inside\").append(scrollbars);\r\n mCSB_container.wrap(contentWrapper);\r\n }\r\n _scrollButtons.call(this);\r\n /* add scrollbar buttons */\r\n /* minimum dragger length */\r\n var mCSB_dragger = [$(\"#mCSB_\" + d.idx + \"_dragger_vertical\"), $(\"#mCSB_\" + d.idx + \"_dragger_horizontal\")];\r\n mCSB_dragger[0].css(\"min-height\", mCSB_dragger[0].height());\r\n mCSB_dragger[1].css(\"min-width\", mCSB_dragger[1].width());\r\n },\r\n /* -------------------- */\r\n\r\n\r\n /* calculates content width */\r\n _contentWidth = function (el) {\r\n var val = [el[0].scrollWidth, Math.max.apply(Math, el.children().map(function () {\r\n return $(this).outerWidth(true);\r\n }).get())], w = el.parent().width();\r\n return val[0] > w ? val[0] : val[1] > w ? val[1] : \"100%\";\r\n },\r\n /* -------------------- */\r\n\r\n\r\n /* expands content horizontally */\r\n _expandContentHorizontally = function () {\r\n var $this = $(this), d = $this.data(pluginPfx), o = d.opt,\r\n mCSB_container = $(\"#mCSB_\" + d.idx + \"_container\");\r\n if (o.advanced.autoExpandHorizontalScroll && o.axis !== \"y\") {\r\n /* calculate scrollWidth */\r\n mCSB_container.css({\"width\": \"auto\", \"min-width\": 0, \"overflow-x\": \"scroll\"});\r\n var w = Math.ceil(mCSB_container[0].scrollWidth);\r\n if (o.advanced.autoExpandHorizontalScroll === 3 || (o.advanced.autoExpandHorizontalScroll !== 2 && w > mCSB_container.parent().width())) {\r\n mCSB_container.css({\"width\": w, \"min-width\": \"100%\", \"overflow-x\": \"inherit\"});\r\n } else {\r\n /*\r\n\t\t\t\t\twrap content with an infinite width div and set its position to absolute and width to auto.\r\n\t\t\t\t\tSetting width to auto before calculating the actual width is important!\r\n\t\t\t\t\tWe must let the browser set the width as browser zoom values are impossible to calculate.\r\n\t\t\t\t\t*/\r\n mCSB_container.css({\"overflow-x\": \"inherit\", \"position\": \"absolute\"})\r\n .wrap(\"
\")\r\n .css({\r\n /* set actual width, original position and un-wrap */\r\n /*\r\n\t\t\t\t\t\t\tget the exact width (with decimals) and then round-up.\r\n\t\t\t\t\t\t\tUsing jquery outerWidth() will round the width value which will mess up with inner elements that have non-integer width\r\n\t\t\t\t\t\t\t*/\r\n \"width\": (Math.ceil(mCSB_container[0].getBoundingClientRect().right + 0.4) - Math.floor(mCSB_container[0].getBoundingClientRect().left)),\r\n \"min-width\": \"100%\",\r\n \"position\": \"relative\"\r\n }).unwrap();\r\n }\r\n }\r\n },\r\n /* -------------------- */\r\n\r\n\r\n /* adds scrollbar buttons */\r\n _scrollButtons = function () {\r\n var $this = $(this), d = $this.data(pluginPfx), o = d.opt,\r\n mCSB_scrollTools = $(\".mCSB_\" + d.idx + \"_scrollbar:first\"),\r\n tabindex = !_isNumeric(o.scrollButtons.tabindex) ? \"\" : \"tabindex='\" + o.scrollButtons.tabindex + \"'\",\r\n btnHTML = [\r\n \"\",\r\n \"\",\r\n \"\",\r\n \"\"\r\n ],\r\n btn = [(o.axis === \"x\" ? btnHTML[2] : btnHTML[0]), (o.axis === \"x\" ? btnHTML[3] : btnHTML[1]), btnHTML[2], btnHTML[3]];\r\n if (o.scrollButtons.enable) {\r\n mCSB_scrollTools.prepend(btn[0]).append(btn[1]).next(\".mCSB_scrollTools\").prepend(btn[2]).append(btn[3]);\r\n }\r\n },\r\n /* -------------------- */\r\n\r\n\r\n /* auto-adjusts scrollbar dragger length */\r\n _setDraggerLength = function () {\r\n var $this = $(this), d = $this.data(pluginPfx),\r\n mCustomScrollBox = $(\"#mCSB_\" + d.idx),\r\n mCSB_container = $(\"#mCSB_\" + d.idx + \"_container\"),\r\n mCSB_dragger = [$(\"#mCSB_\" + d.idx + \"_dragger_vertical\"), $(\"#mCSB_\" + d.idx + \"_dragger_horizontal\")],\r\n ratio = [mCustomScrollBox.height() / mCSB_container.outerHeight(false), mCustomScrollBox.width() / mCSB_container.outerWidth(false)],\r\n l = [\r\n parseInt(mCSB_dragger[0].css(\"min-height\")), Math.round(ratio[0] * mCSB_dragger[0].parent().height()),\r\n parseInt(mCSB_dragger[1].css(\"min-width\")), Math.round(ratio[1] * mCSB_dragger[1].parent().width())\r\n ],\r\n h = oldIE && (l[1] < l[0]) ? l[0] : l[1], w = oldIE && (l[3] < l[2]) ? l[2] : l[3];\r\n mCSB_dragger[0].css({\r\n \"height\": h, \"max-height\": (mCSB_dragger[0].parent().height() - 10)\r\n }).find(\".mCSB_dragger_bar\").css({\"line-height\": l[0] + \"px\"});\r\n mCSB_dragger[1].css({\r\n \"width\": w, \"max-width\": (mCSB_dragger[1].parent().width() - 10)\r\n });\r\n },\r\n /* -------------------- */\r\n\r\n\r\n /* calculates scrollbar to content ratio */\r\n _scrollRatio = function () {\r\n var $this = $(this), d = $this.data(pluginPfx),\r\n mCustomScrollBox = $(\"#mCSB_\" + d.idx),\r\n mCSB_container = $(\"#mCSB_\" + d.idx + \"_container\"),\r\n mCSB_dragger = [$(\"#mCSB_\" + d.idx + \"_dragger_vertical\"), $(\"#mCSB_\" + d.idx + \"_dragger_horizontal\")],\r\n scrollAmount = [mCSB_container.outerHeight(false) - mCustomScrollBox.height(), mCSB_container.outerWidth(false) - mCustomScrollBox.width()],\r\n ratio = [\r\n scrollAmount[0] / (mCSB_dragger[0].parent().height() - mCSB_dragger[0].height()),\r\n scrollAmount[1] / (mCSB_dragger[1].parent().width() - mCSB_dragger[1].width())\r\n ];\r\n d.scrollRatio = {y: ratio[0], x: ratio[1]};\r\n },\r\n /* -------------------- */\r\n\r\n\r\n /* toggles scrolling classes */\r\n _onDragClasses = function (el, action, xpnd) {\r\n var expandClass = xpnd ? classes[0] + \"_expanded\" : \"\",\r\n scrollbar = el.closest(\".mCSB_scrollTools\");\r\n if (action === \"active\") {\r\n el.toggleClass(classes[0] + \" \" + expandClass);\r\n scrollbar.toggleClass(classes[1]);\r\n el[0]._draggable = el[0]._draggable ? 0 : 1;\r\n } else {\r\n if (!el[0]._draggable) {\r\n if (action === \"hide\") {\r\n el.removeClass(classes[0]);\r\n scrollbar.removeClass(classes[1]);\r\n } else {\r\n el.addClass(classes[0]);\r\n scrollbar.addClass(classes[1]);\r\n }\r\n }\r\n }\r\n },\r\n /* -------------------- */\r\n\r\n\r\n /* checks if content overflows its container to determine if scrolling is required */\r\n _overflowed = function () {\r\n var $this = $(this), d = $this.data(pluginPfx),\r\n mCustomScrollBox = $(\"#mCSB_\" + d.idx),\r\n mCSB_container = $(\"#mCSB_\" + d.idx + \"_container\"),\r\n contentHeight = d.overflowed == null ? mCSB_container.height() : mCSB_container.outerHeight(false),\r\n contentWidth = d.overflowed == null ? mCSB_container.width() : mCSB_container.outerWidth(false),\r\n h = mCSB_container[0].scrollHeight, w = mCSB_container[0].scrollWidth;\r\n if (h > contentHeight) {\r\n contentHeight = h;\r\n }\r\n if (w > contentWidth) {\r\n contentWidth = w;\r\n }\r\n return [contentHeight > mCustomScrollBox.height(), contentWidth > mCustomScrollBox.width()];\r\n },\r\n /* -------------------- */\r\n\r\n\r\n /* resets content position to 0 */\r\n _resetContentPosition = function () {\r\n var $this = $(this), d = $this.data(pluginPfx), o = d.opt,\r\n mCustomScrollBox = $(\"#mCSB_\" + d.idx),\r\n mCSB_container = $(\"#mCSB_\" + d.idx + \"_container\"),\r\n mCSB_dragger = [$(\"#mCSB_\" + d.idx + \"_dragger_vertical\"), $(\"#mCSB_\" + d.idx + \"_dragger_horizontal\")];\r\n _stop($this);\r\n /* stop any current scrolling before resetting */\r\n if ((o.axis !== \"x\" && !d.overflowed[0]) || (o.axis === \"y\" && d.overflowed[0])) { /* reset y */\r\n mCSB_dragger[0].add(mCSB_container).css(\"top\", 0);\r\n _scrollTo($this, \"_resetY\");\r\n }\r\n if ((o.axis !== \"y\" && !d.overflowed[1]) || (o.axis === \"x\" && d.overflowed[1])) { /* reset x */\r\n var cx = dx = 0;\r\n if (d.langDir === \"rtl\") { /* adjust left position for rtl direction */\r\n cx = mCustomScrollBox.width() - mCSB_container.outerWidth(false);\r\n dx = Math.abs(cx / d.scrollRatio.x);\r\n }\r\n mCSB_container.css(\"left\", cx);\r\n mCSB_dragger[1].css(\"left\", dx);\r\n _scrollTo($this, \"_resetX\");\r\n }\r\n },\r\n /* -------------------- */\r\n\r\n\r\n /* binds scrollbar events */\r\n _bindEvents = function () {\r\n var $this = $(this), d = $this.data(pluginPfx), o = d.opt;\r\n if (!d.bindEvents) { /* check if events are already bound */\r\n _draggable.call(this);\r\n if (o.contentTouchScroll) {\r\n _contentDraggable.call(this);\r\n }\r\n _selectable.call(this);\r\n if (o.mouseWheel.enable) { /* bind mousewheel fn when plugin is available */\r\n function _mwt() {\r\n mousewheelTimeout = setTimeout(function () {\r\n if (!$.event.special.mousewheel) {\r\n _mwt();\r\n } else {\r\n clearTimeout(mousewheelTimeout);\r\n _mousewheel.call($this[0]);\r\n }\r\n }, 100);\r\n }\r\n\r\n var mousewheelTimeout;\r\n _mwt();\r\n }\r\n _draggerRail.call(this);\r\n _wrapperScroll.call(this);\r\n if (o.advanced.autoScrollOnFocus) {\r\n _focus.call(this);\r\n }\r\n if (o.scrollButtons.enable) {\r\n _buttons.call(this);\r\n }\r\n if (o.keyboard.enable) {\r\n _keyboard.call(this);\r\n }\r\n d.bindEvents = true;\r\n }\r\n },\r\n /* -------------------- */\r\n\r\n\r\n /* unbinds scrollbar events */\r\n _unbindEvents = function () {\r\n var $this = $(this), d = $this.data(pluginPfx), o = d.opt,\r\n namespace = pluginPfx + \"_\" + d.idx,\r\n sb = \".mCSB_\" + d.idx + \"_scrollbar\",\r\n sel = $(\"#mCSB_\" + d.idx + \",#mCSB_\" + d.idx + \"_container,#mCSB_\" + d.idx + \"_container_wrapper,\" + sb + \" .\" + classes[12] + \",#mCSB_\" + d.idx + \"_dragger_vertical,#mCSB_\" + d.idx + \"_dragger_horizontal,\" + sb + \">a\"),\r\n mCSB_container = $(\"#mCSB_\" + d.idx + \"_container\");\r\n if (o.advanced.releaseDraggableSelectors) {\r\n sel.add($(o.advanced.releaseDraggableSelectors));\r\n }\r\n if (o.advanced.extraDraggableSelectors) {\r\n sel.add($(o.advanced.extraDraggableSelectors));\r\n }\r\n if (d.bindEvents) { /* check if events are bound */\r\n /* unbind namespaced events from document/selectors */\r\n $(document).add($(!_canAccessIFrame() || top.document)).unbind(\".\" + namespace);\r\n sel.each(function () {\r\n $(this).unbind(\".\" + namespace);\r\n });\r\n /* clear and delete timeouts/objects */\r\n clearTimeout($this[0]._focusTimeout);\r\n _delete($this[0], \"_focusTimeout\");\r\n clearTimeout(d.sequential.step);\r\n _delete(d.sequential, \"step\");\r\n clearTimeout(mCSB_container[0].onCompleteTimeout);\r\n _delete(mCSB_container[0], \"onCompleteTimeout\");\r\n d.bindEvents = false;\r\n }\r\n },\r\n /* -------------------- */\r\n\r\n\r\n /* toggles scrollbar visibility */\r\n _scrollbarVisibility = function (disabled) {\r\n var $this = $(this), d = $this.data(pluginPfx), o = d.opt,\r\n contentWrapper = $(\"#mCSB_\" + d.idx + \"_container_wrapper\"),\r\n content = contentWrapper.length ? contentWrapper : $(\"#mCSB_\" + d.idx + \"_container\"),\r\n scrollbar = [$(\"#mCSB_\" + d.idx + \"_scrollbar_vertical\"), $(\"#mCSB_\" + d.idx + \"_scrollbar_horizontal\")],\r\n mCSB_dragger = [scrollbar[0].find(\".mCSB_dragger\"), scrollbar[1].find(\".mCSB_dragger\")];\r\n if (o.axis !== \"x\") {\r\n if (d.overflowed[0] && !disabled) {\r\n scrollbar[0].add(mCSB_dragger[0]).add(scrollbar[0].children(\"a\")).css(\"display\", \"block\");\r\n content.removeClass(classes[8] + \" \" + classes[10]);\r\n } else {\r\n if (o.alwaysShowScrollbar) {\r\n if (o.alwaysShowScrollbar !== 2) {\r\n mCSB_dragger[0].css(\"display\", \"none\");\r\n }\r\n content.removeClass(classes[10]);\r\n } else {\r\n scrollbar[0].css(\"display\", \"none\");\r\n content.addClass(classes[10]);\r\n }\r\n content.addClass(classes[8]);\r\n }\r\n }\r\n if (o.axis !== \"y\") {\r\n if (d.overflowed[1] && !disabled) {\r\n scrollbar[1].add(mCSB_dragger[1]).add(scrollbar[1].children(\"a\")).css(\"display\", \"block\");\r\n content.removeClass(classes[9] + \" \" + classes[11]);\r\n } else {\r\n if (o.alwaysShowScrollbar) {\r\n if (o.alwaysShowScrollbar !== 2) {\r\n mCSB_dragger[1].css(\"display\", \"none\");\r\n }\r\n content.removeClass(classes[11]);\r\n } else {\r\n scrollbar[1].css(\"display\", \"none\");\r\n content.addClass(classes[11]);\r\n }\r\n content.addClass(classes[9]);\r\n }\r\n }\r\n if (!d.overflowed[0] && !d.overflowed[1]) {\r\n $this.addClass(classes[5]);\r\n } else {\r\n $this.removeClass(classes[5]);\r\n }\r\n },\r\n /* -------------------- */\r\n\r\n\r\n /* returns input coordinates of pointer, touch and mouse events (relative to document) */\r\n _coordinates = function (e) {\r\n var t = e.type,\r\n o = e.target.ownerDocument !== document && frameElement !== null ? [$(frameElement).offset().top, $(frameElement).offset().left] : null,\r\n io = _canAccessIFrame() && e.target.ownerDocument !== top.document && frameElement !== null ? [$(e.view.frameElement).offset().top, $(e.view.frameElement).offset().left] : [0, 0];\r\n switch (t) {\r\n case \"pointerdown\":\r\n case \"MSPointerDown\":\r\n case \"pointermove\":\r\n case \"MSPointerMove\":\r\n case \"pointerup\":\r\n case \"MSPointerUp\":\r\n return o ? [e.originalEvent.pageY - o[0] + io[0], e.originalEvent.pageX - o[1] + io[1], false] : [e.originalEvent.pageY, e.originalEvent.pageX, false];\r\n break;\r\n case \"touchstart\":\r\n case \"touchmove\":\r\n case \"touchend\":\r\n var touch = e.originalEvent.touches[0] || e.originalEvent.changedTouches[0],\r\n touches = e.originalEvent.touches.length || e.originalEvent.changedTouches.length;\r\n return e.target.ownerDocument !== document ? [touch.screenY, touch.screenX, touches > 1] : [touch.pageY, touch.pageX, touches > 1];\r\n break;\r\n default:\r\n return o ? [e.pageY - o[0] + io[0], e.pageX - o[1] + io[1], false] : [e.pageY, e.pageX, false];\r\n }\r\n },\r\n /* -------------------- */\r\n\r\n\r\n /*\r\n\t\tSCROLLBAR DRAG EVENTS\r\n\t\tscrolls content via scrollbar dragging\r\n\t\t*/\r\n _draggable = function () {\r\n var $this = $(this), d = $this.data(pluginPfx), o = d.opt,\r\n namespace = pluginPfx + \"_\" + d.idx,\r\n draggerId = [\"mCSB_\" + d.idx + \"_dragger_vertical\", \"mCSB_\" + d.idx + \"_dragger_horizontal\"],\r\n mCSB_container = $(\"#mCSB_\" + d.idx + \"_container\"),\r\n mCSB_dragger = $(\"#\" + draggerId[0] + \",#\" + draggerId[1]),\r\n draggable, dragY, dragX,\r\n rds = o.advanced.releaseDraggableSelectors ? mCSB_dragger.add($(o.advanced.releaseDraggableSelectors)) : mCSB_dragger,\r\n eds = o.advanced.extraDraggableSelectors ? $(!_canAccessIFrame() || top.document).add($(o.advanced.extraDraggableSelectors)) : $(!_canAccessIFrame() || top.document);\r\n mCSB_dragger.bind(\"contextmenu.\" + namespace, function (e) {\r\n e.preventDefault(); //prevent right click\r\n }).bind(\"mousedown.\" + namespace + \" touchstart.\" + namespace + \" pointerdown.\" + namespace + \" MSPointerDown.\" + namespace, function (e) {\r\n e.stopImmediatePropagation();\r\n e.preventDefault();\r\n if (!_mouseBtnLeft(e)) {\r\n return;\r\n }\r\n /* left mouse button only */\r\n touchActive = true;\r\n if (oldIE) {\r\n document.onselectstart = function () {\r\n return false;\r\n }\r\n }\r\n /* disable text selection for IE < 9 */\r\n _iframe.call(mCSB_container, false);\r\n /* enable scrollbar dragging over iframes by disabling their events */\r\n _stop($this);\r\n draggable = $(this);\r\n var offset = draggable.offset(), y = _coordinates(e)[0] - offset.top, x = _coordinates(e)[1] - offset.left,\r\n h = draggable.height() + offset.top, w = draggable.width() + offset.left;\r\n if (y < h && y > 0 && x < w && x > 0) {\r\n dragY = y;\r\n dragX = x;\r\n }\r\n _onDragClasses(draggable, \"active\", o.autoExpandScrollbar);\r\n }).bind(\"touchmove.\" + namespace, function (e) {\r\n e.stopImmediatePropagation();\r\n e.preventDefault();\r\n var offset = draggable.offset(), y = _coordinates(e)[0] - offset.top, x = _coordinates(e)[1] - offset.left;\r\n _drag(dragY, dragX, y, x);\r\n });\r\n $(document).add(eds).bind(\"mousemove.\" + namespace + \" pointermove.\" + namespace + \" MSPointerMove.\" + namespace, function (e) {\r\n if (draggable) {\r\n var offset = draggable.offset(), y = _coordinates(e)[0] - offset.top, x = _coordinates(e)[1] - offset.left;\r\n if (dragY === y && dragX === x) {\r\n return;\r\n }\r\n /* has it really moved? */\r\n _drag(dragY, dragX, y, x);\r\n }\r\n }).add(rds).bind(\"mouseup.\" + namespace + \" touchend.\" + namespace + \" pointerup.\" + namespace + \" MSPointerUp.\" + namespace, function (e) {\r\n if (draggable) {\r\n _onDragClasses(draggable, \"active\", o.autoExpandScrollbar);\r\n draggable = null;\r\n }\r\n touchActive = false;\r\n if (oldIE) {\r\n document.onselectstart = null;\r\n }\r\n /* enable text selection for IE < 9 */\r\n _iframe.call(mCSB_container, true);\r\n /* enable iframes events */\r\n });\r\n\r\n function _drag(dragY, dragX, y, x) {\r\n mCSB_container[0].idleTimer = o.scrollInertia < 233 ? 250 : 0;\r\n if (draggable.attr(\"id\") === draggerId[1]) {\r\n var dir = \"x\", to = ((draggable[0].offsetLeft - dragX) + x) * d.scrollRatio.x;\r\n } else {\r\n var dir = \"y\", to = ((draggable[0].offsetTop - dragY) + y) * d.scrollRatio.y;\r\n }\r\n _scrollTo($this, to.toString(), {dir: dir, drag: true});\r\n }\r\n },\r\n /* -------------------- */\r\n\r\n\r\n /*\r\n\t\tTOUCH SWIPE EVENTS\r\n\t\tscrolls content via touch swipe\r\n\t\tEmulates the native touch-swipe scrolling with momentum found in iOS, Android and WP devices\r\n\t\t*/\r\n _contentDraggable = function () {\r\n var $this = $(this), d = $this.data(pluginPfx), o = d.opt,\r\n namespace = pluginPfx + \"_\" + d.idx,\r\n mCustomScrollBox = $(\"#mCSB_\" + d.idx),\r\n mCSB_container = $(\"#mCSB_\" + d.idx + \"_container\"),\r\n mCSB_dragger = [$(\"#mCSB_\" + d.idx + \"_dragger_vertical\"), $(\"#mCSB_\" + d.idx + \"_dragger_horizontal\")],\r\n draggable, dragY, dragX, touchStartY, touchStartX, touchMoveY = [], touchMoveX = [], startTime, runningTime,\r\n endTime, distance, speed, amount,\r\n durA = 0, durB, overwrite = o.axis === \"yx\" ? \"none\" : \"all\", touchIntent = [], touchDrag, docDrag,\r\n iframe = mCSB_container.find(\"iframe\"),\r\n events = [\r\n \"touchstart.\" + namespace + \" pointerdown.\" + namespace + \" MSPointerDown.\" + namespace, //start\r\n \"touchmove.\" + namespace + \" pointermove.\" + namespace + \" MSPointerMove.\" + namespace, //move\r\n \"touchend.\" + namespace + \" pointerup.\" + namespace + \" MSPointerUp.\" + namespace //end\r\n ],\r\n touchAction = document.body.style.touchAction !== undefined && document.body.style.touchAction !== \"\";\r\n mCSB_container.bind(events[0], function (e) {\r\n _onTouchstart(e);\r\n }).bind(events[1], function (e) {\r\n _onTouchmove(e);\r\n });\r\n mCustomScrollBox.bind(events[0], function (e) {\r\n _onTouchstart2(e);\r\n }).bind(events[2], function (e) {\r\n _onTouchend(e);\r\n });\r\n if (iframe.length) {\r\n iframe.each(function () {\r\n $(this).bind(\"load\", function () {\r\n /* bind events on accessible iframes */\r\n if (_canAccessIFrame(this)) {\r\n $(this.contentDocument || this.contentWindow.document).bind(events[0], function (e) {\r\n _onTouchstart(e);\r\n _onTouchstart2(e);\r\n }).bind(events[1], function (e) {\r\n _onTouchmove(e);\r\n }).bind(events[2], function (e) {\r\n _onTouchend(e);\r\n });\r\n }\r\n });\r\n });\r\n }\r\n\r\n function _onTouchstart(e) {\r\n if (!_pointerTouch(e) || touchActive || _coordinates(e)[2]) {\r\n touchable = 0;\r\n return;\r\n }\r\n touchable = 1;\r\n touchDrag = 0;\r\n docDrag = 0;\r\n draggable = 1;\r\n $this.removeClass(\"mCS_touch_action\");\r\n var offset = mCSB_container.offset();\r\n dragY = _coordinates(e)[0] - offset.top;\r\n dragX = _coordinates(e)[1] - offset.left;\r\n touchIntent = [_coordinates(e)[0], _coordinates(e)[1]];\r\n }\r\n\r\n function _onTouchmove(e) {\r\n if (!_pointerTouch(e) || touchActive || _coordinates(e)[2]) {\r\n return;\r\n }\r\n if (!o.documentTouchScroll) {\r\n e.preventDefault();\r\n }\r\n e.stopImmediatePropagation();\r\n if (docDrag && !touchDrag) {\r\n return;\r\n }\r\n if (draggable) {\r\n runningTime = _getTime();\r\n var offset = mCustomScrollBox.offset(), y = _coordinates(e)[0] - offset.top,\r\n x = _coordinates(e)[1] - offset.left,\r\n easing = \"mcsLinearOut\";\r\n touchMoveY.push(y);\r\n touchMoveX.push(x);\r\n touchIntent[2] = Math.abs(_coordinates(e)[0] - touchIntent[0]);\r\n touchIntent[3] = Math.abs(_coordinates(e)[1] - touchIntent[1]);\r\n if (d.overflowed[0]) {\r\n var limit = mCSB_dragger[0].parent().height() - mCSB_dragger[0].height(),\r\n prevent = ((dragY - y) > 0 && (y - dragY) > -(limit * d.scrollRatio.y) && (touchIntent[3] * 2 < touchIntent[2] || o.axis === \"yx\"));\r\n }\r\n if (d.overflowed[1]) {\r\n var limitX = mCSB_dragger[1].parent().width() - mCSB_dragger[1].width(),\r\n preventX = ((dragX - x) > 0 && (x - dragX) > -(limitX * d.scrollRatio.x) && (touchIntent[2] * 2 < touchIntent[3] || o.axis === \"yx\"));\r\n }\r\n if (prevent || preventX) { /* prevent native document scrolling */\r\n if (!touchAction) {\r\n e.preventDefault();\r\n }\r\n touchDrag = 1;\r\n } else {\r\n docDrag = 1;\r\n $this.addClass(\"mCS_touch_action\");\r\n }\r\n if (touchAction) {\r\n e.preventDefault();\r\n }\r\n amount = o.axis === \"yx\" ? [(dragY - y), (dragX - x)] : o.axis === \"x\" ? [null, (dragX - x)] : [(dragY - y), null];\r\n mCSB_container[0].idleTimer = 250;\r\n if (d.overflowed[0]) {\r\n _drag(amount[0], durA, easing, \"y\", \"all\", true);\r\n }\r\n if (d.overflowed[1]) {\r\n _drag(amount[1], durA, easing, \"x\", overwrite, true);\r\n }\r\n }\r\n }\r\n\r\n function _onTouchstart2(e) {\r\n if (!_pointerTouch(e) || touchActive || _coordinates(e)[2]) {\r\n touchable = 0;\r\n return;\r\n }\r\n touchable = 1;\r\n e.stopImmediatePropagation();\r\n _stop($this);\r\n startTime = _getTime();\r\n var offset = mCustomScrollBox.offset();\r\n touchStartY = _coordinates(e)[0] - offset.top;\r\n touchStartX = _coordinates(e)[1] - offset.left;\r\n touchMoveY = [];\r\n touchMoveX = [];\r\n }\r\n\r\n function _onTouchend(e) {\r\n if (!_pointerTouch(e) || touchActive || _coordinates(e)[2]) {\r\n return;\r\n }\r\n draggable = 0;\r\n e.stopImmediatePropagation();\r\n touchDrag = 0;\r\n docDrag = 0;\r\n endTime = _getTime();\r\n var offset = mCustomScrollBox.offset(), y = _coordinates(e)[0] - offset.top,\r\n x = _coordinates(e)[1] - offset.left;\r\n if ((endTime - runningTime) > 30) {\r\n return;\r\n }\r\n speed = 1000 / (endTime - startTime);\r\n var easing = \"mcsEaseOut\", slow = speed < 2.5,\r\n diff = slow ? [touchMoveY[touchMoveY.length - 2], touchMoveX[touchMoveX.length - 2]] : [0, 0];\r\n distance = slow ? [(y - diff[0]), (x - diff[1])] : [y - touchStartY, x - touchStartX];\r\n var absDistance = [Math.abs(distance[0]), Math.abs(distance[1])];\r\n speed = slow ? [Math.abs(distance[0] / 4), Math.abs(distance[1] / 4)] : [speed, speed];\r\n var a = [\r\n Math.abs(mCSB_container[0].offsetTop) - (distance[0] * _m((absDistance[0] / speed[0]), speed[0])),\r\n Math.abs(mCSB_container[0].offsetLeft) - (distance[1] * _m((absDistance[1] / speed[1]), speed[1]))\r\n ];\r\n amount = o.axis === \"yx\" ? [a[0], a[1]] : o.axis === \"x\" ? [null, a[1]] : [a[0], null];\r\n durB = [(absDistance[0] * 4) + o.scrollInertia, (absDistance[1] * 4) + o.scrollInertia];\r\n var md = parseInt(o.contentTouchScroll) || 0;\r\n /* absolute minimum distance required */\r\n amount[0] = absDistance[0] > md ? amount[0] : 0;\r\n amount[1] = absDistance[1] > md ? amount[1] : 0;\r\n if (d.overflowed[0]) {\r\n _drag(amount[0], durB[0], easing, \"y\", overwrite, false);\r\n }\r\n if (d.overflowed[1]) {\r\n _drag(amount[1], durB[1], easing, \"x\", overwrite, false);\r\n }\r\n }\r\n\r\n function _m(ds, s) {\r\n var r = [s * 1.5, s * 2, s / 1.5, s / 2];\r\n if (ds > 90) {\r\n return s > 4 ? r[0] : r[3];\r\n } else if (ds > 60) {\r\n return s > 3 ? r[3] : r[2];\r\n } else if (ds > 30) {\r\n return s > 8 ? r[1] : s > 6 ? r[0] : s > 4 ? s : r[2];\r\n } else {\r\n return s > 8 ? s : r[3];\r\n }\r\n }\r\n\r\n function _drag(amount, dur, easing, dir, overwrite, drag) {\r\n if (!amount) {\r\n return;\r\n }\r\n _scrollTo($this, amount.toString(), {\r\n dur: dur,\r\n scrollEasing: easing,\r\n dir: dir,\r\n overwrite: overwrite,\r\n drag: drag\r\n });\r\n }\r\n },\r\n /* -------------------- */\r\n\r\n\r\n /*\r\n\t\tSELECT TEXT EVENTS\r\n\t\tscrolls content when text is selected\r\n\t\t*/\r\n _selectable = function () {\r\n var $this = $(this), d = $this.data(pluginPfx), o = d.opt, seq = d.sequential,\r\n namespace = pluginPfx + \"_\" + d.idx,\r\n mCSB_container = $(\"#mCSB_\" + d.idx + \"_container\"),\r\n wrapper = mCSB_container.parent(),\r\n action;\r\n mCSB_container.bind(\"mousedown.\" + namespace, function (e) {\r\n if (touchable) {\r\n return;\r\n }\r\n if (!action) {\r\n action = 1;\r\n touchActive = true;\r\n }\r\n }).add(document).bind(\"mousemove.\" + namespace, function (e) {\r\n if (!touchable && action && _sel()) {\r\n var offset = mCSB_container.offset(),\r\n y = _coordinates(e)[0] - offset.top + mCSB_container[0].offsetTop,\r\n x = _coordinates(e)[1] - offset.left + mCSB_container[0].offsetLeft;\r\n if (y > 0 && y < wrapper.height() && x > 0 && x < wrapper.width()) {\r\n if (seq.step) {\r\n _seq(\"off\", null, \"stepped\");\r\n }\r\n } else {\r\n if (o.axis !== \"x\" && d.overflowed[0]) {\r\n if (y < 0) {\r\n _seq(\"on\", 38);\r\n } else if (y > wrapper.height()) {\r\n _seq(\"on\", 40);\r\n }\r\n }\r\n if (o.axis !== \"y\" && d.overflowed[1]) {\r\n if (x < 0) {\r\n _seq(\"on\", 37);\r\n } else if (x > wrapper.width()) {\r\n _seq(\"on\", 39);\r\n }\r\n }\r\n }\r\n }\r\n }).bind(\"mouseup.\" + namespace + \" dragend.\" + namespace, function (e) {\r\n if (touchable) {\r\n return;\r\n }\r\n if (action) {\r\n action = 0;\r\n _seq(\"off\", null);\r\n }\r\n touchActive = false;\r\n });\r\n\r\n function _sel() {\r\n return window.getSelection ? window.getSelection().toString() :\r\n document.selection && document.selection.type != \"Control\" ? document.selection.createRange().text : 0;\r\n }\r\n\r\n function _seq(a, c, s) {\r\n seq.type = s && action ? \"stepped\" : \"stepless\";\r\n seq.scrollAmount = 10;\r\n _sequentialScroll($this, a, c, \"mcsLinearOut\", s ? 60 : null);\r\n }\r\n },\r\n /* -------------------- */\r\n\r\n\r\n /*\r\n\t\tMOUSE WHEEL EVENT\r\n\t\tscrolls content via mouse-wheel\r\n\t\tvia mouse-wheel plugin (https://github.com/brandonaaron/jquery-mousewheel)\r\n\t\t*/\r\n _mousewheel = function () {\r\n if (!$(this).data(pluginPfx)) {\r\n return;\r\n }\r\n /* Check if the scrollbar is ready to use mousewheel events (issue: #185) */\r\n var $this = $(this), d = $this.data(pluginPfx), o = d.opt,\r\n namespace = pluginPfx + \"_\" + d.idx,\r\n mCustomScrollBox = $(\"#mCSB_\" + d.idx),\r\n mCSB_dragger = [$(\"#mCSB_\" + d.idx + \"_dragger_vertical\"), $(\"#mCSB_\" + d.idx + \"_dragger_horizontal\")],\r\n iframe = $(\"#mCSB_\" + d.idx + \"_container\").find(\"iframe\");\r\n if (iframe.length) {\r\n iframe.each(function () {\r\n $(this).bind(\"load\", function () {\r\n /* bind events on accessible iframes */\r\n if (_canAccessIFrame(this)) {\r\n $(this.contentDocument || this.contentWindow.document).bind(\"mousewheel.\" + namespace, function (e, delta) {\r\n _onMousewheel(e, delta);\r\n });\r\n }\r\n });\r\n });\r\n }\r\n mCustomScrollBox.bind(\"mousewheel.\" + namespace, function (e, delta) {\r\n _onMousewheel(e, delta);\r\n });\r\n\r\n function _onMousewheel(e, delta) {\r\n _stop($this);\r\n if (_disableMousewheel($this, e.target)) {\r\n return;\r\n }\r\n /* disables mouse-wheel when hovering specific elements */\r\n var deltaFactor = o.mouseWheel.deltaFactor !== \"auto\" ? parseInt(o.mouseWheel.deltaFactor) : (oldIE && e.deltaFactor < 100) ? 100 : e.deltaFactor || 100,\r\n dur = o.scrollInertia;\r\n if (o.axis === \"x\" || o.mouseWheel.axis === \"x\") {\r\n var dir = \"x\",\r\n px = [Math.round(deltaFactor * d.scrollRatio.x), parseInt(o.mouseWheel.scrollAmount)],\r\n amount = o.mouseWheel.scrollAmount !== \"auto\" ? px[1] : px[0] >= mCustomScrollBox.width() ? mCustomScrollBox.width() * 0.9 : px[0],\r\n contentPos = Math.abs($(\"#mCSB_\" + d.idx + \"_container\")[0].offsetLeft),\r\n draggerPos = mCSB_dragger[1][0].offsetLeft,\r\n limit = mCSB_dragger[1].parent().width() - mCSB_dragger[1].width(),\r\n dlt = o.mouseWheel.axis === \"y\" ? (e.deltaY || delta) : e.deltaX;\r\n } else {\r\n var dir = \"y\",\r\n px = [Math.round(deltaFactor * d.scrollRatio.y), parseInt(o.mouseWheel.scrollAmount)],\r\n amount = o.mouseWheel.scrollAmount !== \"auto\" ? px[1] : px[0] >= mCustomScrollBox.height() ? mCustomScrollBox.height() * 0.9 : px[0],\r\n contentPos = Math.abs($(\"#mCSB_\" + d.idx + \"_container\")[0].offsetTop),\r\n draggerPos = mCSB_dragger[0][0].offsetTop,\r\n limit = mCSB_dragger[0].parent().height() - mCSB_dragger[0].height(),\r\n dlt = e.deltaY || delta;\r\n }\r\n if ((dir === \"y\" && !d.overflowed[0]) || (dir === \"x\" && !d.overflowed[1])) {\r\n return;\r\n }\r\n if (o.mouseWheel.invert || e.webkitDirectionInvertedFromDevice) {\r\n dlt = -dlt;\r\n }\r\n if (o.mouseWheel.normalizeDelta) {\r\n dlt = dlt < 0 ? -1 : 1;\r\n }\r\n if ((dlt > 0 && draggerPos !== 0) || (dlt < 0 && draggerPos !== limit) || o.mouseWheel.preventDefault) {\r\n e.stopImmediatePropagation();\r\n e.preventDefault();\r\n }\r\n if (e.deltaFactor < 5 && !o.mouseWheel.normalizeDelta) {\r\n //very low deltaFactor values mean some kind of delta acceleration (e.g. osx trackpad), so adjusting scrolling accordingly\r\n amount = e.deltaFactor;\r\n dur = 17;\r\n }\r\n _scrollTo($this, (contentPos - (dlt * amount)).toString(), {dir: dir, dur: dur});\r\n }\r\n },\r\n /* -------------------- */\r\n\r\n\r\n /* checks if iframe can be accessed */\r\n _canAccessIFrameCache = new Object(),\r\n _canAccessIFrame = function (iframe) {\r\n var result = false, cacheKey = false, html = null;\r\n if (iframe === undefined) {\r\n cacheKey = \"#empty\";\r\n } else if ($(iframe).attr(\"id\") !== undefined) {\r\n cacheKey = $(iframe).attr(\"id\");\r\n }\r\n if (cacheKey !== false && _canAccessIFrameCache[cacheKey] !== undefined) {\r\n return _canAccessIFrameCache[cacheKey];\r\n }\r\n if (!iframe) {\r\n try {\r\n var doc = top.document;\r\n html = doc.body.innerHTML;\r\n } catch (err) {/* do nothing */\r\n }\r\n result = (html !== null);\r\n } else {\r\n try {\r\n var doc = iframe.contentDocument || iframe.contentWindow.document;\r\n html = doc.body.innerHTML;\r\n } catch (err) {/* do nothing */\r\n }\r\n result = (html !== null);\r\n }\r\n if (cacheKey !== false) {\r\n _canAccessIFrameCache[cacheKey] = result;\r\n }\r\n return result;\r\n },\r\n /* -------------------- */\r\n\r\n\r\n /* switches iframe's pointer-events property (drag, mousewheel etc. over cross-domain iframes) */\r\n _iframe = function (evt) {\r\n var el = this.find(\"iframe\");\r\n if (!el.length) {\r\n return;\r\n }\r\n /* check if content contains iframes */\r\n var val = !evt ? \"none\" : \"auto\";\r\n el.css(\"pointer-events\", val);\r\n /* for IE11, iframe's display property should not be \"block\" */\r\n },\r\n /* -------------------- */\r\n\r\n\r\n /* disables mouse-wheel when hovering specific elements like select, datalist etc. */\r\n _disableMousewheel = function (el, target) {\r\n var tag = target.nodeName.toLowerCase(),\r\n tags = el.data(pluginPfx).opt.mouseWheel.disableOver,\r\n /* elements that require focus */\r\n focusTags = [\"select\", \"textarea\"];\r\n return $.inArray(tag, tags) > -1 && !($.inArray(tag, focusTags) > -1 && !$(target).is(\":focus\"));\r\n },\r\n /* -------------------- */\r\n\r\n\r\n /*\r\n\t\tDRAGGER RAIL CLICK EVENT\r\n\t\tscrolls content via dragger rail\r\n\t\t*/\r\n _draggerRail = function () {\r\n var $this = $(this), d = $this.data(pluginPfx),\r\n namespace = pluginPfx + \"_\" + d.idx,\r\n mCSB_container = $(\"#mCSB_\" + d.idx + \"_container\"),\r\n wrapper = mCSB_container.parent(),\r\n mCSB_draggerContainer = $(\".mCSB_\" + d.idx + \"_scrollbar .\" + classes[12]),\r\n clickable;\r\n mCSB_draggerContainer.bind(\"mousedown.\" + namespace + \" touchstart.\" + namespace + \" pointerdown.\" + namespace + \" MSPointerDown.\" + namespace, function (e) {\r\n touchActive = true;\r\n if (!$(e.target).hasClass(\"mCSB_dragger\")) {\r\n clickable = 1;\r\n }\r\n }).bind(\"touchend.\" + namespace + \" pointerup.\" + namespace + \" MSPointerUp.\" + namespace, function (e) {\r\n touchActive = false;\r\n }).bind(\"click.\" + namespace, function (e) {\r\n if (!clickable) {\r\n return;\r\n }\r\n clickable = 0;\r\n if ($(e.target).hasClass(classes[12]) || $(e.target).hasClass(\"mCSB_draggerRail\")) {\r\n _stop($this);\r\n var el = $(this), mCSB_dragger = el.find(\".mCSB_dragger\");\r\n if (el.parent(\".mCSB_scrollTools_horizontal\").length > 0) {\r\n if (!d.overflowed[1]) {\r\n return;\r\n }\r\n var dir = \"x\",\r\n clickDir = e.pageX > mCSB_dragger.offset().left ? -1 : 1,\r\n to = Math.abs(mCSB_container[0].offsetLeft) - (clickDir * (wrapper.width() * 0.9));\r\n } else {\r\n if (!d.overflowed[0]) {\r\n return;\r\n }\r\n var dir = \"y\",\r\n clickDir = e.pageY > mCSB_dragger.offset().top ? -1 : 1,\r\n to = Math.abs(mCSB_container[0].offsetTop) - (clickDir * (wrapper.height() * 0.9));\r\n }\r\n _scrollTo($this, to.toString(), {dir: dir, scrollEasing: \"mcsEaseInOut\"});\r\n }\r\n });\r\n },\r\n /* -------------------- */\r\n\r\n\r\n /*\r\n\t\tFOCUS EVENT\r\n\t\tscrolls content via element focus (e.g. clicking an input, pressing TAB key etc.)\r\n\t\t*/\r\n _focus = function () {\r\n var $this = $(this), d = $this.data(pluginPfx), o = d.opt,\r\n namespace = pluginPfx + \"_\" + d.idx,\r\n mCSB_container = $(\"#mCSB_\" + d.idx + \"_container\"),\r\n wrapper = mCSB_container.parent();\r\n mCSB_container.bind(\"focusin.\" + namespace, function (e) {\r\n var el = $(document.activeElement),\r\n nested = mCSB_container.find(\".mCustomScrollBox\").length,\r\n dur = 0;\r\n if (!el.is(o.advanced.autoScrollOnFocus)) {\r\n return;\r\n }\r\n _stop($this);\r\n clearTimeout($this[0]._focusTimeout);\r\n $this[0]._focusTimer = nested ? (dur + 17) * nested : 0;\r\n $this[0]._focusTimeout = setTimeout(function () {\r\n var to = [_childPos(el)[0], _childPos(el)[1]],\r\n contentPos = [mCSB_container[0].offsetTop, mCSB_container[0].offsetLeft],\r\n isVisible = [\r\n (contentPos[0] + to[0] >= 0 && contentPos[0] + to[0] < wrapper.height() - el.outerHeight(false)),\r\n (contentPos[1] + to[1] >= 0 && contentPos[0] + to[1] < wrapper.width() - el.outerWidth(false))\r\n ],\r\n overwrite = (o.axis === \"yx\" && !isVisible[0] && !isVisible[1]) ? \"none\" : \"all\";\r\n if (o.axis !== \"x\" && !isVisible[0]) {\r\n _scrollTo($this, to[0].toString(), {\r\n dir: \"y\",\r\n scrollEasing: \"mcsEaseInOut\",\r\n overwrite: overwrite,\r\n dur: dur\r\n });\r\n }\r\n if (o.axis !== \"y\" && !isVisible[1]) {\r\n _scrollTo($this, to[1].toString(), {\r\n dir: \"x\",\r\n scrollEasing: \"mcsEaseInOut\",\r\n overwrite: overwrite,\r\n dur: dur\r\n });\r\n }\r\n }, $this[0]._focusTimer);\r\n });\r\n },\r\n /* -------------------- */\r\n\r\n\r\n /* sets content wrapper scrollTop/scrollLeft always to 0 */\r\n _wrapperScroll = function () {\r\n var $this = $(this), d = $this.data(pluginPfx),\r\n namespace = pluginPfx + \"_\" + d.idx,\r\n wrapper = $(\"#mCSB_\" + d.idx + \"_container\").parent();\r\n wrapper.bind(\"scroll.\" + namespace, function (e) {\r\n if (wrapper.scrollTop() !== 0 || wrapper.scrollLeft() !== 0) {\r\n $(\".mCSB_\" + d.idx + \"_scrollbar\").css(\"visibility\", \"hidden\");\r\n /* hide scrollbar(s) */\r\n }\r\n });\r\n },\r\n /* -------------------- */\r\n\r\n\r\n /*\r\n\t\tBUTTONS EVENTS\r\n\t\tscrolls content via up, down, left and right buttons\r\n\t\t*/\r\n _buttons = function () {\r\n var $this = $(this), d = $this.data(pluginPfx), o = d.opt, seq = d.sequential,\r\n namespace = pluginPfx + \"_\" + d.idx,\r\n sel = \".mCSB_\" + d.idx + \"_scrollbar\",\r\n btn = $(sel + \">a\");\r\n btn.bind(\"contextmenu.\" + namespace, function (e) {\r\n e.preventDefault(); //prevent right click\r\n }).bind(\"mousedown.\" + namespace + \" touchstart.\" + namespace + \" pointerdown.\" + namespace + \" MSPointerDown.\" + namespace + \" mouseup.\" + namespace + \" touchend.\" + namespace + \" pointerup.\" + namespace + \" MSPointerUp.\" + namespace + \" mouseout.\" + namespace + \" pointerout.\" + namespace + \" MSPointerOut.\" + namespace + \" click.\" + namespace, function (e) {\r\n e.preventDefault();\r\n if (!_mouseBtnLeft(e)) {\r\n return;\r\n }\r\n /* left mouse button only */\r\n var btnClass = $(this).attr(\"class\");\r\n seq.type = o.scrollButtons.scrollType;\r\n switch (e.type) {\r\n case \"mousedown\":\r\n case \"touchstart\":\r\n case \"pointerdown\":\r\n case \"MSPointerDown\":\r\n if (seq.type === \"stepped\") {\r\n return;\r\n }\r\n touchActive = true;\r\n d.tweenRunning = false;\r\n _seq(\"on\", btnClass);\r\n break;\r\n case \"mouseup\":\r\n case \"touchend\":\r\n case \"pointerup\":\r\n case \"MSPointerUp\":\r\n case \"mouseout\":\r\n case \"pointerout\":\r\n case \"MSPointerOut\":\r\n if (seq.type === \"stepped\") {\r\n return;\r\n }\r\n touchActive = false;\r\n if (seq.dir) {\r\n _seq(\"off\", btnClass);\r\n }\r\n break;\r\n case \"click\":\r\n if (seq.type !== \"stepped\" || d.tweenRunning) {\r\n return;\r\n }\r\n _seq(\"on\", btnClass);\r\n break;\r\n }\r\n\r\n function _seq(a, c) {\r\n seq.scrollAmount = o.scrollButtons.scrollAmount;\r\n _sequentialScroll($this, a, c);\r\n }\r\n });\r\n },\r\n /* -------------------- */\r\n\r\n\r\n /*\r\n\t\tKEYBOARD EVENTS\r\n\t\tscrolls content via keyboard\r\n\t\tKeys: up arrow, down arrow, left arrow, right arrow, PgUp, PgDn, Home, End\r\n\t\t*/\r\n _keyboard = function () {\r\n var $this = $(this), d = $this.data(pluginPfx), o = d.opt, seq = d.sequential,\r\n namespace = pluginPfx + \"_\" + d.idx,\r\n mCustomScrollBox = $(\"#mCSB_\" + d.idx),\r\n mCSB_container = $(\"#mCSB_\" + d.idx + \"_container\"),\r\n wrapper = mCSB_container.parent(),\r\n editables = \"input,textarea,select,datalist,keygen,[contenteditable='true']\",\r\n iframe = mCSB_container.find(\"iframe\"),\r\n events = [\"blur.\" + namespace + \" keydown.\" + namespace + \" keyup.\" + namespace];\r\n if (iframe.length) {\r\n iframe.each(function () {\r\n $(this).bind(\"load\", function () {\r\n /* bind events on accessible iframes */\r\n if (_canAccessIFrame(this)) {\r\n $(this.contentDocument || this.contentWindow.document).bind(events[0], function (e) {\r\n _onKeyboard(e);\r\n });\r\n }\r\n });\r\n });\r\n }\r\n mCustomScrollBox.attr(\"tabindex\", \"0\").bind(events[0], function (e) {\r\n _onKeyboard(e);\r\n });\r\n\r\n function _onKeyboard(e) {\r\n switch (e.type) {\r\n case \"blur\":\r\n if (d.tweenRunning && seq.dir) {\r\n _seq(\"off\", null);\r\n }\r\n break;\r\n case \"keydown\":\r\n case \"keyup\":\r\n var code = e.keyCode ? e.keyCode : e.which, action = \"on\";\r\n if ((o.axis !== \"x\" && (code === 38 || code === 40)) || (o.axis !== \"y\" && (code === 37 || code === 39))) {\r\n /* up (38), down (40), left (37), right (39) arrows */\r\n if (((code === 38 || code === 40) && !d.overflowed[0]) || ((code === 37 || code === 39) && !d.overflowed[1])) {\r\n return;\r\n }\r\n if (e.type === \"keyup\") {\r\n action = \"off\";\r\n }\r\n if (!$(document.activeElement).is(editables)) {\r\n e.preventDefault();\r\n e.stopImmediatePropagation();\r\n _seq(action, code);\r\n }\r\n } else if (code === 33 || code === 34) {\r\n /* PgUp (33), PgDn (34) */\r\n if (d.overflowed[0] || d.overflowed[1]) {\r\n e.preventDefault();\r\n e.stopImmediatePropagation();\r\n }\r\n if (e.type === \"keyup\") {\r\n _stop($this);\r\n var keyboardDir = code === 34 ? -1 : 1;\r\n if (o.axis === \"x\" || (o.axis === \"yx\" && d.overflowed[1] && !d.overflowed[0])) {\r\n var dir = \"x\",\r\n to = Math.abs(mCSB_container[0].offsetLeft) - (keyboardDir * (wrapper.width() * 0.9));\r\n } else {\r\n var dir = \"y\",\r\n to = Math.abs(mCSB_container[0].offsetTop) - (keyboardDir * (wrapper.height() * 0.9));\r\n }\r\n _scrollTo($this, to.toString(), {dir: dir, scrollEasing: \"mcsEaseInOut\"});\r\n }\r\n } else if (code === 35 || code === 36) {\r\n /* End (35), Home (36) */\r\n if (!$(document.activeElement).is(editables)) {\r\n if (d.overflowed[0] || d.overflowed[1]) {\r\n e.preventDefault();\r\n e.stopImmediatePropagation();\r\n }\r\n if (e.type === \"keyup\") {\r\n if (o.axis === \"x\" || (o.axis === \"yx\" && d.overflowed[1] && !d.overflowed[0])) {\r\n var dir = \"x\",\r\n to = code === 35 ? Math.abs(wrapper.width() - mCSB_container.outerWidth(false)) : 0;\r\n } else {\r\n var dir = \"y\",\r\n to = code === 35 ? Math.abs(wrapper.height() - mCSB_container.outerHeight(false)) : 0;\r\n }\r\n _scrollTo($this, to.toString(), {dir: dir, scrollEasing: \"mcsEaseInOut\"});\r\n }\r\n }\r\n }\r\n break;\r\n }\r\n\r\n function _seq(a, c) {\r\n seq.type = o.keyboard.scrollType;\r\n seq.scrollAmount = o.keyboard.scrollAmount;\r\n if (seq.type === \"stepped\" && d.tweenRunning) {\r\n return;\r\n }\r\n _sequentialScroll($this, a, c);\r\n }\r\n }\r\n },\r\n /* -------------------- */\r\n\r\n\r\n /* scrolls content sequentially (used when scrolling via buttons, keyboard arrows etc.) */\r\n _sequentialScroll = function (el, action, trigger, e, s) {\r\n var d = el.data(pluginPfx), o = d.opt, seq = d.sequential,\r\n mCSB_container = $(\"#mCSB_\" + d.idx + \"_container\"),\r\n once = seq.type === \"stepped\" ? true : false,\r\n steplessSpeed = o.scrollInertia < 26 ? 26 : o.scrollInertia, /* 26/1.5=17 */\r\n steppedSpeed = o.scrollInertia < 1 ? 17 : o.scrollInertia;\r\n switch (action) {\r\n case \"on\":\r\n seq.dir = [\r\n (trigger === classes[16] || trigger === classes[15] || trigger === 39 || trigger === 37 ? \"x\" : \"y\"),\r\n (trigger === classes[13] || trigger === classes[15] || trigger === 38 || trigger === 37 ? -1 : 1)\r\n ];\r\n _stop(el);\r\n if (_isNumeric(trigger) && seq.type === \"stepped\") {\r\n return;\r\n }\r\n _on(once);\r\n break;\r\n case \"off\":\r\n _off();\r\n if (once || (d.tweenRunning && seq.dir)) {\r\n _on(true);\r\n }\r\n break;\r\n }\r\n\r\n /* starts sequence */\r\n function _on(once) {\r\n if (o.snapAmount) {\r\n seq.scrollAmount = !(o.snapAmount instanceof Array) ? o.snapAmount : seq.dir[0] === \"x\" ? o.snapAmount[1] : o.snapAmount[0];\r\n }\r\n /* scrolling snapping */\r\n var c = seq.type !== \"stepped\", /* continuous scrolling */\r\n t = s ? s : !once ? 1000 / 60 : c ? steplessSpeed / 1.5 : steppedSpeed, /* timer */\r\n m = !once ? 2.5 : c ? 7.5 : 40, /* multiplier */\r\n contentPos = [Math.abs(mCSB_container[0].offsetTop), Math.abs(mCSB_container[0].offsetLeft)],\r\n ratio = [d.scrollRatio.y > 10 ? 10 : d.scrollRatio.y, d.scrollRatio.x > 10 ? 10 : d.scrollRatio.x],\r\n amount = seq.dir[0] === \"x\" ? contentPos[1] + (seq.dir[1] * (ratio[1] * m)) : contentPos[0] + (seq.dir[1] * (ratio[0] * m)),\r\n px = seq.dir[0] === \"x\" ? contentPos[1] + (seq.dir[1] * parseInt(seq.scrollAmount)) : contentPos[0] + (seq.dir[1] * parseInt(seq.scrollAmount)),\r\n to = seq.scrollAmount !== \"auto\" ? px : amount,\r\n easing = e ? e : !once ? \"mcsLinear\" : c ? \"mcsLinearOut\" : \"mcsEaseInOut\",\r\n onComplete = !once ? false : true;\r\n if (once && t < 17) {\r\n to = seq.dir[0] === \"x\" ? contentPos[1] : contentPos[0];\r\n }\r\n _scrollTo(el, to.toString(), {dir: seq.dir[0], scrollEasing: easing, dur: t, onComplete: onComplete});\r\n if (once) {\r\n seq.dir = false;\r\n return;\r\n }\r\n clearTimeout(seq.step);\r\n seq.step = setTimeout(function () {\r\n _on();\r\n }, t);\r\n }\r\n\r\n /* stops sequence */\r\n function _off() {\r\n clearTimeout(seq.step);\r\n _delete(seq, \"step\");\r\n _stop(el);\r\n }\r\n },\r\n /* -------------------- */\r\n\r\n\r\n /* returns a yx array from value */\r\n _arr = function (val) {\r\n var o = $(this).data(pluginPfx).opt, vals = [];\r\n if (typeof val === \"function\") {\r\n val = val();\r\n }\r\n /* check if the value is a single anonymous function */\r\n /* check if value is object or array, its length and create an array with yx values */\r\n if (!(val instanceof Array)) { /* object value (e.g. {y:\"100\",x:\"100\"}, 100 etc.) */\r\n vals[0] = val.y ? val.y : val.x || o.axis === \"x\" ? null : val;\r\n vals[1] = val.x ? val.x : val.y || o.axis === \"y\" ? null : val;\r\n } else { /* array value (e.g. [100,100]) */\r\n vals = val.length > 1 ? [val[0], val[1]] : o.axis === \"x\" ? [null, val[0]] : [val[0], null];\r\n }\r\n /* check if array values are anonymous functions */\r\n if (typeof vals[0] === \"function\") {\r\n vals[0] = vals[0]();\r\n }\r\n if (typeof vals[1] === \"function\") {\r\n vals[1] = vals[1]();\r\n }\r\n return vals;\r\n },\r\n /* -------------------- */\r\n\r\n\r\n /* translates values (e.g. \"top\", 100, \"100px\", \"#id\") to actual scroll-to positions */\r\n _to = function (val, dir) {\r\n if (val == null || typeof val == \"undefined\") {\r\n return;\r\n }\r\n var $this = $(this), d = $this.data(pluginPfx), o = d.opt,\r\n mCSB_container = $(\"#mCSB_\" + d.idx + \"_container\"),\r\n wrapper = mCSB_container.parent(),\r\n t = typeof val;\r\n if (!dir) {\r\n dir = o.axis === \"x\" ? \"x\" : \"y\";\r\n }\r\n var contentLength = dir === \"x\" ? mCSB_container.outerWidth(false) - wrapper.width() : mCSB_container.outerHeight(false) - wrapper.height(),\r\n contentPos = dir === \"x\" ? mCSB_container[0].offsetLeft : mCSB_container[0].offsetTop,\r\n cssProp = dir === \"x\" ? \"left\" : \"top\";\r\n switch (t) {\r\n case \"function\": /* this currently is not used. Consider removing it */\r\n return val();\r\n break;\r\n case \"object\": /* js/jquery object */\r\n var obj = val.jquery ? val : $(val);\r\n if (!obj.length) {\r\n return;\r\n }\r\n return dir === \"x\" ? _childPos(obj)[1] : _childPos(obj)[0];\r\n break;\r\n case \"string\":\r\n case \"number\":\r\n if (_isNumeric(val)) { /* numeric value */\r\n return Math.abs(val);\r\n } else if (val.indexOf(\"%\") !== -1) { /* percentage value */\r\n return Math.abs(contentLength * parseInt(val) / 100);\r\n } else if (val.indexOf(\"-=\") !== -1) { /* decrease value */\r\n return Math.abs(contentPos - parseInt(val.split(\"-=\")[1]));\r\n } else if (val.indexOf(\"+=\") !== -1) { /* inrease value */\r\n var p = (contentPos + parseInt(val.split(\"+=\")[1]));\r\n return p >= 0 ? 0 : Math.abs(p);\r\n } else if (val.indexOf(\"px\") !== -1 && _isNumeric(val.split(\"px\")[0])) { /* pixels string value (e.g. \"100px\") */\r\n return Math.abs(val.split(\"px\")[0]);\r\n } else {\r\n if (val === \"top\" || val === \"left\") { /* special strings */\r\n return 0;\r\n } else if (val === \"bottom\") {\r\n return Math.abs(wrapper.height() - mCSB_container.outerHeight(false));\r\n } else if (val === \"right\") {\r\n return Math.abs(wrapper.width() - mCSB_container.outerWidth(false));\r\n } else if (val === \"first\" || val === \"last\") {\r\n var obj = mCSB_container.find(\":\" + val);\r\n return dir === \"x\" ? _childPos(obj)[1] : _childPos(obj)[0];\r\n } else {\r\n if ($(val).length) { /* jquery selector */\r\n return dir === \"x\" ? _childPos($(val))[1] : _childPos($(val))[0];\r\n } else { /* other values (e.g. \"100em\") */\r\n mCSB_container.css(cssProp, val);\r\n methods.update.call(null, $this[0]);\r\n return;\r\n }\r\n }\r\n }\r\n break;\r\n }\r\n },\r\n /* -------------------- */\r\n\r\n\r\n /* calls the update method automatically */\r\n _autoUpdate = function (rem) {\r\n var $this = $(this), d = $this.data(pluginPfx), o = d.opt,\r\n mCSB_container = $(\"#mCSB_\" + d.idx + \"_container\");\r\n if (rem) {\r\n /*\r\n\t\t\t\tremoves autoUpdate timer\r\n\t\t\t\tusage: _autoUpdate.call(this,\"remove\");\r\n\t\t\t\t*/\r\n clearTimeout(mCSB_container[0].autoUpdate);\r\n _delete(mCSB_container[0], \"autoUpdate\");\r\n return;\r\n }\r\n upd();\r\n\r\n function upd() {\r\n clearTimeout(mCSB_container[0].autoUpdate);\r\n if ($this.parents(\"html\").length === 0) {\r\n /* check element in dom tree */\r\n $this = null;\r\n return;\r\n }\r\n mCSB_container[0].autoUpdate = setTimeout(function () {\r\n /* update on specific selector(s) length and size change */\r\n if (o.advanced.updateOnSelectorChange) {\r\n d.poll.change.n = sizesSum();\r\n if (d.poll.change.n !== d.poll.change.o) {\r\n d.poll.change.o = d.poll.change.n;\r\n doUpd(3);\r\n return;\r\n }\r\n }\r\n /* update on main element and scrollbar size changes */\r\n if (o.advanced.updateOnContentResize) {\r\n d.poll.size.n = $this[0].scrollHeight + $this[0].scrollWidth + mCSB_container[0].offsetHeight + $this[0].offsetHeight + $this[0].offsetWidth;\r\n if (d.poll.size.n !== d.poll.size.o) {\r\n d.poll.size.o = d.poll.size.n;\r\n doUpd(1);\r\n return;\r\n }\r\n }\r\n /* update on image load */\r\n if (o.advanced.updateOnImageLoad) {\r\n if (!(o.advanced.updateOnImageLoad === \"auto\" && o.axis === \"y\")) { //by default, it doesn't run on vertical content\r\n d.poll.img.n = mCSB_container.find(\"img\").length;\r\n if (d.poll.img.n !== d.poll.img.o) {\r\n d.poll.img.o = d.poll.img.n;\r\n mCSB_container.find(\"img\").each(function () {\r\n imgLoader(this);\r\n });\r\n return;\r\n }\r\n }\r\n }\r\n if (o.advanced.updateOnSelectorChange || o.advanced.updateOnContentResize || o.advanced.updateOnImageLoad) {\r\n upd();\r\n }\r\n }, o.advanced.autoUpdateTimeout);\r\n }\r\n\r\n /* a tiny image loader */\r\n function imgLoader(el) {\r\n if ($(el).hasClass(classes[2])) {\r\n doUpd();\r\n return;\r\n }\r\n var img = new Image();\r\n\r\n function createDelegate(contextObject, delegateMethod) {\r\n return function () {\r\n return delegateMethod.apply(contextObject, arguments);\r\n }\r\n }\r\n\r\n function imgOnLoad() {\r\n this.onload = null;\r\n $(el).addClass(classes[2]);\r\n doUpd(2);\r\n }\r\n\r\n img.onload = createDelegate(img, imgOnLoad);\r\n img.src = el.src;\r\n }\r\n\r\n /* returns the total height and width sum of all elements matching the selector */\r\n function sizesSum() {\r\n if (o.advanced.updateOnSelectorChange === true) {\r\n o.advanced.updateOnSelectorChange = \"*\";\r\n }\r\n var total = 0, sel = mCSB_container.find(o.advanced.updateOnSelectorChange);\r\n if (o.advanced.updateOnSelectorChange && sel.length > 0) {\r\n sel.each(function () {\r\n total += this.offsetHeight + this.offsetWidth;\r\n });\r\n }\r\n return total;\r\n }\r\n\r\n /* calls the update method */\r\n function doUpd(cb) {\r\n clearTimeout(mCSB_container[0].autoUpdate);\r\n methods.update.call(null, $this[0], cb);\r\n }\r\n },\r\n /* -------------------- */\r\n\r\n\r\n /* snaps scrolling to a multiple of a pixels number */\r\n _snapAmount = function (to, amount, offset) {\r\n return (Math.round(to / amount) * amount - offset);\r\n },\r\n /* -------------------- */\r\n\r\n\r\n /* stops content and scrollbar animations */\r\n _stop = function (el) {\r\n var d = el.data(pluginPfx),\r\n sel = $(\"#mCSB_\" + d.idx + \"_container,#mCSB_\" + d.idx + \"_container_wrapper,#mCSB_\" + d.idx + \"_dragger_vertical,#mCSB_\" + d.idx + \"_dragger_horizontal\");\r\n sel.each(function () {\r\n _stopTween.call(this);\r\n });\r\n },\r\n /* -------------------- */\r\n\r\n\r\n /*\r\n\t\tANIMATES CONTENT\r\n\t\tThis is where the actual scrolling happens\r\n\t\t*/\r\n _scrollTo = function (el, to, options) {\r\n var d = el.data(pluginPfx), o = d.opt,\r\n defaults = {\r\n trigger: \"internal\",\r\n dir: \"y\",\r\n scrollEasing: \"mcsEaseOut\",\r\n drag: false,\r\n dur: o.scrollInertia,\r\n overwrite: \"all\",\r\n callbacks: true,\r\n onStart: true,\r\n onUpdate: true,\r\n onComplete: true\r\n },\r\n options = $.extend(defaults, options),\r\n dur = [options.dur, (options.drag ? 0 : options.dur)],\r\n mCustomScrollBox = $(\"#mCSB_\" + d.idx),\r\n mCSB_container = $(\"#mCSB_\" + d.idx + \"_container\"),\r\n wrapper = mCSB_container.parent(),\r\n totalScrollOffsets = o.callbacks.onTotalScrollOffset ? _arr.call(el, o.callbacks.onTotalScrollOffset) : [0, 0],\r\n totalScrollBackOffsets = o.callbacks.onTotalScrollBackOffset ? _arr.call(el, o.callbacks.onTotalScrollBackOffset) : [0, 0];\r\n d.trigger = options.trigger;\r\n if (wrapper.scrollTop() !== 0 || wrapper.scrollLeft() !== 0) { /* always reset scrollTop/Left */\r\n $(\".mCSB_\" + d.idx + \"_scrollbar\").css(\"visibility\", \"visible\");\r\n wrapper.scrollTop(0).scrollLeft(0);\r\n }\r\n if (to === \"_resetY\" && !d.contentReset.y) {\r\n /* callbacks: onOverflowYNone */\r\n if (_cb(\"onOverflowYNone\")) {\r\n o.callbacks.onOverflowYNone.call(el[0]);\r\n }\r\n d.contentReset.y = 1;\r\n }\r\n if (to === \"_resetX\" && !d.contentReset.x) {\r\n /* callbacks: onOverflowXNone */\r\n if (_cb(\"onOverflowXNone\")) {\r\n o.callbacks.onOverflowXNone.call(el[0]);\r\n }\r\n d.contentReset.x = 1;\r\n }\r\n if (to === \"_resetY\" || to === \"_resetX\") {\r\n return;\r\n }\r\n if ((d.contentReset.y || !el[0].mcs) && d.overflowed[0]) {\r\n /* callbacks: onOverflowY */\r\n if (_cb(\"onOverflowY\")) {\r\n o.callbacks.onOverflowY.call(el[0]);\r\n }\r\n d.contentReset.x = null;\r\n }\r\n if ((d.contentReset.x || !el[0].mcs) && d.overflowed[1]) {\r\n /* callbacks: onOverflowX */\r\n if (_cb(\"onOverflowX\")) {\r\n o.callbacks.onOverflowX.call(el[0]);\r\n }\r\n d.contentReset.x = null;\r\n }\r\n if (o.snapAmount) { /* scrolling snapping */\r\n var snapAmount = !(o.snapAmount instanceof Array) ? o.snapAmount : options.dir === \"x\" ? o.snapAmount[1] : o.snapAmount[0];\r\n to = _snapAmount(to, snapAmount, o.snapOffset);\r\n }\r\n switch (options.dir) {\r\n case \"x\":\r\n var mCSB_dragger = $(\"#mCSB_\" + d.idx + \"_dragger_horizontal\"),\r\n property = \"left\",\r\n contentPos = mCSB_container[0].offsetLeft,\r\n limit = [\r\n mCustomScrollBox.width() - mCSB_container.outerWidth(false),\r\n mCSB_dragger.parent().width() - mCSB_dragger.width()\r\n ],\r\n scrollTo = [to, to === 0 ? 0 : (to / d.scrollRatio.x)],\r\n tso = totalScrollOffsets[1],\r\n tsbo = totalScrollBackOffsets[1],\r\n totalScrollOffset = tso > 0 ? tso / d.scrollRatio.x : 0,\r\n totalScrollBackOffset = tsbo > 0 ? tsbo / d.scrollRatio.x : 0;\r\n break;\r\n case \"y\":\r\n var mCSB_dragger = $(\"#mCSB_\" + d.idx + \"_dragger_vertical\"),\r\n property = \"top\",\r\n contentPos = mCSB_container[0].offsetTop,\r\n limit = [\r\n mCustomScrollBox.height() - mCSB_container.outerHeight(false),\r\n mCSB_dragger.parent().height() - mCSB_dragger.height()\r\n ],\r\n scrollTo = [to, to === 0 ? 0 : (to / d.scrollRatio.y)],\r\n tso = totalScrollOffsets[0],\r\n tsbo = totalScrollBackOffsets[0],\r\n totalScrollOffset = tso > 0 ? tso / d.scrollRatio.y : 0,\r\n totalScrollBackOffset = tsbo > 0 ? tsbo / d.scrollRatio.y : 0;\r\n break;\r\n }\r\n if (scrollTo[1] < 0 || (scrollTo[0] === 0 && scrollTo[1] === 0)) {\r\n scrollTo = [0, 0];\r\n } else if (scrollTo[1] >= limit[1]) {\r\n scrollTo = [limit[0], limit[1]];\r\n } else {\r\n scrollTo[0] = -scrollTo[0];\r\n }\r\n if (!el[0].mcs) {\r\n _mcs();\r\n /* init mcs object (once) to make it available before callbacks */\r\n if (_cb(\"onInit\")) {\r\n o.callbacks.onInit.call(el[0]);\r\n }\r\n /* callbacks: onInit */\r\n }\r\n clearTimeout(mCSB_container[0].onCompleteTimeout);\r\n _tweenTo(mCSB_dragger[0], property, Math.round(scrollTo[1]), dur[1], options.scrollEasing);\r\n if (!d.tweenRunning && ((contentPos === 0 && scrollTo[0] >= 0) || (contentPos === limit[0] && scrollTo[0] <= limit[0]))) {\r\n return;\r\n }\r\n _tweenTo(mCSB_container[0], property, Math.round(scrollTo[0]), dur[0], options.scrollEasing, options.overwrite, {\r\n onStart: function () {\r\n if (options.callbacks && options.onStart && !d.tweenRunning) {\r\n /* callbacks: onScrollStart */\r\n if (_cb(\"onScrollStart\")) {\r\n _mcs();\r\n o.callbacks.onScrollStart.call(el[0]);\r\n }\r\n d.tweenRunning = true;\r\n _onDragClasses(mCSB_dragger);\r\n d.cbOffsets = _cbOffsets();\r\n }\r\n }, onUpdate: function () {\r\n if (options.callbacks && options.onUpdate) {\r\n /* callbacks: whileScrolling */\r\n if (_cb(\"whileScrolling\")) {\r\n _mcs();\r\n o.callbacks.whileScrolling.call(el[0]);\r\n }\r\n }\r\n }, onComplete: function () {\r\n if (options.callbacks && options.onComplete) {\r\n if (o.axis === \"yx\") {\r\n clearTimeout(mCSB_container[0].onCompleteTimeout);\r\n }\r\n var t = mCSB_container[0].idleTimer || 0;\r\n mCSB_container[0].onCompleteTimeout = setTimeout(function () {\r\n /* callbacks: onScroll, onTotalScroll, onTotalScrollBack */\r\n if (_cb(\"onScroll\")) {\r\n _mcs();\r\n o.callbacks.onScroll.call(el[0]);\r\n }\r\n if (_cb(\"onTotalScroll\") && scrollTo[1] >= limit[1] - totalScrollOffset && d.cbOffsets[0]) {\r\n _mcs();\r\n o.callbacks.onTotalScroll.call(el[0]);\r\n }\r\n if (_cb(\"onTotalScrollBack\") && scrollTo[1] <= totalScrollBackOffset && d.cbOffsets[1]) {\r\n _mcs();\r\n o.callbacks.onTotalScrollBack.call(el[0]);\r\n }\r\n d.tweenRunning = false;\r\n mCSB_container[0].idleTimer = 0;\r\n _onDragClasses(mCSB_dragger, \"hide\");\r\n }, t);\r\n }\r\n }\r\n });\r\n\r\n /* checks if callback function exists */\r\n function _cb(cb) {\r\n return d && o.callbacks[cb] && typeof o.callbacks[cb] === \"function\";\r\n }\r\n\r\n /* checks whether callback offsets always trigger */\r\n function _cbOffsets() {\r\n return [o.callbacks.alwaysTriggerOffsets || contentPos >= limit[0] + tso, o.callbacks.alwaysTriggerOffsets || contentPos <= -tsbo];\r\n }\r\n\r\n /*\r\n\t\t\tpopulates object with useful values for the user\r\n\t\t\tvalues:\r\n\t\t\t\tcontent: this.mcs.content\r\n\t\t\t\tcontent top position: this.mcs.top\r\n\t\t\t\tcontent left position: this.mcs.left\r\n\t\t\t\tdragger top position: this.mcs.draggerTop\r\n\t\t\t\tdragger left position: this.mcs.draggerLeft\r\n\t\t\t\tscrolling y percentage: this.mcs.topPct\r\n\t\t\t\tscrolling x percentage: this.mcs.leftPct\r\n\t\t\t\tscrolling direction: this.mcs.direction\r\n\t\t\t*/\r\n function _mcs() {\r\n var cp = [mCSB_container[0].offsetTop, mCSB_container[0].offsetLeft], /* content position */\r\n dp = [mCSB_dragger[0].offsetTop, mCSB_dragger[0].offsetLeft], /* dragger position */\r\n cl = [mCSB_container.outerHeight(false), mCSB_container.outerWidth(false)], /* content length */\r\n pl = [mCustomScrollBox.height(), mCustomScrollBox.width()];\r\n /* content parent length */\r\n el[0].mcs = {\r\n content: mCSB_container, /* original content wrapper as jquery object */\r\n top: cp[0],\r\n left: cp[1],\r\n draggerTop: dp[0],\r\n draggerLeft: dp[1],\r\n topPct: Math.round((100 * Math.abs(cp[0])) / (Math.abs(cl[0]) - pl[0])),\r\n leftPct: Math.round((100 * Math.abs(cp[1])) / (Math.abs(cl[1]) - pl[1])),\r\n direction: options.dir\r\n };\r\n /*\r\n\t\t\t\tthis refers to the original element containing the scrollbar(s)\r\n\t\t\t\tusage: this.mcs.top, this.mcs.leftPct etc.\r\n\t\t\t\t*/\r\n }\r\n },\r\n /* -------------------- */\r\n\r\n\r\n /*\r\n\t\tCUSTOM JAVASCRIPT ANIMATION TWEEN\r\n\t\tLighter and faster than jquery animate() and css transitions\r\n\t\tAnimates top/left properties and includes easings\r\n\t\t*/\r\n _tweenTo = function (el, prop, to, duration, easing, overwrite, callbacks) {\r\n if (!el._mTween) {\r\n el._mTween = {top: {}, left: {}};\r\n }\r\n var callbacks = callbacks || {},\r\n onStart = callbacks.onStart || function () {\r\n }, onUpdate = callbacks.onUpdate || function () {\r\n }, onComplete = callbacks.onComplete || function () {\r\n },\r\n startTime = _getTime(), _delay, progress = 0, from = el.offsetTop, elStyle = el.style, _request,\r\n tobj = el._mTween[prop];\r\n if (prop === \"left\") {\r\n from = el.offsetLeft;\r\n }\r\n var diff = to - from;\r\n tobj.stop = 0;\r\n if (overwrite !== \"none\") {\r\n _cancelTween();\r\n }\r\n _startTween();\r\n\r\n function _step() {\r\n if (tobj.stop) {\r\n return;\r\n }\r\n if (!progress) {\r\n onStart.call();\r\n }\r\n progress = _getTime() - startTime;\r\n _tween();\r\n if (progress >= tobj.time) {\r\n tobj.time = (progress > tobj.time) ? progress + _delay - (progress - tobj.time) : progress + _delay - 1;\r\n if (tobj.time < progress + 1) {\r\n tobj.time = progress + 1;\r\n }\r\n }\r\n if (tobj.time < duration) {\r\n tobj.id = _request(_step);\r\n } else {\r\n onComplete.call();\r\n }\r\n }\r\n\r\n function _tween() {\r\n if (duration > 0) {\r\n tobj.currVal = _ease(tobj.time, from, diff, duration, easing);\r\n elStyle[prop] = Math.round(tobj.currVal) + \"px\";\r\n } else {\r\n elStyle[prop] = to + \"px\";\r\n }\r\n onUpdate.call();\r\n }\r\n\r\n function _startTween() {\r\n _delay = 1000 / 60;\r\n tobj.time = progress + _delay;\r\n _request = (!window.requestAnimationFrame) ? function (f) {\r\n _tween();\r\n return setTimeout(f, 0.01);\r\n } : window.requestAnimationFrame;\r\n tobj.id = _request(_step);\r\n }\r\n\r\n function _cancelTween() {\r\n if (tobj.id == null) {\r\n return;\r\n }\r\n if (!window.requestAnimationFrame) {\r\n clearTimeout(tobj.id);\r\n } else {\r\n window.cancelAnimationFrame(tobj.id);\r\n }\r\n tobj.id = null;\r\n }\r\n\r\n function _ease(t, b, c, d, type) {\r\n switch (type) {\r\n case \"linear\":\r\n case \"mcsLinear\":\r\n return c * t / d + b;\r\n break;\r\n case \"mcsLinearOut\":\r\n t /= d;\r\n t--;\r\n return c * Math.sqrt(1 - t * t) + b;\r\n break;\r\n case \"easeInOutSmooth\":\r\n t /= d / 2;\r\n if (t < 1) return c / 2 * t * t + b;\r\n t--;\r\n return -c / 2 * (t * (t - 2) - 1) + b;\r\n break;\r\n case \"easeInOutStrong\":\r\n t /= d / 2;\r\n if (t < 1) return c / 2 * Math.pow(2, 10 * (t - 1)) + b;\r\n t--;\r\n return c / 2 * ( -Math.pow(2, -10 * t) + 2 ) + b;\r\n break;\r\n case \"easeInOut\":\r\n case \"mcsEaseInOut\":\r\n t /= d / 2;\r\n if (t < 1) return c / 2 * t * t * t + b;\r\n t -= 2;\r\n return c / 2 * (t * t * t + 2) + b;\r\n break;\r\n case \"easeOutSmooth\":\r\n t /= d;\r\n t--;\r\n return -c * (t * t * t * t - 1) + b;\r\n break;\r\n case \"easeOutStrong\":\r\n return c * ( -Math.pow(2, -10 * t / d) + 1 ) + b;\r\n break;\r\n case \"easeOut\":\r\n case \"mcsEaseOut\":\r\n default:\r\n var ts = (t /= d) * t, tc = ts * t;\r\n return b + c * (0.499999999999997 * tc * ts + -2.5 * ts * ts + 5.5 * tc + -6.5 * ts + 4 * t);\r\n }\r\n }\r\n },\r\n /* -------------------- */\r\n\r\n\r\n /* returns current time */\r\n _getTime = function () {\r\n if (window.performance && window.performance.now) {\r\n return window.performance.now();\r\n } else {\r\n if (window.performance && window.performance.webkitNow) {\r\n return window.performance.webkitNow();\r\n } else {\r\n if (Date.now) {\r\n return Date.now();\r\n } else {\r\n return new Date().getTime();\r\n }\r\n }\r\n }\r\n },\r\n /* -------------------- */\r\n\r\n\r\n /* stops a tween */\r\n _stopTween = function () {\r\n var el = this;\r\n if (!el._mTween) {\r\n el._mTween = {top: {}, left: {}};\r\n }\r\n var props = [\"top\", \"left\"];\r\n for (var i = 0; i < props.length; i++) {\r\n var prop = props[i];\r\n if (el._mTween[prop].id) {\r\n if (!window.requestAnimationFrame) {\r\n clearTimeout(el._mTween[prop].id);\r\n } else {\r\n window.cancelAnimationFrame(el._mTween[prop].id);\r\n }\r\n el._mTween[prop].id = null;\r\n el._mTween[prop].stop = 1;\r\n }\r\n }\r\n },\r\n /* -------------------- */\r\n\r\n\r\n /* deletes a property (avoiding the exception thrown by IE) */\r\n _delete = function (c, m) {\r\n try {\r\n delete c[m];\r\n } catch (e) {\r\n c[m] = null;\r\n }\r\n },\r\n /* -------------------- */\r\n\r\n\r\n /* detects left mouse button */\r\n _mouseBtnLeft = function (e) {\r\n return !(e.which && e.which !== 1);\r\n },\r\n /* -------------------- */\r\n\r\n\r\n /* detects if pointer type event is touch */\r\n _pointerTouch = function (e) {\r\n var t = e.originalEvent.pointerType;\r\n return !(t && t !== \"touch\" && t !== 2);\r\n },\r\n /* -------------------- */\r\n\r\n\r\n /* checks if value is numeric */\r\n _isNumeric = function (val) {\r\n return !isNaN(parseFloat(val)) && isFinite(val);\r\n },\r\n /* -------------------- */\r\n\r\n\r\n /* returns element position according to content */\r\n _childPos = function (el) {\r\n var p = el.parents(\".mCSB_container\");\r\n return [el.offset().top - p.offset().top, el.offset().left - p.offset().left];\r\n },\r\n /* -------------------- */\r\n\r\n\r\n /* checks if browser tab is hidden/inactive via Page Visibility API */\r\n _isTabHidden = function () {\r\n var prop = _getHiddenProp();\r\n if (!prop) return false;\r\n return document[prop];\r\n\r\n function _getHiddenProp() {\r\n var pfx = [\"webkit\", \"moz\", \"ms\", \"o\"];\r\n if (\"hidden\" in document) return \"hidden\"; //natively supported\r\n for (var i = 0; i < pfx.length; i++) { //prefixed\r\n if ((pfx[i] + \"Hidden\") in document)\r\n return pfx[i] + \"Hidden\";\r\n }\r\n return null; //not supported\r\n }\r\n };\r\n /* -------------------- */\r\n\r\n\r\n /*\r\n\t----------------------------------------\r\n\tPLUGIN SETUP\r\n\t----------------------------------------\r\n\t*/\r\n\r\n /* plugin constructor functions */\r\n $.fn[pluginNS] = function (method) { /* usage: $(selector).mCustomScrollbar(); */\r\n if (methods[method]) {\r\n return methods[method].apply(this, Array.prototype.slice.call(arguments, 1));\r\n } else if (typeof method === \"object\" || !method) {\r\n return methods.init.apply(this, arguments);\r\n } else {\r\n $.error(\"Method \" + method + \" does not exist\");\r\n }\r\n };\r\n $[pluginNS] = function (method) { /* usage: $.mCustomScrollbar(); */\r\n if (methods[method]) {\r\n return methods[method].apply(this, Array.prototype.slice.call(arguments, 1));\r\n } else if (typeof method === \"object\" || !method) {\r\n return methods.init.apply(this, arguments);\r\n } else {\r\n $.error(\"Method \" + method + \" does not exist\");\r\n }\r\n };\r\n\r\n /*\r\n\tallow setting plugin default options.\r\n\tusage: $.mCustomScrollbar.defaults.scrollInertia=500;\r\n\tto apply any changed default options on default selectors (below), use inside document ready fn\r\n\te.g.: $(document).ready(function(){ $.mCustomScrollbar.defaults.scrollInertia=500; });\r\n\t*/\r\n $[pluginNS].defaults = defaults;\r\n\r\n /*\r\n\tadd window object (window.mCustomScrollbar)\r\n\tusage: if(window.mCustomScrollbar){console.log(\"custom scrollbar plugin loaded\");}\r\n\t*/\r\n window[pluginNS] = true;\r\n\r\n $(window).bind(\"load\", function () {\r\n\r\n $(defaultSelector)[pluginNS]();\r\n /* add scrollbars automatically on default selector */\r\n\r\n /* extend jQuery expressions */\r\n $.extend($.expr[\":\"], {\r\n /* checks if element is within scrollable viewport */\r\n mcsInView: $.expr[\":\"].mcsInView || function (el) {\r\n var $el = $(el), content = $el.parents(\".mCSB_container\"), wrapper, cPos;\r\n if (!content.length) {\r\n return;\r\n }\r\n wrapper = content.parent();\r\n cPos = [content[0].offsetTop, content[0].offsetLeft];\r\n return cPos[0] + _childPos($el)[0] >= 0 && cPos[0] + _childPos($el)[0] < wrapper.height() - $el.outerHeight(false) &&\r\n cPos[1] + _childPos($el)[1] >= 0 && cPos[1] + _childPos($el)[1] < wrapper.width() - $el.outerWidth(false);\r\n },\r\n /* checks if element or part of element is in view of scrollable viewport */\r\n mcsInSight: $.expr[\":\"].mcsInSight || function (el, i, m) {\r\n var $el = $(el), elD, content = $el.parents(\".mCSB_container\"), wrapperView, pos, wrapperViewPct,\r\n pctVals = m[3] === \"exact\" ? [[1, 0], [1, 0]] : [[0.9, 0.1], [0.6, 0.4]];\r\n if (!content.length) {\r\n return;\r\n }\r\n elD = [$el.outerHeight(false), $el.outerWidth(false)];\r\n pos = [content[0].offsetTop + _childPos($el)[0], content[0].offsetLeft + _childPos($el)[1]];\r\n wrapperView = [content.parent()[0].offsetHeight, content.parent()[0].offsetWidth];\r\n wrapperViewPct = [elD[0] < wrapperView[0] ? pctVals[0] : pctVals[1], elD[1] < wrapperView[1] ? pctVals[0] : pctVals[1]];\r\n return pos[0] - (wrapperView[0] * wrapperViewPct[0][0]) < 0 && pos[0] + elD[0] - (wrapperView[0] * wrapperViewPct[0][1]) >= 0 &&\r\n pos[1] - (wrapperView[1] * wrapperViewPct[1][0]) < 0 && pos[1] + elD[1] - (wrapperView[1] * wrapperViewPct[1][1]) >= 0;\r\n },\r\n /* checks if element is overflowed having visible scrollbar(s) */\r\n mcsOverflow: $.expr[\":\"].mcsOverflow || function (el) {\r\n var d = $(el).data(pluginPfx);\r\n if (!d) {\r\n return;\r\n }\r\n return d.overflowed[0] || d.overflowed[1];\r\n }\r\n });\r\n\r\n });\r\n\r\n }))\r\n}));\r\n\n\n\n// WEBPACK FOOTER //\n// ./src/static/scripts/plugins/jquery.mCustomScrollbar.js","/* globals __webpack_amd_options__ */\r\nmodule.exports = __webpack_amd_options__;\r\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// (webpack)/buildin/amd-options.js\n// module id = 114\n// module chunks = 0","/*!\n * jQuery Mousewheel 3.1.13\n *\n * Copyright jQuery Foundation and other contributors\n * Released under the MIT license\n * http://jquery.org/license\n */\n\n(function (factory) {\n if ( typeof define === 'function' && define.amd ) {\n // AMD. Register as an anonymous module.\n define(['jquery'], factory);\n } else if (typeof exports === 'object') {\n // Node/CommonJS style for Browserify\n module.exports = factory;\n } else {\n // Browser globals\n factory(jQuery);\n }\n}(function ($) {\n\n var toFix = ['wheel', 'mousewheel', 'DOMMouseScroll', 'MozMousePixelScroll'],\n toBind = ( 'onwheel' in document || document.documentMode >= 9 ) ?\n ['wheel'] : ['mousewheel', 'DomMouseScroll', 'MozMousePixelScroll'],\n slice = Array.prototype.slice,\n nullLowestDeltaTimeout, lowestDelta;\n\n if ( $.event.fixHooks ) {\n for ( var i = toFix.length; i; ) {\n $.event.fixHooks[ toFix[--i] ] = $.event.mouseHooks;\n }\n }\n\n var special = $.event.special.mousewheel = {\n version: '3.1.12',\n\n setup: function() {\n if ( this.addEventListener ) {\n for ( var i = toBind.length; i; ) {\n this.addEventListener( toBind[--i], handler, false );\n }\n } else {\n this.onmousewheel = handler;\n }\n // Store the line height and page height for this particular element\n $.data(this, 'mousewheel-line-height', special.getLineHeight(this));\n $.data(this, 'mousewheel-page-height', special.getPageHeight(this));\n },\n\n teardown: function() {\n if ( this.removeEventListener ) {\n for ( var i = toBind.length; i; ) {\n this.removeEventListener( toBind[--i], handler, false );\n }\n } else {\n this.onmousewheel = null;\n }\n // Clean up the data we added to the element\n $.removeData(this, 'mousewheel-line-height');\n $.removeData(this, 'mousewheel-page-height');\n },\n\n getLineHeight: function(elem) {\n var $elem = $(elem),\n $parent = $elem['offsetParent' in $.fn ? 'offsetParent' : 'parent']();\n if (!$parent.length) {\n $parent = $('body');\n }\n return parseInt($parent.css('fontSize'), 10) || parseInt($elem.css('fontSize'), 10) || 16;\n },\n\n getPageHeight: function(elem) {\n return $(elem).height();\n },\n\n settings: {\n adjustOldDeltas: true, // see shouldAdjustOldDeltas() below\n normalizeOffset: true // calls getBoundingClientRect for each event\n }\n };\n\n $.fn.extend({\n mousewheel: function(fn) {\n return fn ? this.bind('mousewheel', fn) : this.trigger('mousewheel');\n },\n\n unmousewheel: function(fn) {\n return this.unbind('mousewheel', fn);\n }\n });\n\n\n function handler(event) {\n var orgEvent = event || window.event,\n args = slice.call(arguments, 1),\n delta = 0,\n deltaX = 0,\n deltaY = 0,\n absDelta = 0,\n offsetX = 0,\n offsetY = 0;\n event = $.event.fix(orgEvent);\n event.type = 'mousewheel';\n\n // Old school scrollwheel delta\n if ( 'detail' in orgEvent ) { deltaY = orgEvent.detail * -1; }\n if ( 'wheelDelta' in orgEvent ) { deltaY = orgEvent.wheelDelta; }\n if ( 'wheelDeltaY' in orgEvent ) { deltaY = orgEvent.wheelDeltaY; }\n if ( 'wheelDeltaX' in orgEvent ) { deltaX = orgEvent.wheelDeltaX * -1; }\n\n // Firefox < 17 horizontal scrolling related to DOMMouseScroll event\n if ( 'axis' in orgEvent && orgEvent.axis === orgEvent.HORIZONTAL_AXIS ) {\n deltaX = deltaY * -1;\n deltaY = 0;\n }\n\n // Set delta to be deltaY or deltaX if deltaY is 0 for backwards compatabilitiy\n delta = deltaY === 0 ? deltaX : deltaY;\n\n // New school wheel delta (wheel event)\n if ( 'deltaY' in orgEvent ) {\n deltaY = orgEvent.deltaY * -1;\n delta = deltaY;\n }\n if ( 'deltaX' in orgEvent ) {\n deltaX = orgEvent.deltaX;\n if ( deltaY === 0 ) { delta = deltaX * -1; }\n }\n\n // No change actually happened, no reason to go any further\n if ( deltaY === 0 && deltaX === 0 ) { return; }\n\n // Need to convert lines and pages to pixels if we aren't already in pixels\n // There are three delta modes:\n // * deltaMode 0 is by pixels, nothing to do\n // * deltaMode 1 is by lines\n // * deltaMode 2 is by pages\n if ( orgEvent.deltaMode === 1 ) {\n var lineHeight = $.data(this, 'mousewheel-line-height');\n delta *= lineHeight;\n deltaY *= lineHeight;\n deltaX *= lineHeight;\n } else if ( orgEvent.deltaMode === 2 ) {\n var pageHeight = $.data(this, 'mousewheel-page-height');\n delta *= pageHeight;\n deltaY *= pageHeight;\n deltaX *= pageHeight;\n }\n\n // Store lowest absolute delta to normalize the delta values\n absDelta = Math.max( Math.abs(deltaY), Math.abs(deltaX) );\n\n if ( !lowestDelta || absDelta < lowestDelta ) {\n lowestDelta = absDelta;\n\n // Adjust older deltas if necessary\n if ( shouldAdjustOldDeltas(orgEvent, absDelta) ) {\n lowestDelta /= 40;\n }\n }\n\n // Adjust older deltas if necessary\n if ( shouldAdjustOldDeltas(orgEvent, absDelta) ) {\n // Divide all the things by 40!\n delta /= 40;\n deltaX /= 40;\n deltaY /= 40;\n }\n\n // Get a whole, normalized value for the deltas\n delta = Math[ delta >= 1 ? 'floor' : 'ceil' ](delta / lowestDelta);\n deltaX = Math[ deltaX >= 1 ? 'floor' : 'ceil' ](deltaX / lowestDelta);\n deltaY = Math[ deltaY >= 1 ? 'floor' : 'ceil' ](deltaY / lowestDelta);\n\n // Normalise offsetX and offsetY properties\n if ( special.settings.normalizeOffset && this.getBoundingClientRect ) {\n var boundingRect = this.getBoundingClientRect();\n offsetX = event.clientX - boundingRect.left;\n offsetY = event.clientY - boundingRect.top;\n }\n\n // Add information to the event object\n event.deltaX = deltaX;\n event.deltaY = deltaY;\n event.deltaFactor = lowestDelta;\n event.offsetX = offsetX;\n event.offsetY = offsetY;\n // Go ahead and set deltaMode to 0 since we converted to pixels\n // Although this is a little odd since we overwrite the deltaX/Y\n // properties with normalized deltas.\n event.deltaMode = 0;\n\n // Add event and delta to the front of the arguments\n args.unshift(event, delta, deltaX, deltaY);\n\n // Clearout lowestDelta after sometime to better\n // handle multiple device types that give different\n // a different lowestDelta\n // Ex: trackpad = 3 and mouse wheel = 120\n if (nullLowestDeltaTimeout) { clearTimeout(nullLowestDeltaTimeout); }\n nullLowestDeltaTimeout = setTimeout(nullLowestDelta, 200);\n\n return ($.event.dispatch || $.event.handle).apply(this, args);\n }\n\n function nullLowestDelta() {\n lowestDelta = null;\n }\n\n function shouldAdjustOldDeltas(orgEvent, absDelta) {\n // If this is an older event and the delta is divisable by 120,\n // then we are assuming that the browser is treating this as an\n // older mouse wheel event and that we should divide the deltas\n // by 40 to try and get a more usable deltaFactor.\n // Side note, this actually impacts the reported scroll distance\n // in older browsers and can cause scrolling to be slower than native.\n // Turn this off by setting $.event.special.mousewheel.settings.adjustOldDeltas to false.\n return special.settings.adjustOldDeltas && orgEvent.type === 'mousewheel' && absDelta % 120 === 0;\n }\n\n}));\n\n\n\n// WEBPACK FOOTER //\n// ./node_modules/jquery-mousewheel/jquery.mousewheel.js","// ==================================================\r\n// fancyBox v3.2.10\r\n//\r\n// Licensed GPLv3 for open source use\r\n// or fancyBox Commercial License for commercial use\r\n//\r\n// http://fancyapps.com/fancybox/\r\n// Copyright 2017 fancyApps\r\n//\r\n// ==================================================\r\n;(function (window, document, $, undefined) {\r\n 'use strict';\r\n\r\n // If there's no jQuery, fancyBox can't work\r\n // =========================================\r\n\r\n if (!$) {\r\n return;\r\n }\r\n\r\n // Check if fancyBox is already initialized\r\n // ========================================\r\n\r\n if ($.fn.fancybox) {\r\n\r\n if ('console' in window) {\r\n console.log('fancyBox already initialized');\r\n }\r\n\r\n return;\r\n }\r\n\r\n // Private default settings\r\n // ========================\r\n\r\n var defaults = {\r\n\r\n // Enable infinite gallery navigation\r\n loop: false,\r\n\r\n // Space around image, ignored if zoomed-in or viewport width is smaller than 800px\r\n margin: [44, 0],\r\n\r\n // Horizontal space between slides\r\n gutter: 50,\r\n\r\n // Enable keyboard navigation\r\n keyboard: true,\r\n\r\n // Should display navigation arrows at the screen edges\r\n arrows: true,\r\n\r\n // Should display infobar (counter and arrows at the top)\r\n infobar: true,\r\n\r\n // Should display toolbar (buttons at the top)\r\n toolbar: true,\r\n\r\n // What buttons should appear in the top right corner.\r\n // Buttons will be created using templates from `btnTpl` option\r\n // and they will be placed into toolbar (class=\"fancybox-toolbar\"` element)\r\n buttons: [\r\n 'slideShow',\r\n 'fullScreen',\r\n 'thumbs',\r\n 'share',\r\n //'download',\r\n //'zoom',\r\n 'close'\r\n ],\r\n\r\n // Detect \"idle\" time in seconds\r\n idleTime: 3,\r\n\r\n // Should display buttons at top right corner of the content\r\n // If 'auto' - they will be created for content having type 'html', 'inline' or 'ajax'\r\n // Use template from `btnTpl.smallBtn` for customization\r\n smallBtn: 'auto',\r\n\r\n // Disable right-click and use simple image protection for images\r\n protect: false,\r\n\r\n // Shortcut to make content \"modal\" - disable keyboard navigtion, hide buttons, etc\r\n modal: false,\r\n\r\n image: {\r\n\r\n // Wait for images to load before displaying\r\n // Requires predefined image dimensions\r\n // If 'auto' - will zoom in thumbnail if 'width' and 'height' attributes are found\r\n preload: \"auto\"\r\n\r\n },\r\n\r\n ajax: {\r\n\r\n // Object containing settings for ajax request\r\n settings: {\r\n\r\n // This helps to indicate that request comes from the modal\r\n // Feel free to change naming\r\n data: {\r\n fancybox: true\r\n }\r\n }\r\n\r\n },\r\n\r\n iframe: {\r\n\r\n // Iframe template\r\n tpl: '',\r\n\r\n // Preload iframe before displaying it\r\n // This allows to calculate iframe content width and height\r\n // (note: Due to \"Same Origin Policy\", you can't get cross domain data).\r\n preload: true,\r\n\r\n // Custom CSS styling for iframe wrapping element\r\n // You can use this to set custom iframe dimensions\r\n css: {},\r\n\r\n // Iframe tag attributes\r\n attr: {\r\n scrolling: 'auto'\r\n }\r\n\r\n },\r\n\r\n // Default content type if cannot be detected automatically\r\n defaultType: 'image',\r\n\r\n // Open/close animation type\r\n // Possible values:\r\n // false - disable\r\n // \"zoom\" - zoom images from/to thumbnail\r\n // \"fade\"\r\n // \"zoom-in-out\"\r\n //\r\n animationEffect: \"zoom\",\r\n\r\n // Duration in ms for open/close animation\r\n animationDuration: 500,\r\n\r\n // Should image change opacity while zooming\r\n // If opacity is \"auto\", then opacity will be changed if image and thumbnail have different aspect ratios\r\n zoomOpacity: \"auto\",\r\n\r\n // Transition effect between slides\r\n //\r\n // Possible values:\r\n // false - disable\r\n // \"fade'\r\n // \"slide'\r\n // \"circular'\r\n // \"tube'\r\n // \"zoom-in-out'\r\n // \"rotate'\r\n //\r\n transitionEffect: \"fade\",\r\n\r\n // Duration in ms for transition animation\r\n transitionDuration: 366,\r\n\r\n // Custom CSS class for slide element\r\n slideClass: '',\r\n\r\n // Custom CSS class for layout\r\n baseClass: '',\r\n\r\n // Base template for layout\r\n baseTpl:\r\n '
' +\r\n '
' +\r\n '
' +\r\n '
' +\r\n ' / ' +\r\n '
' +\r\n '
{{buttons}}
' +\r\n '
{{arrows}}
' +\r\n '
' +\r\n '
' +\r\n '
' +\r\n '
',\r\n\r\n // Loading indicator template\r\n spinnerTpl: '
',\r\n\r\n // Error message template\r\n errorTpl: '

{{ERROR}}

',\r\n\r\n btnTpl: {\r\n\r\n download: '
' +\r\n '' +\r\n '' +\r\n '' +\r\n '',\r\n\r\n zoom: '',\r\n\r\n close: '',\r\n\r\n // This small close button will be appended to your html/inline/ajax content by default,\r\n // if \"smallBtn\" option is not set to false\r\n smallBtn: '',\r\n\r\n // Arrows\r\n arrowLeft: '',\r\n\r\n arrowRight: ''\r\n },\r\n\r\n // Container is injected into this element\r\n parentEl: 'body',\r\n\r\n\r\n // Focus handling\r\n // ==============\r\n\r\n // Try to focus on the first focusable element after opening\r\n autoFocus: false,\r\n\r\n // Put focus back to active element after closing\r\n backFocus: true,\r\n\r\n // Do not let user to focus on element outside modal content\r\n trapFocus: true,\r\n\r\n\r\n // Module specific options\r\n // =======================\r\n\r\n fullScreen: {\r\n autoStart: false,\r\n },\r\n\r\n // Set `touch: false` to disable dragging/swiping\r\n touch: {\r\n vertical: true, // Allow to drag content vertically\r\n momentum: true // Continue movement after releasing mouse/touch when panning\r\n },\r\n\r\n // Hash value when initializing manually,\r\n // set `false` to disable hash change\r\n hash: null,\r\n\r\n // Customize or add new media types\r\n // Example:\r\n /*\r\n media : {\r\n youtube : {\r\n params : {\r\n autoplay : 0\r\n }\r\n }\r\n }\r\n */\r\n media: {},\r\n\r\n slideShow: {\r\n autoStart: false,\r\n speed: 4000\r\n },\r\n\r\n thumbs: {\r\n autoStart: false, // Display thumbnails on opening\r\n hideOnClose: true, // Hide thumbnail grid when closing animation starts\r\n parentEl: '.fancybox-container', // Container is injected into this element\r\n axis: 'y' // Vertical (y) or horizontal (x) scrolling\r\n },\r\n\r\n // Use mousewheel to navigate gallery\r\n // If 'auto' - enabled for images only\r\n wheel: 'auto',\r\n\r\n // Callbacks\r\n //==========\r\n\r\n // See Documentation/API/Events for more information\r\n // Example:\r\n /*\r\n afterShow: function( instance, current ) {\r\n console.info( 'Clicked element:' );\r\n console.info( current.opts.$orig );\r\n }\r\n */\r\n\r\n onInit: $.noop, // When instance has been initialized\r\n\r\n beforeLoad: $.noop, // Before the content of a slide is being loaded\r\n afterLoad: $.noop, // When the content of a slide is done loading\r\n\r\n beforeShow: $.noop, // Before open animation starts\r\n afterShow: $.noop, // When content is done loading and animating\r\n\r\n beforeClose: $.noop, // Before the instance attempts to close. Return false to cancel the close.\r\n afterClose: $.noop, // After instance has been closed\r\n\r\n onActivate: $.noop, // When instance is brought to front\r\n onDeactivate: $.noop, // When other instance has been activated\r\n\r\n\r\n // Interaction\r\n // ===========\r\n\r\n // Use options below to customize taken action when user clicks or double clicks on the fancyBox area,\r\n // each option can be string or method that returns value.\r\n //\r\n // Possible values:\r\n // \"close\" - close instance\r\n // \"next\" - move to next gallery item\r\n // \"nextOrClose\" - move to next gallery item or close if gallery has only one item\r\n // \"toggleControls\" - show/hide controls\r\n // \"zoom\" - zoom image (if loaded)\r\n // false - do nothing\r\n\r\n // Clicked on the content\r\n clickContent: function (current, event) {\r\n return current.type === 'image' ? 'zoom' : false;\r\n },\r\n\r\n // Clicked on the slide\r\n clickSlide: 'close',\r\n\r\n // Clicked on the background (backdrop) element\r\n clickOutside: 'close',\r\n\r\n // Same as previous two, but for double click\r\n dblclickContent: false,\r\n dblclickSlide: false,\r\n dblclickOutside: false,\r\n\r\n\r\n // Custom options when mobile device is detected\r\n // =============================================\r\n\r\n mobile: {\r\n idleTime: false,\r\n margin: 0,\r\n\r\n clickContent: function (current, event) {\r\n return current.type === 'image' ? 'toggleControls' : false;\r\n },\r\n clickSlide: function (current, event) {\r\n return current.type === 'image' ? 'toggleControls' : 'close';\r\n },\r\n dblclickContent: function (current, event) {\r\n return current.type === 'image' ? 'zoom' : false;\r\n },\r\n dblclickSlide: function (current, event) {\r\n return current.type === 'image' ? 'zoom' : false;\r\n }\r\n },\r\n\r\n\r\n // Internationalization\r\n // ============\r\n\r\n lang: 'en',\r\n i18n: {\r\n 'en': {\r\n CLOSE: 'Close',\r\n NEXT: 'Next',\r\n PREV: 'Previous',\r\n ERROR: 'The requested content cannot be loaded.
Please try again later.',\r\n PLAY_START: 'Start slideshow',\r\n PLAY_STOP: 'Pause slideshow',\r\n FULL_SCREEN: 'Full screen',\r\n THUMBS: 'Thumbnails',\r\n DOWNLOAD: 'Download',\r\n SHARE: 'Share',\r\n ZOOM: 'Zoom'\r\n },\r\n 'de': {\r\n CLOSE: 'Schliessen',\r\n NEXT: 'Weiter',\r\n PREV: 'Zurück',\r\n ERROR: 'Die angeforderten Daten konnten nicht geladen werden.
Bitte versuchen Sie es später nochmal.',\r\n PLAY_START: 'Diaschau starten',\r\n PLAY_STOP: 'Diaschau beenden',\r\n FULL_SCREEN: 'Vollbild',\r\n THUMBS: 'Vorschaubilder',\r\n DOWNLOAD: 'Herunterladen',\r\n SHARE: 'Teilen',\r\n ZOOM: 'Maßstab'\r\n }\r\n }\r\n\r\n };\r\n\r\n // Few useful variables and methods\r\n // ================================\r\n\r\n var $W = $(window);\r\n var $D = $(document);\r\n\r\n var called = 0;\r\n\r\n\r\n // Check if an object is a jQuery object and not a native JavaScript object\r\n // ========================================================================\r\n\r\n var isQuery = function (obj) {\r\n return obj && obj.hasOwnProperty && obj instanceof $;\r\n };\r\n\r\n\r\n // Handle multiple browsers for \"requestAnimationFrame\" and \"cancelAnimationFrame\"\r\n // ===============================================================================\r\n\r\n var requestAFrame = (function () {\r\n return window.requestAnimationFrame ||\r\n window.webkitRequestAnimationFrame ||\r\n window.mozRequestAnimationFrame ||\r\n window.oRequestAnimationFrame ||\r\n // if all else fails, use setTimeout\r\n function (callback) {\r\n return window.setTimeout(callback, 1000 / 60);\r\n };\r\n })();\r\n\r\n\r\n // Detect the supported transition-end event property name\r\n // =======================================================\r\n\r\n var transitionEnd = (function () {\r\n var t, el = document.createElement(\"fakeelement\");\r\n\r\n var transitions = {\r\n \"transition\": \"transitionend\",\r\n \"OTransition\": \"oTransitionEnd\",\r\n \"MozTransition\": \"transitionend\",\r\n \"WebkitTransition\": \"webkitTransitionEnd\"\r\n };\r\n\r\n for (t in transitions) {\r\n if (el.style[t] !== undefined) {\r\n return transitions[t];\r\n }\r\n }\r\n\r\n return 'transitionend';\r\n })();\r\n\r\n\r\n // Force redraw on an element.\r\n // This helps in cases where the browser doesn't redraw an updated element properly.\r\n // =================================================================================\r\n\r\n var forceRedraw = function ($el) {\r\n return ( $el && $el.length && $el[0].offsetHeight );\r\n };\r\n\r\n\r\n // Class definition\r\n // ================\r\n\r\n var FancyBox = function (content, opts, index) {\r\n var self = this;\r\n\r\n self.opts = $.extend(true, {index: index}, $.fancybox.defaults, opts || {});\r\n\r\n if ($.fancybox.isMobile) {\r\n self.opts = $.extend(true, {}, self.opts, self.opts.mobile);\r\n }\r\n\r\n // Exclude buttons option from deep merging\r\n if (opts && $.isArray(opts.buttons)) {\r\n self.opts.buttons = opts.buttons;\r\n }\r\n\r\n self.id = self.opts.id || ++called;\r\n self.group = [];\r\n\r\n self.currIndex = parseInt(self.opts.index, 10) || 0;\r\n self.prevIndex = null;\r\n\r\n self.prevPos = null;\r\n self.currPos = 0;\r\n\r\n self.firstRun = null;\r\n\r\n // Create group elements from original item collection\r\n self.createGroup(content);\r\n\r\n if (!self.group.length) {\r\n return;\r\n }\r\n\r\n // Save last active element and current scroll position\r\n self.$lastFocus = $(document.activeElement).blur();\r\n\r\n // Collection of gallery objects\r\n self.slides = {};\r\n\r\n self.init();\r\n };\r\n\r\n $.extend(FancyBox.prototype, {\r\n\r\n // Create DOM structure\r\n // ====================\r\n\r\n init: function () {\r\n var self = this,\r\n firstItem = self.group[self.currIndex],\r\n firstItemOpts = firstItem.opts,\r\n scrollbarWidth = $.fancybox.scrollbarWidth,\r\n $scrollDiv,\r\n $container,\r\n buttonStr;\r\n\r\n self.scrollTop = $D.scrollTop();\r\n self.scrollLeft = $D.scrollLeft();\r\n\r\n\r\n // Hide scrollbars\r\n // ===============\r\n\r\n if (!$.fancybox.getInstance()) {\r\n\r\n $('body').addClass('fancybox-active');\r\n\r\n // iOS hack\r\n if (/iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream) {\r\n\r\n // iOS has problems for input elements inside fixed containers,\r\n // the workaround is to apply `position: fixed` to `` element,\r\n // unfortunately, this makes it lose the scrollbars and forces address bar to appear.\r\n\r\n if (firstItem.type !== 'image') {\r\n $('body').css('top', $('body').scrollTop() * -1).addClass('fancybox-iosfix');\r\n }\r\n\r\n } else if (!$.fancybox.isMobile && document.body.scrollHeight > window.innerHeight) {\r\n\r\n if (scrollbarWidth === undefined) {\r\n $scrollDiv = $('
').appendTo('body');\r\n\r\n scrollbarWidth = $.fancybox.scrollbarWidth = $scrollDiv[0].offsetWidth - $scrollDiv[0].clientWidth;\r\n\r\n $scrollDiv.remove();\r\n }\r\n\r\n $('head').append('');\r\n $('body').addClass('compensate-for-scrollbar');\r\n }\r\n }\r\n\r\n\r\n // Build html markup and set references\r\n // ====================================\r\n\r\n // Build html code for buttons and insert into main template\r\n buttonStr = '';\r\n\r\n $.each(firstItemOpts.buttons, function (index, value) {\r\n buttonStr += ( firstItemOpts.btnTpl[value] || '' );\r\n });\r\n\r\n // Create markup from base template, it will be initially hidden to\r\n // avoid unnecessary work like painting while initializing is not complete\r\n $container = $(\r\n self.translate(self,\r\n firstItemOpts.baseTpl\r\n .replace('\\{\\{buttons\\}\\}', buttonStr)\r\n .replace('\\{\\{arrows\\}\\}', firstItemOpts.btnTpl.arrowLeft + firstItemOpts.btnTpl.arrowRight)\r\n )\r\n )\r\n .attr('id', 'fancybox-container-' + self.id)\r\n .addClass('fancybox-is-hidden')\r\n .addClass(firstItemOpts.baseClass)\r\n .data('FancyBox', self)\r\n .appendTo(firstItemOpts.parentEl);\r\n\r\n // Create object holding references to jQuery wrapped nodes\r\n self.$refs = {\r\n container: $container\r\n };\r\n\r\n ['bg', 'inner', 'infobar', 'toolbar', 'stage', 'caption', 'navigation'].forEach(function (item) {\r\n self.$refs[item] = $container.find('.fancybox-' + item);\r\n });\r\n\r\n self.trigger('onInit');\r\n\r\n // Enable events, deactive previous instances\r\n self.activate();\r\n\r\n // Build slides, load and reveal content\r\n self.jumpTo(self.currIndex);\r\n },\r\n\r\n\r\n // Simple i18n support - replaces object keys found in template\r\n // with corresponding values\r\n // ============================================================\r\n\r\n translate: function (obj, str) {\r\n var arr = obj.opts.i18n[obj.opts.lang];\r\n\r\n return str.replace(/\\{\\{(\\w+)\\}\\}/g, function (match, n) {\r\n var value = arr[n];\r\n\r\n if (value === undefined) {\r\n return match;\r\n }\r\n\r\n return value;\r\n });\r\n },\r\n\r\n // Create array of gally item objects\r\n // Check if each object has valid type and content\r\n // ===============================================\r\n\r\n createGroup: function (content) {\r\n var self = this;\r\n var items = $.makeArray(content);\r\n\r\n $.each(items, function (i, item) {\r\n var obj = {},\r\n opts = {},\r\n $item,\r\n type,\r\n found,\r\n src,\r\n srcParts;\r\n\r\n // Step 1 - Make sure we have an object\r\n // ====================================\r\n\r\n if ($.isPlainObject(item)) {\r\n\r\n // We probably have manual usage here, something like\r\n // $.fancybox.open( [ { src : \"image.jpg\", type : \"image\" } ] )\r\n\r\n obj = item;\r\n opts = item.opts || item;\r\n\r\n } else if ($.type(item) === 'object' && $(item).length) {\r\n\r\n // Here we probably have jQuery collection returned by some selector\r\n $item = $(item);\r\n\r\n opts = $item.data();\r\n opts = $.extend({}, opts, opts.options || {});\r\n\r\n // Here we store clicked element\r\n opts.$orig = $item;\r\n\r\n obj.src = opts.src || $item.attr('href');\r\n\r\n // Assume that simple syntax is used, for example:\r\n // `$.fancybox.open( $(\"#test\"), {} );`\r\n if (!obj.type && !obj.src) {\r\n obj.type = 'inline';\r\n obj.src = item;\r\n }\r\n\r\n } else {\r\n\r\n // Assume we have a simple html code, for example:\r\n // $.fancybox.open( '

Hi!

' );\r\n\r\n obj = {\r\n type: 'html',\r\n src: item + ''\r\n };\r\n\r\n }\r\n\r\n // Each gallery object has full collection of options\r\n obj.opts = $.extend(true, {}, self.opts, opts);\r\n\r\n // Do not merge buttons array\r\n if ($.isArray(opts.buttons)) {\r\n obj.opts.buttons = opts.buttons;\r\n }\r\n\r\n\r\n // Step 2 - Make sure we have content type, if not - try to guess\r\n // ==============================================================\r\n\r\n type = obj.type || obj.opts.type;\r\n src = obj.src || '';\r\n\r\n if (!type && src) {\r\n if (src.match(/(^data:image\\/[a-z0-9+\\/=]*,)|(\\.(jp(e|g|eg)|gif|png|bmp|webp|svg|ico)((\\?|#).*)?$)/i)) {\r\n type = 'image';\r\n\r\n } else if (src.match(/\\.(pdf)((\\?|#).*)?$/i)) {\r\n type = 'pdf';\r\n\r\n } else if (found = src.match(/\\.(mp4|mov|ogv)((\\?|#).*)?$/i)) {\r\n type = 'video';\r\n\r\n if (!obj.opts.videoFormat) {\r\n obj.opts.videoFormat = 'video/' + ( found[1] === 'ogv' ? 'ogg' : found[1] );\r\n }\r\n\r\n } else if (src.charAt(0) === '#') {\r\n type = 'inline';\r\n }\r\n }\r\n\r\n if (type) {\r\n obj.type = type;\r\n\r\n } else {\r\n self.trigger('objectNeedsType', obj);\r\n }\r\n\r\n\r\n // Step 3 - Some adjustments\r\n // =========================\r\n\r\n obj.index = self.group.length;\r\n\r\n // Check if $orig and $thumb objects exist\r\n if (obj.opts.$orig && !obj.opts.$orig.length) {\r\n delete obj.opts.$orig;\r\n }\r\n\r\n if (!obj.opts.$thumb && obj.opts.$orig) {\r\n obj.opts.$thumb = obj.opts.$orig.find('img:first');\r\n }\r\n\r\n if (obj.opts.$thumb && !obj.opts.$thumb.length) {\r\n delete obj.opts.$thumb;\r\n }\r\n\r\n // \"caption\" is a \"special\" option, it can be used to customize caption per gallery item ..\r\n if ($.type(obj.opts.caption) === 'function') {\r\n obj.opts.caption = obj.opts.caption.apply(item, [self, obj]);\r\n }\r\n\r\n if ($.type(self.opts.caption) === 'function') {\r\n obj.opts.caption = self.opts.caption.apply(item, [self, obj]);\r\n }\r\n\r\n // Make sure we have caption as a string or jQuery object\r\n if (!( obj.opts.caption instanceof $ )) {\r\n obj.opts.caption = obj.opts.caption === undefined ? '' : obj.opts.caption + '';\r\n }\r\n\r\n // Check if url contains \"filter\" used to filter the content\r\n // Example: \"ajax.html #something\"\r\n if (type === 'ajax') {\r\n srcParts = src.split(/\\s+/, 2);\r\n\r\n if (srcParts.length > 1) {\r\n obj.src = srcParts.shift();\r\n\r\n obj.opts.filter = srcParts.shift();\r\n }\r\n }\r\n\r\n if (obj.opts.smallBtn == 'auto') {\r\n\r\n if ($.inArray(type, ['html', 'inline', 'ajax']) > -1) {\r\n obj.opts.toolbar = false;\r\n obj.opts.smallBtn = true;\r\n\r\n } else {\r\n obj.opts.smallBtn = false;\r\n }\r\n\r\n }\r\n\r\n // If the type is \"pdf\", then simply load file into iframe\r\n if (type === 'pdf') {\r\n obj.type = 'iframe';\r\n\r\n obj.opts.iframe.preload = false;\r\n }\r\n\r\n // Hide all buttons and disable interactivity for modal items\r\n if (obj.opts.modal) {\r\n\r\n obj.opts = $.extend(true, obj.opts, {\r\n // Remove buttons\r\n infobar: 0,\r\n toolbar: 0,\r\n\r\n smallBtn: 0,\r\n\r\n // Disable keyboard navigation\r\n keyboard: 0,\r\n\r\n // Disable some modules\r\n slideShow: 0,\r\n fullScreen: 0,\r\n thumbs: 0,\r\n touch: 0,\r\n\r\n // Disable click event handlers\r\n clickContent: false,\r\n clickSlide: false,\r\n clickOutside: false,\r\n dblclickContent: false,\r\n dblclickSlide: false,\r\n dblclickOutside: false\r\n });\r\n\r\n }\r\n\r\n // Step 4 - Add processed object to group\r\n // ======================================\r\n\r\n self.group.push(obj);\r\n\r\n });\r\n\r\n },\r\n\r\n\r\n // Attach an event handler functions for:\r\n // - navigation buttons\r\n // - browser scrolling, resizing;\r\n // - focusing\r\n // - keyboard\r\n // - detect idle\r\n // ======================================\r\n\r\n addEvents: function () {\r\n var self = this;\r\n\r\n self.removeEvents();\r\n\r\n // Make navigation elements clickable\r\n self.$refs.container.on('click.fb-close', '[data-fancybox-close]', function (e) {\r\n e.stopPropagation();\r\n e.preventDefault();\r\n\r\n self.close(e);\r\n\r\n }).on('click.fb-prev touchend.fb-prev', '[data-fancybox-prev]', function (e) {\r\n e.stopPropagation();\r\n e.preventDefault();\r\n\r\n self.previous();\r\n\r\n }).on('click.fb-next touchend.fb-next', '[data-fancybox-next]', function (e) {\r\n e.stopPropagation();\r\n e.preventDefault();\r\n\r\n self.next();\r\n\r\n }).on('click.fb', '[data-fancybox-zoom]', function (e) {\r\n // Click handler for zoom button\r\n self[self.isScaledDown() ? 'scaleToActual' : 'scaleToFit']();\r\n });\r\n\r\n\r\n // Handle page scrolling and browser resizing\r\n $W.on('orientationchange.fb resize.fb', function (e) {\r\n\r\n if (e && e.originalEvent && e.originalEvent.type === \"resize\") {\r\n\r\n requestAFrame(function () {\r\n self.update();\r\n });\r\n\r\n } else {\r\n\r\n self.$refs.stage.hide();\r\n\r\n setTimeout(function () {\r\n self.$refs.stage.show();\r\n\r\n self.update();\r\n }, 600);\r\n\r\n }\r\n\r\n });\r\n\r\n // Trap keyboard focus inside of the modal, so the user does not accidentally tab outside of the modal\r\n // (a.k.a. \"escaping the modal\")\r\n $D.on('focusin.fb', function (e) {\r\n var instance = $.fancybox ? $.fancybox.getInstance() : null;\r\n\r\n if (instance.isClosing || !instance.current || !instance.current.opts.trapFocus || $(e.target).hasClass('fancybox-container') || $(e.target).is(document)) {\r\n return;\r\n }\r\n\r\n if (instance && $(e.target).css('position') !== 'fixed' && !instance.$refs.container.has(e.target).length) {\r\n e.stopPropagation();\r\n\r\n instance.focus();\r\n\r\n // Sometimes page gets scrolled, set it back\r\n $W.scrollTop(self.scrollTop).scrollLeft(self.scrollLeft);\r\n }\r\n });\r\n\r\n\r\n // Enable keyboard navigation\r\n $D.on('keydown.fb', function (e) {\r\n var current = self.current,\r\n keycode = e.keyCode || e.which;\r\n\r\n if (!current || !current.opts.keyboard) {\r\n return;\r\n }\r\n\r\n if ($(e.target).is('input') || $(e.target).is('textarea')) {\r\n return;\r\n }\r\n\r\n // Backspace and Esc keys\r\n if (keycode === 8 || keycode === 27) {\r\n e.preventDefault();\r\n\r\n self.close(e);\r\n\r\n return;\r\n }\r\n\r\n // Left arrow and Up arrow\r\n if (keycode === 37 || keycode === 38) {\r\n e.preventDefault();\r\n\r\n self.previous();\r\n\r\n return;\r\n }\r\n\r\n // Righ arrow and Down arrow\r\n if (keycode === 39 || keycode === 40) {\r\n e.preventDefault();\r\n\r\n self.next();\r\n\r\n return;\r\n }\r\n\r\n self.trigger('afterKeydown', e, keycode);\r\n });\r\n\r\n\r\n // Hide controls after some inactivity period\r\n if (self.group[self.currIndex].opts.idleTime) {\r\n self.idleSecondsCounter = 0;\r\n\r\n $D.on('mousemove.fb-idle mouseleave.fb-idle mousedown.fb-idle touchstart.fb-idle touchmove.fb-idle scroll.fb-idle keydown.fb-idle', function (e) {\r\n self.idleSecondsCounter = 0;\r\n\r\n if (self.isIdle) {\r\n self.showControls();\r\n }\r\n\r\n self.isIdle = false;\r\n });\r\n\r\n self.idleInterval = window.setInterval(function () {\r\n self.idleSecondsCounter++;\r\n\r\n if (self.idleSecondsCounter >= self.group[self.currIndex].opts.idleTime && !self.isDragging) {\r\n self.isIdle = true;\r\n self.idleSecondsCounter = 0;\r\n\r\n self.hideControls();\r\n }\r\n\r\n }, 1000);\r\n }\r\n\r\n },\r\n\r\n\r\n // Remove events added by the core\r\n // ===============================\r\n\r\n removeEvents: function () {\r\n var self = this;\r\n\r\n $W.off('orientationchange.fb resize.fb');\r\n $D.off('focusin.fb keydown.fb .fb-idle');\r\n\r\n this.$refs.container.off('.fb-close .fb-prev .fb-next');\r\n\r\n if (self.idleInterval) {\r\n window.clearInterval(self.idleInterval);\r\n\r\n self.idleInterval = null;\r\n }\r\n },\r\n\r\n\r\n // Change to previous gallery item\r\n // ===============================\r\n\r\n previous: function (duration) {\r\n return this.jumpTo(this.currPos - 1, duration);\r\n },\r\n\r\n\r\n // Change to next gallery item\r\n // ===========================\r\n\r\n next: function (duration) {\r\n return this.jumpTo(this.currPos + 1, duration);\r\n },\r\n\r\n\r\n // Switch to selected gallery item\r\n // ===============================\r\n\r\n jumpTo: function (pos, duration, slide) {\r\n var self = this,\r\n firstRun,\r\n loop,\r\n current,\r\n previous,\r\n canvasWidth,\r\n currentPos,\r\n transitionProps;\r\n\r\n var groupLen = self.group.length;\r\n\r\n if (self.isDragging || self.isClosing || ( self.isAnimating && self.firstRun )) {\r\n return;\r\n }\r\n\r\n pos = parseInt(pos, 10);\r\n loop = self.current ? self.current.opts.loop : self.opts.loop;\r\n\r\n if (!loop && ( pos < 0 || pos >= groupLen )) {\r\n return false;\r\n }\r\n\r\n firstRun = self.firstRun = ( self.firstRun === null );\r\n\r\n if (groupLen < 2 && !firstRun && !!self.isDragging) {\r\n return;\r\n }\r\n\r\n previous = self.current;\r\n\r\n self.prevIndex = self.currIndex;\r\n self.prevPos = self.currPos;\r\n\r\n // Create slides\r\n current = self.createSlide(pos);\r\n\r\n if (groupLen > 1) {\r\n if (loop || current.index > 0) {\r\n self.createSlide(pos - 1);\r\n }\r\n\r\n if (loop || current.index < groupLen - 1) {\r\n self.createSlide(pos + 1);\r\n }\r\n }\r\n\r\n self.current = current;\r\n self.currIndex = current.index;\r\n self.currPos = current.pos;\r\n\r\n self.trigger('beforeShow', firstRun);\r\n\r\n self.updateControls();\r\n\r\n currentPos = $.fancybox.getTranslate(current.$slide);\r\n\r\n current.isMoved = ( currentPos.left !== 0 || currentPos.top !== 0 ) && !current.$slide.hasClass('fancybox-animated');\r\n current.forcedDuration = undefined;\r\n\r\n if ($.isNumeric(duration)) {\r\n current.forcedDuration = duration;\r\n } else {\r\n duration = current.opts[firstRun ? 'animationDuration' : 'transitionDuration'];\r\n }\r\n\r\n duration = parseInt(duration, 10);\r\n\r\n // Fresh start - reveal container, current slide and start loading content\r\n if (firstRun) {\r\n\r\n if (current.opts.animationEffect && duration) {\r\n self.$refs.container.css('transition-duration', duration + 'ms');\r\n }\r\n\r\n self.$refs.container.removeClass('fancybox-is-hidden');\r\n\r\n forceRedraw(self.$refs.container);\r\n\r\n self.$refs.container.addClass('fancybox-is-open');\r\n\r\n // Make first slide visible (to display loading icon, if needed)\r\n current.$slide.addClass('fancybox-slide--current');\r\n\r\n self.loadSlide(current);\r\n\r\n self.preload('image');\r\n\r\n return;\r\n }\r\n\r\n // Clean up\r\n $.each(self.slides, function (index, slide) {\r\n $.fancybox.stop(slide.$slide);\r\n });\r\n\r\n // Make current that slide is visible even if content is still loading\r\n current.$slide.removeClass('fancybox-slide--next fancybox-slide--previous').addClass('fancybox-slide--current');\r\n\r\n // If slides have been dragged, animate them to correct position\r\n if (current.isMoved) {\r\n canvasWidth = Math.round(current.$slide.width());\r\n\r\n $.each(self.slides, function (index, slide) {\r\n var pos = slide.pos - current.pos;\r\n\r\n $.fancybox.animate(slide.$slide, {\r\n top: 0,\r\n left: ( pos * canvasWidth ) + ( pos * slide.opts.gutter )\r\n }, duration, function () {\r\n\r\n slide.$slide.removeAttr('style').removeClass('fancybox-slide--next fancybox-slide--previous');\r\n\r\n if (slide.pos === self.currPos) {\r\n current.isMoved = false;\r\n\r\n self.complete();\r\n }\r\n });\r\n });\r\n\r\n } else {\r\n self.$refs.stage.children().removeAttr('style');\r\n }\r\n\r\n // Start transition that reveals current content\r\n // or wait when it will be loaded\r\n\r\n if (current.isLoaded) {\r\n self.revealContent(current);\r\n\r\n } else {\r\n self.loadSlide(current);\r\n }\r\n\r\n self.preload('image');\r\n\r\n if (previous.pos === current.pos) {\r\n return;\r\n }\r\n\r\n // Handle previous slide\r\n // =====================\r\n\r\n transitionProps = 'fancybox-slide--' + ( previous.pos > current.pos ? 'next' : 'previous' );\r\n\r\n previous.$slide.removeClass('fancybox-slide--complete fancybox-slide--current fancybox-slide--next fancybox-slide--previous');\r\n\r\n previous.isComplete = false;\r\n\r\n if (!duration || ( !current.isMoved && !current.opts.transitionEffect )) {\r\n return;\r\n }\r\n\r\n if (current.isMoved) {\r\n previous.$slide.addClass(transitionProps);\r\n\r\n } else {\r\n\r\n transitionProps = 'fancybox-animated ' + transitionProps + ' fancybox-fx-' + current.opts.transitionEffect;\r\n\r\n $.fancybox.animate(previous.$slide, transitionProps, duration, function () {\r\n previous.$slide.removeClass(transitionProps).removeAttr('style');\r\n });\r\n\r\n }\r\n\r\n },\r\n\r\n\r\n // Create new \"slide\" element\r\n // These are gallery items that are actually added to DOM\r\n // =======================================================\r\n\r\n createSlide: function (pos) {\r\n\r\n var self = this;\r\n var $slide;\r\n var index;\r\n\r\n index = pos % self.group.length;\r\n index = index < 0 ? self.group.length + index : index;\r\n\r\n if (!self.slides[pos] && self.group[index]) {\r\n $slide = $('
').appendTo(self.$refs.stage);\r\n\r\n self.slides[pos] = $.extend(true, {}, self.group[index], {\r\n pos: pos,\r\n $slide: $slide,\r\n isLoaded: false,\r\n });\r\n\r\n self.updateSlide(self.slides[pos]);\r\n }\r\n\r\n return self.slides[pos];\r\n },\r\n\r\n\r\n // Scale image to the actual size of the image\r\n // ===========================================\r\n\r\n scaleToActual: function (x, y, duration) {\r\n\r\n var self = this;\r\n\r\n var current = self.current;\r\n var $what = current.$content;\r\n\r\n var imgPos, posX, posY, scaleX, scaleY;\r\n\r\n var canvasWidth = parseInt(current.$slide.width(), 10);\r\n var canvasHeight = parseInt(current.$slide.height(), 10);\r\n\r\n var newImgWidth = current.width;\r\n var newImgHeight = current.height;\r\n\r\n if (!( current.type == 'image' && !current.hasError) || !$what || self.isAnimating) {\r\n return;\r\n }\r\n\r\n $.fancybox.stop($what);\r\n\r\n self.isAnimating = true;\r\n\r\n x = x === undefined ? canvasWidth * 0.5 : x;\r\n y = y === undefined ? canvasHeight * 0.5 : y;\r\n\r\n imgPos = $.fancybox.getTranslate($what);\r\n\r\n scaleX = newImgWidth / imgPos.width;\r\n scaleY = newImgHeight / imgPos.height;\r\n\r\n // Get center position for original image\r\n posX = ( canvasWidth * 0.5 - newImgWidth * 0.5 );\r\n posY = ( canvasHeight * 0.5 - newImgHeight * 0.5 );\r\n\r\n // Make sure image does not move away from edges\r\n if (newImgWidth > canvasWidth) {\r\n posX = imgPos.left * scaleX - ( ( x * scaleX ) - x );\r\n\r\n if (posX > 0) {\r\n posX = 0;\r\n }\r\n\r\n if (posX < canvasWidth - newImgWidth) {\r\n posX = canvasWidth - newImgWidth;\r\n }\r\n }\r\n\r\n if (newImgHeight > canvasHeight) {\r\n posY = imgPos.top * scaleY - ( ( y * scaleY ) - y );\r\n\r\n if (posY > 0) {\r\n posY = 0;\r\n }\r\n\r\n if (posY < canvasHeight - newImgHeight) {\r\n posY = canvasHeight - newImgHeight;\r\n }\r\n }\r\n\r\n self.updateCursor(newImgWidth, newImgHeight);\r\n\r\n $.fancybox.animate($what, {\r\n top: posY,\r\n left: posX,\r\n scaleX: scaleX,\r\n scaleY: scaleY\r\n }, duration || 330, function () {\r\n self.isAnimating = false;\r\n });\r\n\r\n // Stop slideshow\r\n if (self.SlideShow && self.SlideShow.isActive) {\r\n self.SlideShow.stop();\r\n }\r\n },\r\n\r\n\r\n // Scale image to fit inside parent element\r\n // ========================================\r\n\r\n scaleToFit: function (duration) {\r\n\r\n var self = this;\r\n\r\n var current = self.current;\r\n var $what = current.$content;\r\n var end;\r\n\r\n if (!( current.type == 'image' && !current.hasError) || !$what || self.isAnimating) {\r\n return;\r\n }\r\n\r\n $.fancybox.stop($what);\r\n\r\n self.isAnimating = true;\r\n\r\n end = self.getFitPos(current);\r\n\r\n self.updateCursor(end.width, end.height);\r\n\r\n $.fancybox.animate($what, {\r\n top: end.top,\r\n left: end.left,\r\n scaleX: end.width / $what.width(),\r\n scaleY: end.height / $what.height()\r\n }, duration || 330, function () {\r\n self.isAnimating = false;\r\n });\r\n\r\n },\r\n\r\n // Calculate image size to fit inside viewport\r\n // ===========================================\r\n\r\n getFitPos: function (slide) {\r\n var self = this;\r\n var $what = slide.$content;\r\n\r\n var imgWidth = slide.width;\r\n var imgHeight = slide.height;\r\n\r\n var margin = slide.opts.margin;\r\n\r\n var canvasWidth, canvasHeight, minRatio, width, height;\r\n\r\n if (!$what || !$what.length || ( !imgWidth && !imgHeight)) {\r\n return false;\r\n }\r\n\r\n // Convert \"margin to CSS style: [ top, right, bottom, left ]\r\n if ($.type(margin) === \"number\") {\r\n margin = [margin, margin];\r\n }\r\n\r\n if (margin.length == 2) {\r\n margin = [margin[0], margin[1], margin[0], margin[1]];\r\n }\r\n\r\n // We can not use $slide width here, because it can have different diemensions while in transiton\r\n canvasWidth = parseInt(self.$refs.stage.width(), 10) - ( margin[1] + margin[3] );\r\n canvasHeight = parseInt(self.$refs.stage.height(), 10) - ( margin[0] + margin[2] );\r\n\r\n minRatio = Math.min(1, canvasWidth / imgWidth, canvasHeight / imgHeight);\r\n\r\n width = Math.floor(minRatio * imgWidth);\r\n height = Math.floor(minRatio * imgHeight);\r\n\r\n // Use floor rounding to make sure it really fits\r\n return {\r\n top: Math.floor(( canvasHeight - height ) * 0.5) + margin[0],\r\n left: Math.floor(( canvasWidth - width ) * 0.5) + margin[3],\r\n width: width,\r\n height: height\r\n };\r\n\r\n },\r\n\r\n\r\n // Update content size and position for all slides\r\n // ==============================================\r\n\r\n update: function () {\r\n var self = this;\r\n\r\n $.each(self.slides, function (key, slide) {\r\n self.updateSlide(slide);\r\n });\r\n },\r\n\r\n\r\n // Update slide content position and size\r\n // ======================================\r\n\r\n updateSlide: function (slide, duration) {\r\n var self = this,\r\n $what = slide && slide.$content;\r\n\r\n if ($what && ( slide.width || slide.height )) {\r\n self.isAnimating = false;\r\n\r\n $.fancybox.stop($what);\r\n\r\n $.fancybox.setTranslate($what, self.getFitPos(slide));\r\n\r\n if (slide.pos === self.currPos) {\r\n self.updateCursor();\r\n }\r\n }\r\n\r\n slide.$slide.trigger('refresh');\r\n\r\n self.trigger('onUpdate', slide);\r\n\r\n },\r\n\r\n\r\n // Horizontally center slide\r\n // =========================\r\n\r\n centerSlide: function (slide, duration) {\r\n var self = this, canvasWidth, pos;\r\n\r\n if (self.current) {\r\n canvasWidth = Math.round(slide.$slide.width());\r\n pos = slide.pos - self.current.pos;\r\n\r\n $.fancybox.animate(slide.$slide, {\r\n top: 0,\r\n left: ( pos * canvasWidth ) + ( pos * slide.opts.gutter ),\r\n opacity: 1\r\n }, duration === undefined ? 0 : duration, null, false);\r\n }\r\n },\r\n\r\n\r\n // Update cursor style depending if content can be zoomed\r\n // ======================================================\r\n\r\n updateCursor: function (nextWidth, nextHeight) {\r\n\r\n var self = this;\r\n var isScaledDown;\r\n\r\n var $container = self.$refs.container.removeClass('fancybox-is-zoomable fancybox-can-zoomIn fancybox-can-drag fancybox-can-zoomOut');\r\n\r\n if (!self.current || self.isClosing) {\r\n return;\r\n }\r\n\r\n if (self.isZoomable()) {\r\n\r\n $container.addClass('fancybox-is-zoomable');\r\n\r\n if (nextWidth !== undefined && nextHeight !== undefined) {\r\n isScaledDown = nextWidth < self.current.width && nextHeight < self.current.height;\r\n\r\n } else {\r\n isScaledDown = self.isScaledDown();\r\n }\r\n\r\n if (isScaledDown) {\r\n\r\n // If image is scaled down, then, obviously, it can be zoomed to full size\r\n $container.addClass('fancybox-can-zoomIn');\r\n\r\n } else {\r\n\r\n if (self.current.opts.touch) {\r\n\r\n // If image size ir largen than available available and touch module is not disable,\r\n // then user can do panning\r\n $container.addClass('fancybox-can-drag');\r\n\r\n } else {\r\n $container.addClass('fancybox-can-zoomOut');\r\n }\r\n\r\n }\r\n\r\n } else if (self.current.opts.touch) {\r\n $container.addClass('fancybox-can-drag');\r\n }\r\n\r\n },\r\n\r\n\r\n // Check if current slide is zoomable\r\n // ==================================\r\n\r\n isZoomable: function () {\r\n\r\n var self = this;\r\n\r\n var current = self.current;\r\n var fitPos;\r\n\r\n if (!current || self.isClosing) {\r\n return;\r\n }\r\n\r\n // Assume that slide is zoomable if\r\n // - image is loaded successfuly\r\n // - click action is \"zoom\"\r\n // - actual size of the image is smaller than available area\r\n if (current.type === 'image' && current.isLoaded && !current.hasError &&\r\n ( current.opts.clickContent === 'zoom' || ( $.isFunction(current.opts.clickContent) && current.opts.clickContent(current) === \"zoom\" ) )\r\n ) {\r\n\r\n fitPos = self.getFitPos(current);\r\n\r\n if (current.width > fitPos.width || current.height > fitPos.height) {\r\n return true;\r\n }\r\n\r\n }\r\n\r\n return false;\r\n\r\n },\r\n\r\n\r\n // Check if current image dimensions are smaller than actual\r\n // =========================================================\r\n\r\n isScaledDown: function () {\r\n\r\n var self = this;\r\n\r\n var current = self.current;\r\n var $what = current.$content;\r\n\r\n var rez = false;\r\n\r\n if ($what) {\r\n rez = $.fancybox.getTranslate($what);\r\n rez = rez.width < current.width || rez.height < current.height;\r\n }\r\n\r\n return rez;\r\n\r\n },\r\n\r\n\r\n // Check if image dimensions exceed parent element\r\n // ===============================================\r\n\r\n canPan: function () {\r\n\r\n var self = this;\r\n\r\n var current = self.current;\r\n var $what = current.$content;\r\n\r\n var rez = false;\r\n\r\n if ($what) {\r\n rez = self.getFitPos(current);\r\n rez = Math.abs($what.width() - rez.width) > 1 || Math.abs($what.height() - rez.height) > 1;\r\n }\r\n\r\n return rez;\r\n\r\n },\r\n\r\n\r\n // Load content into the slide\r\n // ===========================\r\n\r\n loadSlide: function (slide) {\r\n\r\n var self = this, type, $slide;\r\n var ajaxLoad;\r\n\r\n if (slide.isLoading) {\r\n return;\r\n }\r\n\r\n if (slide.isLoaded) {\r\n return;\r\n }\r\n\r\n slide.isLoading = true;\r\n\r\n self.trigger('beforeLoad', slide);\r\n\r\n type = slide.type;\r\n $slide = slide.$slide;\r\n\r\n $slide\r\n .off('refresh')\r\n .trigger('onReset')\r\n .addClass('fancybox-slide--' + ( type || 'unknown' ))\r\n .addClass(slide.opts.slideClass);\r\n\r\n // Create content depending on the type\r\n\r\n switch (type) {\r\n\r\n case 'image':\r\n\r\n self.setImage(slide);\r\n\r\n break;\r\n\r\n case 'iframe':\r\n\r\n self.setIframe(slide);\r\n\r\n break;\r\n\r\n case 'html':\r\n\r\n self.setContent(slide, slide.src || slide.content);\r\n\r\n break;\r\n\r\n case 'inline':\r\n\r\n if ($(slide.src).length) {\r\n self.setContent(slide, $(slide.src));\r\n\r\n } else {\r\n self.setError(slide);\r\n }\r\n\r\n break;\r\n\r\n case 'ajax':\r\n\r\n self.showLoading(slide);\r\n\r\n ajaxLoad = $.ajax($.extend({}, slide.opts.ajax.settings, {\r\n url: slide.src,\r\n success: function (data, textStatus) {\r\n\r\n if (textStatus === 'success') {\r\n self.setContent(slide, data);\r\n }\r\n\r\n },\r\n error: function (jqXHR, textStatus) {\r\n\r\n if (jqXHR && textStatus !== 'abort') {\r\n self.setError(slide);\r\n }\r\n\r\n }\r\n }));\r\n\r\n $slide.one('onReset', function () {\r\n ajaxLoad.abort();\r\n });\r\n\r\n break;\r\n\r\n case 'video' :\r\n\r\n self.setContent(slide,\r\n ''\r\n );\r\n\r\n break;\r\n\r\n default:\r\n\r\n self.setError(slide);\r\n\r\n break;\r\n\r\n }\r\n\r\n return true;\r\n\r\n },\r\n\r\n\r\n // Use thumbnail image, if possible\r\n // ================================\r\n\r\n setImage: function (slide) {\r\n\r\n var self = this;\r\n var srcset = slide.opts.srcset || slide.opts.image.srcset;\r\n\r\n var found, temp, pxRatio, windowWidth;\r\n\r\n // If we have \"srcset\", then we need to find matching \"src\" value.\r\n // This is necessary, because when you set an src attribute, the browser will preload the image\r\n // before any javascript or even CSS is applied.\r\n if (srcset) {\r\n pxRatio = window.devicePixelRatio || 1;\r\n windowWidth = window.innerWidth * pxRatio;\r\n\r\n temp = srcset.split(',').map(function (el) {\r\n var ret = {};\r\n\r\n el.trim().split(/\\s+/).forEach(function (el, i) {\r\n var value = parseInt(el.substring(0, el.length - 1), 10);\r\n\r\n if (i === 0) {\r\n return ( ret.url = el );\r\n }\r\n\r\n if (value) {\r\n ret.value = value;\r\n ret.postfix = el[el.length - 1];\r\n }\r\n\r\n });\r\n\r\n return ret;\r\n });\r\n\r\n // Sort by value\r\n temp.sort(function (a, b) {\r\n return a.value - b.value;\r\n });\r\n\r\n // Ok, now we have an array of all srcset values\r\n for (var j = 0; j < temp.length; j++) {\r\n var el = temp[j];\r\n\r\n if (( el.postfix === 'w' && el.value >= windowWidth ) || ( el.postfix === 'x' && el.value >= pxRatio )) {\r\n found = el;\r\n break;\r\n }\r\n }\r\n\r\n // If not found, take the last one\r\n if (!found && temp.length) {\r\n found = temp[temp.length - 1];\r\n }\r\n\r\n if (found) {\r\n slide.src = found.url;\r\n\r\n // If we have default width/height values, we can calculate height for matching source\r\n if (slide.width && slide.height && found.postfix == 'w') {\r\n slide.height = ( slide.width / slide.height ) * found.value;\r\n slide.width = found.value;\r\n }\r\n }\r\n }\r\n\r\n // This will be wrapper containing both ghost and actual image\r\n slide.$content = $('
')\r\n .addClass('fancybox-is-hidden')\r\n .appendTo(slide.$slide);\r\n\r\n\r\n // If we have a thumbnail, we can display it while actual image is loading\r\n // Users will not stare at black screen and actual image will appear gradually\r\n if (slide.opts.preload !== false && slide.opts.width && slide.opts.height && ( slide.opts.thumb || slide.opts.$thumb )) {\r\n\r\n slide.width = slide.opts.width;\r\n slide.height = slide.opts.height;\r\n\r\n slide.$ghost = $('')\r\n .one('error', function () {\r\n\r\n $(this).remove();\r\n\r\n slide.$ghost = null;\r\n\r\n self.setBigImage(slide);\r\n\r\n })\r\n .one('load', function () {\r\n\r\n self.afterLoad(slide);\r\n\r\n self.setBigImage(slide);\r\n\r\n })\r\n .addClass('fancybox-image')\r\n .appendTo(slide.$content)\r\n .attr('src', slide.opts.thumb || slide.opts.$thumb.attr('src'));\r\n\r\n } else {\r\n\r\n self.setBigImage(slide);\r\n\r\n }\r\n\r\n },\r\n\r\n\r\n // Create full-size image\r\n // ======================\r\n\r\n setBigImage: function (slide) {\r\n var self = this;\r\n var $img = $('');\r\n\r\n slide.$image = $img\r\n .one('error', function () {\r\n\r\n self.setError(slide);\r\n\r\n })\r\n .one('load', function () {\r\n\r\n // Clear timeout that checks if loading icon needs to be displayed\r\n clearTimeout(slide.timouts);\r\n\r\n slide.timouts = null;\r\n\r\n if (self.isClosing) {\r\n return;\r\n }\r\n\r\n slide.width = slide.opts.width || this.naturalWidth;\r\n slide.height = slide.opts.height || this.naturalHeight;\r\n\r\n if (slide.opts.image.srcset) {\r\n $img.attr('sizes', '100vw').attr('srcset', slide.opts.image.srcset);\r\n }\r\n\r\n self.hideLoading(slide);\r\n\r\n if (slide.$ghost) {\r\n\r\n slide.timouts = setTimeout(function () {\r\n slide.timouts = null;\r\n\r\n slide.$ghost.hide();\r\n\r\n }, Math.min(300, Math.max(1000, slide.height / 1600)));\r\n\r\n } else {\r\n self.afterLoad(slide);\r\n }\r\n\r\n })\r\n .addClass('fancybox-image')\r\n .attr('src', slide.src)\r\n .appendTo(slide.$content);\r\n\r\n if (( $img[0].complete || $img[0].readyState == \"complete\" ) && $img[0].naturalWidth && $img[0].naturalHeight) {\r\n $img.trigger('load');\r\n\r\n } else if ($img[0].error) {\r\n $img.trigger('error');\r\n\r\n } else {\r\n\r\n slide.timouts = setTimeout(function () {\r\n if (!$img[0].complete && !slide.hasError) {\r\n self.showLoading(slide);\r\n }\r\n\r\n }, 100);\r\n\r\n }\r\n\r\n },\r\n\r\n\r\n // Create iframe wrapper, iframe and bindings\r\n // ==========================================\r\n\r\n setIframe: function (slide) {\r\n var self = this,\r\n opts = slide.opts.iframe,\r\n $slide = slide.$slide,\r\n $iframe;\r\n\r\n slide.$content = $('
')\r\n .css(opts.css)\r\n .appendTo($slide);\r\n\r\n $iframe = $(opts.tpl.replace(/\\{rnd\\}/g, new Date().getTime()))\r\n .attr(opts.attr)\r\n .appendTo(slide.$content);\r\n\r\n if (opts.preload) {\r\n\r\n self.showLoading(slide);\r\n\r\n // Unfortunately, it is not always possible to determine if iframe is successfully loaded\r\n // (due to browser security policy)\r\n\r\n $iframe.on('load.fb error.fb', function (e) {\r\n this.isReady = 1;\r\n\r\n slide.$slide.trigger('refresh');\r\n\r\n self.afterLoad(slide);\r\n });\r\n\r\n // Recalculate iframe content size\r\n // ===============================\r\n\r\n $slide.on('refresh.fb', function () {\r\n var $wrap = slide.$content,\r\n frameWidth = opts.css.width,\r\n frameHeight = opts.css.height,\r\n scrollWidth,\r\n $contents,\r\n $body;\r\n\r\n if ($iframe[0].isReady !== 1) {\r\n return;\r\n }\r\n\r\n // Check if content is accessible,\r\n // it will fail if frame is not with the same origin\r\n\r\n try {\r\n $contents = $iframe.contents();\r\n $body = $contents.find('body');\r\n\r\n } catch (ignore) {\r\n }\r\n\r\n // Calculate dimensions for the wrapper\r\n if ($body && $body.length) {\r\n\r\n if (frameWidth === undefined) {\r\n scrollWidth = $iframe[0].contentWindow.document.documentElement.scrollWidth;\r\n\r\n frameWidth = Math.ceil($body.outerWidth(true) + ( $wrap.width() - scrollWidth ));\r\n frameWidth += $wrap.outerWidth() - $wrap.innerWidth();\r\n }\r\n\r\n if (frameHeight === undefined) {\r\n frameHeight = Math.ceil($body.outerHeight(true));\r\n frameHeight += $wrap.outerHeight() - $wrap.innerHeight();\r\n }\r\n\r\n // Resize wrapper to fit iframe content\r\n if (frameWidth) {\r\n $wrap.width(frameWidth);\r\n }\r\n\r\n if (frameHeight) {\r\n $wrap.height(frameHeight);\r\n }\r\n }\r\n\r\n $wrap.removeClass('fancybox-is-hidden');\r\n\r\n });\r\n\r\n } else {\r\n\r\n this.afterLoad(slide);\r\n\r\n }\r\n\r\n $iframe.attr('src', slide.src);\r\n\r\n if (slide.opts.smallBtn === true) {\r\n slide.$content.prepend(self.translate(slide, slide.opts.btnTpl.smallBtn));\r\n }\r\n\r\n // Remove iframe if closing or changing gallery item\r\n $slide.one('onReset', function () {\r\n\r\n // This helps IE not to throw errors when closing\r\n try {\r\n\r\n $(this).find('iframe').hide().attr('src', '//about:blank');\r\n\r\n } catch (ignore) {\r\n }\r\n\r\n $(this).empty();\r\n\r\n slide.isLoaded = false;\r\n\r\n });\r\n\r\n },\r\n\r\n\r\n // Wrap and append content to the slide\r\n // ======================================\r\n\r\n setContent: function (slide, content) {\r\n\r\n var self = this;\r\n\r\n if (self.isClosing) {\r\n return;\r\n }\r\n\r\n self.hideLoading(slide);\r\n\r\n slide.$slide.empty();\r\n\r\n if (isQuery(content) && content.parent().length) {\r\n\r\n // If content is a jQuery object, then it will be moved to the slide.\r\n // The placeholder is created so we will know where to put it back.\r\n // If user is navigating gallery fast, then the content might be already inside fancyBox\r\n // =====================================================================================\r\n\r\n // Make sure content is not already moved to fancyBox\r\n content.parent('.fancybox-slide--inline').trigger('onReset');\r\n\r\n // Create temporary element marking original place of the content\r\n slide.$placeholder = $('
').hide().insertAfter(content);\r\n\r\n // Make sure content is visible\r\n content.css('display', 'inline-block');\r\n\r\n } else if (!slide.hasError) {\r\n\r\n // If content is just a plain text, try to convert it to html\r\n if ($.type(content) === 'string') {\r\n content = $('
').append($.trim(content)).contents();\r\n\r\n // If we have text node, then add wrapping element to make vertical alignment work\r\n if (content[0].nodeType === 3) {\r\n content = $('
').html(content);\r\n }\r\n }\r\n\r\n // If \"filter\" option is provided, then filter content\r\n if (slide.opts.filter) {\r\n content = $('
').html(content).find(slide.opts.filter);\r\n }\r\n\r\n }\r\n\r\n slide.$slide.one('onReset', function () {\r\n\r\n // Pause all html5 video/audio\r\n $(this).find('video,audio').trigger('pause');\r\n\r\n // Put content back\r\n if (slide.$placeholder) {\r\n slide.$placeholder.after(content.hide()).remove();\r\n\r\n slide.$placeholder = null;\r\n }\r\n\r\n // Remove custom close button\r\n if (slide.$smallBtn) {\r\n slide.$smallBtn.remove();\r\n\r\n slide.$smallBtn = null;\r\n }\r\n\r\n // Remove content and mark slide as not loaded\r\n if (!slide.hasError) {\r\n $(this).empty();\r\n\r\n slide.isLoaded = false;\r\n }\r\n\r\n });\r\n\r\n slide.$content = $(content).appendTo(slide.$slide);\r\n\r\n this.afterLoad(slide);\r\n },\r\n\r\n // Display error message\r\n // =====================\r\n\r\n setError: function (slide) {\r\n\r\n slide.hasError = true;\r\n\r\n slide.$slide.removeClass('fancybox-slide--' + slide.type);\r\n\r\n this.setContent(slide, this.translate(slide, slide.opts.errorTpl));\r\n\r\n },\r\n\r\n\r\n // Show loading icon inside the slide\r\n // ==================================\r\n\r\n showLoading: function (slide) {\r\n\r\n var self = this;\r\n\r\n slide = slide || self.current;\r\n\r\n if (slide && !slide.$spinner) {\r\n slide.$spinner = $(self.opts.spinnerTpl).appendTo(slide.$slide);\r\n }\r\n\r\n },\r\n\r\n // Remove loading icon from the slide\r\n // ==================================\r\n\r\n hideLoading: function (slide) {\r\n\r\n var self = this;\r\n\r\n slide = slide || self.current;\r\n\r\n if (slide && slide.$spinner) {\r\n slide.$spinner.remove();\r\n\r\n delete slide.$spinner;\r\n }\r\n\r\n },\r\n\r\n\r\n // Adjustments after slide content has been loaded\r\n // ===============================================\r\n\r\n afterLoad: function (slide) {\r\n\r\n var self = this;\r\n\r\n if (self.isClosing) {\r\n return;\r\n }\r\n\r\n slide.isLoading = false;\r\n slide.isLoaded = true;\r\n\r\n self.trigger('afterLoad', slide);\r\n\r\n self.hideLoading(slide);\r\n\r\n if (slide.opts.smallBtn && !slide.$smallBtn) {\r\n slide.$smallBtn = $(self.translate(slide, slide.opts.btnTpl.smallBtn)).appendTo(slide.$content.filter('div,form').first());\r\n }\r\n\r\n if (slide.opts.protect && slide.$content && !slide.hasError) {\r\n\r\n // Disable right click\r\n slide.$content.on('contextmenu.fb', function (e) {\r\n if (e.button == 2) {\r\n e.preventDefault();\r\n }\r\n\r\n return true;\r\n });\r\n\r\n // Add fake element on top of the image\r\n // This makes a bit harder for user to select image\r\n if (slide.type === 'image') {\r\n $('
').appendTo(slide.$content);\r\n }\r\n\r\n }\r\n\r\n self.revealContent(slide);\r\n\r\n },\r\n\r\n\r\n // Make content visible\r\n // This method is called right after content has been loaded or\r\n // user navigates gallery and transition should start\r\n // ============================================================\r\n\r\n revealContent: function (slide) {\r\n\r\n var self = this;\r\n var $slide = slide.$slide;\r\n\r\n var effect, effectClassName, duration, opacity, end, start = false;\r\n\r\n effect = slide.opts[self.firstRun ? 'animationEffect' : 'transitionEffect'];\r\n duration = slide.opts[self.firstRun ? 'animationDuration' : 'transitionDuration'];\r\n\r\n duration = parseInt(slide.forcedDuration === undefined ? duration : slide.forcedDuration, 10);\r\n\r\n if (slide.isMoved || slide.pos !== self.currPos || !duration) {\r\n effect = false;\r\n }\r\n\r\n // Check if can zoom\r\n if (effect === 'zoom' && !( slide.pos === self.currPos && duration && slide.type === 'image' && !slide.hasError && ( start = self.getThumbPos(slide) ) )) {\r\n effect = 'fade';\r\n }\r\n\r\n // Zoom animation\r\n // ==============\r\n\r\n if (effect === 'zoom') {\r\n end = self.getFitPos(slide);\r\n\r\n end.scaleX = end.width / start.width;\r\n end.scaleY = end.height / start.height;\r\n\r\n delete end.width;\r\n delete end.height;\r\n\r\n // Check if we need to animate opacity\r\n opacity = slide.opts.zoomOpacity;\r\n\r\n if (opacity == 'auto') {\r\n opacity = Math.abs(slide.width / slide.height - start.width / start.height) > 0.1;\r\n }\r\n\r\n if (opacity) {\r\n start.opacity = 0.1;\r\n end.opacity = 1;\r\n }\r\n\r\n // Draw image at start position\r\n $.fancybox.setTranslate(slide.$content.removeClass('fancybox-is-hidden'), start);\r\n\r\n forceRedraw(slide.$content);\r\n\r\n // Start animation\r\n $.fancybox.animate(slide.$content, end, duration, function () {\r\n self.complete();\r\n });\r\n\r\n return;\r\n }\r\n\r\n self.updateSlide(slide);\r\n\r\n\r\n // Simply show content\r\n // ===================\r\n\r\n if (!effect) {\r\n forceRedraw($slide);\r\n\r\n slide.$content.removeClass('fancybox-is-hidden');\r\n\r\n if (slide.pos === self.currPos) {\r\n self.complete();\r\n }\r\n\r\n return;\r\n }\r\n\r\n $.fancybox.stop($slide);\r\n\r\n effectClassName = 'fancybox-animated fancybox-slide--' + ( slide.pos >= self.prevPos ? 'next' : 'previous' ) + ' fancybox-fx-' + effect;\r\n\r\n $slide.removeAttr('style').removeClass('fancybox-slide--current fancybox-slide--next fancybox-slide--previous').addClass(effectClassName);\r\n\r\n slide.$content.removeClass('fancybox-is-hidden');\r\n\r\n //Force reflow for CSS3 transitions\r\n forceRedraw($slide);\r\n\r\n $.fancybox.animate($slide, 'fancybox-slide--current', duration, function (e) {\r\n $slide.removeClass(effectClassName).removeAttr('style');\r\n\r\n if (slide.pos === self.currPos) {\r\n self.complete();\r\n }\r\n\r\n }, true);\r\n\r\n },\r\n\r\n\r\n // Check if we can and have to zoom from thumbnail\r\n //================================================\r\n\r\n getThumbPos: function (slide) {\r\n\r\n var self = this;\r\n var rez = false;\r\n\r\n // Check if element is inside the viewport by at least 1 pixel\r\n var isElementVisible = function ($el) {\r\n var element = $el[0];\r\n\r\n var elementRect = element.getBoundingClientRect();\r\n var parentRects = [];\r\n\r\n var visibleInAllParents;\r\n\r\n while (element.parentElement !== null) {\r\n if ($(element.parentElement).css('overflow') === 'hidden' || $(element.parentElement).css('overflow') === 'auto') {\r\n parentRects.push(element.parentElement.getBoundingClientRect());\r\n }\r\n\r\n element = element.parentElement;\r\n }\r\n\r\n visibleInAllParents = parentRects.every(function (parentRect) {\r\n var visiblePixelX = Math.min(elementRect.right, parentRect.right) - Math.max(elementRect.left, parentRect.left);\r\n var visiblePixelY = Math.min(elementRect.bottom, parentRect.bottom) - Math.max(elementRect.top, parentRect.top);\r\n\r\n return visiblePixelX > 0 && visiblePixelY > 0;\r\n });\r\n\r\n return visibleInAllParents &&\r\n elementRect.bottom > 0 && elementRect.right > 0 &&\r\n elementRect.left < $(window).width() && elementRect.top < $(window).height();\r\n };\r\n\r\n var $thumb = slide.opts.$thumb;\r\n var thumbPos = $thumb ? $thumb.offset() : 0;\r\n var slidePos;\r\n\r\n if (thumbPos && $thumb[0].ownerDocument === document && isElementVisible($thumb)) {\r\n slidePos = self.$refs.stage.offset();\r\n\r\n rez = {\r\n top: thumbPos.top - slidePos.top + parseFloat($thumb.css(\"border-top-width\") || 0),\r\n left: thumbPos.left - slidePos.left + parseFloat($thumb.css(\"border-left-width\") || 0),\r\n width: $thumb.width(),\r\n height: $thumb.height(),\r\n scaleX: 1,\r\n scaleY: 1\r\n };\r\n }\r\n\r\n return rez;\r\n },\r\n\r\n\r\n // Final adjustments after current gallery item is moved to position\r\n // and it`s content is loaded\r\n // ==================================================================\r\n\r\n complete: function () {\r\n var self = this,\r\n current = self.current,\r\n slides = {},\r\n promise;\r\n\r\n if (current.isMoved || !current.isLoaded || current.isComplete) {\r\n return;\r\n }\r\n\r\n current.isComplete = true;\r\n\r\n current.$slide.siblings().trigger('onReset');\r\n\r\n self.preload('inline');\r\n\r\n // Trigger any CSS3 transiton inside the slide\r\n forceRedraw(current.$slide);\r\n\r\n current.$slide.addClass('fancybox-slide--complete');\r\n\r\n // Remove unnecessary slides\r\n $.each(self.slides, function (key, slide) {\r\n if (slide.pos >= self.currPos - 1 && slide.pos <= self.currPos + 1) {\r\n slides[slide.pos] = slide;\r\n\r\n } else if (slide) {\r\n $.fancybox.stop(slide.$slide);\r\n\r\n slide.$slide.off().remove();\r\n }\r\n });\r\n\r\n self.slides = slides;\r\n\r\n self.updateCursor();\r\n\r\n self.trigger('afterShow');\r\n\r\n // Play first html5 video/audio\r\n current.$slide.find('video,audio').first().trigger('play');\r\n\r\n // Try to focus on the first focusable element\r\n if ($(document.activeElement).is('[disabled]') || ( current.opts.autoFocus && !( current.type == 'image' || current.type === 'iframe' ) )) {\r\n self.focus();\r\n }\r\n\r\n },\r\n\r\n\r\n // Preload next and previous slides\r\n // ================================\r\n\r\n preload: function (type) {\r\n var self = this,\r\n next = self.slides[self.currPos + 1],\r\n prev = self.slides[self.currPos - 1];\r\n\r\n if (next && next.type === type) {\r\n self.loadSlide(next);\r\n }\r\n\r\n if (prev && prev.type === type) {\r\n self.loadSlide(prev);\r\n }\r\n },\r\n\r\n\r\n // Try to find and focus on the first focusable element\r\n // ====================================================\r\n\r\n focus: function () {\r\n var current = this.current;\r\n var $el;\r\n\r\n if (this.isClosing) {\r\n return;\r\n }\r\n\r\n if (current && current.isComplete) {\r\n\r\n // Look for first input with autofocus attribute\r\n $el = current.$slide.find('input[autofocus]:enabled:visible:first');\r\n\r\n if (!$el.length) {\r\n $el = current.$slide.find('button,:input,[tabindex],a').filter(':enabled:visible:first');\r\n }\r\n }\r\n\r\n $el = $el && $el.length ? $el : this.$refs.container;\r\n\r\n $el.focus();\r\n },\r\n\r\n\r\n // Activates current instance - brings container to the front and enables keyboard,\r\n // notifies other instances about deactivating\r\n // =================================================================================\r\n\r\n activate: function () {\r\n var self = this;\r\n\r\n // Deactivate all instances\r\n $('.fancybox-container').each(function () {\r\n var instance = $(this).data('FancyBox');\r\n\r\n // Skip self and closing instances\r\n if (instance && instance.id !== self.id && !instance.isClosing) {\r\n instance.trigger('onDeactivate');\r\n\r\n instance.removeEvents();\r\n\r\n instance.isVisible = false;\r\n }\r\n\r\n });\r\n\r\n self.isVisible = true;\r\n\r\n if (self.current || self.isIdle) {\r\n self.update();\r\n\r\n self.updateControls();\r\n }\r\n\r\n self.trigger('onActivate');\r\n\r\n self.addEvents();\r\n },\r\n\r\n\r\n // Start closing procedure\r\n // This will start \"zoom-out\" animation if needed and clean everything up afterwards\r\n // =================================================================================\r\n\r\n close: function (e, d) {\r\n\r\n var self = this;\r\n var current = self.current;\r\n\r\n var effect, duration;\r\n var $what, opacity, start, end;\r\n\r\n var done = function () {\r\n self.cleanUp(e);\r\n };\r\n\r\n if (self.isClosing) {\r\n return false;\r\n }\r\n\r\n self.isClosing = true;\r\n\r\n // If beforeClose callback prevents closing, make sure content is centered\r\n if (self.trigger('beforeClose', e) === false) {\r\n self.isClosing = false;\r\n\r\n requestAFrame(function () {\r\n self.update();\r\n });\r\n\r\n return false;\r\n }\r\n\r\n // Remove all events\r\n // If there are multiple instances, they will be set again by \"activate\" method\r\n self.removeEvents();\r\n\r\n if (current.timouts) {\r\n clearTimeout(current.timouts);\r\n }\r\n\r\n $what = current.$content;\r\n effect = current.opts.animationEffect;\r\n duration = $.isNumeric(d) ? d : ( effect ? current.opts.animationDuration : 0 );\r\n\r\n // Remove other slides\r\n current.$slide.off(transitionEnd).removeClass('fancybox-slide--complete fancybox-slide--next fancybox-slide--previous fancybox-animated');\r\n\r\n current.$slide.siblings().trigger('onReset').remove();\r\n\r\n // Trigger animations\r\n if (duration) {\r\n self.$refs.container.removeClass('fancybox-is-open').addClass('fancybox-is-closing');\r\n }\r\n\r\n // Clean up\r\n self.hideLoading(current);\r\n\r\n self.hideControls();\r\n\r\n self.updateCursor();\r\n\r\n // Check if possible to zoom-out\r\n if (effect === 'zoom' && !( e !== true && $what && duration && current.type === 'image' && !current.hasError && ( end = self.getThumbPos(current) ) )) {\r\n effect = 'fade';\r\n }\r\n\r\n if (effect === 'zoom') {\r\n $.fancybox.stop($what);\r\n\r\n start = $.fancybox.getTranslate($what);\r\n\r\n start.width = start.width * start.scaleX;\r\n start.height = start.height * start.scaleY;\r\n\r\n // Check if we need to animate opacity\r\n opacity = current.opts.zoomOpacity;\r\n\r\n if (opacity == 'auto') {\r\n opacity = Math.abs(current.width / current.height - end.width / end.height) > 0.1;\r\n }\r\n\r\n if (opacity) {\r\n end.opacity = 0;\r\n }\r\n\r\n start.scaleX = start.width / end.width;\r\n start.scaleY = start.height / end.height;\r\n\r\n start.width = end.width;\r\n start.height = end.height;\r\n\r\n $.fancybox.setTranslate(current.$content, start);\r\n\r\n forceRedraw(current.$content);\r\n\r\n $.fancybox.animate(current.$content, end, duration, done);\r\n\r\n return true;\r\n }\r\n\r\n if (effect && duration) {\r\n\r\n // If skip animation\r\n if (e === true) {\r\n setTimeout(done, duration);\r\n\r\n } else {\r\n $.fancybox.animate(current.$slide.removeClass('fancybox-slide--current'), 'fancybox-animated fancybox-slide--previous fancybox-fx-' + effect, duration, done);\r\n }\r\n\r\n } else {\r\n done();\r\n }\r\n\r\n return true;\r\n },\r\n\r\n\r\n // Final adjustments after removing the instance\r\n // =============================================\r\n\r\n cleanUp: function (e) {\r\n var self = this,\r\n $body = $('body'),\r\n instance,\r\n offset;\r\n\r\n self.current.$slide.trigger('onReset');\r\n\r\n self.$refs.container.empty().remove();\r\n\r\n self.trigger('afterClose', e);\r\n\r\n // Place back focus\r\n if (self.$lastFocus && !!self.current.opts.backFocus) {\r\n self.$lastFocus.focus();\r\n }\r\n\r\n self.current = null;\r\n\r\n // Check if there are other instances\r\n instance = $.fancybox.getInstance();\r\n\r\n if (instance) {\r\n instance.activate();\r\n\r\n } else {\r\n\r\n $W.scrollTop(self.scrollTop).scrollLeft(self.scrollLeft);\r\n\r\n $body.removeClass('fancybox-active compensate-for-scrollbar');\r\n\r\n if ($body.hasClass('fancybox-iosfix')) {\r\n offset = parseInt(document.body.style.top, 10);\r\n\r\n $body.removeClass('fancybox-iosfix').css('top', '').scrollTop(offset * -1);\r\n }\r\n\r\n $('#fancybox-style-noscroll').remove();\r\n\r\n }\r\n\r\n },\r\n\r\n\r\n // Call callback and trigger an event\r\n // ==================================\r\n\r\n trigger: function (name, slide) {\r\n var args = Array.prototype.slice.call(arguments, 1),\r\n self = this,\r\n obj = slide && slide.opts ? slide : self.current,\r\n rez;\r\n\r\n if (obj) {\r\n args.unshift(obj);\r\n\r\n } else {\r\n obj = self;\r\n }\r\n\r\n args.unshift(self);\r\n\r\n if ($.isFunction(obj.opts[name])) {\r\n rez = obj.opts[name].apply(obj, args);\r\n }\r\n\r\n if (rez === false) {\r\n return rez;\r\n }\r\n\r\n if (name === 'afterClose' || !self.$refs) {\r\n $D.trigger(name + '.fb', args);\r\n\r\n } else {\r\n self.$refs.container.trigger(name + '.fb', args);\r\n }\r\n\r\n },\r\n\r\n\r\n // Update infobar values, navigation button states and reveal caption\r\n // ==================================================================\r\n\r\n updateControls: function (force) {\r\n\r\n var self = this;\r\n\r\n var current = self.current,\r\n index = current.index,\r\n caption = current.opts.caption,\r\n $container = self.$refs.container,\r\n $caption = self.$refs.caption;\r\n\r\n // Recalculate content dimensions\r\n current.$slide.trigger('refresh');\r\n\r\n self.$caption = caption && caption.length ? $caption.html(caption) : null;\r\n\r\n if (!self.isHiddenControls && !self.isIdle) {\r\n self.showControls();\r\n }\r\n\r\n // Update info and navigation elements\r\n $container.find('[data-fancybox-count]').html(self.group.length);\r\n $container.find('[data-fancybox-index]').html(index + 1);\r\n\r\n $container.find('[data-fancybox-prev]').prop('disabled', ( !current.opts.loop && index <= 0 ));\r\n $container.find('[data-fancybox-next]').prop('disabled', ( !current.opts.loop && index >= self.group.length - 1 ));\r\n\r\n if (current.type === 'image') {\r\n\r\n // Update download button source\r\n $container.find('[data-fancybox-download]').attr('href', current.opts.image.src || current.src).show();\r\n\r\n } else {\r\n $container.find('[data-fancybox-download],[data-fancybox-zoom]').hide();\r\n }\r\n },\r\n\r\n // Hide toolbar and caption\r\n // ========================\r\n\r\n hideControls: function () {\r\n\r\n this.isHiddenControls = true;\r\n\r\n this.$refs.container.removeClass('fancybox-show-infobar fancybox-show-toolbar fancybox-show-caption fancybox-show-nav');\r\n\r\n },\r\n\r\n showControls: function () {\r\n var self = this;\r\n var opts = self.current ? self.current.opts : self.opts;\r\n var $container = self.$refs.container;\r\n\r\n self.isHiddenControls = false;\r\n self.idleSecondsCounter = 0;\r\n\r\n $container\r\n .toggleClass('fancybox-show-toolbar', !!( opts.toolbar && opts.buttons ))\r\n .toggleClass('fancybox-show-infobar', !!( opts.infobar && self.group.length > 1 ))\r\n .toggleClass('fancybox-show-nav', !!( opts.arrows && self.group.length > 1 ))\r\n .toggleClass('fancybox-is-modal', !!opts.modal);\r\n\r\n if (self.$caption) {\r\n $container.addClass('fancybox-show-caption ');\r\n\r\n } else {\r\n $container.removeClass('fancybox-show-caption');\r\n }\r\n\r\n },\r\n\r\n\r\n // Toggle toolbar and caption\r\n // ==========================\r\n\r\n toggleControls: function () {\r\n if (this.isHiddenControls) {\r\n this.showControls();\r\n\r\n } else {\r\n this.hideControls();\r\n }\r\n\r\n },\r\n\r\n\r\n });\r\n\r\n\r\n $.fancybox = {\r\n\r\n version: \"3.2.10\",\r\n defaults: defaults,\r\n\r\n\r\n // Get current instance and execute a command.\r\n //\r\n // Examples of usage:\r\n //\r\n // $instance = $.fancybox.getInstance();\r\n // $.fancybox.getInstance().jumpTo( 1 );\r\n // $.fancybox.getInstance( 'jumpTo', 1 );\r\n // $.fancybox.getInstance( function() {\r\n // console.info( this.currIndex );\r\n // });\r\n // ======================================================\r\n\r\n getInstance: function (command) {\r\n var instance = $('.fancybox-container:not(\".fancybox-is-closing\"):last').data('FancyBox');\r\n var args = Array.prototype.slice.call(arguments, 1);\r\n\r\n if (instance instanceof FancyBox) {\r\n\r\n if ($.type(command) === 'string') {\r\n instance[command].apply(instance, args);\r\n\r\n } else if ($.type(command) === 'function') {\r\n command.apply(instance, args);\r\n }\r\n\r\n return instance;\r\n }\r\n\r\n return false;\r\n\r\n },\r\n\r\n\r\n // Create new instance\r\n // ===================\r\n\r\n open: function (items, opts, index) {\r\n return new FancyBox(items, opts, index);\r\n },\r\n\r\n\r\n // Close current or all instances\r\n // ==============================\r\n\r\n close: function (all) {\r\n var instance = this.getInstance();\r\n\r\n if (instance) {\r\n instance.close();\r\n\r\n // Try to find and close next instance\r\n\r\n if (all === true) {\r\n this.close();\r\n }\r\n }\r\n\r\n },\r\n\r\n // Close instances and unbind all events\r\n // ==============================\r\n\r\n destroy: function () {\r\n\r\n this.close(true);\r\n\r\n $D.off('click.fb-start');\r\n\r\n },\r\n\r\n\r\n // Try to detect mobile devices\r\n // ============================\r\n\r\n isMobile: document.createTouch !== undefined && /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),\r\n\r\n\r\n // Detect if 'translate3d' support is available\r\n // ============================================\r\n\r\n use3d: (function () {\r\n var div = document.createElement('div');\r\n\r\n return window.getComputedStyle && window.getComputedStyle(div).getPropertyValue('transform') && !(document.documentMode && document.documentMode < 11);\r\n }()),\r\n\r\n // Helper function to get current visual state of an element\r\n // returns array[ top, left, horizontal-scale, vertical-scale, opacity ]\r\n // =====================================================================\r\n\r\n getTranslate: function ($el) {\r\n var matrix;\r\n\r\n if (!$el || !$el.length) {\r\n return false;\r\n }\r\n\r\n matrix = $el.eq(0).css('transform');\r\n\r\n if (matrix && matrix.indexOf('matrix') !== -1) {\r\n matrix = matrix.split('(')[1];\r\n matrix = matrix.split(')')[0];\r\n matrix = matrix.split(',');\r\n } else {\r\n matrix = [];\r\n }\r\n\r\n if (matrix.length) {\r\n\r\n // If IE\r\n if (matrix.length > 10) {\r\n matrix = [matrix[13], matrix[12], matrix[0], matrix[5]];\r\n\r\n } else {\r\n matrix = [matrix[5], matrix[4], matrix[0], matrix[3]];\r\n }\r\n\r\n matrix = matrix.map(parseFloat);\r\n\r\n } else {\r\n matrix = [0, 0, 1, 1];\r\n\r\n var transRegex = /\\.*translate\\((.*)px,(.*)px\\)/i;\r\n var transRez = transRegex.exec($el.eq(0).attr('style'));\r\n\r\n if (transRez) {\r\n matrix[0] = parseFloat(transRez[2]);\r\n matrix[1] = parseFloat(transRez[1]);\r\n }\r\n }\r\n\r\n return {\r\n top: matrix[0],\r\n left: matrix[1],\r\n scaleX: matrix[2],\r\n scaleY: matrix[3],\r\n opacity: parseFloat($el.css('opacity')),\r\n width: $el.width(),\r\n height: $el.height()\r\n };\r\n\r\n },\r\n\r\n\r\n // Shortcut for setting \"translate3d\" properties for element\r\n // Can set be used to set opacity, too\r\n // ========================================================\r\n\r\n setTranslate: function ($el, props) {\r\n var str = '';\r\n var css = {};\r\n\r\n if (!$el || !props) {\r\n return;\r\n }\r\n\r\n if (props.left !== undefined || props.top !== undefined) {\r\n str = ( props.left === undefined ? $el.position().left : props.left ) + 'px, ' + ( props.top === undefined ? $el.position().top : props.top ) + 'px';\r\n\r\n if (this.use3d) {\r\n str = 'translate3d(' + str + ', 0px)';\r\n\r\n } else {\r\n str = 'translate(' + str + ')';\r\n }\r\n }\r\n\r\n if (props.scaleX !== undefined && props.scaleY !== undefined) {\r\n str = (str.length ? str + ' ' : '') + 'scale(' + props.scaleX + ', ' + props.scaleY + ')';\r\n }\r\n\r\n if (str.length) {\r\n css.transform = str;\r\n }\r\n\r\n if (props.opacity !== undefined) {\r\n css.opacity = props.opacity;\r\n }\r\n\r\n if (props.width !== undefined) {\r\n css.width = props.width;\r\n }\r\n\r\n if (props.height !== undefined) {\r\n css.height = props.height;\r\n }\r\n\r\n return $el.css(css);\r\n },\r\n\r\n\r\n // Simple CSS transition handler\r\n // =============================\r\n\r\n animate: function ($el, to, duration, callback, leaveAnimationName) {\r\n if ($.isFunction(duration)) {\r\n callback = duration;\r\n duration = null;\r\n }\r\n\r\n if (!$.isPlainObject(to)) {\r\n $el.removeAttr('style');\r\n }\r\n\r\n $el.on(transitionEnd, function (e) {\r\n\r\n // Skip events from child elements and z-index change\r\n if (e && e.originalEvent && ( !$el.is(e.originalEvent.target) || e.originalEvent.propertyName == 'z-index' )) {\r\n return;\r\n }\r\n\r\n $.fancybox.stop($el);\r\n\r\n if ($.isPlainObject(to)) {\r\n\r\n if (to.scaleX !== undefined && to.scaleY !== undefined) {\r\n $el.css('transition-duration', '');\r\n\r\n to.width = Math.round($el.width() * to.scaleX);\r\n to.height = Math.round($el.height() * to.scaleY);\r\n\r\n to.scaleX = 1;\r\n to.scaleY = 1;\r\n\r\n $.fancybox.setTranslate($el, to);\r\n }\r\n\r\n if (leaveAnimationName === false) {\r\n $el.removeAttr('style');\r\n }\r\n\r\n } else if (leaveAnimationName !== true) {\r\n $el.removeClass(to);\r\n }\r\n\r\n if ($.isFunction(callback)) {\r\n callback(e);\r\n }\r\n\r\n });\r\n\r\n if ($.isNumeric(duration)) {\r\n $el.css('transition-duration', duration + 'ms');\r\n }\r\n\r\n if ($.isPlainObject(to)) {\r\n $.fancybox.setTranslate($el, to);\r\n\r\n } else {\r\n $el.addClass(to);\r\n }\r\n\r\n if (to.scaleX && $el.hasClass('fancybox-image-wrap')) {\r\n $el.parent().addClass('fancybox-is-scaling');\r\n }\r\n\r\n // Make sure that `transitionend` callback gets fired\r\n $el.data(\"timer\", setTimeout(function () {\r\n $el.trigger('transitionend');\r\n }, duration + 16));\r\n\r\n },\r\n\r\n stop: function ($el) {\r\n clearTimeout($el.data(\"timer\"));\r\n\r\n $el.off('transitionend').css('transition-duration', '');\r\n\r\n if ($el.hasClass('fancybox-image-wrap')) {\r\n $el.parent().removeClass('fancybox-is-scaling');\r\n }\r\n }\r\n\r\n };\r\n\r\n\r\n // Default click handler for \"fancyboxed\" links\r\n // ============================================\r\n\r\n function _run(e) {\r\n var $target = $(e.currentTarget),\r\n opts = e.data ? e.data.options : {},\r\n value = $target.attr('data-fancybox') || '',\r\n index = 0,\r\n items = [];\r\n\r\n // Avoid opening multiple times\r\n if (e.isDefaultPrevented()) {\r\n return;\r\n }\r\n\r\n e.preventDefault();\r\n\r\n // Get all related items and find index for clicked one\r\n if (value) {\r\n items = opts.selector ? $(opts.selector) : ( e.data ? e.data.items : [] );\r\n items = items.length ? items.filter('[data-fancybox=\"' + value + '\"]') : $('[data-fancybox=\"' + value + '\"]');\r\n\r\n index = items.index($target);\r\n\r\n // Sometimes current item can not be found\r\n // (for example, when slider clones items)\r\n if (index < 0) {\r\n index = 0;\r\n }\r\n\r\n } else {\r\n items = [$target];\r\n }\r\n\r\n $.fancybox.open(items, opts, index);\r\n }\r\n\r\n\r\n // Create a jQuery plugin\r\n // ======================\r\n\r\n $.fn.fancybox = function (options) {\r\n var selector;\r\n\r\n options = options || {};\r\n selector = options.selector || false;\r\n\r\n if (selector) {\r\n\r\n $('body').off('click.fb-start', selector).on('click.fb-start', selector, {\r\n options: options\r\n }, _run);\r\n\r\n } else {\r\n\r\n this.off('click.fb-start').on('click.fb-start', {\r\n items: this,\r\n options: options\r\n }, _run);\r\n\r\n }\r\n\r\n return this;\r\n };\r\n\r\n\r\n // Self initializing plugin\r\n // ========================\r\n\r\n $D.on('click.fb-start', '[data-fancybox]', _run);\r\n\r\n}(window, document, window.jQuery || jQuery));\r\n\r\n// ==========================================================================\r\n//\r\n// Media\r\n// Adds additional media type support\r\n//\r\n// ==========================================================================\r\n;(function ($) {\r\n\r\n 'use strict';\r\n\r\n // Formats matching url to final form\r\n\r\n var format = function (url, rez, params) {\r\n if (!url) {\r\n return;\r\n }\r\n\r\n params = params || '';\r\n\r\n if ($.type(params) === \"object\") {\r\n params = $.param(params, true);\r\n }\r\n\r\n $.each(rez, function (key, value) {\r\n url = url.replace('$' + key, value || '');\r\n });\r\n\r\n if (params.length) {\r\n url += (url.indexOf('?') > 0 ? '&' : '?') + params;\r\n }\r\n\r\n return url;\r\n };\r\n\r\n // Object containing properties for each media type\r\n\r\n var defaults = {\r\n youtube: {\r\n matcher: /(youtube\\.com|youtu\\.be|youtube\\-nocookie\\.com)\\/(watch\\?(.*&)?v=|v\\/|u\\/|embed\\/?)?(videoseries\\?list=(.*)|[\\w-]{11}|\\?listType=(.*)&list=(.*))(.*)/i,\r\n params: {\r\n autoplay: 1,\r\n autohide: 1,\r\n fs: 1,\r\n rel: 0,\r\n hd: 1,\r\n wmode: 'transparent',\r\n enablejsapi: 1,\r\n html5: 1\r\n },\r\n paramPlace: 8,\r\n type: 'iframe',\r\n url: '//www.youtube.com/embed/$4',\r\n thumb: '//img.youtube.com/vi/$4/hqdefault.jpg'\r\n },\r\n\r\n vimeo: {\r\n matcher: /^.+vimeo.com\\/(.*\\/)?([\\d]+)(.*)?/,\r\n params: {\r\n autoplay: 1,\r\n hd: 1,\r\n show_title: 1,\r\n show_byline: 1,\r\n show_portrait: 0,\r\n fullscreen: 1,\r\n api: 1\r\n },\r\n paramPlace: 3,\r\n type: 'iframe',\r\n url: '//player.vimeo.com/video/$2'\r\n },\r\n\r\n metacafe: {\r\n matcher: /metacafe.com\\/watch\\/(\\d+)\\/(.*)?/,\r\n type: 'iframe',\r\n url: '//www.metacafe.com/embed/$1/?ap=1'\r\n },\r\n\r\n dailymotion: {\r\n matcher: /dailymotion.com\\/video\\/(.*)\\/?(.*)/,\r\n params: {\r\n additionalInfos: 0,\r\n autoStart: 1\r\n },\r\n type: 'iframe',\r\n url: '//www.dailymotion.com/embed/video/$1'\r\n },\r\n\r\n vine: {\r\n matcher: /vine.co\\/v\\/([a-zA-Z0-9\\?\\=\\-]+)/,\r\n type: 'iframe',\r\n url: '//vine.co/v/$1/embed/simple'\r\n },\r\n\r\n instagram: {\r\n matcher: /(instagr\\.am|instagram\\.com)\\/p\\/([a-zA-Z0-9_\\-]+)\\/?/i,\r\n type: 'image',\r\n url: '//$1/p/$2/media/?size=l'\r\n },\r\n\r\n // Examples:\r\n // http://maps.google.com/?ll=48.857995,2.294297&spn=0.007666,0.021136&t=m&z=16\r\n // https://www.google.com/maps/@37.7852006,-122.4146355,14.65z\r\n // https://www.google.com/maps/place/Googleplex/@37.4220041,-122.0833494,17z/data=!4m5!3m4!1s0x0:0x6c296c66619367e0!8m2!3d37.4219998!4d-122.0840572\r\n gmap_place: {\r\n matcher: /(maps\\.)?google\\.([a-z]{2,3}(\\.[a-z]{2})?)\\/(((maps\\/(place\\/(.*)\\/)?\\@(.*),(\\d+.?\\d+?)z))|(\\?ll=))(.*)?/i,\r\n type: 'iframe',\r\n url: function (rez) {\r\n return '//maps.google.' + rez[2] + '/?ll=' + ( rez[9] ? rez[9] + '&z=' + Math.floor(rez[10]) + ( rez[12] ? rez[12].replace(/^\\//, \"&\") : '' ) : rez[12] ) + '&output=' + ( rez[12] && rez[12].indexOf('layer=c') > 0 ? 'svembed' : 'embed' );\r\n }\r\n },\r\n\r\n // Examples:\r\n // https://www.google.com/maps/search/Empire+State+Building/\r\n // https://www.google.com/maps/search/?api=1&query=centurylink+field\r\n // https://www.google.com/maps/search/?api=1&query=47.5951518,-122.3316393\r\n gmap_search: {\r\n matcher: /(maps\\.)?google\\.([a-z]{2,3}(\\.[a-z]{2})?)\\/(maps\\/search\\/)(.*)/i,\r\n type: 'iframe',\r\n url: function (rez) {\r\n return '//maps.google.' + rez[2] + '/maps?q=' + rez[5].replace('query=', 'q=').replace('api=1', '') + '&output=embed';\r\n }\r\n }\r\n };\r\n\r\n $(document).on('objectNeedsType.fb', function (e, instance, item) {\r\n\r\n var url = item.src || '',\r\n type = false,\r\n media,\r\n thumb,\r\n rez,\r\n params,\r\n urlParams,\r\n paramObj,\r\n provider;\r\n\r\n media = $.extend(true, {}, defaults, item.opts.media);\r\n\r\n // Look for any matching media type\r\n $.each(media, function (providerName, providerOpts) {\r\n rez = url.match(providerOpts.matcher);\r\n\r\n if (!rez) {\r\n return;\r\n }\r\n\r\n type = providerOpts.type;\r\n paramObj = {};\r\n\r\n if (providerOpts.paramPlace && rez[providerOpts.paramPlace]) {\r\n urlParams = rez[providerOpts.paramPlace];\r\n\r\n if (urlParams[0] == '?') {\r\n urlParams = urlParams.substring(1);\r\n }\r\n\r\n urlParams = urlParams.split('&');\r\n\r\n for (var m = 0; m < urlParams.length; ++m) {\r\n var p = urlParams[m].split('=', 2);\r\n\r\n if (p.length == 2) {\r\n paramObj[p[0]] = decodeURIComponent(p[1].replace(/\\+/g, \" \"));\r\n }\r\n }\r\n }\r\n\r\n params = $.extend(true, {}, providerOpts.params, item.opts[providerName], paramObj);\r\n\r\n url = $.type(providerOpts.url) === \"function\" ? providerOpts.url.call(this, rez, params, item) : format(providerOpts.url, rez, params);\r\n thumb = $.type(providerOpts.thumb) === \"function\" ? providerOpts.thumb.call(this, rez, params, item) : format(providerOpts.thumb, rez);\r\n\r\n if (providerName === 'vimeo') {\r\n url = url.replace('&%23', '#');\r\n }\r\n\r\n return false;\r\n });\r\n\r\n // If it is found, then change content type and update the url\r\n\r\n if (type) {\r\n item.src = url;\r\n item.type = type;\r\n\r\n if (!item.opts.thumb && !( item.opts.$thumb && item.opts.$thumb.length )) {\r\n item.opts.thumb = thumb;\r\n }\r\n\r\n if (type === 'iframe') {\r\n $.extend(true, item.opts, {\r\n iframe: {\r\n preload: false,\r\n attr: {\r\n scrolling: \"no\"\r\n }\r\n }\r\n });\r\n\r\n item.contentProvider = provider;\r\n\r\n item.opts.slideClass += ' fancybox-slide--' + ( provider == 'gmap_place' || provider == 'gmap_search' ? 'map' : 'video' );\r\n }\r\n\r\n } else if (url) {\r\n item.type = item.opts.defaultType;\r\n }\r\n\r\n });\r\n\r\n}(window.jQuery || jQuery));\r\n\r\n// ==========================================================================\r\n//\r\n// Guestures\r\n// Adds touch guestures, handles click and tap events\r\n//\r\n// ==========================================================================\r\n;(function (window, document, $) {\r\n 'use strict';\r\n\r\n var requestAFrame = (function () {\r\n return window.requestAnimationFrame ||\r\n window.webkitRequestAnimationFrame ||\r\n window.mozRequestAnimationFrame ||\r\n window.oRequestAnimationFrame ||\r\n // if all else fails, use setTimeout\r\n function (callback) {\r\n return window.setTimeout(callback, 1000 / 60);\r\n };\r\n })();\r\n\r\n var cancelAFrame = (function () {\r\n return window.cancelAnimationFrame ||\r\n window.webkitCancelAnimationFrame ||\r\n window.mozCancelAnimationFrame ||\r\n window.oCancelAnimationFrame ||\r\n function (id) {\r\n window.clearTimeout(id);\r\n };\r\n })();\r\n\r\n var pointers = function (e) {\r\n var result = [];\r\n\r\n e = e.originalEvent || e || window.e;\r\n e = e.touches && e.touches.length ? e.touches : ( e.changedTouches && e.changedTouches.length ? e.changedTouches : [e] );\r\n\r\n for (var key in e) {\r\n\r\n if (e[key].pageX) {\r\n result.push({x: e[key].pageX, y: e[key].pageY});\r\n\r\n } else if (e[key].clientX) {\r\n result.push({x: e[key].clientX, y: e[key].clientY});\r\n }\r\n }\r\n\r\n return result;\r\n };\r\n\r\n var distance = function (point2, point1, what) {\r\n if (!point1 || !point2) {\r\n return 0;\r\n }\r\n\r\n if (what === 'x') {\r\n return point2.x - point1.x;\r\n\r\n } else if (what === 'y') {\r\n return point2.y - point1.y;\r\n }\r\n\r\n return Math.sqrt(Math.pow(point2.x - point1.x, 2) + Math.pow(point2.y - point1.y, 2));\r\n };\r\n\r\n var isClickable = function ($el) {\r\n if ($el.is('a,area,button,[role=\"button\"],input,label,select,summary,textarea') || $.isFunction($el.get(0).onclick) || $el.data('selectable')) {\r\n return true;\r\n }\r\n\r\n // Check for attributes like data-fancybox-next or data-fancybox-close\r\n for (var i = 0, atts = $el[0].attributes, n = atts.length; i < n; i++) {\r\n if (atts[i].nodeName.substr(0, 14) === 'data-fancybox-') {\r\n return true;\r\n }\r\n }\r\n\r\n return false;\r\n };\r\n\r\n var hasScrollbars = function (el) {\r\n var overflowY = window.getComputedStyle(el)['overflow-y'];\r\n var overflowX = window.getComputedStyle(el)['overflow-x'];\r\n\r\n var vertical = (overflowY === 'scroll' || overflowY === 'auto') && el.scrollHeight > el.clientHeight;\r\n var horizontal = (overflowX === 'scroll' || overflowX === 'auto') && el.scrollWidth > el.clientWidth;\r\n\r\n return vertical || horizontal;\r\n };\r\n\r\n var isScrollable = function ($el) {\r\n var rez = false;\r\n\r\n while (true) {\r\n rez = hasScrollbars($el.get(0));\r\n\r\n if (rez) {\r\n break;\r\n }\r\n\r\n $el = $el.parent();\r\n\r\n if (!$el.length || $el.hasClass('fancybox-stage') || $el.is('body')) {\r\n break;\r\n }\r\n }\r\n\r\n return rez;\r\n };\r\n\r\n\r\n var Guestures = function (instance) {\r\n var self = this;\r\n\r\n self.instance = instance;\r\n\r\n self.$bg = instance.$refs.bg;\r\n self.$stage = instance.$refs.stage;\r\n self.$container = instance.$refs.container;\r\n\r\n self.destroy();\r\n\r\n self.$container.on('touchstart.fb.touch mousedown.fb.touch', $.proxy(self, 'ontouchstart'));\r\n };\r\n\r\n Guestures.prototype.destroy = function () {\r\n this.$container.off('.fb.touch');\r\n };\r\n\r\n Guestures.prototype.ontouchstart = function (e) {\r\n var self = this;\r\n\r\n var $target = $(e.target);\r\n var instance = self.instance;\r\n var current = instance.current;\r\n var $content = current.$content;\r\n\r\n var isTouchDevice = ( e.type == 'touchstart' );\r\n\r\n // Do not respond to both (touch and mouse) events\r\n if (isTouchDevice) {\r\n self.$container.off('mousedown.fb.touch');\r\n }\r\n\r\n // Ignore right click\r\n if (e.originalEvent && e.originalEvent.button == 2) {\r\n return;\r\n }\r\n\r\n // Ignore taping on links, buttons, input elements\r\n if (!$target.length || isClickable($target) || isClickable($target.parent())) {\r\n return;\r\n }\r\n\r\n // Ignore clicks on the scrollbar\r\n if (!$target.is('img') && e.originalEvent.clientX > $target[0].clientWidth + $target.offset().left) {\r\n return;\r\n }\r\n\r\n // Ignore clicks while zooming or closing\r\n if (!current || self.instance.isAnimating || self.instance.isClosing) {\r\n e.stopPropagation();\r\n e.preventDefault();\r\n\r\n return;\r\n }\r\n\r\n self.realPoints = self.startPoints = pointers(e);\r\n\r\n if (!self.startPoints) {\r\n return;\r\n }\r\n\r\n e.stopPropagation();\r\n\r\n self.startEvent = e;\r\n\r\n self.canTap = true;\r\n self.$target = $target;\r\n self.$content = $content;\r\n self.opts = current.opts.touch;\r\n\r\n self.isPanning = false;\r\n self.isSwiping = false;\r\n self.isZooming = false;\r\n self.isScrolling = false;\r\n\r\n self.sliderStartPos = self.sliderLastPos || {top: 0, left: 0};\r\n self.contentStartPos = $.fancybox.getTranslate(self.$content);\r\n self.contentLastPos = null;\r\n\r\n self.startTime = new Date().getTime();\r\n self.distanceX = self.distanceY = self.distance = 0;\r\n\r\n self.canvasWidth = Math.round(current.$slide[0].clientWidth);\r\n self.canvasHeight = Math.round(current.$slide[0].clientHeight);\r\n\r\n $(document)\r\n .off('.fb.touch')\r\n .on(isTouchDevice ? 'touchend.fb.touch touchcancel.fb.touch' : 'mouseup.fb.touch mouseleave.fb.touch', $.proxy(self, \"ontouchend\"))\r\n .on(isTouchDevice ? 'touchmove.fb.touch' : 'mousemove.fb.touch', $.proxy(self, \"ontouchmove\"));\r\n\r\n if ($.fancybox.isMobile) {\r\n document.addEventListener('scroll', self.onscroll, true);\r\n }\r\n\r\n if (!(self.opts || instance.canPan() ) || !( $target.is(self.$stage) || self.$stage.find($target).length )) {\r\n\r\n // Prevent image ghosting while dragging\r\n if ($target.is('img')) {\r\n e.preventDefault();\r\n }\r\n\r\n return;\r\n }\r\n\r\n if (!( $.fancybox.isMobile && ( isScrollable($target) || isScrollable($target.parent()) ) )) {\r\n e.preventDefault();\r\n }\r\n\r\n if (self.startPoints.length === 1) {\r\n if (current.type === 'image' && ( self.contentStartPos.width > self.canvasWidth + 1 || self.contentStartPos.height > self.canvasHeight + 1 )) {\r\n $.fancybox.stop(self.$content);\r\n\r\n self.$content.css('transition-duration', '');\r\n\r\n self.isPanning = true;\r\n\r\n } else {\r\n self.isSwiping = true;\r\n }\r\n\r\n self.$container.addClass('fancybox-controls--isGrabbing');\r\n }\r\n\r\n if (self.startPoints.length === 2 && !instance.isAnimating && !current.hasError && current.type === 'image' && ( current.isLoaded || current.$ghost )) {\r\n self.canTap = false;\r\n self.isSwiping = false;\r\n self.isPanning = false;\r\n\r\n self.isZooming = true;\r\n\r\n $.fancybox.stop(self.$content);\r\n\r\n self.$content.css('transition-duration', '');\r\n\r\n self.centerPointStartX = ( ( self.startPoints[0].x + self.startPoints[1].x ) * 0.5 ) - $(window).scrollLeft();\r\n self.centerPointStartY = ( ( self.startPoints[0].y + self.startPoints[1].y ) * 0.5 ) - $(window).scrollTop();\r\n\r\n self.percentageOfImageAtPinchPointX = ( self.centerPointStartX - self.contentStartPos.left ) / self.contentStartPos.width;\r\n self.percentageOfImageAtPinchPointY = ( self.centerPointStartY - self.contentStartPos.top ) / self.contentStartPos.height;\r\n\r\n self.startDistanceBetweenFingers = distance(self.startPoints[0], self.startPoints[1]);\r\n }\r\n\r\n };\r\n\r\n Guestures.prototype.onscroll = function (e) {\r\n self.isScrolling = true;\r\n };\r\n\r\n Guestures.prototype.ontouchmove = function (e) {\r\n var self = this,\r\n $target = $(e.target);\r\n\r\n if (self.isScrolling || !( $target.is(self.$stage) || self.$stage.find($target).length )) {\r\n self.canTap = false;\r\n\r\n return;\r\n }\r\n\r\n self.newPoints = pointers(e);\r\n\r\n if (!( self.opts || self.instance.canPan() ) || !self.newPoints || !self.newPoints.length) {\r\n return;\r\n }\r\n\r\n if (!(self.isSwiping && self.isSwiping === true)) {\r\n e.preventDefault();\r\n }\r\n\r\n self.distanceX = distance(self.newPoints[0], self.startPoints[0], 'x');\r\n self.distanceY = distance(self.newPoints[0], self.startPoints[0], 'y');\r\n\r\n self.distance = distance(self.newPoints[0], self.startPoints[0])\r\n\r\n // Skip false ontouchmove events (Chrome)\r\n if (self.distance > 0) {\r\n if (self.isSwiping) {\r\n self.onSwipe(e);\r\n\r\n } else if (self.isPanning) {\r\n self.onPan();\r\n\r\n } else if (self.isZooming) {\r\n self.onZoom();\r\n }\r\n }\r\n\r\n };\r\n\r\n Guestures.prototype.onSwipe = function (e) {\r\n var self = this,\r\n swiping = self.isSwiping,\r\n left = self.sliderStartPos.left || 0,\r\n angle;\r\n\r\n // If direction is not yet determined\r\n if (swiping === true) {\r\n\r\n // We need at least 10px distance to correctly calculate an angle\r\n if (Math.abs(self.distance) > 10) {\r\n self.canTap = false;\r\n\r\n if (self.instance.group.length < 2 && self.opts.vertical) {\r\n self.isSwiping = 'y';\r\n\r\n } else if (self.instance.isDragging || self.opts.vertical === false || ( self.opts.vertical === 'auto' && $(window).width() > 800 )) {\r\n self.isSwiping = 'x';\r\n\r\n } else {\r\n angle = Math.abs(Math.atan2(self.distanceY, self.distanceX) * 180 / Math.PI);\r\n\r\n self.isSwiping = ( angle > 45 && angle < 135 ) ? 'y' : 'x';\r\n }\r\n\r\n self.canTap = false;\r\n\r\n if (self.isSwiping === 'y' && $.fancybox.isMobile && ( isScrollable(self.$target) || isScrollable(self.$target.parent()) )) {\r\n self.isScrolling = true;\r\n\r\n return;\r\n }\r\n\r\n self.instance.isDragging = self.isSwiping;\r\n\r\n // Reset points to avoid jumping, because we dropped first swipes to calculate the angle\r\n self.startPoints = self.newPoints;\r\n\r\n $.each(self.instance.slides, function (index, slide) {\r\n $.fancybox.stop(slide.$slide);\r\n\r\n slide.$slide.css('transition-duration', '');\r\n\r\n slide.inTransition = false;\r\n\r\n if (slide.pos === self.instance.current.pos) {\r\n self.sliderStartPos.left = $.fancybox.getTranslate(slide.$slide).left;\r\n }\r\n });\r\n\r\n // Stop slideshow\r\n if (self.instance.SlideShow && self.instance.SlideShow.isActive) {\r\n self.instance.SlideShow.stop();\r\n }\r\n }\r\n\r\n return;\r\n }\r\n\r\n // Sticky edges\r\n if (swiping == 'x') {\r\n if (self.distanceX > 0 && ( self.instance.group.length < 2 || ( self.instance.current.index === 0 && !self.instance.current.opts.loop ) )) {\r\n left = left + Math.pow(self.distanceX, 0.8);\r\n\r\n } else if (self.distanceX < 0 && ( self.instance.group.length < 2 || ( self.instance.current.index === self.instance.group.length - 1 && !self.instance.current.opts.loop ) )) {\r\n left = left - Math.pow(-self.distanceX, 0.8);\r\n\r\n } else {\r\n left = left + self.distanceX;\r\n }\r\n }\r\n\r\n self.sliderLastPos = {\r\n top: swiping == 'x' ? 0 : self.sliderStartPos.top + self.distanceY,\r\n left: left\r\n };\r\n\r\n if (self.requestId) {\r\n cancelAFrame(self.requestId);\r\n\r\n self.requestId = null;\r\n }\r\n\r\n self.requestId = requestAFrame(function () {\r\n\r\n if (self.sliderLastPos) {\r\n $.each(self.instance.slides, function (index, slide) {\r\n var pos = slide.pos - self.instance.currPos;\r\n\r\n $.fancybox.setTranslate(slide.$slide, {\r\n top: self.sliderLastPos.top,\r\n left: self.sliderLastPos.left + ( pos * self.canvasWidth ) + ( pos * slide.opts.gutter )\r\n });\r\n });\r\n\r\n self.$container.addClass('fancybox-is-sliding');\r\n }\r\n\r\n });\r\n\r\n };\r\n\r\n Guestures.prototype.onPan = function () {\r\n var self = this;\r\n\r\n // Sometimes, when tapping causally, image can move a bit and that breaks double tapping\r\n if (distance(self.newPoints[0], self.realPoints[0]) < ($.fancybox.isMobile ? 10 : 5)) {\r\n self.startPoints = self.newPoints;\r\n return;\r\n }\r\n\r\n self.canTap = false;\r\n\r\n self.contentLastPos = self.limitMovement();\r\n\r\n if (self.requestId) {\r\n cancelAFrame(self.requestId);\r\n\r\n self.requestId = null;\r\n }\r\n\r\n self.requestId = requestAFrame(function () {\r\n $.fancybox.setTranslate(self.$content, self.contentLastPos);\r\n });\r\n };\r\n\r\n // Make panning sticky to the edges\r\n Guestures.prototype.limitMovement = function () {\r\n var self = this;\r\n\r\n var canvasWidth = self.canvasWidth;\r\n var canvasHeight = self.canvasHeight;\r\n\r\n var distanceX = self.distanceX;\r\n var distanceY = self.distanceY;\r\n\r\n var contentStartPos = self.contentStartPos;\r\n\r\n var currentOffsetX = contentStartPos.left;\r\n var currentOffsetY = contentStartPos.top;\r\n\r\n var currentWidth = contentStartPos.width;\r\n var currentHeight = contentStartPos.height;\r\n\r\n var minTranslateX, minTranslateY,\r\n maxTranslateX, maxTranslateY,\r\n newOffsetX, newOffsetY;\r\n\r\n if (currentWidth > canvasWidth) {\r\n newOffsetX = currentOffsetX + distanceX;\r\n\r\n } else {\r\n newOffsetX = currentOffsetX;\r\n }\r\n\r\n newOffsetY = currentOffsetY + distanceY;\r\n\r\n // Slow down proportionally to traveled distance\r\n minTranslateX = Math.max(0, canvasWidth * 0.5 - currentWidth * 0.5);\r\n minTranslateY = Math.max(0, canvasHeight * 0.5 - currentHeight * 0.5);\r\n\r\n maxTranslateX = Math.min(canvasWidth - currentWidth, canvasWidth * 0.5 - currentWidth * 0.5);\r\n maxTranslateY = Math.min(canvasHeight - currentHeight, canvasHeight * 0.5 - currentHeight * 0.5);\r\n\r\n if (currentWidth > canvasWidth) {\r\n\r\n // ->\r\n if (distanceX > 0 && newOffsetX > minTranslateX) {\r\n newOffsetX = minTranslateX - 1 + Math.pow(-minTranslateX + currentOffsetX + distanceX, 0.8) || 0;\r\n }\r\n\r\n // <-\r\n if (distanceX < 0 && newOffsetX < maxTranslateX) {\r\n newOffsetX = maxTranslateX + 1 - Math.pow(maxTranslateX - currentOffsetX - distanceX, 0.8) || 0;\r\n }\r\n\r\n }\r\n\r\n if (currentHeight > canvasHeight) {\r\n\r\n // \\/\r\n if (distanceY > 0 && newOffsetY > minTranslateY) {\r\n newOffsetY = minTranslateY - 1 + Math.pow(-minTranslateY + currentOffsetY + distanceY, 0.8) || 0;\r\n }\r\n\r\n // /\\\r\n if (distanceY < 0 && newOffsetY < maxTranslateY) {\r\n newOffsetY = maxTranslateY + 1 - Math.pow(maxTranslateY - currentOffsetY - distanceY, 0.8) || 0;\r\n }\r\n\r\n }\r\n\r\n return {\r\n top: newOffsetY,\r\n left: newOffsetX,\r\n scaleX: contentStartPos.scaleX,\r\n scaleY: contentStartPos.scaleY\r\n };\r\n\r\n };\r\n\r\n Guestures.prototype.limitPosition = function (newOffsetX, newOffsetY, newWidth, newHeight) {\r\n var self = this;\r\n\r\n var canvasWidth = self.canvasWidth;\r\n var canvasHeight = self.canvasHeight;\r\n\r\n if (newWidth > canvasWidth) {\r\n newOffsetX = newOffsetX > 0 ? 0 : newOffsetX;\r\n newOffsetX = newOffsetX < canvasWidth - newWidth ? canvasWidth - newWidth : newOffsetX;\r\n\r\n } else {\r\n\r\n // Center horizontally\r\n newOffsetX = Math.max(0, canvasWidth / 2 - newWidth / 2);\r\n\r\n }\r\n\r\n if (newHeight > canvasHeight) {\r\n newOffsetY = newOffsetY > 0 ? 0 : newOffsetY;\r\n newOffsetY = newOffsetY < canvasHeight - newHeight ? canvasHeight - newHeight : newOffsetY;\r\n\r\n } else {\r\n\r\n // Center vertically\r\n newOffsetY = Math.max(0, canvasHeight / 2 - newHeight / 2);\r\n\r\n }\r\n\r\n return {\r\n top: newOffsetY,\r\n left: newOffsetX\r\n };\r\n\r\n };\r\n\r\n Guestures.prototype.onZoom = function () {\r\n var self = this;\r\n\r\n // Calculate current distance between points to get pinch ratio and new width and height\r\n\r\n var currentWidth = self.contentStartPos.width;\r\n var currentHeight = self.contentStartPos.height;\r\n\r\n var currentOffsetX = self.contentStartPos.left;\r\n var currentOffsetY = self.contentStartPos.top;\r\n\r\n var endDistanceBetweenFingers = distance(self.newPoints[0], self.newPoints[1]);\r\n\r\n var pinchRatio = endDistanceBetweenFingers / self.startDistanceBetweenFingers;\r\n\r\n var newWidth = Math.floor(currentWidth * pinchRatio);\r\n var newHeight = Math.floor(currentHeight * pinchRatio);\r\n\r\n // This is the translation due to pinch-zooming\r\n var translateFromZoomingX = (currentWidth - newWidth) * self.percentageOfImageAtPinchPointX;\r\n var translateFromZoomingY = (currentHeight - newHeight) * self.percentageOfImageAtPinchPointY;\r\n\r\n //Point between the two touches\r\n\r\n var centerPointEndX = ((self.newPoints[0].x + self.newPoints[1].x) / 2) - $(window).scrollLeft();\r\n var centerPointEndY = ((self.newPoints[0].y + self.newPoints[1].y) / 2) - $(window).scrollTop();\r\n\r\n // And this is the translation due to translation of the centerpoint\r\n // between the two fingers\r\n\r\n var translateFromTranslatingX = centerPointEndX - self.centerPointStartX;\r\n var translateFromTranslatingY = centerPointEndY - self.centerPointStartY;\r\n\r\n // The new offset is the old/current one plus the total translation\r\n\r\n var newOffsetX = currentOffsetX + ( translateFromZoomingX + translateFromTranslatingX );\r\n var newOffsetY = currentOffsetY + ( translateFromZoomingY + translateFromTranslatingY );\r\n\r\n var newPos = {\r\n top: newOffsetY,\r\n left: newOffsetX,\r\n scaleX: self.contentStartPos.scaleX * pinchRatio,\r\n scaleY: self.contentStartPos.scaleY * pinchRatio\r\n };\r\n\r\n self.canTap = false;\r\n\r\n self.newWidth = newWidth;\r\n self.newHeight = newHeight;\r\n\r\n self.contentLastPos = newPos;\r\n\r\n if (self.requestId) {\r\n cancelAFrame(self.requestId);\r\n\r\n self.requestId = null;\r\n }\r\n\r\n self.requestId = requestAFrame(function () {\r\n $.fancybox.setTranslate(self.$content, self.contentLastPos);\r\n });\r\n\r\n };\r\n\r\n Guestures.prototype.ontouchend = function (e) {\r\n var self = this;\r\n var dMs = Math.max((new Date().getTime() ) - self.startTime, 1);\r\n\r\n var swiping = self.isSwiping;\r\n var panning = self.isPanning;\r\n var zooming = self.isZooming;\r\n var scrolling = self.isScrolling;\r\n\r\n self.endPoints = pointers(e);\r\n\r\n self.$container.removeClass('fancybox-controls--isGrabbing');\r\n\r\n $(document).off('.fb.touch');\r\n\r\n document.removeEventListener('scroll', self.onscroll, true);\r\n\r\n if (self.requestId) {\r\n cancelAFrame(self.requestId);\r\n\r\n self.requestId = null;\r\n }\r\n\r\n self.isSwiping = false;\r\n self.isPanning = false;\r\n self.isZooming = false;\r\n self.isScrolling = false;\r\n\r\n self.instance.isDragging = false;\r\n\r\n if (self.canTap) {\r\n return self.onTap(e);\r\n }\r\n\r\n self.speed = 366;\r\n\r\n // Speed in px/ms\r\n self.velocityX = self.distanceX / dMs * 0.5;\r\n self.velocityY = self.distanceY / dMs * 0.5;\r\n\r\n self.speedX = Math.max(self.speed * 0.5, Math.min(self.speed * 1.5, ( 1 / Math.abs(self.velocityX) ) * self.speed));\r\n\r\n if (panning) {\r\n self.endPanning();\r\n\r\n } else if (zooming) {\r\n self.endZooming();\r\n\r\n } else {\r\n self.endSwiping(swiping, scrolling);\r\n }\r\n\r\n return;\r\n };\r\n\r\n Guestures.prototype.endSwiping = function (swiping, scrolling) {\r\n var self = this,\r\n ret = false,\r\n len = self.instance.group.length;\r\n\r\n self.sliderLastPos = null;\r\n\r\n // Close if swiped vertically / navigate if horizontally\r\n if (swiping == 'y' && !scrolling && Math.abs(self.distanceY) > 50) {\r\n\r\n // Continue vertical movement\r\n $.fancybox.animate(self.instance.current.$slide, {\r\n top: self.sliderStartPos.top + self.distanceY + ( self.velocityY * 150 ),\r\n opacity: 0\r\n }, 150);\r\n\r\n ret = self.instance.close(true, 300);\r\n\r\n } else if (swiping == 'x' && self.distanceX > 50 && len > 1) {\r\n ret = self.instance.previous(self.speedX);\r\n\r\n } else if (swiping == 'x' && self.distanceX < -50 && len > 1) {\r\n ret = self.instance.next(self.speedX);\r\n }\r\n\r\n if (ret === false && ( swiping == 'x' || swiping == 'y' )) {\r\n if (scrolling || len < 2) {\r\n self.instance.centerSlide(self.instance.current, 150);\r\n } else {\r\n self.instance.jumpTo(self.instance.current.index);\r\n }\r\n }\r\n\r\n self.$container.removeClass('fancybox-is-sliding');\r\n\r\n };\r\n\r\n // Limit panning from edges\r\n // ========================\r\n\r\n Guestures.prototype.endPanning = function () {\r\n\r\n var self = this;\r\n var newOffsetX, newOffsetY, newPos;\r\n\r\n if (!self.contentLastPos) {\r\n return;\r\n }\r\n\r\n if (self.opts.momentum === false) {\r\n newOffsetX = self.contentLastPos.left;\r\n newOffsetY = self.contentLastPos.top;\r\n\r\n } else {\r\n\r\n // Continue movement\r\n newOffsetX = self.contentLastPos.left + ( self.velocityX * self.speed );\r\n newOffsetY = self.contentLastPos.top + ( self.velocityY * self.speed );\r\n }\r\n\r\n newPos = self.limitPosition(newOffsetX, newOffsetY, self.contentStartPos.width, self.contentStartPos.height);\r\n\r\n newPos.width = self.contentStartPos.width;\r\n newPos.height = self.contentStartPos.height;\r\n\r\n $.fancybox.animate(self.$content, newPos, 330);\r\n };\r\n\r\n\r\n Guestures.prototype.endZooming = function () {\r\n var self = this;\r\n\r\n var current = self.instance.current;\r\n\r\n var newOffsetX, newOffsetY, newPos, reset;\r\n\r\n var newWidth = self.newWidth;\r\n var newHeight = self.newHeight;\r\n\r\n if (!self.contentLastPos) {\r\n return;\r\n }\r\n\r\n newOffsetX = self.contentLastPos.left;\r\n newOffsetY = self.contentLastPos.top;\r\n\r\n reset = {\r\n top: newOffsetY,\r\n left: newOffsetX,\r\n width: newWidth,\r\n height: newHeight,\r\n scaleX: 1,\r\n scaleY: 1\r\n };\r\n\r\n // Reset scalex/scaleY values; this helps for perfomance and does not break animation\r\n $.fancybox.setTranslate(self.$content, reset);\r\n\r\n if (newWidth < self.canvasWidth && newHeight < self.canvasHeight) {\r\n self.instance.scaleToFit(150);\r\n\r\n } else if (newWidth > current.width || newHeight > current.height) {\r\n self.instance.scaleToActual(self.centerPointStartX, self.centerPointStartY, 150);\r\n\r\n } else {\r\n\r\n newPos = self.limitPosition(newOffsetX, newOffsetY, newWidth, newHeight);\r\n\r\n // Switch from scale() to width/height or animation will not work correctly\r\n $.fancybox.setTranslate(self.content, $.fancybox.getTranslate(self.$content));\r\n\r\n $.fancybox.animate(self.$content, newPos, 150);\r\n }\r\n\r\n };\r\n\r\n Guestures.prototype.onTap = function (e) {\r\n var self = this;\r\n var $target = $(e.target);\r\n\r\n var instance = self.instance;\r\n var current = instance.current;\r\n\r\n var endPoints = ( e && pointers(e) ) || self.startPoints;\r\n\r\n var tapX = endPoints[0] ? endPoints[0].x - self.$stage.offset().left : 0;\r\n var tapY = endPoints[0] ? endPoints[0].y - self.$stage.offset().top : 0;\r\n\r\n var where;\r\n\r\n var process = function (prefix) {\r\n\r\n var action = current.opts[prefix];\r\n\r\n if ($.isFunction(action)) {\r\n action = action.apply(instance, [current, e]);\r\n }\r\n\r\n if (!action) {\r\n return;\r\n }\r\n\r\n switch (action) {\r\n\r\n case \"close\" :\r\n\r\n instance.close(self.startEvent);\r\n\r\n break;\r\n\r\n case \"toggleControls\" :\r\n\r\n instance.toggleControls(true);\r\n\r\n break;\r\n\r\n case \"next\" :\r\n\r\n instance.next();\r\n\r\n break;\r\n\r\n case \"nextOrClose\" :\r\n\r\n if (instance.group.length > 1) {\r\n instance.next();\r\n\r\n } else {\r\n instance.close(self.startEvent);\r\n }\r\n\r\n break;\r\n\r\n case \"zoom\" :\r\n\r\n if (current.type == 'image' && ( current.isLoaded || current.$ghost )) {\r\n\r\n if (instance.canPan()) {\r\n instance.scaleToFit();\r\n\r\n } else if (instance.isScaledDown()) {\r\n instance.scaleToActual(tapX, tapY);\r\n\r\n } else if (instance.group.length < 2) {\r\n instance.close(self.startEvent);\r\n }\r\n }\r\n\r\n break;\r\n }\r\n\r\n };\r\n\r\n // Ignore right click\r\n if (e.originalEvent && e.originalEvent.button == 2) {\r\n return;\r\n }\r\n\r\n // Skip if clicked on the scrollbar\r\n if (!$target.is('img') && tapX > $target[0].clientWidth + $target.offset().left) {\r\n return;\r\n }\r\n\r\n // Check where is clicked\r\n if ($target.is('.fancybox-bg,.fancybox-inner,.fancybox-outer,.fancybox-container')) {\r\n where = 'Outside';\r\n\r\n } else if ($target.is('.fancybox-slide')) {\r\n where = 'Slide';\r\n\r\n } else if (instance.current.$content && instance.current.$content.find($target).addBack().filter($target).length) {\r\n where = 'Content';\r\n\r\n } else {\r\n return;\r\n }\r\n\r\n // Check if this is a double tap\r\n if (self.tapped) {\r\n\r\n // Stop previously created single tap\r\n clearTimeout(self.tapped);\r\n self.tapped = null;\r\n\r\n // Skip if distance between taps is too big\r\n if (Math.abs(tapX - self.tapX) > 50 || Math.abs(tapY - self.tapY) > 50) {\r\n return this;\r\n }\r\n\r\n // OK, now we assume that this is a double-tap\r\n process('dblclick' + where);\r\n\r\n } else {\r\n\r\n // Single tap will be processed if user has not clicked second time within 300ms\r\n // or there is no need to wait for double-tap\r\n self.tapX = tapX;\r\n self.tapY = tapY;\r\n\r\n if (current.opts['dblclick' + where] && current.opts['dblclick' + where] !== current.opts['click' + where]) {\r\n\r\n self.tapped = setTimeout(function () {\r\n self.tapped = null;\r\n\r\n process('click' + where);\r\n\r\n }, 500);\r\n\r\n } else {\r\n process('click' + where);\r\n }\r\n\r\n }\r\n\r\n return this;\r\n };\r\n\r\n $(document).on('onActivate.fb', function (e, instance) {\r\n if (instance && !instance.Guestures) {\r\n instance.Guestures = new Guestures(instance);\r\n }\r\n });\r\n\r\n}(window, document, window.jQuery || jQuery));\r\n\r\n// ==========================================================================\r\n//\r\n// SlideShow\r\n// Enables slideshow functionality\r\n//\r\n// Example of usage:\r\n// $.fancybox.getInstance().SlideShow.start()\r\n//\r\n// ==========================================================================\r\n;(function (document, $) {\r\n 'use strict';\r\n\r\n $.extend(true, $.fancybox.defaults, {\r\n btnTpl: {\r\n slideShow:\r\n ''\r\n },\r\n slideShow: {\r\n autoStart: false,\r\n speed: 3000\r\n }\r\n });\r\n\r\n var SlideShow = function (instance) {\r\n this.instance = instance;\r\n this.init();\r\n };\r\n\r\n $.extend(SlideShow.prototype, {\r\n timer: null,\r\n isActive: false,\r\n $button: null,\r\n\r\n init: function () {\r\n var self = this;\r\n\r\n self.$button = self.instance.$refs.toolbar.find('[data-fancybox-play]').on('click', function () {\r\n self.toggle();\r\n });\r\n\r\n if (self.instance.group.length < 2 || !self.instance.group[self.instance.currIndex].opts.slideShow) {\r\n self.$button.hide();\r\n }\r\n },\r\n\r\n set: function (force) {\r\n var self = this;\r\n\r\n // Check if reached last element\r\n if (self.instance && self.instance.current && (force === true || self.instance.current.opts.loop || self.instance.currIndex < self.instance.group.length - 1 )) {\r\n self.timer = setTimeout(function () {\r\n if (self.isActive) {\r\n self.instance.jumpTo((self.instance.currIndex + 1) % self.instance.group.length);\r\n }\r\n\r\n }, self.instance.current.opts.slideShow.speed);\r\n\r\n } else {\r\n self.stop();\r\n self.instance.idleSecondsCounter = 0;\r\n self.instance.showControls();\r\n }\r\n },\r\n\r\n clear: function () {\r\n var self = this;\r\n\r\n clearTimeout(self.timer);\r\n\r\n self.timer = null;\r\n },\r\n\r\n start: function () {\r\n var self = this;\r\n var current = self.instance.current;\r\n\r\n if (current) {\r\n self.isActive = true;\r\n\r\n self.$button\r\n .attr('title', current.opts.i18n[current.opts.lang].PLAY_STOP)\r\n .removeClass('fancybox-button--play')\r\n .addClass('fancybox-button--pause');\r\n\r\n self.set(true);\r\n }\r\n },\r\n\r\n stop: function () {\r\n var self = this;\r\n var current = self.instance.current;\r\n\r\n self.clear();\r\n\r\n self.$button\r\n .attr('title', current.opts.i18n[current.opts.lang].PLAY_START)\r\n .removeClass('fancybox-button--pause')\r\n .addClass('fancybox-button--play');\r\n\r\n self.isActive = false;\r\n },\r\n\r\n toggle: function () {\r\n var self = this;\r\n\r\n if (self.isActive) {\r\n self.stop();\r\n\r\n } else {\r\n self.start();\r\n }\r\n }\r\n\r\n });\r\n\r\n $(document).on({\r\n 'onInit.fb': function (e, instance) {\r\n if (instance && !instance.SlideShow) {\r\n instance.SlideShow = new SlideShow(instance);\r\n }\r\n },\r\n\r\n 'beforeShow.fb': function (e, instance, current, firstRun) {\r\n var SlideShow = instance && instance.SlideShow;\r\n\r\n if (firstRun) {\r\n\r\n if (SlideShow && current.opts.slideShow.autoStart) {\r\n SlideShow.start();\r\n }\r\n\r\n } else if (SlideShow && SlideShow.isActive) {\r\n SlideShow.clear();\r\n }\r\n },\r\n\r\n 'afterShow.fb': function (e, instance, current) {\r\n var SlideShow = instance && instance.SlideShow;\r\n\r\n if (SlideShow && SlideShow.isActive) {\r\n SlideShow.set();\r\n }\r\n },\r\n\r\n 'afterKeydown.fb': function (e, instance, current, keypress, keycode) {\r\n var SlideShow = instance && instance.SlideShow;\r\n\r\n // \"P\" or Spacebar\r\n if (SlideShow && current.opts.slideShow && ( keycode === 80 || keycode === 32 ) && !$(document.activeElement).is('button,a,input')) {\r\n keypress.preventDefault();\r\n\r\n SlideShow.toggle();\r\n }\r\n },\r\n\r\n 'beforeClose.fb onDeactivate.fb': function (e, instance) {\r\n var SlideShow = instance && instance.SlideShow;\r\n\r\n if (SlideShow) {\r\n SlideShow.stop();\r\n }\r\n }\r\n });\r\n\r\n // Page Visibility API to pause slideshow when window is not active\r\n $(document).on(\"visibilitychange\", function () {\r\n var instance = $.fancybox.getInstance();\r\n var SlideShow = instance && instance.SlideShow;\r\n\r\n if (SlideShow && SlideShow.isActive) {\r\n if (document.hidden) {\r\n SlideShow.clear();\r\n\r\n } else {\r\n SlideShow.set();\r\n }\r\n }\r\n });\r\n\r\n}(document, window.jQuery || jQuery));\r\n\r\n// ==========================================================================\r\n//\r\n// FullScreen\r\n// Adds fullscreen functionality\r\n//\r\n// ==========================================================================\r\n;(function (document, $) {\r\n 'use strict';\r\n\r\n // Collection of methods supported by user browser\r\n var fn = (function () {\r\n\r\n var fnMap = [\r\n [\r\n 'requestFullscreen',\r\n 'exitFullscreen',\r\n 'fullscreenElement',\r\n 'fullscreenEnabled',\r\n 'fullscreenchange',\r\n 'fullscreenerror'\r\n ],\r\n // new WebKit\r\n [\r\n 'webkitRequestFullscreen',\r\n 'webkitExitFullscreen',\r\n 'webkitFullscreenElement',\r\n 'webkitFullscreenEnabled',\r\n 'webkitfullscreenchange',\r\n 'webkitfullscreenerror'\r\n\r\n ],\r\n // old WebKit (Safari 5.1)\r\n [\r\n 'webkitRequestFullScreen',\r\n 'webkitCancelFullScreen',\r\n 'webkitCurrentFullScreenElement',\r\n 'webkitCancelFullScreen',\r\n 'webkitfullscreenchange',\r\n 'webkitfullscreenerror'\r\n\r\n ],\r\n [\r\n 'mozRequestFullScreen',\r\n 'mozCancelFullScreen',\r\n 'mozFullScreenElement',\r\n 'mozFullScreenEnabled',\r\n 'mozfullscreenchange',\r\n 'mozfullscreenerror'\r\n ],\r\n [\r\n 'msRequestFullscreen',\r\n 'msExitFullscreen',\r\n 'msFullscreenElement',\r\n 'msFullscreenEnabled',\r\n 'MSFullscreenChange',\r\n 'MSFullscreenError'\r\n ]\r\n ];\r\n\r\n var val;\r\n var ret = {};\r\n var i, j;\r\n\r\n for (i = 0; i < fnMap.length; i++) {\r\n val = fnMap[i];\r\n\r\n if (val && val[1] in document) {\r\n for (j = 0; j < val.length; j++) {\r\n ret[fnMap[0][j]] = val[j];\r\n }\r\n\r\n return ret;\r\n }\r\n }\r\n\r\n return false;\r\n })();\r\n\r\n // If browser does not have Full Screen API, then simply unset default button template and stop\r\n if (!fn) {\r\n\r\n if ($ && $.fancybox) {\r\n $.fancybox.defaults.btnTpl.fullScreen = false;\r\n }\r\n\r\n return;\r\n }\r\n\r\n var FullScreen = {\r\n\r\n request: function (elem) {\r\n\r\n elem = elem || document.documentElement;\r\n\r\n elem[fn.requestFullscreen](elem.ALLOW_KEYBOARD_INPUT);\r\n\r\n },\r\n exit: function () {\r\n\r\n document[fn.exitFullscreen]();\r\n\r\n },\r\n toggle: function (elem) {\r\n\r\n elem = elem || document.documentElement;\r\n\r\n if (this.isFullscreen()) {\r\n this.exit();\r\n\r\n } else {\r\n this.request(elem);\r\n }\r\n\r\n },\r\n isFullscreen: function () {\r\n\r\n return Boolean(document[fn.fullscreenElement]);\r\n\r\n },\r\n enabled: function () {\r\n\r\n return Boolean(document[fn.fullscreenEnabled]);\r\n\r\n }\r\n };\r\n\r\n $.extend(true, $.fancybox.defaults, {\r\n btnTpl: {\r\n fullScreen:\r\n ''\r\n },\r\n fullScreen: {\r\n autoStart: false\r\n }\r\n });\r\n\r\n $(document).on({\r\n 'onInit.fb': function (e, instance) {\r\n var $container;\r\n\r\n if (instance && instance.group[instance.currIndex].opts.fullScreen) {\r\n $container = instance.$refs.container;\r\n\r\n $container.on('click.fb-fullscreen', '[data-fancybox-fullscreen]', function (e) {\r\n\r\n e.stopPropagation();\r\n e.preventDefault();\r\n\r\n FullScreen.toggle($container[0]);\r\n\r\n });\r\n\r\n if (instance.opts.fullScreen && instance.opts.fullScreen.autoStart === true) {\r\n FullScreen.request($container[0]);\r\n }\r\n\r\n // Expose API\r\n instance.FullScreen = FullScreen;\r\n\r\n } else if (instance) {\r\n instance.$refs.toolbar.find('[data-fancybox-fullscreen]').hide();\r\n }\r\n\r\n },\r\n\r\n 'afterKeydown.fb': function (e, instance, current, keypress, keycode) {\r\n\r\n // \"P\" or Spacebar\r\n if (instance && instance.FullScreen && keycode === 70) {\r\n keypress.preventDefault();\r\n\r\n instance.FullScreen.toggle(instance.$refs.container[0]);\r\n }\r\n\r\n },\r\n\r\n 'beforeClose.fb': function (instance) {\r\n if (instance && instance.FullScreen) {\r\n FullScreen.exit();\r\n }\r\n }\r\n });\r\n\r\n $(document).on(fn.fullscreenchange, function () {\r\n var isFullscreen = FullScreen.isFullscreen(),\r\n instance = $.fancybox.getInstance();\r\n\r\n if (instance) {\r\n\r\n // If image is zooming, then force to stop and reposition properly\r\n if (instance.current && instance.current.type === 'image' && instance.isAnimating) {\r\n instance.current.$content.css('transition', 'none');\r\n\r\n instance.isAnimating = false;\r\n\r\n instance.update(true, true, 0);\r\n }\r\n\r\n instance.trigger('onFullscreenChange', isFullscreen);\r\n\r\n instance.$refs.container.toggleClass('fancybox-is-fullscreen', isFullscreen);\r\n }\r\n\r\n });\r\n\r\n}(document, window.jQuery || jQuery));\r\n\r\n// ==========================================================================\r\n//\r\n// Thumbs\r\n// Displays thumbnails in a grid\r\n//\r\n// ==========================================================================\r\n;(function (document, $) {\r\n 'use strict';\r\n\r\n // Make sure there are default values\r\n $.fancybox.defaults = $.extend(true, {\r\n btnTpl: {\r\n thumbs:\r\n ''\r\n },\r\n thumbs: {\r\n autoStart: false, // Display thumbnails on opening\r\n hideOnClose: true, // Hide thumbnail grid when closing animation starts\r\n parentEl: '.fancybox-container', // Container is injected into this element\r\n axis: 'y' // Vertical (y) or horizontal (x) scrolling\r\n }\r\n }, $.fancybox.defaults);\r\n\r\n var FancyThumbs = function (instance) {\r\n this.init(instance);\r\n };\r\n\r\n $.extend(FancyThumbs.prototype, {\r\n\r\n $button: null,\r\n $grid: null,\r\n $list: null,\r\n isVisible: false,\r\n isActive: false,\r\n\r\n init: function (instance) {\r\n var self = this;\r\n\r\n self.instance = instance;\r\n\r\n instance.Thumbs = self;\r\n\r\n // Enable thumbs if at least two group items have thumbnails\r\n var first = instance.group[0],\r\n second = instance.group[1];\r\n\r\n self.opts = instance.group[instance.currIndex].opts.thumbs;\r\n\r\n self.$button = instance.$refs.toolbar.find('[data-fancybox-thumbs]');\r\n\r\n if (self.opts && first && second && (\r\n ( first.type == 'image' || first.opts.thumb || first.opts.$thumb ) &&\r\n ( second.type == 'image' || second.opts.thumb || second.opts.$thumb )\r\n )) {\r\n\r\n self.$button.show().on('click', function () {\r\n self.toggle();\r\n });\r\n\r\n self.isActive = true;\r\n\r\n } else {\r\n self.$button.hide();\r\n }\r\n },\r\n\r\n create: function () {\r\n var self = this,\r\n instance = self.instance,\r\n parentEl = self.opts.parentEl,\r\n list,\r\n src;\r\n\r\n self.$grid = $('
').appendTo(instance.$refs.container.find(parentEl).addBack().filter(parentEl));\r\n\r\n // Build list HTML\r\n list = '
    ';\r\n\r\n $.each(instance.group, function (i, item) {\r\n src = item.opts.thumb || ( item.opts.$thumb ? item.opts.$thumb.attr('src') : null );\r\n\r\n if (!src && item.type === 'image') {\r\n src = item.src;\r\n }\r\n\r\n if (src && src.length) {\r\n list += '
  • ';\r\n }\r\n });\r\n\r\n list += '
';\r\n\r\n self.$list = $(list).appendTo(self.$grid).on('click', 'li', function () {\r\n instance.jumpTo($(this).data('index'));\r\n });\r\n\r\n self.$list.find('img').hide().one('load', function () {\r\n var $parent = $(this).parent().removeClass('fancybox-thumbs-loading'),\r\n thumbWidth = $parent.outerWidth(),\r\n thumbHeight = $parent.outerHeight(),\r\n width,\r\n height,\r\n widthRatio,\r\n heightRatio;\r\n\r\n width = this.naturalWidth || this.width;\r\n height = this.naturalHeight || this.height;\r\n\r\n // Calculate thumbnail dimensions; center vertically and horizontally\r\n widthRatio = width / thumbWidth;\r\n heightRatio = height / thumbHeight;\r\n\r\n if (widthRatio >= 1 && heightRatio >= 1) {\r\n if (widthRatio > heightRatio) {\r\n width = width / heightRatio;\r\n height = thumbHeight;\r\n\r\n } else {\r\n width = thumbWidth;\r\n height = height / widthRatio;\r\n }\r\n }\r\n\r\n $(this).css({\r\n width: Math.floor(width),\r\n height: Math.floor(height),\r\n 'margin-top': height > thumbHeight ? ( Math.floor(thumbHeight * 0.3 - height * 0.3) ) : Math.floor(thumbHeight * 0.5 - height * 0.5),\r\n 'margin-left': Math.floor(thumbWidth * 0.5 - width * 0.5)\r\n }).show();\r\n\r\n })\r\n .each(function () {\r\n this.src = $(this).data('src');\r\n });\r\n\r\n if (self.opts.axis === 'x') {\r\n self.$list.width(parseInt(self.$grid.css(\"padding-right\")) + ( instance.group.length * self.$list.children().eq(0).outerWidth(true) ) + 'px');\r\n }\r\n },\r\n\r\n focus: function (duration) {\r\n var self = this,\r\n $list = self.$list,\r\n thumb,\r\n thumbPos;\r\n\r\n if (self.instance.current) {\r\n thumb = $list.children()\r\n .removeClass('fancybox-thumbs-active')\r\n .filter('[data-index=\"' + self.instance.current.index + '\"]')\r\n .addClass('fancybox-thumbs-active');\r\n\r\n thumbPos = thumb.position();\r\n\r\n // Check if need to scroll to make current thumb visible\r\n if (self.opts.axis === 'y' && ( thumbPos.top < 0 || thumbPos.top > ( $list.height() - thumb.outerHeight() ) )) {\r\n $list.stop().animate({'scrollTop': $list.scrollTop() + thumbPos.top}, duration);\r\n\r\n } else if (self.opts.axis === 'x' && (\r\n thumbPos.left < $list.parent().scrollLeft() ||\r\n thumbPos.left > ( $list.parent().scrollLeft() + ( $list.parent().width() - thumb.outerWidth() ) )\r\n )\r\n ) {\r\n $list.parent().stop().animate({'scrollLeft': thumbPos.left}, duration);\r\n }\r\n }\r\n },\r\n\r\n update: function () {\r\n this.instance.$refs.container.toggleClass('fancybox-show-thumbs', this.isVisible);\r\n\r\n if (this.isVisible) {\r\n if (!this.$grid) {\r\n this.create();\r\n }\r\n\r\n this.instance.trigger('onThumbsShow');\r\n\r\n this.focus(0);\r\n\r\n } else if (this.$grid) {\r\n this.instance.trigger('onThumbsHide');\r\n }\r\n\r\n // Update content position\r\n this.instance.update();\r\n },\r\n\r\n hide: function () {\r\n this.isVisible = false;\r\n this.update();\r\n },\r\n\r\n show: function () {\r\n this.isVisible = true;\r\n this.update();\r\n },\r\n\r\n toggle: function () {\r\n this.isVisible = !this.isVisible;\r\n this.update();\r\n }\r\n });\r\n\r\n $(document).on({\r\n\r\n 'onInit.fb': function (e, instance) {\r\n var Thumbs;\r\n\r\n if (instance && !instance.Thumbs) {\r\n Thumbs = new FancyThumbs(instance);\r\n\r\n if (Thumbs.isActive && Thumbs.opts.autoStart === true) {\r\n Thumbs.show();\r\n }\r\n }\r\n },\r\n\r\n 'beforeShow.fb': function (e, instance, item, firstRun) {\r\n var Thumbs = instance && instance.Thumbs;\r\n\r\n if (Thumbs && Thumbs.isVisible) {\r\n Thumbs.focus(firstRun ? 0 : 250);\r\n }\r\n },\r\n\r\n 'afterKeydown.fb': function (e, instance, current, keypress, keycode) {\r\n var Thumbs = instance && instance.Thumbs;\r\n\r\n // \"G\"\r\n if (Thumbs && Thumbs.isActive && keycode === 71) {\r\n keypress.preventDefault();\r\n\r\n Thumbs.toggle();\r\n }\r\n },\r\n\r\n 'beforeClose.fb': function (e, instance) {\r\n var Thumbs = instance && instance.Thumbs;\r\n\r\n if (Thumbs && Thumbs.isVisible && Thumbs.opts.hideOnClose !== false) {\r\n Thumbs.$grid.hide();\r\n }\r\n }\r\n\r\n });\r\n\r\n}(document, window.jQuery));\r\n\r\n//// ==========================================================================\r\n//\r\n// Share\r\n// Displays simple form for sharing current url\r\n//\r\n// ==========================================================================\r\n;(function (document, $) {\r\n 'use strict';\r\n\r\n $.extend(true, $.fancybox.defaults, {\r\n btnTpl: {\r\n share:\r\n ''\r\n },\r\n share: {\r\n tpl:\r\n '
' +\r\n '

{{SHARE}}

' +\r\n '

' +\r\n '' +\r\n '' +\r\n 'Facebook' +\r\n '' +\r\n '' +\r\n '' +\r\n 'Pinterest' +\r\n '' +\r\n '' +\r\n '' +\r\n 'Twitter' +\r\n '' +\r\n '

' +\r\n '

' +\r\n '
'\r\n }\r\n });\r\n\r\n function escapeHtml(string) {\r\n var entityMap = {\r\n '&': '&',\r\n '<': '<',\r\n '>': '>',\r\n '\"': '"',\r\n \"'\": ''',\r\n '/': '/',\r\n '`': '`',\r\n '=': '='\r\n };\r\n\r\n return String(string).replace(/[&<>\"'`=\\/]/g, function (s) {\r\n return entityMap[s];\r\n });\r\n }\r\n\r\n $(document).on('click', '[data-fancybox-share]', function () {\r\n var f = $.fancybox.getInstance(),\r\n url,\r\n tpl;\r\n\r\n if (f) {\r\n url = f.current.opts.hash === false ? f.current.src : window.location;\r\n tpl = f.current.opts.share.tpl\r\n .replace(/\\{\\{media\\}\\}/g, f.current.type === 'image' ? encodeURIComponent(f.current.src) : '')\r\n .replace(/\\{\\{url\\}\\}/g, encodeURIComponent(url))\r\n .replace(/\\{\\{url_raw\\}\\}/g, escapeHtml(url))\r\n .replace(/\\{\\{descr\\}\\}/g, f.$caption ? encodeURIComponent(f.$caption.text()) : '');\r\n\r\n $.fancybox.open({\r\n src: f.translate(f, tpl),\r\n type: 'html',\r\n opts: {\r\n animationEffect: \"fade\",\r\n animationDuration: 250,\r\n afterLoad: function (instance, current) {\r\n // Opening links in a popup window\r\n current.$content.find('.fancybox-share__links a').click(function () {\r\n window.open(this.href, \"Share\", \"width=550, height=450\");\r\n return false;\r\n });\r\n }\r\n }\r\n });\r\n }\r\n\r\n });\r\n\r\n}(document, window.jQuery || jQuery));\r\n\r\n// ==========================================================================\r\n//\r\n// Hash\r\n// Enables linking to each modal\r\n//\r\n// ==========================================================================\r\n;(function (document, window, $) {\r\n 'use strict';\r\n\r\n // Simple $.escapeSelector polyfill (for jQuery prior v3)\r\n if (!$.escapeSelector) {\r\n $.escapeSelector = function (sel) {\r\n var rcssescape = /([\\0-\\x1f\\x7f]|^-?\\d)|^-$|[^\\x80-\\uFFFF\\w-]/g;\r\n var fcssescape = function (ch, asCodePoint) {\r\n if (asCodePoint) {\r\n // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER\r\n if (ch === \"\\0\") {\r\n return \"\\uFFFD\";\r\n }\r\n\r\n // Control characters and (dependent upon position) numbers get escaped as code points\r\n return ch.slice(0, -1) + \"\\\\\" + ch.charCodeAt(ch.length - 1).toString(16) + \" \";\r\n }\r\n\r\n // Other potentially-special ASCII characters get backslash-escaped\r\n return \"\\\\\" + ch;\r\n };\r\n\r\n return ( sel + \"\" ).replace(rcssescape, fcssescape);\r\n };\r\n }\r\n\r\n // Create new history entry only once\r\n var shouldCreateHistory = true;\r\n\r\n // Variable containing last hash value set by fancyBox\r\n // It will be used to determine if fancyBox needs to close after hash change is detected\r\n var currentHash = null;\r\n\r\n // Throttling the history change\r\n var timerID = null;\r\n\r\n // Get info about gallery name and current index from url\r\n function parseUrl() {\r\n var hash = window.location.hash.substr(1);\r\n var rez = hash.split('-');\r\n var index = rez.length > 1 && /^\\+?\\d+$/.test(rez[rez.length - 1]) ? parseInt(rez.pop(-1), 10) || 1 : 1;\r\n var gallery = rez.join('-');\r\n\r\n // Index is starting from 1\r\n if (index < 1) {\r\n index = 1;\r\n }\r\n\r\n return {\r\n hash: hash,\r\n index: index,\r\n gallery: gallery\r\n };\r\n }\r\n\r\n // Trigger click evnt on links to open new fancyBox instance\r\n function triggerFromUrl(url) {\r\n var $el;\r\n\r\n if (url.gallery !== '') {\r\n\r\n // If we can find element matching 'data-fancybox' atribute, then trigger click event for that ..\r\n $el = $(\"[data-fancybox='\" + $.escapeSelector(url.gallery) + \"']\").eq(url.index - 1);\r\n\r\n if (!$el.length) {\r\n // .. if not, try finding element by ID\r\n $el = $(\"#\" + $.escapeSelector(url.gallery) + \"\");\r\n }\r\n\r\n if ($el.length) {\r\n shouldCreateHistory = false;\r\n\r\n $el.trigger('click');\r\n }\r\n\r\n }\r\n }\r\n\r\n // Get gallery name from current instance\r\n function getGalleryID(instance) {\r\n var opts;\r\n\r\n if (!instance) {\r\n return false;\r\n }\r\n\r\n opts = instance.current ? instance.current.opts : instance.opts;\r\n\r\n return opts.hash || ( opts.$orig ? opts.$orig.data('fancybox') : '' );\r\n }\r\n\r\n // Start when DOM becomes ready\r\n $(function () {\r\n\r\n // Check if user has disabled this module\r\n if ($.fancybox.defaults.hash === false) {\r\n return;\r\n }\r\n\r\n // Update hash when opening/closing fancyBox\r\n $(document).on({\r\n 'onInit.fb': function (e, instance) {\r\n var url, gallery;\r\n\r\n if (instance.group[instance.currIndex].opts.hash === false) {\r\n return;\r\n }\r\n\r\n url = parseUrl();\r\n gallery = getGalleryID(instance);\r\n\r\n // Make sure gallery start index matches index from hash\r\n if (gallery && url.gallery && gallery == url.gallery) {\r\n instance.currIndex = url.index - 1;\r\n }\r\n },\r\n\r\n 'beforeShow.fb': function (e, instance, current) {\r\n var gallery;\r\n\r\n if (!current || current.opts.hash === false) {\r\n return;\r\n }\r\n\r\n gallery = getGalleryID(instance);\r\n\r\n // Update window hash\r\n if (gallery && gallery !== '') {\r\n\r\n if (window.location.hash.indexOf(gallery) < 0) {\r\n instance.opts.origHash = window.location.hash;\r\n }\r\n\r\n currentHash = gallery + ( instance.group.length > 1 ? '-' + ( current.index + 1 ) : '' );\r\n\r\n if ('replaceState' in window.history) {\r\n if (timerID) {\r\n clearTimeout(timerID);\r\n }\r\n\r\n timerID = setTimeout(function () {\r\n window.history[shouldCreateHistory ? 'pushState' : 'replaceState']({}, document.title, window.location.pathname + window.location.search + '#' + currentHash);\r\n\r\n timerID = null;\r\n\r\n shouldCreateHistory = false;\r\n\r\n }, 300);\r\n\r\n } else {\r\n window.location.hash = currentHash;\r\n }\r\n\r\n }\r\n\r\n },\r\n\r\n 'beforeClose.fb': function (e, instance, current) {\r\n var gallery, origHash;\r\n\r\n if (timerID) {\r\n clearTimeout(timerID);\r\n }\r\n\r\n if (current.opts.hash === false) {\r\n return;\r\n }\r\n\r\n gallery = getGalleryID(instance);\r\n origHash = instance && instance.opts.origHash ? instance.opts.origHash : '';\r\n\r\n // Remove hash from location bar\r\n if (gallery && gallery !== '') {\r\n\r\n if ('replaceState' in history) {\r\n window.history.replaceState({}, document.title, window.location.pathname + window.location.search + origHash);\r\n\r\n } else {\r\n window.location.hash = origHash;\r\n\r\n // Keep original scroll position\r\n $(window).scrollTop(instance.scrollTop).scrollLeft(instance.scrollLeft);\r\n }\r\n }\r\n\r\n currentHash = null;\r\n }\r\n });\r\n\r\n // Check if need to close after url has changed\r\n $(window).on('hashchange.fb', function () {\r\n var url = parseUrl();\r\n\r\n if ($.fancybox.getInstance()) {\r\n if (currentHash && currentHash !== url.gallery + '-' + url.index && !( url.index === 1 && currentHash == url.gallery )) {\r\n currentHash = null;\r\n\r\n $.fancybox.close();\r\n }\r\n\r\n } else if (url.gallery !== '') {\r\n triggerFromUrl(url);\r\n }\r\n });\r\n\r\n // Check current hash and trigger click event on matching element to start fancyBox, if needed\r\n setTimeout(function () {\r\n triggerFromUrl(parseUrl());\r\n }, 50);\r\n });\r\n\r\n}(document, window, window.jQuery || jQuery));\r\n\r\n;(function (document, $) {\r\n 'use strict';\r\n\r\n var prevTime = new Date().getTime();\r\n\r\n $(document).on({\r\n 'onInit.fb': function (e, instance, current) {\r\n instance.$refs.stage.on('mousewheel DOMMouseScroll wheel MozMousePixelScroll', function (e) {\r\n var current = instance.current,\r\n currTime = new Date().getTime();\r\n\r\n if (instance.group.length < 1 || current.opts.wheel === false || ( current.opts.wheel === 'auto' && current.type !== 'image' )) {\r\n return;\r\n }\r\n\r\n e.preventDefault();\r\n e.stopPropagation();\r\n\r\n if (current.$slide.hasClass('fancybox-animated')) {\r\n return;\r\n }\r\n\r\n e = e.originalEvent || e;\r\n\r\n if (currTime - prevTime < 250) {\r\n return;\r\n }\r\n\r\n prevTime = currTime;\r\n\r\n instance[( -e.deltaY || -e.deltaX || e.wheelDelta || -e.detail ) < 0 ? 'next' : 'previous']();\r\n\r\n });\r\n }\r\n });\r\n\r\n}(document, window.jQuery || jQuery));\r\n\n\n\n// WEBPACK FOOTER //\n// ./src/static/scripts/plugins/jquery.fancybox.js","/*\r\n * jQuery Form Styler v2.0.1\r\n * https://github.com/Dimox/jQueryFormStyler\r\n *\r\n * Copyright 2012-2017 Dimox (http://dimox.name/)\r\n * Released under the MIT license.\r\n *\r\n * Date: 2017.08.29\r\n *\r\n */\r\n\r\n;(function (factory) {\r\n if (typeof define === 'function' && define.amd) {\r\n // AMD\r\n define(['jquery'], factory);\r\n } else if (typeof exports === 'object') {\r\n // CommonJS\r\n module.exports = factory($ || require('jquery'));\r\n } else {\r\n factory(jQuery);\r\n }\r\n}(function ($) {\r\n\r\n 'use strict';\r\n\r\n var pluginName = 'styler',\r\n defaults = {\r\n idSuffix: '-styler',\r\n filePlaceholder: 'Файл не выбран',\r\n fileBrowse: 'Обзор...',\r\n fileNumber: 'Выбрано файлов: %s',\r\n selectPlaceholder: 'Выберите...',\r\n selectSearch: false,\r\n selectSearchLimit: 10,\r\n selectSearchNotFound: 'Совпадений не найдено',\r\n selectSearchPlaceholder: 'Поиск...',\r\n selectVisibleOptions: 0,\r\n selectSmartPositioning: true,\r\n locale: 'ru',\r\n locales: {\r\n 'en': {\r\n filePlaceholder: 'No file selected',\r\n fileBrowse: 'Browse...',\r\n fileNumber: 'Selected files: %s',\r\n selectPlaceholder: 'Select...',\r\n selectSearchNotFound: 'No matches found',\r\n selectSearchPlaceholder: 'Search...'\r\n }\r\n },\r\n onSelectOpened: function () {\r\n },\r\n onSelectClosed: function () {\r\n },\r\n onFormStyled: function () {\r\n }\r\n };\r\n\r\n function Plugin(element, options) {\r\n this.element = element;\r\n this.options = $.extend({}, defaults, options);\r\n var locale = this.options.locale;\r\n if (this.options.locales[locale] !== undefined) {\r\n $.extend(this.options, this.options.locales[locale]);\r\n }\r\n this.init();\r\n }\r\n\r\n Plugin.prototype = {\r\n\r\n // инициализация\r\n init: function () {\r\n\r\n var el = $(this.element);\r\n var opt = this.options;\r\n\r\n var iOS = (navigator.userAgent.match(/(iPad|iPhone|iPod)/i) && !navigator.userAgent.match(/(Windows\\sPhone)/i)) ? true : false;\r\n var Android = (navigator.userAgent.match(/Android/i) && !navigator.userAgent.match(/(Windows\\sPhone)/i)) ? true : false;\r\n\r\n function Attributes() {\r\n if (el.attr('id') !== undefined && el.attr('id') !== '') {\r\n this.id = el.attr('id') + opt.idSuffix;\r\n }\r\n this.title = el.attr('title');\r\n this.classes = el.attr('class');\r\n this.data = el.data();\r\n }\r\n\r\n // checkbox\r\n if (el.is(':checkbox')) {\r\n\r\n var checkboxOutput = function () {\r\n\r\n var att = new Attributes();\r\n var checkbox = $('
')\r\n .attr({\r\n id: att.id,\r\n title: att.title\r\n })\r\n .addClass(att.classes)\r\n .data(att.data)\r\n ;\r\n\r\n el.after(checkbox).prependTo(checkbox);\r\n if (el.is(':checked')) checkbox.addClass('checked');\r\n if (el.is(':disabled')) checkbox.addClass('disabled');\r\n\r\n // клик на псевдочекбокс\r\n checkbox.click(function (e) {\r\n e.preventDefault();\r\n el.triggerHandler('click');\r\n if (!checkbox.is('.disabled')) {\r\n if (el.is(':checked')) {\r\n el.prop('checked', false);\r\n checkbox.removeClass('checked');\r\n } else {\r\n el.prop('checked', true);\r\n checkbox.addClass('checked');\r\n }\r\n el.focus().change();\r\n }\r\n });\r\n // клик на label\r\n el.closest('label').add('label[for=\"' + el.attr('id') + '\"]').on('click.styler', function (e) {\r\n if (!$(e.target).is('a') && !$(e.target).closest(checkbox).length) {\r\n checkbox.triggerHandler('click');\r\n e.preventDefault();\r\n }\r\n });\r\n // переключение по Space или Enter\r\n el.on('change.styler', function () {\r\n if (el.is(':checked')) checkbox.addClass('checked');\r\n else checkbox.removeClass('checked');\r\n })\r\n // чтобы переключался чекбокс, который находится в теге label\r\n .on('keydown.styler', function (e) {\r\n if (e.which == 32) checkbox.click();\r\n })\r\n .on('focus.styler', function () {\r\n if (!checkbox.is('.disabled')) checkbox.addClass('focused');\r\n })\r\n .on('blur.styler', function () {\r\n checkbox.removeClass('focused');\r\n });\r\n\r\n }; // end checkboxOutput()\r\n\r\n checkboxOutput();\r\n\r\n // обновление при динамическом изменении\r\n el.on('refresh', function () {\r\n el.closest('label').add('label[for=\"' + el.attr('id') + '\"]').off('.styler');\r\n el.off('.styler').parent().before(el).remove();\r\n checkboxOutput();\r\n });\r\n\r\n // end checkbox\r\n\r\n // radio\r\n } else if (el.is(':radio')) {\r\n\r\n var radioOutput = function () {\r\n\r\n var att = new Attributes();\r\n var radio = $('
')\r\n .attr({\r\n id: att.id,\r\n title: att.title\r\n })\r\n .addClass(att.classes)\r\n .data(att.data)\r\n ;\r\n\r\n el.after(radio).prependTo(radio);\r\n if (el.is(':checked')) radio.addClass('checked');\r\n if (el.is(':disabled')) radio.addClass('disabled');\r\n\r\n // определяем общего родителя у радиокнопок с одинаковым name\r\n // http://stackoverflow.com/a/27733847\r\n $.fn.commonParents = function () {\r\n var cachedThis = this;\r\n return cachedThis.first().parents().filter(function () {\r\n return $(this).find(cachedThis).length === cachedThis.length;\r\n });\r\n };\r\n $.fn.commonParent = function () {\r\n return $(this).commonParents().first();\r\n };\r\n\r\n // клик на псевдорадиокнопке\r\n radio.click(function (e) {\r\n e.preventDefault();\r\n el.triggerHandler('click');\r\n if (!radio.is('.disabled')) {\r\n var inputName = $('input[name=\"' + el.attr('name') + '\"]');\r\n inputName.commonParent().find(inputName).prop('checked', false).parent().removeClass('checked');\r\n el.prop('checked', true).parent().addClass('checked');\r\n el.focus().change();\r\n }\r\n });\r\n // клик на label\r\n el.closest('label').add('label[for=\"' + el.attr('id') + '\"]').on('click.styler', function (e) {\r\n if (!$(e.target).is('a') && !$(e.target).closest(radio).length) {\r\n radio.triggerHandler('click');\r\n e.preventDefault();\r\n }\r\n });\r\n // переключение стрелками\r\n el.on('change.styler', function () {\r\n el.parent().addClass('checked');\r\n })\r\n .on('focus.styler', function () {\r\n if (!radio.is('.disabled')) radio.addClass('focused');\r\n })\r\n .on('blur.styler', function () {\r\n radio.removeClass('focused');\r\n });\r\n\r\n }; // end radioOutput()\r\n\r\n radioOutput();\r\n\r\n // обновление при динамическом изменении\r\n el.on('refresh', function () {\r\n el.closest('label').add('label[for=\"' + el.attr('id') + '\"]').off('.styler');\r\n el.off('.styler').parent().before(el).remove();\r\n radioOutput();\r\n });\r\n\r\n // end radio\r\n\r\n // file\r\n } else if (el.is(':file')) {\r\n\r\n var fileOutput = function () {\r\n\r\n var att = new Attributes();\r\n var placeholder = el.data('placeholder');\r\n if (placeholder === undefined) placeholder = opt.filePlaceholder;\r\n var browse = el.data('browse');\r\n if (browse === undefined || browse === '') browse = opt.fileBrowse;\r\n\r\n var file =\r\n $('
' +\r\n '
' + placeholder + '
' +\r\n '
' + browse + '
' +\r\n '
')\r\n .attr({\r\n id: att.id,\r\n title: att.title\r\n })\r\n .addClass(att.classes)\r\n .data(att.data)\r\n ;\r\n\r\n el.after(file).appendTo(file);\r\n if (el.is(':disabled')) file.addClass('disabled');\r\n\r\n var value = el.val();\r\n var name = $('div.jq-file__name', file);\r\n\r\n // чтобы при динамическом изменении имя файла не сбрасывалось\r\n if (value) name.text(value.replace(/.+[\\\\\\/]/, ''));\r\n\r\n el.on('change.styler', function () {\r\n var value = el.val();\r\n if (el.is('[multiple]')) {\r\n value = '';\r\n var files = el[0].files.length;\r\n if (files > 0) {\r\n var number = el.data('number');\r\n if (number === undefined) number = opt.fileNumber;\r\n number = number.replace('%s', files);\r\n value = number;\r\n }\r\n }\r\n name.text(value.replace(/.+[\\\\\\/]/, ''));\r\n if (value === '') {\r\n name.text(placeholder);\r\n file.removeClass('changed');\r\n } else {\r\n file.addClass('changed');\r\n }\r\n })\r\n .on('focus.styler', function () {\r\n file.addClass('focused');\r\n })\r\n .on('blur.styler', function () {\r\n file.removeClass('focused');\r\n })\r\n .on('click.styler', function () {\r\n file.removeClass('focused');\r\n });\r\n\r\n }; // end fileOutput()\r\n\r\n fileOutput();\r\n\r\n // обновление при динамическом изменении\r\n el.on('refresh', function () {\r\n el.off('.styler').parent().before(el).remove();\r\n fileOutput();\r\n });\r\n\r\n // end file\r\n\r\n // number\r\n } else if (el.is('input[type=\"number\"]')) {\r\n\r\n var numberOutput = function () {\r\n\r\n var att = new Attributes();\r\n var number =\r\n $('
' +\r\n '
' +\r\n '
' +\r\n '
')\r\n .attr({\r\n id: att.id,\r\n title: att.title\r\n })\r\n .addClass(att.classes)\r\n .data(att.data)\r\n ;\r\n\r\n el.after(number).prependTo(number).wrap('
');\r\n if (el.is(':disabled')) number.addClass('disabled');\r\n\r\n var min,\r\n max,\r\n step,\r\n timeout = null,\r\n interval = null;\r\n if (el.attr('min') !== undefined) min = el.attr('min');\r\n if (el.attr('max') !== undefined) max = el.attr('max');\r\n if (el.attr('step') !== undefined && $.isNumeric(el.attr('step')))\r\n step = Number(el.attr('step'));\r\n else\r\n step = Number(1);\r\n\r\n var changeValue = function (spin) {\r\n var value = el.val(),\r\n newValue;\r\n\r\n if (!$.isNumeric(value)) {\r\n value = 0;\r\n el.val('0');\r\n }\r\n\r\n if (spin.is('.minus')) {\r\n newValue = Number(value) - step;\r\n } else if (spin.is('.plus')) {\r\n newValue = Number(value) + step;\r\n }\r\n\r\n // определяем количество десятичных знаков после запятой в step\r\n var decimals = (step.toString().split('.')[1] || []).length;\r\n if (decimals > 0) {\r\n var multiplier = '1';\r\n while (multiplier.length <= decimals) multiplier = multiplier + '0';\r\n // избегаем появления лишних знаков после запятой\r\n newValue = Math.round(newValue * multiplier) / multiplier;\r\n }\r\n\r\n if ($.isNumeric(min) && $.isNumeric(max)) {\r\n if (newValue >= min && newValue <= max) el.val(newValue);\r\n } else if ($.isNumeric(min) && !$.isNumeric(max)) {\r\n if (newValue >= min) el.val(newValue);\r\n } else if (!$.isNumeric(min) && $.isNumeric(max)) {\r\n if (newValue <= max) el.val(newValue);\r\n } else {\r\n el.val(newValue);\r\n }\r\n };\r\n\r\n if (!number.is('.disabled')) {\r\n number.on('mousedown', 'div.jq-number__spin', function () {\r\n var spin = $(this);\r\n changeValue(spin);\r\n timeout = setTimeout(function () {\r\n interval = setInterval(function () {\r\n changeValue(spin);\r\n }, 40);\r\n }, 350);\r\n }).on('mouseup mouseout', 'div.jq-number__spin', function () {\r\n clearTimeout(timeout);\r\n clearInterval(interval);\r\n }).on('mouseup', 'div.jq-number__spin', function () {\r\n el.change().trigger('input');\r\n });\r\n el.on('focus.styler', function () {\r\n number.addClass('focused');\r\n })\r\n .on('blur.styler', function () {\r\n number.removeClass('focused');\r\n });\r\n }\r\n\r\n }; // end numberOutput()\r\n\r\n numberOutput();\r\n\r\n // обновление при динамическом изменении\r\n el.on('refresh', function () {\r\n el.off('.styler').closest('.jq-number').before(el).remove();\r\n numberOutput();\r\n });\r\n\r\n // end number\r\n\r\n // select\r\n } else if (el.is('select')) {\r\n\r\n var selectboxOutput = function () {\r\n\r\n // запрещаем прокрутку страницы при прокрутке селекта\r\n function preventScrolling(selector) {\r\n\r\n var scrollDiff = selector.prop('scrollHeight') - selector.outerHeight(),\r\n wheelDelta = null,\r\n scrollTop = null;\r\n\r\n selector.off('mousewheel DOMMouseScroll').on('mousewheel DOMMouseScroll', function (e) {\r\n\r\n /**\r\n * нормализация направления прокрутки\r\n * (firefox < 0 || chrome etc... > 0)\r\n * (e.originalEvent.detail < 0 || e.originalEvent.wheelDelta > 0)\r\n */\r\n wheelDelta = (e.originalEvent.detail < 0 || e.originalEvent.wheelDelta > 0) ? 1 : -1; // направление прокрутки (-1 вниз, 1 вверх)\r\n scrollTop = selector.scrollTop(); // позиция скролла\r\n\r\n if ((scrollTop >= scrollDiff && wheelDelta < 0) || (scrollTop <= 0 && wheelDelta > 0)) {\r\n e.stopPropagation();\r\n e.preventDefault();\r\n }\r\n\r\n });\r\n }\r\n\r\n var option = $('option', el);\r\n var list = '';\r\n\r\n // формируем список селекта\r\n function makeList() {\r\n for (var i = 0; i < option.length; i++) {\r\n var op = option.eq(i);\r\n var li = '',\r\n liClass = '',\r\n liClasses = '',\r\n id = '',\r\n title = '',\r\n dataList = '',\r\n optionClass = '',\r\n optgroupClass = '',\r\n dataJqfsClass = '';\r\n var disabled = 'disabled';\r\n var selDis = 'selected sel disabled';\r\n if (op.prop('selected')) liClass = 'selected sel';\r\n if (op.is(':disabled')) liClass = disabled;\r\n if (op.is(':selected:disabled')) liClass = selDis;\r\n if (op.attr('id') !== undefined && op.attr('id') !== '') id = ' id=\"' + op.attr('id') + opt.idSuffix + '\"';\r\n if (op.attr('title') !== undefined && option.attr('title') !== '') title = ' title=\"' + op.attr('title') + '\"';\r\n if (op.attr('class') !== undefined) {\r\n optionClass = ' ' + op.attr('class');\r\n dataJqfsClass = ' data-jqfs-class=\"' + op.attr('class') + '\"';\r\n }\r\n\r\n var data = op.data();\r\n for (var k in data) {\r\n if (data[k] !== '') dataList += ' data-' + k + '=\"' + data[k] + '\"';\r\n }\r\n\r\n if ((liClass + optionClass) !== '') liClasses = ' class=\"' + liClass + optionClass + '\"';\r\n li = '' + op.html() + '';\r\n\r\n // если есть optgroup\r\n if (op.parent().is('optgroup')) {\r\n if (op.parent().attr('class') !== undefined) optgroupClass = ' ' + op.parent().attr('class');\r\n li = '' + op.html() + '';\r\n if (op.is(':first-child')) {\r\n li = '
  • ' + op.parent().attr('label') + '
  • ' + li;\r\n }\r\n }\r\n\r\n list += li;\r\n }\r\n } // end makeList()\r\n\r\n // одиночный селект\r\n function doSelect() {\r\n\r\n var att = new Attributes();\r\n var searchHTML = '';\r\n var selectPlaceholder = el.data('placeholder');\r\n var selectSearch = el.data('search');\r\n var selectSearchLimit = el.data('search-limit');\r\n var selectSearchNotFound = el.data('search-not-found');\r\n var selectSearchPlaceholder = el.data('search-placeholder');\r\n var selectSmartPositioning = el.data('smart-positioning');\r\n\r\n if (selectPlaceholder === undefined) selectPlaceholder = opt.selectPlaceholder;\r\n if (selectSearch === undefined || selectSearch === '') selectSearch = opt.selectSearch;\r\n if (selectSearchLimit === undefined || selectSearchLimit === '') selectSearchLimit = opt.selectSearchLimit;\r\n if (selectSearchNotFound === undefined || selectSearchNotFound === '') selectSearchNotFound = opt.selectSearchNotFound;\r\n if (selectSearchPlaceholder === undefined) selectSearchPlaceholder = opt.selectSearchPlaceholder;\r\n if (selectSmartPositioning === undefined || selectSmartPositioning === '') selectSmartPositioning = opt.selectSmartPositioning;\r\n\r\n var selectbox =\r\n $('
    ' +\r\n '
    ' +\r\n '
    ' +\r\n '
    ' +\r\n '
    ' +\r\n '
    ' +\r\n '
    ')\r\n .attr({\r\n id: att.id,\r\n title: att.title\r\n })\r\n .addClass(att.classes)\r\n .data(att.data)\r\n ;\r\n\r\n el.after(selectbox).prependTo(selectbox);\r\n\r\n var selectzIndex = selectbox.css('z-index');\r\n selectzIndex = (selectzIndex > 0 ) ? selectzIndex : 1;\r\n var divSelect = $('div.jq-selectbox__select', selectbox);\r\n var divText = $('div.jq-selectbox__select-text', selectbox);\r\n var optionSelected = option.filter(':selected');\r\n\r\n makeList();\r\n\r\n if (selectSearch) searchHTML =\r\n '
    ' +\r\n '
    ' + selectSearchNotFound + '
    ';\r\n var dropdown =\r\n $('
    ' +\r\n searchHTML + '
      ' + list + '
    ' +\r\n '
    ');\r\n selectbox.append(dropdown);\r\n var ul = $('ul', dropdown);\r\n var li = $('li', dropdown);\r\n var search = $('input', dropdown);\r\n var notFound = $('div.jq-selectbox__not-found', dropdown).hide();\r\n if (li.length < selectSearchLimit) search.parent().hide();\r\n\r\n // показываем опцию по умолчанию\r\n // если у 1-й опции нет текста, она выбрана по умолчанию и параметр selectPlaceholder не false, то показываем плейсхолдер\r\n if (option.first().text() === '' && option.first().is(':selected') && selectPlaceholder !== false) {\r\n divText.text(selectPlaceholder).addClass('placeholder');\r\n } else {\r\n divText.text(optionSelected.text());\r\n }\r\n\r\n // определяем самый широкий пункт селекта\r\n var liWidthInner = 0,\r\n liWidth = 0;\r\n li.css({'display': 'inline-block'});\r\n li.each(function () {\r\n var l = $(this);\r\n if (l.innerWidth() > liWidthInner) {\r\n liWidthInner = l.innerWidth();\r\n liWidth = l.width();\r\n }\r\n });\r\n li.css({'display': ''});\r\n\r\n // подстраиваем ширину свернутого селекта в зависимости\r\n // от ширины плейсхолдера или самого широкого пункта\r\n if (divText.is('.placeholder') && (divText.width() > liWidthInner)) {\r\n divText.width(divText.width());\r\n } else {\r\n var selClone = selectbox.clone().appendTo('body').width('auto');\r\n var selCloneWidth = selClone.outerWidth();\r\n selClone.remove();\r\n if (selCloneWidth == selectbox.outerWidth()) {\r\n divText.width(liWidth);\r\n }\r\n }\r\n\r\n // подстраиваем ширину выпадающего списка в зависимости от самого широкого пункта\r\n if (liWidthInner > selectbox.width()) dropdown.width(liWidthInner);\r\n\r\n // прячем 1-ю пустую опцию, если она есть и если атрибут data-placeholder не пустой\r\n // если все же нужно, чтобы первая пустая опция отображалась, то указываем у селекта: data-placeholder!=\"\"\r\n if (option.first().text() === '' && el.data('placeholder') !== '') {\r\n li.first().hide();\r\n }\r\n\r\n var selectHeight = selectbox.outerHeight(true);\r\n var searchHeight = search.parent().outerHeight(true) || 0;\r\n var isMaxHeight = ul.css('max-height');\r\n var liSelected = li.filter('.selected');\r\n if (liSelected.length < 1) li.first().addClass('selected sel');\r\n if (li.data('li-height') === undefined) {\r\n var liOuterHeight = li.outerHeight();\r\n if (selectPlaceholder !== false) liOuterHeight = li.eq(1).outerHeight();\r\n li.data('li-height', liOuterHeight);\r\n }\r\n var position = dropdown.css('top');\r\n if (dropdown.css('left') == 'auto') dropdown.css({left: 0});\r\n if (dropdown.css('top') == 'auto') {\r\n dropdown.css({top: selectHeight});\r\n position = selectHeight;\r\n }\r\n dropdown.hide();\r\n\r\n // если выбран не дефолтный пункт\r\n if (liSelected.length) {\r\n // добавляем класс, показывающий изменение селекта\r\n if (option.first().text() != optionSelected.text()) {\r\n selectbox.addClass('changed');\r\n }\r\n // передаем селекту класс выбранного пункта\r\n selectbox.data('jqfs-class', liSelected.data('jqfs-class'));\r\n selectbox.addClass(liSelected.data('jqfs-class'));\r\n }\r\n\r\n // если селект неактивный\r\n if (el.is(':disabled')) {\r\n selectbox.addClass('disabled');\r\n return false;\r\n }\r\n\r\n // при клике на псевдоселекте\r\n divSelect.click(function () {\r\n\r\n // колбек при закрытии селекта\r\n if ($('div.jq-selectbox').filter('.opened').length) {\r\n opt.onSelectClosed.call($('div.jq-selectbox').filter('.opened'));\r\n }\r\n\r\n el.focus();\r\n\r\n // если iOS, то не показываем выпадающий список,\r\n // т.к. отображается нативный и неизвестно, как его спрятать\r\n if (iOS) return;\r\n\r\n // умное позиционирование\r\n var win = $(window);\r\n var liHeight = li.data('li-height');\r\n var topOffset = selectbox.offset().top;\r\n var bottomOffset = win.height() - selectHeight - (topOffset - win.scrollTop());\r\n var visible = el.data('visible-options');\r\n if (visible === undefined || visible === '') visible = opt.selectVisibleOptions;\r\n var minHeight = liHeight * 5;\r\n var newHeight = liHeight * visible;\r\n if (visible > 0 && visible < 6) minHeight = newHeight;\r\n if (visible === 0) newHeight = 'auto';\r\n\r\n var dropDown = function () {\r\n dropdown.height('auto').css({bottom: 'auto', top: position});\r\n var maxHeightBottom = function () {\r\n ul.css('max-height', Math.floor((bottomOffset - 20 - searchHeight) / liHeight) * liHeight);\r\n };\r\n maxHeightBottom();\r\n ul.css('max-height', newHeight);\r\n if (isMaxHeight != 'none') {\r\n ul.css('max-height', isMaxHeight);\r\n }\r\n if (bottomOffset < (dropdown.outerHeight() + 20)) {\r\n maxHeightBottom();\r\n }\r\n };\r\n\r\n var dropUp = function () {\r\n dropdown.height('auto').css({top: 'auto', bottom: position});\r\n var maxHeightTop = function () {\r\n ul.css('max-height', Math.floor((topOffset - win.scrollTop() - 20 - searchHeight) / liHeight) * liHeight);\r\n };\r\n maxHeightTop();\r\n ul.css('max-height', newHeight);\r\n if (isMaxHeight != 'none') {\r\n ul.css('max-height', isMaxHeight);\r\n }\r\n if ((topOffset - win.scrollTop() - 20) < (dropdown.outerHeight() + 20)) {\r\n maxHeightTop();\r\n }\r\n };\r\n\r\n if (selectSmartPositioning === true || selectSmartPositioning === 1) {\r\n // раскрытие вниз\r\n if (bottomOffset > (minHeight + searchHeight + 20)) {\r\n dropDown();\r\n selectbox.removeClass('dropup').addClass('dropdown');\r\n // раскрытие вверх\r\n } else {\r\n dropUp();\r\n selectbox.removeClass('dropdown').addClass('dropup');\r\n }\r\n } else if (selectSmartPositioning === false || selectSmartPositioning === 0) {\r\n // раскрытие вниз\r\n if (bottomOffset > (minHeight + searchHeight + 20)) {\r\n dropDown();\r\n selectbox.removeClass('dropup').addClass('dropdown');\r\n }\r\n } else {\r\n // если умное позиционирование отключено\r\n dropdown.height('auto').css({bottom: 'auto', top: position});\r\n ul.css('max-height', newHeight);\r\n if (isMaxHeight != 'none') {\r\n ul.css('max-height', isMaxHeight);\r\n }\r\n }\r\n\r\n // если выпадающий список выходит за правый край окна браузера,\r\n // то меняем позиционирование с левого на правое\r\n if (selectbox.offset().left + dropdown.outerWidth() > win.width()) {\r\n dropdown.css({left: 'auto', right: 0});\r\n }\r\n // конец умного позиционирования\r\n\r\n $('div.jqselect').css({zIndex: (selectzIndex - 1)}).removeClass('opened');\r\n selectbox.css({zIndex: selectzIndex});\r\n if (dropdown.is(':hidden')) {\r\n $('div.jq-selectbox__dropdown:visible').hide();\r\n dropdown.show();\r\n selectbox.addClass('opened focused');\r\n // колбек при открытии селекта\r\n opt.onSelectOpened.call(selectbox);\r\n } else {\r\n dropdown.hide();\r\n selectbox.removeClass('opened dropup dropdown');\r\n // колбек при закрытии селекта\r\n if ($('div.jq-selectbox').filter('.opened').length) {\r\n opt.onSelectClosed.call(selectbox);\r\n }\r\n }\r\n\r\n // поисковое поле\r\n if (search.length) {\r\n search.val('').keyup();\r\n notFound.hide();\r\n search.keyup(function () {\r\n var query = $(this).val();\r\n li.each(function () {\r\n if (!$(this).html().match(new RegExp('.*?' + query + '.*?', 'i'))) {\r\n $(this).hide();\r\n } else {\r\n $(this).show();\r\n }\r\n });\r\n // прячем 1-ю пустую опцию\r\n if (option.first().text() === '' && el.data('placeholder') !== '') {\r\n li.first().hide();\r\n }\r\n if (li.filter(':visible').length < 1) {\r\n notFound.show();\r\n } else {\r\n notFound.hide();\r\n }\r\n });\r\n }\r\n\r\n // прокручиваем до выбранного пункта при открытии списка\r\n if (li.filter('.selected').length) {\r\n if (el.val() === '') {\r\n ul.scrollTop(0);\r\n } else {\r\n // если нечетное количество видимых пунктов,\r\n // то высоту пункта делим пополам для последующего расчета\r\n if ((ul.innerHeight() / liHeight) % 2 !== 0) liHeight = liHeight / 2;\r\n ul.scrollTop(ul.scrollTop() + li.filter('.selected').position().top - ul.innerHeight() / 2 + liHeight);\r\n }\r\n }\r\n\r\n preventScrolling(ul);\r\n\r\n }); // end divSelect.click()\r\n\r\n // при наведении курсора на пункт списка\r\n li.hover(function () {\r\n $(this).siblings().removeClass('selected');\r\n });\r\n var selectedText = li.filter('.selected').text();\r\n\r\n // при клике на пункт списка\r\n li.filter(':not(.disabled):not(.optgroup)').click(function () {\r\n el.focus();\r\n var t = $(this);\r\n var liText = t.text();\r\n if (!t.is('.selected')) {\r\n var index = t.index();\r\n index -= t.prevAll('.optgroup').length;\r\n t.addClass('selected sel').siblings().removeClass('selected sel');\r\n option.prop('selected', false).eq(index).prop('selected', true);\r\n selectedText = liText;\r\n divText.text(liText);\r\n\r\n // передаем селекту класс выбранного пункта\r\n if (selectbox.data('jqfs-class')) selectbox.removeClass(selectbox.data('jqfs-class'));\r\n selectbox.data('jqfs-class', t.data('jqfs-class'));\r\n selectbox.addClass(t.data('jqfs-class'));\r\n\r\n el.change();\r\n }\r\n dropdown.hide();\r\n selectbox.removeClass('opened dropup dropdown');\r\n // колбек при закрытии селекта\r\n opt.onSelectClosed.call(selectbox);\r\n\r\n });\r\n dropdown.mouseout(function () {\r\n $('li.sel', dropdown).addClass('selected');\r\n });\r\n\r\n // изменение селекта\r\n el.on('change.styler', function () {\r\n divText.text(option.filter(':selected').text()).removeClass('placeholder');\r\n li.removeClass('selected sel').not('.optgroup').eq(el[0].selectedIndex).addClass('selected sel');\r\n // добавляем класс, показывающий изменение селекта\r\n if (option.first().text() != li.filter('.selected').text()) {\r\n selectbox.addClass('changed');\r\n } else {\r\n selectbox.removeClass('changed');\r\n }\r\n })\r\n .on('focus.styler', function () {\r\n selectbox.addClass('focused');\r\n $('div.jqselect').not('.focused').removeClass('opened dropup dropdown').find('div.jq-selectbox__dropdown').hide();\r\n })\r\n .on('blur.styler', function () {\r\n selectbox.removeClass('focused');\r\n })\r\n // изменение селекта с клавиатуры\r\n .on('keydown.styler keyup.styler', function (e) {\r\n var liHeight = li.data('li-height');\r\n if (el.val() === '') {\r\n divText.text(selectPlaceholder).addClass('placeholder');\r\n } else {\r\n divText.text(option.filter(':selected').text());\r\n }\r\n li.removeClass('selected sel').not('.optgroup').eq(el[0].selectedIndex).addClass('selected sel');\r\n // вверх, влево, Page Up, Home\r\n if (e.which == 38 || e.which == 37 || e.which == 33 || e.which == 36) {\r\n if (el.val() === '') {\r\n ul.scrollTop(0);\r\n } else {\r\n ul.scrollTop(ul.scrollTop() + li.filter('.selected').position().top);\r\n }\r\n }\r\n // вниз, вправо, Page Down, End\r\n if (e.which == 40 || e.which == 39 || e.which == 34 || e.which == 35) {\r\n ul.scrollTop(ul.scrollTop() + li.filter('.selected').position().top - ul.innerHeight() + liHeight);\r\n }\r\n // закрываем выпадающий список при нажатии Enter\r\n if (e.which == 13) {\r\n e.preventDefault();\r\n dropdown.hide();\r\n selectbox.removeClass('opened dropup dropdown');\r\n // колбек при закрытии селекта\r\n opt.onSelectClosed.call(selectbox);\r\n }\r\n }).on('keydown.styler', function (e) {\r\n // открываем выпадающий список при нажатии Space\r\n if (e.which == 32) {\r\n e.preventDefault();\r\n divSelect.click();\r\n }\r\n });\r\n\r\n // прячем выпадающий список при клике за пределами селекта\r\n if (!onDocumentClick.registered) {\r\n $(document).on('click', onDocumentClick);\r\n onDocumentClick.registered = true;\r\n }\r\n\r\n } // end doSelect()\r\n\r\n // мультиселект\r\n function doMultipleSelect() {\r\n\r\n var att = new Attributes();\r\n var selectbox =\r\n $('
    ')\r\n .attr({\r\n id: att.id,\r\n title: att.title\r\n })\r\n .addClass(att.classes)\r\n .data(att.data)\r\n ;\r\n\r\n el.after(selectbox);\r\n\r\n makeList();\r\n selectbox.append('
      ' + list + '
    ');\r\n var ul = $('ul', selectbox);\r\n var li = $('li', selectbox);\r\n var size = el.attr('size');\r\n var ulHeight = ul.outerHeight();\r\n var liHeight = li.outerHeight();\r\n if (size !== undefined && size > 0) {\r\n ul.css({'height': liHeight * size});\r\n } else {\r\n ul.css({'height': liHeight * 4});\r\n }\r\n if (ulHeight > selectbox.height()) {\r\n ul.css('overflowY', 'scroll');\r\n preventScrolling(ul);\r\n // прокручиваем до выбранного пункта\r\n if (li.filter('.selected').length) {\r\n ul.scrollTop(ul.scrollTop() + li.filter('.selected').position().top);\r\n }\r\n }\r\n\r\n // прячем оригинальный селект\r\n el.prependTo(selectbox);\r\n\r\n // если селект неактивный\r\n if (el.is(':disabled')) {\r\n selectbox.addClass('disabled');\r\n option.each(function () {\r\n if ($(this).is(':selected')) li.eq($(this).index()).addClass('selected');\r\n });\r\n\r\n // если селект активный\r\n } else {\r\n\r\n // при клике на пункт списка\r\n li.filter(':not(.disabled):not(.optgroup)').click(function (e) {\r\n el.focus();\r\n var clkd = $(this);\r\n if (!e.ctrlKey && !e.metaKey) clkd.addClass('selected');\r\n if (!e.shiftKey) clkd.addClass('first');\r\n if (!e.ctrlKey && !e.metaKey && !e.shiftKey) clkd.siblings().removeClass('selected first');\r\n\r\n // выделение пунктов при зажатом Ctrl\r\n if (e.ctrlKey || e.metaKey) {\r\n if (clkd.is('.selected')) clkd.removeClass('selected first');\r\n else clkd.addClass('selected first');\r\n clkd.siblings().removeClass('first');\r\n }\r\n\r\n // выделение пунктов при зажатом Shift\r\n if (e.shiftKey) {\r\n var prev = false,\r\n next = false;\r\n clkd.siblings().removeClass('selected').siblings('.first').addClass('selected');\r\n clkd.prevAll().each(function () {\r\n if ($(this).is('.first')) prev = true;\r\n });\r\n clkd.nextAll().each(function () {\r\n if ($(this).is('.first')) next = true;\r\n });\r\n if (prev) {\r\n clkd.prevAll().each(function () {\r\n if ($(this).is('.selected')) return false;\r\n else $(this).not('.disabled, .optgroup').addClass('selected');\r\n });\r\n }\r\n if (next) {\r\n clkd.nextAll().each(function () {\r\n if ($(this).is('.selected')) return false;\r\n else $(this).not('.disabled, .optgroup').addClass('selected');\r\n });\r\n }\r\n if (li.filter('.selected').length == 1) clkd.addClass('first');\r\n }\r\n\r\n // отмечаем выбранные мышью\r\n option.prop('selected', false);\r\n li.filter('.selected').each(function () {\r\n var t = $(this);\r\n var index = t.index();\r\n if (t.is('.option')) index -= t.prevAll('.optgroup').length;\r\n option.eq(index).prop('selected', true);\r\n });\r\n el.change();\r\n\r\n });\r\n\r\n // отмечаем выбранные с клавиатуры\r\n option.each(function (i) {\r\n $(this).data('optionIndex', i);\r\n });\r\n el.on('change.styler', function () {\r\n li.removeClass('selected');\r\n var arrIndexes = [];\r\n option.filter(':selected').each(function () {\r\n arrIndexes.push($(this).data('optionIndex'));\r\n });\r\n li.not('.optgroup').filter(function (i) {\r\n return $.inArray(i, arrIndexes) > -1;\r\n }).addClass('selected');\r\n })\r\n .on('focus.styler', function () {\r\n selectbox.addClass('focused');\r\n })\r\n .on('blur.styler', function () {\r\n selectbox.removeClass('focused');\r\n });\r\n\r\n // прокручиваем с клавиатуры\r\n if (ulHeight > selectbox.height()) {\r\n el.on('keydown.styler', function (e) {\r\n // вверх, влево, PageUp\r\n if (e.which == 38 || e.which == 37 || e.which == 33) {\r\n ul.scrollTop(ul.scrollTop() + li.filter('.selected').position().top - liHeight);\r\n }\r\n // вниз, вправо, PageDown\r\n if (e.which == 40 || e.which == 39 || e.which == 34) {\r\n ul.scrollTop(ul.scrollTop() + li.filter('.selected:last').position().top - ul.innerHeight() + liHeight * 2);\r\n }\r\n });\r\n }\r\n\r\n }\r\n } // end doMultipleSelect()\r\n\r\n if (el.is('[multiple]')) {\r\n\r\n // если Android или iOS, то мультиселект не стилизуем\r\n // причина для Android - в стилизованном селекте нет возможности выбрать несколько пунктов\r\n // причина для iOS - в стилизованном селекте неправильно отображаются выбранные пункты\r\n if (Android || iOS) return;\r\n\r\n doMultipleSelect();\r\n } else {\r\n doSelect();\r\n }\r\n\r\n }; // end selectboxOutput()\r\n\r\n selectboxOutput();\r\n\r\n // обновление при динамическом изменении\r\n el.on('refresh', function () {\r\n el.off('.styler').parent().before(el).remove();\r\n selectboxOutput();\r\n });\r\n\r\n // end select\r\n\r\n // reset\r\n } else if (el.is(':reset')) {\r\n el.on('click', function () {\r\n setTimeout(function () {\r\n el.closest('form').find('input, select').trigger('refresh');\r\n }, 1);\r\n });\r\n } // end reset\r\n\r\n }, // init: function()\r\n\r\n // деструктор\r\n destroy: function () {\r\n\r\n var el = $(this.element);\r\n\r\n if (el.is(':checkbox') || el.is(':radio')) {\r\n el.removeData('_' + pluginName).off('.styler refresh').removeAttr('style').parent().before(el).remove();\r\n el.closest('label').add('label[for=\"' + el.attr('id') + '\"]').off('.styler');\r\n } else if (el.is('input[type=\"number\"]')) {\r\n el.removeData('_' + pluginName).off('.styler refresh').closest('.jq-number').before(el).remove();\r\n } else if (el.is(':file') || el.is('select')) {\r\n el.removeData('_' + pluginName).off('.styler refresh').removeAttr('style').parent().before(el).remove();\r\n }\r\n\r\n } // destroy: function()\r\n\r\n }; // Plugin.prototype\r\n\r\n $.fn[pluginName] = function (options) {\r\n var args = arguments;\r\n if (options === undefined || typeof options === 'object') {\r\n this.each(function () {\r\n if (!$.data(this, '_' + pluginName)) {\r\n $.data(this, '_' + pluginName, new Plugin(this, options));\r\n }\r\n })\r\n // колбек после выполнения плагина\r\n .promise()\r\n .done(function () {\r\n var opt = $(this[0]).data('_' + pluginName);\r\n if (opt) opt.options.onFormStyled.call();\r\n });\r\n return this;\r\n } else if (typeof options === 'string' && options[0] !== '_' && options !== 'init') {\r\n var returns;\r\n this.each(function () {\r\n var instance = $.data(this, '_' + pluginName);\r\n if (instance instanceof Plugin && typeof instance[options] === 'function') {\r\n returns = instance[options].apply(instance, Array.prototype.slice.call(args, 1));\r\n }\r\n });\r\n return returns !== undefined ? returns : this;\r\n }\r\n };\r\n\r\n // прячем выпадающий список при клике за пределами селекта\r\n function onDocumentClick(e) {\r\n // e.target.nodeName != 'OPTION' - добавлено для обхода бага в Opera на движке Presto\r\n // (при изменении селекта с клавиатуры срабатывает событие onclick)\r\n if (!$(e.target).parents().hasClass('jq-selectbox') && e.target.nodeName != 'OPTION') {\r\n if ($('div.jq-selectbox.opened').length) {\r\n var selectbox = $('div.jq-selectbox.opened'),\r\n search = $('div.jq-selectbox__search input', selectbox),\r\n dropdown = $('div.jq-selectbox__dropdown', selectbox),\r\n opt = selectbox.find('select').data('_' + pluginName).options;\r\n\r\n // колбек при закрытии селекта\r\n opt.onSelectClosed.call(selectbox);\r\n\r\n if (search.length) search.val('').keyup();\r\n dropdown.hide().find('li.sel').addClass('selected');\r\n selectbox.removeClass('focused opened dropup dropdown');\r\n }\r\n }\r\n }\r\n\r\n onDocumentClick.registered = false;\r\n\r\n}));\r\n\n\n\n// WEBPACK FOOTER //\n// ./src/static/scripts/plugins/jquery.formstyler.js","/*\r\n *\tjQuery dotdotdot 3.0.3\r\n *\t@requires jQuery 1.7.0 or later\r\n *\r\n *\tdotdotdot.frebsite.nl\r\n *\r\n *\tCopyright (c) Fred Heusschen\r\n *\twww.frebsite.nl\r\n *\r\n *\tLicense: CC-BY-NC-4.0\r\n *\thttp://creativecommons.org/licenses/by-nc/4.0/\r\n */\r\n\r\n(function ($) {\r\n 'use strict';\r\n\r\n var _PLUGIN_ = 'dotdotdot';\r\n var _VERSION_ = '3.0.3';\r\n\r\n if ($[_PLUGIN_] && $[_PLUGIN_].version > _VERSION_) {\r\n return;\r\n }\r\n\r\n\r\n /*\r\n The class\r\n */\r\n $[_PLUGIN_] = function ($container, opts) {\r\n this.$dot = $container;\r\n this.api = ['getInstance', 'truncate', 'restore', 'destroy', 'watch', 'unwatch'];\r\n this.opts = opts;\r\n\r\n var oldAPI = this.$dot.data(_PLUGIN_);\r\n if (oldAPI) {\r\n oldAPI.destroy();\r\n }\r\n\r\n this.init();\r\n this.truncate();\r\n\r\n if (this.opts.watch) {\r\n this.watch();\r\n }\r\n\r\n return this;\r\n };\r\n\r\n $[_PLUGIN_].version = _VERSION_;\r\n $[_PLUGIN_].uniqueId = 0;\r\n\r\n $[_PLUGIN_].defaults = {\r\n ellipsis: '\\u2026 ',\r\n truncate: 'word',\r\n tolerance: 0,\r\n keep: null,\r\n watch: 'window'\r\n };\r\n\r\n\r\n $[_PLUGIN_].prototype = {\r\n\r\n init: function () {\r\n this.watchTimeout = null;\r\n this.watchInterval = null;\r\n this.uniqueId = $[_PLUGIN_].uniqueId++;\r\n this.originalContent = this.$dot.contents();\r\n this.originalStyle = this.$dot.attr('style') || '';\r\n this.maxHeight = this._getMaxHeight() + this.opts.tolerance;\r\n\r\n if (this.$dot.css('word-wrap') !== 'break-word') {\r\n this.$dot.css('word-wrap', 'break-word');\r\n }\r\n if (this.$dot.css('white-space') === 'nowrap') {\r\n this.$dot.css('white-space', 'normal');\r\n }\r\n },\r\n\r\n getInstance: function () {\r\n return this;\r\n },\r\n\r\n truncate: function () {\r\n var that = this;\r\n\r\n\r\n //\tAdd inner node for measuring the height\r\n this.$inner = this.$dot\r\n .wrapInner('
    ')\r\n .children()\r\n .css({\r\n 'display': 'block',\r\n 'height': 'auto',\r\n 'width': 'auto',\r\n 'border': 'none',\r\n 'padding': 0,\r\n 'margin': 0\r\n });\r\n\r\n\r\n //\tSet original content\r\n this.$inner\r\n .contents()\r\n .detach()\r\n .end()\r\n .append(this.originalContent.clone(true));\r\n\r\n\r\n //\tAdd \"keep\" class to nodes to keep\r\n this.$inner\r\n .find('script, style')\r\n .addClass(_c.keep);\r\n\r\n if (this.opts.keep) {\r\n this.$inner\r\n .find(this.opts.keep)\r\n .addClass(_c.keep);\r\n }\r\n\r\n\r\n //\tFilter contents\r\n this.$inner\r\n .find('*')\r\n .add(this.$inner)\r\n .not('.' + _c.keep)\r\n .contents()\r\n .each(\r\n function () {\r\n var e = this,\r\n $e = $(this);\r\n\r\n if (e.nodeType == 3) {\r\n\r\n //\tRemove whitespace where it does not take up space in the DOM\r\n if ($e.prev().is('table, thead, tfoot, tr, th, td, dl, dt, dd, ul, ol, li, video')) {\r\n $e.remove();\r\n return;\r\n }\r\n\r\n //\tWrap text in a node (during truncation)\r\n if ($e.parent().contents().length > 1) {\r\n var $d = $('' + that.__getTextContent(e) + '')\r\n .css({\r\n 'display': 'inline',\r\n 'height': 'auto',\r\n 'width': 'auto',\r\n 'border': 'none',\r\n 'padding': 0,\r\n 'margin': 0\r\n });\r\n\r\n $e.replaceWith($d);\r\n }\r\n }\r\n\r\n //\tRemove comments\r\n else if (e.nodeType == 8) {\r\n $e.remove();\r\n }\r\n\r\n }\r\n );\r\n\r\n\r\n //\tTruncate the text\r\n var isTruncated = this._truncateNode(this.$inner);\r\n this.$dot[isTruncated ? 'addClass' : 'removeClass'](_c.truncated);\r\n\r\n\r\n //\tUnwrap text from the temporarely node\r\n this.$inner\r\n .find('*')\r\n .add(this.$inner)\r\n .filter('.' + _c.text)\r\n .each(\r\n function () {\r\n $(this).replaceWith($(this).contents());\r\n }\r\n );\r\n\r\n\r\n //\tRemove \"keep\" class\r\n this.$inner\r\n .find('*')\r\n .add(this.$inner)\r\n .filter('.' + _c.keep)\r\n .removeClass(_c.keep);\r\n\r\n\r\n //\tRemove inner node\r\n this.$inner.replaceWith(this.$inner.contents());\r\n this.$inner = null;\r\n\r\n\r\n return isTruncated;\r\n },\r\n\r\n restore: function () {\r\n this.unwatch();\r\n\r\n this.$dot\r\n .contents()\r\n .detach()\r\n .end()\r\n .append(this.originalContent)\r\n .attr('style', this.originalStyle)\r\n .removeClass(_c.truncated);\r\n },\r\n\r\n destroy: function () {\r\n this.restore();\r\n this.$dot.data(_PLUGIN_, null);\r\n },\r\n\r\n watch: function () {\r\n var that = this;\r\n\r\n this.unwatch();\r\n\r\n var oldSizes = {};\r\n\r\n if (this.opts.watch == 'window') {\r\n $wndw.on(\r\n _e.resize + that.uniqueId,\r\n function (e) {\r\n if (that.watchTimeout) {\r\n clearTimeout(that.watchTimeout);\r\n }\r\n that.watchTimeout = setTimeout(\r\n function () {\r\n\r\n oldSizes = that._watchSizes(oldSizes, $wndw, 'width', 'height');\r\n\r\n }, 100\r\n );\r\n }\r\n );\r\n\r\n }\r\n else {\r\n this.watchInterval = setInterval(\r\n function () {\r\n oldSizes = that._watchSizes(oldSizes, that.$dot, 'innerWidth', 'innerHeight');\r\n\r\n }, 500\r\n );\r\n }\r\n },\r\n\r\n unwatch: function () {\r\n $wndw.off(_e.resize + this.uniqueId);\r\n\r\n if (this.watchInterval) {\r\n clearInterval(this.watchInterval);\r\n }\r\n\r\n if (this.watchTimeout) {\r\n clearTimeout(this.watchTimeout);\r\n }\r\n },\r\n\r\n _api: function () {\r\n var that = this,\r\n api = {};\r\n\r\n $.each(this.api,\r\n function (i) {\r\n var fn = this;\r\n api[fn] = function () {\r\n var re = that[fn].apply(that, arguments);\r\n return ( typeof re == 'undefined' ) ? api : re;\r\n };\r\n }\r\n );\r\n return api;\r\n },\r\n\r\n _truncateNode: function ($elem) {\r\n var that = this;\r\n var isTruncated = false;\r\n var forceEllipsis = false;\r\n\r\n $($elem\r\n .children()\r\n .get()\r\n .reverse()\r\n )\r\n .not('.' + _c.keep)\r\n .each(\r\n function () {\r\n var e = $(this).contents()[0],\r\n $e = $(this);\r\n\r\n if (isTruncated) {\r\n return;\r\n }\r\n if ($e.hasClass(_c.keep)) {\r\n return;\r\n }\r\n\r\n if ($e.children().length) {\r\n isTruncated = that._truncateNode($e);\r\n }\r\n else {\r\n if (!that._fits() || forceEllipsis) {\r\n var $x = $('').css('display', 'none');\r\n $e.replaceWith($x);\r\n $e.detach();\r\n\r\n if (that._fits()) {\r\n if (that.opts.truncate == 'node') {\r\n return true;\r\n }\r\n\r\n $x.replaceWith($e);\r\n isTruncated = that._truncateWord($e);\r\n\r\n if (!isTruncated) {\r\n forceEllipsis = true;\r\n $e.detach();\r\n }\r\n }\r\n else {\r\n $x.remove();\r\n }\r\n }\r\n }\r\n\r\n //\tRemove empty nodes\r\n if (!$e.contents().length) {\r\n $e.remove();\r\n }\r\n }\r\n );\r\n\r\n return isTruncated;\r\n },\r\n\r\n _truncateWord: function ($e) {\r\n var e = $e.contents()[0];\r\n\r\n if (!e) {\r\n return false;\r\n }\r\n\r\n var that = this;\r\n\r\n var txt = this.__getTextContent(e),\r\n sep = ( txt.indexOf(' ') !== -1 ) ? ' ' : '\\u3000',\r\n arr = txt.split(sep),\r\n str = '';\r\n\r\n for (var a = arr.length; a >= 0; a--) {\r\n str = arr.slice(0, a).join(sep);\r\n\r\n //\tIf even the first child didn't make it\r\n if (a == 0) {\r\n if (that.opts.truncate == 'letter') {\r\n that.__setTextContent(e, arr.slice(0, a + 1).join(sep));\r\n return that._truncateLetter(e);\r\n }\r\n return false;\r\n }\r\n\r\n if (!str.length) {\r\n continue;\r\n }\r\n\r\n that.__setTextContent(e, that._addEllipsis(str));\r\n\r\n if (that._fits()) {\r\n if (that.opts.truncate == 'letter') {\r\n that.__setTextContent(e, arr.slice(0, a + 1).join(sep));\r\n return that._truncateLetter(e);\r\n }\r\n return true;\r\n }\r\n }\r\n\r\n return false;\r\n },\r\n\r\n _truncateLetter: function (e) {\r\n var that = this;\r\n\r\n var txt = this.__getTextContent(e),\r\n arr = txt.split(''),\r\n str = '';\r\n\r\n for (var a = arr.length; a >= 0; a--) {\r\n str = arr.slice(0, a).join('');\r\n\r\n if (!str.length) {\r\n continue;\r\n }\r\n\r\n that.__setTextContent(e, that._addEllipsis(str));\r\n\r\n if (that._fits()) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n },\r\n\r\n _fits: function () {\r\n return ( this.$inner.innerHeight() <= this.maxHeight );\r\n },\r\n\r\n _addEllipsis: function (txt) {\r\n var remove = [' ', '\\u3000', ',', ';', '.', '!', '?'];\r\n\r\n while ($.inArray(txt.slice(-1), remove) > -1) {\r\n txt = txt.slice(0, -1);\r\n }\r\n txt += this.opts.ellipsis;\r\n\r\n return txt;\r\n },\r\n\r\n _getMaxHeight: function () {\r\n //\tFind smallest CSS height\r\n var arr = ['height', 'maxHeight'],\r\n hgh = 0;\r\n\r\n for (var a = 0; a < arr.length; a++) {\r\n var h = window.getComputedStyle(this.$dot[0])[arr[a]];\r\n if (h.slice(-2) == 'px') {\r\n h = parseInt(h, 10);\r\n hgh = hgh ? Math.min(hgh, h) : h;\r\n }\r\n }\r\n\r\n //\tRemove padding-top/bottom when needed.\r\n switch (this.$dot.css('boxSizing')) {\r\n case 'padding-box':\r\n case 'border-box':\r\n var arr = ['paddingTop', 'paddingBottom'];\r\n\r\n for (var a = 0; a < arr.length; a++) {\r\n var p = window.getComputedStyle(this.$dot[0])[arr[a]];\r\n if (p.slice(-2) == 'px') {\r\n hgh -= parseInt(p, 10);\r\n }\r\n }\r\n break;\r\n }\r\n\r\n //\tSanitize\r\n return Math.max(hgh, 0);\r\n },\r\n\r\n _watchSizes: function (oldSizes, $elem, width, height) {\r\n if (this.$dot.is(':visible')) {\r\n var newSizes = {\r\n 'width': $elem[width](),\r\n 'height': $elem[height]()\r\n };\r\n\r\n if (oldSizes.width != newSizes.width || oldSizes.height != newSizes.height) {\r\n this.truncate();\r\n }\r\n\r\n return newSizes;\r\n }\r\n },\r\n\r\n __getTextContent: function (elem) {\r\n var arr = ['nodeValue', 'textContent', 'innerText'];\r\n for (var a = 0; a < arr.length; a++) {\r\n if (typeof elem[arr[a]] == 'string') {\r\n return elem[arr[a]];\r\n }\r\n }\r\n return '';\r\n },\r\n __setTextContent: function (elem, content) {\r\n var arr = ['nodeValue', 'textContent', 'innerText'];\r\n for (var a = 0; a < arr.length; a++) {\r\n elem[arr[a]] = content;\r\n }\r\n }\r\n };\r\n\r\n\r\n /*\r\n The jQuery plugin\r\n */\r\n $.fn[_PLUGIN_] = function (opts) {\r\n initPlugin();\r\n\r\n opts = $.extend(true, {}, $[_PLUGIN_].defaults, opts);\r\n\r\n return this.each(\r\n function () {\r\n $(this).data(_PLUGIN_, new $[_PLUGIN_]($(this), opts)._api());\r\n }\r\n );\r\n };\r\n\r\n\r\n /*\r\n Global variables\r\n */\r\n var _c, _d, _e, $wndw;\r\n\r\n function initPlugin() {\r\n $wndw = $(window);\r\n\r\n //\tClassnames, Datanames, Eventnames\r\n _c = {};\r\n _d = {};\r\n _e = {};\r\n\r\n $.each([_c, _d, _e],\r\n function (i, o) {\r\n o.add = function (a) {\r\n a = a.split(' ');\r\n for (var b = 0, l = a.length; b < l; b++) {\r\n o[a[b]] = o.ddd(a[b]);\r\n }\r\n };\r\n }\r\n );\r\n\r\n //\tClassnames\r\n _c.ddd = function (c) {\r\n return 'ddd-' + c;\r\n };\r\n _c.add('truncated keep text');\r\n\r\n //\tDatanames\r\n _d.ddd = function (d) {\r\n return 'ddd-' + d;\r\n };\r\n _d.add('text');\r\n\r\n //\tEventnames\r\n _e.ddd = function (e) {\r\n return e + '.ddd';\r\n };\r\n _e.add('resize');\r\n\r\n\r\n //\tOnly once\r\n initPlugin = function () {\r\n };\r\n\r\n }\r\n\r\n\r\n})(jQuery);\r\n\n\n\n// WEBPACK FOOTER //\n// ./src/static/scripts/plugins/jquery.dotdotdot.js","// Sticky Plugin v1.0.4 for jQuery\r\n// =============\r\n// Author: Anthony Garand\r\n// Improvements by German M. Bravo (Kronuz) and Ruud Kamphuis (ruudk)\r\n// Improvements by Leonardo C. Daronco (daronco)\r\n// Created: 02/14/2011\r\n// Date: 07/20/2015\r\n// Website: http://stickyjs.com/\r\n// Description: Makes an element on the page stick on the screen as you scroll\r\n// It will only set the 'top' and 'position' of your element, you\r\n// might need to adjust the width in some cases.\r\n\r\n(function (factory) {\r\n if (typeof define === 'function' && define.amd) {\r\n // AMD. Register as an anonymous module.\r\n define(['jquery'], factory);\r\n } else if (typeof module === 'object' && module.exports) {\r\n // Node/CommonJS\r\n module.exports = factory(require('jquery'));\r\n } else {\r\n // Browser globals\r\n factory(jQuery);\r\n }\r\n}(function ($) {\r\n var slice = Array.prototype.slice; // save ref to original slice()\r\n var splice = Array.prototype.splice; // save ref to original slice()\r\n\r\n var defaults = {\r\n topSpacing: 0,\r\n bottomSpacing: 0,\r\n className: 'is-sticky',\r\n wrapperClassName: 'sticky-wrapper',\r\n center: false,\r\n getWidthFrom: '',\r\n widthFromWrapper: true, // works only when .getWidthFrom is empty\r\n responsiveWidth: false,\r\n zIndex: 'inherit'\r\n },\r\n $window = $(window),\r\n $document = $(document),\r\n sticked = [],\r\n windowHeight = $window.height(),\r\n scroller = function() {\r\n var scrollTop = $window.scrollTop(),\r\n documentHeight = $document.height(),\r\n dwh = documentHeight - windowHeight,\r\n extra = (scrollTop > dwh) ? dwh - scrollTop : 0;\r\n\r\n for (var i = 0, l = sticked.length; i < l; i++) {\r\n var s = sticked[i],\r\n elementTop = s.stickyWrapper.offset().top,\r\n etse = elementTop - s.topSpacing - extra;\r\n\r\n //update height in case of dynamic content\r\n s.stickyWrapper.css('height', s.stickyElement.outerHeight());\r\n\r\n if (scrollTop <= etse) {\r\n if (s.currentTop !== null) {\r\n s.stickyElement\r\n .css({\r\n 'width': '',\r\n 'position': '',\r\n 'top': '',\r\n 'z-index': ''\r\n });\r\n s.stickyElement.parent().removeClass(s.className);\r\n s.stickyElement.trigger('sticky-end', [s]);\r\n s.currentTop = null;\r\n }\r\n }\r\n else {\r\n var newTop = documentHeight - s.stickyElement.outerHeight()\r\n - s.topSpacing - s.bottomSpacing - scrollTop - extra;\r\n if (newTop < 0) {\r\n newTop = newTop + s.topSpacing;\r\n } else {\r\n newTop = s.topSpacing;\r\n }\r\n if (s.currentTop !== newTop) {\r\n var newWidth;\r\n if (s.getWidthFrom) {\r\n padding = s.stickyElement.innerWidth() - s.stickyElement.width();\r\n newWidth = $(s.getWidthFrom).width() - padding || null;\r\n } else if (s.widthFromWrapper) {\r\n newWidth = s.stickyWrapper.width();\r\n }\r\n if (newWidth == null) {\r\n newWidth = s.stickyElement.width();\r\n }\r\n s.stickyElement\r\n .css('width', newWidth)\r\n .css('position', 'fixed')\r\n .css('top', newTop)\r\n .css('z-index', s.zIndex);\r\n\r\n s.stickyElement.parent().addClass(s.className);\r\n\r\n if (s.currentTop === null) {\r\n s.stickyElement.trigger('sticky-start', [s]);\r\n } else {\r\n // sticky is started but it have to be repositioned\r\n s.stickyElement.trigger('sticky-update', [s]);\r\n }\r\n\r\n if (s.currentTop === s.topSpacing && s.currentTop > newTop || s.currentTop === null && newTop < s.topSpacing) {\r\n // just reached bottom || just started to stick but bottom is already reached\r\n s.stickyElement.trigger('sticky-bottom-reached', [s]);\r\n } else if(s.currentTop !== null && newTop === s.topSpacing && s.currentTop < newTop) {\r\n // sticky is started && sticked at topSpacing && overflowing from top just finished\r\n s.stickyElement.trigger('sticky-bottom-unreached', [s]);\r\n }\r\n\r\n s.currentTop = newTop;\r\n }\r\n\r\n // Check if sticky has reached end of container and stop sticking\r\n var stickyWrapperContainer = s.stickyWrapper.parent();\r\n var unstick = (s.stickyElement.offset().top + s.stickyElement.outerHeight() >= stickyWrapperContainer.offset().top + stickyWrapperContainer.outerHeight()) && (s.stickyElement.offset().top <= s.topSpacing);\r\n\r\n if( unstick ) {\r\n s.stickyElement\r\n .css('position', 'absolute')\r\n .css('top', '')\r\n .css('bottom', 0)\r\n .css('z-index', '');\r\n } else {\r\n s.stickyElement\r\n .css('position', 'fixed')\r\n .css('top', newTop)\r\n .css('bottom', '')\r\n .css('z-index', s.zIndex);\r\n }\r\n }\r\n }\r\n },\r\n resizer = function() {\r\n windowHeight = $window.height();\r\n\r\n for (var i = 0, l = sticked.length; i < l; i++) {\r\n var s = sticked[i];\r\n var newWidth = null;\r\n if (s.getWidthFrom) {\r\n if (s.responsiveWidth) {\r\n newWidth = $(s.getWidthFrom).width();\r\n }\r\n } else if(s.widthFromWrapper) {\r\n newWidth = s.stickyWrapper.width();\r\n }\r\n if (newWidth != null) {\r\n s.stickyElement.css('width', newWidth);\r\n }\r\n }\r\n },\r\n methods = {\r\n init: function(options) {\r\n return this.each(function() {\r\n var o = $.extend({}, defaults, options);\r\n var stickyElement = $(this);\r\n\r\n var stickyId = stickyElement.attr('id');\r\n var wrapperId = stickyId ? stickyId + '-' + defaults.wrapperClassName : defaults.wrapperClassName;\r\n var wrapper = $('
    ')\r\n .attr('id', wrapperId)\r\n .addClass(o.wrapperClassName);\r\n\r\n stickyElement.wrapAll(function() {\r\n if ($(this).parent(\"#\" + wrapperId).length == 0) {\r\n return wrapper;\r\n }\r\n});\r\n\r\n var stickyWrapper = stickyElement.parent();\r\n\r\n if (o.center) {\r\n stickyWrapper.css({width:stickyElement.outerWidth(),marginLeft:\"auto\",marginRight:\"auto\"});\r\n }\r\n\r\n if (stickyElement.css(\"float\") === \"right\") {\r\n stickyElement.css({\"float\":\"none\"}).parent().css({\"float\":\"right\"});\r\n }\r\n\r\n o.stickyElement = stickyElement;\r\n o.stickyWrapper = stickyWrapper;\r\n o.currentTop = null;\r\n\r\n sticked.push(o);\r\n\r\n methods.setWrapperHeight(this);\r\n methods.setupChangeListeners(this);\r\n });\r\n },\r\n\r\n setWrapperHeight: function(stickyElement) {\r\n var element = $(stickyElement);\r\n var stickyWrapper = element.parent();\r\n if (stickyWrapper) {\r\n stickyWrapper.css('height', element.outerHeight());\r\n }\r\n },\r\n\r\n setupChangeListeners: function(stickyElement) {\r\n if (window.MutationObserver) {\r\n var mutationObserver = new window.MutationObserver(function(mutations) {\r\n if (mutations[0].addedNodes.length || mutations[0].removedNodes.length) {\r\n methods.setWrapperHeight(stickyElement);\r\n }\r\n });\r\n mutationObserver.observe(stickyElement, {subtree: true, childList: true});\r\n } else {\r\n if (window.addEventListener) {\r\n stickyElement.addEventListener('DOMNodeInserted', function() {\r\n methods.setWrapperHeight(stickyElement);\r\n }, false);\r\n stickyElement.addEventListener('DOMNodeRemoved', function() {\r\n methods.setWrapperHeight(stickyElement);\r\n }, false);\r\n } else if (window.attachEvent) {\r\n stickyElement.attachEvent('onDOMNodeInserted', function() {\r\n methods.setWrapperHeight(stickyElement);\r\n });\r\n stickyElement.attachEvent('onDOMNodeRemoved', function() {\r\n methods.setWrapperHeight(stickyElement);\r\n });\r\n }\r\n }\r\n },\r\n update: scroller,\r\n unstick: function(options) {\r\n return this.each(function() {\r\n var that = this;\r\n var unstickyElement = $(that);\r\n\r\n var removeIdx = -1;\r\n var i = sticked.length;\r\n while (i-- > 0) {\r\n if (sticked[i].stickyElement.get(0) === that) {\r\n splice.call(sticked,i,1);\r\n removeIdx = i;\r\n }\r\n }\r\n if(removeIdx !== -1) {\r\n unstickyElement.unwrap();\r\n unstickyElement\r\n .css({\r\n 'width': '',\r\n 'position': '',\r\n 'top': '',\r\n 'float': '',\r\n 'z-index': ''\r\n })\r\n ;\r\n }\r\n });\r\n }\r\n };\r\n\r\n // should be more efficient than using $window.scroll(scroller) and $window.resize(resizer):\r\n if (window.addEventListener) {\r\n window.addEventListener('scroll', scroller, false);\r\n window.addEventListener('resize', resizer, false);\r\n } else if (window.attachEvent) {\r\n window.attachEvent('onscroll', scroller);\r\n window.attachEvent('onresize', resizer);\r\n }\r\n\r\n $.fn.sticky = function(method) {\r\n if (methods[method]) {\r\n return methods[method].apply(this, slice.call(arguments, 1));\r\n } else if (typeof method === 'object' || !method ) {\r\n return methods.init.apply( this, arguments );\r\n } else {\r\n $.error('Method ' + method + ' does not exist on jQuery.sticky');\r\n }\r\n };\r\n\r\n $.fn.unstick = function(method) {\r\n if (methods[method]) {\r\n return methods[method].apply(this, slice.call(arguments, 1));\r\n } else if (typeof method === 'object' || !method ) {\r\n return methods.unstick.apply( this, arguments );\r\n } else {\r\n $.error('Method ' + method + ' does not exist on jQuery.sticky');\r\n }\r\n };\r\n $(function() {\r\n setTimeout(scroller, 0);\r\n });\r\n}));\r\n\n\n\n// WEBPACK FOOTER //\n// ./src/static/scripts/plugins/jquery.sticky.js","/**\r\n * tooltipster http://iamceege.github.io/tooltipster/\r\n * A rockin' custom tooltip jQuery plugin\r\n * Developed by Caleb Jacob and Louis Ameline\r\n * MIT license\r\n */\r\n(function (root, factory) {\r\n if (typeof define === 'function' && define.amd) {\r\n // AMD. Register as an anonymous module unless amdModuleId is set\r\n define([\"jquery\"], function (a0) {\r\n return (factory(a0));\r\n });\r\n } else if (typeof exports === 'object') {\r\n // Node. Does not work with strict CommonJS, but\r\n // only CommonJS-like environments that support module.exports,\r\n // like Node.\r\n module.exports = factory(require(\"jquery\"));\r\n } else {\r\n factory(jQuery);\r\n }\r\n}(this, function ($) {\r\n\r\n// This file will be UMDified by a build task.\r\n\r\n var defaults = {\r\n animation: 'fade',\r\n animationDuration: 350,\r\n content: null,\r\n contentAsHTML: false,\r\n contentCloning: false,\r\n debug: true,\r\n delay: 300,\r\n delayTouch: [300, 500],\r\n functionInit: null,\r\n functionBefore: null,\r\n functionReady: null,\r\n functionAfter: null,\r\n functionFormat: null,\r\n IEmin: 6,\r\n interactive: false,\r\n multiple: false,\r\n // will default to document.body, or must be an element positioned at (0, 0)\r\n // in the document, typically like the very top views of an app.\r\n parent: null,\r\n plugins: ['sideTip'],\r\n repositionOnScroll: false,\r\n restoration: 'none',\r\n selfDestruction: true,\r\n theme: [],\r\n timer: 0,\r\n trackerInterval: 500,\r\n trackOrigin: false,\r\n trackTooltip: false,\r\n trigger: 'hover',\r\n triggerClose: {\r\n click: false,\r\n mouseleave: false,\r\n originClick: false,\r\n scroll: false,\r\n tap: false,\r\n touchleave: false\r\n },\r\n triggerOpen: {\r\n click: false,\r\n mouseenter: false,\r\n tap: false,\r\n touchstart: false\r\n },\r\n updateAnimation: 'rotate',\r\n zIndex: 9999999\r\n },\r\n // we'll avoid using the 'window' global as a good practice but npm's\r\n // jquery@<2.1.0 package actually requires a 'window' global, so not sure\r\n // it's useful at all\r\n win = (typeof window != 'undefined') ? window : null,\r\n // env will be proxied by the core for plugins to have access its properties\r\n env = {\r\n // detect if this device can trigger touch events. Better have a false\r\n // positive (unused listeners, that's ok) than a false negative.\r\n // https://github.com/Modernizr/Modernizr/blob/master/feature-detects/touchevents.js\r\n // http://stackoverflow.com/questions/4817029/whats-the-best-way-to-detect-a-touch-screen-device-using-javascript\r\n hasTouchCapability: !!(\r\n win\r\n && ( 'ontouchstart' in win\r\n || (win.DocumentTouch && win.document instanceof win.DocumentTouch)\r\n || win.navigator.maxTouchPoints\r\n )\r\n ),\r\n hasTransitions: transitionSupport(),\r\n IE: false,\r\n // don't set manually, it will be updated by a build task after the manifest\r\n semVer: '4.2.6',\r\n window: win\r\n },\r\n core = function () {\r\n\r\n // core variables\r\n\r\n // the core emitters\r\n this.__$emitterPrivate = $({});\r\n this.__$emitterPublic = $({});\r\n this.__instancesLatestArr = [];\r\n // collects plugin constructors\r\n this.__plugins = {};\r\n // proxy env variables for plugins who might use them\r\n this._env = env;\r\n };\r\n\r\n// core methods\r\n core.prototype = {\r\n\r\n /**\r\n * A function to proxy the public methods of an object onto another\r\n *\r\n * @param {object} constructor The constructor to bridge\r\n * @param {object} obj The object that will get new methods (an instance or the core)\r\n * @param {string} pluginName A plugin name for the console log message\r\n * @return {core}\r\n * @private\r\n */\r\n __bridge: function (constructor, obj, pluginName) {\r\n\r\n // if it's not already bridged\r\n if (!obj[pluginName]) {\r\n\r\n var fn = function () {\r\n };\r\n fn.prototype = constructor;\r\n\r\n var pluginInstance = new fn();\r\n\r\n // the _init method has to exist in instance constructors but might be missing\r\n // in core constructors\r\n if (pluginInstance.__init) {\r\n pluginInstance.__init(obj);\r\n }\r\n\r\n $.each(constructor, function (methodName, fn) {\r\n\r\n // don't proxy \"private\" methods, only \"protected\" and public ones\r\n if (methodName.indexOf('__') != 0) {\r\n\r\n // if the method does not exist yet\r\n if (!obj[methodName]) {\r\n\r\n obj[methodName] = function () {\r\n return pluginInstance[methodName].apply(pluginInstance, Array.prototype.slice.apply(arguments));\r\n };\r\n\r\n // remember to which plugin this method corresponds (several plugins may\r\n // have methods of the same name, we need to be sure)\r\n obj[methodName].bridged = pluginInstance;\r\n }\r\n else if (defaults.debug) {\r\n\r\n console.log('The ' + methodName + ' method of the ' + pluginName\r\n + ' plugin conflicts with another plugin or native methods');\r\n }\r\n }\r\n });\r\n\r\n obj[pluginName] = pluginInstance;\r\n }\r\n\r\n return this;\r\n },\r\n\r\n /**\r\n * For mockup in Node env if need be, for testing purposes\r\n *\r\n * @return {core}\r\n * @private\r\n */\r\n __setWindow: function (window) {\r\n env.window = window;\r\n return this;\r\n },\r\n\r\n /**\r\n * Returns a ruler, a tool to help measure the size of a tooltip under\r\n * various settings. Meant for plugins\r\n *\r\n * @see Ruler\r\n * @return {object} A Ruler instance\r\n * @protected\r\n */\r\n _getRuler: function ($tooltip) {\r\n return new Ruler($tooltip);\r\n },\r\n\r\n /**\r\n * For internal use by plugins, if needed\r\n *\r\n * @return {core}\r\n * @protected\r\n */\r\n _off: function () {\r\n this.__$emitterPrivate.off.apply(this.__$emitterPrivate, Array.prototype.slice.apply(arguments));\r\n return this;\r\n },\r\n\r\n /**\r\n * For internal use by plugins, if needed\r\n *\r\n * @return {core}\r\n * @protected\r\n */\r\n _on: function () {\r\n this.__$emitterPrivate.on.apply(this.__$emitterPrivate, Array.prototype.slice.apply(arguments));\r\n return this;\r\n },\r\n\r\n /**\r\n * For internal use by plugins, if needed\r\n *\r\n * @return {core}\r\n * @protected\r\n */\r\n _one: function () {\r\n this.__$emitterPrivate.one.apply(this.__$emitterPrivate, Array.prototype.slice.apply(arguments));\r\n return this;\r\n },\r\n\r\n /**\r\n * Returns (getter) or adds (setter) a plugin\r\n *\r\n * @param {string|object} plugin Provide a string (in the full form\r\n * \"namespace.name\") to use as as getter, an object to use as a setter\r\n * @return {object|core}\r\n * @protected\r\n */\r\n _plugin: function (plugin) {\r\n\r\n var self = this;\r\n\r\n // getter\r\n if (typeof plugin == 'string') {\r\n\r\n var pluginName = plugin,\r\n p = null;\r\n\r\n // if the namespace is provided, it's easy to search\r\n if (pluginName.indexOf('.') > 0) {\r\n p = self.__plugins[pluginName];\r\n }\r\n // otherwise, return the first name that matches\r\n else {\r\n $.each(self.__plugins, function (i, plugin) {\r\n\r\n if (plugin.name.substring(plugin.name.length - pluginName.length - 1) == '.' + pluginName) {\r\n p = plugin;\r\n return false;\r\n }\r\n });\r\n }\r\n\r\n return p;\r\n }\r\n // setter\r\n else {\r\n\r\n // force namespaces\r\n if (plugin.name.indexOf('.') < 0) {\r\n throw new Error('Plugins must be namespaced');\r\n }\r\n\r\n self.__plugins[plugin.name] = plugin;\r\n\r\n // if the plugin has core features\r\n if (plugin.core) {\r\n\r\n // bridge non-private methods onto the core to allow new core methods\r\n self.__bridge(plugin.core, self, plugin.name);\r\n }\r\n\r\n return this;\r\n }\r\n },\r\n\r\n /**\r\n * Trigger events on the core emitters\r\n *\r\n * @returns {core}\r\n * @protected\r\n */\r\n _trigger: function () {\r\n\r\n var args = Array.prototype.slice.apply(arguments);\r\n\r\n if (typeof args[0] == 'string') {\r\n args[0] = {type: args[0]};\r\n }\r\n\r\n // note: the order of emitters matters\r\n this.__$emitterPrivate.trigger.apply(this.__$emitterPrivate, args);\r\n this.__$emitterPublic.trigger.apply(this.__$emitterPublic, args);\r\n\r\n return this;\r\n },\r\n\r\n /**\r\n * Returns instances of all tooltips in the page or an a given element\r\n *\r\n * @param {string|HTML object collection} selector optional Use this\r\n * parameter to restrict the set of objects that will be inspected\r\n * for the retrieval of instances. By default, all instances in the\r\n * page are returned.\r\n * @return {array} An array of instance objects\r\n * @public\r\n */\r\n instances: function (selector) {\r\n\r\n var instances = [],\r\n sel = selector || '.tooltipstered';\r\n\r\n $(sel).each(function () {\r\n\r\n var $this = $(this),\r\n ns = $this.data('tooltipster-ns');\r\n\r\n if (ns) {\r\n\r\n $.each(ns, function (i, namespace) {\r\n instances.push($this.data(namespace));\r\n });\r\n }\r\n });\r\n\r\n return instances;\r\n },\r\n\r\n /**\r\n * Returns the Tooltipster objects generated by the last initializing call\r\n *\r\n * @return {array} An array of instance objects\r\n * @public\r\n */\r\n instancesLatest: function () {\r\n return this.__instancesLatestArr;\r\n },\r\n\r\n /**\r\n * For public use only, not to be used by plugins (use ::_off() instead)\r\n *\r\n * @return {core}\r\n * @public\r\n */\r\n off: function () {\r\n this.__$emitterPublic.off.apply(this.__$emitterPublic, Array.prototype.slice.apply(arguments));\r\n return this;\r\n },\r\n\r\n /**\r\n * For public use only, not to be used by plugins (use ::_on() instead)\r\n *\r\n * @return {core}\r\n * @public\r\n */\r\n on: function () {\r\n this.__$emitterPublic.on.apply(this.__$emitterPublic, Array.prototype.slice.apply(arguments));\r\n return this;\r\n },\r\n\r\n /**\r\n * For public use only, not to be used by plugins (use ::_one() instead)\r\n *\r\n * @return {core}\r\n * @public\r\n */\r\n one: function () {\r\n this.__$emitterPublic.one.apply(this.__$emitterPublic, Array.prototype.slice.apply(arguments));\r\n return this;\r\n },\r\n\r\n /**\r\n * Returns all HTML elements which have one or more tooltips\r\n *\r\n * @param {string} selector optional Use this to restrict the results\r\n * to the descendants of an element\r\n * @return {array} An array of HTML elements\r\n * @public\r\n */\r\n origins: function (selector) {\r\n\r\n var sel = selector ?\r\n selector + ' ' :\r\n '';\r\n\r\n return $(sel + '.tooltipstered').toArray();\r\n },\r\n\r\n /**\r\n * Change default options for all future instances\r\n *\r\n * @param {object} d The options that should be made defaults\r\n * @return {core}\r\n * @public\r\n */\r\n setDefaults: function (d) {\r\n $.extend(defaults, d);\r\n return this;\r\n },\r\n\r\n /**\r\n * For users to trigger their handlers on the public emitter\r\n *\r\n * @returns {core}\r\n * @public\r\n */\r\n triggerHandler: function () {\r\n this.__$emitterPublic.triggerHandler.apply(this.__$emitterPublic, Array.prototype.slice.apply(arguments));\r\n return this;\r\n }\r\n };\r\n\r\n// $.tooltipster will be used to call core methods\r\n $.tooltipster = new core();\r\n\r\n// the Tooltipster instance class (mind the capital T)\r\n $.Tooltipster = function (element, options) {\r\n\r\n // list of instance variables\r\n\r\n // stack of custom callbacks provided as parameters to API methods\r\n this.__callbacks = {\r\n close: [],\r\n open: []\r\n };\r\n // the schedule time of DOM removal\r\n this.__closingTime;\r\n // this will be the user content shown in the tooltip. A capital \"C\" is used\r\n // because there is also a method called content()\r\n this.__Content;\r\n // for the size tracker\r\n this.__contentBcr;\r\n // to disable the tooltip after destruction\r\n this.__destroyed = false;\r\n // we can't emit directly on the instance because if a method with the same\r\n // name as the event exists, it will be called by jQuery. Se we use a plain\r\n // object as emitter. This emitter is for internal use by plugins,\r\n // if needed.\r\n this.__$emitterPrivate = $({});\r\n // this emitter is for the user to listen to events without risking to mess\r\n // with our internal listeners\r\n this.__$emitterPublic = $({});\r\n this.__enabled = true;\r\n // the reference to the gc interval\r\n this.__garbageCollector;\r\n // various position and size data recomputed before each repositioning\r\n this.__Geometry;\r\n // the tooltip position, saved after each repositioning by a plugin\r\n this.__lastPosition;\r\n // a unique namespace per instance\r\n this.__namespace = 'tooltipster-' + Math.round(Math.random() * 1000000);\r\n this.__options;\r\n // will be used to support origins in scrollable areas\r\n this.__$originParents;\r\n this.__pointerIsOverOrigin = false;\r\n // to remove themes if needed\r\n this.__previousThemes = [];\r\n // the state can be either: appearing, stable, disappearing, closed\r\n this.__state = 'closed';\r\n // timeout references\r\n this.__timeouts = {\r\n close: [],\r\n open: null\r\n };\r\n // store touch events to be able to detect emulated mouse events\r\n this.__touchEvents = [];\r\n // the reference to the tracker interval\r\n this.__tracker = null;\r\n // the element to which this tooltip is associated\r\n this._$origin;\r\n // this will be the tooltip element (jQuery wrapped HTML element).\r\n // It's the job of a plugin to create it and append it to the DOM\r\n this._$tooltip;\r\n\r\n // launch\r\n this.__init(element, options);\r\n };\r\n\r\n $.Tooltipster.prototype = {\r\n\r\n /**\r\n * @param origin\r\n * @param options\r\n * @private\r\n */\r\n __init: function (origin, options) {\r\n\r\n var self = this;\r\n\r\n self._$origin = $(origin);\r\n self.__options = $.extend(true, {}, defaults, options);\r\n\r\n // some options may need to be reformatted\r\n self.__optionsFormat();\r\n\r\n // don't run on old IE if asked no to\r\n if (!env.IE\r\n || env.IE >= self.__options.IEmin\r\n ) {\r\n\r\n // note: the content is null (empty) by default and can stay that\r\n // way if the plugin remains initialized but not fed any content. The\r\n // tooltip will just not appear.\r\n\r\n // let's save the initial value of the title attribute for later\r\n // restoration if need be.\r\n var initialTitle = null;\r\n\r\n // it will already have been saved in case of multiple tooltips\r\n if (self._$origin.data('tooltipster-initialTitle') === undefined) {\r\n\r\n initialTitle = self._$origin.attr('title');\r\n\r\n // we do not want initialTitle to be \"undefined\" because\r\n // of how jQuery's .data() method works\r\n if (initialTitle === undefined) initialTitle = null;\r\n\r\n self._$origin.data('tooltipster-initialTitle', initialTitle);\r\n }\r\n\r\n // If content is provided in the options, it has precedence over the\r\n // title attribute.\r\n // Note: an empty string is considered content, only 'null' represents\r\n // the absence of content.\r\n // Also, an existing title=\"\" attribute will result in an empty string\r\n // content\r\n if (self.__options.content !== null) {\r\n self.__contentSet(self.__options.content);\r\n }\r\n else {\r\n\r\n var selector = self._$origin.attr('data-tooltip-content'),\r\n $el;\r\n\r\n if (selector) {\r\n $el = $(selector);\r\n }\r\n\r\n if ($el && $el[0]) {\r\n self.__contentSet($el.first());\r\n }\r\n else {\r\n self.__contentSet(initialTitle);\r\n }\r\n }\r\n\r\n self._$origin\r\n // strip the title off of the element to prevent the default tooltips\r\n // from popping up\r\n .removeAttr('title')\r\n // to be able to find all instances on the page later (upon window\r\n // events in particular)\r\n .addClass('tooltipstered');\r\n\r\n // set listeners on the origin\r\n self.__prepareOrigin();\r\n\r\n // set the garbage collector\r\n self.__prepareGC();\r\n\r\n // init plugins\r\n $.each(self.__options.plugins, function (i, pluginName) {\r\n self._plug(pluginName);\r\n });\r\n\r\n // to detect swiping\r\n if (env.hasTouchCapability) {\r\n $(env.window.document.body).on('touchmove.' + self.__namespace + '-triggerOpen', function (event) {\r\n self._touchRecordEvent(event);\r\n });\r\n }\r\n\r\n self\r\n // prepare the tooltip when it gets created. This event must\r\n // be fired by a plugin\r\n ._on('created', function () {\r\n self.__prepareTooltip();\r\n })\r\n // save position information when it's sent by a plugin\r\n ._on('repositioned', function (e) {\r\n self.__lastPosition = e.position;\r\n });\r\n }\r\n else {\r\n self.__options.disabled = true;\r\n }\r\n },\r\n\r\n /**\r\n * Insert the content into the appropriate HTML element of the tooltip\r\n *\r\n * @returns {self}\r\n * @private\r\n */\r\n __contentInsert: function () {\r\n\r\n var self = this,\r\n $el = self._$tooltip.find('.tooltipster-content'),\r\n formattedContent = self.__Content,\r\n format = function (content) {\r\n formattedContent = content;\r\n };\r\n\r\n self._trigger({\r\n type: 'format',\r\n content: self.__Content,\r\n format: format\r\n });\r\n\r\n if (self.__options.functionFormat) {\r\n\r\n formattedContent = self.__options.functionFormat.call(\r\n self,\r\n self,\r\n {origin: self._$origin[0]},\r\n self.__Content\r\n );\r\n }\r\n\r\n if (typeof formattedContent === 'string' && !self.__options.contentAsHTML) {\r\n $el.text(formattedContent);\r\n }\r\n else {\r\n $el\r\n .empty()\r\n .append(formattedContent);\r\n }\r\n\r\n return self;\r\n },\r\n\r\n /**\r\n * Save the content, cloning it beforehand if need be\r\n *\r\n * @param content\r\n * @returns {self}\r\n * @private\r\n */\r\n __contentSet: function (content) {\r\n\r\n // clone if asked. Cloning the object makes sure that each instance has its\r\n // own version of the content (in case a same object were provided for several\r\n // instances)\r\n // reminder: typeof null === object\r\n if (content instanceof $ && this.__options.contentCloning) {\r\n content = content.clone(true);\r\n }\r\n\r\n this.__Content = content;\r\n\r\n this._trigger({\r\n type: 'updated',\r\n content: content\r\n });\r\n\r\n return this;\r\n },\r\n\r\n /**\r\n * Error message about a method call made after destruction\r\n *\r\n * @private\r\n */\r\n __destroyError: function () {\r\n throw new Error('This tooltip has been destroyed and cannot execute your method call.');\r\n },\r\n\r\n /**\r\n * Gather all information about dimensions and available space,\r\n * called before every repositioning\r\n *\r\n * @private\r\n * @returns {object}\r\n */\r\n __geometry: function () {\r\n\r\n var self = this,\r\n $target = self._$origin,\r\n originIsArea = self._$origin.is('area');\r\n\r\n // if this._$origin is a map area, the target we'll need\r\n // the dimensions of is actually the image using the map,\r\n // not the area itself\r\n if (originIsArea) {\r\n\r\n var mapName = self._$origin.parent().attr('name');\r\n\r\n $target = $('img[usemap=\"#' + mapName + '\"]');\r\n }\r\n\r\n var bcr = $target[0].getBoundingClientRect(),\r\n $document = $(env.window.document),\r\n $window = $(env.window),\r\n $parent = $target,\r\n // some useful properties of important elements\r\n geo = {\r\n // available space for the tooltip, see down below\r\n available: {\r\n document: null,\r\n window: null\r\n },\r\n document: {\r\n size: {\r\n height: $document.height(),\r\n width: $document.width()\r\n }\r\n },\r\n window: {\r\n scroll: {\r\n // the second ones are for IE compatibility\r\n left: env.window.scrollX || env.window.document.documentElement.scrollLeft,\r\n top: env.window.scrollY || env.window.document.documentElement.scrollTop\r\n },\r\n size: {\r\n height: $window.height(),\r\n width: $window.width()\r\n }\r\n },\r\n origin: {\r\n // the origin has a fixed lineage if itself or one of its\r\n // ancestors has a fixed position\r\n fixedLineage: false,\r\n // relative to the document\r\n offset: {},\r\n size: {\r\n height: bcr.bottom - bcr.top,\r\n width: bcr.right - bcr.left\r\n },\r\n usemapImage: originIsArea ? $target[0] : null,\r\n // relative to the window\r\n windowOffset: {\r\n bottom: bcr.bottom,\r\n left: bcr.left,\r\n right: bcr.right,\r\n top: bcr.top\r\n }\r\n }\r\n },\r\n geoFixed = false;\r\n\r\n // if the element is a map area, some properties may need\r\n // to be recalculated\r\n if (originIsArea) {\r\n\r\n var shape = self._$origin.attr('shape'),\r\n coords = self._$origin.attr('coords');\r\n\r\n if (coords) {\r\n\r\n coords = coords.split(',');\r\n\r\n $.map(coords, function (val, i) {\r\n coords[i] = parseInt(val);\r\n });\r\n }\r\n\r\n // if the image itself is the area, nothing more to do\r\n if (shape != 'default') {\r\n\r\n switch (shape) {\r\n\r\n case 'circle':\r\n\r\n var circleCenterLeft = coords[0],\r\n circleCenterTop = coords[1],\r\n circleRadius = coords[2],\r\n areaTopOffset = circleCenterTop - circleRadius,\r\n areaLeftOffset = circleCenterLeft - circleRadius;\r\n\r\n geo.origin.size.height = circleRadius * 2;\r\n geo.origin.size.width = geo.origin.size.height;\r\n\r\n geo.origin.windowOffset.left += areaLeftOffset;\r\n geo.origin.windowOffset.top += areaTopOffset;\r\n\r\n break;\r\n\r\n case 'rect':\r\n\r\n var areaLeft = coords[0],\r\n areaTop = coords[1],\r\n areaRight = coords[2],\r\n areaBottom = coords[3];\r\n\r\n geo.origin.size.height = areaBottom - areaTop;\r\n geo.origin.size.width = areaRight - areaLeft;\r\n\r\n geo.origin.windowOffset.left += areaLeft;\r\n geo.origin.windowOffset.top += areaTop;\r\n\r\n break;\r\n\r\n case 'poly':\r\n\r\n var areaSmallestX = 0,\r\n areaSmallestY = 0,\r\n areaGreatestX = 0,\r\n areaGreatestY = 0,\r\n arrayAlternate = 'even';\r\n\r\n for (var i = 0; i < coords.length; i++) {\r\n\r\n var areaNumber = coords[i];\r\n\r\n if (arrayAlternate == 'even') {\r\n\r\n if (areaNumber > areaGreatestX) {\r\n\r\n areaGreatestX = areaNumber;\r\n\r\n if (i === 0) {\r\n areaSmallestX = areaGreatestX;\r\n }\r\n }\r\n\r\n if (areaNumber < areaSmallestX) {\r\n areaSmallestX = areaNumber;\r\n }\r\n\r\n arrayAlternate = 'odd';\r\n }\r\n else {\r\n if (areaNumber > areaGreatestY) {\r\n\r\n areaGreatestY = areaNumber;\r\n\r\n if (i == 1) {\r\n areaSmallestY = areaGreatestY;\r\n }\r\n }\r\n\r\n if (areaNumber < areaSmallestY) {\r\n areaSmallestY = areaNumber;\r\n }\r\n\r\n arrayAlternate = 'even';\r\n }\r\n }\r\n\r\n geo.origin.size.height = areaGreatestY - areaSmallestY;\r\n geo.origin.size.width = areaGreatestX - areaSmallestX;\r\n\r\n geo.origin.windowOffset.left += areaSmallestX;\r\n geo.origin.windowOffset.top += areaSmallestY;\r\n\r\n break;\r\n }\r\n }\r\n }\r\n\r\n // user callback through an event\r\n var edit = function (r) {\r\n geo.origin.size.height = r.height,\r\n geo.origin.windowOffset.left = r.left,\r\n geo.origin.windowOffset.top = r.top,\r\n geo.origin.size.width = r.width\r\n };\r\n\r\n self._trigger({\r\n type: 'geometry',\r\n edit: edit,\r\n geometry: {\r\n height: geo.origin.size.height,\r\n left: geo.origin.windowOffset.left,\r\n top: geo.origin.windowOffset.top,\r\n width: geo.origin.size.width\r\n }\r\n });\r\n\r\n // calculate the remaining properties with what we got\r\n\r\n geo.origin.windowOffset.right = geo.origin.windowOffset.left + geo.origin.size.width;\r\n geo.origin.windowOffset.bottom = geo.origin.windowOffset.top + geo.origin.size.height;\r\n\r\n geo.origin.offset.left = geo.origin.windowOffset.left + geo.window.scroll.left;\r\n geo.origin.offset.top = geo.origin.windowOffset.top + geo.window.scroll.top;\r\n geo.origin.offset.bottom = geo.origin.offset.top + geo.origin.size.height;\r\n geo.origin.offset.right = geo.origin.offset.left + geo.origin.size.width;\r\n\r\n // the space that is available to display the tooltip relatively to the document\r\n geo.available.document = {\r\n bottom: {\r\n height: geo.document.size.height - geo.origin.offset.bottom,\r\n width: geo.document.size.width\r\n },\r\n left: {\r\n height: geo.document.size.height,\r\n width: geo.origin.offset.left\r\n },\r\n right: {\r\n height: geo.document.size.height,\r\n width: geo.document.size.width - geo.origin.offset.right\r\n },\r\n top: {\r\n height: geo.origin.offset.top,\r\n width: geo.document.size.width\r\n }\r\n };\r\n\r\n // the space that is available to display the tooltip relatively to the viewport\r\n // (the resulting values may be negative if the origin overflows the viewport)\r\n geo.available.window = {\r\n bottom: {\r\n // the inner max is here to make sure the available height is no bigger\r\n // than the viewport height (when the origin is off screen at the top).\r\n // The outer max just makes sure that the height is not negative (when\r\n // the origin overflows at the bottom).\r\n height: Math.max(geo.window.size.height - Math.max(geo.origin.windowOffset.bottom, 0), 0),\r\n width: geo.window.size.width\r\n },\r\n left: {\r\n height: geo.window.size.height,\r\n width: Math.max(geo.origin.windowOffset.left, 0)\r\n },\r\n right: {\r\n height: geo.window.size.height,\r\n width: Math.max(geo.window.size.width - Math.max(geo.origin.windowOffset.right, 0), 0)\r\n },\r\n top: {\r\n height: Math.max(geo.origin.windowOffset.top, 0),\r\n width: geo.window.size.width\r\n }\r\n };\r\n\r\n while ($parent[0].tagName.toLowerCase() != 'html') {\r\n\r\n if ($parent.css('position') == 'fixed') {\r\n geo.origin.fixedLineage = true;\r\n break;\r\n }\r\n\r\n $parent = $parent.parent();\r\n }\r\n\r\n return geo;\r\n },\r\n\r\n /**\r\n * Some options may need to be formated before being used\r\n *\r\n * @returns {self}\r\n * @private\r\n */\r\n __optionsFormat: function () {\r\n\r\n if (typeof this.__options.animationDuration == 'number') {\r\n this.__options.animationDuration = [this.__options.animationDuration, this.__options.animationDuration];\r\n }\r\n\r\n if (typeof this.__options.delay == 'number') {\r\n this.__options.delay = [this.__options.delay, this.__options.delay];\r\n }\r\n\r\n if (typeof this.__options.delayTouch == 'number') {\r\n this.__options.delayTouch = [this.__options.delayTouch, this.__options.delayTouch];\r\n }\r\n\r\n if (typeof this.__options.theme == 'string') {\r\n this.__options.theme = [this.__options.theme];\r\n }\r\n\r\n // determine the future parent\r\n if (this.__options.parent === null) {\r\n this.__options.parent = $(env.window.document.body);\r\n }\r\n else if (typeof this.__options.parent == 'string') {\r\n this.__options.parent = $(this.__options.parent);\r\n }\r\n\r\n if (this.__options.trigger == 'hover') {\r\n\r\n this.__options.triggerOpen = {\r\n mouseenter: true,\r\n touchstart: true\r\n };\r\n\r\n this.__options.triggerClose = {\r\n mouseleave: true,\r\n originClick: true,\r\n touchleave: true\r\n };\r\n }\r\n else if (this.__options.trigger == 'click') {\r\n\r\n this.__options.triggerOpen = {\r\n click: true,\r\n tap: true\r\n };\r\n\r\n this.__options.triggerClose = {\r\n click: true,\r\n tap: true\r\n };\r\n }\r\n\r\n // for the plugins\r\n this._trigger('options');\r\n\r\n return this;\r\n },\r\n\r\n /**\r\n * Schedules or cancels the garbage collector task\r\n *\r\n * @returns {self}\r\n * @private\r\n */\r\n __prepareGC: function () {\r\n\r\n var self = this;\r\n\r\n // in case the selfDestruction option has been changed by a method call\r\n if (self.__options.selfDestruction) {\r\n\r\n // the GC task\r\n self.__garbageCollector = setInterval(function () {\r\n\r\n var now = new Date().getTime();\r\n\r\n // forget the old events\r\n self.__touchEvents = $.grep(self.__touchEvents, function (event, i) {\r\n // 1 minute\r\n return now - event.time > 60000;\r\n });\r\n\r\n // auto-destruct if the origin is gone\r\n if (!bodyContains(self._$origin)) {\r\n\r\n self.close(function () {\r\n self.destroy();\r\n });\r\n }\r\n }, 20000);\r\n }\r\n else {\r\n clearInterval(self.__garbageCollector);\r\n }\r\n\r\n return self;\r\n },\r\n\r\n /**\r\n * Sets listeners on the origin if the open triggers require them.\r\n * Unlike the listeners set at opening time, these ones\r\n * remain even when the tooltip is closed. It has been made a\r\n * separate method so it can be called when the triggers are\r\n * changed in the options. Closing is handled in _open()\r\n * because of the bindings that may be needed on the tooltip\r\n * itself\r\n *\r\n * @returns {self}\r\n * @private\r\n */\r\n __prepareOrigin: function () {\r\n\r\n var self = this;\r\n\r\n // in case we're resetting the triggers\r\n self._$origin.off('.' + self.__namespace + '-triggerOpen');\r\n\r\n // if the device is touch capable, even if only mouse triggers\r\n // are asked, we need to listen to touch events to know if the mouse\r\n // events are actually emulated (so we can ignore them)\r\n if (env.hasTouchCapability) {\r\n\r\n self._$origin.on(\r\n 'touchstart.' + self.__namespace + '-triggerOpen ' +\r\n 'touchend.' + self.__namespace + '-triggerOpen ' +\r\n 'touchcancel.' + self.__namespace + '-triggerOpen',\r\n function (event) {\r\n self._touchRecordEvent(event);\r\n }\r\n );\r\n }\r\n\r\n // mouse click and touch tap work the same way\r\n if (self.__options.triggerOpen.click\r\n || (self.__options.triggerOpen.tap && env.hasTouchCapability)\r\n ) {\r\n\r\n var eventNames = '';\r\n if (self.__options.triggerOpen.click) {\r\n eventNames += 'click.' + self.__namespace + '-triggerOpen ';\r\n }\r\n if (self.__options.triggerOpen.tap && env.hasTouchCapability) {\r\n eventNames += 'touchend.' + self.__namespace + '-triggerOpen';\r\n }\r\n\r\n self._$origin.on(eventNames, function (event) {\r\n if (self._touchIsMeaningfulEvent(event)) {\r\n self._open(event);\r\n }\r\n });\r\n }\r\n\r\n // mouseenter and touch start work the same way\r\n if (self.__options.triggerOpen.mouseenter\r\n || (self.__options.triggerOpen.touchstart && env.hasTouchCapability)\r\n ) {\r\n\r\n var eventNames = '';\r\n if (self.__options.triggerOpen.mouseenter) {\r\n eventNames += 'mouseenter.' + self.__namespace + '-triggerOpen ';\r\n }\r\n if (self.__options.triggerOpen.touchstart && env.hasTouchCapability) {\r\n eventNames += 'touchstart.' + self.__namespace + '-triggerOpen';\r\n }\r\n\r\n self._$origin.on(eventNames, function (event) {\r\n if (self._touchIsTouchEvent(event)\r\n || !self._touchIsEmulatedEvent(event)\r\n ) {\r\n self.__pointerIsOverOrigin = true;\r\n self._openShortly(event);\r\n }\r\n });\r\n }\r\n\r\n // info for the mouseleave/touchleave close triggers when they use a delay\r\n if (self.__options.triggerClose.mouseleave\r\n || (self.__options.triggerClose.touchleave && env.hasTouchCapability)\r\n ) {\r\n\r\n var eventNames = '';\r\n if (self.__options.triggerClose.mouseleave) {\r\n eventNames += 'mouseleave.' + self.__namespace + '-triggerOpen ';\r\n }\r\n if (self.__options.triggerClose.touchleave && env.hasTouchCapability) {\r\n eventNames += 'touchend.' + self.__namespace + '-triggerOpen touchcancel.' + self.__namespace + '-triggerOpen';\r\n }\r\n\r\n self._$origin.on(eventNames, function (event) {\r\n\r\n if (self._touchIsMeaningfulEvent(event)) {\r\n self.__pointerIsOverOrigin = false;\r\n }\r\n });\r\n }\r\n\r\n return self;\r\n },\r\n\r\n /**\r\n * Do the things that need to be done only once after the tooltip\r\n * HTML element it has been created. It has been made a separate\r\n * method so it can be called when options are changed. Remember\r\n * that the tooltip may actually exist in the DOM before it is\r\n * opened, and present after it has been closed: it's the display\r\n * plugin that takes care of handling it.\r\n *\r\n * @returns {self}\r\n * @private\r\n */\r\n __prepareTooltip: function () {\r\n\r\n var self = this,\r\n p = self.__options.interactive ? 'auto' : '';\r\n\r\n // this will be useful to know quickly if the tooltip is in\r\n // the DOM or not\r\n self._$tooltip\r\n .attr('id', self.__namespace)\r\n .css({\r\n // pointer events\r\n 'pointer-events': p,\r\n zIndex: self.__options.zIndex\r\n });\r\n\r\n // themes\r\n // remove the old ones and add the new ones\r\n $.each(self.__previousThemes, function (i, theme) {\r\n self._$tooltip.removeClass(theme);\r\n });\r\n $.each(self.__options.theme, function (i, theme) {\r\n self._$tooltip.addClass(theme);\r\n });\r\n\r\n self.__previousThemes = $.merge([], self.__options.theme);\r\n\r\n return self;\r\n },\r\n\r\n /**\r\n * Handles the scroll on any of the parents of the origin (when the\r\n * tooltip is open)\r\n *\r\n * @param {object} event\r\n * @returns {self}\r\n * @private\r\n */\r\n __scrollHandler: function (event) {\r\n\r\n var self = this;\r\n\r\n if (self.__options.triggerClose.scroll) {\r\n self._close(event);\r\n }\r\n else {\r\n\r\n // if the origin or tooltip have been removed: do nothing, the tracker will\r\n // take care of it later\r\n if (bodyContains(self._$origin) && bodyContains(self._$tooltip)) {\r\n\r\n var geo = null;\r\n\r\n // if the scroll happened on the window\r\n if (event.target === env.window.document) {\r\n\r\n // if the origin has a fixed lineage, window scroll will have no\r\n // effect on its position nor on the position of the tooltip\r\n if (!self.__Geometry.origin.fixedLineage) {\r\n\r\n // we don't need to do anything unless repositionOnScroll is true\r\n // because the tooltip will already have moved with the window\r\n // (and of course with the origin)\r\n if (self.__options.repositionOnScroll) {\r\n self.reposition(event);\r\n }\r\n }\r\n }\r\n // if the scroll happened on another parent of the tooltip, it means\r\n // that it's in a scrollable area and now needs to have its position\r\n // adjusted or recomputed, depending ont the repositionOnScroll\r\n // option. Also, if the origin is partly hidden due to a parent that\r\n // hides its overflow, we'll just hide (not close) the tooltip.\r\n else {\r\n\r\n geo = self.__geometry();\r\n\r\n var overflows = false;\r\n\r\n // a fixed position origin is not affected by the overflow hiding\r\n // of a parent\r\n if (self._$origin.css('position') != 'fixed') {\r\n\r\n self.__$originParents.each(function (i, el) {\r\n\r\n var $el = $(el),\r\n overflowX = $el.css('overflow-x'),\r\n overflowY = $el.css('overflow-y');\r\n\r\n if (overflowX != 'visible' || overflowY != 'visible') {\r\n\r\n var bcr = el.getBoundingClientRect();\r\n\r\n if (overflowX != 'visible') {\r\n\r\n if (geo.origin.windowOffset.left < bcr.left\r\n || geo.origin.windowOffset.right > bcr.right\r\n ) {\r\n overflows = true;\r\n return false;\r\n }\r\n }\r\n\r\n if (overflowY != 'visible') {\r\n\r\n if (geo.origin.windowOffset.top < bcr.top\r\n || geo.origin.windowOffset.bottom > bcr.bottom\r\n ) {\r\n overflows = true;\r\n return false;\r\n }\r\n }\r\n }\r\n\r\n // no need to go further if fixed, for the same reason as above\r\n if ($el.css('position') == 'fixed') {\r\n return false;\r\n }\r\n });\r\n }\r\n\r\n if (overflows) {\r\n self._$tooltip.css('visibility', 'hidden');\r\n }\r\n else {\r\n\r\n self._$tooltip.css('visibility', 'visible');\r\n\r\n // reposition\r\n if (self.__options.repositionOnScroll) {\r\n self.reposition(event);\r\n }\r\n // or just adjust offset\r\n else {\r\n\r\n // we have to use offset and not windowOffset because this way,\r\n // only the scroll distance of the scrollable areas are taken into\r\n // account (the scrolltop value of the main window must be\r\n // ignored since the tooltip already moves with it)\r\n var offsetLeft = geo.origin.offset.left - self.__Geometry.origin.offset.left,\r\n offsetTop = geo.origin.offset.top - self.__Geometry.origin.offset.top;\r\n\r\n // add the offset to the position initially computed by the display plugin\r\n self._$tooltip.css({\r\n left: self.__lastPosition.coord.left + offsetLeft,\r\n top: self.__lastPosition.coord.top + offsetTop\r\n });\r\n }\r\n }\r\n }\r\n\r\n self._trigger({\r\n type: 'scroll',\r\n event: event,\r\n geo: geo\r\n });\r\n }\r\n }\r\n\r\n return self;\r\n },\r\n\r\n /**\r\n * Changes the state of the tooltip\r\n *\r\n * @param {string} state\r\n * @returns {self}\r\n * @private\r\n */\r\n __stateSet: function (state) {\r\n\r\n this.__state = state;\r\n\r\n this._trigger({\r\n type: 'state',\r\n state: state\r\n });\r\n\r\n return this;\r\n },\r\n\r\n /**\r\n * Clear appearance timeouts\r\n *\r\n * @returns {self}\r\n * @private\r\n */\r\n __timeoutsClear: function () {\r\n\r\n // there is only one possible open timeout: the delayed opening\r\n // when the mouseenter/touchstart open triggers are used\r\n clearTimeout(this.__timeouts.open);\r\n this.__timeouts.open = null;\r\n\r\n // ... but several close timeouts: the delayed closing when the\r\n // mouseleave close trigger is used and the timer option\r\n $.each(this.__timeouts.close, function (i, timeout) {\r\n clearTimeout(timeout);\r\n });\r\n this.__timeouts.close = [];\r\n\r\n return this;\r\n },\r\n\r\n /**\r\n * Start the tracker that will make checks at regular intervals\r\n *\r\n * @returns {self}\r\n * @private\r\n */\r\n __trackerStart: function () {\r\n\r\n var self = this,\r\n $content = self._$tooltip.find('.tooltipster-content');\r\n\r\n // get the initial content size\r\n if (self.__options.trackTooltip) {\r\n self.__contentBcr = $content[0].getBoundingClientRect();\r\n }\r\n\r\n self.__tracker = setInterval(function () {\r\n\r\n // if the origin or tooltip elements have been removed.\r\n // Note: we could destroy the instance now if the origin has\r\n // been removed but we'll leave that task to our garbage collector\r\n if (!bodyContains(self._$origin) || !bodyContains(self._$tooltip)) {\r\n self._close();\r\n }\r\n // if everything is alright\r\n else {\r\n\r\n // compare the former and current positions of the origin to reposition\r\n // the tooltip if need be\r\n if (self.__options.trackOrigin) {\r\n\r\n var g = self.__geometry(),\r\n identical = false;\r\n\r\n // compare size first (a change requires repositioning too)\r\n if (areEqual(g.origin.size, self.__Geometry.origin.size)) {\r\n\r\n // for elements that have a fixed lineage (see __geometry()), we track the\r\n // top and left properties (relative to window)\r\n if (self.__Geometry.origin.fixedLineage) {\r\n if (areEqual(g.origin.windowOffset, self.__Geometry.origin.windowOffset)) {\r\n identical = true;\r\n }\r\n }\r\n // otherwise, track total offset (relative to document)\r\n else {\r\n if (areEqual(g.origin.offset, self.__Geometry.origin.offset)) {\r\n identical = true;\r\n }\r\n }\r\n }\r\n\r\n if (!identical) {\r\n\r\n // close the tooltip when using the mouseleave close trigger\r\n // (see https://github.com/iamceege/tooltipster/pull/253)\r\n if (self.__options.triggerClose.mouseleave) {\r\n self._close();\r\n }\r\n else {\r\n self.reposition();\r\n }\r\n }\r\n }\r\n\r\n if (self.__options.trackTooltip) {\r\n\r\n var currentBcr = $content[0].getBoundingClientRect();\r\n\r\n if (currentBcr.height !== self.__contentBcr.height\r\n || currentBcr.width !== self.__contentBcr.width\r\n ) {\r\n self.reposition();\r\n self.__contentBcr = currentBcr;\r\n }\r\n }\r\n }\r\n }, self.__options.trackerInterval);\r\n\r\n return self;\r\n },\r\n\r\n /**\r\n * Closes the tooltip (after the closing delay)\r\n *\r\n * @param event\r\n * @param callback\r\n * @param force Set to true to override a potential refusal of the user's function\r\n * @returns {self}\r\n * @protected\r\n */\r\n _close: function (event, callback, force) {\r\n\r\n var self = this,\r\n ok = true;\r\n\r\n self._trigger({\r\n type: 'close',\r\n event: event,\r\n stop: function () {\r\n ok = false;\r\n }\r\n });\r\n\r\n // a destroying tooltip (force == true) may not refuse to close\r\n if (ok || force) {\r\n\r\n // save the method custom callback and cancel any open method custom callbacks\r\n if (callback) self.__callbacks.close.push(callback);\r\n self.__callbacks.open = [];\r\n\r\n // clear open/close timeouts\r\n self.__timeoutsClear();\r\n\r\n var finishCallbacks = function () {\r\n\r\n // trigger any close method custom callbacks and reset them\r\n $.each(self.__callbacks.close, function (i, c) {\r\n c.call(self, self, {\r\n event: event,\r\n origin: self._$origin[0]\r\n });\r\n });\r\n\r\n self.__callbacks.close = [];\r\n };\r\n\r\n if (self.__state != 'closed') {\r\n\r\n var necessary = true,\r\n d = new Date(),\r\n now = d.getTime(),\r\n newClosingTime = now + self.__options.animationDuration[1];\r\n\r\n // the tooltip may already already be disappearing, but if a new\r\n // call to close() is made after the animationDuration was changed\r\n // to 0 (for example), we ought to actually close it sooner than\r\n // previously scheduled. In that case it should be noted that the\r\n // browser will not adapt the animation duration to the new\r\n // animationDuration that was set after the start of the closing\r\n // animation.\r\n // Note: the same thing could be considered at opening, but is not\r\n // really useful since the tooltip is actually opened immediately\r\n // upon a call to _open(). Since it would not make the opening\r\n // animation finish sooner, its sole impact would be to trigger the\r\n // state event and the open callbacks sooner than the actual end of\r\n // the opening animation, which is not great.\r\n if (self.__state == 'disappearing') {\r\n\r\n if (newClosingTime > self.__closingTime\r\n // in case closing is actually overdue because the script\r\n // execution was suspended. See #679\r\n && self.__options.animationDuration[1] > 0\r\n ) {\r\n necessary = false;\r\n }\r\n }\r\n\r\n if (necessary) {\r\n\r\n self.__closingTime = newClosingTime;\r\n\r\n if (self.__state != 'disappearing') {\r\n self.__stateSet('disappearing');\r\n }\r\n\r\n var finish = function () {\r\n\r\n // stop the tracker\r\n clearInterval(self.__tracker);\r\n\r\n // a \"beforeClose\" option has been asked several times but would\r\n // probably useless since the content element is still accessible\r\n // via ::content(), and because people can always use listeners\r\n // inside their content to track what's going on. For the sake of\r\n // simplicity, this has been denied. Bur for the rare people who\r\n // really need the option (for old browsers or for the case where\r\n // detaching the content is actually destructive, for file or\r\n // password inputs for example), this event will do the work.\r\n self._trigger({\r\n type: 'closing',\r\n event: event\r\n });\r\n\r\n // unbind listeners which are no longer needed\r\n\r\n self._$tooltip\r\n .off('.' + self.__namespace + '-triggerClose')\r\n .removeClass('tooltipster-dying');\r\n\r\n // orientationchange, scroll and resize listeners\r\n $(env.window).off('.' + self.__namespace + '-triggerClose');\r\n\r\n // scroll listeners\r\n self.__$originParents.each(function (i, el) {\r\n $(el).off('scroll.' + self.__namespace + '-triggerClose');\r\n });\r\n // clear the array to prevent memory leaks\r\n self.__$originParents = null;\r\n\r\n $(env.window.document.body).off('.' + self.__namespace + '-triggerClose');\r\n\r\n self._$origin.off('.' + self.__namespace + '-triggerClose');\r\n\r\n self._off('dismissable');\r\n\r\n // a plugin that would like to remove the tooltip from the\r\n // DOM when closed should bind on this\r\n self.__stateSet('closed');\r\n\r\n // trigger event\r\n self._trigger({\r\n type: 'after',\r\n event: event\r\n });\r\n\r\n // call our constructor custom callback function\r\n if (self.__options.functionAfter) {\r\n self.__options.functionAfter.call(self, self, {\r\n event: event,\r\n origin: self._$origin[0]\r\n });\r\n }\r\n\r\n // call our method custom callbacks functions\r\n finishCallbacks();\r\n };\r\n\r\n if (env.hasTransitions) {\r\n\r\n self._$tooltip.css({\r\n '-moz-animation-duration': self.__options.animationDuration[1] + 'ms',\r\n '-ms-animation-duration': self.__options.animationDuration[1] + 'ms',\r\n '-o-animation-duration': self.__options.animationDuration[1] + 'ms',\r\n '-webkit-animation-duration': self.__options.animationDuration[1] + 'ms',\r\n 'animation-duration': self.__options.animationDuration[1] + 'ms',\r\n 'transition-duration': self.__options.animationDuration[1] + 'ms'\r\n });\r\n\r\n self._$tooltip\r\n // clear both potential open and close tasks\r\n .clearQueue()\r\n .removeClass('tooltipster-show')\r\n // for transitions only\r\n .addClass('tooltipster-dying');\r\n\r\n if (self.__options.animationDuration[1] > 0) {\r\n self._$tooltip.delay(self.__options.animationDuration[1]);\r\n }\r\n\r\n self._$tooltip.queue(finish);\r\n }\r\n else {\r\n\r\n self._$tooltip\r\n .stop()\r\n .fadeOut(self.__options.animationDuration[1], finish);\r\n }\r\n }\r\n }\r\n // if the tooltip is already closed, we still need to trigger\r\n // the method custom callbacks\r\n else {\r\n finishCallbacks();\r\n }\r\n }\r\n\r\n return self;\r\n },\r\n\r\n /**\r\n * For internal use by plugins, if needed\r\n *\r\n * @returns {self}\r\n * @protected\r\n */\r\n _off: function () {\r\n this.__$emitterPrivate.off.apply(this.__$emitterPrivate, Array.prototype.slice.apply(arguments));\r\n return this;\r\n },\r\n\r\n /**\r\n * For internal use by plugins, if needed\r\n *\r\n * @returns {self}\r\n * @protected\r\n */\r\n _on: function () {\r\n this.__$emitterPrivate.on.apply(this.__$emitterPrivate, Array.prototype.slice.apply(arguments));\r\n return this;\r\n },\r\n\r\n /**\r\n * For internal use by plugins, if needed\r\n *\r\n * @returns {self}\r\n * @protected\r\n */\r\n _one: function () {\r\n this.__$emitterPrivate.one.apply(this.__$emitterPrivate, Array.prototype.slice.apply(arguments));\r\n return this;\r\n },\r\n\r\n /**\r\n * Opens the tooltip right away.\r\n *\r\n * @param event\r\n * @param callback Will be called when the opening animation is over\r\n * @returns {self}\r\n * @protected\r\n */\r\n _open: function (event, callback) {\r\n\r\n var self = this;\r\n\r\n // if the destruction process has not begun and if this was not\r\n // triggered by an unwanted emulated click event\r\n if (!self.__destroying) {\r\n\r\n // check that the origin is still in the DOM\r\n if (bodyContains(self._$origin)\r\n // if the tooltip is enabled\r\n && self.__enabled\r\n ) {\r\n\r\n var ok = true;\r\n\r\n // if the tooltip is not open yet, we need to call functionBefore.\r\n // otherwise we can jst go on\r\n if (self.__state == 'closed') {\r\n\r\n // trigger an event. The event.stop function allows the callback\r\n // to prevent the opening of the tooltip\r\n self._trigger({\r\n type: 'before',\r\n event: event,\r\n stop: function () {\r\n ok = false;\r\n }\r\n });\r\n\r\n if (ok && self.__options.functionBefore) {\r\n\r\n // call our custom function before continuing\r\n ok = self.__options.functionBefore.call(self, self, {\r\n event: event,\r\n origin: self._$origin[0]\r\n });\r\n }\r\n }\r\n\r\n if (ok !== false) {\r\n\r\n // if there is some content\r\n if (self.__Content !== null) {\r\n\r\n // save the method callback and cancel close method callbacks\r\n if (callback) {\r\n self.__callbacks.open.push(callback);\r\n }\r\n self.__callbacks.close = [];\r\n\r\n // get rid of any appearance timeouts\r\n self.__timeoutsClear();\r\n\r\n var extraTime,\r\n finish = function () {\r\n\r\n if (self.__state != 'stable') {\r\n self.__stateSet('stable');\r\n }\r\n\r\n // trigger any open method custom callbacks and reset them\r\n $.each(self.__callbacks.open, function (i, c) {\r\n c.call(self, self, {\r\n origin: self._$origin[0],\r\n tooltip: self._$tooltip[0]\r\n });\r\n });\r\n\r\n self.__callbacks.open = [];\r\n };\r\n\r\n // if the tooltip is already open\r\n if (self.__state !== 'closed') {\r\n\r\n // the timer (if any) will start (or restart) right now\r\n extraTime = 0;\r\n\r\n // if it was disappearing, cancel that\r\n if (self.__state === 'disappearing') {\r\n\r\n self.__stateSet('appearing');\r\n\r\n if (env.hasTransitions) {\r\n\r\n self._$tooltip\r\n .clearQueue()\r\n .removeClass('tooltipster-dying')\r\n .addClass('tooltipster-show');\r\n\r\n if (self.__options.animationDuration[0] > 0) {\r\n self._$tooltip.delay(self.__options.animationDuration[0]);\r\n }\r\n\r\n self._$tooltip.queue(finish);\r\n }\r\n else {\r\n // in case the tooltip was currently fading out, bring it back\r\n // to life\r\n self._$tooltip\r\n .stop()\r\n .fadeIn(finish);\r\n }\r\n }\r\n // if the tooltip is already open, we still need to trigger the method\r\n // custom callback\r\n else if (self.__state == 'stable') {\r\n finish();\r\n }\r\n }\r\n // if the tooltip isn't already open, open it\r\n else {\r\n\r\n // a plugin must bind on this and store the tooltip in this._$tooltip\r\n self.__stateSet('appearing');\r\n\r\n // the timer (if any) will start when the tooltip has fully appeared\r\n // after its transition\r\n extraTime = self.__options.animationDuration[0];\r\n\r\n // insert the content inside the tooltip\r\n self.__contentInsert();\r\n\r\n // reposition the tooltip and attach to the DOM\r\n self.reposition(event, true);\r\n\r\n // animate in the tooltip. If the display plugin wants no css\r\n // animations, it may override the animation option with a\r\n // dummy value that will produce no effect\r\n if (env.hasTransitions) {\r\n\r\n // note: there seems to be an issue with start animations which\r\n // are randomly not played on fast devices in both Chrome and FF,\r\n // couldn't find a way to solve it yet. It seems that applying\r\n // the classes before appending to the DOM helps a little, but\r\n // it messes up some CSS transitions. The issue almost never\r\n // happens when delay[0]==0 though\r\n self._$tooltip\r\n .addClass('tooltipster-' + self.__options.animation)\r\n .addClass('tooltipster-initial')\r\n .css({\r\n '-moz-animation-duration': self.__options.animationDuration[0] + 'ms',\r\n '-ms-animation-duration': self.__options.animationDuration[0] + 'ms',\r\n '-o-animation-duration': self.__options.animationDuration[0] + 'ms',\r\n '-webkit-animation-duration': self.__options.animationDuration[0] + 'ms',\r\n 'animation-duration': self.__options.animationDuration[0] + 'ms',\r\n 'transition-duration': self.__options.animationDuration[0] + 'ms'\r\n });\r\n\r\n setTimeout(\r\n function () {\r\n\r\n // a quick hover may have already triggered a mouseleave\r\n if (self.__state != 'closed') {\r\n\r\n self._$tooltip\r\n .addClass('tooltipster-show')\r\n .removeClass('tooltipster-initial');\r\n\r\n if (self.__options.animationDuration[0] > 0) {\r\n self._$tooltip.delay(self.__options.animationDuration[0]);\r\n }\r\n\r\n self._$tooltip.queue(finish);\r\n }\r\n },\r\n 0\r\n );\r\n }\r\n else {\r\n\r\n // old browsers will have to live with this\r\n self._$tooltip\r\n .css('display', 'none')\r\n .fadeIn(self.__options.animationDuration[0], finish);\r\n }\r\n\r\n // checks if the origin is removed while the tooltip is open\r\n self.__trackerStart();\r\n\r\n // NOTE: the listeners below have a '-triggerClose' namespace\r\n // because we'll remove them when the tooltip closes (unlike\r\n // the '-triggerOpen' listeners). So some of them are actually\r\n // not about close triggers, rather about positioning.\r\n\r\n $(env.window)\r\n // reposition on resize\r\n .on('resize.' + self.__namespace + '-triggerClose', function (e) {\r\n\r\n var $ae = $(document.activeElement);\r\n\r\n // reposition only if the resize event was not triggered upon the opening\r\n // of a virtual keyboard due to an input field being focused within the tooltip\r\n // (otherwise the repositioning would lose the focus)\r\n if ((!$ae.is('input') && !$ae.is('textarea'))\r\n || !$.contains(self._$tooltip[0], $ae[0])\r\n ) {\r\n self.reposition(e);\r\n }\r\n })\r\n // same as below for parents\r\n .on('scroll.' + self.__namespace + '-triggerClose', function (e) {\r\n self.__scrollHandler(e);\r\n });\r\n\r\n self.__$originParents = self._$origin.parents();\r\n\r\n // scrolling may require the tooltip to be moved or even\r\n // repositioned in some cases\r\n self.__$originParents.each(function (i, parent) {\r\n\r\n $(parent).on('scroll.' + self.__namespace + '-triggerClose', function (e) {\r\n self.__scrollHandler(e);\r\n });\r\n });\r\n\r\n if (self.__options.triggerClose.mouseleave\r\n || (self.__options.triggerClose.touchleave && env.hasTouchCapability)\r\n ) {\r\n\r\n // we use an event to allow users/plugins to control when the mouseleave/touchleave\r\n // close triggers will come to action. It allows to have more triggering elements\r\n // than just the origin and the tooltip for example, or to cancel/delay the closing,\r\n // or to make the tooltip interactive even if it wasn't when it was open, etc.\r\n self._on('dismissable', function (event) {\r\n\r\n if (event.dismissable) {\r\n\r\n if (event.delay) {\r\n\r\n timeout = setTimeout(function () {\r\n // event.event may be undefined\r\n self._close(event.event);\r\n }, event.delay);\r\n\r\n self.__timeouts.close.push(timeout);\r\n }\r\n else {\r\n self._close(event);\r\n }\r\n }\r\n else {\r\n clearTimeout(timeout);\r\n }\r\n });\r\n\r\n // now set the listeners that will trigger 'dismissable' events\r\n var $elements = self._$origin,\r\n eventNamesIn = '',\r\n eventNamesOut = '',\r\n timeout = null;\r\n\r\n // if we have to allow interaction, bind on the tooltip too\r\n if (self.__options.interactive) {\r\n $elements = $elements.add(self._$tooltip);\r\n }\r\n\r\n if (self.__options.triggerClose.mouseleave) {\r\n eventNamesIn += 'mouseenter.' + self.__namespace + '-triggerClose ';\r\n eventNamesOut += 'mouseleave.' + self.__namespace + '-triggerClose ';\r\n }\r\n if (self.__options.triggerClose.touchleave && env.hasTouchCapability) {\r\n eventNamesIn += 'touchstart.' + self.__namespace + '-triggerClose';\r\n eventNamesOut += 'touchend.' + self.__namespace + '-triggerClose touchcancel.' + self.__namespace + '-triggerClose';\r\n }\r\n\r\n $elements\r\n // close after some time spent outside of the elements\r\n .on(eventNamesOut, function (event) {\r\n\r\n // it's ok if the touch gesture ended up to be a swipe,\r\n // it's still a \"touch leave\" situation\r\n if (self._touchIsTouchEvent(event)\r\n || !self._touchIsEmulatedEvent(event)\r\n ) {\r\n\r\n var delay = (event.type == 'mouseleave') ?\r\n self.__options.delay :\r\n self.__options.delayTouch;\r\n\r\n self._trigger({\r\n delay: delay[1],\r\n dismissable: true,\r\n event: event,\r\n type: 'dismissable'\r\n });\r\n }\r\n })\r\n // suspend the mouseleave timeout when the pointer comes back\r\n // over the elements\r\n .on(eventNamesIn, function (event) {\r\n\r\n // it's also ok if the touch event is a swipe gesture\r\n if (self._touchIsTouchEvent(event)\r\n || !self._touchIsEmulatedEvent(event)\r\n ) {\r\n self._trigger({\r\n dismissable: false,\r\n event: event,\r\n type: 'dismissable'\r\n });\r\n }\r\n });\r\n }\r\n\r\n // close the tooltip when the origin gets a mouse click (common behavior of\r\n // native tooltips)\r\n if (self.__options.triggerClose.originClick) {\r\n\r\n self._$origin.on('click.' + self.__namespace + '-triggerClose', function (event) {\r\n\r\n // we could actually let a tap trigger this but this feature just\r\n // does not make sense on touch devices\r\n if (!self._touchIsTouchEvent(event)\r\n && !self._touchIsEmulatedEvent(event)\r\n ) {\r\n self._close(event);\r\n }\r\n });\r\n }\r\n\r\n // set the same bindings for click and touch on the body to close the tooltip\r\n if (self.__options.triggerClose.click\r\n || (self.__options.triggerClose.tap && env.hasTouchCapability)\r\n ) {\r\n\r\n // don't set right away since the click/tap event which triggered this method\r\n // (if it was a click/tap) is going to bubble up to the body, we don't want it\r\n // to close the tooltip immediately after it opened\r\n setTimeout(function () {\r\n\r\n if (self.__state != 'closed') {\r\n\r\n var eventNames = '',\r\n $body = $(env.window.document.body);\r\n\r\n if (self.__options.triggerClose.click) {\r\n eventNames += 'click.' + self.__namespace + '-triggerClose ';\r\n }\r\n if (self.__options.triggerClose.tap && env.hasTouchCapability) {\r\n eventNames += 'touchend.' + self.__namespace + '-triggerClose';\r\n }\r\n\r\n $body.on(eventNames, function (event) {\r\n\r\n if (self._touchIsMeaningfulEvent(event)) {\r\n\r\n self._touchRecordEvent(event);\r\n\r\n if (!self.__options.interactive || !$.contains(self._$tooltip[0], event.target)) {\r\n self._close(event);\r\n }\r\n }\r\n });\r\n\r\n // needed to detect and ignore swiping\r\n if (self.__options.triggerClose.tap && env.hasTouchCapability) {\r\n\r\n $body.on('touchstart.' + self.__namespace + '-triggerClose', function (event) {\r\n self._touchRecordEvent(event);\r\n });\r\n }\r\n }\r\n }, 0);\r\n }\r\n\r\n self._trigger('ready');\r\n\r\n // call our custom callback\r\n if (self.__options.functionReady) {\r\n self.__options.functionReady.call(self, self, {\r\n origin: self._$origin[0],\r\n tooltip: self._$tooltip[0]\r\n });\r\n }\r\n }\r\n\r\n // if we have a timer set, let the countdown begin\r\n if (self.__options.timer > 0) {\r\n\r\n var timeout = setTimeout(function () {\r\n self._close();\r\n }, self.__options.timer + extraTime);\r\n\r\n self.__timeouts.close.push(timeout);\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n return self;\r\n },\r\n\r\n /**\r\n * When using the mouseenter/touchstart open triggers, this function will\r\n * schedule the opening of the tooltip after the delay, if there is one\r\n *\r\n * @param event\r\n * @returns {self}\r\n * @protected\r\n */\r\n _openShortly: function (event) {\r\n\r\n var self = this,\r\n ok = true;\r\n\r\n if (self.__state != 'stable' && self.__state != 'appearing') {\r\n\r\n // if a timeout is not already running\r\n if (!self.__timeouts.open) {\r\n\r\n self._trigger({\r\n type: 'start',\r\n event: event,\r\n stop: function () {\r\n ok = false;\r\n }\r\n });\r\n\r\n if (ok) {\r\n\r\n var delay = (event.type.indexOf('touch') == 0) ?\r\n self.__options.delayTouch :\r\n self.__options.delay;\r\n\r\n if (delay[0]) {\r\n\r\n self.__timeouts.open = setTimeout(function () {\r\n\r\n self.__timeouts.open = null;\r\n\r\n // open only if the pointer (mouse or touch) is still over the origin.\r\n // The check on the \"meaningful event\" can only be made here, after some\r\n // time has passed (to know if the touch was a swipe or not)\r\n if (self.__pointerIsOverOrigin && self._touchIsMeaningfulEvent(event)) {\r\n\r\n // signal that we go on\r\n self._trigger('startend');\r\n\r\n self._open(event);\r\n }\r\n else {\r\n // signal that we cancel\r\n self._trigger('startcancel');\r\n }\r\n }, delay[0]);\r\n }\r\n else {\r\n // signal that we go on\r\n self._trigger('startend');\r\n\r\n self._open(event);\r\n }\r\n }\r\n }\r\n }\r\n\r\n return self;\r\n },\r\n\r\n /**\r\n * Meant for plugins to get their options\r\n *\r\n * @param {string} pluginName The name of the plugin that asks for its options\r\n * @param {object} defaultOptions The default options of the plugin\r\n * @returns {object} The options\r\n * @protected\r\n */\r\n _optionsExtract: function (pluginName, defaultOptions) {\r\n\r\n var self = this,\r\n options = $.extend(true, {}, defaultOptions);\r\n\r\n // if the plugin options were isolated in a property named after the\r\n // plugin, use them (prevents conflicts with other plugins)\r\n var pluginOptions = self.__options[pluginName];\r\n\r\n // if not, try to get them as regular options\r\n if (!pluginOptions) {\r\n\r\n pluginOptions = {};\r\n\r\n $.each(defaultOptions, function (optionName, value) {\r\n\r\n var o = self.__options[optionName];\r\n\r\n if (o !== undefined) {\r\n pluginOptions[optionName] = o;\r\n }\r\n });\r\n }\r\n\r\n // let's merge the default options and the ones that were provided. We'd want\r\n // to do a deep copy but not let jQuery merge arrays, so we'll do a shallow\r\n // extend on two levels, that will be enough if options are not more than 1\r\n // level deep\r\n $.each(options, function (optionName, value) {\r\n\r\n if (pluginOptions[optionName] !== undefined) {\r\n\r\n if (( typeof value == 'object'\r\n && !(value instanceof Array)\r\n && value != null\r\n )\r\n &&\r\n ( typeof pluginOptions[optionName] == 'object'\r\n && !(pluginOptions[optionName] instanceof Array)\r\n && pluginOptions[optionName] != null\r\n )\r\n ) {\r\n $.extend(options[optionName], pluginOptions[optionName]);\r\n }\r\n else {\r\n options[optionName] = pluginOptions[optionName];\r\n }\r\n }\r\n });\r\n\r\n return options;\r\n },\r\n\r\n /**\r\n * Used at instantiation of the plugin, or afterwards by plugins that activate themselves\r\n * on existing instances\r\n *\r\n * @param {object} pluginName\r\n * @returns {self}\r\n * @protected\r\n */\r\n _plug: function (pluginName) {\r\n\r\n var plugin = $.tooltipster._plugin(pluginName);\r\n\r\n if (plugin) {\r\n\r\n // if there is a constructor for instances\r\n if (plugin.instance) {\r\n\r\n // proxy non-private methods on the instance to allow new instance methods\r\n $.tooltipster.__bridge(plugin.instance, this, plugin.name);\r\n }\r\n }\r\n else {\r\n throw new Error('The \"' + pluginName + '\" plugin is not defined');\r\n }\r\n\r\n return this;\r\n },\r\n\r\n /**\r\n * This will return true if the event is a mouse event which was\r\n * emulated by the browser after a touch event. This allows us to\r\n * really dissociate mouse and touch triggers.\r\n *\r\n * There is a margin of error if a real mouse event is fired right\r\n * after (within the delay shown below) a touch event on the same\r\n * element, but hopefully it should not happen often.\r\n *\r\n * @returns {boolean}\r\n * @protected\r\n */\r\n _touchIsEmulatedEvent: function (event) {\r\n\r\n var isEmulated = false,\r\n now = new Date().getTime();\r\n\r\n for (var i = this.__touchEvents.length - 1; i >= 0; i--) {\r\n\r\n var e = this.__touchEvents[i];\r\n\r\n // delay, in milliseconds. It's supposed to be 300ms in\r\n // most browsers (350ms on iOS) to allow a double tap but\r\n // can be less (check out FastClick for more info)\r\n if (now - e.time < 500) {\r\n\r\n if (e.target === event.target) {\r\n isEmulated = true;\r\n }\r\n }\r\n else {\r\n break;\r\n }\r\n }\r\n\r\n return isEmulated;\r\n },\r\n\r\n /**\r\n * Returns false if the event was an emulated mouse event or\r\n * a touch event involved in a swipe gesture.\r\n *\r\n * @param {object} event\r\n * @returns {boolean}\r\n * @protected\r\n */\r\n _touchIsMeaningfulEvent: function (event) {\r\n return (\r\n (this._touchIsTouchEvent(event) && !this._touchSwiped(event.target))\r\n || (!this._touchIsTouchEvent(event) && !this._touchIsEmulatedEvent(event))\r\n );\r\n },\r\n\r\n /**\r\n * Checks if an event is a touch event\r\n *\r\n * @param {object} event\r\n * @returns {boolean}\r\n * @protected\r\n */\r\n _touchIsTouchEvent: function (event) {\r\n return event.type.indexOf('touch') == 0;\r\n },\r\n\r\n /**\r\n * Store touch events for a while to detect swiping and emulated mouse events\r\n *\r\n * @param {object} event\r\n * @returns {self}\r\n * @protected\r\n */\r\n _touchRecordEvent: function (event) {\r\n\r\n if (this._touchIsTouchEvent(event)) {\r\n event.time = new Date().getTime();\r\n this.__touchEvents.push(event);\r\n }\r\n\r\n return this;\r\n },\r\n\r\n /**\r\n * Returns true if a swipe happened after the last touchstart event fired on\r\n * event.target.\r\n *\r\n * We need to differentiate a swipe from a tap before we let the event open\r\n * or close the tooltip. A swipe is when a touchmove (scroll) event happens\r\n * on the body between the touchstart and the touchend events of an element.\r\n *\r\n * @param {object} target The HTML element that may have triggered the swipe\r\n * @returns {boolean}\r\n * @protected\r\n */\r\n _touchSwiped: function (target) {\r\n\r\n var swiped = false;\r\n\r\n for (var i = this.__touchEvents.length - 1; i >= 0; i--) {\r\n\r\n var e = this.__touchEvents[i];\r\n\r\n if (e.type == 'touchmove') {\r\n swiped = true;\r\n break;\r\n }\r\n else if (\r\n e.type == 'touchstart'\r\n && target === e.target\r\n ) {\r\n break;\r\n }\r\n }\r\n\r\n return swiped;\r\n },\r\n\r\n /**\r\n * Triggers an event on the instance emitters\r\n *\r\n * @returns {self}\r\n * @protected\r\n */\r\n _trigger: function () {\r\n\r\n var args = Array.prototype.slice.apply(arguments);\r\n\r\n if (typeof args[0] == 'string') {\r\n args[0] = {type: args[0]};\r\n }\r\n\r\n // add properties to the event\r\n args[0].instance = this;\r\n args[0].origin = this._$origin ? this._$origin[0] : null;\r\n args[0].tooltip = this._$tooltip ? this._$tooltip[0] : null;\r\n\r\n // note: the order of emitters matters\r\n this.__$emitterPrivate.trigger.apply(this.__$emitterPrivate, args);\r\n $.tooltipster._trigger.apply($.tooltipster, args);\r\n this.__$emitterPublic.trigger.apply(this.__$emitterPublic, args);\r\n\r\n return this;\r\n },\r\n\r\n /**\r\n * Deactivate a plugin on this instance\r\n *\r\n * @returns {self}\r\n * @protected\r\n */\r\n _unplug: function (pluginName) {\r\n\r\n var self = this;\r\n\r\n // if the plugin has been activated on this instance\r\n if (self[pluginName]) {\r\n\r\n var plugin = $.tooltipster._plugin(pluginName);\r\n\r\n // if there is a constructor for instances\r\n if (plugin.instance) {\r\n\r\n // unbridge\r\n $.each(plugin.instance, function (methodName, fn) {\r\n\r\n // if the method exists (privates methods do not) and comes indeed from\r\n // this plugin (may be missing or come from a conflicting plugin).\r\n if (self[methodName]\r\n && self[methodName].bridged === self[pluginName]\r\n ) {\r\n delete self[methodName];\r\n }\r\n });\r\n }\r\n\r\n // destroy the plugin\r\n if (self[pluginName].__destroy) {\r\n self[pluginName].__destroy();\r\n }\r\n\r\n // remove the reference to the plugin instance\r\n delete self[pluginName];\r\n }\r\n\r\n return self;\r\n },\r\n\r\n /**\r\n * @see self::_close\r\n * @returns {self}\r\n * @public\r\n */\r\n close: function (callback) {\r\n\r\n if (!this.__destroyed) {\r\n this._close(null, callback);\r\n }\r\n else {\r\n this.__destroyError();\r\n }\r\n\r\n return this;\r\n },\r\n\r\n /**\r\n * Sets or gets the content of the tooltip\r\n *\r\n * @returns {mixed|self}\r\n * @public\r\n */\r\n content: function (content) {\r\n\r\n var self = this;\r\n\r\n // getter method\r\n if (content === undefined) {\r\n return self.__Content;\r\n }\r\n // setter method\r\n else {\r\n\r\n if (!self.__destroyed) {\r\n\r\n // change the content\r\n self.__contentSet(content);\r\n\r\n if (self.__Content !== null) {\r\n\r\n // update the tooltip if it is open\r\n if (self.__state !== 'closed') {\r\n\r\n // reset the content in the tooltip\r\n self.__contentInsert();\r\n\r\n // reposition and resize the tooltip\r\n self.reposition();\r\n\r\n // if we want to play a little animation showing the content changed\r\n if (self.__options.updateAnimation) {\r\n\r\n if (env.hasTransitions) {\r\n\r\n // keep the reference in the local scope\r\n var animation = self.__options.updateAnimation;\r\n\r\n self._$tooltip.addClass('tooltipster-update-' + animation);\r\n\r\n // remove the class after a while. The actual duration of the\r\n // update animation may be shorter, it's set in the CSS rules\r\n setTimeout(function () {\r\n\r\n if (self.__state != 'closed') {\r\n\r\n self._$tooltip.removeClass('tooltipster-update-' + animation);\r\n }\r\n }, 1000);\r\n }\r\n else {\r\n self._$tooltip.fadeTo(200, 0.5, function () {\r\n if (self.__state != 'closed') {\r\n self._$tooltip.fadeTo(200, 1);\r\n }\r\n });\r\n }\r\n }\r\n }\r\n }\r\n else {\r\n self._close();\r\n }\r\n }\r\n else {\r\n self.__destroyError();\r\n }\r\n\r\n return self;\r\n }\r\n },\r\n\r\n /**\r\n * Destroys the tooltip\r\n *\r\n * @returns {self}\r\n * @public\r\n */\r\n destroy: function () {\r\n\r\n var self = this;\r\n\r\n if (!self.__destroyed) {\r\n\r\n if (self.__state != 'closed') {\r\n\r\n // no closing delay\r\n self.option('animationDuration', 0)\r\n // force closing\r\n ._close(null, null, true);\r\n }\r\n else {\r\n // there might be an open timeout still running\r\n self.__timeoutsClear();\r\n }\r\n\r\n // send event\r\n self._trigger('destroy');\r\n\r\n self.__destroyed = true;\r\n\r\n self._$origin\r\n .removeData(self.__namespace)\r\n // remove the open trigger listeners\r\n .off('.' + self.__namespace + '-triggerOpen');\r\n\r\n // remove the touch listener\r\n $(env.window.document.body).off('.' + self.__namespace + '-triggerOpen');\r\n\r\n var ns = self._$origin.data('tooltipster-ns');\r\n\r\n // if the origin has been removed from DOM, its data may\r\n // well have been destroyed in the process and there would\r\n // be nothing to clean up or restore\r\n if (ns) {\r\n\r\n // if there are no more tooltips on this element\r\n if (ns.length === 1) {\r\n\r\n // optional restoration of a title attribute\r\n var title = null;\r\n if (self.__options.restoration == 'previous') {\r\n title = self._$origin.data('tooltipster-initialTitle');\r\n }\r\n else if (self.__options.restoration == 'current') {\r\n\r\n // old school technique to stringify when outerHTML is not supported\r\n title = (typeof self.__Content == 'string') ?\r\n self.__Content :\r\n $('
    ').append(self.__Content).html();\r\n }\r\n\r\n if (title) {\r\n self._$origin.attr('title', title);\r\n }\r\n\r\n // final cleaning\r\n\r\n self._$origin.removeClass('tooltipstered');\r\n\r\n self._$origin\r\n .removeData('tooltipster-ns')\r\n .removeData('tooltipster-initialTitle');\r\n }\r\n else {\r\n // remove the instance namespace from the list of namespaces of\r\n // tooltips present on the element\r\n ns = $.grep(ns, function (el, i) {\r\n return el !== self.__namespace;\r\n });\r\n self._$origin.data('tooltipster-ns', ns);\r\n }\r\n }\r\n\r\n // last event\r\n self._trigger('destroyed');\r\n\r\n // unbind private and public event listeners\r\n self._off();\r\n self.off();\r\n\r\n // remove external references, just in case\r\n self.__Content = null;\r\n self.__$emitterPrivate = null;\r\n self.__$emitterPublic = null;\r\n self.__options.parent = null;\r\n self._$origin = null;\r\n self._$tooltip = null;\r\n\r\n // make sure the object is no longer referenced in there to prevent\r\n // memory leaks\r\n $.tooltipster.__instancesLatestArr = $.grep($.tooltipster.__instancesLatestArr, function (el, i) {\r\n return self !== el;\r\n });\r\n\r\n clearInterval(self.__garbageCollector);\r\n }\r\n else {\r\n self.__destroyError();\r\n }\r\n\r\n // we return the scope rather than true so that the call to\r\n // .tooltipster('destroy') actually returns the matched elements\r\n // and applies to all of them\r\n return self;\r\n },\r\n\r\n /**\r\n * Disables the tooltip\r\n *\r\n * @returns {self}\r\n * @public\r\n */\r\n disable: function () {\r\n\r\n if (!this.__destroyed) {\r\n\r\n // close first, in case the tooltip would not disappear on\r\n // its own (no close trigger)\r\n this._close();\r\n this.__enabled = false;\r\n\r\n return this;\r\n }\r\n else {\r\n this.__destroyError();\r\n }\r\n\r\n return this;\r\n },\r\n\r\n /**\r\n * Returns the HTML element of the origin\r\n *\r\n * @returns {self}\r\n * @public\r\n */\r\n elementOrigin: function () {\r\n\r\n if (!this.__destroyed) {\r\n return this._$origin[0];\r\n }\r\n else {\r\n this.__destroyError();\r\n }\r\n },\r\n\r\n /**\r\n * Returns the HTML element of the tooltip\r\n *\r\n * @returns {self}\r\n * @public\r\n */\r\n elementTooltip: function () {\r\n return this._$tooltip ? this._$tooltip[0] : null;\r\n },\r\n\r\n /**\r\n * Enables the tooltip\r\n *\r\n * @returns {self}\r\n * @public\r\n */\r\n enable: function () {\r\n this.__enabled = true;\r\n return this;\r\n },\r\n\r\n /**\r\n * Alias, deprecated in 4.0.0\r\n *\r\n * @param {function} callback\r\n * @returns {self}\r\n * @public\r\n */\r\n hide: function (callback) {\r\n return this.close(callback);\r\n },\r\n\r\n /**\r\n * Returns the instance\r\n *\r\n * @returns {self}\r\n * @public\r\n */\r\n instance: function () {\r\n return this;\r\n },\r\n\r\n /**\r\n * For public use only, not to be used by plugins (use ::_off() instead)\r\n *\r\n * @returns {self}\r\n * @public\r\n */\r\n off: function () {\r\n\r\n if (!this.__destroyed) {\r\n this.__$emitterPublic.off.apply(this.__$emitterPublic, Array.prototype.slice.apply(arguments));\r\n }\r\n\r\n return this;\r\n },\r\n\r\n /**\r\n * For public use only, not to be used by plugins (use ::_on() instead)\r\n *\r\n * @returns {self}\r\n * @public\r\n */\r\n on: function () {\r\n\r\n if (!this.__destroyed) {\r\n this.__$emitterPublic.on.apply(this.__$emitterPublic, Array.prototype.slice.apply(arguments));\r\n }\r\n else {\r\n this.__destroyError();\r\n }\r\n\r\n return this;\r\n },\r\n\r\n /**\r\n * For public use only, not to be used by plugins\r\n *\r\n * @returns {self}\r\n * @public\r\n */\r\n one: function () {\r\n\r\n if (!this.__destroyed) {\r\n this.__$emitterPublic.one.apply(this.__$emitterPublic, Array.prototype.slice.apply(arguments));\r\n }\r\n else {\r\n this.__destroyError();\r\n }\r\n\r\n return this;\r\n },\r\n\r\n /**\r\n * @see self::_open\r\n * @returns {self}\r\n * @public\r\n */\r\n open: function (callback) {\r\n\r\n if (!this.__destroyed) {\r\n this._open(null, callback);\r\n }\r\n else {\r\n this.__destroyError();\r\n }\r\n\r\n return this;\r\n },\r\n\r\n /**\r\n * Get or set options. For internal use and advanced users only.\r\n *\r\n * @param {string} o Option name\r\n * @param {mixed} val optional A new value for the option\r\n * @return {mixed|self} If val is omitted, the value of the option\r\n * is returned, otherwise the instance itself is returned\r\n * @public\r\n */\r\n option: function (o, val) {\r\n\r\n // getter\r\n if (val === undefined) {\r\n return this.__options[o];\r\n }\r\n // setter\r\n else {\r\n\r\n if (!this.__destroyed) {\r\n\r\n // change value\r\n this.__options[o] = val;\r\n\r\n // format\r\n this.__optionsFormat();\r\n\r\n // re-prepare the triggers if needed\r\n if ($.inArray(o, ['trigger', 'triggerClose', 'triggerOpen']) >= 0) {\r\n this.__prepareOrigin();\r\n }\r\n\r\n if (o === 'selfDestruction') {\r\n this.__prepareGC();\r\n }\r\n }\r\n else {\r\n this.__destroyError();\r\n }\r\n\r\n return this;\r\n }\r\n },\r\n\r\n /**\r\n * This method is in charge of setting the position and size properties of the tooltip.\r\n * All the hard work is delegated to the display plugin.\r\n * Note: The tooltip may be detached from the DOM at the moment the method is called\r\n * but must be attached by the end of the method call.\r\n *\r\n * @param {object} event For internal use only. Defined if an event such as\r\n * window resizing triggered the repositioning\r\n * @param {boolean} tooltipIsDetached For internal use only. Set this to true if you\r\n * know that the tooltip not being in the DOM is not an issue (typically when the\r\n * tooltip element has just been created but has not been added to the DOM yet).\r\n * @returns {self}\r\n * @public\r\n */\r\n reposition: function (event, tooltipIsDetached) {\r\n\r\n var self = this;\r\n\r\n if (!self.__destroyed) {\r\n\r\n // if the tooltip is still open and the origin is still in the DOM\r\n if (self.__state != 'closed' && bodyContains(self._$origin)) {\r\n\r\n // if the tooltip has not been removed from DOM manually (or if it\r\n // has been detached on purpose)\r\n if (tooltipIsDetached || bodyContains(self._$tooltip)) {\r\n\r\n if (!tooltipIsDetached) {\r\n // detach in case the tooltip overflows the window and adds\r\n // scrollbars to it, so __geometry can be accurate\r\n self._$tooltip.detach();\r\n }\r\n\r\n // refresh the geometry object before passing it as a helper\r\n self.__Geometry = self.__geometry();\r\n\r\n // let a plugin fo the rest\r\n self._trigger({\r\n type: 'reposition',\r\n event: event,\r\n helper: {\r\n geo: self.__Geometry\r\n }\r\n });\r\n }\r\n }\r\n }\r\n else {\r\n self.__destroyError();\r\n }\r\n\r\n return self;\r\n },\r\n\r\n /**\r\n * Alias, deprecated in 4.0.0\r\n *\r\n * @param callback\r\n * @returns {self}\r\n * @public\r\n */\r\n show: function (callback) {\r\n return this.open(callback);\r\n },\r\n\r\n /**\r\n * Returns some properties about the instance\r\n *\r\n * @returns {object}\r\n * @public\r\n */\r\n status: function () {\r\n\r\n return {\r\n destroyed: this.__destroyed,\r\n enabled: this.__enabled,\r\n open: this.__state !== 'closed',\r\n state: this.__state\r\n };\r\n },\r\n\r\n /**\r\n * For public use only, not to be used by plugins\r\n *\r\n * @returns {self}\r\n * @public\r\n */\r\n triggerHandler: function () {\r\n\r\n if (!this.__destroyed) {\r\n this.__$emitterPublic.triggerHandler.apply(this.__$emitterPublic, Array.prototype.slice.apply(arguments));\r\n }\r\n else {\r\n this.__destroyError();\r\n }\r\n\r\n return this;\r\n }\r\n };\r\n\r\n $.fn.tooltipster = function () {\r\n\r\n // for using in closures\r\n var args = Array.prototype.slice.apply(arguments),\r\n // common mistake: an HTML element can't be in several tooltips at the same time\r\n contentCloningWarning = 'You are using a single HTML element as content for several tooltips. You probably want to set the contentCloning option to TRUE.';\r\n\r\n // this happens with $(sel).tooltipster(...) when $(sel) does not match anything\r\n if (this.length === 0) {\r\n\r\n // still chainable\r\n return this;\r\n }\r\n // this happens when calling $(sel).tooltipster('methodName or options')\r\n // where $(sel) matches one or more elements\r\n else {\r\n\r\n // method calls\r\n if (typeof args[0] === 'string') {\r\n\r\n var v = '#*$~&';\r\n\r\n this.each(function () {\r\n\r\n // retrieve the namepaces of the tooltip(s) that exist on that element.\r\n // We will interact with the first tooltip only.\r\n var ns = $(this).data('tooltipster-ns'),\r\n // self represents the instance of the first tooltipster plugin\r\n // associated to the current HTML object of the loop\r\n self = ns ? $(this).data(ns[0]) : null;\r\n\r\n // if the current element holds a tooltipster instance\r\n if (self) {\r\n\r\n if (typeof self[args[0]] === 'function') {\r\n\r\n if (this.length > 1\r\n && args[0] == 'content'\r\n && ( args[1] instanceof $\r\n || (typeof args[1] == 'object' && args[1] != null && args[1].tagName)\r\n )\r\n && !self.__options.contentCloning\r\n && self.__options.debug\r\n ) {\r\n console.log(contentCloningWarning);\r\n }\r\n\r\n // note : args[1] and args[2] may not be defined\r\n var resp = self[args[0]](args[1], args[2]);\r\n }\r\n else {\r\n throw new Error('Unknown method \"' + args[0] + '\"');\r\n }\r\n\r\n // if the function returned anything other than the instance\r\n // itself (which implies chaining, except for the `instance` method)\r\n if (resp !== self || args[0] === 'instance') {\r\n\r\n v = resp;\r\n\r\n // return false to stop .each iteration on the first element\r\n // matched by the selector\r\n return false;\r\n }\r\n }\r\n else {\r\n throw new Error('You called Tooltipster\\'s \"' + args[0] + '\" method on an uninitialized element');\r\n }\r\n });\r\n\r\n return (v !== '#*$~&') ? v : this;\r\n }\r\n // first argument is undefined or an object: the tooltip is initializing\r\n else {\r\n\r\n // reset the array of last initialized objects\r\n $.tooltipster.__instancesLatestArr = [];\r\n\r\n // is there a defined value for the multiple option in the options object ?\r\n var multipleIsSet = args[0] && args[0].multiple !== undefined,\r\n // if the multiple option is set to true, or if it's not defined but\r\n // set to true in the defaults\r\n multiple = (multipleIsSet && args[0].multiple) || (!multipleIsSet && defaults.multiple),\r\n // same for content\r\n contentIsSet = args[0] && args[0].content !== undefined,\r\n content = (contentIsSet && args[0].content) || (!contentIsSet && defaults.content),\r\n // same for contentCloning\r\n contentCloningIsSet = args[0] && args[0].contentCloning !== undefined,\r\n contentCloning =\r\n (contentCloningIsSet && args[0].contentCloning)\r\n || (!contentCloningIsSet && defaults.contentCloning),\r\n // same for debug\r\n debugIsSet = args[0] && args[0].debug !== undefined,\r\n debug = (debugIsSet && args[0].debug) || (!debugIsSet && defaults.debug);\r\n\r\n if (this.length > 1\r\n && ( content instanceof $\r\n || (typeof content == 'object' && content != null && content.tagName)\r\n )\r\n && !contentCloning\r\n && debug\r\n ) {\r\n console.log(contentCloningWarning);\r\n }\r\n\r\n // create a tooltipster instance for each element if it doesn't\r\n // already have one or if the multiple option is set, and attach the\r\n // object to it\r\n this.each(function () {\r\n\r\n var go = false,\r\n $this = $(this),\r\n ns = $this.data('tooltipster-ns'),\r\n obj = null;\r\n\r\n if (!ns) {\r\n go = true;\r\n }\r\n else if (multiple) {\r\n go = true;\r\n }\r\n else if (debug) {\r\n console.log('Tooltipster: one or more tooltips are already attached to the element below. Ignoring.');\r\n console.log(this);\r\n }\r\n\r\n if (go) {\r\n obj = new $.Tooltipster(this, args[0]);\r\n\r\n // save the reference of the new instance\r\n if (!ns) ns = [];\r\n ns.push(obj.__namespace);\r\n $this.data('tooltipster-ns', ns);\r\n\r\n // save the instance itself\r\n $this.data(obj.__namespace, obj);\r\n\r\n // call our constructor custom function.\r\n // we do this here and not in ::init() because we wanted\r\n // the object to be saved in $this.data before triggering\r\n // it\r\n if (obj.__options.functionInit) {\r\n obj.__options.functionInit.call(obj, obj, {\r\n origin: this\r\n });\r\n }\r\n\r\n // and now the event, for the plugins and core emitter\r\n obj._trigger('init');\r\n }\r\n\r\n $.tooltipster.__instancesLatestArr.push(obj);\r\n });\r\n\r\n return this;\r\n }\r\n }\r\n };\r\n\r\n// Utilities\r\n\r\n /**\r\n * A class to check if a tooltip can fit in given dimensions\r\n *\r\n * @param {object} $tooltip The jQuery wrapped tooltip element, or a clone of it\r\n */\r\n function Ruler($tooltip) {\r\n\r\n // list of instance variables\r\n\r\n this.$container;\r\n this.constraints = null;\r\n this.__$tooltip;\r\n\r\n this.__init($tooltip);\r\n }\r\n\r\n Ruler.prototype = {\r\n\r\n /**\r\n * Move the tooltip into an invisible div that does not allow overflow to make\r\n * size tests. Note: the tooltip may or may not be attached to the DOM at the\r\n * moment this method is called, it does not matter.\r\n *\r\n * @param {object} $tooltip The object to test. May be just a clone of the\r\n * actual tooltip.\r\n * @private\r\n */\r\n __init: function ($tooltip) {\r\n\r\n this.__$tooltip = $tooltip;\r\n\r\n this.__$tooltip\r\n .css({\r\n // for some reason we have to specify top and left 0\r\n left: 0,\r\n // any overflow will be ignored while measuring\r\n overflow: 'hidden',\r\n // positions at (0,0) without the div using 100% of the available width\r\n position: 'absolute',\r\n top: 0\r\n })\r\n // overflow must be auto during the test. We re-set this in case\r\n // it were modified by the user\r\n .find('.tooltipster-content')\r\n .css('overflow', 'auto');\r\n\r\n this.$container = $('
    ')\r\n .append(this.__$tooltip)\r\n .appendTo(env.window.document.body);\r\n },\r\n\r\n /**\r\n * Force the browser to redraw (re-render) the tooltip immediately. This is required\r\n * when you changed some CSS properties and need to make something with it\r\n * immediately, without waiting for the browser to redraw at the end of instructions.\r\n *\r\n * @see http://stackoverflow.com/questions/3485365/how-can-i-force-webkit-to-redraw-repaint-to-propagate-style-changes\r\n * @private\r\n */\r\n __forceRedraw: function () {\r\n\r\n // note: this would work but for Webkit only\r\n //this.__$tooltip.close();\r\n //this.__$tooltip[0].offsetHeight;\r\n //this.__$tooltip.open();\r\n\r\n // works in FF too\r\n var $p = this.__$tooltip.parent();\r\n this.__$tooltip.detach();\r\n this.__$tooltip.appendTo($p);\r\n },\r\n\r\n /**\r\n * Set maximum dimensions for the tooltip. A call to ::measure afterwards\r\n * will tell us if the content overflows or if it's ok\r\n *\r\n * @param {int} width\r\n * @param {int} height\r\n * @return {Ruler}\r\n * @public\r\n */\r\n constrain: function (width, height) {\r\n\r\n this.constraints = {\r\n width: width,\r\n height: height\r\n };\r\n\r\n this.__$tooltip.css({\r\n // we disable display:flex, otherwise the content would overflow without\r\n // creating horizontal scrolling (which we need to detect).\r\n display: 'block',\r\n // reset any previous height\r\n height: '',\r\n // we'll check if horizontal scrolling occurs\r\n overflow: 'auto',\r\n // we'll set the width and see what height is generated and if there\r\n // is horizontal overflow\r\n width: width\r\n });\r\n\r\n return this;\r\n },\r\n\r\n /**\r\n * Reset the tooltip content overflow and remove the test container\r\n *\r\n * @returns {Ruler}\r\n * @public\r\n */\r\n destroy: function () {\r\n\r\n // in case the element was not a clone\r\n this.__$tooltip\r\n .detach()\r\n .find('.tooltipster-content')\r\n .css({\r\n // reset to CSS value\r\n display: '',\r\n overflow: ''\r\n });\r\n\r\n this.$container.remove();\r\n },\r\n\r\n /**\r\n * Removes any constraints\r\n *\r\n * @returns {Ruler}\r\n * @public\r\n */\r\n free: function () {\r\n\r\n this.constraints = null;\r\n\r\n // reset to natural size\r\n this.__$tooltip.css({\r\n display: '',\r\n height: '',\r\n overflow: 'visible',\r\n width: ''\r\n });\r\n\r\n return this;\r\n },\r\n\r\n /**\r\n * Returns the size of the tooltip. When constraints are applied, also returns\r\n * whether the tooltip fits in the provided dimensions.\r\n * The idea is to see if the new height is small enough and if the content does\r\n * not overflow horizontally.\r\n *\r\n * @param {int} width\r\n * @param {int} height\r\n * @returns {object} An object with a bool `fits` property and a `size` property\r\n * @public\r\n */\r\n measure: function () {\r\n\r\n this.__forceRedraw();\r\n\r\n var tooltipBcr = this.__$tooltip[0].getBoundingClientRect(),\r\n result = {\r\n size: {\r\n // bcr.width/height are not defined in IE8- but in this\r\n // case, bcr.right/bottom will have the same value\r\n // except in iOS 8+ where tooltipBcr.bottom/right are wrong\r\n // after scrolling for reasons yet to be determined.\r\n // tooltipBcr.top/left might not be 0, see issue #514\r\n height: tooltipBcr.height || (tooltipBcr.bottom - tooltipBcr.top),\r\n width: tooltipBcr.width || (tooltipBcr.right - tooltipBcr.left)\r\n }\r\n };\r\n\r\n if (this.constraints) {\r\n\r\n // note: we used to use offsetWidth instead of boundingRectClient but\r\n // it returned rounded values, causing issues with sub-pixel layouts.\r\n\r\n // note2: noticed that the bcrWidth of text content of a div was once\r\n // greater than the bcrWidth of its container by 1px, causing the final\r\n // tooltip box to be too small for its content. However, evaluating\r\n // their widths one against the other (below) surprisingly returned\r\n // equality. Happened only once in Chrome 48, was not able to reproduce\r\n // => just having fun with float position values...\r\n\r\n var $content = this.__$tooltip.find('.tooltipster-content'),\r\n height = this.__$tooltip.outerHeight(),\r\n contentBcr = $content[0].getBoundingClientRect(),\r\n fits = {\r\n height: height <= this.constraints.height,\r\n width: (\r\n // this condition accounts for min-width property that\r\n // may apply\r\n tooltipBcr.width <= this.constraints.width\r\n // the -1 is here because scrollWidth actually returns\r\n // a rounded value, and may be greater than bcr.width if\r\n // it was rounded up. This may cause an issue for contents\r\n // which actually really overflow by 1px or so, but that\r\n // should be rare. Not sure how to solve this efficiently.\r\n // See http://blogs.msdn.com/b/ie/archive/2012/02/17/sub-pixel-rendering-and-the-css-object-model.aspx\r\n && contentBcr.width >= $content[0].scrollWidth - 1\r\n )\r\n };\r\n\r\n result.fits = fits.height && fits.width;\r\n }\r\n\r\n // old versions of IE get the width wrong for some reason and it causes\r\n // the text to be broken to a new line, so we round it up. If the width\r\n // is the width of the screen though, we can assume it is accurate.\r\n if (env.IE\r\n && env.IE <= 11\r\n && result.size.width !== env.window.document.documentElement.clientWidth\r\n ) {\r\n result.size.width = Math.ceil(result.size.width) + 1;\r\n }\r\n\r\n return result;\r\n }\r\n };\r\n\r\n// quick & dirty compare function, not bijective nor multidimensional\r\n function areEqual(a, b) {\r\n var same = true;\r\n $.each(a, function (i, _) {\r\n if (b[i] === undefined || a[i] !== b[i]) {\r\n same = false;\r\n return false;\r\n }\r\n });\r\n return same;\r\n }\r\n\r\n /**\r\n * A fast function to check if an element is still in the DOM. It\r\n * tries to use an id as ids are indexed by the browser, or falls\r\n * back to jQuery's `contains` method. May fail if two elements\r\n * have the same id, but so be it\r\n *\r\n * @param {object} $obj A jQuery-wrapped HTML element\r\n * @return {boolean}\r\n */\r\n function bodyContains($obj) {\r\n var id = $obj.attr('id'),\r\n el = id ? env.window.document.getElementById(id) : null;\r\n // must also check that the element with the id is the one we want\r\n return el ? el === $obj[0] : $.contains(env.window.document.body, $obj[0]);\r\n }\r\n\r\n// detect IE versions for dirty fixes\r\n var uA = navigator.userAgent.toLowerCase();\r\n if (uA.indexOf('msie') != -1) env.IE = parseInt(uA.split('msie')[1]);\r\n else if (uA.toLowerCase().indexOf('trident') !== -1 && uA.indexOf(' rv:11') !== -1) env.IE = 11;\r\n else if (uA.toLowerCase().indexOf('edge/') != -1) env.IE = parseInt(uA.toLowerCase().split('edge/')[1]);\r\n\r\n// detecting support for CSS transitions\r\n function transitionSupport() {\r\n\r\n // env.window is not defined yet when this is called\r\n if (!win) return false;\r\n\r\n var b = win.document.body || win.document.documentElement,\r\n s = b.style,\r\n p = 'transition',\r\n v = ['Moz', 'Webkit', 'Khtml', 'O', 'ms'];\r\n\r\n if (typeof s[p] == 'string') {\r\n return true;\r\n }\r\n\r\n p = p.charAt(0).toUpperCase() + p.substr(1);\r\n for (var i = 0; i < v.length; i++) {\r\n if (typeof s[v[i] + p] == 'string') {\r\n return true;\r\n }\r\n }\r\n return false;\r\n }\r\n\r\n// we'll return jQuery for plugins not to have to declare it as a dependency,\r\n// but it's done by a build task since it should be included only once at the\r\n// end when we concatenate the main file with a plugin\r\n// sideTip is Tooltipster's default plugin.\r\n// This file will be UMDified by a build task.\r\n\r\n var pluginName = 'tooltipster.sideTip';\r\n\r\n $.tooltipster._plugin({\r\n name: pluginName,\r\n instance: {\r\n /**\r\n * Defaults are provided as a function for an easy override by inheritance\r\n *\r\n * @return {object} An object with the defaults options\r\n * @private\r\n */\r\n __defaults: function () {\r\n\r\n return {\r\n // if the tooltip should display an arrow that points to the origin\r\n arrow: true,\r\n // the distance in pixels between the tooltip and the origin\r\n distance: 6,\r\n // allows to easily change the position of the tooltip\r\n functionPosition: null,\r\n maxWidth: null,\r\n // used to accomodate the arrow of tooltip if there is one.\r\n // First to make sure that the arrow target is not too close\r\n // to the edge of the tooltip, so the arrow does not overflow\r\n // the tooltip. Secondly when we reposition the tooltip to\r\n // make sure that it's positioned in such a way that the arrow is\r\n // still pointing at the target (and not a few pixels beyond it).\r\n // It should be equal to or greater than half the width of\r\n // the arrow (by width we mean the size of the side which touches\r\n // the side of the tooltip).\r\n minIntersection: 16,\r\n minWidth: 0,\r\n // deprecated in 4.0.0. Listed for _optionsExtract to pick it up\r\n position: null,\r\n side: 'top',\r\n // set to false to position the tooltip relatively to the document rather\r\n // than the window when we open it\r\n viewportAware: true\r\n };\r\n },\r\n\r\n /**\r\n * Run once: at instantiation of the plugin\r\n *\r\n * @param {object} instance The tooltipster object that instantiated this plugin\r\n * @private\r\n */\r\n __init: function (instance) {\r\n\r\n var self = this;\r\n\r\n // list of instance variables\r\n\r\n self.__instance = instance;\r\n self.__namespace = 'tooltipster-sideTip-' + Math.round(Math.random() * 1000000);\r\n self.__previousState = 'closed';\r\n self.__options;\r\n\r\n // initial formatting\r\n self.__optionsFormat();\r\n\r\n self.__instance._on('state.' + self.__namespace, function (event) {\r\n\r\n if (event.state == 'closed') {\r\n self.__close();\r\n }\r\n else if (event.state == 'appearing' && self.__previousState == 'closed') {\r\n self.__create();\r\n }\r\n\r\n self.__previousState = event.state;\r\n });\r\n\r\n // reformat every time the options are changed\r\n self.__instance._on('options.' + self.__namespace, function () {\r\n self.__optionsFormat();\r\n });\r\n\r\n self.__instance._on('reposition.' + self.__namespace, function (e) {\r\n self.__reposition(e.event, e.helper);\r\n });\r\n },\r\n\r\n /**\r\n * Called when the tooltip has closed\r\n *\r\n * @private\r\n */\r\n __close: function () {\r\n\r\n // detach our content object first, so the next jQuery's remove()\r\n // call does not unbind its event handlers\r\n if (this.__instance.content() instanceof $) {\r\n this.__instance.content().detach();\r\n }\r\n\r\n // remove the tooltip from the DOM\r\n this.__instance._$tooltip.remove();\r\n this.__instance._$tooltip = null;\r\n },\r\n\r\n /**\r\n * Creates the HTML element of the tooltip.\r\n *\r\n * @private\r\n */\r\n __create: function () {\r\n\r\n // note: we wrap with a .tooltipster-box div to be able to set a margin on it\r\n // (.tooltipster-base must not have one)\r\n var $html = $(\r\n '
    ' +\r\n '
    ' +\r\n '
    ' +\r\n '
    ' +\r\n '
    ' +\r\n '
    ' +\r\n '
    ' +\r\n '
    ' +\r\n '
    ' +\r\n '
    ' +\r\n '
    '\r\n );\r\n\r\n // hide arrow if asked\r\n if (!this.__options.arrow) {\r\n $html\r\n .find('.tooltipster-box')\r\n .css('margin', 0)\r\n .end()\r\n .find('.tooltipster-arrow')\r\n .hide();\r\n }\r\n\r\n // apply min/max width if asked\r\n if (this.__options.minWidth) {\r\n $html.css('min-width', this.__options.minWidth + 'px');\r\n }\r\n if (this.__options.maxWidth) {\r\n $html.css('max-width', this.__options.maxWidth + 'px');\r\n }\r\n\r\n this.__instance._$tooltip = $html;\r\n\r\n // tell the instance that the tooltip element has been created\r\n this.__instance._trigger('created');\r\n },\r\n\r\n /**\r\n * Used when the plugin is to be unplugged\r\n *\r\n * @private\r\n */\r\n __destroy: function () {\r\n this.__instance._off('.' + self.__namespace);\r\n },\r\n\r\n /**\r\n * (Re)compute this.__options from the options declared to the instance\r\n *\r\n * @private\r\n */\r\n __optionsFormat: function () {\r\n\r\n var self = this;\r\n\r\n // get the options\r\n self.__options = self.__instance._optionsExtract(pluginName, self.__defaults());\r\n\r\n // for backward compatibility, deprecated in v4.0.0\r\n if (self.__options.position) {\r\n self.__options.side = self.__options.position;\r\n }\r\n\r\n // options formatting\r\n\r\n // format distance as a four-cell array if it ain't one yet and then make\r\n // it an object with top/bottom/left/right properties\r\n if (typeof self.__options.distance != 'object') {\r\n self.__options.distance = [self.__options.distance];\r\n }\r\n if (self.__options.distance.length < 4) {\r\n\r\n if (self.__options.distance[1] === undefined) self.__options.distance[1] = self.__options.distance[0];\r\n if (self.__options.distance[2] === undefined) self.__options.distance[2] = self.__options.distance[0];\r\n if (self.__options.distance[3] === undefined) self.__options.distance[3] = self.__options.distance[1];\r\n\r\n self.__options.distance = {\r\n top: self.__options.distance[0],\r\n right: self.__options.distance[1],\r\n bottom: self.__options.distance[2],\r\n left: self.__options.distance[3]\r\n };\r\n }\r\n\r\n // let's transform:\r\n // 'top' into ['top', 'bottom', 'right', 'left']\r\n // 'right' into ['right', 'left', 'top', 'bottom']\r\n // 'bottom' into ['bottom', 'top', 'right', 'left']\r\n // 'left' into ['left', 'right', 'top', 'bottom']\r\n if (typeof self.__options.side == 'string') {\r\n\r\n var opposites = {\r\n 'top': 'bottom',\r\n 'right': 'left',\r\n 'bottom': 'top',\r\n 'left': 'right'\r\n };\r\n\r\n self.__options.side = [self.__options.side, opposites[self.__options.side]];\r\n\r\n if (self.__options.side[0] == 'left' || self.__options.side[0] == 'right') {\r\n self.__options.side.push('top', 'bottom');\r\n }\r\n else {\r\n self.__options.side.push('right', 'left');\r\n }\r\n }\r\n\r\n // misc\r\n // disable the arrow in IE6 unless the arrow option was explicitly set to true\r\n if ($.tooltipster._env.IE === 6\r\n && self.__options.arrow !== true\r\n ) {\r\n self.__options.arrow = false;\r\n }\r\n },\r\n\r\n /**\r\n * This method must compute and set the positioning properties of the\r\n * tooltip (left, top, width, height, etc.). It must also make sure the\r\n * tooltip is eventually appended to its parent (since the element may be\r\n * detached from the DOM at the moment the method is called).\r\n *\r\n * We'll evaluate positioning scenarios to find which side can contain the\r\n * tooltip in the best way. We'll consider things relatively to the window\r\n * (unless the user asks not to), then to the document (if need be, or if the\r\n * user explicitly requires the tests to run on the document). For each\r\n * scenario, measures are taken, allowing us to know how well the tooltip\r\n * is going to fit. After that, a sorting function will let us know what\r\n * the best scenario is (we also allow the user to choose his favorite\r\n * scenario by using an event).\r\n *\r\n * @param {object} helper An object that contains variables that plugin\r\n * creators may find useful (see below)\r\n * @param {object} helper.geo An object with many layout properties\r\n * about objects of interest (window, document, origin). This should help\r\n * plugin users compute the optimal position of the tooltip\r\n * @private\r\n */\r\n __reposition: function (event, helper) {\r\n\r\n var self = this,\r\n finalResult,\r\n // to know where to put the tooltip, we need to know on which point\r\n // of the x or y axis we should center it. That coordinate is the target\r\n targets = self.__targetFind(helper),\r\n testResults = [];\r\n\r\n // make sure the tooltip is detached while we make tests on a clone\r\n self.__instance._$tooltip.detach();\r\n\r\n // we could actually provide the original element to the Ruler and\r\n // not a clone, but it just feels right to keep it out of the\r\n // machinery.\r\n var $clone = self.__instance._$tooltip.clone(),\r\n // start position tests session\r\n ruler = $.tooltipster._getRuler($clone),\r\n satisfied = false,\r\n animation = self.__instance.option('animation');\r\n\r\n // an animation class could contain properties that distort the size\r\n if (animation) {\r\n $clone.removeClass('tooltipster-' + animation);\r\n }\r\n\r\n // start evaluating scenarios\r\n $.each(['window', 'document'], function (i, container) {\r\n\r\n var takeTest = null;\r\n\r\n // let the user decide to keep on testing or not\r\n self.__instance._trigger({\r\n container: container,\r\n helper: helper,\r\n satisfied: satisfied,\r\n takeTest: function (bool) {\r\n takeTest = bool;\r\n },\r\n results: testResults,\r\n type: 'positionTest'\r\n });\r\n\r\n if (takeTest == true\r\n || ( takeTest != false\r\n && satisfied == false\r\n // skip the window scenarios if asked. If they are reintegrated by\r\n // the callback of the positionTest event, they will have to be\r\n // excluded using the callback of positionTested\r\n && (container != 'window' || self.__options.viewportAware)\r\n )\r\n ) {\r\n\r\n // for each allowed side\r\n for (var i = 0; i < self.__options.side.length; i++) {\r\n\r\n var distance = {\r\n horizontal: 0,\r\n vertical: 0\r\n },\r\n side = self.__options.side[i];\r\n\r\n if (side == 'top' || side == 'bottom') {\r\n distance.vertical = self.__options.distance[side];\r\n }\r\n else {\r\n distance.horizontal = self.__options.distance[side];\r\n }\r\n\r\n // this may have an effect on the size of the tooltip if there are css\r\n // rules for the arrow or something else\r\n self.__sideChange($clone, side);\r\n\r\n $.each(['natural', 'constrained'], function (i, mode) {\r\n\r\n takeTest = null;\r\n\r\n // emit an event on the instance\r\n self.__instance._trigger({\r\n container: container,\r\n event: event,\r\n helper: helper,\r\n mode: mode,\r\n results: testResults,\r\n satisfied: satisfied,\r\n side: side,\r\n takeTest: function (bool) {\r\n takeTest = bool;\r\n },\r\n type: 'positionTest'\r\n });\r\n\r\n if (takeTest == true\r\n || ( takeTest != false\r\n && satisfied == false\r\n )\r\n ) {\r\n\r\n var testResult = {\r\n container: container,\r\n // we let the distance as an object here, it can make things a little easier\r\n // during the user's calculations at positionTest/positionTested\r\n distance: distance,\r\n // whether the tooltip can fit in the size of the viewport (does not mean\r\n // that we'll be able to make it initially entirely visible, see 'whole')\r\n fits: null,\r\n mode: mode,\r\n outerSize: null,\r\n side: side,\r\n size: null,\r\n target: targets[side],\r\n // check if the origin has enough surface on screen for the tooltip to\r\n // aim at it without overflowing the viewport (this is due to the thickness\r\n // of the arrow represented by the minIntersection length).\r\n // If not, the tooltip will have to be partly or entirely off screen in\r\n // order to stay docked to the origin. This value will stay null when the\r\n // container is the document, as it is not relevant\r\n whole: null\r\n };\r\n\r\n // get the size of the tooltip with or without size constraints\r\n var rulerConfigured = (mode == 'natural') ?\r\n ruler.free() :\r\n ruler.constrain(\r\n helper.geo.available[container][side].width - distance.horizontal,\r\n helper.geo.available[container][side].height - distance.vertical\r\n ),\r\n rulerResults = rulerConfigured.measure();\r\n\r\n testResult.size = rulerResults.size;\r\n testResult.outerSize = {\r\n height: rulerResults.size.height + distance.vertical,\r\n width: rulerResults.size.width + distance.horizontal\r\n };\r\n\r\n if (mode == 'natural') {\r\n\r\n if (helper.geo.available[container][side].width >= testResult.outerSize.width\r\n && helper.geo.available[container][side].height >= testResult.outerSize.height\r\n ) {\r\n testResult.fits = true;\r\n }\r\n else {\r\n testResult.fits = false;\r\n }\r\n }\r\n else {\r\n testResult.fits = rulerResults.fits;\r\n }\r\n\r\n if (container == 'window') {\r\n\r\n if (!testResult.fits) {\r\n testResult.whole = false;\r\n }\r\n else {\r\n if (side == 'top' || side == 'bottom') {\r\n\r\n testResult.whole = (\r\n helper.geo.origin.windowOffset.right >= self.__options.minIntersection\r\n && helper.geo.window.size.width - helper.geo.origin.windowOffset.left >= self.__options.minIntersection\r\n );\r\n }\r\n else {\r\n testResult.whole = (\r\n helper.geo.origin.windowOffset.bottom >= self.__options.minIntersection\r\n && helper.geo.window.size.height - helper.geo.origin.windowOffset.top >= self.__options.minIntersection\r\n );\r\n }\r\n }\r\n }\r\n\r\n testResults.push(testResult);\r\n\r\n // we don't need to compute more positions if we have one fully on screen\r\n if (testResult.whole) {\r\n satisfied = true;\r\n }\r\n else {\r\n // don't run the constrained test unless the natural width was greater\r\n // than the available width, otherwise it's pointless as we know it\r\n // wouldn't fit either\r\n if (testResult.mode == 'natural'\r\n && ( testResult.fits\r\n || testResult.size.width <= helper.geo.available[container][side].width\r\n )\r\n ) {\r\n return false;\r\n }\r\n }\r\n }\r\n });\r\n }\r\n }\r\n });\r\n\r\n // the user may eliminate the unwanted scenarios from testResults, but he's\r\n // not supposed to alter them at this point. functionPosition and the\r\n // position event serve that purpose.\r\n self.__instance._trigger({\r\n edit: function (r) {\r\n testResults = r;\r\n },\r\n event: event,\r\n helper: helper,\r\n results: testResults,\r\n type: 'positionTested'\r\n });\r\n\r\n /**\r\n * Sort the scenarios to find the favorite one.\r\n *\r\n * The favorite scenario is when we can fully display the tooltip on screen,\r\n * even if it means that the middle of the tooltip is no longer centered on\r\n * the middle of the origin (when the origin is near the edge of the screen\r\n * or even partly off screen). We want the tooltip on the preferred side,\r\n * even if it means that we have to use a constrained size rather than a\r\n * natural one (as long as it fits). When the origin is off screen at the top\r\n * the tooltip will be positioned at the bottom (if allowed), if the origin\r\n * is off screen on the right, it will be positioned on the left, etc.\r\n * If there are no scenarios where the tooltip can fit on screen, or if the\r\n * user does not want the tooltip to fit on screen (viewportAware == false),\r\n * we fall back to the scenarios relative to the document.\r\n *\r\n * When the tooltip is bigger than the viewport in either dimension, we stop\r\n * looking at the window scenarios and consider the document scenarios only,\r\n * with the same logic to find on which side it would fit best.\r\n *\r\n * If the tooltip cannot fit the document on any side, we force it at the\r\n * bottom, so at least the user can scroll to see it.\r\n */\r\n testResults.sort(function (a, b) {\r\n\r\n // best if it's whole (the tooltip fits and adapts to the viewport)\r\n if (a.whole && !b.whole) {\r\n return -1;\r\n }\r\n else if (!a.whole && b.whole) {\r\n return 1;\r\n }\r\n else if (a.whole && b.whole) {\r\n\r\n var ai = self.__options.side.indexOf(a.side),\r\n bi = self.__options.side.indexOf(b.side);\r\n\r\n // use the user's sides fallback array\r\n if (ai < bi) {\r\n return -1;\r\n }\r\n else if (ai > bi) {\r\n return 1;\r\n }\r\n else {\r\n // will be used if the user forced the tests to continue\r\n return a.mode == 'natural' ? -1 : 1;\r\n }\r\n }\r\n else {\r\n\r\n // better if it fits\r\n if (a.fits && !b.fits) {\r\n return -1;\r\n }\r\n else if (!a.fits && b.fits) {\r\n return 1;\r\n }\r\n else if (a.fits && b.fits) {\r\n\r\n var ai = self.__options.side.indexOf(a.side),\r\n bi = self.__options.side.indexOf(b.side);\r\n\r\n // use the user's sides fallback array\r\n if (ai < bi) {\r\n return -1;\r\n }\r\n else if (ai > bi) {\r\n return 1;\r\n }\r\n else {\r\n // will be used if the user forced the tests to continue\r\n return a.mode == 'natural' ? -1 : 1;\r\n }\r\n }\r\n else {\r\n\r\n // if everything failed, this will give a preference to the case where\r\n // the tooltip overflows the document at the bottom\r\n if (a.container == 'document'\r\n && a.side == 'bottom'\r\n && a.mode == 'natural'\r\n ) {\r\n return -1;\r\n }\r\n else {\r\n return 1;\r\n }\r\n }\r\n }\r\n });\r\n\r\n finalResult = testResults[0];\r\n\r\n\r\n // now let's find the coordinates of the tooltip relatively to the window\r\n finalResult.coord = {};\r\n\r\n switch (finalResult.side) {\r\n\r\n case 'left':\r\n case 'right':\r\n finalResult.coord.top = Math.floor(finalResult.target - finalResult.size.height / 2);\r\n break;\r\n\r\n case 'bottom':\r\n case 'top':\r\n finalResult.coord.left = Math.floor(finalResult.target - finalResult.size.width / 2);\r\n break;\r\n }\r\n\r\n switch (finalResult.side) {\r\n\r\n case 'left':\r\n finalResult.coord.left = helper.geo.origin.windowOffset.left - finalResult.outerSize.width;\r\n break;\r\n\r\n case 'right':\r\n finalResult.coord.left = helper.geo.origin.windowOffset.right + finalResult.distance.horizontal;\r\n break;\r\n\r\n case 'top':\r\n finalResult.coord.top = helper.geo.origin.windowOffset.top - finalResult.outerSize.height;\r\n break;\r\n\r\n case 'bottom':\r\n finalResult.coord.top = helper.geo.origin.windowOffset.bottom + finalResult.distance.vertical;\r\n break;\r\n }\r\n\r\n // if the tooltip can potentially be contained within the viewport dimensions\r\n // and that we are asked to make it fit on screen\r\n if (finalResult.container == 'window') {\r\n\r\n // if the tooltip overflows the viewport, we'll move it accordingly (then it will\r\n // not be centered on the middle of the origin anymore). We only move horizontally\r\n // for top and bottom tooltips and vice versa.\r\n if (finalResult.side == 'top' || finalResult.side == 'bottom') {\r\n\r\n // if there is an overflow on the left\r\n if (finalResult.coord.left < 0) {\r\n\r\n // prevent the overflow unless the origin itself gets off screen (minus the\r\n // margin needed to keep the arrow pointing at the target)\r\n if (helper.geo.origin.windowOffset.right - this.__options.minIntersection >= 0) {\r\n finalResult.coord.left = 0;\r\n }\r\n else {\r\n finalResult.coord.left = helper.geo.origin.windowOffset.right - this.__options.minIntersection - 1;\r\n }\r\n }\r\n // or an overflow on the right\r\n else if (finalResult.coord.left > helper.geo.window.size.width - finalResult.size.width) {\r\n\r\n if (helper.geo.origin.windowOffset.left + this.__options.minIntersection <= helper.geo.window.size.width) {\r\n finalResult.coord.left = helper.geo.window.size.width - finalResult.size.width;\r\n }\r\n else {\r\n finalResult.coord.left = helper.geo.origin.windowOffset.left + this.__options.minIntersection + 1 - finalResult.size.width;\r\n }\r\n }\r\n }\r\n else {\r\n\r\n // overflow at the top\r\n if (finalResult.coord.top < 0) {\r\n\r\n if (helper.geo.origin.windowOffset.bottom - this.__options.minIntersection >= 0) {\r\n finalResult.coord.top = 0;\r\n }\r\n else {\r\n finalResult.coord.top = helper.geo.origin.windowOffset.bottom - this.__options.minIntersection - 1;\r\n }\r\n }\r\n // or at the bottom\r\n else if (finalResult.coord.top > helper.geo.window.size.height - finalResult.size.height) {\r\n\r\n if (helper.geo.origin.windowOffset.top + this.__options.minIntersection <= helper.geo.window.size.height) {\r\n finalResult.coord.top = helper.geo.window.size.height - finalResult.size.height;\r\n }\r\n else {\r\n finalResult.coord.top = helper.geo.origin.windowOffset.top + this.__options.minIntersection + 1 - finalResult.size.height;\r\n }\r\n }\r\n }\r\n }\r\n else {\r\n\r\n // there might be overflow here too but it's easier to handle. If there has\r\n // to be an overflow, we'll make sure it's on the right side of the screen\r\n // (because the browser will extend the document size if there is an overflow\r\n // on the right, but not on the left). The sort function above has already\r\n // made sure that a bottom document overflow is preferred to a top overflow,\r\n // so we don't have to care about it.\r\n\r\n // if there is an overflow on the right\r\n if (finalResult.coord.left > helper.geo.window.size.width - finalResult.size.width) {\r\n\r\n // this may actually create on overflow on the left but we'll fix it in a sec\r\n finalResult.coord.left = helper.geo.window.size.width - finalResult.size.width;\r\n }\r\n\r\n // if there is an overflow on the left\r\n if (finalResult.coord.left < 0) {\r\n\r\n // don't care if it overflows the right after that, we made our best\r\n finalResult.coord.left = 0;\r\n }\r\n }\r\n\r\n\r\n // submit the positioning proposal to the user function which may choose to change\r\n // the side, size and/or the coordinates\r\n\r\n // first, set the rules that corresponds to the proposed side: it may change\r\n // the size of the tooltip, and the custom functionPosition may want to detect the\r\n // size of something before making a decision. So let's make things easier for the\r\n // implementor\r\n self.__sideChange($clone, finalResult.side);\r\n\r\n // add some variables to the helper\r\n helper.tooltipClone = $clone[0];\r\n helper.tooltipParent = self.__instance.option('parent').parent[0];\r\n // move informative values to the helper\r\n helper.mode = finalResult.mode;\r\n helper.whole = finalResult.whole;\r\n // add some variables to the helper for the functionPosition callback (these\r\n // will also be added to the event fired by self.__instance._trigger but that's\r\n // ok, we're just being consistent)\r\n helper.origin = self.__instance._$origin[0];\r\n helper.tooltip = self.__instance._$tooltip[0];\r\n\r\n // leave only the actionable values in there for functionPosition\r\n delete finalResult.container;\r\n delete finalResult.fits;\r\n delete finalResult.mode;\r\n delete finalResult.outerSize;\r\n delete finalResult.whole;\r\n\r\n // keep only the distance on the relevant side, for clarity\r\n finalResult.distance = finalResult.distance.horizontal || finalResult.distance.vertical;\r\n\r\n // beginners may not be comfortable with the concept of editing the object\r\n // passed by reference, so we provide an edit function and pass a clone\r\n var finalResultClone = $.extend(true, {}, finalResult);\r\n\r\n // emit an event on the instance\r\n self.__instance._trigger({\r\n edit: function (result) {\r\n finalResult = result;\r\n },\r\n event: event,\r\n helper: helper,\r\n position: finalResultClone,\r\n type: 'position'\r\n });\r\n\r\n if (self.__options.functionPosition) {\r\n\r\n var result = self.__options.functionPosition.call(self, self.__instance, helper, finalResultClone);\r\n\r\n if (result) finalResult = result;\r\n }\r\n\r\n // end the positioning tests session (the user might have had a\r\n // use for it during the position event, now it's over)\r\n ruler.destroy();\r\n\r\n // compute the position of the target relatively to the tooltip root\r\n // element so we can place the arrow and make the needed adjustments\r\n var arrowCoord,\r\n maxVal;\r\n\r\n if (finalResult.side == 'top' || finalResult.side == 'bottom') {\r\n\r\n arrowCoord = {\r\n prop: 'left',\r\n val: finalResult.target - finalResult.coord.left\r\n };\r\n maxVal = finalResult.size.width - this.__options.minIntersection;\r\n }\r\n else {\r\n\r\n arrowCoord = {\r\n prop: 'top',\r\n val: finalResult.target - finalResult.coord.top\r\n };\r\n maxVal = finalResult.size.height - this.__options.minIntersection;\r\n }\r\n\r\n // cannot lie beyond the boundaries of the tooltip, minus the\r\n // arrow margin\r\n if (arrowCoord.val < this.__options.minIntersection) {\r\n arrowCoord.val = this.__options.minIntersection;\r\n }\r\n else if (arrowCoord.val > maxVal) {\r\n arrowCoord.val = maxVal;\r\n }\r\n\r\n var originParentOffset;\r\n\r\n // let's convert the window-relative coordinates into coordinates relative to the\r\n // future positioned parent that the tooltip will be appended to\r\n if (helper.geo.origin.fixedLineage) {\r\n\r\n // same as windowOffset when the position is fixed\r\n originParentOffset = helper.geo.origin.windowOffset;\r\n }\r\n else {\r\n\r\n // this assumes that the parent of the tooltip is located at\r\n // (0, 0) in the document, typically like when the parent is\r\n // .\r\n // If we ever allow other types of parent, .tooltipster-ruler\r\n // will have to be appended to the parent to inherit css style\r\n // values that affect the display of the text and such.\r\n originParentOffset = {\r\n left: helper.geo.origin.windowOffset.left + helper.geo.window.scroll.left,\r\n top: helper.geo.origin.windowOffset.top + helper.geo.window.scroll.top\r\n };\r\n }\r\n\r\n finalResult.coord = {\r\n left: originParentOffset.left + (finalResult.coord.left - helper.geo.origin.windowOffset.left),\r\n top: originParentOffset.top + (finalResult.coord.top - helper.geo.origin.windowOffset.top)\r\n };\r\n\r\n // set position values on the original tooltip element\r\n\r\n self.__sideChange(self.__instance._$tooltip, finalResult.side);\r\n\r\n if (helper.geo.origin.fixedLineage) {\r\n self.__instance._$tooltip\r\n .css('position', 'fixed');\r\n }\r\n else {\r\n // CSS default\r\n self.__instance._$tooltip\r\n .css('position', '');\r\n }\r\n\r\n self.__instance._$tooltip\r\n .css({\r\n left: finalResult.coord.left,\r\n top: finalResult.coord.top,\r\n // we need to set a size even if the tooltip is in its natural size\r\n // because when the tooltip is positioned beyond the width of the body\r\n // (which is by default the width of the window; it will happen when\r\n // you scroll the window horizontally to get to the origin), its text\r\n // content will otherwise break lines at each word to keep up with the\r\n // body overflow strategy.\r\n height: finalResult.size.height,\r\n width: finalResult.size.width\r\n })\r\n .find('.tooltipster-arrow')\r\n .css({\r\n 'left': '',\r\n 'top': ''\r\n })\r\n .css(arrowCoord.prop, arrowCoord.val);\r\n\r\n // append the tooltip HTML element to its parent\r\n self.__instance._$tooltip.appendTo(self.__instance.option('parent'));\r\n\r\n self.__instance._trigger({\r\n type: 'repositioned',\r\n event: event,\r\n position: finalResult\r\n });\r\n },\r\n\r\n /**\r\n * Make whatever modifications are needed when the side is changed. This has\r\n * been made an independant method for easy inheritance in custom plugins based\r\n * on this default plugin.\r\n *\r\n * @param {object} $obj\r\n * @param {string} side\r\n * @private\r\n */\r\n __sideChange: function ($obj, side) {\r\n\r\n $obj\r\n .removeClass('tooltipster-bottom')\r\n .removeClass('tooltipster-left')\r\n .removeClass('tooltipster-right')\r\n .removeClass('tooltipster-top')\r\n .addClass('tooltipster-' + side);\r\n },\r\n\r\n /**\r\n * Returns the target that the tooltip should aim at for a given side.\r\n * The calculated value is a distance from the edge of the window\r\n * (left edge for top/bottom sides, top edge for left/right side). The\r\n * tooltip will be centered on that position and the arrow will be\r\n * positioned there (as much as possible).\r\n *\r\n * @param {object} helper\r\n * @return {integer}\r\n * @private\r\n */\r\n __targetFind: function (helper) {\r\n\r\n var target = {},\r\n rects = this.__instance._$origin[0].getClientRects();\r\n\r\n // these lines fix a Chrome bug (issue #491)\r\n if (rects.length > 1) {\r\n var opacity = this.__instance._$origin.css('opacity');\r\n if (opacity == 1) {\r\n this.__instance._$origin.css('opacity', 0.99);\r\n rects = this.__instance._$origin[0].getClientRects();\r\n this.__instance._$origin.css('opacity', 1);\r\n }\r\n }\r\n\r\n // by default, the target will be the middle of the origin\r\n if (rects.length < 2) {\r\n\r\n target.top = Math.floor(helper.geo.origin.windowOffset.left + (helper.geo.origin.size.width / 2));\r\n target.bottom = target.top;\r\n\r\n target.left = Math.floor(helper.geo.origin.windowOffset.top + (helper.geo.origin.size.height / 2));\r\n target.right = target.left;\r\n }\r\n // if multiple client rects exist, the element may be text split\r\n // up into multiple lines and the middle of the origin may not be\r\n // best option anymore. We need to choose the best target client rect\r\n else {\r\n\r\n // top: the first\r\n var targetRect = rects[0];\r\n target.top = Math.floor(targetRect.left + (targetRect.right - targetRect.left) / 2);\r\n\r\n // right: the middle line, rounded down in case there is an even\r\n // number of lines (looks more centered => check out the\r\n // demo with 4 split lines)\r\n if (rects.length > 2) {\r\n targetRect = rects[Math.ceil(rects.length / 2) - 1];\r\n }\r\n else {\r\n targetRect = rects[0];\r\n }\r\n target.right = Math.floor(targetRect.top + (targetRect.bottom - targetRect.top) / 2);\r\n\r\n // bottom: the last\r\n targetRect = rects[rects.length - 1];\r\n target.bottom = Math.floor(targetRect.left + (targetRect.right - targetRect.left) / 2);\r\n\r\n // left: the middle line, rounded up\r\n if (rects.length > 2) {\r\n targetRect = rects[Math.ceil((rects.length + 1) / 2) - 1];\r\n }\r\n else {\r\n targetRect = rects[rects.length - 1];\r\n }\r\n\r\n target.left = Math.floor(targetRect.top + (targetRect.bottom - targetRect.top) / 2);\r\n }\r\n\r\n return target;\r\n }\r\n }\r\n });\r\n\r\n /* a build task will add \"return $;\" here */\r\n return $;\r\n\r\n}));\r\n\n\n\n// WEBPACK FOOTER //\n// ./src/static/scripts/plugins/tooltipster.js","// ==========================================================================\r\n// Plyr\r\n// plyr.js v2.0.18\r\n// https://github.com/sampotts/plyr\r\n// License: The MIT License (MIT)\r\n// ==========================================================================\r\n// Credits: http://paypal.github.io/accessible-html5-video-player/\r\n// ==========================================================================\r\n\r\n(function (root, factory) {\r\n 'use strict';\r\n /*global define,module*/\r\n\r\n if (typeof module === 'object' && typeof module.exports === 'object') {\r\n // Node, CommonJS-like\r\n module.exports = factory(root, document);\r\n } else if (typeof define === 'function' && define.amd) {\r\n // AMD\r\n define([], function () {\r\n return factory(root, document);\r\n });\r\n } else {\r\n // Browser globals (root is window)\r\n root.plyr = factory(root, document);\r\n }\r\n})(typeof window !== 'undefined' ? window : this, function (window, document) {\r\n 'use strict';\r\n\r\n // Globals\r\n var fullscreen,\r\n scroll = {x: 0, y: 0},\r\n // Default config\r\n defaults = {\r\n enabled: true,\r\n debug: false,\r\n autoplay: false,\r\n loop: false,\r\n seekTime: 10,\r\n volume: 10,\r\n volumeMin: 0,\r\n volumeMax: 10,\r\n volumeStep: 1,\r\n duration: null,\r\n displayDuration: true,\r\n loadSprite: true,\r\n iconPrefix: 'plyr',\r\n iconUrl: 'https://cdn.plyr.io/2.0.18/plyr.svg',\r\n blankUrl: 'https://cdn.plyr.io/static/blank.mp4',\r\n clickToPlay: true,\r\n hideControls: true,\r\n showPosterOnEnd: false,\r\n disableContextMenu: true,\r\n keyboardShorcuts: {\r\n focused: true,\r\n global: false,\r\n },\r\n tooltips: {\r\n controls: false,\r\n seek: true,\r\n },\r\n selectors: {\r\n html5: 'video, audio',\r\n embed: '[data-type]',\r\n editable: 'input, textarea, select, [contenteditable]',\r\n container: '.plyr',\r\n controls: {\r\n container: null,\r\n wrapper: '.plyr__controls',\r\n },\r\n labels: '[data-plyr]',\r\n buttons: {\r\n seek: '[data-plyr=\"seek\"]',\r\n play: '[data-plyr=\"play\"]',\r\n pause: '[data-plyr=\"pause\"]',\r\n restart: '[data-plyr=\"restart\"]',\r\n rewind: '[data-plyr=\"rewind\"]',\r\n forward: '[data-plyr=\"fast-forward\"]',\r\n mute: '[data-plyr=\"mute\"]',\r\n captions: '[data-plyr=\"captions\"]',\r\n fullscreen: '[data-plyr=\"fullscreen\"]',\r\n },\r\n volume: {\r\n input: '[data-plyr=\"volume\"]',\r\n display: '.plyr__volume--display',\r\n },\r\n progress: {\r\n container: '.plyr__progress',\r\n buffer: '.plyr__progress--buffer',\r\n played: '.plyr__progress--played',\r\n },\r\n captions: '.plyr__captions',\r\n currentTime: '.plyr__time--current',\r\n duration: '.plyr__time--duration',\r\n },\r\n classes: {\r\n setup: 'plyr--setup',\r\n ready: 'plyr--ready',\r\n videoWrapper: 'plyr__video-wrapper',\r\n embedWrapper: 'plyr__video-embed',\r\n type: 'plyr--{0}',\r\n stopped: 'plyr--stopped',\r\n playing: 'plyr--playing',\r\n muted: 'plyr--muted',\r\n loading: 'plyr--loading',\r\n hover: 'plyr--hover',\r\n tooltip: 'plyr__tooltip',\r\n hidden: 'plyr__sr-only',\r\n hideControls: 'plyr--hide-controls',\r\n isIos: 'plyr--is-ios',\r\n isTouch: 'plyr--is-touch',\r\n captions: {\r\n enabled: 'plyr--captions-enabled',\r\n active: 'plyr--captions-active',\r\n },\r\n fullscreen: {\r\n enabled: 'plyr--fullscreen-enabled',\r\n fallback: 'plyr--fullscreen-fallback',\r\n active: 'plyr--fullscreen-active',\r\n },\r\n tabFocus: 'tab-focus',\r\n },\r\n captions: {\r\n defaultActive: false,\r\n },\r\n fullscreen: {\r\n enabled: true,\r\n fallback: true,\r\n allowAudio: false,\r\n },\r\n storage: {\r\n enabled: true,\r\n key: 'plyr',\r\n },\r\n controls: ['play-large', 'play', 'progress', 'current-time', 'mute', 'volume', 'captions', 'fullscreen'],\r\n i18n: {\r\n restart: 'Restart',\r\n rewind: 'Rewind {seektime} secs',\r\n play: 'Play',\r\n pause: 'Pause',\r\n forward: 'Forward {seektime} secs',\r\n played: 'played',\r\n buffered: 'buffered',\r\n currentTime: 'Current time',\r\n duration: 'Duration',\r\n volume: 'Volume',\r\n toggleMute: 'Toggle Mute',\r\n toggleCaptions: 'Toggle Captions',\r\n toggleFullscreen: 'Toggle Fullscreen',\r\n frameTitle: 'Player for {title}',\r\n },\r\n types: {\r\n embed: ['youtube', 'vimeo', 'soundcloud'],\r\n html5: ['video', 'audio'],\r\n },\r\n // URLs\r\n urls: {\r\n vimeo: {\r\n api: 'https://player.vimeo.com/api/player.js',\r\n },\r\n youtube: {\r\n api: 'https://www.youtube.com/iframe_api',\r\n },\r\n soundcloud: {\r\n api: 'https://w.soundcloud.com/player/api.js',\r\n },\r\n },\r\n // Custom control listeners\r\n listeners: {\r\n seek: null,\r\n play: null,\r\n pause: null,\r\n restart: null,\r\n rewind: null,\r\n forward: null,\r\n mute: null,\r\n volume: null,\r\n captions: null,\r\n fullscreen: null,\r\n },\r\n // Events to watch on HTML5 media elements\r\n events: [\r\n 'ready',\r\n 'ended',\r\n 'progress',\r\n 'stalled',\r\n 'playing',\r\n 'waiting',\r\n 'canplay',\r\n 'canplaythrough',\r\n 'loadstart',\r\n 'loadeddata',\r\n 'loadedmetadata',\r\n 'timeupdate',\r\n 'volumechange',\r\n 'play',\r\n 'pause',\r\n 'error',\r\n 'seeking',\r\n 'seeked',\r\n 'emptied',\r\n ],\r\n // Logging\r\n logPrefix: '[Plyr]',\r\n };\r\n\r\n // Credits: http://paypal.github.io/accessible-html5-video-player/\r\n // Unfortunately, due to mixed support, UA sniffing is required\r\n function _browserSniff() {\r\n var ua = navigator.userAgent,\r\n name = navigator.appName,\r\n fullVersion = '' + parseFloat(navigator.appVersion),\r\n majorVersion = parseInt(navigator.appVersion, 10),\r\n nameOffset,\r\n verOffset,\r\n ix,\r\n isIE = false,\r\n isFirefox = false,\r\n isChrome = false,\r\n isSafari = false;\r\n\r\n if (navigator.appVersion.indexOf('Windows NT') !== -1 && navigator.appVersion.indexOf('rv:11') !== -1) {\r\n // MSIE 11\r\n isIE = true;\r\n name = 'IE';\r\n fullVersion = '11';\r\n } else if ((verOffset = ua.indexOf('MSIE')) !== -1) {\r\n // MSIE\r\n isIE = true;\r\n name = 'IE';\r\n fullVersion = ua.substring(verOffset + 5);\r\n } else if ((verOffset = ua.indexOf('Chrome')) !== -1) {\r\n // Chrome\r\n isChrome = true;\r\n name = 'Chrome';\r\n fullVersion = ua.substring(verOffset + 7);\r\n } else if ((verOffset = ua.indexOf('Safari')) !== -1) {\r\n // Safari\r\n isSafari = true;\r\n name = 'Safari';\r\n fullVersion = ua.substring(verOffset + 7);\r\n if ((verOffset = ua.indexOf('Version')) !== -1) {\r\n fullVersion = ua.substring(verOffset + 8);\r\n }\r\n } else if ((verOffset = ua.indexOf('Firefox')) !== -1) {\r\n // Firefox\r\n isFirefox = true;\r\n name = 'Firefox';\r\n fullVersion = ua.substring(verOffset + 8);\r\n } else if ((nameOffset = ua.lastIndexOf(' ') + 1) < (verOffset = ua.lastIndexOf('/'))) {\r\n // In most other browsers, 'name/version' is at the end of userAgent\r\n name = ua.substring(nameOffset, verOffset);\r\n fullVersion = ua.substring(verOffset + 1);\r\n\r\n if (name.toLowerCase() === name.toUpperCase()) {\r\n name = navigator.appName;\r\n }\r\n }\r\n\r\n // Trim the fullVersion string at semicolon/space if present\r\n if ((ix = fullVersion.indexOf(';')) !== -1) {\r\n fullVersion = fullVersion.substring(0, ix);\r\n }\r\n if ((ix = fullVersion.indexOf(' ')) !== -1) {\r\n fullVersion = fullVersion.substring(0, ix);\r\n }\r\n\r\n // Get major version\r\n majorVersion = parseInt('' + fullVersion, 10);\r\n if (isNaN(majorVersion)) {\r\n fullVersion = '' + parseFloat(navigator.appVersion);\r\n majorVersion = parseInt(navigator.appVersion, 10);\r\n }\r\n\r\n // Return data\r\n return {\r\n name: name,\r\n version: majorVersion,\r\n isIE: isIE,\r\n isFirefox: isFirefox,\r\n isChrome: isChrome,\r\n isSafari: isSafari,\r\n isIos: /(iPad|iPhone|iPod)/g.test(navigator.platform),\r\n isIphone: /(iPhone|iPod)/g.test(navigator.userAgent),\r\n isTouch: 'ontouchstart' in document.documentElement,\r\n };\r\n }\r\n\r\n // Check for mime type support against a player instance\r\n // Credits: http://diveintohtml5.info/everything.html\r\n // Related: http://www.leanbackplyr.com/test/h5mt.html\r\n function _supportMime(plyr, mimeType) {\r\n var media = plyr.media;\r\n\r\n if (plyr.type === 'video') {\r\n // Check type\r\n switch (mimeType) {\r\n case 'video/webm':\r\n return !!(media.canPlayType && media.canPlayType('video/webm; codecs=\"vp8, vorbis\"').replace(/no/, ''));\r\n case 'video/mp4':\r\n return !!(media.canPlayType && media.canPlayType('video/mp4; codecs=\"avc1.42E01E, mp4a.40.2\"').replace(/no/, ''));\r\n case 'video/ogg':\r\n return !!(media.canPlayType && media.canPlayType('video/ogg; codecs=\"theora\"').replace(/no/, ''));\r\n }\r\n } else if (plyr.type === 'audio') {\r\n // Check type\r\n switch (mimeType) {\r\n case 'audio/mpeg':\r\n return !!(media.canPlayType && media.canPlayType('audio/mpeg;').replace(/no/, ''));\r\n case 'audio/ogg':\r\n return !!(media.canPlayType && media.canPlayType('audio/ogg; codecs=\"vorbis\"').replace(/no/, ''));\r\n case 'audio/wav':\r\n return !!(media.canPlayType && media.canPlayType('audio/wav; codecs=\"1\"').replace(/no/, ''));\r\n }\r\n }\r\n\r\n // If we got this far, we're stuffed\r\n return false;\r\n }\r\n\r\n // Inject a script\r\n function _injectScript(source) {\r\n if (document.querySelectorAll('script[src=\"' + source + '\"]').length) {\r\n return;\r\n }\r\n\r\n var tag = document.createElement('script');\r\n tag.src = source;\r\n var firstScriptTag = document.getElementsByTagName('script')[0];\r\n firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);\r\n }\r\n\r\n // Element exists in an array\r\n function _inArray(haystack, needle) {\r\n return Array.prototype.indexOf && haystack.indexOf(needle) !== -1;\r\n }\r\n\r\n // Replace all\r\n function _replaceAll(string, find, replace) {\r\n return string.replace(new RegExp(find.replace(/([.*+?\\^=!:${}()|\\[\\]\\/\\\\])/g, '\\\\$1'), 'g'), replace);\r\n }\r\n\r\n // Wrap an element\r\n function _wrap(elements, wrapper) {\r\n // Convert `elements` to an array, if necessary.\r\n if (!elements.length) {\r\n elements = [elements];\r\n }\r\n\r\n // Loops backwards to prevent having to clone the wrapper on the\r\n // first element (see `child` below).\r\n for (var i = elements.length - 1; i >= 0; i--) {\r\n var child = i > 0 ? wrapper.cloneNode(true) : wrapper;\r\n var element = elements[i];\r\n\r\n // Cache the current parent and sibling.\r\n var parent = element.parentNode;\r\n var sibling = element.nextSibling;\r\n\r\n // Wrap the element (is automatically removed from its current\r\n // parent).\r\n child.appendChild(element);\r\n\r\n // If the element had a sibling, insert the wrapper before\r\n // the sibling to maintain the HTML structure; otherwise, just\r\n // append it to the parent.\r\n if (sibling) {\r\n parent.insertBefore(child, sibling);\r\n } else {\r\n parent.appendChild(child);\r\n }\r\n\r\n return child;\r\n }\r\n }\r\n\r\n // Unwrap an element\r\n // http://plainjs.com/javascript/manipulation/unwrap-a-dom-element-35/\r\n /*function _unwrap(wrapper) {\r\n // Get the element's parent node\r\n var parent = wrapper.parentNode;\r\n\r\n // Move all children out of the element\r\n while (wrapper.firstChild) {\r\n parent.insertBefore(wrapper.firstChild, wrapper);\r\n }\r\n\r\n // Remove the empty element\r\n parent.removeChild(wrapper);\r\n }*/\r\n\r\n // Remove an element\r\n function _remove(element) {\r\n if (!element) {\r\n return;\r\n }\r\n element.parentNode.removeChild(element);\r\n }\r\n\r\n // Prepend child\r\n function _prependChild(parent, element) {\r\n parent.insertBefore(element, parent.firstChild);\r\n }\r\n\r\n // Set attributes\r\n function _setAttributes(element, attributes) {\r\n for (var key in attributes) {\r\n element.setAttribute(key, _is.boolean(attributes[key]) && attributes[key] ? '' : attributes[key]);\r\n }\r\n }\r\n\r\n // Insert a HTML element\r\n function _insertElement(type, parent, attributes) {\r\n // Create a new \r\n var element = document.createElement(type);\r\n\r\n // Set all passed attributes\r\n _setAttributes(element, attributes);\r\n\r\n // Inject the new element\r\n _prependChild(parent, element);\r\n }\r\n\r\n // Get a classname from selector\r\n function _getClassname(selector) {\r\n return selector.replace('.', '');\r\n }\r\n\r\n // Toggle class on an element\r\n function _toggleClass(element, className, state) {\r\n if (element) {\r\n if (element.classList) {\r\n element.classList[state ? 'add' : 'remove'](className);\r\n } else {\r\n var name = (' ' + element.className + ' ').replace(/\\s+/g, ' ').replace(' ' + className + ' ', '');\r\n element.className = name + (state ? ' ' + className : '');\r\n }\r\n }\r\n }\r\n\r\n // Has class name\r\n function _hasClass(element, className) {\r\n if (element) {\r\n if (element.classList) {\r\n return element.classList.contains(className);\r\n } else {\r\n return new RegExp('(\\\\s|^)' + className + '(\\\\s|$)').test(element.className);\r\n }\r\n }\r\n return false;\r\n }\r\n\r\n // Element matches selector\r\n function _matches(element, selector) {\r\n var p = Element.prototype;\r\n\r\n var f =\r\n p.matches ||\r\n p.webkitMatchesSelector ||\r\n p.mozMatchesSelector ||\r\n p.msMatchesSelector ||\r\n function (s) {\r\n return [].indexOf.call(document.querySelectorAll(s), this) !== -1;\r\n };\r\n\r\n return f.call(element, selector);\r\n }\r\n\r\n // Bind along with custom handler\r\n function _proxyListener(element, eventName, userListener, defaultListener, useCapture) {\r\n if (userListener) {\r\n // Register this before defaultListener\r\n _on(\r\n element,\r\n eventName,\r\n function (event) {\r\n userListener.apply(element, [event]);\r\n },\r\n useCapture\r\n );\r\n }\r\n _on(\r\n element,\r\n eventName,\r\n function (event) {\r\n defaultListener.apply(element, [event]);\r\n },\r\n useCapture\r\n );\r\n }\r\n\r\n // Toggle event listener\r\n function _toggleListener(element, events, callback, toggle, useCapture) {\r\n var eventList = events.split(' ');\r\n\r\n // Whether the listener is a capturing listener or not\r\n // Default to false\r\n if (!_is.boolean(useCapture)) {\r\n useCapture = false;\r\n }\r\n\r\n // If a nodelist is passed, call itself on each node\r\n if (element instanceof NodeList) {\r\n for (var x = 0; x < element.length; x++) {\r\n if (element[x] instanceof Node) {\r\n _toggleListener(element[x], arguments[1], arguments[2], arguments[3]);\r\n }\r\n }\r\n return;\r\n }\r\n\r\n // If a single node is passed, bind the event listener\r\n for (var i = 0; i < eventList.length; i++) {\r\n element[toggle ? 'addEventListener' : 'removeEventListener'](eventList[i], callback, useCapture);\r\n }\r\n }\r\n\r\n // Bind event\r\n function _on(element, events, callback, useCapture) {\r\n if (element) {\r\n _toggleListener(element, events, callback, true, useCapture);\r\n }\r\n }\r\n\r\n // Unbind event\r\n function _off(element, events, callback, useCapture) {\r\n if (element) {\r\n _toggleListener(element, events, callback, false, useCapture);\r\n }\r\n }\r\n\r\n // Trigger event\r\n function _event(element, type, bubbles, properties) {\r\n // Bail if no element\r\n if (!element || !type) {\r\n return;\r\n }\r\n\r\n // Default bubbles to false\r\n if (!_is.boolean(bubbles)) {\r\n bubbles = false;\r\n }\r\n\r\n // Create and dispatch the event\r\n var event = new CustomEvent(type, {\r\n bubbles: bubbles,\r\n detail: properties,\r\n });\r\n\r\n // Dispatch the event\r\n element.dispatchEvent(event);\r\n }\r\n\r\n // Toggle aria-pressed state on a toggle button\r\n // http://www.ssbbartgroup.com/blog/how-not-to-misuse-aria-states-properties-and-roles\r\n function _toggleState(target, state) {\r\n // Bail if no target\r\n if (!target) {\r\n return;\r\n }\r\n\r\n // Get state\r\n state = _is.boolean(state) ? state : !target.getAttribute('aria-pressed');\r\n\r\n // Set the attribute on target\r\n target.setAttribute('aria-pressed', state);\r\n\r\n return state;\r\n }\r\n\r\n // Get percentage\r\n function _getPercentage(current, max) {\r\n if (current === 0 || max === 0 || isNaN(current) || isNaN(max)) {\r\n return 0;\r\n }\r\n return (current / max * 100).toFixed(2);\r\n }\r\n\r\n // Deep extend/merge destination object with N more objects\r\n // http://andrewdupont.net/2009/08/28/deep-extending-objects-in-javascript/\r\n // Removed call to arguments.callee (used explicit function name instead)\r\n function _extend() {\r\n // Get arguments\r\n var objects = arguments;\r\n\r\n // Bail if nothing to merge\r\n if (!objects.length) {\r\n return;\r\n }\r\n\r\n // Return first if specified but nothing to merge\r\n if (objects.length === 1) {\r\n return objects[0];\r\n }\r\n\r\n // First object is the destination\r\n var destination = Array.prototype.shift.call(objects),\r\n length = objects.length;\r\n\r\n // Loop through all objects to merge\r\n for (var i = 0; i < length; i++) {\r\n var source = objects[i];\r\n\r\n for (var property in source) {\r\n if (source[property] && source[property].constructor && source[property].constructor === Object) {\r\n destination[property] = destination[property] || {};\r\n _extend(destination[property], source[property]);\r\n } else {\r\n destination[property] = source[property];\r\n }\r\n }\r\n }\r\n\r\n return destination;\r\n }\r\n\r\n // Check variable types\r\n var _is = {\r\n object: function (input) {\r\n return input !== null && typeof input === 'object';\r\n },\r\n array: function (input) {\r\n return input !== null && (typeof input === 'object' && input.constructor === Array);\r\n },\r\n number: function (input) {\r\n return input !== null && ((typeof input === 'number' && !isNaN(input - 0)) || (typeof input === 'object' && input.constructor === Number));\r\n },\r\n string: function (input) {\r\n return input !== null && (typeof input === 'string' || (typeof input === 'object' && input.constructor === String));\r\n },\r\n boolean: function (input) {\r\n return input !== null && typeof input === 'boolean';\r\n },\r\n nodeList: function (input) {\r\n return input !== null && input instanceof NodeList;\r\n },\r\n htmlElement: function (input) {\r\n return input !== null && input instanceof HTMLElement;\r\n },\r\n function: function (input) {\r\n return input !== null && typeof input === 'function';\r\n },\r\n undefined: function (input) {\r\n return input !== null && typeof input === 'undefined';\r\n },\r\n };\r\n\r\n // Parse YouTube ID from url\r\n function _parseYouTubeId(url) {\r\n var regex = /^.*(youtu.be\\/|v\\/|u\\/\\w\\/|embed\\/|watch\\?v=|\\&v=)([^#\\&\\?]*).*/;\r\n return url.match(regex) ? RegExp.$2 : url;\r\n }\r\n\r\n // Parse Vimeo ID from url\r\n function _parseVimeoId(url) {\r\n var regex = /^.*(vimeo.com\\/|video\\/)(\\d+).*/;\r\n return url.match(regex) ? RegExp.$2 : url;\r\n }\r\n\r\n // Fullscreen API\r\n function _fullscreen() {\r\n var fullscreen = {\r\n supportsFullScreen: false,\r\n isFullScreen: function () {\r\n return false;\r\n },\r\n requestFullScreen: function () {\r\n },\r\n cancelFullScreen: function () {\r\n },\r\n fullScreenEventName: '',\r\n element: null,\r\n prefix: '',\r\n },\r\n browserPrefixes = 'webkit o moz ms khtml'.split(' ');\r\n\r\n // Check for native support\r\n if (!_is.undefined(document.cancelFullScreen)) {\r\n fullscreen.supportsFullScreen = true;\r\n } else {\r\n // Check for fullscreen support by vendor prefix\r\n for (var i = 0, il = browserPrefixes.length; i < il; i++) {\r\n fullscreen.prefix = browserPrefixes[i];\r\n\r\n if (!_is.undefined(document[fullscreen.prefix + 'CancelFullScreen'])) {\r\n fullscreen.supportsFullScreen = true;\r\n break;\r\n } else if (!_is.undefined(document.msExitFullscreen) && document.msFullscreenEnabled) {\r\n // Special case for MS (when isn't it?)\r\n fullscreen.prefix = 'ms';\r\n fullscreen.supportsFullScreen = true;\r\n break;\r\n }\r\n }\r\n }\r\n\r\n // Update methods to do something useful\r\n if (fullscreen.supportsFullScreen) {\r\n // Yet again Microsoft awesomeness,\r\n // Sometimes the prefix is 'ms', sometimes 'MS' to keep you on your toes\r\n fullscreen.fullScreenEventName = fullscreen.prefix === 'ms' ? 'MSFullscreenChange' : fullscreen.prefix + 'fullscreenchange';\r\n\r\n fullscreen.isFullScreen = function (element) {\r\n if (_is.undefined(element)) {\r\n element = document.body;\r\n }\r\n switch (this.prefix) {\r\n case '':\r\n return document.fullscreenElement === element;\r\n case 'moz':\r\n return document.mozFullScreenElement === element;\r\n default:\r\n return document[this.prefix + 'FullscreenElement'] === element;\r\n }\r\n };\r\n fullscreen.requestFullScreen = function (element) {\r\n if (_is.undefined(element)) {\r\n element = document.body;\r\n }\r\n return this.prefix === ''\r\n ? element.requestFullScreen()\r\n : element[this.prefix + (this.prefix === 'ms' ? 'RequestFullscreen' : 'RequestFullScreen')]();\r\n };\r\n fullscreen.cancelFullScreen = function () {\r\n return this.prefix === ''\r\n ? document.cancelFullScreen()\r\n : document[this.prefix + (this.prefix === 'ms' ? 'ExitFullscreen' : 'CancelFullScreen')]();\r\n };\r\n fullscreen.element = function () {\r\n return this.prefix === '' ? document.fullscreenElement : document[this.prefix + 'FullscreenElement'];\r\n };\r\n }\r\n\r\n return fullscreen;\r\n }\r\n\r\n // Local storage\r\n var _storage = {\r\n supported: (function () {\r\n // Try to use it (it might be disabled, e.g. user is in private/porn mode)\r\n // see: https://github.com/sampotts/plyr/issues/131\r\n try {\r\n // Add test item\r\n window.localStorage.setItem('___test', 'OK');\r\n\r\n // Get the test item\r\n var result = window.localStorage.getItem('___test');\r\n\r\n // Clean up\r\n window.localStorage.removeItem('___test');\r\n\r\n // Check if value matches\r\n return result === 'OK';\r\n } catch (e) {\r\n return false;\r\n }\r\n\r\n return false;\r\n })(),\r\n };\r\n\r\n // Player instance\r\n function Plyr(media, config) {\r\n var plyr = this,\r\n timers = {},\r\n api;\r\n\r\n // Set media\r\n plyr.media = media;\r\n var original = media.cloneNode(true);\r\n\r\n // Trigger events, with plyr instance passed\r\n function _triggerEvent(element, type, bubbles, properties) {\r\n _event(\r\n element,\r\n type,\r\n bubbles,\r\n _extend({}, properties, {\r\n plyr: api,\r\n })\r\n );\r\n }\r\n\r\n // Debugging\r\n function _console(type, args) {\r\n if (config.debug && window.console) {\r\n args = Array.prototype.slice.call(args);\r\n\r\n if (_is.string(config.logPrefix) && config.logPrefix.length) {\r\n args.unshift(config.logPrefix);\r\n }\r\n\r\n console[type].apply(console, args);\r\n }\r\n }\r\n\r\n var _log = function () {\r\n _console('log', arguments);\r\n },\r\n _warn = function () {\r\n _console('warn', arguments);\r\n };\r\n\r\n // Log config options\r\n _log('Config', config);\r\n\r\n // Get icon URL\r\n function _getIconUrl() {\r\n return {\r\n url: config.iconUrl,\r\n // If you're using svg4everybody you don't need absolute paths\r\n absolute: config.iconUrl.indexOf('http') === 0 || (plyr.browser.isIE && !window.svg4everybody),\r\n };\r\n }\r\n\r\n // Build the default HTML\r\n function _buildControls() {\r\n // Create html array\r\n var html = [],\r\n iconUrl = _getIconUrl(),\r\n iconPath = (!iconUrl.absolute ? iconUrl.url : '') + '#' + config.iconPrefix;\r\n\r\n // Larger overlaid play button\r\n if (_inArray(config.controls, 'play-large')) {\r\n html.push(\r\n ''\r\n );\r\n }\r\n\r\n html.push('
    ');\r\n\r\n // Restart button\r\n if (_inArray(config.controls, 'restart')) {\r\n html.push(\r\n ''\r\n );\r\n }\r\n\r\n // Rewind button\r\n if (_inArray(config.controls, 'rewind')) {\r\n html.push(\r\n ''\r\n );\r\n }\r\n\r\n // Play Pause button\r\n // TODO: This should be a toggle button really?\r\n if (_inArray(config.controls, 'play')) {\r\n html.push(\r\n '',\r\n ''\r\n );\r\n }\r\n\r\n // Fast forward button\r\n if (_inArray(config.controls, 'fast-forward')) {\r\n html.push(\r\n ''\r\n );\r\n }\r\n\r\n // Progress\r\n if (_inArray(config.controls, 'progress')) {\r\n // Create progress\r\n html.push(\r\n '',\r\n '',\r\n '',\r\n '',\r\n '',\r\n '0% ' + config.i18n.buffered,\r\n ''\r\n );\r\n\r\n // Seek tooltip\r\n if (config.tooltips.seek) {\r\n html.push('00:00');\r\n }\r\n\r\n // Close\r\n html.push('');\r\n }\r\n\r\n // Media current time display\r\n if (_inArray(config.controls, 'current-time')) {\r\n html.push(\r\n '',\r\n '' + config.i18n.currentTime + '',\r\n '00:00',\r\n ''\r\n );\r\n }\r\n\r\n // Media duration display\r\n if (_inArray(config.controls, 'duration')) {\r\n html.push(\r\n '',\r\n '' + config.i18n.duration + '',\r\n '00:00',\r\n ''\r\n );\r\n }\r\n\r\n // Toggle mute button\r\n if (_inArray(config.controls, 'mute')) {\r\n html.push(\r\n ''\r\n );\r\n }\r\n\r\n // Volume range control\r\n if (_inArray(config.controls, 'volume')) {\r\n html.push(\r\n '',\r\n '',\r\n '',\r\n '',\r\n ''\r\n );\r\n }\r\n\r\n // Toggle captions button\r\n if (_inArray(config.controls, 'captions')) {\r\n html.push(\r\n ''\r\n );\r\n }\r\n\r\n // Toggle fullscreen button\r\n if (_inArray(config.controls, 'fullscreen')) {\r\n html.push(\r\n ''\r\n );\r\n }\r\n\r\n // Close everything\r\n html.push('
    ');\r\n\r\n return html.join('');\r\n }\r\n\r\n // Setup fullscreen\r\n function _setupFullscreen() {\r\n if (!plyr.supported.full) {\r\n return;\r\n }\r\n\r\n if ((plyr.type !== 'audio' || config.fullscreen.allowAudio) && config.fullscreen.enabled) {\r\n // Check for native support\r\n var nativeSupport = fullscreen.supportsFullScreen;\r\n\r\n if (nativeSupport || (config.fullscreen.fallback && !_inFrame())) {\r\n _log((nativeSupport ? 'Native' : 'Fallback') + ' fullscreen enabled');\r\n\r\n // Add styling hook\r\n if (!nativeSupport) {\r\n _toggleClass(plyr.container, config.classes.fullscreen.fallback, true);\r\n }\r\n\r\n // Add styling hook\r\n _toggleClass(plyr.container, config.classes.fullscreen.enabled, true);\r\n } else {\r\n _log('Fullscreen not supported and fallback disabled');\r\n }\r\n\r\n // Toggle state\r\n if (plyr.buttons && plyr.buttons.fullscreen) {\r\n _toggleState(plyr.buttons.fullscreen, false);\r\n }\r\n\r\n // Setup focus trap\r\n _focusTrap();\r\n }\r\n }\r\n\r\n // Setup captions\r\n function _setupCaptions() {\r\n // Bail if not HTML5 video\r\n if (plyr.type !== 'video') {\r\n return;\r\n }\r\n\r\n // Inject the container\r\n if (!_getElement(config.selectors.captions)) {\r\n plyr.videoContainer.insertAdjacentHTML('afterbegin', '
    ');\r\n }\r\n\r\n // Determine if HTML5 textTracks is supported\r\n plyr.usingTextTracks = false;\r\n if (plyr.media.textTracks) {\r\n plyr.usingTextTracks = true;\r\n }\r\n\r\n // Get URL of caption file if exists\r\n var captionSrc = '',\r\n kind,\r\n children = plyr.media.childNodes;\r\n\r\n for (var i = 0; i < children.length; i++) {\r\n if (children[i].nodeName.toLowerCase() === 'track') {\r\n kind = children[i].kind;\r\n if (kind === 'captions' || kind === 'subtitles') {\r\n captionSrc = children[i].getAttribute('src');\r\n }\r\n }\r\n }\r\n\r\n // Record if caption file exists or not\r\n plyr.captionExists = true;\r\n if (captionSrc === '') {\r\n plyr.captionExists = false;\r\n _log('No caption track found');\r\n } else {\r\n _log('Caption track found; URI: ' + captionSrc);\r\n }\r\n\r\n // If no caption file exists, hide container for caption text\r\n if (!plyr.captionExists) {\r\n _toggleClass(plyr.container, config.classes.captions.enabled);\r\n } else {\r\n // Turn off native caption rendering to avoid double captions\r\n // This doesn't seem to work in Safari 7+, so the elements are removed from the dom below\r\n var tracks = plyr.media.textTracks;\r\n for (var x = 0; x < tracks.length; x++) {\r\n tracks[x].mode = 'hidden';\r\n }\r\n\r\n // Enable UI\r\n _showCaptions(plyr);\r\n\r\n // Disable unsupported browsers than report false positive\r\n // Firefox bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1033144\r\n if ((plyr.browser.isIE && plyr.browser.version >= 10) || (plyr.browser.isFirefox && plyr.browser.version >= 31)) {\r\n // Debugging\r\n _log('Detected browser with known TextTrack issues - using manual fallback');\r\n\r\n // Set to false so skips to 'manual' captioning\r\n plyr.usingTextTracks = false;\r\n }\r\n\r\n // Rendering caption tracks\r\n // Native support required - http://caniuse.com/webvtt\r\n if (plyr.usingTextTracks) {\r\n _log('TextTracks supported');\r\n\r\n for (var y = 0; y < tracks.length; y++) {\r\n var track = tracks[y];\r\n\r\n if (track.kind === 'captions' || track.kind === 'subtitles') {\r\n _on(track, 'cuechange', function () {\r\n // Display a cue, if there is one\r\n if (this.activeCues[0] && 'text' in this.activeCues[0]) {\r\n _setCaption(this.activeCues[0].getCueAsHTML());\r\n } else {\r\n _setCaption();\r\n }\r\n });\r\n }\r\n }\r\n } else {\r\n // Caption tracks not natively supported\r\n _log('TextTracks not supported so rendering captions manually');\r\n\r\n // Render captions from array at appropriate time\r\n plyr.currentCaption = '';\r\n plyr.captions = [];\r\n\r\n if (captionSrc !== '') {\r\n // Create XMLHttpRequest Object\r\n var xhr = new XMLHttpRequest();\r\n\r\n xhr.onreadystatechange = function () {\r\n if (xhr.readyState === 4) {\r\n if (xhr.status === 200) {\r\n var captions = [],\r\n caption,\r\n req = xhr.responseText;\r\n\r\n //According to webvtt spec, line terminator consists of one of the following\r\n // CRLF (U+000D U+000A), LF (U+000A) or CR (U+000D)\r\n var lineSeparator = '\\r\\n';\r\n if (req.indexOf(lineSeparator + lineSeparator) === -1) {\r\n if (req.indexOf('\\r\\r') !== -1) {\r\n lineSeparator = '\\r';\r\n } else {\r\n lineSeparator = '\\n';\r\n }\r\n }\r\n\r\n captions = req.split(lineSeparator + lineSeparator);\r\n\r\n for (var r = 0; r < captions.length; r++) {\r\n caption = captions[r];\r\n plyr.captions[r] = [];\r\n\r\n // Get the parts of the captions\r\n var parts = caption.split(lineSeparator),\r\n index = 0;\r\n\r\n // Incase caption numbers are added\r\n if (parts[index].indexOf(':') === -1) {\r\n index = 1;\r\n }\r\n\r\n plyr.captions[r] = [parts[index], parts[index + 1]];\r\n }\r\n\r\n // Remove first element ('VTT')\r\n plyr.captions.shift();\r\n\r\n _log('Successfully loaded the caption file via AJAX');\r\n } else {\r\n _warn(config.logPrefix + 'There was a problem loading the caption file via AJAX');\r\n }\r\n }\r\n };\r\n\r\n xhr.open('get', captionSrc, true);\r\n\r\n xhr.send();\r\n }\r\n }\r\n }\r\n }\r\n\r\n // Set the current caption\r\n function _setCaption(caption) {\r\n /* jshint unused:false */\r\n var container = _getElement(config.selectors.captions),\r\n content = document.createElement('span');\r\n\r\n // Empty the container\r\n container.innerHTML = '';\r\n\r\n // Default to empty\r\n if (_is.undefined(caption)) {\r\n caption = '';\r\n }\r\n\r\n // Set the span content\r\n if (_is.string(caption)) {\r\n content.innerHTML = caption.trim();\r\n } else {\r\n content.appendChild(caption);\r\n }\r\n\r\n // Set new caption text\r\n container.appendChild(content);\r\n\r\n // Force redraw (for Safari)\r\n var redraw = container.offsetHeight;\r\n }\r\n\r\n // Captions functions\r\n // Seek the manual caption time and update UI\r\n function _seekManualCaptions(time) {\r\n // Utilities for caption time codes\r\n function _timecodeCommon(tc, pos) {\r\n var tcpair = [];\r\n tcpair = tc.split(' --> ');\r\n for (var i = 0; i < tcpair.length; i++) {\r\n // WebVTT allows for extra meta data after the timestamp line\r\n // So get rid of this if it exists\r\n tcpair[i] = tcpair[i].replace(/(\\d+:\\d+:\\d+\\.\\d+).*/, '$1');\r\n }\r\n return _subTcSecs(tcpair[pos]);\r\n }\r\n\r\n function _timecodeMin(tc) {\r\n return _timecodeCommon(tc, 0);\r\n }\r\n\r\n function _timecodeMax(tc) {\r\n return _timecodeCommon(tc, 1);\r\n }\r\n\r\n function _subTcSecs(tc) {\r\n if (tc === null || tc === undefined) {\r\n return 0;\r\n } else {\r\n var tc1 = [],\r\n tc2 = [],\r\n seconds;\r\n tc1 = tc.split(',');\r\n tc2 = tc1[0].split(':');\r\n seconds = Math.floor(tc2[0] * 60 * 60) + Math.floor(tc2[1] * 60) + Math.floor(tc2[2]);\r\n return seconds;\r\n }\r\n }\r\n\r\n // If it's not video, or we're using textTracks, bail.\r\n if (plyr.usingTextTracks || plyr.type !== 'video' || !plyr.supported.full) {\r\n return;\r\n }\r\n\r\n // Reset subcount\r\n plyr.subcount = 0;\r\n\r\n // Check time is a number, if not use currentTime\r\n // IE has a bug where currentTime doesn't go to 0\r\n // https://twitter.com/Sam_Potts/status/573715746506731521\r\n time = _is.number(time) ? time : plyr.media.currentTime;\r\n\r\n // If there's no subs available, bail\r\n if (!plyr.captions[plyr.subcount]) {\r\n return;\r\n }\r\n\r\n while (_timecodeMax(plyr.captions[plyr.subcount][0]) < time.toFixed(1)) {\r\n plyr.subcount++;\r\n if (plyr.subcount > plyr.captions.length - 1) {\r\n plyr.subcount = plyr.captions.length - 1;\r\n break;\r\n }\r\n }\r\n\r\n // Check if the next caption is in the current time range\r\n if (\r\n plyr.media.currentTime.toFixed(1) >= _timecodeMin(plyr.captions[plyr.subcount][0]) &&\r\n plyr.media.currentTime.toFixed(1) <= _timecodeMax(plyr.captions[plyr.subcount][0])\r\n ) {\r\n plyr.currentCaption = plyr.captions[plyr.subcount][1];\r\n\r\n // Render the caption\r\n _setCaption(plyr.currentCaption);\r\n } else {\r\n _setCaption();\r\n }\r\n }\r\n\r\n // Display captions container and button (for initialization)\r\n function _showCaptions() {\r\n // If there's no caption toggle, bail\r\n if (!plyr.buttons.captions) {\r\n return;\r\n }\r\n\r\n _toggleClass(plyr.container, config.classes.captions.enabled, true);\r\n\r\n // Try to load the value from storage\r\n var active = plyr.storage.captionsEnabled;\r\n\r\n // Otherwise fall back to the default config\r\n if (!_is.boolean(active)) {\r\n active = config.captions.defaultActive;\r\n }\r\n\r\n if (active) {\r\n _toggleClass(plyr.container, config.classes.captions.active, true);\r\n _toggleState(plyr.buttons.captions, true);\r\n }\r\n }\r\n\r\n // Find all elements\r\n function _getElements(selector) {\r\n return plyr.container.querySelectorAll(selector);\r\n }\r\n\r\n // Find a single element\r\n function _getElement(selector) {\r\n return _getElements(selector)[0];\r\n }\r\n\r\n // Determine if we're in an iframe\r\n function _inFrame() {\r\n try {\r\n return window.self !== window.top;\r\n } catch (e) {\r\n return true;\r\n }\r\n }\r\n\r\n // Trap focus inside container\r\n function _focusTrap() {\r\n var tabbables = _getElements('input:not([disabled]), button:not([disabled])'),\r\n first = tabbables[0],\r\n last = tabbables[tabbables.length - 1];\r\n\r\n function _checkFocus(event) {\r\n // If it is TAB\r\n if (event.which === 9 && plyr.isFullscreen) {\r\n if (event.target === last && !event.shiftKey) {\r\n // Move focus to first element that can be tabbed if Shift isn't used\r\n event.preventDefault();\r\n first.focus();\r\n } else if (event.target === first && event.shiftKey) {\r\n // Move focus to last element that can be tabbed if Shift is used\r\n event.preventDefault();\r\n last.focus();\r\n }\r\n }\r\n }\r\n\r\n // Bind the handler\r\n _on(plyr.container, 'keydown', _checkFocus);\r\n }\r\n\r\n // Add elements to HTML5 media (source, tracks, etc)\r\n function _insertChildElements(type, attributes) {\r\n if (_is.string(attributes)) {\r\n _insertElement(type, plyr.media, {src: attributes});\r\n } else if (attributes.constructor === Array) {\r\n for (var i = attributes.length - 1; i >= 0; i--) {\r\n _insertElement(type, plyr.media, attributes[i]);\r\n }\r\n }\r\n }\r\n\r\n // Insert controls\r\n function _injectControls() {\r\n // Sprite\r\n if (config.loadSprite) {\r\n var iconUrl = _getIconUrl();\r\n\r\n // Only load external sprite using AJAX\r\n if (iconUrl.absolute) {\r\n _log('AJAX loading absolute SVG sprite' + (plyr.browser.isIE ? ' (due to IE)' : ''));\r\n loadSprite(iconUrl.url, 'sprite-plyr');\r\n } else {\r\n _log('Sprite will be used as external resource directly');\r\n }\r\n }\r\n\r\n // Make a copy of the html\r\n var html = config.html;\r\n\r\n // Insert custom video controls\r\n _log('Injecting custom controls');\r\n\r\n // If no controls are specified, create default\r\n if (!html) {\r\n html = _buildControls();\r\n }\r\n\r\n // Replace seek time instances\r\n html = _replaceAll(html, '{seektime}', config.seekTime);\r\n\r\n // Replace all id references with random numbers\r\n html = _replaceAll(html, '{id}', Math.floor(Math.random() * 10000));\r\n\r\n // Replace Title, if it exists\r\n if (config.title) {\r\n html = _replaceAll(html, '{title}', config.title);\r\n }\r\n\r\n // Controls container\r\n var target;\r\n\r\n // Inject to custom location\r\n if (_is.string(config.selectors.controls.container)) {\r\n target = document.querySelector(config.selectors.controls.container);\r\n }\r\n\r\n // Inject into the container by default\r\n if (!_is.htmlElement(target)) {\r\n target = plyr.container;\r\n }\r\n\r\n // Inject controls HTML\r\n target.insertAdjacentHTML('beforeend', html);\r\n\r\n // Setup tooltips\r\n if (config.tooltips.controls) {\r\n var labels = _getElements([config.selectors.controls.wrapper, ' ', config.selectors.labels, ' .', config.classes.hidden].join(''));\r\n\r\n for (var i = labels.length - 1; i >= 0; i--) {\r\n var label = labels[i];\r\n\r\n _toggleClass(label, config.classes.hidden, false);\r\n _toggleClass(label, config.classes.tooltip, true);\r\n }\r\n }\r\n }\r\n\r\n // Find the UI controls and store references\r\n function _findElements() {\r\n try {\r\n plyr.controls = _getElement(config.selectors.controls.wrapper);\r\n\r\n // Buttons\r\n plyr.buttons = {};\r\n plyr.buttons.seek = _getElement(config.selectors.buttons.seek);\r\n plyr.buttons.play = _getElements(config.selectors.buttons.play);\r\n plyr.buttons.pause = _getElement(config.selectors.buttons.pause);\r\n plyr.buttons.restart = _getElement(config.selectors.buttons.restart);\r\n plyr.buttons.rewind = _getElement(config.selectors.buttons.rewind);\r\n plyr.buttons.forward = _getElement(config.selectors.buttons.forward);\r\n plyr.buttons.fullscreen = _getElement(config.selectors.buttons.fullscreen);\r\n\r\n // Inputs\r\n plyr.buttons.mute = _getElement(config.selectors.buttons.mute);\r\n plyr.buttons.captions = _getElement(config.selectors.buttons.captions);\r\n\r\n // Progress\r\n plyr.progress = {};\r\n plyr.progress.container = _getElement(config.selectors.progress.container);\r\n\r\n // Progress - Buffering\r\n plyr.progress.buffer = {};\r\n plyr.progress.buffer.bar = _getElement(config.selectors.progress.buffer);\r\n plyr.progress.buffer.text = plyr.progress.buffer.bar && plyr.progress.buffer.bar.getElementsByTagName('span')[0];\r\n\r\n // Progress - Played\r\n plyr.progress.played = _getElement(config.selectors.progress.played);\r\n\r\n // Seek tooltip\r\n plyr.progress.tooltip = plyr.progress.container && plyr.progress.container.querySelector('.' + config.classes.tooltip);\r\n\r\n // Volume\r\n plyr.volume = {};\r\n plyr.volume.input = _getElement(config.selectors.volume.input);\r\n plyr.volume.display = _getElement(config.selectors.volume.display);\r\n\r\n // Timing\r\n plyr.duration = _getElement(config.selectors.duration);\r\n plyr.currentTime = _getElement(config.selectors.currentTime);\r\n plyr.seekTime = _getElements(config.selectors.seekTime);\r\n\r\n return true;\r\n } catch (e) {\r\n _warn('It looks like there is a problem with your controls HTML');\r\n\r\n // Restore native video controls\r\n _toggleNativeControls(true);\r\n\r\n return false;\r\n }\r\n }\r\n\r\n // Toggle style hook\r\n function _toggleStyleHook() {\r\n _toggleClass(plyr.container, config.selectors.container.replace('.', ''), plyr.supported.full);\r\n }\r\n\r\n // Toggle native controls\r\n function _toggleNativeControls(toggle) {\r\n if (toggle && _inArray(config.types.html5, plyr.type)) {\r\n plyr.media.setAttribute('controls', '');\r\n } else {\r\n plyr.media.removeAttribute('controls');\r\n }\r\n }\r\n\r\n // Setup aria attribute for play and iframe title\r\n function _setTitle(iframe) {\r\n // Find the current text\r\n var label = config.i18n.play;\r\n\r\n // If there's a media title set, use that for the label\r\n if (_is.string(config.title) && config.title.length) {\r\n label += ', ' + config.title;\r\n\r\n // Set container label\r\n plyr.container.setAttribute('aria-label', config.title);\r\n }\r\n\r\n // If there's a play button, set label\r\n if (plyr.supported.full && plyr.buttons.play) {\r\n for (var i = plyr.buttons.play.length - 1; i >= 0; i--) {\r\n plyr.buttons.play[i].setAttribute('aria-label', label);\r\n }\r\n }\r\n\r\n // Set iframe title\r\n // https://github.com/sampotts/plyr/issues/124\r\n if (_is.htmlElement(iframe)) {\r\n iframe.setAttribute('title', config.i18n.frameTitle.replace('{title}', config.title));\r\n }\r\n }\r\n\r\n // Setup localStorage\r\n function _setupStorage() {\r\n var value = null;\r\n plyr.storage = {};\r\n\r\n // Bail if we don't have localStorage support or it's disabled\r\n if (!_storage.supported || !config.storage.enabled) {\r\n return;\r\n }\r\n\r\n // Clean up old volume\r\n // https://github.com/sampotts/plyr/issues/171\r\n window.localStorage.removeItem('plyr-volume');\r\n\r\n // load value from the current key\r\n value = window.localStorage.getItem(config.storage.key);\r\n\r\n if (!value) {\r\n // Key wasn't set (or had been cleared), move along\r\n return;\r\n } else if (/^\\d+(\\.\\d+)?$/.test(value)) {\r\n // If value is a number, it's probably volume from an older\r\n // version of plyr. See: https://github.com/sampotts/plyr/pull/313\r\n // Update the key to be JSON\r\n _updateStorage({volume: parseFloat(value)});\r\n } else {\r\n // Assume it's JSON from this or a later version of plyr\r\n plyr.storage = JSON.parse(value);\r\n }\r\n }\r\n\r\n // Save a value back to local storage\r\n function _updateStorage(value) {\r\n // Bail if we don't have localStorage support or it's disabled\r\n if (!_storage.supported || !config.storage.enabled) {\r\n return;\r\n }\r\n\r\n // Update the working copy of the values\r\n _extend(plyr.storage, value);\r\n\r\n // Update storage\r\n window.localStorage.setItem(config.storage.key, JSON.stringify(plyr.storage));\r\n }\r\n\r\n // Setup media\r\n function _setupMedia() {\r\n // If there's no media, bail\r\n if (!plyr.media) {\r\n _warn('No media element found!');\r\n return;\r\n }\r\n\r\n if (plyr.supported.full) {\r\n // Add type class\r\n _toggleClass(plyr.container, config.classes.type.replace('{0}', plyr.type), true);\r\n\r\n // Add video class for embeds\r\n // This will require changes if audio embeds are added\r\n if (_inArray(config.types.embed, plyr.type)) {\r\n _toggleClass(plyr.container, config.classes.type.replace('{0}', 'video'), true);\r\n }\r\n\r\n // If there's no autoplay attribute, assume the video is stopped and add state class\r\n _toggleClass(plyr.container, config.classes.stopped, config.autoplay);\r\n\r\n // Add iOS class\r\n _toggleClass(plyr.container, config.classes.isIos, plyr.browser.isIos);\r\n\r\n // Add touch class\r\n _toggleClass(plyr.container, config.classes.isTouch, plyr.browser.isTouch);\r\n\r\n // Inject the player wrapper\r\n if (plyr.type === 'video') {\r\n // Create the wrapper div\r\n var wrapper = document.createElement('div');\r\n wrapper.setAttribute('class', config.classes.videoWrapper);\r\n\r\n // Wrap the video in a container\r\n _wrap(plyr.media, wrapper);\r\n\r\n // Cache the container\r\n plyr.videoContainer = wrapper;\r\n }\r\n }\r\n\r\n // Embeds\r\n if (_inArray(config.types.embed, plyr.type)) {\r\n _setupEmbed();\r\n }\r\n }\r\n\r\n // Setup YouTube/Vimeo\r\n function _setupEmbed() {\r\n var container = document.createElement('div'),\r\n mediaId,\r\n mediaUrl,\r\n id = plyr.type + '-' + Math.floor(Math.random() * 10000);\r\n\r\n // Parse IDs from URLs if supplied\r\n switch (plyr.type) {\r\n case 'youtube':\r\n mediaId = _parseYouTubeId(plyr.embedId);\r\n break;\r\n\r\n case 'vimeo':\r\n mediaId = _parseVimeoId(plyr.embedId);\r\n break;\r\n\r\n default:\r\n mediaId = plyr.embedId;\r\n }\r\n\r\n // Remove old containers\r\n var containers = _getElements('[id^=\"' + plyr.type + '-\"]');\r\n for (var i = containers.length - 1; i >= 0; i--) {\r\n _remove(containers[i]);\r\n }\r\n\r\n // Add embed class for responsive\r\n _toggleClass(plyr.media, config.classes.videoWrapper, true);\r\n _toggleClass(plyr.media, config.classes.embedWrapper, true);\r\n\r\n if (plyr.type === 'youtube') {\r\n // Create the YouTube container\r\n plyr.media.appendChild(container);\r\n\r\n // Set ID\r\n container.setAttribute('id', id);\r\n\r\n // Setup API\r\n if (_is.object(window.YT)) {\r\n _youTubeReady(mediaId, container);\r\n } else {\r\n // Load the API\r\n _injectScript(config.urls.youtube.api);\r\n\r\n // Setup callback for the API\r\n window.onYouTubeReadyCallbacks = window.onYouTubeReadyCallbacks || [];\r\n\r\n // Add to queue\r\n window.onYouTubeReadyCallbacks.push(function () {\r\n _youTubeReady(mediaId, container);\r\n });\r\n\r\n // Set callback to process queue\r\n window.onYouTubeIframeAPIReady = function () {\r\n window.onYouTubeReadyCallbacks.forEach(function (callback) {\r\n callback();\r\n });\r\n };\r\n }\r\n } else if (plyr.type === 'vimeo') {\r\n // Vimeo needs an extra div to hide controls on desktop (which has full support)\r\n if (plyr.supported.full) {\r\n plyr.media.appendChild(container);\r\n } else {\r\n container = plyr.media;\r\n }\r\n\r\n // Set ID\r\n container.setAttribute('id', id);\r\n\r\n // Load the API if not already\r\n if (!_is.object(window.Vimeo)) {\r\n _injectScript(config.urls.vimeo.api);\r\n\r\n // Wait for fragaloop load\r\n var vimeoTimer = window.setInterval(function () {\r\n if (_is.object(window.Vimeo)) {\r\n window.clearInterval(vimeoTimer);\r\n _vimeoReady(mediaId, container);\r\n }\r\n }, 50);\r\n } else {\r\n _vimeoReady(mediaId, container);\r\n }\r\n } else if (plyr.type === 'soundcloud') {\r\n // TODO: Currently unsupported and undocumented\r\n // Inject the iframe\r\n var soundCloud = document.createElement('iframe');\r\n\r\n // Watch for iframe load\r\n soundCloud.loaded = false;\r\n _on(soundCloud, 'load', function () {\r\n soundCloud.loaded = true;\r\n });\r\n\r\n _setAttributes(soundCloud, {\r\n src: 'https://w.soundcloud.com/player/?url=https://api.soundcloud.com/tracks/' + mediaId,\r\n id: id,\r\n });\r\n\r\n container.appendChild(soundCloud);\r\n plyr.media.appendChild(container);\r\n\r\n // Load the API if not already\r\n if (!window.SC) {\r\n _injectScript(config.urls.soundcloud.api);\r\n }\r\n\r\n // Wait for SC load\r\n var soundCloudTimer = window.setInterval(function () {\r\n if (window.SC && soundCloud.loaded) {\r\n window.clearInterval(soundCloudTimer);\r\n _soundcloudReady.call(soundCloud);\r\n }\r\n }, 50);\r\n }\r\n }\r\n\r\n // When embeds are ready\r\n function _embedReady() {\r\n // Setup the UI and call ready if full support\r\n if (plyr.supported.full) {\r\n _setupInterface();\r\n _ready();\r\n }\r\n\r\n // Set title\r\n _setTitle(_getElement('iframe'));\r\n }\r\n\r\n // Handle YouTube API ready\r\n function _youTubeReady(videoId, container) {\r\n // Setup instance\r\n // https://developers.google.com/youtube/iframe_api_reference\r\n plyr.embed = new window.YT.Player(container.id, {\r\n videoId: videoId,\r\n playerVars: {\r\n autoplay: config.autoplay ? 1 : 0,\r\n controls: plyr.supported.full ? 0 : 1,\r\n rel: 0,\r\n showinfo: 0,\r\n iv_load_policy: 3,\r\n cc_load_policy: config.captions.defaultActive ? 1 : 0,\r\n cc_lang_pref: 'en',\r\n wmode: 'transparent',\r\n modestbranding: 1,\r\n disablekb: 1,\r\n origin: '*', // https://code.google.com/p/gdata-issues/issues/detail?id=5788#c45\r\n },\r\n events: {\r\n onError: function (event) {\r\n _triggerEvent(plyr.container, 'error', true, {\r\n code: event.data,\r\n embed: event.target,\r\n });\r\n },\r\n onReady: function (event) {\r\n // Get the instance\r\n var instance = event.target;\r\n\r\n // Create a faux HTML5 API using the YouTube API\r\n plyr.media.play = function () {\r\n instance.playVideo();\r\n plyr.media.paused = false;\r\n };\r\n plyr.media.pause = function () {\r\n instance.pauseVideo();\r\n plyr.media.paused = true;\r\n };\r\n plyr.media.stop = function () {\r\n instance.stopVideo();\r\n plyr.media.paused = true;\r\n };\r\n plyr.media.duration = instance.getDuration();\r\n plyr.media.paused = true;\r\n plyr.media.currentTime = 0;\r\n plyr.media.muted = instance.isMuted();\r\n\r\n // Set title if possible\r\n if (typeof instance.getVideoData === 'function') {\r\n config.title = instance.getVideoData().title;\r\n }\r\n\r\n // Set the tabindex\r\n if (plyr.supported.full) {\r\n plyr.media.querySelector('iframe').setAttribute('tabindex', '-1');\r\n }\r\n\r\n // Update UI\r\n _embedReady();\r\n\r\n // Trigger timeupdate\r\n _triggerEvent(plyr.media, 'timeupdate');\r\n\r\n // Trigger timeupdate\r\n _triggerEvent(plyr.media, 'durationchange');\r\n\r\n // Reset timer\r\n window.clearInterval(timers.buffering);\r\n\r\n // Setup buffering\r\n timers.buffering = window.setInterval(function () {\r\n // Get loaded % from YouTube\r\n plyr.media.buffered = instance.getVideoLoadedFraction();\r\n\r\n // Trigger progress only when we actually buffer something\r\n if (plyr.media.lastBuffered === null || plyr.media.lastBuffered < plyr.media.buffered) {\r\n _triggerEvent(plyr.media, 'progress');\r\n }\r\n\r\n // Set last buffer point\r\n plyr.media.lastBuffered = plyr.media.buffered;\r\n\r\n // Bail if we're at 100%\r\n if (plyr.media.buffered === 1) {\r\n window.clearInterval(timers.buffering);\r\n\r\n // Trigger event\r\n _triggerEvent(plyr.media, 'canplaythrough');\r\n }\r\n }, 200);\r\n },\r\n onStateChange: function (event) {\r\n // Get the instance\r\n var instance = event.target;\r\n\r\n // Reset timer\r\n window.clearInterval(timers.playing);\r\n\r\n // Handle events\r\n // -1 Unstarted\r\n // 0 Ended\r\n // 1 Playing\r\n // 2 Paused\r\n // 3 Buffering\r\n // 5 Video cued\r\n switch (event.data) {\r\n case 0:\r\n plyr.media.paused = true;\r\n _triggerEvent(plyr.media, 'ended');\r\n break;\r\n\r\n case 1:\r\n plyr.media.paused = false;\r\n\r\n // If we were seeking, fire seeked event\r\n if (plyr.media.seeking) {\r\n _triggerEvent(plyr.media, 'seeked');\r\n }\r\n\r\n plyr.media.seeking = false;\r\n _triggerEvent(plyr.media, 'play');\r\n _triggerEvent(plyr.media, 'playing');\r\n\r\n // Poll to get playback progress\r\n timers.playing = window.setInterval(function () {\r\n // Set the current time\r\n plyr.media.currentTime = instance.getCurrentTime();\r\n\r\n // Trigger timeupdate\r\n _triggerEvent(plyr.media, 'timeupdate');\r\n }, 100);\r\n\r\n // Check duration again due to YouTube bug\r\n // https://github.com/sampotts/plyr/issues/374\r\n // https://code.google.com/p/gdata-issues/issues/detail?id=8690\r\n if (plyr.media.duration !== instance.getDuration()) {\r\n plyr.media.duration = instance.getDuration();\r\n _triggerEvent(plyr.media, 'durationchange');\r\n }\r\n\r\n break;\r\n\r\n case 2:\r\n plyr.media.paused = true;\r\n _triggerEvent(plyr.media, 'pause');\r\n break;\r\n }\r\n\r\n _triggerEvent(plyr.container, 'statechange', false, {\r\n code: event.data,\r\n });\r\n },\r\n },\r\n });\r\n }\r\n\r\n // Vimeo ready\r\n function _vimeoReady(mediaId, container) {\r\n // Setup instance\r\n // https://github.com/vimeo/player.js\r\n\r\n var options = {\r\n loop: config.loop,\r\n autoplay: config.autoplay,\r\n byline: false,\r\n portrait: false,\r\n title: false,\r\n speed: true,\r\n transparent: 0,\r\n };\r\n\r\n // Convert options into URL params for iframe\r\n function buildUrlParameters(options) {\r\n return Object.keys(options)\r\n .map(function (key) {\r\n return encodeURIComponent(key) + '=' + encodeURIComponent(options[key]);\r\n })\r\n .join('&');\r\n }\r\n\r\n // Get Vimeo params for the iframe\r\n var params = buildUrlParameters(options);\r\n\r\n // Build an iframe\r\n var iframe = document.createElement('iframe');\r\n var src = 'https://player.vimeo.com/video/' + mediaId + '?' + params;\r\n iframe.setAttribute('src', src);\r\n iframe.setAttribute('allowfullscreen', '');\r\n container.appendChild(iframe);\r\n\r\n plyr.embed = new window.Vimeo.Player(iframe);\r\n\r\n // Create a faux HTML5 API using the Vimeo API\r\n plyr.media.play = function () {\r\n plyr.embed.play();\r\n plyr.media.paused = false;\r\n };\r\n plyr.media.pause = function () {\r\n plyr.embed.pause();\r\n plyr.media.paused = true;\r\n };\r\n plyr.media.stop = function () {\r\n plyr.embed.stop();\r\n plyr.media.paused = true;\r\n };\r\n\r\n plyr.media.paused = true;\r\n plyr.media.currentTime = 0;\r\n\r\n // Update UI\r\n _embedReady();\r\n\r\n plyr.embed.getCurrentTime().then(function (value) {\r\n plyr.media.currentTime = value;\r\n\r\n // Trigger timeupdate\r\n _triggerEvent(plyr.media, 'timeupdate');\r\n });\r\n\r\n plyr.embed.getDuration().then(function (value) {\r\n plyr.media.duration = value;\r\n\r\n // Trigger timeupdate\r\n _triggerEvent(plyr.media, 'durationchange');\r\n });\r\n\r\n // TODO: Captions\r\n /*if (config.captions.defaultActive) {\r\n plyr.embed.enableTextTrack('en');\r\n }*/\r\n\r\n plyr.embed.on('loaded', function () {\r\n // Fix keyboard focus issues\r\n // https://github.com/sampotts/plyr/issues/317\r\n if (_is.htmlElement(plyr.embed.element) && plyr.supported.full) {\r\n plyr.embed.element.setAttribute('tabindex', '-1');\r\n }\r\n });\r\n\r\n plyr.embed.on('play', function () {\r\n plyr.media.paused = false;\r\n _triggerEvent(plyr.media, 'play');\r\n _triggerEvent(plyr.media, 'playing');\r\n });\r\n\r\n plyr.embed.on('pause', function () {\r\n plyr.media.paused = true;\r\n _triggerEvent(plyr.media, 'pause');\r\n });\r\n\r\n plyr.embed.on('timeupdate', function (data) {\r\n plyr.media.seeking = false;\r\n plyr.media.currentTime = data.seconds;\r\n _triggerEvent(plyr.media, 'timeupdate');\r\n });\r\n\r\n plyr.embed.on('progress', function (data) {\r\n plyr.media.buffered = data.percent;\r\n _triggerEvent(plyr.media, 'progress');\r\n\r\n if (parseInt(data.percent) === 1) {\r\n // Trigger event\r\n _triggerEvent(plyr.media, 'canplaythrough');\r\n }\r\n });\r\n\r\n plyr.embed.on('seeked', function () {\r\n plyr.media.seeking = false;\r\n _triggerEvent(plyr.media, 'seeked');\r\n _triggerEvent(plyr.media, 'play');\r\n });\r\n\r\n plyr.embed.on('ended', function () {\r\n plyr.media.paused = true;\r\n _triggerEvent(plyr.media, 'ended');\r\n });\r\n }\r\n\r\n // Soundcloud ready\r\n function _soundcloudReady() {\r\n /* jshint validthis: true */\r\n plyr.embed = window.SC.Widget(this);\r\n\r\n // Setup on ready\r\n plyr.embed.bind(window.SC.Widget.Events.READY, function () {\r\n // Create a faux HTML5 API using the Soundcloud API\r\n plyr.media.play = function () {\r\n plyr.embed.play();\r\n plyr.media.paused = false;\r\n };\r\n plyr.media.pause = function () {\r\n plyr.embed.pause();\r\n plyr.media.paused = true;\r\n };\r\n plyr.media.stop = function () {\r\n plyr.embed.seekTo(0);\r\n plyr.embed.pause();\r\n plyr.media.paused = true;\r\n };\r\n\r\n plyr.media.paused = true;\r\n plyr.media.currentTime = 0;\r\n\r\n plyr.embed.getDuration(function (value) {\r\n plyr.media.duration = value / 1000;\r\n\r\n // Update UI\r\n _embedReady();\r\n });\r\n\r\n plyr.embed.getPosition(function (value) {\r\n plyr.media.currentTime = value;\r\n\r\n // Trigger timeupdate\r\n _triggerEvent(plyr.media, 'timeupdate');\r\n });\r\n\r\n plyr.embed.bind(window.SC.Widget.Events.PLAY, function () {\r\n plyr.media.paused = false;\r\n _triggerEvent(plyr.media, 'play');\r\n _triggerEvent(plyr.media, 'playing');\r\n });\r\n\r\n plyr.embed.bind(window.SC.Widget.Events.PAUSE, function () {\r\n plyr.media.paused = true;\r\n _triggerEvent(plyr.media, 'pause');\r\n });\r\n\r\n plyr.embed.bind(window.SC.Widget.Events.PLAY_PROGRESS, function (data) {\r\n plyr.media.seeking = false;\r\n plyr.media.currentTime = data.currentPosition / 1000;\r\n _triggerEvent(plyr.media, 'timeupdate');\r\n });\r\n\r\n plyr.embed.bind(window.SC.Widget.Events.LOAD_PROGRESS, function (data) {\r\n plyr.media.buffered = data.loadProgress;\r\n _triggerEvent(plyr.media, 'progress');\r\n\r\n if (parseInt(data.loadProgress) === 1) {\r\n // Trigger event\r\n _triggerEvent(plyr.media, 'canplaythrough');\r\n }\r\n });\r\n\r\n plyr.embed.bind(window.SC.Widget.Events.FINISH, function () {\r\n plyr.media.paused = true;\r\n _triggerEvent(plyr.media, 'ended');\r\n });\r\n });\r\n }\r\n\r\n // Play media\r\n function _play() {\r\n if ('play' in plyr.media) {\r\n plyr.media.play();\r\n }\r\n }\r\n\r\n // Pause media\r\n function _pause() {\r\n if ('pause' in plyr.media) {\r\n plyr.media.pause();\r\n }\r\n }\r\n\r\n // Toggle playback\r\n function _togglePlay(toggle) {\r\n // True toggle\r\n if (!_is.boolean(toggle)) {\r\n toggle = plyr.media.paused;\r\n }\r\n\r\n if (toggle) {\r\n _play();\r\n } else {\r\n _pause();\r\n }\r\n\r\n return toggle;\r\n }\r\n\r\n // Rewind\r\n function _rewind(seekTime) {\r\n // Use default if needed\r\n if (!_is.number(seekTime)) {\r\n seekTime = config.seekTime;\r\n }\r\n _seek(plyr.media.currentTime - seekTime);\r\n }\r\n\r\n // Fast forward\r\n function _forward(seekTime) {\r\n // Use default if needed\r\n if (!_is.number(seekTime)) {\r\n seekTime = config.seekTime;\r\n }\r\n _seek(plyr.media.currentTime + seekTime);\r\n }\r\n\r\n // Seek to time\r\n // The input parameter can be an event or a number\r\n function _seek(input) {\r\n var targetTime = 0,\r\n paused = plyr.media.paused,\r\n duration = _getDuration();\r\n\r\n if (_is.number(input)) {\r\n targetTime = input;\r\n } else if (_is.object(input) && _inArray(['input', 'change'], input.type)) {\r\n // It's the seek slider\r\n // Seek to the selected time\r\n targetTime = input.target.value / input.target.max * duration;\r\n }\r\n\r\n // Normalise targetTime\r\n if (targetTime < 0) {\r\n targetTime = 0;\r\n } else if (targetTime > duration) {\r\n targetTime = duration;\r\n }\r\n\r\n // Update seek range and progress\r\n _updateSeekDisplay(targetTime);\r\n\r\n // Set the current time\r\n // Try/catch incase the media isn't set and we're calling seek() from source() and IE moans\r\n try {\r\n plyr.media.currentTime = targetTime.toFixed(4);\r\n } catch (e) {\r\n }\r\n\r\n // Embeds\r\n if (_inArray(config.types.embed, plyr.type)) {\r\n switch (plyr.type) {\r\n case 'youtube':\r\n plyr.embed.seekTo(targetTime);\r\n break;\r\n\r\n case 'vimeo':\r\n // Round to nearest second for vimeo\r\n plyr.embed.setCurrentTime(targetTime.toFixed(0));\r\n break;\r\n\r\n case 'soundcloud':\r\n plyr.embed.seekTo(targetTime * 1000);\r\n break;\r\n }\r\n\r\n if (paused) {\r\n _pause();\r\n }\r\n\r\n // Trigger timeupdate\r\n _triggerEvent(plyr.media, 'timeupdate');\r\n\r\n // Set seeking flag\r\n plyr.media.seeking = true;\r\n\r\n // Trigger seeking\r\n _triggerEvent(plyr.media, 'seeking');\r\n }\r\n\r\n // Logging\r\n _log('Seeking to ' + plyr.media.currentTime + ' seconds');\r\n\r\n // Special handling for 'manual' captions\r\n _seekManualCaptions(targetTime);\r\n }\r\n\r\n // Get the duration (or custom if set)\r\n function _getDuration() {\r\n // It should be a number, but parse it just incase\r\n var duration = parseInt(config.duration),\r\n // True duration\r\n mediaDuration = 0;\r\n\r\n // Only if duration available\r\n if (plyr.media.duration !== null && !isNaN(plyr.media.duration)) {\r\n mediaDuration = plyr.media.duration;\r\n }\r\n\r\n // If custom duration is funky, use regular duration\r\n return isNaN(duration) ? mediaDuration : duration;\r\n }\r\n\r\n // Check playing state\r\n function _checkPlaying() {\r\n _toggleClass(plyr.container, config.classes.playing, !plyr.media.paused);\r\n\r\n _toggleClass(plyr.container, config.classes.stopped, plyr.media.paused);\r\n\r\n _toggleControls(plyr.media.paused);\r\n }\r\n\r\n // Save scroll position\r\n function _saveScrollPosition() {\r\n scroll = {\r\n x: window.pageXOffset || 0,\r\n y: window.pageYOffset || 0,\r\n };\r\n }\r\n\r\n // Restore scroll position\r\n function _restoreScrollPosition() {\r\n window.scrollTo(scroll.x, scroll.y);\r\n }\r\n\r\n // Toggle fullscreen\r\n function _toggleFullscreen(event) {\r\n // We don't allow fullscreen on audio player\r\n if (plyr.type === 'audio') {\r\n return\r\n }\r\n\r\n // Check for native support\r\n var nativeSupport = fullscreen.supportsFullScreen;\r\n\r\n if (nativeSupport) {\r\n // If it's a fullscreen change event, update the UI\r\n if (event && event.type === fullscreen.fullScreenEventName) {\r\n plyr.isFullscreen = fullscreen.isFullScreen(plyr.container);\r\n } else {\r\n // Else it's a user request to enter or exit\r\n if (!fullscreen.isFullScreen(plyr.container)) {\r\n // Save scroll position\r\n _saveScrollPosition();\r\n\r\n // Request full screen\r\n fullscreen.requestFullScreen(plyr.container);\r\n } else {\r\n // Bail from fullscreen\r\n fullscreen.cancelFullScreen();\r\n }\r\n\r\n // Check if we're actually full screen (it could fail)\r\n plyr.isFullscreen = fullscreen.isFullScreen(plyr.container);\r\n\r\n return;\r\n }\r\n } else {\r\n // Otherwise, it's a simple toggle\r\n plyr.isFullscreen = !plyr.isFullscreen;\r\n\r\n // Bind/unbind escape key\r\n document.body.style.overflow = plyr.isFullscreen ? 'hidden' : '';\r\n }\r\n\r\n // Set class hook\r\n _toggleClass(plyr.container, config.classes.fullscreen.active, plyr.isFullscreen);\r\n\r\n // Trap focus\r\n _focusTrap(plyr.isFullscreen);\r\n\r\n // Set button state\r\n if (plyr.buttons && plyr.buttons.fullscreen) {\r\n _toggleState(plyr.buttons.fullscreen, plyr.isFullscreen);\r\n }\r\n\r\n // Trigger an event\r\n _triggerEvent(plyr.container, plyr.isFullscreen ? 'enterfullscreen' : 'exitfullscreen', true);\r\n\r\n // Restore scroll position\r\n if (!plyr.isFullscreen && nativeSupport) {\r\n _restoreScrollPosition();\r\n }\r\n }\r\n\r\n // Mute\r\n function _toggleMute(muted) {\r\n // If the method is called without parameter, toggle based on current value\r\n if (!_is.boolean(muted)) {\r\n muted = !plyr.media.muted;\r\n }\r\n\r\n // Set button state\r\n _toggleState(plyr.buttons.mute, muted);\r\n\r\n // Set mute on the player\r\n plyr.media.muted = muted;\r\n\r\n // If volume is 0 after unmuting, set to default\r\n if (plyr.media.volume === 0) {\r\n _setVolume(config.volume);\r\n }\r\n\r\n // Embeds\r\n if (_inArray(config.types.embed, plyr.type)) {\r\n // YouTube\r\n switch (plyr.type) {\r\n case 'youtube':\r\n plyr.embed[plyr.media.muted ? 'mute' : 'unMute']();\r\n break;\r\n\r\n case 'vimeo':\r\n case 'soundcloud':\r\n plyr.embed.setVolume(plyr.media.muted ? 0 : parseFloat(config.volume / config.volumeMax));\r\n break;\r\n }\r\n\r\n // Trigger volumechange for embeds\r\n _triggerEvent(plyr.media, 'volumechange');\r\n }\r\n }\r\n\r\n // Set volume\r\n function _setVolume(volume) {\r\n var max = config.volumeMax,\r\n min = config.volumeMin;\r\n\r\n // Load volume from storage if no value specified\r\n if (_is.undefined(volume)) {\r\n volume = plyr.storage.volume;\r\n }\r\n\r\n // Use config if all else fails\r\n if (volume === null || isNaN(volume)) {\r\n volume = config.volume;\r\n }\r\n\r\n // Maximum is volumeMax\r\n if (volume > max) {\r\n volume = max;\r\n }\r\n // Minimum is volumeMin\r\n if (volume < min) {\r\n volume = min;\r\n }\r\n\r\n // Set the player volume\r\n plyr.media.volume = parseFloat(volume / max);\r\n\r\n // Set the display\r\n if (plyr.volume.display) {\r\n plyr.volume.display.value = volume;\r\n }\r\n\r\n // Embeds\r\n if (_inArray(config.types.embed, plyr.type)) {\r\n switch (plyr.type) {\r\n case 'youtube':\r\n plyr.embed.setVolume(plyr.media.volume * 100);\r\n break;\r\n\r\n case 'vimeo':\r\n case 'soundcloud':\r\n plyr.embed.setVolume(plyr.media.volume);\r\n break;\r\n }\r\n\r\n // Trigger volumechange for embeds\r\n _triggerEvent(plyr.media, 'volumechange');\r\n }\r\n\r\n // Toggle muted state\r\n if (volume === 0) {\r\n plyr.media.muted = true;\r\n } else if (plyr.media.muted && volume > 0) {\r\n _toggleMute();\r\n }\r\n }\r\n\r\n // Increase volume\r\n function _increaseVolume(step) {\r\n var volume = plyr.media.muted ? 0 : plyr.media.volume * config.volumeMax;\r\n\r\n if (!_is.number(step)) {\r\n step = config.volumeStep;\r\n }\r\n\r\n _setVolume(volume + step);\r\n }\r\n\r\n // Decrease volume\r\n function _decreaseVolume(step) {\r\n var volume = plyr.media.muted ? 0 : plyr.media.volume * config.volumeMax;\r\n\r\n if (!_is.number(step)) {\r\n step = config.volumeStep;\r\n }\r\n\r\n _setVolume(volume - step);\r\n }\r\n\r\n // Update volume UI and storage\r\n function _updateVolume() {\r\n // Get the current volume\r\n var volume = plyr.media.muted ? 0 : plyr.media.volume * config.volumeMax;\r\n\r\n // Update the if present\r\n if (plyr.supported.full) {\r\n if (plyr.volume.input) {\r\n plyr.volume.input.value = volume;\r\n }\r\n if (plyr.volume.display) {\r\n plyr.volume.display.value = volume;\r\n }\r\n }\r\n\r\n // Update the volume in storage\r\n _updateStorage({volume: volume});\r\n\r\n // Toggle class if muted\r\n _toggleClass(plyr.container, config.classes.muted, volume === 0);\r\n\r\n // Update checkbox for mute state\r\n if (plyr.supported.full && plyr.buttons.mute) {\r\n _toggleState(plyr.buttons.mute, volume === 0);\r\n }\r\n }\r\n\r\n // Toggle captions\r\n function _toggleCaptions(show) {\r\n // If there's no full support, or there's no caption toggle\r\n if (!plyr.supported.full || !plyr.buttons.captions) {\r\n return;\r\n }\r\n\r\n // If the method is called without parameter, toggle based on current value\r\n if (!_is.boolean(show)) {\r\n show = plyr.container.className.indexOf(config.classes.captions.active) === -1;\r\n }\r\n\r\n // Set global\r\n plyr.captionsEnabled = show;\r\n\r\n // Toggle state\r\n _toggleState(plyr.buttons.captions, plyr.captionsEnabled);\r\n\r\n // Add class hook\r\n _toggleClass(plyr.container, config.classes.captions.active, plyr.captionsEnabled);\r\n\r\n // Trigger an event\r\n _triggerEvent(plyr.container, plyr.captionsEnabled ? 'captionsenabled' : 'captionsdisabled', true);\r\n\r\n // Save captions state to localStorage\r\n _updateStorage({captionsEnabled: plyr.captionsEnabled});\r\n }\r\n\r\n // Check if media is loading\r\n function _checkLoading(event) {\r\n var loading = event.type === 'waiting';\r\n\r\n // Clear timer\r\n clearTimeout(timers.loading);\r\n\r\n // Timer to prevent flicker when seeking\r\n timers.loading = setTimeout(function () {\r\n // Toggle container class hook\r\n _toggleClass(plyr.container, config.classes.loading, loading);\r\n\r\n // Show controls if loading, hide if done\r\n _toggleControls(loading);\r\n }, loading ? 250 : 0);\r\n }\r\n\r\n // Update elements\r\n function _updateProgress(event) {\r\n if (!plyr.supported.full) {\r\n return;\r\n }\r\n\r\n var progress = plyr.progress.played,\r\n value = 0,\r\n duration = _getDuration();\r\n\r\n if (event) {\r\n switch (event.type) {\r\n // Video playing\r\n case 'timeupdate':\r\n case 'seeking':\r\n if (plyr.controls.pressed) {\r\n return;\r\n }\r\n\r\n value = _getPercentage(plyr.media.currentTime, duration);\r\n\r\n // Set seek range value only if it's a 'natural' time event\r\n if (event.type === 'timeupdate' && plyr.buttons.seek) {\r\n plyr.buttons.seek.value = value;\r\n }\r\n\r\n break;\r\n\r\n // Check buffer status\r\n case 'playing':\r\n case 'progress':\r\n progress = plyr.progress.buffer;\r\n value = (function () {\r\n var buffered = plyr.media.buffered;\r\n\r\n if (buffered && buffered.length) {\r\n // HTML5\r\n return _getPercentage(buffered.end(0), duration);\r\n } else if (_is.number(buffered)) {\r\n // YouTube returns between 0 and 1\r\n return buffered * 100;\r\n }\r\n\r\n return 0;\r\n })();\r\n\r\n break;\r\n }\r\n }\r\n\r\n // Set values\r\n _setProgress(progress, value);\r\n }\r\n\r\n // Set value\r\n function _setProgress(progress, value) {\r\n if (!plyr.supported.full) {\r\n return;\r\n }\r\n\r\n // Default to 0\r\n if (_is.undefined(value)) {\r\n value = 0;\r\n }\r\n // Default to buffer or bail\r\n if (_is.undefined(progress)) {\r\n if (plyr.progress && plyr.progress.buffer) {\r\n progress = plyr.progress.buffer;\r\n } else {\r\n return;\r\n }\r\n }\r\n\r\n // One progress element passed\r\n if (_is.htmlElement(progress)) {\r\n progress.value = value;\r\n } else if (progress) {\r\n // Object of progress + text element\r\n if (progress.bar) {\r\n progress.bar.value = value;\r\n }\r\n if (progress.text) {\r\n progress.text.innerHTML = value;\r\n }\r\n }\r\n }\r\n\r\n // Update the displayed time\r\n function _updateTimeDisplay(time, element) {\r\n // Bail if there's no duration display\r\n if (!element) {\r\n return;\r\n }\r\n\r\n // Fallback to 0\r\n if (isNaN(time)) {\r\n time = 0;\r\n }\r\n\r\n plyr.secs = parseInt(time % 60);\r\n plyr.mins = parseInt((time / 60) % 60);\r\n plyr.hours = parseInt((time / 60 / 60) % 60);\r\n\r\n // Do we need to display hours?\r\n var displayHours = parseInt((_getDuration() / 60 / 60) % 60) > 0;\r\n\r\n // Ensure it's two digits. For example, 03 rather than 3.\r\n plyr.secs = ('0' + plyr.secs).slice(-2);\r\n plyr.mins = ('0' + plyr.mins).slice(-2);\r\n\r\n // Render\r\n element.innerHTML = (displayHours ? plyr.hours + ':' : '') + plyr.mins + ':' + plyr.secs;\r\n }\r\n\r\n // Show the duration on metadataloaded\r\n function _displayDuration() {\r\n if (!plyr.supported.full) {\r\n return;\r\n }\r\n\r\n // Determine duration\r\n var duration = _getDuration() || 0;\r\n\r\n // If there's only one time display, display duration there\r\n if (!plyr.duration && config.displayDuration && plyr.media.paused) {\r\n _updateTimeDisplay(duration, plyr.currentTime);\r\n }\r\n\r\n // If there's a duration element, update content\r\n if (plyr.duration) {\r\n _updateTimeDisplay(duration, plyr.duration);\r\n }\r\n\r\n // Update the tooltip (if visible)\r\n _updateSeekTooltip();\r\n }\r\n\r\n // Handle time change event\r\n function _timeUpdate(event) {\r\n // Duration\r\n _updateTimeDisplay(plyr.media.currentTime, plyr.currentTime);\r\n\r\n // Ignore updates while seeking\r\n if (event && event.type === 'timeupdate' && plyr.media.seeking) {\r\n return;\r\n }\r\n\r\n // Playing progress\r\n _updateProgress(event);\r\n }\r\n\r\n // Update seek range and progress\r\n function _updateSeekDisplay(time) {\r\n // Default to 0\r\n if (!_is.number(time)) {\r\n time = 0;\r\n }\r\n\r\n var duration = _getDuration(),\r\n value = _getPercentage(time, duration);\r\n\r\n // Update progress\r\n if (plyr.progress && plyr.progress.played) {\r\n plyr.progress.played.value = value;\r\n }\r\n\r\n // Update seek range input\r\n if (plyr.buttons && plyr.buttons.seek) {\r\n plyr.buttons.seek.value = value;\r\n }\r\n }\r\n\r\n // Update hover tooltip for seeking\r\n function _updateSeekTooltip(event) {\r\n var duration = _getDuration();\r\n\r\n // Bail if setting not true\r\n if (!config.tooltips.seek || !plyr.progress.container || duration === 0) {\r\n return;\r\n }\r\n\r\n // Calculate percentage\r\n var clientRect = plyr.progress.container.getBoundingClientRect(),\r\n percent = 0,\r\n visible = config.classes.tooltip + '--visible';\r\n\r\n // Determine percentage, if already visible\r\n if (!event) {\r\n if (_hasClass(plyr.progress.tooltip, visible)) {\r\n percent = plyr.progress.tooltip.style.left.replace('%', '');\r\n } else {\r\n return;\r\n }\r\n } else {\r\n percent = 100 / clientRect.width * (event.pageX - clientRect.left);\r\n }\r\n\r\n // Set bounds\r\n if (percent < 0) {\r\n percent = 0;\r\n } else if (percent > 100) {\r\n percent = 100;\r\n }\r\n\r\n // Display the time a click would seek to\r\n _updateTimeDisplay(duration / 100 * percent, plyr.progress.tooltip);\r\n\r\n // Set position\r\n plyr.progress.tooltip.style.left = percent + '%';\r\n\r\n // Show/hide the tooltip\r\n // If the event is a moues in/out and percentage is inside bounds\r\n if (event && _inArray(['mouseenter', 'mouseleave'], event.type)) {\r\n _toggleClass(plyr.progress.tooltip, visible, event.type === 'mouseenter');\r\n }\r\n }\r\n\r\n // Show the player controls in fullscreen mode\r\n function _toggleControls(toggle) {\r\n // Don't hide if config says not to, it's audio, or not ready or loading\r\n if (!config.hideControls || plyr.type === 'audio') {\r\n return;\r\n }\r\n\r\n var delay = 0,\r\n isEnterFullscreen = false,\r\n show = toggle,\r\n loading = _hasClass(plyr.container, config.classes.loading);\r\n\r\n // Default to false if no boolean\r\n if (!_is.boolean(toggle)) {\r\n if (toggle && toggle.type) {\r\n // Is the enter fullscreen event\r\n isEnterFullscreen = toggle.type === 'enterfullscreen';\r\n\r\n // Whether to show controls\r\n show = _inArray(['mousemove', 'touchstart', 'mouseenter', 'focus'], toggle.type);\r\n\r\n // Delay hiding on move events\r\n if (_inArray(['mousemove', 'touchmove'], toggle.type)) {\r\n delay = 2000;\r\n }\r\n\r\n // Delay a little more for keyboard users\r\n if (toggle.type === 'focus') {\r\n delay = 3000;\r\n }\r\n } else {\r\n show = _hasClass(plyr.container, config.classes.hideControls);\r\n }\r\n }\r\n\r\n // Clear timer every movement\r\n window.clearTimeout(timers.hover);\r\n\r\n // If the mouse is not over the controls, set a timeout to hide them\r\n if (show || plyr.media.paused || loading) {\r\n _toggleClass(plyr.container, config.classes.hideControls, false);\r\n\r\n // Always show controls when paused or if touch\r\n if (plyr.media.paused || loading) {\r\n return;\r\n }\r\n\r\n // Delay for hiding on touch\r\n if (plyr.browser.isTouch) {\r\n delay = 3000;\r\n }\r\n }\r\n\r\n // If toggle is false or if we're playing (regardless of toggle),\r\n // then set the timer to hide the controls\r\n if (!show || !plyr.media.paused) {\r\n timers.hover = window.setTimeout(function () {\r\n // If the mouse is over the controls (and not entering fullscreen), bail\r\n if ((plyr.controls.pressed || plyr.controls.hover) && !isEnterFullscreen) {\r\n return;\r\n }\r\n\r\n _toggleClass(plyr.container, config.classes.hideControls, true);\r\n }, delay);\r\n }\r\n }\r\n\r\n // Add common function to retrieve media source\r\n function _source(source) {\r\n // If not null or undefined, parse it\r\n if (!_is.undefined(source)) {\r\n _updateSource(source);\r\n return;\r\n }\r\n\r\n // Return the current source\r\n var url;\r\n switch (plyr.type) {\r\n case 'youtube':\r\n url = plyr.embed.getVideoUrl();\r\n break;\r\n\r\n case 'vimeo':\r\n plyr.embed.getVideoUrl.then(function (value) {\r\n url = value;\r\n });\r\n break;\r\n\r\n case 'soundcloud':\r\n plyr.embed.getCurrentSound(function (object) {\r\n url = object.permalink_url;\r\n });\r\n break;\r\n\r\n default:\r\n url = plyr.media.currentSrc;\r\n break;\r\n }\r\n\r\n return url || '';\r\n }\r\n\r\n // Update source\r\n // Sources are not checked for support so be careful\r\n function _updateSource(source) {\r\n if (!_is.object(source) || !('sources' in source) || !source.sources.length) {\r\n _warn('Invalid source format');\r\n return;\r\n }\r\n\r\n // Remove ready class hook\r\n _toggleClass(plyr.container, config.classes.ready, false);\r\n\r\n // Pause playback\r\n _pause();\r\n\r\n // Update seek range and progress\r\n _updateSeekDisplay();\r\n\r\n // Reset buffer progress\r\n _setProgress();\r\n\r\n // Cancel current network requests\r\n _cancelRequests();\r\n\r\n // Setup new source\r\n function setup() {\r\n // Remove embed object\r\n plyr.embed = null;\r\n\r\n // Remove the old media\r\n _remove(plyr.media);\r\n\r\n // Remove video container\r\n if (plyr.type === 'video' && plyr.videoContainer) {\r\n _remove(plyr.videoContainer);\r\n }\r\n\r\n // Reset class name\r\n if (plyr.container) {\r\n plyr.container.removeAttribute('class');\r\n }\r\n\r\n // Set the type\r\n if ('type' in source) {\r\n plyr.type = source.type;\r\n\r\n // Get child type for video (it might be an embed)\r\n if (plyr.type === 'video') {\r\n var firstSource = source.sources[0];\r\n\r\n if ('type' in firstSource && _inArray(config.types.embed, firstSource.type)) {\r\n plyr.type = firstSource.type;\r\n }\r\n }\r\n }\r\n\r\n // Check for support\r\n plyr.supported = supported(plyr.type);\r\n\r\n // Create new markup\r\n switch (plyr.type) {\r\n case 'video':\r\n plyr.media = document.createElement('video');\r\n break;\r\n\r\n case 'audio':\r\n plyr.media = document.createElement('audio');\r\n break;\r\n\r\n case 'youtube':\r\n case 'vimeo':\r\n case 'soundcloud':\r\n plyr.media = document.createElement('div');\r\n plyr.embedId = source.sources[0].src;\r\n break;\r\n }\r\n\r\n // Inject the new element\r\n _prependChild(plyr.container, plyr.media);\r\n\r\n // Autoplay the new source?\r\n if (_is.boolean(source.autoplay)) {\r\n config.autoplay = source.autoplay;\r\n }\r\n\r\n // Set attributes for audio and video\r\n if (_inArray(config.types.html5, plyr.type)) {\r\n if (config.crossorigin) {\r\n plyr.media.setAttribute('crossorigin', '');\r\n }\r\n if (config.autoplay) {\r\n plyr.media.setAttribute('autoplay', '');\r\n }\r\n if ('poster' in source) {\r\n plyr.media.setAttribute('poster', source.poster);\r\n }\r\n if (config.loop) {\r\n plyr.media.setAttribute('loop', '');\r\n }\r\n }\r\n\r\n // Restore class hooks\r\n _toggleClass(plyr.container, config.classes.fullscreen.active, plyr.isFullscreen);\r\n _toggleClass(plyr.container, config.classes.captions.active, plyr.captionsEnabled);\r\n _toggleStyleHook();\r\n\r\n // Set new sources for html5\r\n if (_inArray(config.types.html5, plyr.type)) {\r\n _insertChildElements('source', source.sources);\r\n }\r\n\r\n // Set up from scratch\r\n _setupMedia();\r\n\r\n // HTML5 stuff\r\n if (_inArray(config.types.html5, plyr.type)) {\r\n // Setup captions\r\n if ('tracks' in source) {\r\n _insertChildElements('track', source.tracks);\r\n }\r\n\r\n // Load HTML5 sources\r\n plyr.media.load();\r\n }\r\n\r\n // If HTML5 or embed but not fully supported, setupInterface and call ready now\r\n if (_inArray(config.types.html5, plyr.type) || (_inArray(config.types.embed, plyr.type) && !plyr.supported.full)) {\r\n // Setup interface\r\n _setupInterface();\r\n\r\n // Call ready\r\n _ready();\r\n }\r\n\r\n // Set aria title and iframe title\r\n config.title = source.title;\r\n _setTitle();\r\n }\r\n\r\n // Destroy instance adn wait for callback\r\n // Vimeo throws a wobbly if you don't wait\r\n _destroy(setup, false);\r\n }\r\n\r\n // Update poster\r\n function _updatePoster(source) {\r\n if (plyr.type === 'video') {\r\n plyr.media.setAttribute('poster', source);\r\n }\r\n }\r\n\r\n function onBodyClick() {\r\n _toggleClass(_getElement('.' + config.classes.tabFocus), config.classes.tabFocus, false);\r\n }\r\n\r\n // Listen for control events\r\n function _controlListeners() {\r\n // IE doesn't support input event, so we fallback to change\r\n var inputEvent = plyr.browser.isIE ? 'change' : 'input';\r\n\r\n // Click play/pause helper\r\n function togglePlay() {\r\n var play = _togglePlay();\r\n\r\n // Determine which buttons\r\n var trigger = plyr.buttons[play ? 'play' : 'pause'],\r\n target = plyr.buttons[play ? 'pause' : 'play'];\r\n\r\n // Get the last play button to account for the large play button\r\n if (target) {\r\n if (target.length > 1) {\r\n target = target[target.length - 1];\r\n } else {\r\n target = target[0];\r\n }\r\n }\r\n\r\n // Setup focus and tab focus\r\n if (target) {\r\n var hadTabFocus = _hasClass(trigger, config.classes.tabFocus);\r\n\r\n setTimeout(function () {\r\n target.focus();\r\n\r\n if (hadTabFocus) {\r\n _toggleClass(trigger, config.classes.tabFocus, false);\r\n _toggleClass(target, config.classes.tabFocus, true);\r\n }\r\n }, 100);\r\n }\r\n }\r\n\r\n // Get the focused element\r\n function getFocusElement() {\r\n var focused = document.activeElement;\r\n\r\n if (!focused || focused === document.body) {\r\n focused = null;\r\n } else {\r\n focused = document.querySelector(':focus');\r\n }\r\n\r\n return focused;\r\n }\r\n\r\n // Get the key code for an event\r\n function getKeyCode(event) {\r\n return event.keyCode ? event.keyCode : event.which;\r\n }\r\n\r\n // Detect tab focus\r\n function checkTabFocus(focused) {\r\n for (var button in plyr.buttons) {\r\n var element = plyr.buttons[button];\r\n\r\n if (_is.nodeList(element)) {\r\n for (var i = 0; i < element.length; i++) {\r\n _toggleClass(element[i], config.classes.tabFocus, element[i] === focused);\r\n }\r\n } else {\r\n _toggleClass(element, config.classes.tabFocus, element === focused);\r\n }\r\n }\r\n }\r\n\r\n // Keyboard shortcuts\r\n if (config.keyboardShorcuts.focused) {\r\n var last = null;\r\n\r\n // Handle global presses\r\n if (config.keyboardShorcuts.global) {\r\n _on(window, 'keydown keyup', function (event) {\r\n var code = getKeyCode(event),\r\n focused = getFocusElement(),\r\n allowed = [48, 49, 50, 51, 52, 53, 54, 56, 57, 75, 77, 70, 67],\r\n count = get().length;\r\n\r\n // Only handle global key press if there's only one player\r\n // and the key is in the allowed keys\r\n // and if the focused element is not editable (e.g. text input)\r\n // and any that accept key input http://webaim.org/techniques/keyboard/\r\n if (count === 1 && _inArray(allowed, code) && (!_is.htmlElement(focused) || !_matches(focused, config.selectors.editable))) {\r\n handleKey(event);\r\n }\r\n });\r\n }\r\n\r\n // Handle presses on focused\r\n _on(plyr.container, 'keydown keyup', handleKey);\r\n }\r\n\r\n function handleKey(event) {\r\n var code = getKeyCode(event),\r\n pressed = event.type === 'keydown',\r\n held = pressed && code === last;\r\n\r\n // If the event is bubbled from the media element\r\n // Firefox doesn't get the keycode for whatever reason\r\n if (!_is.number(code)) {\r\n return;\r\n }\r\n\r\n // Seek by the number keys\r\n function seekByKey() {\r\n // Get current duration\r\n var duration = plyr.media.duration;\r\n\r\n // Bail if we have no duration set\r\n if (!_is.number(duration)) {\r\n return;\r\n }\r\n\r\n // Divide the max duration into 10th's and times by the number value\r\n _seek(duration / 10 * (code - 48));\r\n }\r\n\r\n // Handle the key on keydown\r\n // Reset on keyup\r\n if (pressed) {\r\n // Which keycodes should we prevent default\r\n var preventDefault = [48, 49, 50, 51, 52, 53, 54, 56, 57, 32, 75, 38, 40, 77, 39, 37, 70, 67];\r\n\r\n // If the code is found prevent default (e.g. prevent scrolling for arrows)\r\n if (_inArray(preventDefault, code)) {\r\n event.preventDefault();\r\n event.stopPropagation();\r\n }\r\n\r\n switch (code) {\r\n // 0-9\r\n case 48:\r\n case 49:\r\n case 50:\r\n case 51:\r\n case 52:\r\n case 53:\r\n case 54:\r\n case 55:\r\n case 56:\r\n case 57:\r\n if (!held) {\r\n seekByKey();\r\n }\r\n break;\r\n // Space and K key\r\n case 32:\r\n case 75:\r\n if (!held) {\r\n _togglePlay();\r\n }\r\n break;\r\n // Arrow up\r\n case 38:\r\n _increaseVolume();\r\n break;\r\n // Arrow down\r\n case 40:\r\n _decreaseVolume();\r\n break;\r\n // M key\r\n case 77:\r\n if (!held) {\r\n _toggleMute();\r\n }\r\n break;\r\n // Arrow forward\r\n case 39:\r\n _forward();\r\n break;\r\n // Arrow back\r\n case 37:\r\n _rewind();\r\n break;\r\n // F key\r\n case 70:\r\n _toggleFullscreen();\r\n break;\r\n // C key\r\n case 67:\r\n if (!held) {\r\n _toggleCaptions();\r\n }\r\n break;\r\n }\r\n\r\n // Escape is handle natively when in full screen\r\n // So we only need to worry about non native\r\n if (!fullscreen.supportsFullScreen && plyr.isFullscreen && code === 27) {\r\n _toggleFullscreen();\r\n }\r\n\r\n // Store last code for next cycle\r\n last = code;\r\n } else {\r\n last = null;\r\n }\r\n }\r\n\r\n // Focus/tab management\r\n _on(window, 'keyup', function (event) {\r\n var code = getKeyCode(event),\r\n focused = getFocusElement();\r\n\r\n if (code === 9) {\r\n checkTabFocus(focused);\r\n }\r\n });\r\n _on(document.body, 'click', onBodyClick);\r\n for (var button in plyr.buttons) {\r\n var element = plyr.buttons[button];\r\n\r\n _on(element, 'blur', function () {\r\n _toggleClass(element, 'tab-focus', false);\r\n });\r\n }\r\n\r\n // Play\r\n _proxyListener(plyr.buttons.play, 'click', config.listeners.play, togglePlay);\r\n\r\n // Pause\r\n _proxyListener(plyr.buttons.pause, 'click', config.listeners.pause, togglePlay);\r\n\r\n // Restart\r\n _proxyListener(plyr.buttons.restart, 'click', config.listeners.restart, _seek);\r\n\r\n // Rewind\r\n _proxyListener(plyr.buttons.rewind, 'click', config.listeners.rewind, _rewind);\r\n\r\n // Fast forward\r\n _proxyListener(plyr.buttons.forward, 'click', config.listeners.forward, _forward);\r\n\r\n // Seek\r\n _proxyListener(plyr.buttons.seek, inputEvent, config.listeners.seek, _seek);\r\n\r\n // Set volume\r\n _proxyListener(plyr.volume.input, inputEvent, config.listeners.volume, function () {\r\n _setVolume(plyr.volume.input.value);\r\n });\r\n\r\n // Mute\r\n _proxyListener(plyr.buttons.mute, 'click', config.listeners.mute, _toggleMute);\r\n\r\n // Fullscreen\r\n _proxyListener(plyr.buttons.fullscreen, 'click', config.listeners.fullscreen, _toggleFullscreen);\r\n\r\n // Toggle fullscreen when user double clicks on video wrapper\r\n _proxyListener(plyr.container, 'dblclick', config.listeners.fullscreen, _toggleFullscreen);\r\n\r\n // Handle user exiting fullscreen by escaping etc\r\n if (fullscreen.supportsFullScreen) {\r\n _on(document, fullscreen.fullScreenEventName, _toggleFullscreen);\r\n }\r\n\r\n // Captions\r\n _proxyListener(plyr.buttons.captions, 'click', config.listeners.captions, _toggleCaptions);\r\n\r\n // Seek tooltip\r\n _on(plyr.progress.container, 'mouseenter mouseleave mousemove', _updateSeekTooltip);\r\n\r\n // Toggle controls visibility based on mouse movement\r\n if (config.hideControls) {\r\n // Toggle controls on mouse events and entering fullscreen\r\n _on(plyr.container, 'mouseenter mouseleave mousemove touchstart touchend touchcancel touchmove enterfullscreen', _toggleControls);\r\n\r\n // Watch for cursor over controls so they don't hide when trying to interact\r\n _on(plyr.controls, 'mouseenter mouseleave', function (event) {\r\n plyr.controls.hover = event.type === 'mouseenter';\r\n });\r\n\r\n // Watch for cursor over controls so they don't hide when trying to interact\r\n _on(plyr.controls, 'mousedown mouseup touchstart touchend touchcancel', function (event) {\r\n plyr.controls.pressed = _inArray(['mousedown', 'touchstart'], event.type);\r\n });\r\n\r\n // Focus in/out on controls\r\n _on(plyr.controls, 'focus blur', _toggleControls, true);\r\n }\r\n\r\n // Adjust volume on scroll\r\n _on(plyr.volume.input, 'wheel', function (event) {\r\n event.preventDefault();\r\n\r\n // Detect \"natural\" scroll - suppored on OS X Safari only\r\n // Other browsers on OS X will be inverted until support improves\r\n var inverted = event.webkitDirectionInvertedFromDevice,\r\n step = config.volumeStep / 5;\r\n\r\n // Scroll down (or up on natural) to decrease\r\n if (event.deltaY < 0 || event.deltaX > 0) {\r\n if (inverted) {\r\n _decreaseVolume(step);\r\n } else {\r\n _increaseVolume(step);\r\n }\r\n }\r\n\r\n // Scroll up (or down on natural) to increase\r\n if (event.deltaY > 0 || event.deltaX < 0) {\r\n if (inverted) {\r\n _increaseVolume(step);\r\n } else {\r\n _decreaseVolume(step);\r\n }\r\n }\r\n });\r\n }\r\n\r\n // Listen for media events\r\n function _mediaListeners() {\r\n // Time change on media\r\n _on(plyr.media, 'timeupdate seeking', _timeUpdate);\r\n\r\n // Update manual captions\r\n _on(plyr.media, 'timeupdate', _seekManualCaptions);\r\n\r\n // Display duration\r\n _on(plyr.media, 'durationchange loadedmetadata', _displayDuration);\r\n\r\n // Handle the media finishing\r\n _on(plyr.media, 'ended', function () {\r\n // Show poster on end\r\n if (plyr.type === 'video' && config.showPosterOnEnd) {\r\n // Clear\r\n if (plyr.type === 'video') {\r\n _setCaption();\r\n }\r\n\r\n // Restart\r\n _seek();\r\n\r\n // Re-load media\r\n plyr.media.load();\r\n }\r\n });\r\n\r\n // Check for buffer progress\r\n _on(plyr.media, 'progress playing', _updateProgress);\r\n\r\n // Handle native mute\r\n _on(plyr.media, 'volumechange', _updateVolume);\r\n\r\n // Handle native play/pause\r\n _on(plyr.media, 'play pause ended', _checkPlaying);\r\n\r\n // Loading\r\n _on(plyr.media, 'waiting canplay seeked', _checkLoading);\r\n\r\n // Click video\r\n if (config.clickToPlay && plyr.type !== 'audio') {\r\n // Re-fetch the wrapper\r\n var wrapper = _getElement('.' + config.classes.videoWrapper);\r\n\r\n // Bail if there's no wrapper (this should never happen)\r\n if (!wrapper) {\r\n return;\r\n }\r\n\r\n // Set cursor\r\n wrapper.style.cursor = 'pointer';\r\n\r\n // On click play, pause ore restart\r\n _on(wrapper, 'click', function () {\r\n // Touch devices will just show controls (if we're hiding controls)\r\n if (config.hideControls && plyr.browser.isTouch && !plyr.media.paused) {\r\n return;\r\n }\r\n\r\n if (plyr.media.paused) {\r\n _play();\r\n } else if (plyr.media.ended) {\r\n _seek();\r\n _play();\r\n } else {\r\n _pause();\r\n }\r\n });\r\n }\r\n\r\n // Disable right click\r\n if (config.disableContextMenu) {\r\n _on(plyr.media, 'contextmenu', function (event) {\r\n event.preventDefault();\r\n });\r\n }\r\n\r\n // Proxy events to container\r\n // Bubble up key events for Edge\r\n _on(plyr.media, config.events.concat(['keyup', 'keydown']).join(' '), function (event) {\r\n _triggerEvent(plyr.container, event.type, true);\r\n });\r\n }\r\n\r\n // Cancel current network requests\r\n // See https://github.com/sampotts/plyr/issues/174\r\n function _cancelRequests() {\r\n if (!_inArray(config.types.html5, plyr.type)) {\r\n return;\r\n }\r\n\r\n // Remove child sources\r\n var sources = plyr.media.querySelectorAll('source');\r\n for (var i = 0; i < sources.length; i++) {\r\n _remove(sources[i]);\r\n }\r\n\r\n // Set blank video src attribute\r\n // This is to prevent a MEDIA_ERR_SRC_NOT_SUPPORTED error\r\n // Info: http://stackoverflow.com/questions/32231579/how-to-properly-dispose-of-an-html5-video-and-close-socket-or-connection\r\n plyr.media.setAttribute('src', config.blankUrl);\r\n\r\n // Load the new empty source\r\n // This will cancel existing requests\r\n // See https://github.com/sampotts/plyr/issues/174\r\n plyr.media.load();\r\n\r\n // Debugging\r\n _log('Cancelled network requests');\r\n }\r\n\r\n // Destroy an instance\r\n // Event listeners are removed when elements are removed\r\n // http://stackoverflow.com/questions/12528049/if-a-dom-element-is-removed-are-its-listeners-also-removed-from-memory\r\n function _destroy(callback, restore) {\r\n // Bail if the element is not initialized\r\n if (!plyr.init) {\r\n return null;\r\n }\r\n\r\n // Type specific stuff\r\n switch (plyr.type) {\r\n case 'youtube':\r\n // Clear timers\r\n window.clearInterval(timers.buffering);\r\n window.clearInterval(timers.playing);\r\n\r\n // Destroy YouTube API\r\n plyr.embed.destroy();\r\n\r\n // Clean up\r\n cleanUp();\r\n\r\n break;\r\n\r\n case 'vimeo':\r\n // Destroy Vimeo API\r\n // then clean up (wait, to prevent postmessage errors)\r\n plyr.embed.unload().then(cleanUp);\r\n\r\n // Vimeo does not always return\r\n timers.cleanUp = window.setTimeout(cleanUp, 200);\r\n\r\n break;\r\n\r\n case 'video':\r\n case 'audio':\r\n // Restore native video controls\r\n _toggleNativeControls(true);\r\n\r\n // Clean up\r\n cleanUp();\r\n\r\n break;\r\n }\r\n\r\n function cleanUp() {\r\n clearTimeout(timers.cleanUp);\r\n\r\n // Default to restore original element\r\n if (!_is.boolean(restore)) {\r\n restore = true;\r\n }\r\n\r\n // Callback\r\n if (_is.function(callback)) {\r\n callback.call(original);\r\n }\r\n\r\n // Bail if we don't need to restore the original element\r\n if (!restore) {\r\n return;\r\n }\r\n\r\n // Remove init flag\r\n plyr.init = false;\r\n\r\n // Replace the container with the original element provided\r\n plyr.container.parentNode.replaceChild(original, plyr.container);\r\n\r\n // Free container in order for GC to remove it and prevent memory leaks due to added events\r\n plyr.container = null;\r\n\r\n // Allow overflow (set on fullscreen)\r\n document.body.style.overflow = '';\r\n\r\n //remove events\r\n _off(document.body, 'click', onBodyClick);\r\n\r\n // Event\r\n _triggerEvent(original, 'destroyed', true);\r\n }\r\n }\r\n\r\n // Setup a player\r\n function _init() {\r\n // Bail if the element is initialized\r\n if (plyr.init) {\r\n return null;\r\n }\r\n\r\n // Setup the fullscreen api\r\n fullscreen = _fullscreen();\r\n\r\n // Sniff out the browser\r\n plyr.browser = _browserSniff();\r\n\r\n // Bail if nothing to setup\r\n if (!_is.htmlElement(plyr.media)) {\r\n return;\r\n }\r\n\r\n // Load saved settings from localStorage\r\n _setupStorage();\r\n\r\n // Set media type based on tag or data attribute\r\n // Supported: video, audio, vimeo, youtube\r\n var tagName = media.tagName.toLowerCase();\r\n if (tagName === 'div') {\r\n plyr.type = media.getAttribute('data-type');\r\n plyr.embedId = media.getAttribute('data-video-id');\r\n\r\n // Clean up\r\n media.removeAttribute('data-type');\r\n media.removeAttribute('data-video-id');\r\n } else {\r\n plyr.type = tagName;\r\n config.crossorigin = media.getAttribute('crossorigin') !== null;\r\n config.autoplay = config.autoplay || media.getAttribute('autoplay') !== null;\r\n config.loop = config.loop || media.getAttribute('loop') !== null;\r\n }\r\n\r\n // Check for support\r\n plyr.supported = supported(plyr.type);\r\n\r\n // If no native support, bail\r\n if (!plyr.supported.basic) {\r\n return;\r\n }\r\n\r\n // Wrap media\r\n plyr.container = _wrap(media, document.createElement('div'));\r\n\r\n // Allow focus to be captured\r\n plyr.container.setAttribute('tabindex', 0);\r\n\r\n // Add style hook\r\n _toggleStyleHook();\r\n\r\n // Debug info\r\n _log('' + plyr.browser.name + ' ' + plyr.browser.version);\r\n\r\n // Setup media\r\n _setupMedia();\r\n\r\n // Setup interface\r\n // If embed but not fully supported, setupInterface (to avoid flash of controls) and call ready now\r\n if (_inArray(config.types.html5, plyr.type) || (_inArray(config.types.embed, plyr.type) && !plyr.supported.full)) {\r\n // Setup UI\r\n _setupInterface();\r\n\r\n // Call ready\r\n _ready();\r\n\r\n // Set title on button and frame\r\n _setTitle();\r\n }\r\n\r\n // Successful setup\r\n plyr.init = true;\r\n }\r\n\r\n // Setup the UI\r\n function _setupInterface() {\r\n // Don't setup interface if no support\r\n if (!plyr.supported.full) {\r\n _warn('Basic support only', plyr.type);\r\n\r\n // Remove controls\r\n _remove(_getElement(config.selectors.controls.wrapper));\r\n\r\n // Remove large play\r\n _remove(_getElement(config.selectors.buttons.play));\r\n\r\n // Restore native controls\r\n _toggleNativeControls(true);\r\n\r\n // Bail\r\n return;\r\n }\r\n\r\n // Inject custom controls if not present\r\n var controlsMissing = !_getElements(config.selectors.controls.wrapper).length;\r\n if (controlsMissing) {\r\n // Inject custom controls\r\n _injectControls();\r\n }\r\n\r\n // Find the elements\r\n if (!_findElements()) {\r\n return;\r\n }\r\n\r\n // If the controls are injected, re-bind listeners for controls\r\n if (controlsMissing) {\r\n _controlListeners();\r\n }\r\n\r\n // Media element listeners\r\n _mediaListeners();\r\n\r\n // Remove native controls\r\n _toggleNativeControls();\r\n\r\n // Setup fullscreen\r\n _setupFullscreen();\r\n\r\n // Captions\r\n _setupCaptions();\r\n\r\n // Set volume\r\n _setVolume();\r\n _updateVolume();\r\n\r\n // Reset time display\r\n _timeUpdate();\r\n\r\n // Update the UI\r\n _checkPlaying();\r\n\r\n // Display duration\r\n _displayDuration();\r\n }\r\n\r\n api = {\r\n getOriginal: function () {\r\n return original;\r\n },\r\n getContainer: function () {\r\n return plyr.container;\r\n },\r\n getEmbed: function () {\r\n return plyr.embed;\r\n },\r\n getMedia: function () {\r\n return plyr.media;\r\n },\r\n getType: function () {\r\n return plyr.type;\r\n },\r\n getDuration: _getDuration,\r\n getCurrentTime: function () {\r\n return plyr.media.currentTime;\r\n },\r\n getVolume: function () {\r\n return plyr.media.volume;\r\n },\r\n isMuted: function () {\r\n return plyr.media.muted;\r\n },\r\n isReady: function () {\r\n return _hasClass(plyr.container, config.classes.ready);\r\n },\r\n isLoading: function () {\r\n return _hasClass(plyr.container, config.classes.loading);\r\n },\r\n isPaused: function () {\r\n return plyr.media.paused;\r\n },\r\n on: function (event, callback) {\r\n _on(plyr.container, event, callback);\r\n return this;\r\n },\r\n play: _play,\r\n pause: _pause,\r\n stop: function () {\r\n _pause();\r\n _seek();\r\n },\r\n restart: _seek,\r\n rewind: _rewind,\r\n forward: _forward,\r\n seek: _seek,\r\n source: _source,\r\n poster: _updatePoster,\r\n setVolume: _setVolume,\r\n togglePlay: _togglePlay,\r\n toggleMute: _toggleMute,\r\n toggleCaptions: _toggleCaptions,\r\n toggleFullscreen: _toggleFullscreen,\r\n toggleControls: _toggleControls,\r\n isFullscreen: function () {\r\n return plyr.isFullscreen || false;\r\n },\r\n support: function (mimeType) {\r\n return _supportMime(plyr, mimeType);\r\n },\r\n destroy: _destroy,\r\n };\r\n\r\n // Everything done\r\n function _ready() {\r\n // Ready event at end of execution stack\r\n window.setTimeout(function () {\r\n _triggerEvent(plyr.media, 'ready');\r\n }, 0);\r\n\r\n // Set class hook on media element\r\n _toggleClass(plyr.media, defaults.classes.setup, true);\r\n\r\n // Set container class for ready\r\n _toggleClass(plyr.container, config.classes.ready, true);\r\n\r\n // Store a refernce to instance\r\n plyr.media.plyr = api;\r\n\r\n // Autoplay\r\n if (config.autoplay) {\r\n _play();\r\n }\r\n }\r\n\r\n // Initialize instance\r\n _init();\r\n\r\n // If init failed, return null\r\n if (!plyr.init) {\r\n return null;\r\n }\r\n\r\n return api;\r\n }\r\n\r\n // Load a sprite\r\n function loadSprite(url, id) {\r\n var x = new XMLHttpRequest();\r\n\r\n // If the id is set and sprite exists, bail\r\n if (_is.string(id) && _is.htmlElement(document.querySelector('#' + id))) {\r\n return;\r\n }\r\n\r\n // Create placeholder (to prevent loading twice)\r\n var container = document.createElement('div');\r\n container.setAttribute('hidden', '');\r\n if (_is.string(id)) {\r\n container.setAttribute('id', id);\r\n }\r\n document.body.insertBefore(container, document.body.childNodes[0]);\r\n\r\n // Check for CORS support\r\n if ('withCredentials' in x) {\r\n x.open('GET', url, true);\r\n } else {\r\n return;\r\n }\r\n\r\n // Inject hidden div with sprite on load\r\n x.onload = function () {\r\n container.innerHTML = x.responseText;\r\n };\r\n\r\n x.send();\r\n }\r\n\r\n // Check for support\r\n function supported(type) {\r\n var browser = _browserSniff(),\r\n isOldIE = browser.isIE && browser.version <= 9,\r\n isIos = browser.isIos,\r\n isIphone = browser.isIphone,\r\n audioSupport = !!document.createElement('audio').canPlayType,\r\n videoSupport = !!document.createElement('video').canPlayType,\r\n basic = false,\r\n full = false;\r\n\r\n switch (type) {\r\n case 'video':\r\n basic = videoSupport;\r\n full = basic && (!isOldIE && !isIphone);\r\n break;\r\n\r\n case 'audio':\r\n basic = audioSupport;\r\n full = basic && !isOldIE;\r\n break;\r\n\r\n // Vimeo does not seem to be supported on iOS via API\r\n // Issue raised https://github.com/vimeo/player.js/issues/87\r\n case 'vimeo':\r\n basic = true;\r\n full = !isOldIE && !isIos;\r\n break;\r\n\r\n case 'youtube':\r\n basic = true;\r\n full = !isOldIE && !isIos;\r\n\r\n // YouTube seems to work on iOS 10+ on iPad\r\n if (isIos && !isIphone && browser.version >= 10) {\r\n full = true;\r\n }\r\n\r\n break;\r\n\r\n case 'soundcloud':\r\n basic = true;\r\n full = !isOldIE && !isIphone;\r\n break;\r\n\r\n default:\r\n basic = audioSupport && videoSupport;\r\n full = basic && !isOldIE;\r\n }\r\n\r\n return {\r\n basic: basic,\r\n full: full,\r\n };\r\n }\r\n\r\n // Setup function\r\n function setup(targets, options) {\r\n // Get the players\r\n var players = [],\r\n instances = [],\r\n selector = [defaults.selectors.html5, defaults.selectors.embed].join(',');\r\n\r\n // Select the elements\r\n if (_is.string(targets)) {\r\n // String selector passed\r\n targets = document.querySelectorAll(targets);\r\n } else if (_is.htmlElement(targets)) {\r\n // Single HTMLElement passed\r\n targets = [targets];\r\n } else if (!_is.nodeList(targets) && !_is.array(targets) && !_is.string(targets)) {\r\n // No selector passed, possibly options as first argument\r\n // If options are the first argument\r\n if (_is.undefined(options) && _is.object(targets)) {\r\n options = targets;\r\n }\r\n\r\n // Use default selector\r\n targets = document.querySelectorAll(selector);\r\n }\r\n\r\n // Convert NodeList to array\r\n if (_is.nodeList(targets)) {\r\n targets = Array.prototype.slice.call(targets);\r\n }\r\n\r\n // Bail if disabled or no basic support\r\n // You may want to disable certain UAs etc\r\n if (!supported().basic || !targets.length) {\r\n return false;\r\n }\r\n\r\n // Add to container list\r\n function add(target, media) {\r\n if (!_hasClass(media, defaults.classes.hook)) {\r\n players.push({\r\n // Always wrap in a
    for styling\r\n //container: _wrap(media, document.createElement('div')),\r\n // Could be a container or the media itself\r\n target: target,\r\n // This should be the