diff --git a/README.md b/README.md index f29f683..e7b54cb 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@

Official React wrapper for the fullpage.js library

- react-fullpage version + react-fullpage version

- [Demo online](https://alvarotrigo.com/react-fullpage/) | [CodeSandbox](https://codesandbox.io/s/m34yq5q0qx) diff --git a/components/ReactFullpage/index.js b/components/ReactFullpage/index.js index 5dd989d..b9b0082 100644 --- a/components/ReactFullpage/index.js +++ b/components/ReactFullpage/index.js @@ -25,52 +25,44 @@ class ReactFullpage extends React.Component { throw new Error('must provide render prop to '); } - this.state = { initialized: false }; + this.state = { + initialized: false, + }; } componentDidMount() { - const { $, v2compatible = false } = this.props; const opts = this.buildOptions(); - if (v2compatible) { - if (!$ || $ instanceof window.jQuery === false) { - throw new Error('Must provide $ (jQuery) as a prop if using v2 API'); - } - - $(document).ready(() => { - // eslint-disable-line - $('#fullpage').fullpage(opts); - }); - } else if (Fullpage) { + if (Fullpage) { this.init(opts); this.markInitialized(); } } componentDidUpdate(prevProps, prevState) { - if (prevState.initialized === this.state.initialized) { + const newSectionCount = this.getSectionCount(); + const newSlideCount = this.getSlideCount(); + const { sectionCount, slideCount } = this.state; + + /* TODO: add a list of fullpage.js specific props to subscribe too + similar to how callbacks are handled) + */ + + if (this.props.sectionsColor !== prevProps.sectionsColor) { + console.log('rebuilding due to a change in fullpage.js props'); + // NOTE: if fullpage props have changed we need to rebuild + this.destroy(); + this.init(this.buildOptions()); return; } - const { props, fpUtils } = this; - const slideSelector = props.slideSelector || '.slide'; - const sectionSelector = props.sectionSelector || '.section'; - - const activeSection = document.querySelector(`${sectionSelector}.active`); - const activeSectionIndex = activeSection ? fpUtils.index(activeSection): -1; - const activeSlide = document.querySelector(`${sectionSelector}.active${slideSelector}.active`); - const activeSlideIndex = activeSlide ? fpUtils.index(activeSlide) : -1; + if (sectionCount === newSectionCount && slideCount === newSlideCount) { + return; + } + console.log('rebuilding due to a change in fullpage.js sections/slides'); + // NOTE: if sections have changed we need to rebuild this.destroy(); - - if (activeSectionIndex > -1) { - fpUtils.addClass(document.querySelectorAll(sectionSelector)[activeSectionIndex], 'active'); - } - - if (activeSlideIndex > -1) { - fpUtils.addClass(activeSlide, 'active'); - } - this.init(this.buildOptions()); } @@ -78,6 +70,20 @@ class ReactFullpage extends React.Component { this.destroy(); } + getSectionCount() { + const { sectionSelector = '.section' } = this.props; + return document + .querySelectorAll(sectionSelector) + .length; + } + + getSlideCount() { + const { slideSelector = '.slide' } = this.props; + return document + .querySelectorAll(slideSelector) + .length; + } + init(opts) { new Fullpage('#fullpage', opts); // eslint-disable-line this.fullpageApi = window.fullpage_api; @@ -87,22 +93,34 @@ class ReactFullpage extends React.Component { destroy() { // NOTE: need to check for init to support SSR - if (!this.state.initialized) return; - - this.fullpageApi.destroy('all'); + if (typeof window !== 'undefined') { + this + .fullpageApi + .destroy('all'); + } } markInitialized() { - this.setState({ initialized: true }); + this.setState({ + initialized: true, + sectionCount: this.getSectionCount(), + slideCount: this.getSlideCount(), + }); } buildOptions() { - const filterCb = key => !!Object.keys(this.props).find(cb => cb === key); + const filterCb = key => !!Object + .keys(this.props) + .find(cb => cb === key); const registered = fullpageCallbacks.filter(filterCb); const listeners = registered.reduce((result, key) => { - const agg = { ...result }; + const agg = { + ...result, + }; agg[key] = (...args) => { - const newArgs = [key, ...args]; + const newArgs = [ + key, ...args, + ]; this.update(...newArgs); }; @@ -116,10 +134,10 @@ class ReactFullpage extends React.Component { } update(lastEvent, ...args) { - const { v2compatible = false } = this.props; - let state = { ...this.state, + sectionCount: this.getSectionCount(), + getSlideCount: this.getSlideCount(), }; const makeState = callbackParameters => ({ @@ -128,89 +146,43 @@ class ReactFullpage extends React.Component { lastEvent, }); - const fromArgs = argList => - argList.reduce((result, key, i) => { - const value = args[i]; - result[key] = value; // eslint-disable-line - return result; - }, {}); + const fromArgs = argList => argList.reduce((result, key, i) => { + const value = args[i]; + result[key] = value; // eslint-disable-line + return result; + }, {}); - // TODO: change all fromArgs to constants After-* - if (v2compatible) { - // NOTE: remapping callback args for v2 - // https://github.com/alvarotrigo/fullPage.js#callbacks - switch (lastEvent) { - // After-* - case 'afterLoad': - state = makeState(fromArgs(['anchorLink', 'index'])); - break; + // NOTE: remapping callback args to v3 + // https://github.com/alvarotrigo/fullPage.js#callbacks + switch (lastEvent) { + // After-* + case 'afterLoad': + state = makeState(fromArgs(['origin', 'destination', 'direction'])); + break; - case 'afterResponsive': - state = makeState(fromArgs(['isResponsive'])); - break; + case 'afterResize': + state = makeState(fromArgs([''])); + break; - case 'afterSlideLoad': - state = makeState(fromArgs(['anchorLink', 'index', 'slideAnchor', 'slideIndex'])); - break; + case 'afterResponsive': + state = makeState(fromArgs(['isResponsive'])); + break; + + case 'afterSlideLoad': + state = makeState(fromArgs(['section', 'origin', 'destination', 'direction'])); + break; // On-* - case 'onLeave': - state = makeState(fromArgs(['index', 'nextIndex', 'direction'])); - break; + case 'onLeave': + state = makeState(fromArgs(['origin', 'destination', 'direction'])); + break; - case 'onSlideLeave': - state = makeState(fromArgs([ - 'anchorLink', - 'index', - 'slideIndex', - 'direction', - 'nextSlideIndex', - ])); - break; + case 'onSlideLeave': + state = makeState(fromArgs(['section', 'origin', 'slideIndex', 'destination', 'direction'])); + break; - default: - break; - } - } else { - // NOTE: remapping callback args to v3 - // https://github.com/alvarotrigo/fullPage.js#callbacks - switch (lastEvent) { - // After-* - case 'afterLoad': - state = makeState(fromArgs(['origin', 'destination', 'direction'])); - break; - - // TODO: update accoding to new API - case 'afterResize': - state = makeState(fromArgs([''])); - break; - - case 'afterResponsive': - state = makeState(fromArgs(['isResponsive'])); - break; - - case 'afterSlideLoad': - state = makeState(fromArgs(['section', 'origin', 'destination', 'direction'])); - break; - - // On-* - case 'onLeave': - state = makeState(fromArgs(['origin', 'destination', 'direction'])); - break; - - case 'onSlideLeave': - state = makeState(fromArgs([ - 'section', - 'origin', - 'slideIndex', - 'destination', - 'direction', - ])); - break; - - default: - break; - } + default: + break; } this.setState(state, () => { @@ -221,10 +193,7 @@ class ReactFullpage extends React.Component { render() { return (
- {this.state.initialized - ? this.props.render(this) - :
- } + {this.props.render(this)}
); } diff --git a/components/Wrapper/index.js b/components/Wrapper/index.js index ec56fd2..14fd874 100644 --- a/components/Wrapper/index.js +++ b/components/Wrapper/index.js @@ -2,6 +2,6 @@ import React, { Fragment } from 'react'; -const Wrapper = ({ children }) => {children}; +const Wrapper = ({ children }) => {children} export default Wrapper; diff --git a/components/index.js b/components/index.js index 542cd46..c46ff5f 100644 --- a/components/index.js +++ b/components/index.js @@ -11,7 +11,6 @@ export default (() => { exported = require('./ReactFullpageShell').default; } - console.log({ exported }) exported.Wrapper = Wrapper; return exported; diff --git a/dist/react-fullpage-commonjs.js b/dist/react-fullpage-commonjs.js index 0b48e8d..4608619 100644 --- a/dist/react-fullpage-commonjs.js +++ b/dist/react-fullpage-commonjs.js @@ -1,5 +1,5 @@ /*! - * @fullpage/react-fullpage 0.1.2 + * @fullpage/react-fullpage 0.1.3 * https://github.com/alvarotrigo/react-fullpage * @license https://github.com/alvarotrigo/react-fullpage#license * @@ -109,4384 +109,8 @@ var __WEBPACK_AMD_DEFINE_RESULT__;/*! * * Copyright (C) 2015 alvarotrigo.com - A project by Alvaro Trigo */ -(function( root, window, document, factory, undefined) { - if( true ) { - // AMD. Register as an anonymous module. - !(__WEBPACK_AMD_DEFINE_RESULT__ = (function() { - root.fullpage = factory(window, document); - return root.fullpage; - }).call(exports, __webpack_require__, exports, module), - __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); - } else {} -}(this, window, document, function(window, document){ - 'use strict'; - - // keeping central set of classnames and selectors - var WRAPPER = 'fullpage-wrapper'; - var WRAPPER_SEL = '.' + WRAPPER; - - // slimscroll - var SCROLLABLE = 'fp-scrollable'; - var SCROLLABLE_SEL = '.' + SCROLLABLE; - - // util - var RESPONSIVE = 'fp-responsive'; - var NO_TRANSITION = 'fp-notransition'; - var DESTROYED = 'fp-destroyed'; - var ENABLED = 'fp-enabled'; - var VIEWING_PREFIX = 'fp-viewing'; - var ACTIVE = 'active'; - var ACTIVE_SEL = '.' + ACTIVE; - var COMPLETELY = 'fp-completely'; - var COMPLETELY_SEL = '.' + COMPLETELY; - - // section - var SECTION_DEFAULT_SEL = '.section'; - var SECTION = 'fp-section'; - var SECTION_SEL = '.' + SECTION; - var SECTION_ACTIVE_SEL = SECTION_SEL + ACTIVE_SEL; - var TABLE_CELL = 'fp-tableCell'; - var TABLE_CELL_SEL = '.' + TABLE_CELL; - var AUTO_HEIGHT = 'fp-auto-height'; - var AUTO_HEIGHT_SEL = '.' + AUTO_HEIGHT; - var NORMAL_SCROLL = 'fp-normal-scroll'; - var NORMAL_SCROLL_SEL = '.' + NORMAL_SCROLL; - - // section nav - var SECTION_NAV = 'fp-nav'; - var SECTION_NAV_SEL = '#' + SECTION_NAV; - var SECTION_NAV_TOOLTIP = 'fp-tooltip'; - var SECTION_NAV_TOOLTIP_SEL='.'+SECTION_NAV_TOOLTIP; - var SHOW_ACTIVE_TOOLTIP = 'fp-show-active'; - - // slide - var SLIDE_DEFAULT_SEL = '.slide'; - var SLIDE = 'fp-slide'; - var SLIDE_SEL = '.' + SLIDE; - var SLIDE_ACTIVE_SEL = SLIDE_SEL + ACTIVE_SEL; - var SLIDES_WRAPPER = 'fp-slides'; - var SLIDES_WRAPPER_SEL = '.' + SLIDES_WRAPPER; - var SLIDES_CONTAINER = 'fp-slidesContainer'; - var SLIDES_CONTAINER_SEL = '.' + SLIDES_CONTAINER; - var TABLE = 'fp-table'; - var INITIAL = 'fp-initial'; - - // slide nav - var SLIDES_NAV = 'fp-slidesNav'; - var SLIDES_NAV_SEL = '.' + SLIDES_NAV; - var SLIDES_NAV_LINK_SEL = SLIDES_NAV_SEL + ' a'; - var SLIDES_ARROW = 'fp-controlArrow'; - var SLIDES_ARROW_SEL = '.' + SLIDES_ARROW; - var SLIDES_PREV = 'fp-prev'; - var SLIDES_PREV_SEL = '.' + SLIDES_PREV; - var SLIDES_ARROW_PREV = SLIDES_ARROW + ' ' + SLIDES_PREV; - var SLIDES_ARROW_PREV_SEL = SLIDES_ARROW_SEL + SLIDES_PREV_SEL; - var SLIDES_NEXT = 'fp-next'; - var SLIDES_NEXT_SEL = '.' + SLIDES_NEXT; - var SLIDES_ARROW_NEXT = SLIDES_ARROW + ' ' + SLIDES_NEXT; - var SLIDES_ARROW_NEXT_SEL = SLIDES_ARROW_SEL + SLIDES_NEXT_SEL; - - function initialise(containerSelector, options) { - var isLicenseValid = options && new RegExp('([\\d\\w]{8}-){3}[\\d\\w]{8}|OPEN-SOURCE-GPLV3-LICENSE').test(options.licenseKey) || document.domain.indexOf('alvarotrigo.com') > -1; - - //only once my friend! - if(hasClass($('html'), ENABLED)){ displayWarnings(); return; } - - // common jQuery objects - var $htmlBody = $('html, body'); - var $body = $('body')[0]; - - var FP = {}; - - // Creating some defaults, extending them with any options that were provided - options = deepExtend({ - //navigation - menu: false, - anchors:[], - lockAnchors: false, - navigation: false, - navigationPosition: 'right', - navigationTooltips: [], - showActiveTooltip: false, - slidesNavigation: false, - slidesNavPosition: 'bottom', - scrollBar: false, - hybrid: false, - - //scrolling - css3: true, - scrollingSpeed: 700, - autoScrolling: true, - fitToSection: true, - fitToSectionDelay: 1000, - easing: 'easeInOutCubic', - easingcss3: 'ease', - loopBottom: false, - loopTop: false, - loopHorizontal: true, - continuousVertical: false, - continuousHorizontal: false, - scrollHorizontally: false, - interlockedSlides: false, - dragAndMove: false, - offsetSections: false, - resetSliders: false, - fadingEffect: false, - normalScrollElements: null, - scrollOverflow: false, - scrollOverflowReset: false, - scrollOverflowHandler: window.fp_scrolloverflow ? window.fp_scrolloverflow.iscrollHandler : null, - scrollOverflowOptions: null, - touchSensitivity: 5, - normalScrollElementTouchThreshold: 5, - bigSectionsDestination: null, - - //Accessibility - keyboardScrolling: true, - animateAnchor: true, - recordHistory: true, - - //design - controlArrows: true, - controlArrowColor: '#fff', - verticalCentered: true, - sectionsColor : [], - paddingTop: 0, - paddingBottom: 0, - fixedElements: null, - responsive: 0, //backwards compabitility with responsiveWiddth - responsiveWidth: 0, - responsiveHeight: 0, - responsiveSlides: false, - parallax: false, - parallaxOptions: { - type: 'reveal', - percentage: 62, - property: 'translate' - }, - - //Custom selectors - sectionSelector: SECTION_DEFAULT_SEL, - slideSelector: SLIDE_DEFAULT_SEL, - - //events - v2compatible: false, - afterLoad: null, - onLeave: null, - afterRender: null, - afterResize: null, - afterReBuild: null, - afterSlideLoad: null, - onSlideLeave: null, - afterResponsive: null, - - lazyLoading: true - }, options); - - //flag to avoid very fast sliding for landscape sliders - var slideMoving = false; - - var isTouchDevice = navigator.userAgent.match(/(iPhone|iPod|iPad|Android|playbook|silk|BlackBerry|BB10|Windows Phone|Tizen|Bada|webOS|IEMobile|Opera Mini)/); - var isTouch = (('ontouchstart' in window) || (navigator.msMaxTouchPoints > 0) || (navigator.maxTouchPoints)); - var container = typeof containerSelector === 'string' ? $(containerSelector)[0] : containerSelector; - var windowsHeight = getWindowHeight(); - var isResizing = false; - var isWindowFocused = true; - var lastScrolledDestiny; - var lastScrolledSlide; - var canScroll = true; - var scrollings = []; - var controlPressed; - var startingSection; - var isScrollAllowed = {}; - isScrollAllowed.m = { 'up':true, 'down':true, 'left':true, 'right':true }; - isScrollAllowed.k = deepExtend({}, isScrollAllowed.m); - var MSPointer = getMSPointer(); - var events = { - touchmove: 'ontouchmove' in window ? 'touchmove' : MSPointer.move, - touchstart: 'ontouchstart' in window ? 'touchstart' : MSPointer.down - }; - var scrollBarHandler; - var isUnlicensesBannerAdded = false; - - // taken from https://github.com/udacity/ud891/blob/gh-pages/lesson2-focus/07-modals-and-keyboard-traps/solution/modal.js - var focusableElementsString = 'a[href], area[href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), button:not([disabled]), iframe, object, embed, [tabindex="0"], [contenteditable]'; - - //timeouts - var resizeId; - var afterSectionLoadsId; - var afterSlideLoadsId; - var scrollId; - var scrollId2; - var keydownId; - var silentScrollId; - var originals = deepExtend({}, options); //deep copy - var activeAnimation; - var activationKey = {}; - - displayWarnings(); - - //easeInOutCubic animation included in the plugin - window.fp_easings = deepExtend(window.fp_easings, { - easeInOutCubic: function (t, b, c, d) { - if ((t/=d/2) < 1) return c/2*t*t*t + b;return c/2*((t-=2)*t*t + 2) + b; - } - }); - - /** - * Sets the autoScroll option. - * It changes the scroll bar visibility and the history of the site as a result. - */ - function setAutoScrolling(value, type){ - //removing the transformation - if(!value){ - silentScroll(0); - } - - setVariableState('autoScrolling', value, type); - - var element = $(SECTION_ACTIVE_SEL)[0]; - - if(options.autoScrolling && !options.scrollBar){ - css($htmlBody, { - 'overflow': 'hidden', - 'height': '100%' - }); - - setRecordHistory(originals.recordHistory, 'internal'); - - //for IE touch devices - css(container, { - '-ms-touch-action': 'none', - 'touch-action': 'none' - }); - - if(element != null){ - //moving the container up - silentScroll(element.offsetTop); - } - }else{ - css($htmlBody, { - 'overflow' : 'visible', - 'height' : 'initial' - }); - - setRecordHistory(false, 'internal'); - - //for IE touch devices - css(container, { - '-ms-touch-action': '', - 'touch-action': '' - }); - - //extensions only! - removeAnimation(container); - - //scrolling the page to the section with no animation - if (element != null) { - var scrollSettings = getScrollSettings(element.offsetTop); - scrollSettings.element.scrollTo(0, scrollSettings.options); - } - } - - trigger(container, 'setAutoScrolling', value); - } - - /** - * Defines wheter to record the history for each hash change in the URL. - */ - function setRecordHistory(value, type){ - setVariableState('recordHistory', value, type); - } - - /** - * Defines the scrolling speed - */ - function setScrollingSpeed(value, type){ - if(type !== 'internal' && options.fadingEffect && FP.fadingEffect ){ - FP.fadingEffect.update(value); - } - setVariableState('scrollingSpeed', value, type); - } - - /** - * Sets fitToSection - */ - function setFitToSection(value, type){ - setVariableState('fitToSection', value, type); - } - - /** - * Sets lockAnchors - */ - function setLockAnchors(value){ - options.lockAnchors = value; - } - - /** - * Adds or remove the possibility of scrolling through sections by using the mouse wheel or the trackpad. - */ - function setMouseWheelScrolling(value){ - if(value){ - addMouseWheelHandler(); - addMiddleWheelHandler(); - }else{ - removeMouseWheelHandler(); - removeMiddleWheelHandler(); - } - } - - /** - * Adds or remove the possibility of scrolling through sections by using the mouse wheel/trackpad or touch gestures. - * Optionally a second parameter can be used to specify the direction for which the action will be applied. - * - * @param directions string containing the direction or directions separated by comma. - */ - function setAllowScrolling(value, directions){ - if(typeof directions !== 'undefined'){ - directions = directions.replace(/ /g,'').split(','); - - directions.forEach(function (direction){ - setIsScrollAllowed(value, direction, 'm'); - }); - } - else{ - setIsScrollAllowed(value, 'all', 'm'); - } - trigger(container, 'setAllowScrolling', {value: value, directions: directions}); - } - - /** - * Adds or remove the mouse wheel hijacking - */ - function setMouseHijack(value){ - if(value){ - setMouseWheelScrolling(true); - - //not sure what is this doing here alvaro!! - //I'll comment it as it was causing a bug on dragAndMove when swiping for the 1st time - //The page background was visible. We need preventBouncing for drag and move too!! - //and drag And move already disables the default touch events on init turnOffTouch() function! - //if(!usingExtension('dragAndMove') || options.dragAndMove === 'mouseonly'){ - addTouchHandler(); - //} - }else{ - setMouseWheelScrolling(false); - removeTouchHandler(); - } - } - - /** - * Adds or remove the possibility of scrolling through sections by using the keyboard arrow keys - */ - function setKeyboardScrolling(value, directions){ - if(typeof directions !== 'undefined'){ - directions = directions.replace(/ /g,'').split(','); - - directions.forEach(function(direction){ - setIsScrollAllowed(value, direction, 'k'); - }); - }else{ - setIsScrollAllowed(value, 'all', 'k'); - options.keyboardScrolling = value; - } - } - - /** - * Moves the page up one section. - */ - function moveSectionUp(){ - var prev = prevUntil($(SECTION_ACTIVE_SEL)[0], SECTION_SEL); - - //looping to the bottom if there's no more sections above - if (!prev && (options.loopTop || options.continuousVertical)) { - prev = last($(SECTION_SEL)); - } - - if (prev != null) { - scrollPage(prev, null, true); - } - } - - /** - * Moves the page down one section. - */ - function moveSectionDown(){ - var next = nextUntil($(SECTION_ACTIVE_SEL)[0], SECTION_SEL); - - //looping to the top if there's no more sections below - if(!next && - (options.loopBottom || options.continuousVertical)){ - next = $(SECTION_SEL)[0]; - } - - if(next != null){ - scrollPage(next, null, false); - } - } - - /** - * Moves the page to the given section and slide with no animation. - * Anchors or index positions can be used as params. - */ - function silentMoveTo(sectionAnchor, slideAnchor){ - setScrollingSpeed (0, 'internal'); - moveTo(sectionAnchor, slideAnchor); - setScrollingSpeed (originals.scrollingSpeed, 'internal'); - } - - /** - * Moves the page to the given section and slide. - * Anchors or index positions can be used as params. - */ - function moveTo(sectionAnchor, slideAnchor){ - var destiny = getSectionByAnchor(sectionAnchor); - - if (typeof slideAnchor !== 'undefined'){ - scrollPageAndSlide(sectionAnchor, slideAnchor); - }else if(destiny != null){ - scrollPage(destiny); - } - } - - /** - * Slides right the slider of the active section. - * Optional `section` param. - */ - function moveSlideRight(section){ - moveSlide('right', section); - } - - /** - * Slides left the slider of the active section. - * Optional `section` param. - */ - function moveSlideLeft(section){ - moveSlide('left', section); - } - - /** - * When resizing is finished, we adjust the slides sizes and positions - */ - function reBuild(resizing){ - if(hasClass(container, DESTROYED)){ return; } //nothing to do if the plugin was destroyed - - isResizing = true; - - windowsHeight = getWindowHeight(); //updating global var - - var sections = $(SECTION_SEL); - for (var i = 0; i < sections.length; ++i) { - var section = sections[i]; - var slidesWrap = $(SLIDES_WRAPPER_SEL, section)[0]; - var slides = $(SLIDE_SEL, section); - - //adjusting the height of the table-cell for IE and Firefox - if(options.verticalCentered){ - css($(TABLE_CELL_SEL, section), {'height': getTableHeight(section) + 'px'}); - } - - css(section, {'height': getWindowHeightOffset(section) + 'px'}); - - //adjusting the position fo the FULL WIDTH slides... - if (slides.length > 1) { - landscapeScroll(slidesWrap, $(SLIDE_ACTIVE_SEL, slidesWrap)[0]); - } - } - - if(options.scrollOverflow){ - scrollBarHandler.createScrollBarForAll(); - } - - var activeSection = $(SECTION_ACTIVE_SEL)[0]; - var sectionIndex = index(activeSection, SECTION_SEL); - - //isn't it the first section? - if(sectionIndex && !usingExtension('fadingEffect')){ - //adjusting the position for the current section - silentMoveTo(sectionIndex + 1); - } - - isResizing = false; - if(isFunction( options.afterResize ) && resizing){ - options.afterResize.call(container, window.innerWidth, window.innerHeight); - } - if(isFunction( options.afterReBuild ) && !resizing){ - options.afterReBuild.call(container); - } - trigger(container, 'afterRebuild'); - } - - /** - * Turns fullPage.js to normal scrolling mode when the viewport `width` or `height` - * are smaller than the set limit values. - */ - function setResponsive(active){ - var isResponsive = hasClass($body, RESPONSIVE); - - if(active){ - if(!isResponsive){ - setAutoScrolling(false, 'internal'); - setFitToSection(false, 'internal'); - hide($(SECTION_NAV_SEL)); - addClass($body, RESPONSIVE); - if(isFunction( options.afterResponsive )){ - options.afterResponsive.call( container, active); - } - - if(options.responsiveSlides && FP.responsiveSlides){ - FP.responsiveSlides.toSections(); - } - - trigger(container, 'afterResponsive', active); - - //when on page load, we will remove scrolloverflow if necessary - if(options.scrollOverflow){ - scrollBarHandler.createScrollBarForAll(); - } - } - } - else if(isResponsive){ - setAutoScrolling(originals.autoScrolling, 'internal'); - setFitToSection(originals.autoScrolling, 'internal'); - show($(SECTION_NAV_SEL)); - removeClass($body, RESPONSIVE); - if(isFunction( options.afterResponsive )){ - options.afterResponsive.call( container, active); - } - - if(options.responsiveSlides && FP.responsiveSlides){ - FP.responsiveSlides.toSlides(); - } - - trigger(container, 'afterResponsive', active); - } - } - - function getFullpageData(){ - return { - options: options, - internals: { - container: container, - canScroll: canScroll, - isScrollAllowed: isScrollAllowed, - getDestinationPosition: getDestinationPosition, - isTouch: isTouch, - c: checkActivationKey, - getXmovement: getXmovement, - removeAnimation: disableAnimation, - getTransforms: getTransforms, - lazyLoad: lazyLoad, - addAnimation: addAnimation, - performHorizontalMove: performHorizontalMove, - landscapeScroll: landscapeScroll, - silentLandscapeScroll: silentLandscapeScroll, - keepSlidesPosition: keepSlidesPosition, - silentScroll: silentScroll, - styleSlides: styleSlides, - scrollHandler: scrollHandler, - getEventsPage: getEventsPage, - getMSPointer:getMSPointer, - isReallyTouch: isReallyTouch, - usingExtension: usingExtension, - toggleControlArrows: toggleControlArrows, - touchStartHandler: touchStartHandler, - touchMoveHandler: touchMoveHandler - } - }; - } - - if(container){ - //public functions - FP.version = '3.0.2'; - FP.setAutoScrolling = setAutoScrolling; - FP.setRecordHistory = setRecordHistory; - FP.setScrollingSpeed = setScrollingSpeed; - FP.setFitToSection = setFitToSection; - FP.setLockAnchors = setLockAnchors; - FP.setMouseWheelScrolling = setMouseWheelScrolling; - FP.setAllowScrolling = setAllowScrolling; - FP.setKeyboardScrolling = setKeyboardScrolling; - FP.moveSectionUp = moveSectionUp; - FP.moveSectionDown = moveSectionDown; - FP.silentMoveTo = silentMoveTo; - FP.moveTo = moveTo; - FP.moveSlideRight = moveSlideRight; - FP.moveSlideLeft = moveSlideLeft; - FP.fitToSection = fitToSection; - FP.reBuild = reBuild; - FP.setResponsive = setResponsive; - FP.getFullpageData = getFullpageData; - FP.destroy = destroy; - FP.getActiveSection = getActiveSection; - FP.getActiveSlide = getActiveSlide; - FP.landscapeScroll = landscapeScroll; - - FP.test = { - top: '0px', - translate3d: 'translate3d(0px, 0px, 0px)', - translate3dH: (function(){ - var a = []; - for(var i = 0; i < $(options.sectionSelector, container).length; i++){ - a.push('translate3d(0px, 0px, 0px)'); - } - return a; - })(), - left: (function(){ - var a = []; - for(var i = 0; i < $(options.sectionSelector, container).length; i++){ - a.push(0); - } - return a; - })(), - options: options, - setAutoScrolling: setAutoScrolling - }; - - //functions we want to share across files but which are not - //mean to be used on their own by developers - FP.shared ={ - afterRenderActions: afterRenderActions - }; - - window.fullpage_api = FP; - - //Loading extensions - loadExtension('continuousHorizontal'); - loadExtension('scrollHorizontally'); - loadExtension('resetSliders'); - loadExtension('interlockedSlides'); - loadExtension('responsiveSlides'); - loadExtension('fadingEffect'); - loadExtension('dragAndMove'); - loadExtension('offsetSections'); - loadExtension('scrollOverflowReset'); - loadExtension('parallax'); - - if(usingExtension('dragAndMove')){ - FP.dragAndMove.init(); - } - - init(); - - bindEvents(); - - if(usingExtension('dragAndMove')){ - FP.dragAndMove.turnOffTouch(); - } - } - - function init(){ - //if css3 is not supported, it will use jQuery animations - if(options.css3){ - options.css3 = support3d(); - } - - options.scrollBar = options.scrollBar || options.hybrid; - - setOptionsFromDOM(); - prepareDom(); - setAllowScrolling(true); - setMouseHijack(true); - setAutoScrolling(options.autoScrolling, 'internal'); - responsive(); - - //setting the class for the body element - setBodyClass(); - - if(document.readyState === 'complete'){ - scrollToAnchor(); - } - window.addEventListener('load', scrollToAnchor); - } - - function bindEvents(){ - - //when scrolling... - window.addEventListener('scroll', scrollHandler); - - //detecting any change on the URL to scroll to the given anchor link - //(a way to detect back history button as we play with the hashes on the URL) - window.addEventListener('hashchange', hashChangeHandler); - - //when opening a new tab (ctrl + t), `control` won't be pressed when coming back. - window.addEventListener('blur', blurHandler); - - //when resizing the site, we adjust the heights of the sections, slimScroll... - window.addEventListener('resize', resizeHandler); - - //Sliding with arrow keys, both, vertical and horizontal - document.addEventListener('keydown', keydownHandler); - - //to prevent scrolling while zooming - document.addEventListener('keyup', keyUpHandler); - - //Scrolls to the section when clicking the navigation bullet - //simulating the jQuery .on('click') event using delegation - ['click', 'touchstart'].forEach(function(eventName){ - document.addEventListener(eventName, delegatedEvents); - }); - - /** - * Applying normalScroll elements. - * Ignoring the scrolls over the specified selectors. - */ - if(options.normalScrollElements){ - ['mouseenter', 'touchstart'].forEach(function(eventName){ - forMouseLeaveOrTOuch(eventName, false); - }); - - ['mouseleave', 'touchend'].forEach(function(eventName){ - forMouseLeaveOrTOuch(eventName, true); - }); - } - } - - function delegatedEvents(e){ - var target = e.target; - - if(target && closest(target, SECTION_NAV_SEL + ' a')){ - sectionBulletHandler.call(target, e); - } - else if(matches(target, SECTION_NAV_TOOLTIP_SEL)){ - tooltipTextHandler.call(target); - } - else if(matches(target, SLIDES_ARROW_SEL)){ - slideArrowHandler.call(target, e); - } - else if(matches(target, SLIDES_NAV_LINK_SEL) || closest(target, SLIDES_NAV_LINK_SEL) != null){ - slideBulletHandler.call(target, e); - } - } - - function forMouseLeaveOrTOuch(eventName, allowScrolling){ - //a way to pass arguments to the onMouseEnterOrLeave function - document['fp_' + eventName] = allowScrolling; - document.addEventListener(eventName, onMouseEnterOrLeave, true); //capturing phase - } - - function onMouseEnterOrLeave(e) { - if(e.target == document){ - return; - } - var normalSelectors = options.normalScrollElements.split(','); - normalSelectors.forEach(function(normalSelector){ - if(matches(e.target, normalSelector)){ - setMouseHijack(document['fp_' + e.type]); //e.type = eventName - } - }); - } - - /** - * Sets a public internal function based on the extension name. - * @param externalName {String} Extension name with the form fp_[NAME]Extension referring to an external function. - */ - function loadExtension(internalName){ - var externalName = 'fp_' + internalName + 'Extension'; - activationKey[internalName] = options[internalName + 'Key']; - - FP[internalName] = typeof window[externalName] !=='undefined' ? new window[externalName]() : null; - FP[internalName] && FP[internalName].c(internalName); - } - - /** - * Setting options from DOM elements if they are not provided. - */ - function setOptionsFromDOM(){ - - //no anchors option? Checking for them in the DOM attributes - if(!options.anchors.length){ - var attrName = '[data-anchor]'; - var anchors = $(options.sectionSelector.split(',').join(attrName + ',') + attrName, container); - if(anchors.length){ - anchors.forEach(function(item){ - options.anchors.push(item.getAttribute('data-anchor').toString()); - }); - } - } - - //no tooltips option? Checking for them in the DOM attributes - if(!options.navigationTooltips.length){ - var attrName = '[data-tooltip]'; - var tooltips = $(options.sectionSelector.split(',').join(attrName + ',') + attrName, container); - if(tooltips.length){ - tooltips.forEach(function(item){ - options.navigationTooltips.push(item.getAttribute('data-tooltip').toString()); - }); - } - } - } - - /** - * Works over the DOM structure to set it up for the current fullpage options. - */ - function prepareDom(){ - css(container, { - 'height': '100%', - 'position': 'relative' - }); - - //adding a class to recognize the container internally in the code - addClass(container, WRAPPER); - addClass($('html'), ENABLED); - - //due to https://github.com/alvarotrigo/fullPage.js/issues/1502 - windowsHeight = getWindowHeight(); - - removeClass(container, DESTROYED); //in case it was destroyed before initializing it again - - addInternalSelectors(); - extensionCall('parallax', 'init'); - - var sections = $(SECTION_SEL); - - //styling the sections / slides / menu - for(var i = 0; i 0) { - styleSlides(section, slides, numSlides); - }else{ - if(options.verticalCentered){ - addTableClass(section); - } - } - } - - //fixed elements need to be moved out of the plugin container due to problems with CSS3. - if(options.fixedElements && options.css3){ - $(options.fixedElements).forEach(function(item){ - $body.appendChild(item); - }); - } - - //vertical centered of the navigation + active bullet - if(options.navigation){ - addVerticalNavigation(); - } - - enableYoutubeAPI(); - - if(options.fadingEffect && FP.fadingEffect){ - FP.fadingEffect.apply(); - } - - if(options.scrollOverflow){ - scrollBarHandler = options.scrollOverflowHandler.init(options); - }else{ - afterRenderActions(); - } - } - - /** - * Styles the horizontal slides for a section. - */ - function styleSlides(section, slides, numSlides){ - var sliderWidth = numSlides * 100; - var slideWidth = 100 / numSlides; - - var slidesWrapper = document.createElement('div'); - slidesWrapper.className = SLIDES_WRAPPER; //fp-slides - wrapAll(slides, slidesWrapper); - - var slidesContainer = document.createElement('div'); - slidesContainer.className = SLIDES_CONTAINER; //fp-slidesContainer - wrapAll(slides, slidesContainer); - - css($(SLIDES_CONTAINER_SEL, section), {'width': sliderWidth + '%'}); - - if(numSlides > 1){ - if(options.controlArrows){ - createSlideArrows(section); - } - - if(options.slidesNavigation){ - addSlidesNavigation(section, numSlides); - } - } - - slides.forEach(function(slide) { - css(slide, {'width': slideWidth + '%'}); - - if(options.verticalCentered){ - addTableClass(slide); - } - }); - - var startingSlide = $(SLIDE_ACTIVE_SEL, section)[0]; - - //if the slide won't be an starting point, the default will be the first one - //the active section isn't the first one? Is not the first slide of the first section? Then we load that section/slide by default. - if( startingSlide != null && (index($(SECTION_ACTIVE_SEL), SECTION_SEL) !== 0 || (index($(SECTION_ACTIVE_SEL), SECTION_SEL) === 0 && index(startingSlide) !== 0))){ - silentLandscapeScroll(startingSlide, 'internal'); - addClass(startingSlide, INITIAL); - }else{ - addClass(slides[0], ACTIVE); - } - } - - function getWindowHeightOffset(element){ - return (options.offsetSections && FP.offsetSections) ? Math.round(FP.offsetSections.getWindowHeight(element)) : getWindowHeight(); - } - - /** - * Styling vertical sections - */ - function styleSection(section, index){ - //if no active section is defined, the 1st one will be the default one - if(!index && $(SECTION_ACTIVE_SEL)[0] == null) { - addClass(section, ACTIVE); - } - startingSection = $(SECTION_ACTIVE_SEL)[0]; - - css(section, {'height': getWindowHeightOffset(section) + 'px'}); - - if(options.paddingTop){ - css(section, {'padding-top': options.paddingTop}); - } - - if(options.paddingBottom){ - css(section, {'padding-bottom': options.paddingBottom}); - } - - if (typeof options.sectionsColor[index] !== 'undefined') { - css(section, {'background-color': options.sectionsColor[index]}); - } - - if (typeof options.anchors[index] !== 'undefined') { - section.setAttribute('data-anchor', options.anchors[index]); - } - } - - /** - * Sets the data-anchor attributes to the menu elements and activates the current one. - */ - function styleMenu(section, index){ - if (typeof options.anchors[index] !== 'undefined') { - //activating the menu / nav element on load - if(hasClass(section, ACTIVE)){ - activateMenuAndNav(options.anchors[index], index); - } - } - - //moving the menu outside the main container if it is inside (avoid problems with fixed positions when using CSS3 tranforms) - if(options.menu && options.css3 && closest($(options.menu)[0], WRAPPER_SEL) != null){ - $body.appendChild($(options.menu)[0]); - } - } - - /** - * Adds internal classes to be able to provide customizable selectors - * keeping the link with the style sheet. - */ - function addInternalSelectors(){ - addClass($(options.sectionSelector, container), SECTION); - addClass($(options.slideSelector, container), SLIDE); - } - - /** - * Creates the control arrows for the given section - */ - function createSlideArrows(section){ - var arrows = [createElementFromHTML('
'), createElementFromHTML('
')]; - after($(SLIDES_WRAPPER_SEL, section)[0], arrows); - - if(options.controlArrowColor !== '#fff'){ - css($(SLIDES_ARROW_NEXT_SEL, section), {'border-color': 'transparent transparent transparent '+options.controlArrowColor}); - css($(SLIDES_ARROW_PREV_SEL, section), {'border-color': 'transparent '+ options.controlArrowColor + ' transparent transparent'}); - } - - if(!options.loopHorizontal){ - hide($(SLIDES_ARROW_PREV_SEL, section)); - } - } - - /** - * Creates a vertical navigation bar. - */ - function addVerticalNavigation(){ - var navigation = document.createElement('div'); - navigation.setAttribute('id', SECTION_NAV); - - var divUl = document.createElement('ul'); - navigation.appendChild(divUl); - - appendTo(navigation, $body); - var nav = $(SECTION_NAV_SEL)[0]; - - addClass(nav, 'fp-' + options.navigationPosition); - - if(options.showActiveTooltip){ - addClass(nav, SHOW_ACTIVE_TOOLTIP); - } - - var li = ''; - - for (var i = 0; i < $(SECTION_SEL).length; i++) { - var link = ''; - if (options.anchors.length) { - link = options.anchors[i]; - } - - li += '
  • ' + getBulletLinkName(i, 'Section') + ''; - - // Only add tooltip if needed (defined by user) - var tooltip = options.navigationTooltips[i]; - - if (typeof tooltip !== 'undefined' && tooltip !== '') { - li += '
    ' + tooltip + '
    '; - } - - li += '
  • '; - } - $('ul', nav)[0].innerHTML = li; - - //centering it vertically - css($(SECTION_NAV_SEL), {'margin-top': '-' + ($(SECTION_NAV_SEL)[0].offsetHeight/2) + 'px'}); - - //activating the current active section - - var bullet = $('li', $(SECTION_NAV_SEL)[0])[index($(SECTION_ACTIVE_SEL)[0], SECTION_SEL)]; - addClass($('a', bullet), ACTIVE); - } - - /** - * Gets the name for screen readers for a section/slide navigation bullet. - */ - function getBulletLinkName(i, defaultName){ - return options.navigationTooltips[i] - || options.anchors[i] - || defaultName + ' ' + (i+1) - } - - /* - * Enables the Youtube videos API so we can control their flow if necessary. - */ - function enableYoutubeAPI(){ - $('iframe[src*="youtube.com/embed/"]', container).forEach(function(item){ - addURLParam(item, 'enablejsapi=1'); - }); - } - - /** - * Adds a new parameter and its value to the `src` of a given element - */ - function addURLParam(element, newParam){ - var originalSrc = element.getAttribute('src'); - element.setAttribute('src', originalSrc + getUrlParamSign(originalSrc) + newParam); - } - - /* - * Returns the prefix sign to use for a new parameter in an existen URL. - * - * @return {String} ? | & - */ - function getUrlParamSign(url){ - return ( !/\?/.test( url ) ) ? '?' : '&'; - } - - /** - * Actions and callbacks to fire afterRender - */ - function afterRenderActions(){ - var section = $(SECTION_ACTIVE_SEL)[0]; - - addClass(section, COMPLETELY); - - lazyLoad(section); - playMedia(section); - - if(options.scrollOverflow){ - options.scrollOverflowHandler.afterLoad(); - } - - if(isDestinyTheStartingSection() && isFunction(options.afterLoad) ){ - fireCallback('afterLoad', { - activeSection: null, - element: section, - direction: null, - - //for backwards compatibility callback (to be removed in a future!) - anchorLink: section.getAttribute('data-anchor'), - sectionIndex: index(section, SECTION_SEL) - }); - } - - if(isFunction(options.afterRender)){ - fireCallback('afterRender'); - } - trigger(container, 'afterRender'); - } - - /** - * Determines if the URL anchor destiny is the starting section (the one using 'active' class before initialization) - */ - function isDestinyTheStartingSection(){ - var destinationSection = getSectionByAnchor(getAnchorsURL().section); - return !destinationSection || typeof destinationSection !=='undefined' && index(destinationSection) === index(startingSection); - } - - var isScrolling = false; - //var lastScroll = 0; not being used now - - //when scrolling... - function scrollHandler(){ - trigger(container, 'onScroll'); - var currentSection; - - if( (!options.autoScrolling || options.scrollBar || usingExtension('dragAndMove')) && !isDragging()){ - var currentScroll = usingExtension('dragAndMove') ? Math.abs(FP.dragAndMove.getCurrentScroll()) : getScrollTop(); - //var scrollDirection = getScrollDirection(currentScroll); - var visibleSectionIndex = 0; - var screen_mid = currentScroll + (getWindowHeight() / 2.0); - var documentHeight = usingExtension('dragAndMove') ? FP.dragAndMove.getDocumentHeight() : $body.offsetHeight - getWindowHeight(); - var isAtBottom = documentHeight === currentScroll; - var sections = $(SECTION_SEL); - - //when using `auto-height` for a small last section it won't be centered in the viewport - if(isAtBottom){ - visibleSectionIndex = sections.length - 1; - } - //is at top? when using `auto-height` for a small first section it won't be centered in the viewport - else if(!currentScroll){ - visibleSectionIndex = 0; - } - - //taking the section which is showing more content in the viewport - else{ - for (var i = 0; i < sections.length; ++i) { - var section = sections[i]; - - // Pick the the last section which passes the middle line of the screen. - if (section.offsetTop <= screen_mid) - { - visibleSectionIndex = i; - } - } - } - - /* - if(isCompletelyInViewPort(scrollDirection)){ - if(!hasClass($(SECTION_ACTIVE_SEL)[0], COMPLETELY)){ - addClass($(SECTION_ACTIVE_SEL)[0], COMPLETELY); - removeClass(siblings($(SECTION_ACTIVE_SEL)[0]), COMPLETELY); - } - } - */ - - //geting the last one, the current one on the screen - currentSection = sections[visibleSectionIndex]; - - //setting the visible section as active when manually scrolling - //executing only once the first time we reach the section - if(!hasClass(currentSection, ACTIVE)){ - isScrolling = true; - var leavingSection = $(SECTION_ACTIVE_SEL)[0]; - var leavingSectionIndex = index(leavingSection, SECTION_SEL) + 1; - var yMovement = getYmovement(currentSection); - var anchorLink = currentSection.getAttribute('data-anchor'); - var sectionIndex = index(currentSection, SECTION_SEL) + 1; - var activeSlide = $(SLIDE_ACTIVE_SEL, currentSection)[0]; - var slideIndex; - var slideAnchorLink; - var callbacksParams = { - activeSection: leavingSection, - sectionIndex: sectionIndex -1, - anchorLink: anchorLink, - element: currentSection, - leavingSection: leavingSectionIndex, - direction: yMovement - }; - - if(activeSlide){ - slideAnchorLink = activeSlide.getAttribute('data-anchor'); - slideIndex = index(activeSlide); - } - - if(canScroll){ - addClass(currentSection, ACTIVE); - removeClass(siblings(currentSection), ACTIVE); - - extensionCall('parallax', 'afterLoad'); - - if(isFunction( options.onLeave )){ - fireCallback('onLeave', callbacksParams); - } - if(isFunction( options.afterLoad )){ - fireCallback('afterLoad', callbacksParams); - } - - if(options.resetSliders && FP.resetSliders){ - FP.resetSliders.apply({localIsResizing: isResizing, leavingSection: leavingSectionIndex}); - } - - stopMedia(leavingSection); - lazyLoad(currentSection); - playMedia(currentSection); - - activateMenuAndNav(anchorLink, sectionIndex - 1); - - if(options.anchors.length){ - //needed to enter in hashChange event when using the menu with anchor links - lastScrolledDestiny = anchorLink; - } - setState(slideIndex, slideAnchorLink, anchorLink, sectionIndex); - } - - //small timeout in order to avoid entering in hashChange event when scrolling is not finished yet - clearTimeout(scrollId); - scrollId = setTimeout(function(){ - isScrolling = false; - }, 100); - } - - if(options.fitToSection){ - //for the auto adjust of the viewport to fit a whole section - clearTimeout(scrollId2); - - scrollId2 = setTimeout(function(){ - //checking it again in case it changed during the delay - if(options.fitToSection && - - //is the destination element bigger than the viewport? - $(SECTION_ACTIVE_SEL)[0].offsetHeight <= windowsHeight - ){ - fitToSection(); - } - }, options.fitToSectionDelay); - } - } - } - - /** - * Fits the site to the nearest active section - */ - function fitToSection(){ - //checking fitToSection again in case it was set to false before the timeout delay - if(canScroll){ - //allows to scroll to an active section and - //if the section is already active, we prevent firing callbacks - isResizing = true; - - scrollPage($(SECTION_ACTIVE_SEL)[0]); - isResizing = false; - } - } - - /** - * Determines whether the active section has seen in its whole or not. - - function isCompletelyInViewPort(movement){ - var top = $(SECTION_ACTIVE_SEL)[0].offsetTop; - var bottom = top + getWindowHeight(); - - if(movement == 'up'){ - return bottom >= (getScrollTop() + getWindowHeight()); - } - return top <= getScrollTop(); - } - */ - - /** - * Gets the directon of the the scrolling fired by the scroll event. - - function getScrollDirection(currentScroll){ - var direction = currentScroll > lastScroll ? 'down' : 'up'; - - lastScroll = currentScroll; - - //needed for auto-height sections to determine if we want to scroll to the top or bottom of the destination - previousDestTop = currentScroll; - - return direction; - } - */ - - /** - * Determines the way of scrolling up or down: - * by 'automatically' scrolling a section or by using the default and normal scrolling. - */ - function scrolling(type){ - if (!isScrollAllowed.m[type]){ - return; - } - var scrollSection = (type === 'down') ? moveSectionDown : moveSectionUp; - - if(FP.scrollHorizontally){ - scrollSection = FP.scrollHorizontally.getScrollSection(type, scrollSection); - } - - if(options.scrollOverflow){ - var scrollable = options.scrollOverflowHandler.scrollable($(SECTION_ACTIVE_SEL)[0]); - var check = (type === 'down') ? 'bottom' : 'top'; - - if(scrollable != null ){ - //is the scrollbar at the start/end of the scroll? - if(options.scrollOverflowHandler.isScrolled(check, scrollable)){ - scrollSection(); - }else{ - return true; - } - - }else{ - // moved up/down - scrollSection(); - } - }else{ - // moved up/down - scrollSection(); - } - } - - /* - * Preventing bouncing in iOS #2285 - */ - function preventBouncing(e){ - if(options.autoScrolling && isReallyTouch(e)){ - //preventing the easing on iOS devices - preventDefault(e); - } - } - - var touchStartY = 0; - var touchStartX = 0; - var touchEndY = 0; - var touchEndX = 0; - - /* Detecting touch events - - * As we are changing the top property of the page on scrolling, we can not use the traditional way to detect it. - * This way, the touchstart and the touch moves shows an small difference between them which is the - * used one to determine the direction. - */ - function touchMoveHandler(e){ - var activeSection = closest(e.target, SECTION_SEL); - - // additional: if one of the normalScrollElements isn't within options.normalScrollElementTouchThreshold hops up the DOM chain - if (isReallyTouch(e) ) { - - if(options.autoScrolling){ - //preventing the easing on iOS devices - preventDefault(e); - } - - var touchEvents = getEventsPage(e); - - touchEndY = touchEvents.y; - touchEndX = touchEvents.x; - - //if movement in the X axys is greater than in the Y and the currect section has slides... - if ($(SLIDES_WRAPPER_SEL, activeSection).length && Math.abs(touchStartX - touchEndX) > (Math.abs(touchStartY - touchEndY))) { - - //is the movement greater than the minimum resistance to scroll? - if (!slideMoving && Math.abs(touchStartX - touchEndX) > (window.innerWidth / 100 * options.touchSensitivity)) { - if (touchStartX > touchEndX) { - if(isScrollAllowed.m.right){ - moveSlideRight(activeSection); //next - } - } else { - if(isScrollAllowed.m.left){ - moveSlideLeft(activeSection); //prev - } - } - } - } - - //vertical scrolling (only when autoScrolling is enabled) - else if(options.autoScrolling && canScroll){ - - //is the movement greater than the minimum resistance to scroll? - if (Math.abs(touchStartY - touchEndY) > (window.innerHeight / 100 * options.touchSensitivity)) { - if (touchStartY > touchEndY) { - scrolling('down'); - } else if (touchEndY > touchStartY) { - scrolling('up'); - } - } - } - } - } - - /** - * As IE >= 10 fires both touch and mouse events when using a mouse in a touchscreen - * this way we make sure that is really a touch event what IE is detecting. - */ - function isReallyTouch(e){ - //if is not IE || IE is detecting `touch` or `pen` - return typeof e.pointerType === 'undefined' || e.pointerType != 'mouse'; - } - - /** - * Handler for the touch start event. - */ - function touchStartHandler(e){ - - //stopping the auto scroll to adjust to a section - if(options.fitToSection){ - activeAnimation = false; - } - - if(isReallyTouch(e)){ - var touchEvents = getEventsPage(e); - touchStartY = touchEvents.y; - touchStartX = touchEvents.x; - } - } - - /** - * Gets the average of the last `number` elements of the given array. - */ - function getAverage(elements, number){ - var sum = 0; - - //taking `number` elements from the end to make the average, if there are not enought, 1 - var lastElements = elements.slice(Math.max(elements.length - number, 1)); - - for(var i = 0; i < lastElements.length; i++){ - sum = sum + lastElements[i]; - } - - return Math.ceil(sum/number); - } - - /** - * Detecting mousewheel scrolling - * - * http://blogs.sitepointstatic.com/examples/tech/mouse-wheel/index.html - * http://www.sitepoint.com/html5-javascript-mouse-wheel/ - */ - var prevTime = new Date().getTime(); - - function MouseWheelHandler(e) { - var curTime = new Date().getTime(); - var isNormalScroll = hasClass($(COMPLETELY_SEL)[0], NORMAL_SCROLL); - - //is scroll allowed? - if (!isScrollAllowed.m.down && !isScrollAllowed.m.up) { - preventDefault(e); - return false; - } - - //autoscrolling and not zooming? - if(options.autoScrolling && !controlPressed && !isNormalScroll){ - // cross-browser wheel delta - e = e || window.event; - var value = e.wheelDelta || -e.deltaY || -e.detail; - var delta = Math.max(-1, Math.min(1, value)); - - var horizontalDetection = typeof e.wheelDeltaX !== 'undefined' || typeof e.deltaX !== 'undefined'; - var isScrollingVertically = (Math.abs(e.wheelDeltaX) < Math.abs(e.wheelDelta)) || (Math.abs(e.deltaX ) < Math.abs(e.deltaY) || !horizontalDetection); - - //Limiting the array to 150 (lets not waste memory!) - if(scrollings.length > 149){ - scrollings.shift(); - } - - //keeping record of the previous scrollings - scrollings.push(Math.abs(value)); - - //preventing to scroll the site on mouse wheel when scrollbar is present - if(options.scrollBar){ - preventDefault(e); - } - - //time difference between the last scroll and the current one - var timeDiff = curTime-prevTime; - prevTime = curTime; - - //haven't they scrolled in a while? - //(enough to be consider a different scrolling action to scroll another section) - if(timeDiff > 200){ - //emptying the array, we dont care about old scrollings for our averages - scrollings = []; - } - - if(canScroll && !isAnimatingDragging()){ - var averageEnd = getAverage(scrollings, 10); - var averageMiddle = getAverage(scrollings, 70); - var isAccelerating = averageEnd >= averageMiddle; - - //to avoid double swipes... - if(isAccelerating && isScrollingVertically){ - //scrolling down? - if (delta < 0) { - scrolling('down'); - - //scrolling up? - }else { - scrolling('up'); - } - } - } - - return false; - } - - if(options.fitToSection){ - //stopping the auto scroll to adjust to a section - activeAnimation = false; - } - } - - /** - * Slides a slider to the given direction. - * Optional `section` param. - */ - function moveSlide(direction, section){ - var activeSection = section == null ? $(SECTION_ACTIVE_SEL)[0] : section; - var slides = $(SLIDES_WRAPPER_SEL, activeSection)[0]; - - // more than one slide needed and nothing should be sliding - if (slides == null || isAnimatingDragging() || slideMoving || $(SLIDE_SEL, slides).length < 2) { - return; - } - - var currentSlide = $(SLIDE_ACTIVE_SEL, slides)[0]; - var destiny = null; - - if(direction === 'left'){ - destiny = prevUntil(currentSlide, SLIDE_SEL); - }else{ - destiny = nextUntil(currentSlide, SLIDE_SEL); - } - - //isn't there a next slide in the secuence? - if(destiny == null){ - //respect loopHorizontal settin - if (!options.loopHorizontal) return; - - var slideSiblings = siblings(currentSlide); - if(direction === 'left'){ - destiny = slideSiblings[slideSiblings.length - 1]; //last - }else{ - destiny = slideSiblings[0]; //first - } - } - - slideMoving = true && !FP.test.isTesting; - landscapeScroll(slides, destiny, direction); - } - - /** - * Maintains the active slides in the viewport - * (Because the `scroll` animation might get lost with some actions, such as when using continuousVertical) - */ - function keepSlidesPosition(){ - var activeSlides = $(SLIDE_ACTIVE_SEL); - for( var i =0; i previousDestTop; - var sectionBottom = position - windowsHeight + elementHeight; - var bigSectionsDestination = options.bigSectionsDestination; - - //is the destination element bigger than the viewport? - if(elementHeight > windowsHeight){ - //scrolling up? - if(!isScrollingDown && !bigSectionsDestination || bigSectionsDestination === 'bottom' ){ - position = sectionBottom; - } - } - - //sections equal or smaller than the viewport height && scrolling down? || is resizing and its in the last section - else if(isScrollingDown || (isResizing && next(element) == null) ){ - //The bottom of the destination will be at the bottom of the viewport - position = sectionBottom; - } - - if(options.offsetSections && FP.offsetSections){ - position = FP.offsetSections.getSectionPosition(isScrollingDown, position, element); - } - - /* - Keeping record of the last scrolled position to determine the scrolling direction. - No conventional methods can be used as the scroll bar might not be present - AND the section might not be active if it is auto-height and didnt reach the middle - of the viewport. - */ - previousDestTop = position; - return position; - } - - /** - * Scrolls the site to the given element and scrolls to the slide if a callback is given. - */ - function scrollPage(element, callback, isMovementUp){ - if(element == null){ return; } //there's no element to scroll, leaving the function - - var dtop = getDestinationPosition(element); - var slideAnchorLink; - var slideIndex; - - //local variables - var v = { - element: element, - callback: callback, - isMovementUp: isMovementUp, - dtop: dtop, - yMovement: getYmovement(element), - anchorLink: element.getAttribute('data-anchor'), - sectionIndex: index(element, SECTION_SEL), - activeSlide: $(SLIDE_ACTIVE_SEL, element)[0], - activeSection: $(SECTION_ACTIVE_SEL)[0], - leavingSection: index($(SECTION_ACTIVE_SEL), SECTION_SEL) + 1, - - //caching the value of isResizing at the momment the function is called - //because it will be checked later inside a setTimeout and the value might change - localIsResizing: isResizing - }; - - //quiting when destination scroll is the same as the current one - if((v.activeSection == element && !isResizing) || (options.scrollBar && getScrollTop() === v.dtop && !hasClass(element, AUTO_HEIGHT) )){ return; } - - if(v.activeSlide != null){ - slideAnchorLink = v.activeSlide.getAttribute('data-anchor'); - slideIndex = index(v.activeSlide); - } - - //callback (onLeave) if the site is not just resizing and readjusting the slides - if(isFunction(options.onLeave) && !v.localIsResizing){ - var direction = v.yMovement; - - //required for continousVertical - if(typeof isMovementUp !== 'undefined'){ - direction = isMovementUp ? 'up' : 'down'; - } - - //for the callback - v.direction = direction; - - if(fireCallback('onLeave', v) === false){ - return; - } - } - - extensionCall('parallax', 'apply', v); - - // If continuousVertical && we need to wrap around - if (options.autoScrolling && options.continuousVertical && typeof (v.isMovementUp) !== "undefined" && - ((!v.isMovementUp && v.yMovement == 'up') || // Intending to scroll down but about to go up or - (v.isMovementUp && v.yMovement == 'down'))) { // intending to scroll up but about to go down - - v = createInfiniteSections(v); - } - - if(usingExtension('scrollOverflowReset')){ - FP.scrollOverflowReset.setPrevious(v.activeSection); - } - - //pausing media of the leaving section (if we are not just resizing, as destinatino will be the same one) - if(!v.localIsResizing){ - stopMedia(v.activeSection); - } - - if(options.scrollOverflow){ - options.scrollOverflowHandler.beforeLeave(); - } - - addClass(element, ACTIVE); - removeClass(siblings(element), ACTIVE); - lazyLoad(element); - - if(options.scrollOverflow){ - options.scrollOverflowHandler.onLeave(); - } - - //preventing from activating the MouseWheelHandler event - //more than once if the page is scrolling - canScroll = false || FP.test.isTesting; - - setState(slideIndex, slideAnchorLink, v.anchorLink, v.sectionIndex); - - performMovement(v); - - //flag to avoid callingn `scrollPage()` twice in case of using anchor links - lastScrolledDestiny = v.anchorLink; - - activateMenuAndNav(v.anchorLink, getBulletIndex(v)); - } - - /** - /* When using continousVertical we won't get the right sectionIndex onLeave - * because sections positions are temporally in other position in the DOM - * This fixes https://github.com/alvarotrigo/fullPage.js/issues/2917 - */ - function getBulletIndex(v){ - //when using continousVertical the value of v.sectionIndex won't be the real one - //therefore we have to adjust it here to activate properly the navigation bullets - //when not using anchors - if(v.wrapAroundElements != null){ - return v.isMovementUp ? $(SECTION_SEL).length -1 : 0; - } - - //we can not change the value of v.sectionIndex at this point as it is used - //by extensions such as parallax - return v.sectionIndex; - } - - /** - * Dispatch events & callbacks making sure it does it on the right format, depending on - * whether v2compatible is being used or not. - */ - function fireCallback(eventName, v){ - var eventData = getEventData(eventName, v); - - if(!options.v2compatible){ - trigger(container, eventName, eventData); - - if(options[eventName].apply(eventData[Object.keys(eventData)[0]], toArray(eventData)) === false){ - return false; - } - } - else{ - if(options[eventName].apply(eventData[0], eventData.slice(1)) === false){ - return false; - } - } - - return true; - } - - /** - * Makes sure to only create a Panel object if the element exist - */ - function nullOrSection(el){ - return el ? new Section(el) : null; - } - - function nullOrSlide(el){ - return el ? new Slide(el) : null; - } - - /** - * Gets the event's data for the given event on the right format. Depending on whether - * v2compatible is being used or not. - */ - function getEventData(eventName, v){ - var paramsPerEvent; - - if(!options.v2compatible){ - - //using functions to run only the necessary bits within the object - paramsPerEvent = { - afterRender: function(){ - return { - section: nullOrSection($(SECTION_ACTIVE_SEL)[0]), - slide: nullOrSlide($(SLIDE_ACTIVE_SEL, $(SECTION_ACTIVE_SEL)[0])[0]) - }; - }, - onLeave: function(){ - return { - origin: nullOrSection(v.activeSection), - destination: nullOrSection(v.element), - direction: v.direction - }; - }, - - afterLoad: function(){ - return paramsPerEvent.onLeave(); - }, - - afterSlideLoad: function(){ - return { - section: nullOrSection(v.section), - origin: nullOrSlide(v.prevSlide), - destination: nullOrSlide(v.destiny), - direction: v.direction - }; - }, - - onSlideLeave: function(){ - return paramsPerEvent.afterSlideLoad(); - } - }; - } - else{ - paramsPerEvent = { - afterRender: function(){ return [container]; }, - onLeave: function(){ return [v.activeSection, v.leavingSection, (v.sectionIndex + 1), v.direction]; }, - afterLoad: function(){ return [v.element, v.anchorLink, (v.sectionIndex + 1)]; }, - afterSlideLoad: function(){ return [v.destiny, v.anchorLink, (v.sectionIndex + 1), v.slideAnchor, v.slideIndex]; }, - onSlideLeave: function(){ return [v.prevSlide, v.anchorLink, (v.sectionIndex + 1), v.prevSlideIndex, v.direction, v.slideIndex]; }, - }; - } - - return paramsPerEvent[eventName](); - } - - /** - * Performs the vertical movement (by CSS3 or by jQuery) - */ - function performMovement(v){ - // using CSS3 translate functionality - if (options.css3 && options.autoScrolling && !options.scrollBar) { - - // The first section can have a negative value in iOS 10. Not quite sure why: -0.0142822265625 - // that's why we round it to 0. - var translate3d = 'translate3d(0px, -' + Math.round(v.dtop) + 'px, 0px)'; - transformContainer(translate3d, true); - - //even when the scrollingSpeed is 0 there's a little delay, which might cause the - //scrollingSpeed to change in case of using silentMoveTo(); - if(options.scrollingSpeed){ - clearTimeout(afterSectionLoadsId); - afterSectionLoadsId = setTimeout(function () { - afterSectionLoads(v); - }, options.scrollingSpeed); - }else{ - afterSectionLoads(v); - } - } - - // using JS to animate - else{ - var scrollSettings = getScrollSettings(v.dtop); - FP.test.top = -v.dtop + 'px'; - - scrollTo(scrollSettings.element, scrollSettings.options, options.scrollingSpeed, function(){ - if(options.scrollBar){ - - /* Hack! - The timeout prevents setting the most dominant section in the viewport as "active" when the user - scrolled to a smaller section by using the mousewheel (auto scrolling) rather than draging the scroll bar. - - When using scrollBar:true It seems like the scroll events still getting propagated even after the scrolling animation has finished. - */ - setTimeout(function(){ - afterSectionLoads(v); - },30); - }else{ - afterSectionLoads(v); - } - }); - } - } - - /** - * Gets the scrolling settings depending on the plugin autoScrolling option - */ - function getScrollSettings(top){ - var scroll = {}; - - //top property animation - if(options.autoScrolling && !options.scrollBar){ - scroll.options = -top; - scroll.element = $(WRAPPER_SEL)[0]; - } - - //window real scrolling - else{ - scroll.options = top; - scroll.element = window; - } - - return scroll; - } - - /** - * Adds sections before or after the current one to create the infinite effect. - */ - function createInfiniteSections(v){ - // Scrolling down - if (!v.isMovementUp) { - // Move all previous sections to after the active section - after($(SECTION_ACTIVE_SEL)[0], prevAll(v.activeSection, SECTION_SEL).reverse()); - } - else { // Scrolling up - // Move all next sections to before the active section - before($(SECTION_ACTIVE_SEL)[0], nextAll(v.activeSection, SECTION_SEL)); - } - - // Maintain the displayed position (now that we changed the element order) - silentScroll($(SECTION_ACTIVE_SEL)[0].offsetTop); - - // Maintain the active slides visible in the viewport - keepSlidesPosition(); - - // save for later the elements that still need to be reordered - v.wrapAroundElements = v.activeSection; - - // Recalculate animation variables - v.dtop = v.element.offsetTop; - v.yMovement = getYmovement(v.element); - - //sections will temporally have another position in the DOM - //updating this values in case we need them, such as in parallax extension - v.leavingSection = index(v.activeSection, SECTION_SEL) + 1; - v.sectionIndex = index(v.element, SECTION_SEL); - - trigger($(WRAPPER_SEL)[0], 'onContinuousVertical', v); - - return v; - } - - /** - * Fix section order after continuousVertical changes have been animated - */ - function continuousVerticalFixSectionOrder (v) { - // If continuousVertical is in effect (and autoScrolling would also be in effect then), - // finish moving the elements around so the direct navigation will function more simply - if (v.wrapAroundElements == null) { - return; - } - - if (v.isMovementUp) { - before($(SECTION_SEL)[0], v.wrapAroundElements); - } - else { - after($(SECTION_SEL)[$(SECTION_SEL).length-1], v.wrapAroundElements); - } - - silentScroll($(SECTION_ACTIVE_SEL)[0].offsetTop); - - // Maintain the active slides visible in the viewport - keepSlidesPosition(); - - //recalculating the sections data after the changes - v.sectionIndex = index(v.element, SECTION_SEL); - v.leavingSection = index(v.activeSection, SECTION_SEL) + 1; - } - - - /** - * Actions to do once the section is loaded. - */ - function afterSectionLoads (v){ - continuousVerticalFixSectionOrder(v); - - //callback (afterLoad) if the site is not just resizing and readjusting the slides - if(isFunction(options.afterLoad) && !v.localIsResizing){ - fireCallback('afterLoad', v); - } - if(options.scrollOverflow){ - options.scrollOverflowHandler.afterLoad(); - } - - extensionCall('parallax', 'afterLoad'); - - if(usingExtension('scrollOverflowReset')){ - FP.scrollOverflowReset.reset(); - } - - if(usingExtension('resetSliders')){ - FP.resetSliders.apply(v); - } - - if(!v.localIsResizing){ - playMedia(v.element); - } - - addClass(v.element, COMPLETELY); - removeClass(siblings(v.element), COMPLETELY); - - canScroll = true; - - if(isFunction(v.callback)){ - v.callback(); - } - } - - /** - * Sets the value for the given attribute from the `data-` attribute with the same suffix - * ie: data-srcset ==> srcset | data-src ==> src - */ - function setSrc(element, attribute){ - element.setAttribute(attribute, element.getAttribute('data-' + attribute)); - element.removeAttribute('data-' + attribute); - } - - /** - * Lazy loads image, video and audio elements. - */ - function lazyLoad(destiny){ - if (!options.lazyLoading){ - return; - } - - var panel = getSlideOrSection(destiny); - - $('img[data-src], img[data-srcset], source[data-src], source[data-srcset], video[data-src], audio[data-src], iframe[data-src]', panel).forEach(function(element){ - ['src', 'srcset'].forEach(function(type){ - var attribute = element.getAttribute('data-' + type); - if(attribute != null && attribute){ - setSrc(element, type); - } - }); - - if(matches(element, 'source')){ - var elementToPlay = closest(element, 'video, audio'); - if(elementToPlay){ - elementToPlay.load(); - } - } - }); - } - - /** - * Plays video and audio elements. - */ - function playMedia(destiny){ - var panel = getSlideOrSection(destiny); - - //playing HTML5 media elements - $('video, audio', panel).forEach(function(element){ - if( element.hasAttribute('data-autoplay') && typeof element.play === 'function' ) { - element.play(); - } - }); - - //youtube videos - $('iframe[src*="youtube.com/embed/"]', panel).forEach(function(element){ - if ( element.hasAttribute('data-autoplay') ){ - playYoutube(element); - } - - //in case the URL was not loaded yet. On page load we need time for the new URL (with the API string) to load. - element.onload = function() { - if ( element.hasAttribute('data-autoplay') ){ - playYoutube(element); - } - }; - }); - } - - /** - * Plays a youtube video - */ - function playYoutube(element){ - element.contentWindow.postMessage('{"event":"command","func":"playVideo","args":""}', '*'); - } - - /** - * Stops video and audio elements. - */ - function stopMedia(destiny){ - var panel = getSlideOrSection(destiny); - - //stopping HTML5 media elements - $('video, audio', panel).forEach(function(element){ - if( !element.hasAttribute('data-keepplaying') && typeof element.pause === 'function' ) { - element.pause(); - } - }); - - //youtube videos - $('iframe[src*="youtube.com/embed/"]', panel).forEach(function(element){ - if( /youtube\.com\/embed\//.test(element.getAttribute('src')) && !element.hasAttribute('data-keepplaying')){ - element.contentWindow.postMessage('{"event":"command","func":"pauseVideo","args":""}','*'); - } - }); - } - - /** - * Gets the active slide (or section) for the given section - */ - function getSlideOrSection(destiny){ - var slide = $(SLIDE_ACTIVE_SEL, destiny); - if( slide.length ) { - destiny = slide[0]; - } - - return destiny; - } - - // Create Base64 Object - function decode(value){ - var _keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="; - - function decode(e) { - var t = ""; - var n, r, i; - var s, o, u, a; - var f = 0; - e = e.replace(/[^A-Za-z0-9+/=]/g, ""); - while (f < e.length) { - s = _keyStr.indexOf(e.charAt(f++)); - o = _keyStr.indexOf(e.charAt(f++)); - u = _keyStr.indexOf(e.charAt(f++)); - a = _keyStr.indexOf(e.charAt(f++)); - n = s << 2 | o >> 4; - r = (o & 15) << 4 | u >> 2; - i = (u & 3) << 6 | a; - t = t + String.fromCharCode(n); - if (u != 64) { - t = t + String.fromCharCode(r); - } - if (a != 64) { - t = t + String.fromCharCode(i); - } - } - t = _utf8_decode(t); - return t; - } - - function _utf8_decode(e) { - var t = ""; - var n = 0; - var r = 0; - var c1 = 0; - var c2 = 0; - var c3; - while (n < e.length) { - r = e.charCodeAt(n); - if (r < 128) { - t += String.fromCharCode(r); - n++; - } else if (r > 191 && r < 224) { - c2 = e.charCodeAt(n + 1); - t += String.fromCharCode((r & 31) << 6 | c2 & 63); - n += 2; - } else { - c2 = e.charCodeAt(n + 1); - c3 = e.charCodeAt(n + 2); - t += String.fromCharCode((r & 15) << 12 | (c2 & 63) << 6 | c3 & 63); - n += 3; - } - } - return t; - } - - function nada(a){ - return a; - } - - function removeAddedChars(text){ - return text.slice(3).slice(0,-3); - } - - function removeCrap(value){ - var extensionType = value.split('_'); - - if(extensionType.length > 1){ - var withoutDomain = extensionType[1]; - var domainWithAddedChars = value.replace(removeAddedChars(extensionType[1]), '').split('_')[0]; - var domainWithoutAddedChars = domainWithAddedChars; - return domainWithoutAddedChars + '_' + decode(withoutDomain.slice(3).slice(0,-3)); - } - - return removeAddedChars(value); - } - - return nada(removeCrap(decode(value))); - } - - //Gets the domain name from a URL without www - //http://stackoverflow.com/a/13367604/1081396 - function getDomain(){ - if(document.domain.length){ - var parts = document.domain.replace(/^(www\.)/,"").split('.'); - - //is there a subdomain? - while(parts.length > 2){ - var subdomain = parts.shift(); - } - var domain = parts.join('.'); - - return domain.replace(/(^\.*)|(\.*$)/g, ""); - } - return ''; - } - - function isValidActivationKey(extensionName){ - var domainName = getDomain(); - var _0x86bb = ['MTM0bG9jYWxob3N0MjM0','MTM0MC4xMjM0', 'MTM0anNoZWxsLm5ldDIzNA==', 'UDdDQU5ZNlNN']; - var localhost = decode(_0x86bb[0]); - var localIp = decode(_0x86bb[1]); - var jsfiddle = decode(_0x86bb[2]); - var unlimited = decode(_0x86bb[3]); - var isNotTest = [localhost, localIp, jsfiddle].indexOf(domainName) < 0 && domainName.length !== 0; - var isKeyDefined = (typeof activationKey[extensionName] !== 'undefined' && activationKey[extensionName].length); - - if( !isKeyDefined && isNotTest){ return false; } - - var decoded = isKeyDefined ? decode(activationKey[extensionName]) : ''; - - // [0] = domain [1] = extensionName - decoded = decoded.split('_'); - - var extensionMatches = decoded.length > 1 && decoded[1].indexOf(extensionName, decoded[1].length - extensionName.length) > -1; - var domainDoesntMatch = decoded[0].indexOf(domainName, decoded[0].length - domainName.length) < 0; - - return !(domainDoesntMatch && isNotTest && unlimited!=decoded[0]) && extensionMatches || !isNotTest; - } - - var bannerContent; - var objectElement; - var destroyedId; - - function onBannerChange(mutations){ - mutations.forEach(function(mutation) { - if(mutation.removedNodes[0] && mutation.removedNodes[0].isEqualNode(objectElement)){ - //in case they try to destory it... this will get fired with removed form the DOM - clearTimeout(destroyedId); - destroyedId = setTimeout(destroyed, 900); - } - }); - } - - function destroyed(){ - isUnlicensesBannerAdded = false; - } - - function checkActivationKey(extensionName){ - objectElement = document.createElement('div'); - bannerContent = decode('MTIzPGRpdj48YSBocmVmPSJodHRwOi8vYWx2YXJvdHJpZ28uY29tL2Z1bGxQYWdlL2V4dGVuc2lvbnMvIiBzdHlsZT0iY29sb3I6ICNmZmYgIWltcG9ydGFudDsgdGV4dC1kZWNvcmF0aW9uOm5vbmUgIWltcG9ydGFudDsiPlVubGljZW5zZWQgZnVsbFBhZ2UuanMgRXh0ZW5zaW9uPC9hPjwvZGl2PjEyMw=='); - objectElement.innerHTML = bannerContent; - objectElement = objectElement.firstChild; - - if ("MutationObserver" in window) { - var observer = new MutationObserver(onBannerChange); - observer.observe(document.body, { - childList:true, - subtree:false - }); - } - - //do nothing if not active or present - if(!usingExtension(extensionName) || !FP[extensionName]){ - return; - } - - if(!isValidActivationKey(extensionName)){ - addWarning(); - //https://jsfiddle.net/youxkay0/ - //
    xxx
    - setInterval(addWarning, 2*1000); - } - } - - function addWarning(){ - if(!objectElement){return;} - - if(!isUnlicensesBannerAdded){ - if(Math.random() < 0.5){ - prependTo($body, objectElement); - }else{ - appendTo(objectElement, $body); - } - - isUnlicensesBannerAdded = true; - } - - objectElement.setAttribute('style', decode('MTIzei1pbmRleDo5OTk5OTk5O3Bvc2l0aW9uOmZpeGVkO3RvcDoyMHB4O2JvdHRvbTphdXRvO2xlZnQ6MjBweDtyaWdodDphdXRvO2JhY2tncm91bmQ6cmVkO3BhZGRpbmc6N3B4IDE1cHg7Zm9udC1zaXplOjE0cHg7Zm9udC1mYW1pbHk6YXJpYWw7Y29sb3I6I2ZmZjtkaXNwbGF5OmlubGluZS1ibG9jazt0cmFuc2Zvcm06dHJhbnNsYXRlM2QoMCwwLDApO29wYWNpdHk6MTtoZWlnaHQ6YXV0bzt3aWR0aDphdXRvO3pvb206MTttYXJnaW46YXV0bztib3JkZXI6bm9uZTt2aXNpYmlsaXR5OnZpc2libGU7Y2xpcC1wYXRoOm5vbmU7MTIz').replace(/;/g, decode('MTIzICFpbXBvcnRhbnQ7MzQ1'))); - - } - - /** - * Scrolls to the anchor in the URL when loading the site - */ - function scrollToAnchor(){ - var anchors = getAnchorsURL(); - var sectionAnchor = anchors.section; - var slideAnchor = anchors.slide; - - if(sectionAnchor){ //if theres any # - if(options.animateAnchor){ - scrollPageAndSlide(sectionAnchor, slideAnchor); - }else{ - silentMoveTo(sectionAnchor, slideAnchor); - } - } - } - - /** - * Detecting any change on the URL to scroll to the given anchor link - * (a way to detect back history button as we play with the hashes on the URL) - */ - function hashChangeHandler(){ - if(!isScrolling && !options.lockAnchors){ - var anchors = getAnchorsURL(); - var sectionAnchor = anchors.section; - var slideAnchor = anchors.slide; - - //when moving to a slide in the first section for the first time (first time to add an anchor to the URL) - var isFirstSlideMove = (typeof lastScrolledDestiny === 'undefined'); - var isFirstScrollMove = (typeof lastScrolledDestiny === 'undefined' && typeof slideAnchor === 'undefined' && !slideMoving); - - if(sectionAnchor && sectionAnchor.length){ - /*in order to call scrollpage() only once for each destination at a time - It is called twice for each scroll otherwise, as in case of using anchorlinks `hashChange` - event is fired on every scroll too.*/ - if ((sectionAnchor && sectionAnchor !== lastScrolledDestiny) && !isFirstSlideMove - || isFirstScrollMove - || (!slideMoving && lastScrolledSlide != slideAnchor )){ - - scrollPageAndSlide(sectionAnchor, slideAnchor); - } - } - } - } - - //gets the URL anchors (section and slide) - function getAnchorsURL(){ - var section; - var slide; - var hash = window.location.hash; - - if(hash.length){ - //getting the anchor link in the URL and deleting the `#` - var anchorsParts = hash.replace('#', '').split('/'); - - //using / for visual reasons and not as a section/slide separator #2803 - var isFunkyAnchor = hash.indexOf('#/') > -1; - - section = isFunkyAnchor ? '/' + anchorsParts[1] : decodeURIComponent(anchorsParts[0]); - - var slideAnchor = isFunkyAnchor ? anchorsParts[2] : anchorsParts[1]; - if(slideAnchor && slideAnchor.length){ - slide = decodeURIComponent(slideAnchor); - } - } - - return { - section: section, - slide: slide - }; - } - - //Sliding with arrow keys, both, vertical and horizontal - function keydownHandler(e) { - clearTimeout(keydownId); - - var activeElement = document.activeElement; - var keyCode = e.keyCode; - - //tab? - if(keyCode === 9){ - onTab(e); - } - - else if(!matches(activeElement, 'textarea') && !matches(activeElement, 'input') && !matches(activeElement, 'select') && - activeElement.getAttribute('contentEditable') !== "true" && activeElement.getAttribute('contentEditable') !== '' && - options.keyboardScrolling && options.autoScrolling){ - - //preventing the scroll with arrow keys & spacebar & Page Up & Down keys - var keyControls = [40, 38, 32, 33, 34]; - if(keyControls.indexOf(keyCode) > -1){ - preventDefault(e); - } - - controlPressed = e.ctrlKey; - - keydownId = setTimeout(function(){ - onkeydown(e); - },150); - } - } - - function tooltipTextHandler(){ - /*jshint validthis:true */ - trigger(prev(this), 'click'); - } - - //to prevent scrolling while zooming - function keyUpHandler(e){ - if(isWindowFocused){ //the keyup gets fired on new tab ctrl + t in Firefox - controlPressed = e.ctrlKey; - } - } - - //binding the mousemove when the mouse's middle button is released - function mouseDownHandler(e){ - //middle button - if (e.which == 2){ - oldPageY = e.pageY; - container.addEventListener('mousemove', mouseMoveHandler); - } - } - - //unbinding the mousemove when the mouse's middle button is released - function mouseUpHandler(e){ - //middle button - if (e.which == 2){ - container.removeEventListener('mousemove', mouseMoveHandler); - } - } - - /** - * Makes sure the tab key will only focus elements within the current section/slide - * preventing this way from breaking the page. - * Based on "Modals and keyboard traps" - * from https://developers.google.com/web/fundamentals/accessibility/focus/using-tabindex - */ - function onTab(e){ - var isShiftPressed = e.shiftKey; - var activeElement = document.activeElement; - var focusableElements = getFocusables(getSlideOrSection($(SECTION_ACTIVE_SEL)[0])); - - function preventAndFocusFirst(e){ - preventDefault(e); - return focusableElements[0] ? focusableElements[0].focus() : null; - } - - //outside any section or slide? Let's not hijack the tab! - if(isFocusOutside(e)){ - return; - } - - //is there an element with focus? - if(activeElement){ - if(closest(activeElement, SECTION_ACTIVE_SEL + ',' + SECTION_ACTIVE_SEL + ' ' + SLIDE_ACTIVE_SEL) == null){ - activeElement = preventAndFocusFirst(e); - } - } - - //no element if focused? Let's focus the first one of the section/slide - else{ - preventAndFocusFirst(e); - } - - //when reached the first or last focusable element of the section/slide - //we prevent the tab action to keep it in the last focusable element - if(!isShiftPressed && activeElement == focusableElements[focusableElements.length - 1] || - isShiftPressed && activeElement == focusableElements[0] - ){ - preventDefault(e); - } - } - - /** - * Gets all the focusable elements inside the passed element. - */ - function getFocusables(el){ - return [].slice.call($(focusableElementsString, el)).filter(function(item) { - return item.getAttribute('tabindex') !== '-1' - //are also not hidden elements (or with hidden parents) - && item.offsetParent !== null; - }); - } - - /** - * Determines whether the focus is outside fullpage.js sections/slides or not. - */ - function isFocusOutside(e){ - var allFocusables = getFocusables(document); - var currentFocusIndex = allFocusables.indexOf(document.activeElement); - var focusDestinationIndex = e.shiftKey ? currentFocusIndex - 1 : currentFocusIndex + 1; - var focusDestination = allFocusables[focusDestinationIndex]; - var destinationItemSlide = nullOrSlide(closest(focusDestination, SLIDE_SEL)); - var destinationItemSection = nullOrSection(closest(focusDestination, SECTION_SEL)); - - return !destinationItemSlide && !destinationItemSection; - } - - //Scrolling horizontally when clicking on the slider controls. - function slideArrowHandler(){ - /*jshint validthis:true */ - var section = closest(this, SECTION_SEL); - - /*jshint validthis:true */ - if (hasClass(this, SLIDES_PREV)) { - if(isScrollAllowed.m.left){ - moveSlideLeft(section); - } - } else { - if(isScrollAllowed.m.right){ - moveSlideRight(section); - } - } - } - - //when opening a new tab (ctrl + t), `control` won't be pressed when coming back. - function blurHandler(){ - isWindowFocused = false; - controlPressed = false; - } - - //Scrolls to the section when clicking the navigation bullet - function sectionBulletHandler(e){ - preventDefault(e); - - /*jshint validthis:true */ - var indexBullet = index(closest(this, SECTION_NAV_SEL + ' li')); - scrollPage($(SECTION_SEL)[indexBullet]); - } - - //Scrolls the slider to the given slide destination for the given section - function slideBulletHandler(e){ - preventDefault(e); - - /*jshint validthis:true */ - var slides = $(SLIDES_WRAPPER_SEL, closest(this, SECTION_SEL))[0]; - var destiny = $(SLIDE_SEL, slides)[index(closest(this, 'li'))]; - - landscapeScroll(slides, destiny); - } - - /** - * Keydown event - */ - function onkeydown(e){ - var shiftPressed = e.shiftKey; - - //do nothing if we can not scroll or we are not using horizotnal key arrows. - if(!canScroll && [37,39].indexOf(e.keyCode) < 0){ - return; - } - - switch (e.keyCode) { - //up - case 38: - case 33: - if(isScrollAllowed.k.up){ - moveSectionUp(); - } - break; - - //down - case 32: //spacebar - if(shiftPressed && isScrollAllowed.k.up){ - moveSectionUp(); - break; - } - /* falls through */ - case 40: - case 34: - if(isScrollAllowed.k.down){ - moveSectionDown(); - } - break; - - //Home - case 36: - if(isScrollAllowed.k.up){ - moveTo(1); - } - break; - - //End - case 35: - if(isScrollAllowed.k.down){ - moveTo( $(SECTION_SEL).length ); - } - break; - - //left - case 37: - if(isScrollAllowed.k.left){ - moveSlideLeft(); - } - break; - - //right - case 39: - if(isScrollAllowed.k.right){ - moveSlideRight(); - } - break; - - default: - return; // exit this handler for other keys - } - } - - /** - * Detecting the direction of the mouse movement. - * Used only for the middle button of the mouse. - */ - var oldPageY = 0; - function mouseMoveHandler(e){ - if(canScroll){ - // moving up - if (e.pageY < oldPageY && isScrollAllowed.m.up){ - moveSectionUp(); - } - - // moving down - else if(e.pageY > oldPageY && isScrollAllowed.m.down){ - moveSectionDown(); - } - } - oldPageY = e.pageY; - } - - /** - * Scrolls horizontal sliders. - */ - function landscapeScroll(slides, destiny, direction){ - var section = closest(slides, SECTION_SEL); - var v = { - slides: slides, - destiny: destiny, - direction: direction, - destinyPos: {left: destiny.offsetLeft}, - slideIndex: index(destiny), - section: section, - sectionIndex: index(section, SECTION_SEL), - anchorLink: section.getAttribute('data-anchor'), - slidesNav: $(SLIDES_NAV_SEL, section)[0], - slideAnchor: getAnchor(destiny), - prevSlide: $(SLIDE_ACTIVE_SEL, section)[0], - prevSlideIndex: index($(SLIDE_ACTIVE_SEL, section)[0]), - - //caching the value of isResizing at the momment the function is called - //because it will be checked later inside a setTimeout and the value might change - localIsResizing: isResizing - }; - v.xMovement = getXmovement(v.prevSlideIndex, v.slideIndex); - - //important!! Only do it when not resizing - if(!v.localIsResizing){ - //preventing from scrolling to the next/prev section when using scrollHorizontally - canScroll = false; - } - - //quiting when destination slide is the same as the current one - //if((v.prevSlide.is(v.destiny) && !v.localIsResizing)){ return; } - - extensionCall('parallax', 'applyHorizontal', v); - - if(options.onSlideLeave){ - - //if the site is not just resizing and readjusting the slides - if(!v.localIsResizing && v.xMovement!=='none'){ - if(isFunction( options.onSlideLeave )){ - if( fireCallback('onSlideLeave', v) === false){ - slideMoving = false; - return; - } - } - } - } - - addClass(destiny, ACTIVE); - removeClass(siblings(destiny), ACTIVE); - - if(!v.localIsResizing){ - stopMedia(v.prevSlide); - lazyLoad(destiny); - } - - toggleControlArrows(v); - - //only changing the URL if the slides are in the current section (not for resize re-adjusting) - if(hasClass(section, ACTIVE) && !v.localIsResizing){ - setState(v.slideIndex, v.slideAnchor, v.anchorLink, v.sectionIndex); - } - - if(FP.continuousHorizontal){ - FP.continuousHorizontal.apply(v); - } - - if(!isDragging()){ - performHorizontalMove(slides, v, true); - } - //we need to fire the callbacks and set canScroll again when using dragAndMove - else{ - afterSlideLoads(v); - } - - //duplicated call to FP.interlockedSlides.apply(v) here!! But necessary! At least this one! - //We have to call it here in order to call it at exactly the same time as we slide connected slides - //otherwise we will see the sliding animation in connected sections when scrolling down fast after sliding horizontally - //- Fixed bug with interlockedSlides and continuousHorizontal fullpageExtensions #130 - if(options.interlockedSlides && FP.interlockedSlides){ - //not using continuousHorizontal or using it but not about to apply it - if(!usingExtension('continuousHorizontal') || - typeof (direction) === "undefined" || direction === v.xMovement){ - FP.interlockedSlides.apply(v); - } - } - } - - function toggleControlArrows(v){ - if(!options.loopHorizontal && options.controlArrows){ - //hidding it for the fist slide, showing for the rest - toggle($(SLIDES_ARROW_PREV_SEL, v.section), v.slideIndex!==0); - - //hidding it for the last slide, showing for the rest - toggle($(SLIDES_ARROW_NEXT_SEL, v.section), next(v.destiny) != null); - } - } - - - function afterSlideLoads(v){ - if(FP.continuousHorizontal){ - FP.continuousHorizontal.afterSlideLoads(v); - } - activeSlidesNavigation(v.slidesNav, v.slideIndex); - - //if the site is not just resizing and readjusting the slides - if(!v.localIsResizing){ - extensionCall('parallax', 'afterSlideLoads'); - - if(isFunction( options.afterSlideLoad )){ - fireCallback('afterSlideLoad', v); - } - //needs to be inside the condition to prevent problems with continuousVertical and scrollHorizontally - //and to prevent double scroll right after a windows resize - canScroll = true; - - playMedia(v.destiny); - } - - //letting them slide again - slideMoving = false; - - if(usingExtension('interlockedSlides')){ - FP.interlockedSlides.apply(v); - } - } - - /** - * Performs the horizontal movement. (CSS3 or jQuery) - * - * @param fireCallback {Bool} - determines whether or not to fire the callback - */ - function performHorizontalMove(slides, v, fireCallback){ - var destinyPos = v.destinyPos; - - if(options.css3){ - var translate3d = 'translate3d(-' + Math.round(destinyPos.left) + 'px, 0px, 0px)'; - - FP.test.translate3dH[v.sectionIndex] = translate3d; - css(addAnimation($(SLIDES_CONTAINER_SEL, slides)), getTransforms(translate3d)); - - afterSlideLoadsId = setTimeout(function(){ - if(fireCallback){ - afterSlideLoads(v); - } - }, options.scrollingSpeed); - }else{ - FP.test.left[v.sectionIndex] = Math.round(destinyPos.left); - - scrollTo(slides, Math.round(destinyPos.left), options.scrollingSpeed, function(){ - if(fireCallback){ - afterSlideLoads(v); - } - }); - } - } - - /** - * Sets the state for the horizontal bullet navigations. - */ - function activeSlidesNavigation(slidesNav, slideIndex){ - if(options.slidesNavigation && slidesNav != null){ - removeClass($(ACTIVE_SEL, slidesNav), ACTIVE); - addClass( $('a', $('li', slidesNav)[slideIndex] ), ACTIVE); - } - } - - var previousHeight = windowsHeight; - - //when resizing the site, we adjust the heights of the sections, slimScroll... - function resizeHandler(){ - trigger(container, 'onResize'); - - //checking if it needs to get responsive - responsive(); - - // rebuild immediately on touch devices - if (isTouchDevice) { - var activeElement = document.activeElement; - - //if the keyboard is NOT visible - if (!matches(activeElement, 'textarea') && !matches(activeElement, 'input') && !matches(activeElement, 'select')) { - var currentHeight = getWindowHeight(); - - //making sure the change in the viewport size is enough to force a rebuild. (20 % of the window to avoid problems when hidding scroll bars) - if( Math.abs(currentHeight - previousHeight) > (20 * Math.max(previousHeight, currentHeight) / 100) ){ - reBuild(true); - previousHeight = currentHeight; - } - } - }else{ - //in order to call the functions only when the resize is finished - //http://stackoverflow.com/questions/4298612/jquery-how-to-call-resize-event-only-once-its-finished-resizing - clearTimeout(resizeId); - - resizeId = setTimeout(function(){ - reBuild(true); - }, 350); - } - } - - /** - * Checks if the site needs to get responsive and disables autoScrolling if so. - * A class `fp-responsive` is added to the plugin's container in case the user wants to use it for his own responsive CSS. - */ - function responsive(){ - var widthLimit = options.responsive || options.responsiveWidth; //backwards compatiblity - var heightLimit = options.responsiveHeight; - - //only calculating what we need. Remember its called on the resize event. - var isBreakingPointWidth = widthLimit && window.innerWidth < widthLimit; - var isBreakingPointHeight = heightLimit && window.innerHeight < heightLimit; - - if(widthLimit && heightLimit){ - setResponsive(isBreakingPointWidth || isBreakingPointHeight); - } - else if(widthLimit){ - setResponsive(isBreakingPointWidth); - } - else if(heightLimit){ - setResponsive(isBreakingPointHeight); - } - } - - /** - * Adds transition animations for the given element - */ - function addAnimation(element){ - var transition = 'all ' + options.scrollingSpeed + 'ms ' + options.easingcss3; - - removeClass(element, NO_TRANSITION); - return css(element, { - '-webkit-transition': transition, - 'transition': transition - }); - } - - /** - * Remove transition animations for the given element - */ - function disableAnimation(element){ - return addClass(element, NO_TRANSITION); - } - - /** - * Activating the vertical navigation bullets according to the given slide name. - */ - function activateNavDots(name, sectionIndex){ - if(options.navigation && $(SECTION_NAV_SEL)[0] != null){ - removeClass($(ACTIVE_SEL, $(SECTION_NAV_SEL)[0]), ACTIVE); - if(name){ - addClass( $('a[href="#' + name + '"]', $(SECTION_NAV_SEL)[0]), ACTIVE); - }else{ - addClass($('a', $('li', $(SECTION_NAV_SEL)[0])[sectionIndex]), ACTIVE); - } - } - } - - /** - * Activating the website main menu elements according to the given slide name. - */ - function activateMenuElement(name){ - var menu = $(options.menu)[0]; - if(options.menu && menu != null){ - removeClass($(ACTIVE_SEL, menu), ACTIVE); - addClass($('[data-menuanchor="'+name+'"]', menu), ACTIVE); - } - } - - /** - * Sets to active the current menu and vertical nav items. - */ - function activateMenuAndNav(anchor, index){ - activateMenuElement(anchor); - activateNavDots(anchor, index); - } - - /** - * Retuns `up` or `down` depending on the scrolling movement to reach its destination - * from the current section. - */ - function getYmovement(destiny){ - var fromIndex = index($(SECTION_ACTIVE_SEL)[0], SECTION_SEL); - var toIndex = index(destiny, SECTION_SEL); - if( fromIndex == toIndex){ - return 'none'; - } - if(fromIndex > toIndex){ - return 'up'; - } - return 'down'; - } - - /** - * Retuns `right` or `left` depending on the scrolling movement to reach its destination - * from the current slide. - */ - function getXmovement(fromIndex, toIndex){ - if( fromIndex == toIndex){ - return 'none'; - } - if(fromIndex > toIndex){ - return 'left'; - } - return 'right'; - } - - function addTableClass(element){ - //In case we are styling for the 2nd time as in with reponsiveSlides - if(!hasClass(element, TABLE)){ - var wrapper = document.createElement('div'); - wrapper.className = TABLE_CELL; - wrapper.style.height = getTableHeight(element) + 'px'; - - addClass(element, TABLE); - wrapInner(element, wrapper); - } - } - - function getTableHeight(element){ - var sectionHeight = getWindowHeightOffset(element); - - if(options.paddingTop || options.paddingBottom){ - var section = element; - if(!hasClass(section, SECTION)){ - section = closest(element, SECTION_SEL); - } - - var paddings = parseInt(getComputedStyle(section)['padding-top']) + parseInt(getComputedStyle(section)['padding-bottom']); - sectionHeight = (sectionHeight - paddings); - } - - return sectionHeight; - } - - /** - * Adds a css3 transform property to the container class with or without animation depending on the animated param. - */ - function transformContainer(translate3d, animated){ - if(animated){ - addAnimation(container); - }else{ - disableAnimation(container); - } - - clearTimeout(silentScrollId); - css(container, getTransforms(translate3d)); - FP.test.translate3d = translate3d; - - //syncronously removing the class after the animation has been applied. - silentScrollId = setTimeout(function(){ - removeClass(container, NO_TRANSITION); - },10); - } - - /** - * Gets a section by its anchor / index - */ - function getSectionByAnchor(sectionAnchor){ - var section = $(SECTION_SEL + '[data-anchor="'+sectionAnchor+'"]', container)[0]; - if(!section){ - var sectionIndex = typeof sectionAnchor !== 'undefined' ? sectionAnchor -1 : 0; - section = $(SECTION_SEL)[sectionIndex]; - } - - return section; - } - - /** - * Gets a slide inside a given section by its anchor / index - */ - function getSlideByAnchor(slideAnchor, section){ - var slide = $(SLIDE_SEL + '[data-anchor="'+slideAnchor+'"]', section)[0]; - if(slide == null){ - slideAnchor = typeof slideAnchor !== 'undefined' ? slideAnchor : 0; - slide = $(SLIDE_SEL, section)[slideAnchor]; - } - - return slide; - } - - /** - * Scrolls to the given section and slide anchors - */ - function scrollPageAndSlide(sectionAnchor, slideAnchor){ - var section = getSectionByAnchor(sectionAnchor); - - //do nothing if there's no section with the given anchor name - if(section == null) return; - - var slide = getSlideByAnchor(slideAnchor, section); - - //we need to scroll to the section and then to the slide - if (getAnchor(section) !== lastScrolledDestiny && !hasClass(section, ACTIVE)){ - scrollPage(section, function(){ - scrollSlider(slide); - }); - } - //if we were already in the section - else{ - scrollSlider(slide); - } - } - - /** - * Scrolls the slider to the given slide destination for the given section - */ - function scrollSlider(slide){ - if(slide != null){ - landscapeScroll(closest(slide, SLIDES_WRAPPER_SEL), slide); - } - } - - /** - * Creates a landscape navigation bar with dots for horizontal sliders. - */ - function addSlidesNavigation(section, numSlides){ - appendTo(createElementFromHTML('
      '), section); - var nav = $(SLIDES_NAV_SEL, section)[0]; - - //top or bottom - addClass(nav, 'fp-' + options.slidesNavPosition); - - for(var i=0; i< numSlides; i++){ - appendTo(createElementFromHTML('
    • '+ getBulletLinkName(i, 'Slide') +'
    • '), $('ul', nav)[0] ); - } - - //centering it - css(nav, {'margin-left': '-' + (nav.innerWidth/2) + 'px'}); - - addClass($('a', $('li', nav)[0] ), ACTIVE); - } - - - /** - * Sets the state of the website depending on the active section/slide. - * It changes the URL hash when needed and updates the body class. - */ - function setState(slideIndex, slideAnchor, anchorLink, sectionIndex){ - var sectionHash = ''; - - if(options.anchors.length && !options.lockAnchors){ - - //isn't it the first slide? - if(slideIndex){ - if(anchorLink != null){ - sectionHash = anchorLink; - } - - //slide without anchor link? We take the index instead. - if(slideAnchor == null){ - slideAnchor = slideIndex; - } - - lastScrolledSlide = slideAnchor; - setUrlHash(sectionHash + '/' + slideAnchor); - - //first slide won't have slide anchor, just the section one - }else if(slideIndex != null){ - lastScrolledSlide = slideAnchor; - setUrlHash(anchorLink); - } - - //section without slides - else{ - setUrlHash(anchorLink); - } - } - - setBodyClass(); - } - - /** - * Sets the URL hash. - */ - function setUrlHash(url){ - if(options.recordHistory){ - location.hash = url; - }else{ - //Mobile Chrome doesn't work the normal way, so... lets use HTML5 for phones :) - if(isTouchDevice || isTouch){ - window.history.replaceState(undefined, undefined, '#' + url); - }else{ - var baseUrl = window.location.href.split('#')[0]; - window.location.replace( baseUrl + '#' + url ); - } - } - } - - /** - * Gets the anchor for the given slide / section. Its index will be used if there's none. - */ - function getAnchor(element){ - if(!element){ - return null; - } - var anchor = element.getAttribute('data-anchor'); - var elementIndex = index(element); - - //Slide without anchor link? We take the index instead. - if(anchor == null){ - anchor = elementIndex; - } - - return anchor; - } - - /** - * Sets a class for the body of the page depending on the active section / slide - */ - function setBodyClass(){ - var section = $(SECTION_ACTIVE_SEL)[0]; - var slide = $(SLIDE_ACTIVE_SEL, section)[0]; - - var sectionAnchor = getAnchor(section); - var slideAnchor = getAnchor(slide); - - var text = String(sectionAnchor); - - if(slide){ - text = text + '-' + slideAnchor; - } - - //changing slash for dash to make it a valid CSS style - text = text.replace('/', '-').replace('#',''); - - //removing previous anchor classes - var classRe = new RegExp('\\b\\s?' + VIEWING_PREFIX + '-[^\\s]+\\b', "g"); - $body.className = $body.className.replace(classRe, ''); - - //adding the current anchor - addClass($body, VIEWING_PREFIX + '-' + text); - } - - /** - * Checks for translate3d support - * @return boolean - * http://stackoverflow.com/questions/5661671/detecting-transform-translate3d-support - */ - function support3d() { - var el = document.createElement('p'), - has3d, - transforms = { - 'webkitTransform':'-webkit-transform', - 'OTransform':'-o-transform', - 'msTransform':'-ms-transform', - 'MozTransform':'-moz-transform', - 'transform':'transform' - }; - - //preventing the style p:empty{display: none;} from returning the wrong result - el.style.display = 'block' - - // Add it to the body to get the computed style. - document.body.insertBefore(el, null); - - for (var t in transforms) { - if (el.style[t] !== undefined) { - el.style[t] = 'translate3d(1px,1px,1px)'; - has3d = window.getComputedStyle(el).getPropertyValue(transforms[t]); - } - } - - document.body.removeChild(el); - - return (has3d !== undefined && has3d.length > 0 && has3d !== 'none'); - } - - /** - * Removes the auto scrolling action fired by the mouse wheel and trackpad. - * After this function is called, the mousewheel and trackpad movements won't scroll through sections. - */ - function removeMouseWheelHandler(){ - if (document.addEventListener) { - document.removeEventListener('mousewheel', MouseWheelHandler, false); //IE9, Chrome, Safari, Oper - document.removeEventListener('wheel', MouseWheelHandler, false); //Firefox - document.removeEventListener('MozMousePixelScroll', MouseWheelHandler, false); //old Firefox - } else { - document.detachEvent('onmousewheel', MouseWheelHandler); //IE 6/7/8 - } - } - - /** - * Adds the auto scrolling action for the mouse wheel and trackpad. - * After this function is called, the mousewheel and trackpad movements will scroll through sections - * https://developer.mozilla.org/en-US/docs/Web/Events/wheel - */ - function addMouseWheelHandler(){ - var prefix = ''; - var _addEventListener; - - if (window.addEventListener){ - _addEventListener = "addEventListener"; - }else{ - _addEventListener = "attachEvent"; - prefix = 'on'; - } - - // detect available wheel event - var support = 'onwheel' in document.createElement('div') ? 'wheel' : // Modern browsers support "wheel" - document.onmousewheel !== undefined ? 'mousewheel' : // Webkit and IE support at least "mousewheel" - 'DOMMouseScroll'; // let's assume that remaining browsers are older Firefox - - - if(support == 'DOMMouseScroll'){ - document[ _addEventListener ](prefix + 'MozMousePixelScroll', MouseWheelHandler, false); - } - - //handle MozMousePixelScroll in older Firefox - else{ - document[ _addEventListener ](prefix + support, MouseWheelHandler, false); - } - } - - /** - * Binding the mousemove when the mouse's middle button is pressed - */ - function addMiddleWheelHandler(){ - container.addEventListener('mousedown', mouseDownHandler); - container.addEventListener('mouseup', mouseUpHandler); - } - - /** - * Unbinding the mousemove when the mouse's middle button is released - */ - function removeMiddleWheelHandler(){ - container.removeEventListener('mousedown', mouseDownHandler); - container.removeEventListener('mouseup', mouseUpHandler); - } - - /** - * Adds the possibility to auto scroll through sections on touch devices. - */ - function addTouchHandler(){ - if(isTouchDevice || isTouch){ - if(options.autoScrolling){ - $body.removeEventListener(events.touchmove, preventBouncing, {passive: false}); - $body.addEventListener(events.touchmove, preventBouncing, {passive: false}); - } - - if($(WRAPPER_SEL).length > 0){ - $(WRAPPER_SEL)[0].removeEventListener(events.touchstart, touchStartHandler); - $(WRAPPER_SEL)[0].removeEventListener(events.touchmove, touchMoveHandler, {passive: false}); - - $(WRAPPER_SEL)[0].addEventListener(events.touchstart, touchStartHandler); - $(WRAPPER_SEL)[0].addEventListener(events.touchmove, touchMoveHandler, {passive: false}); - } - } - } - - /** - * Removes the auto scrolling for touch devices. - */ - function removeTouchHandler(){ - if(isTouchDevice || isTouch){ - // normalScrollElements requires it off #2691 - if(options.autoScrolling){ - $body.removeEventListener(events.touchmove, touchMoveHandler, {passive: false}); - $body.removeEventListener(events.touchmove, preventBouncing, {passive: false}); - } - - if($(WRAPPER_SEL).length > 0){ - $(WRAPPER_SEL)[0].removeEventListener(events.touchstart, touchStartHandler); - $(WRAPPER_SEL)[0].removeEventListener(events.touchmove, touchMoveHandler, {passive: false}); - } - } - } - - /* - * Returns and object with Microsoft pointers (for IE<11 and for IE >= 11) - * http://msdn.microsoft.com/en-us/library/ie/dn304886(v=vs.85).aspx - */ - function getMSPointer(){ - var pointer; - - //IE >= 11 & rest of browsers - if(window.PointerEvent){ - pointer = { down: 'pointerdown', move: 'pointermove'}; - } - - //IE < 11 - else{ - pointer = { down: 'MSPointerDown', move: 'MSPointerMove'}; - } - - return pointer; - } - - /** - * Gets the pageX and pageY properties depending on the browser. - * https://github.com/alvarotrigo/fullPage.js/issues/194#issuecomment-34069854 - */ - function getEventsPage(e){ - var events = []; - - events.y = (typeof e.pageY !== 'undefined' && (e.pageY || e.pageX) ? e.pageY : e.touches[0].pageY); - events.x = (typeof e.pageX !== 'undefined' && (e.pageY || e.pageX) ? e.pageX : e.touches[0].pageX); - - //in touch devices with scrollBar:true, e.pageY is detected, but we have to deal with touch events. #1008 - if(isTouch && isReallyTouch(e) && options.scrollBar && typeof e.touches !== 'undefined'){ - events.y = e.touches[0].pageY; - events.x = e.touches[0].pageX; - } - - return events; - } - - /** - * Slides silently (with no animation) the active slider to the given slide. - * @param noCallback {bool} true or defined -> no callbacks - */ - function silentLandscapeScroll(activeSlide, noCallbacks){ - setScrollingSpeed (0, 'internal'); - - if(typeof noCallbacks !== 'undefined'){ - //preventing firing callbacks afterSlideLoad etc. - isResizing = true; - } - - landscapeScroll(closest(activeSlide, SLIDES_WRAPPER_SEL), activeSlide); - - if(typeof noCallbacks !== 'undefined'){ - isResizing = false; - } - - setScrollingSpeed(originals.scrollingSpeed, 'internal'); - } - - /** - * Scrolls silently (with no animation) the page to the given Y position. - */ - function silentScroll(top){ - // The first section can have a negative value in iOS 10. Not quite sure why: -0.0142822265625 - // that's why we round it to 0. - var roundedTop = Math.round(top); - - if (options.css3 && options.autoScrolling && !options.scrollBar){ - var translate3d = 'translate3d(0px, -' + roundedTop + 'px, 0px)'; - transformContainer(translate3d, false); - } - else if(options.autoScrolling && !options.scrollBar){ - css(container, {'top': -roundedTop + 'px'}); - FP.test.top = -roundedTop + 'px'; - } - else{ - var scrollSettings = getScrollSettings(roundedTop); - setScrolling(scrollSettings.element, scrollSettings.options); - } - } - - /** - * Returns the cross-browser transform string. - */ - function getTransforms(translate3d){ - return { - '-webkit-transform': translate3d, - '-moz-transform': translate3d, - '-ms-transform':translate3d, - 'transform': translate3d - }; - } - - /** - * Allowing or disallowing the mouse/swipe scroll in a given direction. (not for keyboard) - * @type m (mouse) or k (keyboard) - */ - function setIsScrollAllowed(value, direction, type){ - //up, down, left, right - if(direction !== 'all'){ - isScrollAllowed[type][direction] = value; - } - - //all directions? - else{ - Object.keys(isScrollAllowed[type]).forEach(function(key){ - isScrollAllowed[type][key] = value; - }); - } - } - - /* - * Destroys fullpage.js plugin events and optinally its html markup and styles - */ - function destroy(all){ - trigger(container, 'destroy', all); - - setAutoScrolling(false, 'internal'); - setAllowScrolling(true); - setMouseHijack(false); - setKeyboardScrolling(false); - addClass(container, DESTROYED); - - clearTimeout(afterSlideLoadsId); - clearTimeout(afterSectionLoadsId); - clearTimeout(resizeId); - clearTimeout(scrollId); - clearTimeout(scrollId2); - - window.removeEventListener('scroll', scrollHandler); - window.removeEventListener('hashchange', hashChangeHandler); - window.removeEventListener('resize', resizeHandler); - - document.removeEventListener('keydown', keydownHandler); - document.removeEventListener('keyup', keyUpHandler); - - ['click', 'touchstart'].forEach(function(eventName){ - document.removeEventListener(eventName, delegatedEvents); - }); - - ['mouseenter', 'touchstart', 'mouseleave', 'touchend'].forEach(function(eventName){ - document.removeEventListener(eventName, onMouseEnterOrLeave, true); //true is required! - }); - - if(usingExtension('dragAndMove')){ - FP.dragAndMove.destroy(); - } - - clearTimeout(afterSlideLoadsId); - clearTimeout(afterSectionLoadsId); - - //lets make a mess! - if(all){ - destroyStructure(); - } - } - - /* - * Removes inline styles added by fullpage.js - */ - function destroyStructure(){ - //reseting the `top` or `translate` properties to 0 - silentScroll(0); - - //loading all the lazy load content - $('img[data-src], source[data-src], audio[data-src], iframe[data-src]', container).forEach(function(item){ - setSrc(item, 'src'); - }); - - $('img[data-srcset]').forEach(function(item){ - setSrc(item, 'srcset'); - }); - - remove($(SECTION_NAV_SEL + ', ' + SLIDES_NAV_SEL + ', ' + SLIDES_ARROW_SEL)); - - //removing inline styles - css($(SECTION_SEL), { - 'height': '', - 'background-color' : '', - 'padding': '' - }); - - css($(SLIDE_SEL), { - 'width': '' - }); - - css(container, { - 'height': '', - 'position': '', - '-ms-touch-action': '', - 'touch-action': '' - }); - - css($htmlBody, { - 'overflow': '', - 'height': '' - }); - - // remove .fp-enabled class - removeClass($('html'), ENABLED); - - // remove .fp-responsive class - removeClass($body, RESPONSIVE); - - // remove all of the .fp-viewing- classes - $body.className.split(/\s+/).forEach(function (className) { - if (className.indexOf(VIEWING_PREFIX) === 0) { - removeClass($body, className); - } - }); - - //removing added classes - $(SECTION_SEL + ', ' + SLIDE_SEL).forEach(function(item){ - if(options.scrollOverflowHandler){ - options.scrollOverflowHandler.remove(item); - } - removeClass(item, TABLE + ' ' + ACTIVE + ' ' + COMPLETELY); - var previousStyles = item.getAttribute('data-fp-styles'); - if(previousStyles){ - item.setAttribute('style', item.getAttribute('data-fp-styles')); - } - }); - - //removing the applied transition from the fullpage wrapper - removeAnimation(container); - - //Unwrapping content - [TABLE_CELL_SEL, SLIDES_CONTAINER_SEL,SLIDES_WRAPPER_SEL].forEach(function(selector){ - $(selector, container).forEach(function(item){ - //unwrap not being use in case there's no child element inside and its just text - unwrap(item); - }); - }); - - //scrolling the page to the top with no animation - //scrolling the page to the top with no animation - window.scrollTo(0, 0); - - //removing selectors - var usedSelectors = [SECTION, SLIDE, SLIDES_CONTAINER]; - usedSelectors.forEach(function(item){ - removeClass($('.' + item), item); - }); - } - - function removeAnimation(element){ - return css(element, { - '-webkit-transition': 'none', - 'transition': 'none' - }); - } - - function usingExtension(name){ - //is an array? - if(options[name] !== null && Object.prototype.toString.call( options[name] ) === '[object Array]'){ - return options[name].length && FP[name]; - } - return options[name] && FP[name]; - } - - function extensionCall(extensionName, method, params){ - if(usingExtension(extensionName)){ - return FP[extensionName][method](params); - } - } - - /** - * DragAndMove Extension - */ - function isAnimatingDragging(){ - return ( usingExtension('dragAndMove') && FP.dragAndMove.isAnimating); - } - - function isDragging(){ - return (usingExtension('dragAndMove') && FP.dragAndMove.isGrabbing); - } - - /* - * Sets the state for a variable with multiple states (original, and temporal) - * Some variables such as `autoScrolling` or `recordHistory` might change automatically its state when using `responsive` or `autoScrolling:false`. - * This function is used to keep track of both states, the original and the temporal one. - * If type is not 'internal', then we assume the user is globally changing the variable. - */ - function setVariableState(variable, value, type){ - options[variable] = value; - if(type !== 'internal'){ - originals[variable] = value; - } - } - - /** - * Displays warnings - */ - function displayWarnings(){ - if(!isLicenseValid){ - showError('error', 'Fullpage.js version 3 has changed its license to GPLv3 and it requires a `licenseKey` option. Read about it here:'); - showError('error', 'https://github.com/alvarotrigo/fullPage.js#options.'); - } - - if(hasClass($('html'), ENABLED)){ - showError('error', 'Fullpage.js can only be initialized once and you are doing it multiple times!'); - return; - } - - // Disable mutually exclusive settings - if (options.continuousVertical && - (options.loopTop || options.loopBottom)) { - options.continuousVertical = false; - showError('warn', 'Option `loopTop/loopBottom` is mutually exclusive with `continuousVertical`; `continuousVertical` disabled'); - } - - if(options.scrollOverflow && - (options.scrollBar || !options.autoScrolling)){ - showError('warn', 'Options scrollBar:true and autoScrolling:false are mutually exclusive with scrollOverflow:true. Sections with scrollOverflow might not work well in Firefox'); - } - - if(options.continuousVertical && (options.scrollBar || !options.autoScrolling)){ - options.continuousVertical = false; - showError('warn', 'Scroll bars (`scrollBar:true` or `autoScrolling:false`) are mutually exclusive with `continuousVertical`; `continuousVertical` disabled'); - } - - if(options.scrollOverflow && options.scrollOverflowHandler == null){ - options.scrollOverflow = false; - showError('error', 'The option `scrollOverflow:true` requires the file `scrolloverflow.min.js`. Please include it before fullPage.js.'); - } - - //anchors can not have the same value as any element ID or NAME - options.anchors.forEach(function(name){ - - //case insensitive selectors (http://stackoverflow.com/a/19465187/1081396) - var nameAttr = [].slice.call($('[name]')).filter(function(item) { - return item.getAttribute('name') && item.getAttribute('name').toLowerCase() == name.toLowerCase(); - }); - - var idAttr = [].slice.call($('[id]')).filter(function(item) { - return item.getAttribute('id') && item.getAttribute('id').toLowerCase() == name.toLowerCase(); - }); - - if(idAttr.length || nameAttr.length ){ - showError('error', 'data-anchor tags can not have the same value as any `id` element on the site (or `name` element for IE).'); - if(idAttr.length){ - showError('error', '"' + name + '" is is being used by another element `id` property'); - } - if(nameAttr.length){ - showError('error', '"' + name + '" is is being used by another element `name` property'); - } - } - }); - } - - /** - * Getting the position of the element to scroll when using jQuery animations - */ - function getScrolledPosition(element){ - var position; - - //is not the window element and is a slide? - if(element.self != window && hasClass(element, SLIDES_WRAPPER)){ - position = element.scrollLeft; - } - else if(!options.autoScrolling || options.scrollBar){ - position = getScrollTop(); - } - else{ - position = element.offsetTop; - } - - //gets the top property of the wrapper - return position; - } - - /** - * Simulates the animated scrollTop of jQuery. Used when css3:false or scrollBar:true or autoScrolling:false - * http://stackoverflow.com/a/16136789/1081396 - */ - function scrollTo(element, to, duration, callback) { - var start = getScrolledPosition(element); - var change = to - start; - var currentTime = 0; - var increment = 20; - activeAnimation = true; - - var animateScroll = function(){ - if(activeAnimation){ //in order to stope it from other function whenever we want - var val = to; - - currentTime += increment; - - if(duration){ - val = window.fp_easings[options.easing](currentTime, start, change, duration); - } - - setScrolling(element, val); - - if(currentTime < duration) { - setTimeout(animateScroll, increment); - }else if(typeof callback !== 'undefined'){ - callback(); - } - }else if (currentTime < duration){ - callback(); - } - }; - - animateScroll(); - } - - /** - * Scrolls the page / slider the given number of pixels. - * It will do it one or another way dependiong on the library's config. - */ - function setScrolling(element, val){ - if(!options.autoScrolling || options.scrollBar || (element.self != window && hasClass(element, SLIDES_WRAPPER))){ - - //scrolling horizontally through the slides? - if(element.self != window && hasClass(element, SLIDES_WRAPPER)){ - element.scrollLeft = val; - } - //vertical scroll - else{ - element.scrollTo(0, val); - } - }else{ - element.style.top = val + 'px'; - } - } - - /** - * Gets the active slide. - */ - function getActiveSlide(){ - var activeSlide = $(SLIDE_ACTIVE_SEL, $(SECTION_ACTIVE_SEL)[0])[0]; - return nullOrSlide(activeSlide); - } - - /** - * Gets the active section. - */ - function getActiveSection(){ - return new Section($(SECTION_ACTIVE_SEL)[0]); - } - - /** - * Item. Slide or Section objects share the same properties. - */ - function Item(el, selector){ - this.anchor = el.getAttribute('data-anchor'); - this.item = el; - this.index = index(el, selector); - this.isLast = this.index === $(selector).length -1; - this.isFirst = !this.index; - } - - /** - * Section object - */ - function Section(el){ - Item.call(this, el, SECTION_SEL); - } - - /** - * Slide object - */ - function Slide(el){ - Item.call(this, el, SLIDE_SEL); - } - - return FP; - }//end of $.fn.fullpage - - //utils - /** - * Shows a message in the console of the given type. - */ - function showError(type, text){ - window.console && window.console[type] && window.console[type]('fullPage: ' + text); - } - - /** - * Equivalent or jQuery function $(). - */ - function $(selector, context){ - context = arguments.length > 1 ? context : document; - return context ? context.querySelectorAll(selector) : null; - } - - /** - * Extends a given Object properties and its childs. - */ - function deepExtend(out) { - out = out || {}; - for (var i = 1, len = arguments.length; i < len; ++i){ - var obj = arguments[i]; - - if(!obj){ - continue; - } - - for(var key in obj){ - if (!obj.hasOwnProperty(key)){ - continue; - } - - // based on https://javascriptweblog.wordpress.com/2011/08/08/fixing-the-javascript-typeof-operator/ - if (Object.prototype.toString.call(obj[key]) === '[object Object]'){ - out[key] = deepExtend(out[key], obj[key]); - continue; - } - - out[key] = obj[key]; - } - } - return out; - } - - /** - * Checks if the passed element contains the passed class. - */ - function hasClass(el, className){ - if(el == null){ - return false; - } - if (el.classList){ - return el.classList.contains(className); - } - return new RegExp('(^| )' + className + '( |$)', 'gi').test(el.className); - } - - /** - * Gets the window height. Crossbrowser. - */ - function getWindowHeight(){ - return 'innerHeight' in window ? window.innerHeight : document.documentElement.offsetHeight; - } - - /** - * Set's the CSS properties for the passed item/s. - * @param {NodeList|HTMLElement} items - * @param {Object} props css properties and values. - */ - function css(items, props) { - items = getList(items); - - var key; - for (key in props) { - if (props.hasOwnProperty(key)) { - if (key !== null) { - for (var i = 0; i < items.length; i++) { - var item = items[i]; - item.style[key] = props[key]; - } - } - } - } - - return items; - } - - /** - * Generic function to get the previous or next element. - */ - function until(item, selector, fn){ - var sibling = item[fn]; - while(sibling && !matches(sibling, selector)){ - sibling = sibling[fn]; - } - - return sibling; - } - - /** - * Gets the previous element to the passed element that matches the passed selector. - */ - function prevUntil(item, selector){ - return until(item, selector, 'previousElementSibling'); - } - - /** - * Gets the next element to the passed element that matches the passed selector. - */ - function nextUntil(item, selector){ - return until(item, selector, 'nextElementSibling'); - } - - /** - * Gets the previous element to the passed element. - */ - function prev(item, selector){ - if(selector == null){ - return item.previousElementSibling; - } - var prevItem = prev(item); - return prevItem && matches(prevItem, selector) ? prevItem : null; - } - - /** - * Gets the next element to the passed element. - */ - function next(item, selector){ - if(selector == null){ - return item.nextElementSibling; - } - var nextItem = next(item); - return nextItem && matches(nextItem, selector) ? nextItem : null; - } - - /** - * Gets the last element from the passed list of elements. - */ - function last(item){ - return item[item.length-1]; - } - - /** - * Gets index from the passed element. - * @param {String} selector is optional. - */ - function index(item, selector) { - item = isArrayOrList(item) ? item[0] : item; - var children = selector != null? $(selector, item.parentNode) : item.parentNode.childNodes; - var num = 0; - for (var i=0; iafdas
      '); - * wrapInner(document.querySelector('#pepe'), element); - * - * https://jsfiddle.net/zexxz0tw/6/ - * - * https://stackoverflow.com/a/21817590/1081396 - */ - function wrapInner(parent, wrapper) { - if (typeof wrapper === "string"){ - wrapper = createElementFromHTML(wrapper); - } - - parent.appendChild(wrapper); - - while(parent.firstChild !== wrapper){ - wrapper.appendChild(parent.firstChild); - } - } - - /** - * Usage: - * unwrap(document.querySelector('#pepe')); - * unwrap(element); - * - * https://jsfiddle.net/szjt0hxq/1/ - * - */ - function unwrap(wrapper) { - var wrapperContent = document.createDocumentFragment(); - while (wrapper.firstChild) { - wrapperContent.appendChild(wrapper.firstChild); - } - wrapper.parentNode.replaceChild(wrapperContent, wrapper); - } - - /** - * http://stackoverflow.com/questions/22100853/dom-pure-javascript-solution-to-jquery-closest-implementation - * Returns the element or `false` if there's none - */ - function closest(el, selector) { - if(el && el.nodeType === 1){ - if(matches(el, selector)){ - return el; - } - return closest(el.parentNode, selector); - } - return null; - } - - /** - * Places one element (rel) after another one or group of them (reference). - * @param {HTMLElement} reference - * @param {HTMLElement|NodeList|String} el - * https://jsfiddle.net/9s97hhzv/1/ - */ - function after(reference, el) { - insertBefore(reference, reference.nextSibling, el); - } - - /** - * Places one element (rel) before another one or group of them (reference). - * @param {HTMLElement} reference - * @param {HTMLElement|NodeList|String} el - * https://jsfiddle.net/9s97hhzv/1/ - */ - function before(reference, el) { - insertBefore(reference, reference, el); - } - - /** - * Based in https://stackoverflow.com/a/19316024/1081396 - * and https://stackoverflow.com/a/4793630/1081396 - */ - function insertBefore(reference, beforeElement, el){ - if(!isArrayOrList(el)){ - if(typeof el == 'string'){ - el = createElementFromHTML(el); - } - el = [el]; - } - - for(var i = 0; i1?n:t)?n.querySelectorAll(e):null}function Q(e){e=e||{};for(var t=1,n=arguments.length;t-1;if(!J(_("html"),a)){var le=_("html, body"),ce=_("body")[0],ve={};Z=Q({menu:!1,anchors:[],lockAnchors:!1,navigation:!1,navigationPosition:"right",navigationTooltips:[],showActiveTooltip:!1,slidesNavigation:!1,slidesNavPosition:"bottom",scrollBar:!1,hybrid:!1,css3:!0,scrollingSpeed:700,autoScrolling:!0,fitToSection:!0,fitToSectionDelay:1e3,easing:"easeInOutCubic",easingcss3:"ease",loopBottom:!1,loopTop:!1,loopHorizontal:!0,continuousVertical:!1,continuousHorizontal:!1,scrollHorizontally:!1,interlockedSlides:!1,dragAndMove:!1,offsetSections:!1,resetSliders:!1,fadingEffect:!1,normalScrollElements:null,scrollOverflow:!1,scrollOverflowReset:!1,scrollOverflowHandler:e.fp_scrolloverflow?e.fp_scrolloverflow.iscrollHandler:null,scrollOverflowOptions:null,touchSensitivity:5,normalScrollElementTouchThreshold:5,bigSectionsDestination:null,keyboardScrolling:!0,animateAnchor:!0,recordHistory:!0,controlArrows:!0,controlArrowColor:"#fff",verticalCentered:!0,sectionsColor:[],paddingTop:0,paddingBottom:0,fixedElements:null,responsive:0,responsiveWidth:0,responsiveHeight:0,responsiveSlides:!1,parallax:!1,parallaxOptions:{type:"reveal",percentage:62,property:"translate"},sectionSelector:v,slideSelector:M,v2compatible:!1,afterLoad:null,onLeave:null,afterRender:null,afterResize:null,afterReBuild:null,afterSlideLoad:null,onSlideLeave:null,afterResponsive:null,lazyLoading:!0},Z);var we,Ce,ze,Be,Ne=!1,je=navigator.userAgent.match(/(iPhone|iPod|iPad|Android|playbook|silk|BlackBerry|BB10|Windows Phone|Tizen|Bada|webOS|IEMobile|Opera Mini)/),Pe="ontouchstart"in e||navigator.msMaxTouchPoints>0||navigator.maxTouchPoints,De="string"==typeof D?_(D)[0]:D,Ye=K(),We=!1,Ve=!0,Xe=!0,Ze=[],Ge={m:{up:!0,down:!0,left:!0,right:!0}};Ge.k=Q({},Ge.m);var Fe,Ue,_e,Qe,Je,Ke,qe,$e,et,tt=Kn(),nt={touchmove:"ontouchmove"in e?"touchmove":tt.move,touchstart:"ontouchstart"in e?"touchstart":tt.down},ot=!1,rt='a[href], area[href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), button:not([disabled]), iframe, object, embed, [tabindex="0"], [contenteditable]',it=Q({},Z),lt={};co(),e.fp_easings=Q(e.fp_easings,{easeInOutCubic:function(e,t,n,o){return(e/=o/2)<1?n/2*e*e*e+t:n/2*((e-=2)*e*e+2)+t}}),De&&(ve.version="3.0.2",ve.setAutoScrolling=bt,ve.setRecordHistory=wt,ve.setScrollingSpeed=yt,ve.setFitToSection=Et,ve.setLockAnchors=function(e){Z.lockAnchors=e},ve.setMouseWheelScrolling=xt,ve.setAllowScrolling=Lt,ve.setKeyboardScrolling=Mt,ve.moveSectionUp=Tt,ve.moveSectionDown=Ot,ve.silentMoveTo=kt,ve.moveTo=Ct,ve.moveSlideRight=Ht,ve.moveSlideLeft=Rt,ve.fitToSection=Zt,ve.reBuild=It,ve.setResponsive=zt,ve.getFullpageData=function(){return{options:Z,internals:{container:De,canScroll:Xe,isScrollAllowed:Ge,getDestinationPosition:en,isTouch:Pe,c:Sn,getXmovement:Yn,removeAnimation:jn,getTransforms:to,lazyLoad:cn,addAnimation:Nn,performHorizontalMove:In,landscapeScroll:Cn,silentLandscapeScroll:$n,keepSlidesPosition:$t,silentScroll:eo,styleSlides:Dt,scrollHandler:Xt,getEventsPage:qn,getMSPointer:Kn,isReallyTouch:_t,usingExtension:ro,toggleControlArrows:Hn,touchStartHandler:Qt,touchMoveHandler:Ut}}},ve.destroy=function(n){Ae(De,"destroy",n),bt(!1,"internal"),Lt(!0),At(!1),Mt(!1),ue(De,l),clearTimeout(Qe),clearTimeout(_e),clearTimeout(Ue),clearTimeout(Je),clearTimeout(Ke),e.removeEventListener("scroll",Xt),e.removeEventListener("hashchange",yn),e.removeEventListener("resize",zn),t.removeEventListener("keydown",xn),t.removeEventListener("keyup",Ln),["click","touchstart"].forEach(function(e){t.removeEventListener(e,Bt)}),["mouseenter","touchstart","mouseleave","touchend"].forEach(function(e){t.removeEventListener(e,jt,!0)}),ro("dragAndMove")&&ve.dragAndMove.destroy(),clearTimeout(Qe),clearTimeout(_e),n&&(eo(0),_("img[data-src], source[data-src], audio[data-src], iframe[data-src]",De).forEach(function(e){sn(e,"src")}),_("img[data-srcset]").forEach(function(e){sn(e,"srcset")}),ke(_(E+", "+j+", "+Y)),q(_(h),{height:"","background-color":"",padding:""}),q(_(O),{width:""}),q(De,{height:"",position:"","-ms-touch-action":"","touch-action":""}),q(le,{overflow:"",height:""}),de(_("html"),a),de(ce,r),ce.className.split(/\s+/).forEach(function(e){0===e.indexOf(s)&&de(ce,e)}),_(h+", "+O).forEach(function(e){Z.scrollOverflowHandler&&Z.scrollOverflow&&Z.scrollOverflowHandler.remove(e),de(e,z+" "+c+" "+d);var t=e.getAttribute("data-fp-styles");t&&e.setAttribute("style",e.getAttribute("data-fp-styles"))}),oo(De),[S,I,H].forEach(function(e){_(e,De).forEach(function(e){ge(e)})}),e.scrollTo(0,0),[p,T,R].forEach(function(e){de(_("."+e),e)}))},ve.getActiveSection=function(){return new po(_(g)[0])},ve.getActiveSlide=function(){return rn(_(k,_(g)[0])[0])},ve.landscapeScroll=Cn,ve.test={top:"0px",translate3d:"translate3d(0px, 0px, 0px)",translate3dH:function(){for(var e=[],t=0;t<_(Z.sectionSelector,De).length;t++)e.push("translate3d(0px, 0px, 0px)");return e}(),left:function(){for(var e=[],t=0;t<_(Z.sectionSelector,De).length;t++)e.push(0);return e}(),options:Z,setAutoScrolling:bt},ve.shared={afterRenderActions:Vt},e.fullpage_api=ve,Pt("continuousHorizontal"),Pt("scrollHorizontally"),Pt("resetSliders"),Pt("interlockedSlides"),Pt("responsiveSlides"),Pt("fadingEffect"),Pt("dragAndMove"),Pt("offsetSections"),Pt("scrollOverflowReset"),Pt("parallax"),ro("dragAndMove")&&ve.dragAndMove.init(),Z.css3&&(Z.css3=function(){var n,o=t.createElement("p"),r={webkitTransform:"-webkit-transform",OTransform:"-o-transform",msTransform:"-ms-transform",MozTransform:"-moz-transform",transform:"transform"};for(var i in o.style.display="block",t.body.insertBefore(o,null),r)void 0!==o.style[i]&&(o.style[i]="translate3d(1px,1px,1px)",n=e.getComputedStyle(o).getPropertyValue(r[i]));return t.body.removeChild(o),void 0!==n&&n.length>0&&"none"!==n}()),Z.scrollBar=Z.scrollBar||Z.hybrid,function(){if(!Z.anchors.length){var e="[data-anchor]",t=_(Z.sectionSelector.split(",").join(e+",")+e,De);t.length&&t.forEach(function(e){Z.anchors.push(e.getAttribute("data-anchor").toString())})}if(!Z.navigationTooltips.length){var e="[data-tooltip]",n=_(Z.sectionSelector.split(",").join(e+",")+e,De);n.length&&n.forEach(function(e){Z.navigationTooltips.push(e.getAttribute("data-tooltip").toString())})}}(),function(){q(De,{height:"100%",position:"relative"}),ue(De,n),ue(_("html"),a),Ye=K(),de(De,l),ue(_(Z.sectionSelector,De),p),ue(_(Z.slideSelector,De),T),io("parallax","init");for(var e=_(h),r=0;r0?Dt(s,u,d):Z.verticalCentered&&Wn(s)}var f,v,m,S;Z.fixedElements&&Z.css3&&_(Z.fixedElements).forEach(function(e){ce.appendChild(e)}),Z.navigation&&function(){var e=t.createElement("div");e.setAttribute("id",y);var n=t.createElement("ul");e.appendChild(n),fe(e,ce);var o=_(E)[0];ue(o,"fp-"+Z.navigationPosition),Z.showActiveTooltip&&ue(o,A);for(var r="",i=0;i<_(h).length;i++){var l="";Z.anchors.length&&(l=Z.anchors[i]),r+='
    • '+Wt(i,"Section")+"";var a=Z.navigationTooltips[i];void 0!==a&&""!==a&&(r+='
      '+a+"
      "),r+="
    • "}_("ul",o)[0].innerHTML=r,q(_(E),{"margin-top":"-"+_(E)[0].offsetHeight/2+"px"}),ue(_("a",_("li",_(E)[0])[ie(_(g)[0],h)]),c)}(),_('iframe[src*="youtube.com/embed/"]',De).forEach(function(e){var t,n,o;n="enablejsapi=1",o=(t=e).getAttribute("src"),t.setAttribute("src",o+(/\?/.test(o)?"&":"?")+n)}),Z.fadingEffect&&ve.fadingEffect&&ve.fadingEffect.apply(),Z.scrollOverflow?Fe=Z.scrollOverflowHandler.init(Z):Vt()}(),Lt(!0),At(!0),bt(Z.autoScrolling,"internal"),Bn(),Jn(),"complete"===t.readyState&&wn(),e.addEventListener("load",wn),e.addEventListener("scroll",Xt),e.addEventListener("hashchange",yn),e.addEventListener("blur",On),e.addEventListener("resize",zn),t.addEventListener("keydown",xn),t.addEventListener("keyup",Ln),["click","touchstart"].forEach(function(e){t.addEventListener(e,Bt)}),Z.normalScrollElements&&(["mouseenter","touchstart"].forEach(function(e){Nt(e,!1)}),["mouseleave","touchend"].forEach(function(e){Nt(e,!0)})),ro("dragAndMove")&&ve.dragAndMove.turnOffTouch());var at,st,ct,ut=!1,dt=0,ft=0,vt=0,pt=0,ht=(new Date).getTime(),gt=0,mt=0,St=Ye;return ve}function bt(e,t){e||eo(0),so("autoScrolling",e,t);var n=_(g)[0];if(Z.autoScrolling&&!Z.scrollBar)q(le,{overflow:"hidden",height:"100%"}),wt(it.recordHistory,"internal"),q(De,{"-ms-touch-action":"none","touch-action":"none"}),null!=n&&eo(n.offsetTop);else if(q(le,{overflow:"visible",height:"initial"}),wt(!1,"internal"),q(De,{"-ms-touch-action":"","touch-action":""}),oo(De),null!=n){var o=ln(n.offsetTop);o.element.scrollTo(0,o.options)}Ae(De,"setAutoScrolling",e)}function wt(e,t){so("recordHistory",e,t)}function yt(e,t){"internal"!==t&&Z.fadingEffect&&ve.fadingEffect&&ve.fadingEffect.update(e),so("scrollingSpeed",e,t)}function Et(e,t){so("fitToSection",e,t)}function xt(n){n?(function(){var n,o="";e.addEventListener?n="addEventListener":(n="attachEvent",o="on");var r="onwheel"in t.createElement("div")?"wheel":void 0!==t.onmousewheel?"mousewheel":"DOMMouseScroll";"DOMMouseScroll"==r?t[n](o+"MozMousePixelScroll",Kt,!1):t[n](o+r,Kt,!1)}(),De.addEventListener("mousedown",An),De.addEventListener("mouseup",Mn)):(t.addEventListener?(t.removeEventListener("mousewheel",Kt,!1),t.removeEventListener("wheel",Kt,!1),t.removeEventListener("MozMousePixelScroll",Kt,!1)):t.detachEvent("onmousewheel",Kt),De.removeEventListener("mousedown",An),De.removeEventListener("mouseup",Mn))}function Lt(e,t){void 0!==t?(t=t.replace(/ /g,"").split(",")).forEach(function(t){no(e,t,"m")}):no(e,"all","m"),Ae(De,"setAllowScrolling",{value:e,directions:t})}function At(e){e?(xt(!0),(je||Pe)&&(Z.autoScrolling&&(ce.removeEventListener(nt.touchmove,Ft,{passive:!1}),ce.addEventListener(nt.touchmove,Ft,{passive:!1})),_(o).length>0&&(_(o)[0].removeEventListener(nt.touchstart,Qt),_(o)[0].removeEventListener(nt.touchmove,Ut,{passive:!1}),_(o)[0].addEventListener(nt.touchstart,Qt),_(o)[0].addEventListener(nt.touchmove,Ut,{passive:!1})))):(xt(!1),(je||Pe)&&(Z.autoScrolling&&(ce.removeEventListener(nt.touchmove,Ut,{passive:!1}),ce.removeEventListener(nt.touchmove,Ft,{passive:!1})),_(o).length>0&&(_(o)[0].removeEventListener(nt.touchstart,Qt),_(o)[0].removeEventListener(nt.touchmove,Ut,{passive:!1}))))}function Mt(e,t){void 0!==t?(t=t.replace(/ /g,"").split(",")).forEach(function(t){no(e,t,"k")}):(no(e,"all","k"),Z.keyboardScrolling=e)}function Tt(){var e=ee(_(g)[0],h);e||!Z.loopTop&&!Z.continuousVertical||(e=re(_(h))),null!=e&&tn(e,null,!0)}function Ot(){var e=te(_(g)[0],h);e||!Z.loopBottom&&!Z.continuousVertical||(e=_(h)[0]),null!=e&&tn(e,null,!1)}function kt(e,t){yt(0,"internal"),Ct(e,t),yt(it.scrollingSpeed,"internal")}function Ct(e,t){var n=Zn(e);void 0!==t?Gn(e,t):null!=n&&tn(n)}function Ht(e){qt("right",e)}function Rt(e){qt("left",e)}function It(t){if(!J(De,l)){We=!0,Ye=K();for(var n=_(h),o=0;o1&&Cn(i,_(k,i)[0])}Z.scrollOverflow&&Fe.createScrollBarForAll();var s=ie(_(g)[0],h);s&&!ro("fadingEffect")&&kt(s+1),We=!1,Le(Z.afterResize)&&t&&Z.afterResize.call(De,e.innerWidth,e.innerHeight),Le(Z.afterReBuild)&&!t&&Z.afterReBuild.call(De),Ae(De,"afterRebuild")}}function zt(e){var t=J(ce,r);e?t||(bt(!1,"internal"),Et(!1,"internal"),ae(_(E)),ue(ce,r),Le(Z.afterResponsive)&&Z.afterResponsive.call(De,e),Z.responsiveSlides&&ve.responsiveSlides&&ve.responsiveSlides.toSections(),Ae(De,"afterResponsive",e),Z.scrollOverflow&&Fe.createScrollBarForAll()):t&&(bt(it.autoScrolling,"internal"),Et(it.autoScrolling,"internal"),se(_(E)),de(ce,r),Le(Z.afterResponsive)&&Z.afterResponsive.call(De,e),Z.responsiveSlides&&ve.responsiveSlides&&ve.responsiveSlides.toSlides(),Ae(De,"afterResponsive",e))}function Bt(e){var t=e.target;t&&me(t,E+" a")?function(e){xe(e);var t=ie(me(this,E+" li"));tn(_(h)[t])}.call(t,e):Me(t,L)?function(){Ae(ne(this),"click")}.call(t):Me(t,Y)?function(){var e=me(this,h);J(this,W)?Ge.m.left&&Rt(e):Ge.m.right&&Ht(e)}.call(t,e):(Me(t,P)||null!=me(t,P))&&function(e){xe(e);var t=_(H,me(this,h))[0],n=_(O,t)[ie(me(this,"li"))];Cn(t,n)}.call(t,e)}function Nt(e,n){t["fp_"+e]=n,t.addEventListener(e,jt,!0)}function jt(e){e.target!=t&&Z.normalScrollElements.split(",").forEach(function(n){Me(e.target,n)&&At(t["fp_"+e.type])})}function Pt(t){var n="fp_"+t+"Extension";lt[t]=Z[t+"Key"],ve[t]=void 0!==e[n]?new e[n]:null,ve[t]&&ve[t].c(t)}function Dt(e,n,o){var r=100*o,i=100/o,l=t.createElement("div");l.className=C,pe(n,l);var a,s,u=t.createElement("div");u.className=R,pe(n,u),q(_(I,e),{width:r+"%"}),o>1&&(Z.controlArrows&&(a=e,s=[Oe('
      '),Oe('
      ')],Se(_(H,a)[0],s),"#fff"!==Z.controlArrowColor&&(q(_(F,a),{"border-color":"transparent transparent transparent "+Z.controlArrowColor}),q(_(X,a),{"border-color":"transparent "+Z.controlArrowColor+" transparent transparent"})),Z.loopHorizontal||ae(_(X,a))),Z.slidesNavigation&&function(e,t){fe(Oe('
        '),e);var n=_(j,e)[0];ue(n,"fp-"+Z.slidesNavPosition);for(var o=0;o'+Wt(o,"Slide")+""),_("ul",n)[0]);q(n,{"margin-left":"-"+n.innerWidth/2+"px"}),ue(_("a",_("li",n)[0]),c)}(e,o)),n.forEach(function(e){q(e,{width:i+"%"}),Z.verticalCentered&&Wn(e)});var d=_(k,e)[0];null!=d&&(0!==ie(_(g),h)||0===ie(_(g),h)&&0!==ie(d))?($n(d,"internal"),ue(d,B)):ue(n[0],c)}function Yt(e){return Z.offsetSections&&ve.offsetSections?Math.round(ve.offsetSections.getWindowHeight(e)):K()}function Wt(e,t){return Z.navigationTooltips[e]||Z.anchors[e]||t+" "+(e+1)}function Vt(){var e,t=_(g)[0];ue(t,d),cn(t),un(t),Z.scrollOverflow&&Z.scrollOverflowHandler.afterLoad(),(!(e=Zn(En().section))||void 0!==e&&ie(e)===ie(Be))&&Le(Z.afterLoad)&&nn("afterLoad",{activeSection:null,element:t,direction:null,anchorLink:t.getAttribute("data-anchor"),sectionIndex:ie(t,h)}),Le(Z.afterRender)&&nn("afterRender"),Ae(De,"afterRender")}function Xt(){var e;if(Ae(De,"onScroll"),(!Z.autoScrolling||Z.scrollBar||ro("dragAndMove"))&&!ao()){var t=ro("dragAndMove")?Math.abs(ve.dragAndMove.getCurrentScroll()):ye(),n=0,o=t+K()/2,r=(ro("dragAndMove")?ve.dragAndMove.getDocumentHeight():ce.offsetHeight-K())===t,i=_(h);if(r)n=i.length-1;else if(t)for(var l=0;lMath.abs(dt-vt)?!Ne&&Math.abs(ft-pt)>e.innerWidth/100*Z.touchSensitivity&&(ft>pt?Ge.m.right&&Ht(n):Ge.m.left&&Rt(n)):Z.autoScrolling&&Xe&&Math.abs(dt-vt)>e.innerHeight/100*Z.touchSensitivity&&(dt>vt?Gt("down"):vt>dt&&Gt("up"))}}function _t(e){return void 0===e.pointerType||"mouse"!=e.pointerType}function Qt(e){if(Z.fitToSection&&(et=!1),_t(e)){var t=qn(e);dt=t.y,ft=t.x}}function Jt(e,t){for(var n=0,o=e.slice(Math.max(e.length-t,1)),r=0;r149&&Ze.shift(),Ze.push(Math.abs(r)),Z.scrollBar&&xe(t);var s=n-ht;return ht=n,s>200&&(Ze=[]),Xe&&!lo()&&Jt(Ze,10)>=Jt(Ze,70)&&a&&Gt(i<0?"down":"up"),!1}Z.fitToSection&&(et=!1)}function qt(e,t){var n=null==t?_(g)[0]:t,o=_(H,n)[0];if(!(null==o||lo()||Ne||_(O,o).length<2)){var r=_(k,o)[0],i=null;if(null==(i="left"===e?ee(r,O):te(r,O))){if(!Z.loopHorizontal)return;var l=Ee(r);i="left"===e?l[l.length-1]:l[0]}Ne=!ve.test.isTesting,Cn(o,i,e)}}function $t(){for(var e=_(k),t=0;tgt,i=o-Ye+t,l=Z.bigSectionsDestination;return t>Ye?(r||l)&&"bottom"!==l||(o=i):(r||We&&null==oe(e))&&(o=i),Z.offsetSections&&ve.offsetSections&&(o=ve.offsetSections.getSectionPosition(r,o,e)),gt=o,o}function tn(e,t,n){if(null!=e){var r,i,l={element:e,callback:t,isMovementUp:n,dtop:en(e),yMovement:Dn(e),anchorLink:e.getAttribute("data-anchor"),sectionIndex:ie(e,h),activeSlide:_(k,e)[0],activeSection:_(g)[0],leavingSection:ie(_(g),h)+1,localIsResizing:We};if(!(l.activeSection==e&&!We||Z.scrollBar&&ye()===l.dtop&&!J(e,b))){if(null!=l.activeSlide&&(r=l.activeSlide.getAttribute("data-anchor"),i=ie(l.activeSlide)),Le(Z.onLeave)&&!l.localIsResizing){var a=l.yMovement;if(void 0!==n&&(a=n?"up":"down"),l.direction=a,!1===nn("onLeave",l))return}io("parallax","apply",l),Z.autoScrolling&&Z.continuousVertical&&void 0!==l.isMovementUp&&(!l.isMovementUp&&"up"==l.yMovement||l.isMovementUp&&"down"==l.yMovement)&&((u=l).isMovementUp?be(_(g)[0],He(u.activeSection,h)):Se(_(g)[0],Re(u.activeSection,h).reverse()),eo(_(g)[0].offsetTop),$t(),u.wrapAroundElements=u.activeSection,u.dtop=u.element.offsetTop,u.yMovement=Dn(u.element),u.leavingSection=ie(u.activeSection,h)+1,u.sectionIndex=ie(u.element,h),Ae(_(o)[0],"onContinuousVertical",u),l=u),ro("scrollOverflowReset")&&ve.scrollOverflowReset.setPrevious(l.activeSection),l.localIsResizing||fn(l.activeSection),Z.scrollOverflow&&Z.scrollOverflowHandler.beforeLeave(),ue(e,c),de(Ee(e),c),cn(e),Z.scrollOverflow&&Z.scrollOverflowHandler.onLeave(),Xe=ve.test.isTesting,Un(i,r,l.anchorLink,l.sectionIndex),function(e){if(Z.css3&&Z.autoScrolling&&!Z.scrollBar){var t="translate3d(0px, -"+Math.round(e.dtop)+"px, 0px)";Xn(t,!0),Z.scrollingSpeed?(clearTimeout(_e),_e=setTimeout(function(){an(e)},Z.scrollingSpeed)):an(e)}else{var n=ln(e.dtop);ve.test.top=-e.dtop+"px",uo(n.element,n.options,Z.scrollingSpeed,function(){Z.scrollBar?setTimeout(function(){an(e)},30):an(e)})}}(l),we=l.anchorLink,Pn(l.anchorLink,null!=(s=l).wrapAroundElements?s.isMovementUp?_(h).length-1:0:s.sectionIndex)}}var s,u}function nn(e,t){var n,o,r,i,l=(o=e,r=t,(i=Z.v2compatible?{afterRender:function(){return[De]},onLeave:function(){return[r.activeSection,r.leavingSection,r.sectionIndex+1,r.direction]},afterLoad:function(){return[r.element,r.anchorLink,r.sectionIndex+1]},afterSlideLoad:function(){return[r.destiny,r.anchorLink,r.sectionIndex+1,r.slideAnchor,r.slideIndex]},onSlideLeave:function(){return[r.prevSlide,r.anchorLink,r.sectionIndex+1,r.prevSlideIndex,r.direction,r.slideIndex]}}:{afterRender:function(){return{section:on(_(g)[0]),slide:rn(_(k,_(g)[0])[0])}},onLeave:function(){return{origin:on(r.activeSection),destination:on(r.element),direction:r.direction}},afterLoad:function(){return i.onLeave()},afterSlideLoad:function(){return{section:on(r.section),origin:rn(r.prevSlide),destination:rn(r.destiny),direction:r.direction}},onSlideLeave:function(){return i.afterSlideLoad()}})[o]());if(Z.v2compatible){if(!1===Z[e].apply(l[0],l.slice(1)))return!1}else if(Ae(De,e,l),!1===Z[e].apply(l[Object.keys(l)[0]],(n=l,Object.keys(n).map(function(e){return n[e]}))))return!1;return!0}function on(e){return e?new po(e):null}function rn(e){return e?new function(e){vo.call(this,e,O)}(e):null}function ln(t){var n={};return Z.autoScrolling&&!Z.scrollBar?(n.options=-t,n.element=_(o)[0]):(n.options=t,n.element=e),n}function an(e){var t;null!=(t=e).wrapAroundElements&&(t.isMovementUp?be(_(h)[0],t.wrapAroundElements):Se(_(h)[_(h).length-1],t.wrapAroundElements),eo(_(g)[0].offsetTop),$t(),t.sectionIndex=ie(t.element,h),t.leavingSection=ie(t.activeSection,h)+1),Le(Z.afterLoad)&&!e.localIsResizing&&nn("afterLoad",e),Z.scrollOverflow&&Z.scrollOverflowHandler.afterLoad(),io("parallax","afterLoad"),ro("scrollOverflowReset")&&ve.scrollOverflowReset.reset(),ro("resetSliders")&&ve.resetSliders.apply(e),e.localIsResizing||un(e.element),ue(e.element,d),de(Ee(e.element),d),Xe=!0,Le(e.callback)&&e.callback()}function sn(e,t){e.setAttribute(t,e.getAttribute("data-"+t)),e.removeAttribute("data-"+t)}function cn(e){Z.lazyLoading&&_("img[data-src], img[data-srcset], source[data-src], source[data-srcset], video[data-src], audio[data-src], iframe[data-src]",vn(e)).forEach(function(e){if(["src","srcset"].forEach(function(t){var n=e.getAttribute("data-"+t);null!=n&&n&&sn(e,t)}),Me(e,"source")){var t=me(e,"video, audio");t&&t.load()}})}function un(e){var t=vn(e);_("video, audio",t).forEach(function(e){e.hasAttribute("data-autoplay")&&"function"==typeof e.play&&e.play()}),_('iframe[src*="youtube.com/embed/"]',t).forEach(function(e){e.hasAttribute("data-autoplay")&&dn(e),e.onload=function(){e.hasAttribute("data-autoplay")&&dn(e)}})}function dn(e){e.contentWindow.postMessage('{"event":"command","func":"playVideo","args":""}',"*")}function fn(e){var t=vn(e);_("video, audio",t).forEach(function(e){e.hasAttribute("data-keepplaying")||"function"!=typeof e.pause||e.pause()}),_('iframe[src*="youtube.com/embed/"]',t).forEach(function(e){/youtube\.com\/embed\//.test(e.getAttribute("src"))&&!e.hasAttribute("data-keepplaying")&&e.contentWindow.postMessage('{"event":"command","func":"pauseVideo","args":""}',"*")})}function vn(e){var t=_(k,e);return t.length&&(e=t[0]),e}function pn(e){var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";function n(e){var n,o,r,i,l,a,s="",c=0;for(e=e.replace(/[^A-Za-z0-9+/=]/g,"");c>4,o=(15&i)<<4|(l=t.indexOf(e.charAt(c++)))>>2,r=(3&l)<<6|(a=t.indexOf(e.charAt(c++))),s+=String.fromCharCode(n),64!=l&&(s+=String.fromCharCode(o)),64!=a&&(s+=String.fromCharCode(r));return s=function(e){for(var t,n="",o=0,r=0,i=0;o191&&r<224?(i=e.charCodeAt(o+1),n+=String.fromCharCode((31&r)<<6|63&i),o+=2):(i=e.charCodeAt(o+1),t=e.charCodeAt(o+2),n+=String.fromCharCode((15&r)<<12|(63&i)<<6|63&t),o+=3);return n}(s)}function o(e){return e.slice(3).slice(0,-3)}return function(e){var t=e.split("_");if(t.length>1){var r=t[1];return e.replace(o(t[1]),"").split("_")[0]+"_"+n(r.slice(3).slice(0,-3))}return o(e)}(n(e))}function hn(e){var n=function(){if(t.domain.length){for(var e=t.domain.replace(/^(www\.)/,"").split(".");e.length>2;)e.shift();return e.join(".").replace(/(^\.*)|(\.*$)/g,"")}return""}(),o=["MTM0bG9jYWxob3N0MjM0","MTM0MC4xMjM0","MTM0anNoZWxsLm5ldDIzNA==","UDdDQU5ZNlNN"],r=pn(o[0]),i=pn(o[1]),l=pn(o[2]),a=pn(o[3]),s=[r,i,l].indexOf(n)<0&&0!==n.length,c=void 0!==lt[e]&<[e].length;if(!c&&s)return!1;var u=c?pn(lt[e]):"",d=(u=u.split("_")).length>1&&u[1].indexOf(e,u[1].length-e.length)>-1;return!(u[0].indexOf(n,u[0].length-n.length)<0&&s&&a!=u[0])&&d||!s}function gn(e){e.forEach(function(e){e.removedNodes[0]&&e.removedNodes[0].isEqualNode(st)&&(clearTimeout(ct),ct=setTimeout(mn,900))})}function mn(){ot=!1}function Sn(n){st=t.createElement("div"),at=pn("MTIzPGRpdj48YSBocmVmPSJodHRwOi8vYWx2YXJvdHJpZ28uY29tL2Z1bGxQYWdlL2V4dGVuc2lvbnMvIiBzdHlsZT0iY29sb3I6ICNmZmYgIWltcG9ydGFudDsgdGV4dC1kZWNvcmF0aW9uOm5vbmUgIWltcG9ydGFudDsiPlVubGljZW5zZWQgZnVsbFBhZ2UuanMgRXh0ZW5zaW9uPC9hPjwvZGl2PjEyMw=="),st.innerHTML=at,st=st.firstChild,"MutationObserver"in e&&new MutationObserver(gn).observe(t.body,{childList:!0,subtree:!1}),ro(n)&&ve[n]&&(hn(n)||(bn(),setInterval(bn,2e3)))}function bn(){st&&(ot||(Math.random()<.5?Ie(ce,st):fe(st,ce),ot=!0),st.setAttribute("style",pn("MTIzei1pbmRleDo5OTk5OTk5O3Bvc2l0aW9uOmZpeGVkO3RvcDoyMHB4O2JvdHRvbTphdXRvO2xlZnQ6MjBweDtyaWdodDphdXRvO2JhY2tncm91bmQ6cmVkO3BhZGRpbmc6N3B4IDE1cHg7Zm9udC1zaXplOjE0cHg7Zm9udC1mYW1pbHk6YXJpYWw7Y29sb3I6I2ZmZjtkaXNwbGF5OmlubGluZS1ibG9jazt0cmFuc2Zvcm06dHJhbnNsYXRlM2QoMCwwLDApO29wYWNpdHk6MTtoZWlnaHQ6YXV0bzt3aWR0aDphdXRvO3pvb206MTttYXJnaW46YXV0bztib3JkZXI6bm9uZTt2aXNpYmlsaXR5OnZpc2libGU7Y2xpcC1wYXRoOm5vbmU7MTIz").replace(/;/g,pn("MTIzICFpbXBvcnRhbnQ7MzQ1"))))}function wn(){var e=En(),t=e.section,n=e.slide;t&&(Z.animateAnchor?Gn(t,n):kt(t,n))}function yn(){if(!ut&&!Z.lockAnchors){var e=En(),t=e.section,n=e.slide,o=void 0===we,r=void 0===we&&void 0===n&&!Ne;t&&t.length&&(t&&t!==we&&!o||r||!Ne&&Ce!=n)&&Gn(t,n)}}function En(){var t,n,o=e.location.hash;if(o.length){var r=o.replace("#","").split("/"),i=o.indexOf("#/")>-1;t=i?"/"+r[1]:decodeURIComponent(r[0]);var l=i?r[2]:r[1];l&&l.length&&(n=decodeURIComponent(l))}return{section:t,slide:n}}function xn(e){clearTimeout(qe);var n=t.activeElement,o=e.keyCode;9===o?function(e){var n,o,r,i,l,a,s,c=e.shiftKey,u=t.activeElement,d=Tn(vn(_(g)[0]));function f(e){return xe(e),d[0]?d[0].focus():null}(n=e,o=Tn(t),r=o.indexOf(t.activeElement),i=n.shiftKey?r-1:r+1,l=o[i],a=rn(me(l,O)),s=on(me(l,h)),a||s)&&(u?null==me(u,g+","+g+" "+k)&&(u=f(e)):f(e),(!c&&u==d[d.length-1]||c&&u==d[0])&&xe(e))}(e):Me(n,"textarea")||Me(n,"input")||Me(n,"select")||"true"===n.getAttribute("contentEditable")||""===n.getAttribute("contentEditable")||!Z.keyboardScrolling||!Z.autoScrolling||([40,38,32,33,34].indexOf(o)>-1&&xe(e),ze=e.ctrlKey,qe=setTimeout(function(){!function(e){var t=e.shiftKey;if(Xe||!([37,39].indexOf(e.keyCode)<0))switch(e.keyCode){case 38:case 33:Ge.k.up&&Tt();break;case 32:if(t&&Ge.k.up){Tt();break}case 40:case 34:Ge.k.down&&Ot();break;case 36:Ge.k.up&&Ct(1);break;case 35:Ge.k.down&&Ct(_(h).length);break;case 37:Ge.k.left&&Rt();break;case 39:Ge.k.right&&Ht()}}(e)},150))}function Ln(e){Ve&&(ze=e.ctrlKey)}function An(e){2==e.which&&(mt=e.pageY,De.addEventListener("mousemove",kn))}function Mn(e){2==e.which&&De.removeEventListener("mousemove",kn)}function Tn(e){return[].slice.call(_(rt,e)).filter(function(e){return"-1"!==e.getAttribute("tabindex")&&null!==e.offsetParent})}function On(){Ve=!1,ze=!1}function kn(e){Xe&&(e.pageYmt&&Ge.m.down&&Ot()),mt=e.pageY}function Cn(e,t,n){var o=me(e,h),r={slides:e,destiny:t,direction:n,destinyPos:{left:t.offsetLeft},slideIndex:ie(t),section:o,sectionIndex:ie(o,h),anchorLink:o.getAttribute("data-anchor"),slidesNav:_(j,o)[0],slideAnchor:Qn(t),prevSlide:_(k,o)[0],prevSlideIndex:ie(_(k,o)[0]),localIsResizing:We};r.xMovement=Yn(r.prevSlideIndex,r.slideIndex),r.localIsResizing||(Xe=!1),io("parallax","applyHorizontal",r),Z.onSlideLeave&&!r.localIsResizing&&"none"!==r.xMovement&&Le(Z.onSlideLeave)&&!1===nn("onSlideLeave",r)?Ne=!1:(ue(t,c),de(Ee(t),c),r.localIsResizing||(fn(r.prevSlide),cn(t)),Hn(r),J(o,c)&&!r.localIsResizing&&Un(r.slideIndex,r.slideAnchor,r.anchorLink,r.sectionIndex),ve.continuousHorizontal&&ve.continuousHorizontal.apply(r),ao()?Rn(r):In(e,r,!0),Z.interlockedSlides&&ve.interlockedSlides&&(ro("continuousHorizontal")&&void 0!==n&&n!==r.xMovement||ve.interlockedSlides.apply(r)))}function Hn(e){!Z.loopHorizontal&&Z.controlArrows&&(Te(_(X,e.section),0!==e.slideIndex),Te(_(F,e.section),null!=oe(e.destiny)))}function Rn(e){var t,n;ve.continuousHorizontal&&ve.continuousHorizontal.afterSlideLoads(e),t=e.slidesNav,n=e.slideIndex,Z.slidesNavigation&&null!=t&&(de(_(u,t),c),ue(_("a",_("li",t)[n]),c)),e.localIsResizing||(io("parallax","afterSlideLoads"),Le(Z.afterSlideLoad)&&nn("afterSlideLoad",e),Xe=!0,un(e.destiny)),Ne=!1,ro("interlockedSlides")&&ve.interlockedSlides.apply(e)}function In(e,t,n){var o=t.destinyPos;if(Z.css3){var r="translate3d(-"+Math.round(o.left)+"px, 0px, 0px)";ve.test.translate3dH[t.sectionIndex]=r,q(Nn(_(I,e)),to(r)),Qe=setTimeout(function(){n&&Rn(t)},Z.scrollingSpeed)}else ve.test.left[t.sectionIndex]=Math.round(o.left),uo(e,Math.round(o.left),Z.scrollingSpeed,function(){n&&Rn(t)})}function zn(){if(Ae(De,"onResize"),Bn(),je){var e=t.activeElement;if(!Me(e,"textarea")&&!Me(e,"input")&&!Me(e,"select")){var n=K();Math.abs(n-St)>20*Math.max(St,n)/100&&(It(!0),St=n)}}else clearTimeout(Ue),Ue=setTimeout(function(){It(!0)},350)}function Bn(){var t=Z.responsive||Z.responsiveWidth,n=Z.responsiveHeight,o=t&&e.innerWidthn?"up":"down"}function Yn(e,t){return e==t?"none":e>t?"left":"right"}function Wn(e){if(!J(e,z)){var n=t.createElement("div");n.className=m,n.style.height=Vn(e)+"px",ue(e,z),he(e,n)}}function Vn(e){var t=Yt(e);if(Z.paddingTop||Z.paddingBottom){var n=e;J(n,p)||(n=me(e,h)),t-=parseInt(getComputedStyle(n)["padding-top"])+parseInt(getComputedStyle(n)["padding-bottom"])}return t}function Xn(e,t){t?Nn(De):jn(De),clearTimeout($e),q(De,to(e)),ve.test.translate3d=e,$e=setTimeout(function(){de(De,i)},10)}function Zn(e){var t=_(h+'[data-anchor="'+e+'"]',De)[0];if(!t){var n=void 0!==e?e-1:0;t=_(h)[n]}return t}function Gn(e,t){var n=Zn(e);if(null!=n){var o,r,i,l=(null==(i=_(O+'[data-anchor="'+(o=t)+'"]',r=n)[0])&&(o=void 0!==o?o:0,i=_(O,r)[o]),i);Qn(n)===we||J(n,c)?Fn(l):tn(n,function(){Fn(l)})}}function Fn(e){null!=e&&Cn(me(e,H),e)}function Un(e,t,n,o){var r="";Z.anchors.length&&!Z.lockAnchors&&(e?(null!=n&&(r=n),null==t&&(t=e),Ce=t,_n(r+"/"+t)):null!=e?(Ce=t,_n(n)):_n(n)),Jn()}function _n(t){if(Z.recordHistory)location.hash=t;else if(je||Pe)e.history.replaceState(void 0,void 0,"#"+t);else{var n=e.location.href.split("#")[0];e.location.replace(n+"#"+t)}}function Qn(e){if(!e)return null;var t=e.getAttribute("data-anchor"),n=ie(e);return null==t&&(t=n),t}function Jn(){var e=_(g)[0],t=_(k,e)[0],n=Qn(e),o=Qn(t),r=String(n);t&&(r=r+"-"+o),r=r.replace("/","-").replace("#","");var i=new RegExp("\\b\\s?"+s+"-[^\\s]+\\b","g");ce.className=ce.className.replace(i,""),ue(ce,s+"-"+r)}function Kn(){return e.PointerEvent?{down:"pointerdown",move:"pointermove"}:{down:"MSPointerDown",move:"MSPointerMove"}}function qn(e){var t=[];return t.y=void 0!==e.pageY&&(e.pageY||e.pageX)?e.pageY:e.touches[0].pageY,t.x=void 0!==e.pageX&&(e.pageY||e.pageX)?e.pageX:e.touches[0].pageX,Pe&&_t(e)&&Z.scrollBar&&void 0!==e.touches&&(t.y=e.touches[0].pageY,t.x=e.touches[0].pageX),t}function $n(e,t){yt(0,"internal"),void 0!==t&&(We=!0),Cn(me(e,H),e),void 0!==t&&(We=!1),yt(it.scrollingSpeed,"internal")}function eo(e){var t=Math.round(e);if(Z.css3&&Z.autoScrolling&&!Z.scrollBar)Xn("translate3d(0px, -"+t+"px, 0px)",!1);else if(Z.autoScrolling&&!Z.scrollBar)q(De,{top:-t+"px"}),ve.test.top=-t+"px";else{var n=ln(t);fo(n.element,n.options)}}function to(e){return{"-webkit-transform":e,"-moz-transform":e,"-ms-transform":e,transform:e}}function no(e,t,n){"all"!==t?Ge[n][t]=e:Object.keys(Ge[n]).forEach(function(t){Ge[n][t]=e})}function oo(e){return q(e,{"-webkit-transition":"none",transition:"none"})}function ro(e){return null!==Z[e]&&"[object Array]"===Object.prototype.toString.call(Z[e])?Z[e].length&&ve[e]:Z[e]&&ve[e]}function io(e,t,n){if(ro(e))return ve[e][t](n)}function lo(){return ro("dragAndMove")&&ve.dragAndMove.isAnimating}function ao(){return ro("dragAndMove")&&ve.dragAndMove.isGrabbing}function so(e,t,n){Z[e]=t,"internal"!==n&&(it[e]=t)}function co(){$||(U("error","Fullpage.js version 3 has changed its license to GPLv3 and it requires a `licenseKey` option. Read about it here:"),U("error","https://github.com/alvarotrigo/fullPage.js#options.")),J(_("html"),a)?U("error","Fullpage.js can only be initialized once and you are doing it multiple times!"):(Z.continuousVertical&&(Z.loopTop||Z.loopBottom)&&(Z.continuousVertical=!1,U("warn","Option `loopTop/loopBottom` is mutually exclusive with `continuousVertical`; `continuousVertical` disabled")),!Z.scrollOverflow||!Z.scrollBar&&Z.autoScrolling||U("warn","Options scrollBar:true and autoScrolling:false are mutually exclusive with scrollOverflow:true. Sections with scrollOverflow might not work well in Firefox"),!Z.continuousVertical||!Z.scrollBar&&Z.autoScrolling||(Z.continuousVertical=!1,U("warn","Scroll bars (`scrollBar:true` or `autoScrolling:false`) are mutually exclusive with `continuousVertical`; `continuousVertical` disabled")),Z.scrollOverflow&&null==Z.scrollOverflowHandler&&(Z.scrollOverflow=!1,U("error","The option `scrollOverflow:true` requires the file `scrolloverflow.min.js`. Please include it before fullPage.js.")),Z.anchors.forEach(function(e){var t=[].slice.call(_("[name]")).filter(function(t){return t.getAttribute("name")&&t.getAttribute("name").toLowerCase()==e.toLowerCase()}),n=[].slice.call(_("[id]")).filter(function(t){return t.getAttribute("id")&&t.getAttribute("id").toLowerCase()==e.toLowerCase()});(n.length||t.length)&&(U("error","data-anchor tags can not have the same value as any `id` element on the site (or `name` element for IE)."),n.length&&U("error",'"'+e+'" is is being used by another element `id` property'),t.length&&U("error",'"'+e+'" is is being used by another element `name` property'))}))}function uo(t,n,o,r){var i,l=(i=t).self!=e&&J(i,C)?i.scrollLeft:!Z.autoScrolling||Z.scrollBar?ye():i.offsetTop,a=n-l,s=0;et=!0;var c=function(){if(et){var i=n;s+=20,o&&(i=e.fp_easings[Z.easing](s,l,a,o)),fo(t,i),s');}_this.state={initialized:false};return _this;}_createClass(ReactFullpage,[{key:'componentDidMount',value:function componentDidMount(){var _props=this.props,$=_props.$,_props$v2compatible=_props.v2compatible,v2compatible=_props$v2compatible===undefined?false:_props$v2compatible;var opts=this.buildOptions();if(v2compatible){if(!$||$ instanceof window.jQuery===false){throw new Error('Must provide $ (jQuery) as a prop if using v2 API');}$(document).ready(function(){// eslint-disable-line -$('#fullpage').fullpage(opts);});}else if(fullpage_js_dist_fullpage_extensions_min__WEBPACK_IMPORTED_MODULE_1___default.a){this.init(opts);this.markInitialized();}}},{key:'componentDidUpdate',value:function componentDidUpdate(prevProps,prevState){if(prevState.initialized===this.state.initialized){return;}var props=this.props,fpUtils=this.fpUtils;var slideSelector=props.slideSelector||'.slide';var sectionSelector=props.sectionSelector||'.section';var activeSection=document.querySelector(sectionSelector+'.active');var activeSectionIndex=activeSection?fpUtils.index(activeSection):-1;var activeSlide=document.querySelector(sectionSelector+'.active'+slideSelector+'.active');var activeSlideIndex=activeSlide?fpUtils.index(activeSlide):-1;this.destroy();if(activeSectionIndex>-1){fpUtils.addClass(document.querySelectorAll(sectionSelector)[activeSectionIndex],'active');}if(activeSlideIndex>-1){fpUtils.addClass(activeSlide,'active');}this.init(this.buildOptions());}},{key:'componentWillUnmount',value:function componentWillUnmount(){this.destroy();}},{key:'init',value:function init(opts){new fullpage_js_dist_fullpage_extensions_min__WEBPACK_IMPORTED_MODULE_1___default.a('#fullpage',opts);// eslint-disable-line +var isFunc=function isFunc(val){return typeof val==='function';};var fullpageCallbacks=['afterLoad','afterRender','afterResize','afterResponsive','afterSlideLoad','onLeave','onSlideLeave'];var ReactFullpage=function(_React$Component){_inherits(ReactFullpage,_React$Component);function ReactFullpage(props){_classCallCheck(this,ReactFullpage);var _this=_possibleConstructorReturn(this,(ReactFullpage.__proto__||Object.getPrototypeOf(ReactFullpage)).call(this,props));var render=_this.props.render;if(!isFunc(render)){throw new Error('must provide render prop to ');}_this.state={initialized:false};return _this;}_createClass(ReactFullpage,[{key:'componentDidMount',value:function componentDidMount(){var opts=this.buildOptions();if(fullpage_js_dist_fullpage_extensions_min__WEBPACK_IMPORTED_MODULE_1___default.a){this.init(opts);this.markInitialized();}}},{key:'componentDidUpdate',value:function componentDidUpdate(prevProps,prevState){var newSectionCount=this.getSectionCount();var newSlideCount=this.getSlideCount();var _state=this.state,sectionCount=_state.sectionCount,slideCount=_state.slideCount;/* TODO: add a list of fullpage.js specific props to subscribe too + similar to how callbacks are handled) + */if(this.props.sectionsColor!==prevProps.sectionsColor){console.log('rebuilding due to a change in fullpage.js props');// NOTE: if fullpage props have changed we need to rebuild +this.destroy();this.init(this.buildOptions());return;}if(sectionCount===newSectionCount&&slideCount===newSlideCount){return;}console.log('rebuilding due to a change in fullpage.js sections/slides');// NOTE: if sections have changed we need to rebuild +this.destroy();this.init(this.buildOptions());}},{key:'componentWillUnmount',value:function componentWillUnmount(){this.destroy();}},{key:'getSectionCount',value:function getSectionCount(){var _props$sectionSelecto=this.props.sectionSelector,sectionSelector=_props$sectionSelecto===undefined?'.section':_props$sectionSelecto;return document.querySelectorAll(sectionSelector).length;}},{key:'getSlideCount',value:function getSlideCount(){var _props$slideSelector=this.props.slideSelector,slideSelector=_props$slideSelector===undefined?'.slide':_props$slideSelector;return document.querySelectorAll(slideSelector).length;}},{key:'init',value:function init(opts){new fullpage_js_dist_fullpage_extensions_min__WEBPACK_IMPORTED_MODULE_1___default.a('#fullpage',opts);// eslint-disable-line this.fullpageApi=window.fullpage_api;this.fpUtils=window.fp_utils;this.fpEasings=window.fp_easings;}},{key:'destroy',value:function destroy(){// NOTE: need to check for init to support SSR -if(!this.state.initialized)return;this.fullpageApi.destroy('all');}},{key:'markInitialized',value:function markInitialized(){this.setState({initialized:true});}},{key:'buildOptions',value:function buildOptions(){var _this2=this;var filterCb=function filterCb(key){return!!Object.keys(_this2.props).find(function(cb){return cb===key;});};var registered=fullpageCallbacks.filter(filterCb);var listeners=registered.reduce(function(result,key){var agg=_extends({},result);agg[key]=function(){for(var _len=arguments.length,args=Array(_len),_key=0;_key<_len;_key++){args[_key]=arguments[_key];}var newArgs=[key].concat(args);_this2.update.apply(_this2,_toConsumableArray(newArgs));};return agg;},{});return _extends({},this.props,listeners);}},{key:'update',value:function update(lastEvent){var _this3=this;for(var _len2=arguments.length,args=Array(_len2>1?_len2-1:0),_key2=1;_key2<_len2;_key2++){args[_key2-1]=arguments[_key2];}var _props$v2compatible2=this.props.v2compatible,v2compatible=_props$v2compatible2===undefined?false:_props$v2compatible2;var state=_extends({},this.state);var makeState=function makeState(callbackParameters){return _extends({},state,callbackParameters,{lastEvent:lastEvent});};var fromArgs=function fromArgs(argList){return argList.reduce(function(result,key,i){var value=args[i];result[key]=value;// eslint-disable-line -return result;},{});};// TODO: change all fromArgs to constants After-* -if(v2compatible){// NOTE: remapping callback args for v2 +if(typeof window!=='undefined'){this.fullpageApi.destroy('all');}}},{key:'markInitialized',value:function markInitialized(){this.setState({initialized:true,sectionCount:this.getSectionCount(),slideCount:this.getSlideCount()});}},{key:'buildOptions',value:function buildOptions(){var _this2=this;var filterCb=function filterCb(key){return!!Object.keys(_this2.props).find(function(cb){return cb===key;});};var registered=fullpageCallbacks.filter(filterCb);var listeners=registered.reduce(function(result,key){var agg=_extends({},result);agg[key]=function(){for(var _len=arguments.length,args=Array(_len),_key=0;_key<_len;_key++){args[_key]=arguments[_key];}var newArgs=[key].concat(args);_this2.update.apply(_this2,_toConsumableArray(newArgs));};return agg;},{});return _extends({},this.props,listeners);}},{key:'update',value:function update(lastEvent){var _this3=this;for(var _len2=arguments.length,args=Array(_len2>1?_len2-1:0),_key2=1;_key2<_len2;_key2++){args[_key2-1]=arguments[_key2];}var state=_extends({},this.state,{sectionCount:this.getSectionCount(),getSlideCount:this.getSlideCount()});var makeState=function makeState(callbackParameters){return _extends({},state,callbackParameters,{lastEvent:lastEvent});};var fromArgs=function fromArgs(argList){return argList.reduce(function(result,key,i){var value=args[i];result[key]=value;// eslint-disable-line +return result;},{});};// NOTE: remapping callback args to v3 // https://github.com/alvarotrigo/fullPage.js#callbacks switch(lastEvent){// After-* -case'afterLoad':state=makeState(fromArgs(['anchorLink','index']));break;case'afterResponsive':state=makeState(fromArgs(['isResponsive']));break;case'afterSlideLoad':state=makeState(fromArgs(['anchorLink','index','slideAnchor','slideIndex']));break;// On-* -case'onLeave':state=makeState(fromArgs(['index','nextIndex','direction']));break;case'onSlideLeave':state=makeState(fromArgs(['anchorLink','index','slideIndex','direction','nextSlideIndex']));break;default:break;}}else{// NOTE: remapping callback args to v3 -// https://github.com/alvarotrigo/fullPage.js#callbacks -switch(lastEvent){// After-* -case'afterLoad':state=makeState(fromArgs(['origin','destination','direction']));break;// TODO: update accoding to new API -case'afterResize':state=makeState(fromArgs(['']));break;case'afterResponsive':state=makeState(fromArgs(['isResponsive']));break;case'afterSlideLoad':state=makeState(fromArgs(['section','origin','destination','direction']));break;// On-* -case'onLeave':state=makeState(fromArgs(['origin','destination','direction']));break;case'onSlideLeave':state=makeState(fromArgs(['section','origin','slideIndex','destination','direction']));break;default:break;}}this.setState(state,function(){var _props2;(_props2=_this3.props)[lastEvent].apply(_props2,args);});}},{key:'render',value:function render(){return react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement('div',{id:'fullpage'},this.state.initialized?this.props.render(this):react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement('div',{className:'section'}));}}]);return ReactFullpage;}(react__WEBPACK_IMPORTED_MODULE_0___default.a.Component);/* harmony default export */ __webpack_exports__["default"] = (ReactFullpage); +case'afterLoad':state=makeState(fromArgs(['origin','destination','direction']));break;case'afterResize':state=makeState(fromArgs(['']));break;case'afterResponsive':state=makeState(fromArgs(['isResponsive']));break;case'afterSlideLoad':state=makeState(fromArgs(['section','origin','destination','direction']));break;// On-* +case'onLeave':state=makeState(fromArgs(['origin','destination','direction']));break;case'onSlideLeave':state=makeState(fromArgs(['section','origin','slideIndex','destination','direction']));break;default:break;}this.setState(state,function(){var _props;(_props=_this3.props)[lastEvent].apply(_props,args);});}},{key:'render',value:function render(){return react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement('div',{id:'fullpage'},this.props.render(this));}}]);return ReactFullpage;}(react__WEBPACK_IMPORTED_MODULE_0___default.a.Component);/* harmony default export */ __webpack_exports__["default"] = (ReactFullpage); /***/ }) /******/ ]); \ No newline at end of file diff --git a/dist/react-fullpage.js b/dist/react-fullpage.js index 43fb0e4..d97ec13 100644 --- a/dist/react-fullpage.js +++ b/dist/react-fullpage.js @@ -1,5 +1,5 @@ /*! - * @fullpage/react-fullpage 0.1.2 + * @fullpage/react-fullpage 0.1.3 * https://github.com/alvarotrigo/react-fullpage * @license https://github.com/alvarotrigo/react-fullpage#license * @@ -118,4384 +118,8 @@ var __WEBPACK_AMD_DEFINE_RESULT__;/*! * * Copyright (C) 2015 alvarotrigo.com - A project by Alvaro Trigo */ -(function( root, window, document, factory, undefined) { - if( true ) { - // AMD. Register as an anonymous module. - !(__WEBPACK_AMD_DEFINE_RESULT__ = (function() { - root.fullpage = factory(window, document); - return root.fullpage; - }).call(exports, __webpack_require__, exports, module), - __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); - } else {} -}(this, window, document, function(window, document){ - 'use strict'; - - // keeping central set of classnames and selectors - var WRAPPER = 'fullpage-wrapper'; - var WRAPPER_SEL = '.' + WRAPPER; - - // slimscroll - var SCROLLABLE = 'fp-scrollable'; - var SCROLLABLE_SEL = '.' + SCROLLABLE; - - // util - var RESPONSIVE = 'fp-responsive'; - var NO_TRANSITION = 'fp-notransition'; - var DESTROYED = 'fp-destroyed'; - var ENABLED = 'fp-enabled'; - var VIEWING_PREFIX = 'fp-viewing'; - var ACTIVE = 'active'; - var ACTIVE_SEL = '.' + ACTIVE; - var COMPLETELY = 'fp-completely'; - var COMPLETELY_SEL = '.' + COMPLETELY; - - // section - var SECTION_DEFAULT_SEL = '.section'; - var SECTION = 'fp-section'; - var SECTION_SEL = '.' + SECTION; - var SECTION_ACTIVE_SEL = SECTION_SEL + ACTIVE_SEL; - var TABLE_CELL = 'fp-tableCell'; - var TABLE_CELL_SEL = '.' + TABLE_CELL; - var AUTO_HEIGHT = 'fp-auto-height'; - var AUTO_HEIGHT_SEL = '.' + AUTO_HEIGHT; - var NORMAL_SCROLL = 'fp-normal-scroll'; - var NORMAL_SCROLL_SEL = '.' + NORMAL_SCROLL; - - // section nav - var SECTION_NAV = 'fp-nav'; - var SECTION_NAV_SEL = '#' + SECTION_NAV; - var SECTION_NAV_TOOLTIP = 'fp-tooltip'; - var SECTION_NAV_TOOLTIP_SEL='.'+SECTION_NAV_TOOLTIP; - var SHOW_ACTIVE_TOOLTIP = 'fp-show-active'; - - // slide - var SLIDE_DEFAULT_SEL = '.slide'; - var SLIDE = 'fp-slide'; - var SLIDE_SEL = '.' + SLIDE; - var SLIDE_ACTIVE_SEL = SLIDE_SEL + ACTIVE_SEL; - var SLIDES_WRAPPER = 'fp-slides'; - var SLIDES_WRAPPER_SEL = '.' + SLIDES_WRAPPER; - var SLIDES_CONTAINER = 'fp-slidesContainer'; - var SLIDES_CONTAINER_SEL = '.' + SLIDES_CONTAINER; - var TABLE = 'fp-table'; - var INITIAL = 'fp-initial'; - - // slide nav - var SLIDES_NAV = 'fp-slidesNav'; - var SLIDES_NAV_SEL = '.' + SLIDES_NAV; - var SLIDES_NAV_LINK_SEL = SLIDES_NAV_SEL + ' a'; - var SLIDES_ARROW = 'fp-controlArrow'; - var SLIDES_ARROW_SEL = '.' + SLIDES_ARROW; - var SLIDES_PREV = 'fp-prev'; - var SLIDES_PREV_SEL = '.' + SLIDES_PREV; - var SLIDES_ARROW_PREV = SLIDES_ARROW + ' ' + SLIDES_PREV; - var SLIDES_ARROW_PREV_SEL = SLIDES_ARROW_SEL + SLIDES_PREV_SEL; - var SLIDES_NEXT = 'fp-next'; - var SLIDES_NEXT_SEL = '.' + SLIDES_NEXT; - var SLIDES_ARROW_NEXT = SLIDES_ARROW + ' ' + SLIDES_NEXT; - var SLIDES_ARROW_NEXT_SEL = SLIDES_ARROW_SEL + SLIDES_NEXT_SEL; - - function initialise(containerSelector, options) { - var isLicenseValid = options && new RegExp('([\\d\\w]{8}-){3}[\\d\\w]{8}|OPEN-SOURCE-GPLV3-LICENSE').test(options.licenseKey) || document.domain.indexOf('alvarotrigo.com') > -1; - - //only once my friend! - if(hasClass($('html'), ENABLED)){ displayWarnings(); return; } - - // common jQuery objects - var $htmlBody = $('html, body'); - var $body = $('body')[0]; - - var FP = {}; - - // Creating some defaults, extending them with any options that were provided - options = deepExtend({ - //navigation - menu: false, - anchors:[], - lockAnchors: false, - navigation: false, - navigationPosition: 'right', - navigationTooltips: [], - showActiveTooltip: false, - slidesNavigation: false, - slidesNavPosition: 'bottom', - scrollBar: false, - hybrid: false, - - //scrolling - css3: true, - scrollingSpeed: 700, - autoScrolling: true, - fitToSection: true, - fitToSectionDelay: 1000, - easing: 'easeInOutCubic', - easingcss3: 'ease', - loopBottom: false, - loopTop: false, - loopHorizontal: true, - continuousVertical: false, - continuousHorizontal: false, - scrollHorizontally: false, - interlockedSlides: false, - dragAndMove: false, - offsetSections: false, - resetSliders: false, - fadingEffect: false, - normalScrollElements: null, - scrollOverflow: false, - scrollOverflowReset: false, - scrollOverflowHandler: window.fp_scrolloverflow ? window.fp_scrolloverflow.iscrollHandler : null, - scrollOverflowOptions: null, - touchSensitivity: 5, - normalScrollElementTouchThreshold: 5, - bigSectionsDestination: null, - - //Accessibility - keyboardScrolling: true, - animateAnchor: true, - recordHistory: true, - - //design - controlArrows: true, - controlArrowColor: '#fff', - verticalCentered: true, - sectionsColor : [], - paddingTop: 0, - paddingBottom: 0, - fixedElements: null, - responsive: 0, //backwards compabitility with responsiveWiddth - responsiveWidth: 0, - responsiveHeight: 0, - responsiveSlides: false, - parallax: false, - parallaxOptions: { - type: 'reveal', - percentage: 62, - property: 'translate' - }, - - //Custom selectors - sectionSelector: SECTION_DEFAULT_SEL, - slideSelector: SLIDE_DEFAULT_SEL, - - //events - v2compatible: false, - afterLoad: null, - onLeave: null, - afterRender: null, - afterResize: null, - afterReBuild: null, - afterSlideLoad: null, - onSlideLeave: null, - afterResponsive: null, - - lazyLoading: true - }, options); - - //flag to avoid very fast sliding for landscape sliders - var slideMoving = false; - - var isTouchDevice = navigator.userAgent.match(/(iPhone|iPod|iPad|Android|playbook|silk|BlackBerry|BB10|Windows Phone|Tizen|Bada|webOS|IEMobile|Opera Mini)/); - var isTouch = (('ontouchstart' in window) || (navigator.msMaxTouchPoints > 0) || (navigator.maxTouchPoints)); - var container = typeof containerSelector === 'string' ? $(containerSelector)[0] : containerSelector; - var windowsHeight = getWindowHeight(); - var isResizing = false; - var isWindowFocused = true; - var lastScrolledDestiny; - var lastScrolledSlide; - var canScroll = true; - var scrollings = []; - var controlPressed; - var startingSection; - var isScrollAllowed = {}; - isScrollAllowed.m = { 'up':true, 'down':true, 'left':true, 'right':true }; - isScrollAllowed.k = deepExtend({}, isScrollAllowed.m); - var MSPointer = getMSPointer(); - var events = { - touchmove: 'ontouchmove' in window ? 'touchmove' : MSPointer.move, - touchstart: 'ontouchstart' in window ? 'touchstart' : MSPointer.down - }; - var scrollBarHandler; - var isUnlicensesBannerAdded = false; - - // taken from https://github.com/udacity/ud891/blob/gh-pages/lesson2-focus/07-modals-and-keyboard-traps/solution/modal.js - var focusableElementsString = 'a[href], area[href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), button:not([disabled]), iframe, object, embed, [tabindex="0"], [contenteditable]'; - - //timeouts - var resizeId; - var afterSectionLoadsId; - var afterSlideLoadsId; - var scrollId; - var scrollId2; - var keydownId; - var silentScrollId; - var originals = deepExtend({}, options); //deep copy - var activeAnimation; - var activationKey = {}; - - displayWarnings(); - - //easeInOutCubic animation included in the plugin - window.fp_easings = deepExtend(window.fp_easings, { - easeInOutCubic: function (t, b, c, d) { - if ((t/=d/2) < 1) return c/2*t*t*t + b;return c/2*((t-=2)*t*t + 2) + b; - } - }); - - /** - * Sets the autoScroll option. - * It changes the scroll bar visibility and the history of the site as a result. - */ - function setAutoScrolling(value, type){ - //removing the transformation - if(!value){ - silentScroll(0); - } - - setVariableState('autoScrolling', value, type); - - var element = $(SECTION_ACTIVE_SEL)[0]; - - if(options.autoScrolling && !options.scrollBar){ - css($htmlBody, { - 'overflow': 'hidden', - 'height': '100%' - }); - - setRecordHistory(originals.recordHistory, 'internal'); - - //for IE touch devices - css(container, { - '-ms-touch-action': 'none', - 'touch-action': 'none' - }); - - if(element != null){ - //moving the container up - silentScroll(element.offsetTop); - } - }else{ - css($htmlBody, { - 'overflow' : 'visible', - 'height' : 'initial' - }); - - setRecordHistory(false, 'internal'); - - //for IE touch devices - css(container, { - '-ms-touch-action': '', - 'touch-action': '' - }); - - //extensions only! - removeAnimation(container); - - //scrolling the page to the section with no animation - if (element != null) { - var scrollSettings = getScrollSettings(element.offsetTop); - scrollSettings.element.scrollTo(0, scrollSettings.options); - } - } - - trigger(container, 'setAutoScrolling', value); - } - - /** - * Defines wheter to record the history for each hash change in the URL. - */ - function setRecordHistory(value, type){ - setVariableState('recordHistory', value, type); - } - - /** - * Defines the scrolling speed - */ - function setScrollingSpeed(value, type){ - if(type !== 'internal' && options.fadingEffect && FP.fadingEffect ){ - FP.fadingEffect.update(value); - } - setVariableState('scrollingSpeed', value, type); - } - - /** - * Sets fitToSection - */ - function setFitToSection(value, type){ - setVariableState('fitToSection', value, type); - } - - /** - * Sets lockAnchors - */ - function setLockAnchors(value){ - options.lockAnchors = value; - } - - /** - * Adds or remove the possibility of scrolling through sections by using the mouse wheel or the trackpad. - */ - function setMouseWheelScrolling(value){ - if(value){ - addMouseWheelHandler(); - addMiddleWheelHandler(); - }else{ - removeMouseWheelHandler(); - removeMiddleWheelHandler(); - } - } - - /** - * Adds or remove the possibility of scrolling through sections by using the mouse wheel/trackpad or touch gestures. - * Optionally a second parameter can be used to specify the direction for which the action will be applied. - * - * @param directions string containing the direction or directions separated by comma. - */ - function setAllowScrolling(value, directions){ - if(typeof directions !== 'undefined'){ - directions = directions.replace(/ /g,'').split(','); - - directions.forEach(function (direction){ - setIsScrollAllowed(value, direction, 'm'); - }); - } - else{ - setIsScrollAllowed(value, 'all', 'm'); - } - trigger(container, 'setAllowScrolling', {value: value, directions: directions}); - } - - /** - * Adds or remove the mouse wheel hijacking - */ - function setMouseHijack(value){ - if(value){ - setMouseWheelScrolling(true); - - //not sure what is this doing here alvaro!! - //I'll comment it as it was causing a bug on dragAndMove when swiping for the 1st time - //The page background was visible. We need preventBouncing for drag and move too!! - //and drag And move already disables the default touch events on init turnOffTouch() function! - //if(!usingExtension('dragAndMove') || options.dragAndMove === 'mouseonly'){ - addTouchHandler(); - //} - }else{ - setMouseWheelScrolling(false); - removeTouchHandler(); - } - } - - /** - * Adds or remove the possibility of scrolling through sections by using the keyboard arrow keys - */ - function setKeyboardScrolling(value, directions){ - if(typeof directions !== 'undefined'){ - directions = directions.replace(/ /g,'').split(','); - - directions.forEach(function(direction){ - setIsScrollAllowed(value, direction, 'k'); - }); - }else{ - setIsScrollAllowed(value, 'all', 'k'); - options.keyboardScrolling = value; - } - } - - /** - * Moves the page up one section. - */ - function moveSectionUp(){ - var prev = prevUntil($(SECTION_ACTIVE_SEL)[0], SECTION_SEL); - - //looping to the bottom if there's no more sections above - if (!prev && (options.loopTop || options.continuousVertical)) { - prev = last($(SECTION_SEL)); - } - - if (prev != null) { - scrollPage(prev, null, true); - } - } - - /** - * Moves the page down one section. - */ - function moveSectionDown(){ - var next = nextUntil($(SECTION_ACTIVE_SEL)[0], SECTION_SEL); - - //looping to the top if there's no more sections below - if(!next && - (options.loopBottom || options.continuousVertical)){ - next = $(SECTION_SEL)[0]; - } - - if(next != null){ - scrollPage(next, null, false); - } - } - - /** - * Moves the page to the given section and slide with no animation. - * Anchors or index positions can be used as params. - */ - function silentMoveTo(sectionAnchor, slideAnchor){ - setScrollingSpeed (0, 'internal'); - moveTo(sectionAnchor, slideAnchor); - setScrollingSpeed (originals.scrollingSpeed, 'internal'); - } - - /** - * Moves the page to the given section and slide. - * Anchors or index positions can be used as params. - */ - function moveTo(sectionAnchor, slideAnchor){ - var destiny = getSectionByAnchor(sectionAnchor); - - if (typeof slideAnchor !== 'undefined'){ - scrollPageAndSlide(sectionAnchor, slideAnchor); - }else if(destiny != null){ - scrollPage(destiny); - } - } - - /** - * Slides right the slider of the active section. - * Optional `section` param. - */ - function moveSlideRight(section){ - moveSlide('right', section); - } - - /** - * Slides left the slider of the active section. - * Optional `section` param. - */ - function moveSlideLeft(section){ - moveSlide('left', section); - } - - /** - * When resizing is finished, we adjust the slides sizes and positions - */ - function reBuild(resizing){ - if(hasClass(container, DESTROYED)){ return; } //nothing to do if the plugin was destroyed - - isResizing = true; - - windowsHeight = getWindowHeight(); //updating global var - - var sections = $(SECTION_SEL); - for (var i = 0; i < sections.length; ++i) { - var section = sections[i]; - var slidesWrap = $(SLIDES_WRAPPER_SEL, section)[0]; - var slides = $(SLIDE_SEL, section); - - //adjusting the height of the table-cell for IE and Firefox - if(options.verticalCentered){ - css($(TABLE_CELL_SEL, section), {'height': getTableHeight(section) + 'px'}); - } - - css(section, {'height': getWindowHeightOffset(section) + 'px'}); - - //adjusting the position fo the FULL WIDTH slides... - if (slides.length > 1) { - landscapeScroll(slidesWrap, $(SLIDE_ACTIVE_SEL, slidesWrap)[0]); - } - } - - if(options.scrollOverflow){ - scrollBarHandler.createScrollBarForAll(); - } - - var activeSection = $(SECTION_ACTIVE_SEL)[0]; - var sectionIndex = index(activeSection, SECTION_SEL); - - //isn't it the first section? - if(sectionIndex && !usingExtension('fadingEffect')){ - //adjusting the position for the current section - silentMoveTo(sectionIndex + 1); - } - - isResizing = false; - if(isFunction( options.afterResize ) && resizing){ - options.afterResize.call(container, window.innerWidth, window.innerHeight); - } - if(isFunction( options.afterReBuild ) && !resizing){ - options.afterReBuild.call(container); - } - trigger(container, 'afterRebuild'); - } - - /** - * Turns fullPage.js to normal scrolling mode when the viewport `width` or `height` - * are smaller than the set limit values. - */ - function setResponsive(active){ - var isResponsive = hasClass($body, RESPONSIVE); - - if(active){ - if(!isResponsive){ - setAutoScrolling(false, 'internal'); - setFitToSection(false, 'internal'); - hide($(SECTION_NAV_SEL)); - addClass($body, RESPONSIVE); - if(isFunction( options.afterResponsive )){ - options.afterResponsive.call( container, active); - } - - if(options.responsiveSlides && FP.responsiveSlides){ - FP.responsiveSlides.toSections(); - } - - trigger(container, 'afterResponsive', active); - - //when on page load, we will remove scrolloverflow if necessary - if(options.scrollOverflow){ - scrollBarHandler.createScrollBarForAll(); - } - } - } - else if(isResponsive){ - setAutoScrolling(originals.autoScrolling, 'internal'); - setFitToSection(originals.autoScrolling, 'internal'); - show($(SECTION_NAV_SEL)); - removeClass($body, RESPONSIVE); - if(isFunction( options.afterResponsive )){ - options.afterResponsive.call( container, active); - } - - if(options.responsiveSlides && FP.responsiveSlides){ - FP.responsiveSlides.toSlides(); - } - - trigger(container, 'afterResponsive', active); - } - } - - function getFullpageData(){ - return { - options: options, - internals: { - container: container, - canScroll: canScroll, - isScrollAllowed: isScrollAllowed, - getDestinationPosition: getDestinationPosition, - isTouch: isTouch, - c: checkActivationKey, - getXmovement: getXmovement, - removeAnimation: disableAnimation, - getTransforms: getTransforms, - lazyLoad: lazyLoad, - addAnimation: addAnimation, - performHorizontalMove: performHorizontalMove, - landscapeScroll: landscapeScroll, - silentLandscapeScroll: silentLandscapeScroll, - keepSlidesPosition: keepSlidesPosition, - silentScroll: silentScroll, - styleSlides: styleSlides, - scrollHandler: scrollHandler, - getEventsPage: getEventsPage, - getMSPointer:getMSPointer, - isReallyTouch: isReallyTouch, - usingExtension: usingExtension, - toggleControlArrows: toggleControlArrows, - touchStartHandler: touchStartHandler, - touchMoveHandler: touchMoveHandler - } - }; - } - - if(container){ - //public functions - FP.version = '3.0.2'; - FP.setAutoScrolling = setAutoScrolling; - FP.setRecordHistory = setRecordHistory; - FP.setScrollingSpeed = setScrollingSpeed; - FP.setFitToSection = setFitToSection; - FP.setLockAnchors = setLockAnchors; - FP.setMouseWheelScrolling = setMouseWheelScrolling; - FP.setAllowScrolling = setAllowScrolling; - FP.setKeyboardScrolling = setKeyboardScrolling; - FP.moveSectionUp = moveSectionUp; - FP.moveSectionDown = moveSectionDown; - FP.silentMoveTo = silentMoveTo; - FP.moveTo = moveTo; - FP.moveSlideRight = moveSlideRight; - FP.moveSlideLeft = moveSlideLeft; - FP.fitToSection = fitToSection; - FP.reBuild = reBuild; - FP.setResponsive = setResponsive; - FP.getFullpageData = getFullpageData; - FP.destroy = destroy; - FP.getActiveSection = getActiveSection; - FP.getActiveSlide = getActiveSlide; - FP.landscapeScroll = landscapeScroll; - - FP.test = { - top: '0px', - translate3d: 'translate3d(0px, 0px, 0px)', - translate3dH: (function(){ - var a = []; - for(var i = 0; i < $(options.sectionSelector, container).length; i++){ - a.push('translate3d(0px, 0px, 0px)'); - } - return a; - })(), - left: (function(){ - var a = []; - for(var i = 0; i < $(options.sectionSelector, container).length; i++){ - a.push(0); - } - return a; - })(), - options: options, - setAutoScrolling: setAutoScrolling - }; - - //functions we want to share across files but which are not - //mean to be used on their own by developers - FP.shared ={ - afterRenderActions: afterRenderActions - }; - - window.fullpage_api = FP; - - //Loading extensions - loadExtension('continuousHorizontal'); - loadExtension('scrollHorizontally'); - loadExtension('resetSliders'); - loadExtension('interlockedSlides'); - loadExtension('responsiveSlides'); - loadExtension('fadingEffect'); - loadExtension('dragAndMove'); - loadExtension('offsetSections'); - loadExtension('scrollOverflowReset'); - loadExtension('parallax'); - - if(usingExtension('dragAndMove')){ - FP.dragAndMove.init(); - } - - init(); - - bindEvents(); - - if(usingExtension('dragAndMove')){ - FP.dragAndMove.turnOffTouch(); - } - } - - function init(){ - //if css3 is not supported, it will use jQuery animations - if(options.css3){ - options.css3 = support3d(); - } - - options.scrollBar = options.scrollBar || options.hybrid; - - setOptionsFromDOM(); - prepareDom(); - setAllowScrolling(true); - setMouseHijack(true); - setAutoScrolling(options.autoScrolling, 'internal'); - responsive(); - - //setting the class for the body element - setBodyClass(); - - if(document.readyState === 'complete'){ - scrollToAnchor(); - } - window.addEventListener('load', scrollToAnchor); - } - - function bindEvents(){ - - //when scrolling... - window.addEventListener('scroll', scrollHandler); - - //detecting any change on the URL to scroll to the given anchor link - //(a way to detect back history button as we play with the hashes on the URL) - window.addEventListener('hashchange', hashChangeHandler); - - //when opening a new tab (ctrl + t), `control` won't be pressed when coming back. - window.addEventListener('blur', blurHandler); - - //when resizing the site, we adjust the heights of the sections, slimScroll... - window.addEventListener('resize', resizeHandler); - - //Sliding with arrow keys, both, vertical and horizontal - document.addEventListener('keydown', keydownHandler); - - //to prevent scrolling while zooming - document.addEventListener('keyup', keyUpHandler); - - //Scrolls to the section when clicking the navigation bullet - //simulating the jQuery .on('click') event using delegation - ['click', 'touchstart'].forEach(function(eventName){ - document.addEventListener(eventName, delegatedEvents); - }); - - /** - * Applying normalScroll elements. - * Ignoring the scrolls over the specified selectors. - */ - if(options.normalScrollElements){ - ['mouseenter', 'touchstart'].forEach(function(eventName){ - forMouseLeaveOrTOuch(eventName, false); - }); - - ['mouseleave', 'touchend'].forEach(function(eventName){ - forMouseLeaveOrTOuch(eventName, true); - }); - } - } - - function delegatedEvents(e){ - var target = e.target; - - if(target && closest(target, SECTION_NAV_SEL + ' a')){ - sectionBulletHandler.call(target, e); - } - else if(matches(target, SECTION_NAV_TOOLTIP_SEL)){ - tooltipTextHandler.call(target); - } - else if(matches(target, SLIDES_ARROW_SEL)){ - slideArrowHandler.call(target, e); - } - else if(matches(target, SLIDES_NAV_LINK_SEL) || closest(target, SLIDES_NAV_LINK_SEL) != null){ - slideBulletHandler.call(target, e); - } - } - - function forMouseLeaveOrTOuch(eventName, allowScrolling){ - //a way to pass arguments to the onMouseEnterOrLeave function - document['fp_' + eventName] = allowScrolling; - document.addEventListener(eventName, onMouseEnterOrLeave, true); //capturing phase - } - - function onMouseEnterOrLeave(e) { - if(e.target == document){ - return; - } - var normalSelectors = options.normalScrollElements.split(','); - normalSelectors.forEach(function(normalSelector){ - if(matches(e.target, normalSelector)){ - setMouseHijack(document['fp_' + e.type]); //e.type = eventName - } - }); - } - - /** - * Sets a public internal function based on the extension name. - * @param externalName {String} Extension name with the form fp_[NAME]Extension referring to an external function. - */ - function loadExtension(internalName){ - var externalName = 'fp_' + internalName + 'Extension'; - activationKey[internalName] = options[internalName + 'Key']; - - FP[internalName] = typeof window[externalName] !=='undefined' ? new window[externalName]() : null; - FP[internalName] && FP[internalName].c(internalName); - } - - /** - * Setting options from DOM elements if they are not provided. - */ - function setOptionsFromDOM(){ - - //no anchors option? Checking for them in the DOM attributes - if(!options.anchors.length){ - var attrName = '[data-anchor]'; - var anchors = $(options.sectionSelector.split(',').join(attrName + ',') + attrName, container); - if(anchors.length){ - anchors.forEach(function(item){ - options.anchors.push(item.getAttribute('data-anchor').toString()); - }); - } - } - - //no tooltips option? Checking for them in the DOM attributes - if(!options.navigationTooltips.length){ - var attrName = '[data-tooltip]'; - var tooltips = $(options.sectionSelector.split(',').join(attrName + ',') + attrName, container); - if(tooltips.length){ - tooltips.forEach(function(item){ - options.navigationTooltips.push(item.getAttribute('data-tooltip').toString()); - }); - } - } - } - - /** - * Works over the DOM structure to set it up for the current fullpage options. - */ - function prepareDom(){ - css(container, { - 'height': '100%', - 'position': 'relative' - }); - - //adding a class to recognize the container internally in the code - addClass(container, WRAPPER); - addClass($('html'), ENABLED); - - //due to https://github.com/alvarotrigo/fullPage.js/issues/1502 - windowsHeight = getWindowHeight(); - - removeClass(container, DESTROYED); //in case it was destroyed before initializing it again - - addInternalSelectors(); - extensionCall('parallax', 'init'); - - var sections = $(SECTION_SEL); - - //styling the sections / slides / menu - for(var i = 0; i 0) { - styleSlides(section, slides, numSlides); - }else{ - if(options.verticalCentered){ - addTableClass(section); - } - } - } - - //fixed elements need to be moved out of the plugin container due to problems with CSS3. - if(options.fixedElements && options.css3){ - $(options.fixedElements).forEach(function(item){ - $body.appendChild(item); - }); - } - - //vertical centered of the navigation + active bullet - if(options.navigation){ - addVerticalNavigation(); - } - - enableYoutubeAPI(); - - if(options.fadingEffect && FP.fadingEffect){ - FP.fadingEffect.apply(); - } - - if(options.scrollOverflow){ - scrollBarHandler = options.scrollOverflowHandler.init(options); - }else{ - afterRenderActions(); - } - } - - /** - * Styles the horizontal slides for a section. - */ - function styleSlides(section, slides, numSlides){ - var sliderWidth = numSlides * 100; - var slideWidth = 100 / numSlides; - - var slidesWrapper = document.createElement('div'); - slidesWrapper.className = SLIDES_WRAPPER; //fp-slides - wrapAll(slides, slidesWrapper); - - var slidesContainer = document.createElement('div'); - slidesContainer.className = SLIDES_CONTAINER; //fp-slidesContainer - wrapAll(slides, slidesContainer); - - css($(SLIDES_CONTAINER_SEL, section), {'width': sliderWidth + '%'}); - - if(numSlides > 1){ - if(options.controlArrows){ - createSlideArrows(section); - } - - if(options.slidesNavigation){ - addSlidesNavigation(section, numSlides); - } - } - - slides.forEach(function(slide) { - css(slide, {'width': slideWidth + '%'}); - - if(options.verticalCentered){ - addTableClass(slide); - } - }); - - var startingSlide = $(SLIDE_ACTIVE_SEL, section)[0]; - - //if the slide won't be an starting point, the default will be the first one - //the active section isn't the first one? Is not the first slide of the first section? Then we load that section/slide by default. - if( startingSlide != null && (index($(SECTION_ACTIVE_SEL), SECTION_SEL) !== 0 || (index($(SECTION_ACTIVE_SEL), SECTION_SEL) === 0 && index(startingSlide) !== 0))){ - silentLandscapeScroll(startingSlide, 'internal'); - addClass(startingSlide, INITIAL); - }else{ - addClass(slides[0], ACTIVE); - } - } - - function getWindowHeightOffset(element){ - return (options.offsetSections && FP.offsetSections) ? Math.round(FP.offsetSections.getWindowHeight(element)) : getWindowHeight(); - } - - /** - * Styling vertical sections - */ - function styleSection(section, index){ - //if no active section is defined, the 1st one will be the default one - if(!index && $(SECTION_ACTIVE_SEL)[0] == null) { - addClass(section, ACTIVE); - } - startingSection = $(SECTION_ACTIVE_SEL)[0]; - - css(section, {'height': getWindowHeightOffset(section) + 'px'}); - - if(options.paddingTop){ - css(section, {'padding-top': options.paddingTop}); - } - - if(options.paddingBottom){ - css(section, {'padding-bottom': options.paddingBottom}); - } - - if (typeof options.sectionsColor[index] !== 'undefined') { - css(section, {'background-color': options.sectionsColor[index]}); - } - - if (typeof options.anchors[index] !== 'undefined') { - section.setAttribute('data-anchor', options.anchors[index]); - } - } - - /** - * Sets the data-anchor attributes to the menu elements and activates the current one. - */ - function styleMenu(section, index){ - if (typeof options.anchors[index] !== 'undefined') { - //activating the menu / nav element on load - if(hasClass(section, ACTIVE)){ - activateMenuAndNav(options.anchors[index], index); - } - } - - //moving the menu outside the main container if it is inside (avoid problems with fixed positions when using CSS3 tranforms) - if(options.menu && options.css3 && closest($(options.menu)[0], WRAPPER_SEL) != null){ - $body.appendChild($(options.menu)[0]); - } - } - - /** - * Adds internal classes to be able to provide customizable selectors - * keeping the link with the style sheet. - */ - function addInternalSelectors(){ - addClass($(options.sectionSelector, container), SECTION); - addClass($(options.slideSelector, container), SLIDE); - } - - /** - * Creates the control arrows for the given section - */ - function createSlideArrows(section){ - var arrows = [createElementFromHTML('
        '), createElementFromHTML('
        ')]; - after($(SLIDES_WRAPPER_SEL, section)[0], arrows); - - if(options.controlArrowColor !== '#fff'){ - css($(SLIDES_ARROW_NEXT_SEL, section), {'border-color': 'transparent transparent transparent '+options.controlArrowColor}); - css($(SLIDES_ARROW_PREV_SEL, section), {'border-color': 'transparent '+ options.controlArrowColor + ' transparent transparent'}); - } - - if(!options.loopHorizontal){ - hide($(SLIDES_ARROW_PREV_SEL, section)); - } - } - - /** - * Creates a vertical navigation bar. - */ - function addVerticalNavigation(){ - var navigation = document.createElement('div'); - navigation.setAttribute('id', SECTION_NAV); - - var divUl = document.createElement('ul'); - navigation.appendChild(divUl); - - appendTo(navigation, $body); - var nav = $(SECTION_NAV_SEL)[0]; - - addClass(nav, 'fp-' + options.navigationPosition); - - if(options.showActiveTooltip){ - addClass(nav, SHOW_ACTIVE_TOOLTIP); - } - - var li = ''; - - for (var i = 0; i < $(SECTION_SEL).length; i++) { - var link = ''; - if (options.anchors.length) { - link = options.anchors[i]; - } - - li += '
      • ' + getBulletLinkName(i, 'Section') + ''; - - // Only add tooltip if needed (defined by user) - var tooltip = options.navigationTooltips[i]; - - if (typeof tooltip !== 'undefined' && tooltip !== '') { - li += '
        ' + tooltip + '
        '; - } - - li += '
      • '; - } - $('ul', nav)[0].innerHTML = li; - - //centering it vertically - css($(SECTION_NAV_SEL), {'margin-top': '-' + ($(SECTION_NAV_SEL)[0].offsetHeight/2) + 'px'}); - - //activating the current active section - - var bullet = $('li', $(SECTION_NAV_SEL)[0])[index($(SECTION_ACTIVE_SEL)[0], SECTION_SEL)]; - addClass($('a', bullet), ACTIVE); - } - - /** - * Gets the name for screen readers for a section/slide navigation bullet. - */ - function getBulletLinkName(i, defaultName){ - return options.navigationTooltips[i] - || options.anchors[i] - || defaultName + ' ' + (i+1) - } - - /* - * Enables the Youtube videos API so we can control their flow if necessary. - */ - function enableYoutubeAPI(){ - $('iframe[src*="youtube.com/embed/"]', container).forEach(function(item){ - addURLParam(item, 'enablejsapi=1'); - }); - } - - /** - * Adds a new parameter and its value to the `src` of a given element - */ - function addURLParam(element, newParam){ - var originalSrc = element.getAttribute('src'); - element.setAttribute('src', originalSrc + getUrlParamSign(originalSrc) + newParam); - } - - /* - * Returns the prefix sign to use for a new parameter in an existen URL. - * - * @return {String} ? | & - */ - function getUrlParamSign(url){ - return ( !/\?/.test( url ) ) ? '?' : '&'; - } - - /** - * Actions and callbacks to fire afterRender - */ - function afterRenderActions(){ - var section = $(SECTION_ACTIVE_SEL)[0]; - - addClass(section, COMPLETELY); - - lazyLoad(section); - playMedia(section); - - if(options.scrollOverflow){ - options.scrollOverflowHandler.afterLoad(); - } - - if(isDestinyTheStartingSection() && isFunction(options.afterLoad) ){ - fireCallback('afterLoad', { - activeSection: null, - element: section, - direction: null, - - //for backwards compatibility callback (to be removed in a future!) - anchorLink: section.getAttribute('data-anchor'), - sectionIndex: index(section, SECTION_SEL) - }); - } - - if(isFunction(options.afterRender)){ - fireCallback('afterRender'); - } - trigger(container, 'afterRender'); - } - - /** - * Determines if the URL anchor destiny is the starting section (the one using 'active' class before initialization) - */ - function isDestinyTheStartingSection(){ - var destinationSection = getSectionByAnchor(getAnchorsURL().section); - return !destinationSection || typeof destinationSection !=='undefined' && index(destinationSection) === index(startingSection); - } - - var isScrolling = false; - //var lastScroll = 0; not being used now - - //when scrolling... - function scrollHandler(){ - trigger(container, 'onScroll'); - var currentSection; - - if( (!options.autoScrolling || options.scrollBar || usingExtension('dragAndMove')) && !isDragging()){ - var currentScroll = usingExtension('dragAndMove') ? Math.abs(FP.dragAndMove.getCurrentScroll()) : getScrollTop(); - //var scrollDirection = getScrollDirection(currentScroll); - var visibleSectionIndex = 0; - var screen_mid = currentScroll + (getWindowHeight() / 2.0); - var documentHeight = usingExtension('dragAndMove') ? FP.dragAndMove.getDocumentHeight() : $body.offsetHeight - getWindowHeight(); - var isAtBottom = documentHeight === currentScroll; - var sections = $(SECTION_SEL); - - //when using `auto-height` for a small last section it won't be centered in the viewport - if(isAtBottom){ - visibleSectionIndex = sections.length - 1; - } - //is at top? when using `auto-height` for a small first section it won't be centered in the viewport - else if(!currentScroll){ - visibleSectionIndex = 0; - } - - //taking the section which is showing more content in the viewport - else{ - for (var i = 0; i < sections.length; ++i) { - var section = sections[i]; - - // Pick the the last section which passes the middle line of the screen. - if (section.offsetTop <= screen_mid) - { - visibleSectionIndex = i; - } - } - } - - /* - if(isCompletelyInViewPort(scrollDirection)){ - if(!hasClass($(SECTION_ACTIVE_SEL)[0], COMPLETELY)){ - addClass($(SECTION_ACTIVE_SEL)[0], COMPLETELY); - removeClass(siblings($(SECTION_ACTIVE_SEL)[0]), COMPLETELY); - } - } - */ - - //geting the last one, the current one on the screen - currentSection = sections[visibleSectionIndex]; - - //setting the visible section as active when manually scrolling - //executing only once the first time we reach the section - if(!hasClass(currentSection, ACTIVE)){ - isScrolling = true; - var leavingSection = $(SECTION_ACTIVE_SEL)[0]; - var leavingSectionIndex = index(leavingSection, SECTION_SEL) + 1; - var yMovement = getYmovement(currentSection); - var anchorLink = currentSection.getAttribute('data-anchor'); - var sectionIndex = index(currentSection, SECTION_SEL) + 1; - var activeSlide = $(SLIDE_ACTIVE_SEL, currentSection)[0]; - var slideIndex; - var slideAnchorLink; - var callbacksParams = { - activeSection: leavingSection, - sectionIndex: sectionIndex -1, - anchorLink: anchorLink, - element: currentSection, - leavingSection: leavingSectionIndex, - direction: yMovement - }; - - if(activeSlide){ - slideAnchorLink = activeSlide.getAttribute('data-anchor'); - slideIndex = index(activeSlide); - } - - if(canScroll){ - addClass(currentSection, ACTIVE); - removeClass(siblings(currentSection), ACTIVE); - - extensionCall('parallax', 'afterLoad'); - - if(isFunction( options.onLeave )){ - fireCallback('onLeave', callbacksParams); - } - if(isFunction( options.afterLoad )){ - fireCallback('afterLoad', callbacksParams); - } - - if(options.resetSliders && FP.resetSliders){ - FP.resetSliders.apply({localIsResizing: isResizing, leavingSection: leavingSectionIndex}); - } - - stopMedia(leavingSection); - lazyLoad(currentSection); - playMedia(currentSection); - - activateMenuAndNav(anchorLink, sectionIndex - 1); - - if(options.anchors.length){ - //needed to enter in hashChange event when using the menu with anchor links - lastScrolledDestiny = anchorLink; - } - setState(slideIndex, slideAnchorLink, anchorLink, sectionIndex); - } - - //small timeout in order to avoid entering in hashChange event when scrolling is not finished yet - clearTimeout(scrollId); - scrollId = setTimeout(function(){ - isScrolling = false; - }, 100); - } - - if(options.fitToSection){ - //for the auto adjust of the viewport to fit a whole section - clearTimeout(scrollId2); - - scrollId2 = setTimeout(function(){ - //checking it again in case it changed during the delay - if(options.fitToSection && - - //is the destination element bigger than the viewport? - $(SECTION_ACTIVE_SEL)[0].offsetHeight <= windowsHeight - ){ - fitToSection(); - } - }, options.fitToSectionDelay); - } - } - } - - /** - * Fits the site to the nearest active section - */ - function fitToSection(){ - //checking fitToSection again in case it was set to false before the timeout delay - if(canScroll){ - //allows to scroll to an active section and - //if the section is already active, we prevent firing callbacks - isResizing = true; - - scrollPage($(SECTION_ACTIVE_SEL)[0]); - isResizing = false; - } - } - - /** - * Determines whether the active section has seen in its whole or not. - - function isCompletelyInViewPort(movement){ - var top = $(SECTION_ACTIVE_SEL)[0].offsetTop; - var bottom = top + getWindowHeight(); - - if(movement == 'up'){ - return bottom >= (getScrollTop() + getWindowHeight()); - } - return top <= getScrollTop(); - } - */ - - /** - * Gets the directon of the the scrolling fired by the scroll event. - - function getScrollDirection(currentScroll){ - var direction = currentScroll > lastScroll ? 'down' : 'up'; - - lastScroll = currentScroll; - - //needed for auto-height sections to determine if we want to scroll to the top or bottom of the destination - previousDestTop = currentScroll; - - return direction; - } - */ - - /** - * Determines the way of scrolling up or down: - * by 'automatically' scrolling a section or by using the default and normal scrolling. - */ - function scrolling(type){ - if (!isScrollAllowed.m[type]){ - return; - } - var scrollSection = (type === 'down') ? moveSectionDown : moveSectionUp; - - if(FP.scrollHorizontally){ - scrollSection = FP.scrollHorizontally.getScrollSection(type, scrollSection); - } - - if(options.scrollOverflow){ - var scrollable = options.scrollOverflowHandler.scrollable($(SECTION_ACTIVE_SEL)[0]); - var check = (type === 'down') ? 'bottom' : 'top'; - - if(scrollable != null ){ - //is the scrollbar at the start/end of the scroll? - if(options.scrollOverflowHandler.isScrolled(check, scrollable)){ - scrollSection(); - }else{ - return true; - } - - }else{ - // moved up/down - scrollSection(); - } - }else{ - // moved up/down - scrollSection(); - } - } - - /* - * Preventing bouncing in iOS #2285 - */ - function preventBouncing(e){ - if(options.autoScrolling && isReallyTouch(e)){ - //preventing the easing on iOS devices - preventDefault(e); - } - } - - var touchStartY = 0; - var touchStartX = 0; - var touchEndY = 0; - var touchEndX = 0; - - /* Detecting touch events - - * As we are changing the top property of the page on scrolling, we can not use the traditional way to detect it. - * This way, the touchstart and the touch moves shows an small difference between them which is the - * used one to determine the direction. - */ - function touchMoveHandler(e){ - var activeSection = closest(e.target, SECTION_SEL); - - // additional: if one of the normalScrollElements isn't within options.normalScrollElementTouchThreshold hops up the DOM chain - if (isReallyTouch(e) ) { - - if(options.autoScrolling){ - //preventing the easing on iOS devices - preventDefault(e); - } - - var touchEvents = getEventsPage(e); - - touchEndY = touchEvents.y; - touchEndX = touchEvents.x; - - //if movement in the X axys is greater than in the Y and the currect section has slides... - if ($(SLIDES_WRAPPER_SEL, activeSection).length && Math.abs(touchStartX - touchEndX) > (Math.abs(touchStartY - touchEndY))) { - - //is the movement greater than the minimum resistance to scroll? - if (!slideMoving && Math.abs(touchStartX - touchEndX) > (window.innerWidth / 100 * options.touchSensitivity)) { - if (touchStartX > touchEndX) { - if(isScrollAllowed.m.right){ - moveSlideRight(activeSection); //next - } - } else { - if(isScrollAllowed.m.left){ - moveSlideLeft(activeSection); //prev - } - } - } - } - - //vertical scrolling (only when autoScrolling is enabled) - else if(options.autoScrolling && canScroll){ - - //is the movement greater than the minimum resistance to scroll? - if (Math.abs(touchStartY - touchEndY) > (window.innerHeight / 100 * options.touchSensitivity)) { - if (touchStartY > touchEndY) { - scrolling('down'); - } else if (touchEndY > touchStartY) { - scrolling('up'); - } - } - } - } - } - - /** - * As IE >= 10 fires both touch and mouse events when using a mouse in a touchscreen - * this way we make sure that is really a touch event what IE is detecting. - */ - function isReallyTouch(e){ - //if is not IE || IE is detecting `touch` or `pen` - return typeof e.pointerType === 'undefined' || e.pointerType != 'mouse'; - } - - /** - * Handler for the touch start event. - */ - function touchStartHandler(e){ - - //stopping the auto scroll to adjust to a section - if(options.fitToSection){ - activeAnimation = false; - } - - if(isReallyTouch(e)){ - var touchEvents = getEventsPage(e); - touchStartY = touchEvents.y; - touchStartX = touchEvents.x; - } - } - - /** - * Gets the average of the last `number` elements of the given array. - */ - function getAverage(elements, number){ - var sum = 0; - - //taking `number` elements from the end to make the average, if there are not enought, 1 - var lastElements = elements.slice(Math.max(elements.length - number, 1)); - - for(var i = 0; i < lastElements.length; i++){ - sum = sum + lastElements[i]; - } - - return Math.ceil(sum/number); - } - - /** - * Detecting mousewheel scrolling - * - * http://blogs.sitepointstatic.com/examples/tech/mouse-wheel/index.html - * http://www.sitepoint.com/html5-javascript-mouse-wheel/ - */ - var prevTime = new Date().getTime(); - - function MouseWheelHandler(e) { - var curTime = new Date().getTime(); - var isNormalScroll = hasClass($(COMPLETELY_SEL)[0], NORMAL_SCROLL); - - //is scroll allowed? - if (!isScrollAllowed.m.down && !isScrollAllowed.m.up) { - preventDefault(e); - return false; - } - - //autoscrolling and not zooming? - if(options.autoScrolling && !controlPressed && !isNormalScroll){ - // cross-browser wheel delta - e = e || window.event; - var value = e.wheelDelta || -e.deltaY || -e.detail; - var delta = Math.max(-1, Math.min(1, value)); - - var horizontalDetection = typeof e.wheelDeltaX !== 'undefined' || typeof e.deltaX !== 'undefined'; - var isScrollingVertically = (Math.abs(e.wheelDeltaX) < Math.abs(e.wheelDelta)) || (Math.abs(e.deltaX ) < Math.abs(e.deltaY) || !horizontalDetection); - - //Limiting the array to 150 (lets not waste memory!) - if(scrollings.length > 149){ - scrollings.shift(); - } - - //keeping record of the previous scrollings - scrollings.push(Math.abs(value)); - - //preventing to scroll the site on mouse wheel when scrollbar is present - if(options.scrollBar){ - preventDefault(e); - } - - //time difference between the last scroll and the current one - var timeDiff = curTime-prevTime; - prevTime = curTime; - - //haven't they scrolled in a while? - //(enough to be consider a different scrolling action to scroll another section) - if(timeDiff > 200){ - //emptying the array, we dont care about old scrollings for our averages - scrollings = []; - } - - if(canScroll && !isAnimatingDragging()){ - var averageEnd = getAverage(scrollings, 10); - var averageMiddle = getAverage(scrollings, 70); - var isAccelerating = averageEnd >= averageMiddle; - - //to avoid double swipes... - if(isAccelerating && isScrollingVertically){ - //scrolling down? - if (delta < 0) { - scrolling('down'); - - //scrolling up? - }else { - scrolling('up'); - } - } - } - - return false; - } - - if(options.fitToSection){ - //stopping the auto scroll to adjust to a section - activeAnimation = false; - } - } - - /** - * Slides a slider to the given direction. - * Optional `section` param. - */ - function moveSlide(direction, section){ - var activeSection = section == null ? $(SECTION_ACTIVE_SEL)[0] : section; - var slides = $(SLIDES_WRAPPER_SEL, activeSection)[0]; - - // more than one slide needed and nothing should be sliding - if (slides == null || isAnimatingDragging() || slideMoving || $(SLIDE_SEL, slides).length < 2) { - return; - } - - var currentSlide = $(SLIDE_ACTIVE_SEL, slides)[0]; - var destiny = null; - - if(direction === 'left'){ - destiny = prevUntil(currentSlide, SLIDE_SEL); - }else{ - destiny = nextUntil(currentSlide, SLIDE_SEL); - } - - //isn't there a next slide in the secuence? - if(destiny == null){ - //respect loopHorizontal settin - if (!options.loopHorizontal) return; - - var slideSiblings = siblings(currentSlide); - if(direction === 'left'){ - destiny = slideSiblings[slideSiblings.length - 1]; //last - }else{ - destiny = slideSiblings[0]; //first - } - } - - slideMoving = true && !FP.test.isTesting; - landscapeScroll(slides, destiny, direction); - } - - /** - * Maintains the active slides in the viewport - * (Because the `scroll` animation might get lost with some actions, such as when using continuousVertical) - */ - function keepSlidesPosition(){ - var activeSlides = $(SLIDE_ACTIVE_SEL); - for( var i =0; i previousDestTop; - var sectionBottom = position - windowsHeight + elementHeight; - var bigSectionsDestination = options.bigSectionsDestination; - - //is the destination element bigger than the viewport? - if(elementHeight > windowsHeight){ - //scrolling up? - if(!isScrollingDown && !bigSectionsDestination || bigSectionsDestination === 'bottom' ){ - position = sectionBottom; - } - } - - //sections equal or smaller than the viewport height && scrolling down? || is resizing and its in the last section - else if(isScrollingDown || (isResizing && next(element) == null) ){ - //The bottom of the destination will be at the bottom of the viewport - position = sectionBottom; - } - - if(options.offsetSections && FP.offsetSections){ - position = FP.offsetSections.getSectionPosition(isScrollingDown, position, element); - } - - /* - Keeping record of the last scrolled position to determine the scrolling direction. - No conventional methods can be used as the scroll bar might not be present - AND the section might not be active if it is auto-height and didnt reach the middle - of the viewport. - */ - previousDestTop = position; - return position; - } - - /** - * Scrolls the site to the given element and scrolls to the slide if a callback is given. - */ - function scrollPage(element, callback, isMovementUp){ - if(element == null){ return; } //there's no element to scroll, leaving the function - - var dtop = getDestinationPosition(element); - var slideAnchorLink; - var slideIndex; - - //local variables - var v = { - element: element, - callback: callback, - isMovementUp: isMovementUp, - dtop: dtop, - yMovement: getYmovement(element), - anchorLink: element.getAttribute('data-anchor'), - sectionIndex: index(element, SECTION_SEL), - activeSlide: $(SLIDE_ACTIVE_SEL, element)[0], - activeSection: $(SECTION_ACTIVE_SEL)[0], - leavingSection: index($(SECTION_ACTIVE_SEL), SECTION_SEL) + 1, - - //caching the value of isResizing at the momment the function is called - //because it will be checked later inside a setTimeout and the value might change - localIsResizing: isResizing - }; - - //quiting when destination scroll is the same as the current one - if((v.activeSection == element && !isResizing) || (options.scrollBar && getScrollTop() === v.dtop && !hasClass(element, AUTO_HEIGHT) )){ return; } - - if(v.activeSlide != null){ - slideAnchorLink = v.activeSlide.getAttribute('data-anchor'); - slideIndex = index(v.activeSlide); - } - - //callback (onLeave) if the site is not just resizing and readjusting the slides - if(isFunction(options.onLeave) && !v.localIsResizing){ - var direction = v.yMovement; - - //required for continousVertical - if(typeof isMovementUp !== 'undefined'){ - direction = isMovementUp ? 'up' : 'down'; - } - - //for the callback - v.direction = direction; - - if(fireCallback('onLeave', v) === false){ - return; - } - } - - extensionCall('parallax', 'apply', v); - - // If continuousVertical && we need to wrap around - if (options.autoScrolling && options.continuousVertical && typeof (v.isMovementUp) !== "undefined" && - ((!v.isMovementUp && v.yMovement == 'up') || // Intending to scroll down but about to go up or - (v.isMovementUp && v.yMovement == 'down'))) { // intending to scroll up but about to go down - - v = createInfiniteSections(v); - } - - if(usingExtension('scrollOverflowReset')){ - FP.scrollOverflowReset.setPrevious(v.activeSection); - } - - //pausing media of the leaving section (if we are not just resizing, as destinatino will be the same one) - if(!v.localIsResizing){ - stopMedia(v.activeSection); - } - - if(options.scrollOverflow){ - options.scrollOverflowHandler.beforeLeave(); - } - - addClass(element, ACTIVE); - removeClass(siblings(element), ACTIVE); - lazyLoad(element); - - if(options.scrollOverflow){ - options.scrollOverflowHandler.onLeave(); - } - - //preventing from activating the MouseWheelHandler event - //more than once if the page is scrolling - canScroll = false || FP.test.isTesting; - - setState(slideIndex, slideAnchorLink, v.anchorLink, v.sectionIndex); - - performMovement(v); - - //flag to avoid callingn `scrollPage()` twice in case of using anchor links - lastScrolledDestiny = v.anchorLink; - - activateMenuAndNav(v.anchorLink, getBulletIndex(v)); - } - - /** - /* When using continousVertical we won't get the right sectionIndex onLeave - * because sections positions are temporally in other position in the DOM - * This fixes https://github.com/alvarotrigo/fullPage.js/issues/2917 - */ - function getBulletIndex(v){ - //when using continousVertical the value of v.sectionIndex won't be the real one - //therefore we have to adjust it here to activate properly the navigation bullets - //when not using anchors - if(v.wrapAroundElements != null){ - return v.isMovementUp ? $(SECTION_SEL).length -1 : 0; - } - - //we can not change the value of v.sectionIndex at this point as it is used - //by extensions such as parallax - return v.sectionIndex; - } - - /** - * Dispatch events & callbacks making sure it does it on the right format, depending on - * whether v2compatible is being used or not. - */ - function fireCallback(eventName, v){ - var eventData = getEventData(eventName, v); - - if(!options.v2compatible){ - trigger(container, eventName, eventData); - - if(options[eventName].apply(eventData[Object.keys(eventData)[0]], toArray(eventData)) === false){ - return false; - } - } - else{ - if(options[eventName].apply(eventData[0], eventData.slice(1)) === false){ - return false; - } - } - - return true; - } - - /** - * Makes sure to only create a Panel object if the element exist - */ - function nullOrSection(el){ - return el ? new Section(el) : null; - } - - function nullOrSlide(el){ - return el ? new Slide(el) : null; - } - - /** - * Gets the event's data for the given event on the right format. Depending on whether - * v2compatible is being used or not. - */ - function getEventData(eventName, v){ - var paramsPerEvent; - - if(!options.v2compatible){ - - //using functions to run only the necessary bits within the object - paramsPerEvent = { - afterRender: function(){ - return { - section: nullOrSection($(SECTION_ACTIVE_SEL)[0]), - slide: nullOrSlide($(SLIDE_ACTIVE_SEL, $(SECTION_ACTIVE_SEL)[0])[0]) - }; - }, - onLeave: function(){ - return { - origin: nullOrSection(v.activeSection), - destination: nullOrSection(v.element), - direction: v.direction - }; - }, - - afterLoad: function(){ - return paramsPerEvent.onLeave(); - }, - - afterSlideLoad: function(){ - return { - section: nullOrSection(v.section), - origin: nullOrSlide(v.prevSlide), - destination: nullOrSlide(v.destiny), - direction: v.direction - }; - }, - - onSlideLeave: function(){ - return paramsPerEvent.afterSlideLoad(); - } - }; - } - else{ - paramsPerEvent = { - afterRender: function(){ return [container]; }, - onLeave: function(){ return [v.activeSection, v.leavingSection, (v.sectionIndex + 1), v.direction]; }, - afterLoad: function(){ return [v.element, v.anchorLink, (v.sectionIndex + 1)]; }, - afterSlideLoad: function(){ return [v.destiny, v.anchorLink, (v.sectionIndex + 1), v.slideAnchor, v.slideIndex]; }, - onSlideLeave: function(){ return [v.prevSlide, v.anchorLink, (v.sectionIndex + 1), v.prevSlideIndex, v.direction, v.slideIndex]; }, - }; - } - - return paramsPerEvent[eventName](); - } - - /** - * Performs the vertical movement (by CSS3 or by jQuery) - */ - function performMovement(v){ - // using CSS3 translate functionality - if (options.css3 && options.autoScrolling && !options.scrollBar) { - - // The first section can have a negative value in iOS 10. Not quite sure why: -0.0142822265625 - // that's why we round it to 0. - var translate3d = 'translate3d(0px, -' + Math.round(v.dtop) + 'px, 0px)'; - transformContainer(translate3d, true); - - //even when the scrollingSpeed is 0 there's a little delay, which might cause the - //scrollingSpeed to change in case of using silentMoveTo(); - if(options.scrollingSpeed){ - clearTimeout(afterSectionLoadsId); - afterSectionLoadsId = setTimeout(function () { - afterSectionLoads(v); - }, options.scrollingSpeed); - }else{ - afterSectionLoads(v); - } - } - - // using JS to animate - else{ - var scrollSettings = getScrollSettings(v.dtop); - FP.test.top = -v.dtop + 'px'; - - scrollTo(scrollSettings.element, scrollSettings.options, options.scrollingSpeed, function(){ - if(options.scrollBar){ - - /* Hack! - The timeout prevents setting the most dominant section in the viewport as "active" when the user - scrolled to a smaller section by using the mousewheel (auto scrolling) rather than draging the scroll bar. - - When using scrollBar:true It seems like the scroll events still getting propagated even after the scrolling animation has finished. - */ - setTimeout(function(){ - afterSectionLoads(v); - },30); - }else{ - afterSectionLoads(v); - } - }); - } - } - - /** - * Gets the scrolling settings depending on the plugin autoScrolling option - */ - function getScrollSettings(top){ - var scroll = {}; - - //top property animation - if(options.autoScrolling && !options.scrollBar){ - scroll.options = -top; - scroll.element = $(WRAPPER_SEL)[0]; - } - - //window real scrolling - else{ - scroll.options = top; - scroll.element = window; - } - - return scroll; - } - - /** - * Adds sections before or after the current one to create the infinite effect. - */ - function createInfiniteSections(v){ - // Scrolling down - if (!v.isMovementUp) { - // Move all previous sections to after the active section - after($(SECTION_ACTIVE_SEL)[0], prevAll(v.activeSection, SECTION_SEL).reverse()); - } - else { // Scrolling up - // Move all next sections to before the active section - before($(SECTION_ACTIVE_SEL)[0], nextAll(v.activeSection, SECTION_SEL)); - } - - // Maintain the displayed position (now that we changed the element order) - silentScroll($(SECTION_ACTIVE_SEL)[0].offsetTop); - - // Maintain the active slides visible in the viewport - keepSlidesPosition(); - - // save for later the elements that still need to be reordered - v.wrapAroundElements = v.activeSection; - - // Recalculate animation variables - v.dtop = v.element.offsetTop; - v.yMovement = getYmovement(v.element); - - //sections will temporally have another position in the DOM - //updating this values in case we need them, such as in parallax extension - v.leavingSection = index(v.activeSection, SECTION_SEL) + 1; - v.sectionIndex = index(v.element, SECTION_SEL); - - trigger($(WRAPPER_SEL)[0], 'onContinuousVertical', v); - - return v; - } - - /** - * Fix section order after continuousVertical changes have been animated - */ - function continuousVerticalFixSectionOrder (v) { - // If continuousVertical is in effect (and autoScrolling would also be in effect then), - // finish moving the elements around so the direct navigation will function more simply - if (v.wrapAroundElements == null) { - return; - } - - if (v.isMovementUp) { - before($(SECTION_SEL)[0], v.wrapAroundElements); - } - else { - after($(SECTION_SEL)[$(SECTION_SEL).length-1], v.wrapAroundElements); - } - - silentScroll($(SECTION_ACTIVE_SEL)[0].offsetTop); - - // Maintain the active slides visible in the viewport - keepSlidesPosition(); - - //recalculating the sections data after the changes - v.sectionIndex = index(v.element, SECTION_SEL); - v.leavingSection = index(v.activeSection, SECTION_SEL) + 1; - } - - - /** - * Actions to do once the section is loaded. - */ - function afterSectionLoads (v){ - continuousVerticalFixSectionOrder(v); - - //callback (afterLoad) if the site is not just resizing and readjusting the slides - if(isFunction(options.afterLoad) && !v.localIsResizing){ - fireCallback('afterLoad', v); - } - if(options.scrollOverflow){ - options.scrollOverflowHandler.afterLoad(); - } - - extensionCall('parallax', 'afterLoad'); - - if(usingExtension('scrollOverflowReset')){ - FP.scrollOverflowReset.reset(); - } - - if(usingExtension('resetSliders')){ - FP.resetSliders.apply(v); - } - - if(!v.localIsResizing){ - playMedia(v.element); - } - - addClass(v.element, COMPLETELY); - removeClass(siblings(v.element), COMPLETELY); - - canScroll = true; - - if(isFunction(v.callback)){ - v.callback(); - } - } - - /** - * Sets the value for the given attribute from the `data-` attribute with the same suffix - * ie: data-srcset ==> srcset | data-src ==> src - */ - function setSrc(element, attribute){ - element.setAttribute(attribute, element.getAttribute('data-' + attribute)); - element.removeAttribute('data-' + attribute); - } - - /** - * Lazy loads image, video and audio elements. - */ - function lazyLoad(destiny){ - if (!options.lazyLoading){ - return; - } - - var panel = getSlideOrSection(destiny); - - $('img[data-src], img[data-srcset], source[data-src], source[data-srcset], video[data-src], audio[data-src], iframe[data-src]', panel).forEach(function(element){ - ['src', 'srcset'].forEach(function(type){ - var attribute = element.getAttribute('data-' + type); - if(attribute != null && attribute){ - setSrc(element, type); - } - }); - - if(matches(element, 'source')){ - var elementToPlay = closest(element, 'video, audio'); - if(elementToPlay){ - elementToPlay.load(); - } - } - }); - } - - /** - * Plays video and audio elements. - */ - function playMedia(destiny){ - var panel = getSlideOrSection(destiny); - - //playing HTML5 media elements - $('video, audio', panel).forEach(function(element){ - if( element.hasAttribute('data-autoplay') && typeof element.play === 'function' ) { - element.play(); - } - }); - - //youtube videos - $('iframe[src*="youtube.com/embed/"]', panel).forEach(function(element){ - if ( element.hasAttribute('data-autoplay') ){ - playYoutube(element); - } - - //in case the URL was not loaded yet. On page load we need time for the new URL (with the API string) to load. - element.onload = function() { - if ( element.hasAttribute('data-autoplay') ){ - playYoutube(element); - } - }; - }); - } - - /** - * Plays a youtube video - */ - function playYoutube(element){ - element.contentWindow.postMessage('{"event":"command","func":"playVideo","args":""}', '*'); - } - - /** - * Stops video and audio elements. - */ - function stopMedia(destiny){ - var panel = getSlideOrSection(destiny); - - //stopping HTML5 media elements - $('video, audio', panel).forEach(function(element){ - if( !element.hasAttribute('data-keepplaying') && typeof element.pause === 'function' ) { - element.pause(); - } - }); - - //youtube videos - $('iframe[src*="youtube.com/embed/"]', panel).forEach(function(element){ - if( /youtube\.com\/embed\//.test(element.getAttribute('src')) && !element.hasAttribute('data-keepplaying')){ - element.contentWindow.postMessage('{"event":"command","func":"pauseVideo","args":""}','*'); - } - }); - } - - /** - * Gets the active slide (or section) for the given section - */ - function getSlideOrSection(destiny){ - var slide = $(SLIDE_ACTIVE_SEL, destiny); - if( slide.length ) { - destiny = slide[0]; - } - - return destiny; - } - - // Create Base64 Object - function decode(value){ - var _keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="; - - function decode(e) { - var t = ""; - var n, r, i; - var s, o, u, a; - var f = 0; - e = e.replace(/[^A-Za-z0-9+/=]/g, ""); - while (f < e.length) { - s = _keyStr.indexOf(e.charAt(f++)); - o = _keyStr.indexOf(e.charAt(f++)); - u = _keyStr.indexOf(e.charAt(f++)); - a = _keyStr.indexOf(e.charAt(f++)); - n = s << 2 | o >> 4; - r = (o & 15) << 4 | u >> 2; - i = (u & 3) << 6 | a; - t = t + String.fromCharCode(n); - if (u != 64) { - t = t + String.fromCharCode(r); - } - if (a != 64) { - t = t + String.fromCharCode(i); - } - } - t = _utf8_decode(t); - return t; - } - - function _utf8_decode(e) { - var t = ""; - var n = 0; - var r = 0; - var c1 = 0; - var c2 = 0; - var c3; - while (n < e.length) { - r = e.charCodeAt(n); - if (r < 128) { - t += String.fromCharCode(r); - n++; - } else if (r > 191 && r < 224) { - c2 = e.charCodeAt(n + 1); - t += String.fromCharCode((r & 31) << 6 | c2 & 63); - n += 2; - } else { - c2 = e.charCodeAt(n + 1); - c3 = e.charCodeAt(n + 2); - t += String.fromCharCode((r & 15) << 12 | (c2 & 63) << 6 | c3 & 63); - n += 3; - } - } - return t; - } - - function nada(a){ - return a; - } - - function removeAddedChars(text){ - return text.slice(3).slice(0,-3); - } - - function removeCrap(value){ - var extensionType = value.split('_'); - - if(extensionType.length > 1){ - var withoutDomain = extensionType[1]; - var domainWithAddedChars = value.replace(removeAddedChars(extensionType[1]), '').split('_')[0]; - var domainWithoutAddedChars = domainWithAddedChars; - return domainWithoutAddedChars + '_' + decode(withoutDomain.slice(3).slice(0,-3)); - } - - return removeAddedChars(value); - } - - return nada(removeCrap(decode(value))); - } - - //Gets the domain name from a URL without www - //http://stackoverflow.com/a/13367604/1081396 - function getDomain(){ - if(document.domain.length){ - var parts = document.domain.replace(/^(www\.)/,"").split('.'); - - //is there a subdomain? - while(parts.length > 2){ - var subdomain = parts.shift(); - } - var domain = parts.join('.'); - - return domain.replace(/(^\.*)|(\.*$)/g, ""); - } - return ''; - } - - function isValidActivationKey(extensionName){ - var domainName = getDomain(); - var _0x86bb = ['MTM0bG9jYWxob3N0MjM0','MTM0MC4xMjM0', 'MTM0anNoZWxsLm5ldDIzNA==', 'UDdDQU5ZNlNN']; - var localhost = decode(_0x86bb[0]); - var localIp = decode(_0x86bb[1]); - var jsfiddle = decode(_0x86bb[2]); - var unlimited = decode(_0x86bb[3]); - var isNotTest = [localhost, localIp, jsfiddle].indexOf(domainName) < 0 && domainName.length !== 0; - var isKeyDefined = (typeof activationKey[extensionName] !== 'undefined' && activationKey[extensionName].length); - - if( !isKeyDefined && isNotTest){ return false; } - - var decoded = isKeyDefined ? decode(activationKey[extensionName]) : ''; - - // [0] = domain [1] = extensionName - decoded = decoded.split('_'); - - var extensionMatches = decoded.length > 1 && decoded[1].indexOf(extensionName, decoded[1].length - extensionName.length) > -1; - var domainDoesntMatch = decoded[0].indexOf(domainName, decoded[0].length - domainName.length) < 0; - - return !(domainDoesntMatch && isNotTest && unlimited!=decoded[0]) && extensionMatches || !isNotTest; - } - - var bannerContent; - var objectElement; - var destroyedId; - - function onBannerChange(mutations){ - mutations.forEach(function(mutation) { - if(mutation.removedNodes[0] && mutation.removedNodes[0].isEqualNode(objectElement)){ - //in case they try to destory it... this will get fired with removed form the DOM - clearTimeout(destroyedId); - destroyedId = setTimeout(destroyed, 900); - } - }); - } - - function destroyed(){ - isUnlicensesBannerAdded = false; - } - - function checkActivationKey(extensionName){ - objectElement = document.createElement('div'); - bannerContent = decode('MTIzPGRpdj48YSBocmVmPSJodHRwOi8vYWx2YXJvdHJpZ28uY29tL2Z1bGxQYWdlL2V4dGVuc2lvbnMvIiBzdHlsZT0iY29sb3I6ICNmZmYgIWltcG9ydGFudDsgdGV4dC1kZWNvcmF0aW9uOm5vbmUgIWltcG9ydGFudDsiPlVubGljZW5zZWQgZnVsbFBhZ2UuanMgRXh0ZW5zaW9uPC9hPjwvZGl2PjEyMw=='); - objectElement.innerHTML = bannerContent; - objectElement = objectElement.firstChild; - - if ("MutationObserver" in window) { - var observer = new MutationObserver(onBannerChange); - observer.observe(document.body, { - childList:true, - subtree:false - }); - } - - //do nothing if not active or present - if(!usingExtension(extensionName) || !FP[extensionName]){ - return; - } - - if(!isValidActivationKey(extensionName)){ - addWarning(); - //https://jsfiddle.net/youxkay0/ - // - setInterval(addWarning, 2*1000); - } - } - - function addWarning(){ - if(!objectElement){return;} - - if(!isUnlicensesBannerAdded){ - if(Math.random() < 0.5){ - prependTo($body, objectElement); - }else{ - appendTo(objectElement, $body); - } - - isUnlicensesBannerAdded = true; - } - - objectElement.setAttribute('style', decode('MTIzei1pbmRleDo5OTk5OTk5O3Bvc2l0aW9uOmZpeGVkO3RvcDoyMHB4O2JvdHRvbTphdXRvO2xlZnQ6MjBweDtyaWdodDphdXRvO2JhY2tncm91bmQ6cmVkO3BhZGRpbmc6N3B4IDE1cHg7Zm9udC1zaXplOjE0cHg7Zm9udC1mYW1pbHk6YXJpYWw7Y29sb3I6I2ZmZjtkaXNwbGF5OmlubGluZS1ibG9jazt0cmFuc2Zvcm06dHJhbnNsYXRlM2QoMCwwLDApO29wYWNpdHk6MTtoZWlnaHQ6YXV0bzt3aWR0aDphdXRvO3pvb206MTttYXJnaW46YXV0bztib3JkZXI6bm9uZTt2aXNpYmlsaXR5OnZpc2libGU7Y2xpcC1wYXRoOm5vbmU7MTIz').replace(/;/g, decode('MTIzICFpbXBvcnRhbnQ7MzQ1'))); - - } - - /** - * Scrolls to the anchor in the URL when loading the site - */ - function scrollToAnchor(){ - var anchors = getAnchorsURL(); - var sectionAnchor = anchors.section; - var slideAnchor = anchors.slide; - - if(sectionAnchor){ //if theres any # - if(options.animateAnchor){ - scrollPageAndSlide(sectionAnchor, slideAnchor); - }else{ - silentMoveTo(sectionAnchor, slideAnchor); - } - } - } - - /** - * Detecting any change on the URL to scroll to the given anchor link - * (a way to detect back history button as we play with the hashes on the URL) - */ - function hashChangeHandler(){ - if(!isScrolling && !options.lockAnchors){ - var anchors = getAnchorsURL(); - var sectionAnchor = anchors.section; - var slideAnchor = anchors.slide; - - //when moving to a slide in the first section for the first time (first time to add an anchor to the URL) - var isFirstSlideMove = (typeof lastScrolledDestiny === 'undefined'); - var isFirstScrollMove = (typeof lastScrolledDestiny === 'undefined' && typeof slideAnchor === 'undefined' && !slideMoving); - - if(sectionAnchor && sectionAnchor.length){ - /*in order to call scrollpage() only once for each destination at a time - It is called twice for each scroll otherwise, as in case of using anchorlinks `hashChange` - event is fired on every scroll too.*/ - if ((sectionAnchor && sectionAnchor !== lastScrolledDestiny) && !isFirstSlideMove - || isFirstScrollMove - || (!slideMoving && lastScrolledSlide != slideAnchor )){ - - scrollPageAndSlide(sectionAnchor, slideAnchor); - } - } - } - } - - //gets the URL anchors (section and slide) - function getAnchorsURL(){ - var section; - var slide; - var hash = window.location.hash; - - if(hash.length){ - //getting the anchor link in the URL and deleting the `#` - var anchorsParts = hash.replace('#', '').split('/'); - - //using / for visual reasons and not as a section/slide separator #2803 - var isFunkyAnchor = hash.indexOf('#/') > -1; - - section = isFunkyAnchor ? '/' + anchorsParts[1] : decodeURIComponent(anchorsParts[0]); - - var slideAnchor = isFunkyAnchor ? anchorsParts[2] : anchorsParts[1]; - if(slideAnchor && slideAnchor.length){ - slide = decodeURIComponent(slideAnchor); - } - } - - return { - section: section, - slide: slide - }; - } - - //Sliding with arrow keys, both, vertical and horizontal - function keydownHandler(e) { - clearTimeout(keydownId); - - var activeElement = document.activeElement; - var keyCode = e.keyCode; - - //tab? - if(keyCode === 9){ - onTab(e); - } - - else if(!matches(activeElement, 'textarea') && !matches(activeElement, 'input') && !matches(activeElement, 'select') && - activeElement.getAttribute('contentEditable') !== "true" && activeElement.getAttribute('contentEditable') !== '' && - options.keyboardScrolling && options.autoScrolling){ - - //preventing the scroll with arrow keys & spacebar & Page Up & Down keys - var keyControls = [40, 38, 32, 33, 34]; - if(keyControls.indexOf(keyCode) > -1){ - preventDefault(e); - } - - controlPressed = e.ctrlKey; - - keydownId = setTimeout(function(){ - onkeydown(e); - },150); - } - } - - function tooltipTextHandler(){ - /*jshint validthis:true */ - trigger(prev(this), 'click'); - } - - //to prevent scrolling while zooming - function keyUpHandler(e){ - if(isWindowFocused){ //the keyup gets fired on new tab ctrl + t in Firefox - controlPressed = e.ctrlKey; - } - } - - //binding the mousemove when the mouse's middle button is released - function mouseDownHandler(e){ - //middle button - if (e.which == 2){ - oldPageY = e.pageY; - container.addEventListener('mousemove', mouseMoveHandler); - } - } - - //unbinding the mousemove when the mouse's middle button is released - function mouseUpHandler(e){ - //middle button - if (e.which == 2){ - container.removeEventListener('mousemove', mouseMoveHandler); - } - } - - /** - * Makes sure the tab key will only focus elements within the current section/slide - * preventing this way from breaking the page. - * Based on "Modals and keyboard traps" - * from https://developers.google.com/web/fundamentals/accessibility/focus/using-tabindex - */ - function onTab(e){ - var isShiftPressed = e.shiftKey; - var activeElement = document.activeElement; - var focusableElements = getFocusables(getSlideOrSection($(SECTION_ACTIVE_SEL)[0])); - - function preventAndFocusFirst(e){ - preventDefault(e); - return focusableElements[0] ? focusableElements[0].focus() : null; - } - - //outside any section or slide? Let's not hijack the tab! - if(isFocusOutside(e)){ - return; - } - - //is there an element with focus? - if(activeElement){ - if(closest(activeElement, SECTION_ACTIVE_SEL + ',' + SECTION_ACTIVE_SEL + ' ' + SLIDE_ACTIVE_SEL) == null){ - activeElement = preventAndFocusFirst(e); - } - } - - //no element if focused? Let's focus the first one of the section/slide - else{ - preventAndFocusFirst(e); - } - - //when reached the first or last focusable element of the section/slide - //we prevent the tab action to keep it in the last focusable element - if(!isShiftPressed && activeElement == focusableElements[focusableElements.length - 1] || - isShiftPressed && activeElement == focusableElements[0] - ){ - preventDefault(e); - } - } - - /** - * Gets all the focusable elements inside the passed element. - */ - function getFocusables(el){ - return [].slice.call($(focusableElementsString, el)).filter(function(item) { - return item.getAttribute('tabindex') !== '-1' - //are also not hidden elements (or with hidden parents) - && item.offsetParent !== null; - }); - } - - /** - * Determines whether the focus is outside fullpage.js sections/slides or not. - */ - function isFocusOutside(e){ - var allFocusables = getFocusables(document); - var currentFocusIndex = allFocusables.indexOf(document.activeElement); - var focusDestinationIndex = e.shiftKey ? currentFocusIndex - 1 : currentFocusIndex + 1; - var focusDestination = allFocusables[focusDestinationIndex]; - var destinationItemSlide = nullOrSlide(closest(focusDestination, SLIDE_SEL)); - var destinationItemSection = nullOrSection(closest(focusDestination, SECTION_SEL)); - - return !destinationItemSlide && !destinationItemSection; - } - - //Scrolling horizontally when clicking on the slider controls. - function slideArrowHandler(){ - /*jshint validthis:true */ - var section = closest(this, SECTION_SEL); - - /*jshint validthis:true */ - if (hasClass(this, SLIDES_PREV)) { - if(isScrollAllowed.m.left){ - moveSlideLeft(section); - } - } else { - if(isScrollAllowed.m.right){ - moveSlideRight(section); - } - } - } - - //when opening a new tab (ctrl + t), `control` won't be pressed when coming back. - function blurHandler(){ - isWindowFocused = false; - controlPressed = false; - } - - //Scrolls to the section when clicking the navigation bullet - function sectionBulletHandler(e){ - preventDefault(e); - - /*jshint validthis:true */ - var indexBullet = index(closest(this, SECTION_NAV_SEL + ' li')); - scrollPage($(SECTION_SEL)[indexBullet]); - } - - //Scrolls the slider to the given slide destination for the given section - function slideBulletHandler(e){ - preventDefault(e); - - /*jshint validthis:true */ - var slides = $(SLIDES_WRAPPER_SEL, closest(this, SECTION_SEL))[0]; - var destiny = $(SLIDE_SEL, slides)[index(closest(this, 'li'))]; - - landscapeScroll(slides, destiny); - } - - /** - * Keydown event - */ - function onkeydown(e){ - var shiftPressed = e.shiftKey; - - //do nothing if we can not scroll or we are not using horizotnal key arrows. - if(!canScroll && [37,39].indexOf(e.keyCode) < 0){ - return; - } - - switch (e.keyCode) { - //up - case 38: - case 33: - if(isScrollAllowed.k.up){ - moveSectionUp(); - } - break; - - //down - case 32: //spacebar - if(shiftPressed && isScrollAllowed.k.up){ - moveSectionUp(); - break; - } - /* falls through */ - case 40: - case 34: - if(isScrollAllowed.k.down){ - moveSectionDown(); - } - break; - - //Home - case 36: - if(isScrollAllowed.k.up){ - moveTo(1); - } - break; - - //End - case 35: - if(isScrollAllowed.k.down){ - moveTo( $(SECTION_SEL).length ); - } - break; - - //left - case 37: - if(isScrollAllowed.k.left){ - moveSlideLeft(); - } - break; - - //right - case 39: - if(isScrollAllowed.k.right){ - moveSlideRight(); - } - break; - - default: - return; // exit this handler for other keys - } - } - - /** - * Detecting the direction of the mouse movement. - * Used only for the middle button of the mouse. - */ - var oldPageY = 0; - function mouseMoveHandler(e){ - if(canScroll){ - // moving up - if (e.pageY < oldPageY && isScrollAllowed.m.up){ - moveSectionUp(); - } - - // moving down - else if(e.pageY > oldPageY && isScrollAllowed.m.down){ - moveSectionDown(); - } - } - oldPageY = e.pageY; - } - - /** - * Scrolls horizontal sliders. - */ - function landscapeScroll(slides, destiny, direction){ - var section = closest(slides, SECTION_SEL); - var v = { - slides: slides, - destiny: destiny, - direction: direction, - destinyPos: {left: destiny.offsetLeft}, - slideIndex: index(destiny), - section: section, - sectionIndex: index(section, SECTION_SEL), - anchorLink: section.getAttribute('data-anchor'), - slidesNav: $(SLIDES_NAV_SEL, section)[0], - slideAnchor: getAnchor(destiny), - prevSlide: $(SLIDE_ACTIVE_SEL, section)[0], - prevSlideIndex: index($(SLIDE_ACTIVE_SEL, section)[0]), - - //caching the value of isResizing at the momment the function is called - //because it will be checked later inside a setTimeout and the value might change - localIsResizing: isResizing - }; - v.xMovement = getXmovement(v.prevSlideIndex, v.slideIndex); - - //important!! Only do it when not resizing - if(!v.localIsResizing){ - //preventing from scrolling to the next/prev section when using scrollHorizontally - canScroll = false; - } - - //quiting when destination slide is the same as the current one - //if((v.prevSlide.is(v.destiny) && !v.localIsResizing)){ return; } - - extensionCall('parallax', 'applyHorizontal', v); - - if(options.onSlideLeave){ - - //if the site is not just resizing and readjusting the slides - if(!v.localIsResizing && v.xMovement!=='none'){ - if(isFunction( options.onSlideLeave )){ - if( fireCallback('onSlideLeave', v) === false){ - slideMoving = false; - return; - } - } - } - } - - addClass(destiny, ACTIVE); - removeClass(siblings(destiny), ACTIVE); - - if(!v.localIsResizing){ - stopMedia(v.prevSlide); - lazyLoad(destiny); - } - - toggleControlArrows(v); - - //only changing the URL if the slides are in the current section (not for resize re-adjusting) - if(hasClass(section, ACTIVE) && !v.localIsResizing){ - setState(v.slideIndex, v.slideAnchor, v.anchorLink, v.sectionIndex); - } - - if(FP.continuousHorizontal){ - FP.continuousHorizontal.apply(v); - } - - if(!isDragging()){ - performHorizontalMove(slides, v, true); - } - //we need to fire the callbacks and set canScroll again when using dragAndMove - else{ - afterSlideLoads(v); - } - - //duplicated call to FP.interlockedSlides.apply(v) here!! But necessary! At least this one! - //We have to call it here in order to call it at exactly the same time as we slide connected slides - //otherwise we will see the sliding animation in connected sections when scrolling down fast after sliding horizontally - //- Fixed bug with interlockedSlides and continuousHorizontal fullpageExtensions #130 - if(options.interlockedSlides && FP.interlockedSlides){ - //not using continuousHorizontal or using it but not about to apply it - if(!usingExtension('continuousHorizontal') || - typeof (direction) === "undefined" || direction === v.xMovement){ - FP.interlockedSlides.apply(v); - } - } - } - - function toggleControlArrows(v){ - if(!options.loopHorizontal && options.controlArrows){ - //hidding it for the fist slide, showing for the rest - toggle($(SLIDES_ARROW_PREV_SEL, v.section), v.slideIndex!==0); - - //hidding it for the last slide, showing for the rest - toggle($(SLIDES_ARROW_NEXT_SEL, v.section), next(v.destiny) != null); - } - } - - - function afterSlideLoads(v){ - if(FP.continuousHorizontal){ - FP.continuousHorizontal.afterSlideLoads(v); - } - activeSlidesNavigation(v.slidesNav, v.slideIndex); - - //if the site is not just resizing and readjusting the slides - if(!v.localIsResizing){ - extensionCall('parallax', 'afterSlideLoads'); - - if(isFunction( options.afterSlideLoad )){ - fireCallback('afterSlideLoad', v); - } - //needs to be inside the condition to prevent problems with continuousVertical and scrollHorizontally - //and to prevent double scroll right after a windows resize - canScroll = true; - - playMedia(v.destiny); - } - - //letting them slide again - slideMoving = false; - - if(usingExtension('interlockedSlides')){ - FP.interlockedSlides.apply(v); - } - } - - /** - * Performs the horizontal movement. (CSS3 or jQuery) - * - * @param fireCallback {Bool} - determines whether or not to fire the callback - */ - function performHorizontalMove(slides, v, fireCallback){ - var destinyPos = v.destinyPos; - - if(options.css3){ - var translate3d = 'translate3d(-' + Math.round(destinyPos.left) + 'px, 0px, 0px)'; - - FP.test.translate3dH[v.sectionIndex] = translate3d; - css(addAnimation($(SLIDES_CONTAINER_SEL, slides)), getTransforms(translate3d)); - - afterSlideLoadsId = setTimeout(function(){ - if(fireCallback){ - afterSlideLoads(v); - } - }, options.scrollingSpeed); - }else{ - FP.test.left[v.sectionIndex] = Math.round(destinyPos.left); - - scrollTo(slides, Math.round(destinyPos.left), options.scrollingSpeed, function(){ - if(fireCallback){ - afterSlideLoads(v); - } - }); - } - } - - /** - * Sets the state for the horizontal bullet navigations. - */ - function activeSlidesNavigation(slidesNav, slideIndex){ - if(options.slidesNavigation && slidesNav != null){ - removeClass($(ACTIVE_SEL, slidesNav), ACTIVE); - addClass( $('a', $('li', slidesNav)[slideIndex] ), ACTIVE); - } - } - - var previousHeight = windowsHeight; - - //when resizing the site, we adjust the heights of the sections, slimScroll... - function resizeHandler(){ - trigger(container, 'onResize'); - - //checking if it needs to get responsive - responsive(); - - // rebuild immediately on touch devices - if (isTouchDevice) { - var activeElement = document.activeElement; - - //if the keyboard is NOT visible - if (!matches(activeElement, 'textarea') && !matches(activeElement, 'input') && !matches(activeElement, 'select')) { - var currentHeight = getWindowHeight(); - - //making sure the change in the viewport size is enough to force a rebuild. (20 % of the window to avoid problems when hidding scroll bars) - if( Math.abs(currentHeight - previousHeight) > (20 * Math.max(previousHeight, currentHeight) / 100) ){ - reBuild(true); - previousHeight = currentHeight; - } - } - }else{ - //in order to call the functions only when the resize is finished - //http://stackoverflow.com/questions/4298612/jquery-how-to-call-resize-event-only-once-its-finished-resizing - clearTimeout(resizeId); - - resizeId = setTimeout(function(){ - reBuild(true); - }, 350); - } - } - - /** - * Checks if the site needs to get responsive and disables autoScrolling if so. - * A class `fp-responsive` is added to the plugin's container in case the user wants to use it for his own responsive CSS. - */ - function responsive(){ - var widthLimit = options.responsive || options.responsiveWidth; //backwards compatiblity - var heightLimit = options.responsiveHeight; - - //only calculating what we need. Remember its called on the resize event. - var isBreakingPointWidth = widthLimit && window.innerWidth < widthLimit; - var isBreakingPointHeight = heightLimit && window.innerHeight < heightLimit; - - if(widthLimit && heightLimit){ - setResponsive(isBreakingPointWidth || isBreakingPointHeight); - } - else if(widthLimit){ - setResponsive(isBreakingPointWidth); - } - else if(heightLimit){ - setResponsive(isBreakingPointHeight); - } - } - - /** - * Adds transition animations for the given element - */ - function addAnimation(element){ - var transition = 'all ' + options.scrollingSpeed + 'ms ' + options.easingcss3; - - removeClass(element, NO_TRANSITION); - return css(element, { - '-webkit-transition': transition, - 'transition': transition - }); - } - - /** - * Remove transition animations for the given element - */ - function disableAnimation(element){ - return addClass(element, NO_TRANSITION); - } - - /** - * Activating the vertical navigation bullets according to the given slide name. - */ - function activateNavDots(name, sectionIndex){ - if(options.navigation && $(SECTION_NAV_SEL)[0] != null){ - removeClass($(ACTIVE_SEL, $(SECTION_NAV_SEL)[0]), ACTIVE); - if(name){ - addClass( $('a[href="#' + name + '"]', $(SECTION_NAV_SEL)[0]), ACTIVE); - }else{ - addClass($('a', $('li', $(SECTION_NAV_SEL)[0])[sectionIndex]), ACTIVE); - } - } - } - - /** - * Activating the website main menu elements according to the given slide name. - */ - function activateMenuElement(name){ - var menu = $(options.menu)[0]; - if(options.menu && menu != null){ - removeClass($(ACTIVE_SEL, menu), ACTIVE); - addClass($('[data-menuanchor="'+name+'"]', menu), ACTIVE); - } - } - - /** - * Sets to active the current menu and vertical nav items. - */ - function activateMenuAndNav(anchor, index){ - activateMenuElement(anchor); - activateNavDots(anchor, index); - } - - /** - * Retuns `up` or `down` depending on the scrolling movement to reach its destination - * from the current section. - */ - function getYmovement(destiny){ - var fromIndex = index($(SECTION_ACTIVE_SEL)[0], SECTION_SEL); - var toIndex = index(destiny, SECTION_SEL); - if( fromIndex == toIndex){ - return 'none'; - } - if(fromIndex > toIndex){ - return 'up'; - } - return 'down'; - } - - /** - * Retuns `right` or `left` depending on the scrolling movement to reach its destination - * from the current slide. - */ - function getXmovement(fromIndex, toIndex){ - if( fromIndex == toIndex){ - return 'none'; - } - if(fromIndex > toIndex){ - return 'left'; - } - return 'right'; - } - - function addTableClass(element){ - //In case we are styling for the 2nd time as in with reponsiveSlides - if(!hasClass(element, TABLE)){ - var wrapper = document.createElement('div'); - wrapper.className = TABLE_CELL; - wrapper.style.height = getTableHeight(element) + 'px'; - - addClass(element, TABLE); - wrapInner(element, wrapper); - } - } - - function getTableHeight(element){ - var sectionHeight = getWindowHeightOffset(element); - - if(options.paddingTop || options.paddingBottom){ - var section = element; - if(!hasClass(section, SECTION)){ - section = closest(element, SECTION_SEL); - } - - var paddings = parseInt(getComputedStyle(section)['padding-top']) + parseInt(getComputedStyle(section)['padding-bottom']); - sectionHeight = (sectionHeight - paddings); - } - - return sectionHeight; - } - - /** - * Adds a css3 transform property to the container class with or without animation depending on the animated param. - */ - function transformContainer(translate3d, animated){ - if(animated){ - addAnimation(container); - }else{ - disableAnimation(container); - } - - clearTimeout(silentScrollId); - css(container, getTransforms(translate3d)); - FP.test.translate3d = translate3d; - - //syncronously removing the class after the animation has been applied. - silentScrollId = setTimeout(function(){ - removeClass(container, NO_TRANSITION); - },10); - } - - /** - * Gets a section by its anchor / index - */ - function getSectionByAnchor(sectionAnchor){ - var section = $(SECTION_SEL + '[data-anchor="'+sectionAnchor+'"]', container)[0]; - if(!section){ - var sectionIndex = typeof sectionAnchor !== 'undefined' ? sectionAnchor -1 : 0; - section = $(SECTION_SEL)[sectionIndex]; - } - - return section; - } - - /** - * Gets a slide inside a given section by its anchor / index - */ - function getSlideByAnchor(slideAnchor, section){ - var slide = $(SLIDE_SEL + '[data-anchor="'+slideAnchor+'"]', section)[0]; - if(slide == null){ - slideAnchor = typeof slideAnchor !== 'undefined' ? slideAnchor : 0; - slide = $(SLIDE_SEL, section)[slideAnchor]; - } - - return slide; - } - - /** - * Scrolls to the given section and slide anchors - */ - function scrollPageAndSlide(sectionAnchor, slideAnchor){ - var section = getSectionByAnchor(sectionAnchor); - - //do nothing if there's no section with the given anchor name - if(section == null) return; - - var slide = getSlideByAnchor(slideAnchor, section); - - //we need to scroll to the section and then to the slide - if (getAnchor(section) !== lastScrolledDestiny && !hasClass(section, ACTIVE)){ - scrollPage(section, function(){ - scrollSlider(slide); - }); - } - //if we were already in the section - else{ - scrollSlider(slide); - } - } - - /** - * Scrolls the slider to the given slide destination for the given section - */ - function scrollSlider(slide){ - if(slide != null){ - landscapeScroll(closest(slide, SLIDES_WRAPPER_SEL), slide); - } - } - - /** - * Creates a landscape navigation bar with dots for horizontal sliders. - */ - function addSlidesNavigation(section, numSlides){ - appendTo(createElementFromHTML('
          '), section); - var nav = $(SLIDES_NAV_SEL, section)[0]; - - //top or bottom - addClass(nav, 'fp-' + options.slidesNavPosition); - - for(var i=0; i< numSlides; i++){ - appendTo(createElementFromHTML('
        • '+ getBulletLinkName(i, 'Slide') +'
        • '), $('ul', nav)[0] ); - } - - //centering it - css(nav, {'margin-left': '-' + (nav.innerWidth/2) + 'px'}); - - addClass($('a', $('li', nav)[0] ), ACTIVE); - } - - - /** - * Sets the state of the website depending on the active section/slide. - * It changes the URL hash when needed and updates the body class. - */ - function setState(slideIndex, slideAnchor, anchorLink, sectionIndex){ - var sectionHash = ''; - - if(options.anchors.length && !options.lockAnchors){ - - //isn't it the first slide? - if(slideIndex){ - if(anchorLink != null){ - sectionHash = anchorLink; - } - - //slide without anchor link? We take the index instead. - if(slideAnchor == null){ - slideAnchor = slideIndex; - } - - lastScrolledSlide = slideAnchor; - setUrlHash(sectionHash + '/' + slideAnchor); - - //first slide won't have slide anchor, just the section one - }else if(slideIndex != null){ - lastScrolledSlide = slideAnchor; - setUrlHash(anchorLink); - } - - //section without slides - else{ - setUrlHash(anchorLink); - } - } - - setBodyClass(); - } - - /** - * Sets the URL hash. - */ - function setUrlHash(url){ - if(options.recordHistory){ - location.hash = url; - }else{ - //Mobile Chrome doesn't work the normal way, so... lets use HTML5 for phones :) - if(isTouchDevice || isTouch){ - window.history.replaceState(undefined, undefined, '#' + url); - }else{ - var baseUrl = window.location.href.split('#')[0]; - window.location.replace( baseUrl + '#' + url ); - } - } - } - - /** - * Gets the anchor for the given slide / section. Its index will be used if there's none. - */ - function getAnchor(element){ - if(!element){ - return null; - } - var anchor = element.getAttribute('data-anchor'); - var elementIndex = index(element); - - //Slide without anchor link? We take the index instead. - if(anchor == null){ - anchor = elementIndex; - } - - return anchor; - } - - /** - * Sets a class for the body of the page depending on the active section / slide - */ - function setBodyClass(){ - var section = $(SECTION_ACTIVE_SEL)[0]; - var slide = $(SLIDE_ACTIVE_SEL, section)[0]; - - var sectionAnchor = getAnchor(section); - var slideAnchor = getAnchor(slide); - - var text = String(sectionAnchor); - - if(slide){ - text = text + '-' + slideAnchor; - } - - //changing slash for dash to make it a valid CSS style - text = text.replace('/', '-').replace('#',''); - - //removing previous anchor classes - var classRe = new RegExp('\\b\\s?' + VIEWING_PREFIX + '-[^\\s]+\\b', "g"); - $body.className = $body.className.replace(classRe, ''); - - //adding the current anchor - addClass($body, VIEWING_PREFIX + '-' + text); - } - - /** - * Checks for translate3d support - * @return boolean - * http://stackoverflow.com/questions/5661671/detecting-transform-translate3d-support - */ - function support3d() { - var el = document.createElement('p'), - has3d, - transforms = { - 'webkitTransform':'-webkit-transform', - 'OTransform':'-o-transform', - 'msTransform':'-ms-transform', - 'MozTransform':'-moz-transform', - 'transform':'transform' - }; - - //preventing the style p:empty{display: none;} from returning the wrong result - el.style.display = 'block' - - // Add it to the body to get the computed style. - document.body.insertBefore(el, null); - - for (var t in transforms) { - if (el.style[t] !== undefined) { - el.style[t] = 'translate3d(1px,1px,1px)'; - has3d = window.getComputedStyle(el).getPropertyValue(transforms[t]); - } - } - - document.body.removeChild(el); - - return (has3d !== undefined && has3d.length > 0 && has3d !== 'none'); - } - - /** - * Removes the auto scrolling action fired by the mouse wheel and trackpad. - * After this function is called, the mousewheel and trackpad movements won't scroll through sections. - */ - function removeMouseWheelHandler(){ - if (document.addEventListener) { - document.removeEventListener('mousewheel', MouseWheelHandler, false); //IE9, Chrome, Safari, Oper - document.removeEventListener('wheel', MouseWheelHandler, false); //Firefox - document.removeEventListener('MozMousePixelScroll', MouseWheelHandler, false); //old Firefox - } else { - document.detachEvent('onmousewheel', MouseWheelHandler); //IE 6/7/8 - } - } - - /** - * Adds the auto scrolling action for the mouse wheel and trackpad. - * After this function is called, the mousewheel and trackpad movements will scroll through sections - * https://developer.mozilla.org/en-US/docs/Web/Events/wheel - */ - function addMouseWheelHandler(){ - var prefix = ''; - var _addEventListener; - - if (window.addEventListener){ - _addEventListener = "addEventListener"; - }else{ - _addEventListener = "attachEvent"; - prefix = 'on'; - } - - // detect available wheel event - var support = 'onwheel' in document.createElement('div') ? 'wheel' : // Modern browsers support "wheel" - document.onmousewheel !== undefined ? 'mousewheel' : // Webkit and IE support at least "mousewheel" - 'DOMMouseScroll'; // let's assume that remaining browsers are older Firefox - - - if(support == 'DOMMouseScroll'){ - document[ _addEventListener ](prefix + 'MozMousePixelScroll', MouseWheelHandler, false); - } - - //handle MozMousePixelScroll in older Firefox - else{ - document[ _addEventListener ](prefix + support, MouseWheelHandler, false); - } - } - - /** - * Binding the mousemove when the mouse's middle button is pressed - */ - function addMiddleWheelHandler(){ - container.addEventListener('mousedown', mouseDownHandler); - container.addEventListener('mouseup', mouseUpHandler); - } - - /** - * Unbinding the mousemove when the mouse's middle button is released - */ - function removeMiddleWheelHandler(){ - container.removeEventListener('mousedown', mouseDownHandler); - container.removeEventListener('mouseup', mouseUpHandler); - } - - /** - * Adds the possibility to auto scroll through sections on touch devices. - */ - function addTouchHandler(){ - if(isTouchDevice || isTouch){ - if(options.autoScrolling){ - $body.removeEventListener(events.touchmove, preventBouncing, {passive: false}); - $body.addEventListener(events.touchmove, preventBouncing, {passive: false}); - } - - if($(WRAPPER_SEL).length > 0){ - $(WRAPPER_SEL)[0].removeEventListener(events.touchstart, touchStartHandler); - $(WRAPPER_SEL)[0].removeEventListener(events.touchmove, touchMoveHandler, {passive: false}); - - $(WRAPPER_SEL)[0].addEventListener(events.touchstart, touchStartHandler); - $(WRAPPER_SEL)[0].addEventListener(events.touchmove, touchMoveHandler, {passive: false}); - } - } - } - - /** - * Removes the auto scrolling for touch devices. - */ - function removeTouchHandler(){ - if(isTouchDevice || isTouch){ - // normalScrollElements requires it off #2691 - if(options.autoScrolling){ - $body.removeEventListener(events.touchmove, touchMoveHandler, {passive: false}); - $body.removeEventListener(events.touchmove, preventBouncing, {passive: false}); - } - - if($(WRAPPER_SEL).length > 0){ - $(WRAPPER_SEL)[0].removeEventListener(events.touchstart, touchStartHandler); - $(WRAPPER_SEL)[0].removeEventListener(events.touchmove, touchMoveHandler, {passive: false}); - } - } - } - - /* - * Returns and object with Microsoft pointers (for IE<11 and for IE >= 11) - * http://msdn.microsoft.com/en-us/library/ie/dn304886(v=vs.85).aspx - */ - function getMSPointer(){ - var pointer; - - //IE >= 11 & rest of browsers - if(window.PointerEvent){ - pointer = { down: 'pointerdown', move: 'pointermove'}; - } - - //IE < 11 - else{ - pointer = { down: 'MSPointerDown', move: 'MSPointerMove'}; - } - - return pointer; - } - - /** - * Gets the pageX and pageY properties depending on the browser. - * https://github.com/alvarotrigo/fullPage.js/issues/194#issuecomment-34069854 - */ - function getEventsPage(e){ - var events = []; - - events.y = (typeof e.pageY !== 'undefined' && (e.pageY || e.pageX) ? e.pageY : e.touches[0].pageY); - events.x = (typeof e.pageX !== 'undefined' && (e.pageY || e.pageX) ? e.pageX : e.touches[0].pageX); - - //in touch devices with scrollBar:true, e.pageY is detected, but we have to deal with touch events. #1008 - if(isTouch && isReallyTouch(e) && options.scrollBar && typeof e.touches !== 'undefined'){ - events.y = e.touches[0].pageY; - events.x = e.touches[0].pageX; - } - - return events; - } - - /** - * Slides silently (with no animation) the active slider to the given slide. - * @param noCallback {bool} true or defined -> no callbacks - */ - function silentLandscapeScroll(activeSlide, noCallbacks){ - setScrollingSpeed (0, 'internal'); - - if(typeof noCallbacks !== 'undefined'){ - //preventing firing callbacks afterSlideLoad etc. - isResizing = true; - } - - landscapeScroll(closest(activeSlide, SLIDES_WRAPPER_SEL), activeSlide); - - if(typeof noCallbacks !== 'undefined'){ - isResizing = false; - } - - setScrollingSpeed(originals.scrollingSpeed, 'internal'); - } - - /** - * Scrolls silently (with no animation) the page to the given Y position. - */ - function silentScroll(top){ - // The first section can have a negative value in iOS 10. Not quite sure why: -0.0142822265625 - // that's why we round it to 0. - var roundedTop = Math.round(top); - - if (options.css3 && options.autoScrolling && !options.scrollBar){ - var translate3d = 'translate3d(0px, -' + roundedTop + 'px, 0px)'; - transformContainer(translate3d, false); - } - else if(options.autoScrolling && !options.scrollBar){ - css(container, {'top': -roundedTop + 'px'}); - FP.test.top = -roundedTop + 'px'; - } - else{ - var scrollSettings = getScrollSettings(roundedTop); - setScrolling(scrollSettings.element, scrollSettings.options); - } - } - - /** - * Returns the cross-browser transform string. - */ - function getTransforms(translate3d){ - return { - '-webkit-transform': translate3d, - '-moz-transform': translate3d, - '-ms-transform':translate3d, - 'transform': translate3d - }; - } - - /** - * Allowing or disallowing the mouse/swipe scroll in a given direction. (not for keyboard) - * @type m (mouse) or k (keyboard) - */ - function setIsScrollAllowed(value, direction, type){ - //up, down, left, right - if(direction !== 'all'){ - isScrollAllowed[type][direction] = value; - } - - //all directions? - else{ - Object.keys(isScrollAllowed[type]).forEach(function(key){ - isScrollAllowed[type][key] = value; - }); - } - } - - /* - * Destroys fullpage.js plugin events and optinally its html markup and styles - */ - function destroy(all){ - trigger(container, 'destroy', all); - - setAutoScrolling(false, 'internal'); - setAllowScrolling(true); - setMouseHijack(false); - setKeyboardScrolling(false); - addClass(container, DESTROYED); - - clearTimeout(afterSlideLoadsId); - clearTimeout(afterSectionLoadsId); - clearTimeout(resizeId); - clearTimeout(scrollId); - clearTimeout(scrollId2); - - window.removeEventListener('scroll', scrollHandler); - window.removeEventListener('hashchange', hashChangeHandler); - window.removeEventListener('resize', resizeHandler); - - document.removeEventListener('keydown', keydownHandler); - document.removeEventListener('keyup', keyUpHandler); - - ['click', 'touchstart'].forEach(function(eventName){ - document.removeEventListener(eventName, delegatedEvents); - }); - - ['mouseenter', 'touchstart', 'mouseleave', 'touchend'].forEach(function(eventName){ - document.removeEventListener(eventName, onMouseEnterOrLeave, true); //true is required! - }); - - if(usingExtension('dragAndMove')){ - FP.dragAndMove.destroy(); - } - - clearTimeout(afterSlideLoadsId); - clearTimeout(afterSectionLoadsId); - - //lets make a mess! - if(all){ - destroyStructure(); - } - } - - /* - * Removes inline styles added by fullpage.js - */ - function destroyStructure(){ - //reseting the `top` or `translate` properties to 0 - silentScroll(0); - - //loading all the lazy load content - $('img[data-src], source[data-src], audio[data-src], iframe[data-src]', container).forEach(function(item){ - setSrc(item, 'src'); - }); - - $('img[data-srcset]').forEach(function(item){ - setSrc(item, 'srcset'); - }); - - remove($(SECTION_NAV_SEL + ', ' + SLIDES_NAV_SEL + ', ' + SLIDES_ARROW_SEL)); - - //removing inline styles - css($(SECTION_SEL), { - 'height': '', - 'background-color' : '', - 'padding': '' - }); - - css($(SLIDE_SEL), { - 'width': '' - }); - - css(container, { - 'height': '', - 'position': '', - '-ms-touch-action': '', - 'touch-action': '' - }); - - css($htmlBody, { - 'overflow': '', - 'height': '' - }); - - // remove .fp-enabled class - removeClass($('html'), ENABLED); - - // remove .fp-responsive class - removeClass($body, RESPONSIVE); - - // remove all of the .fp-viewing- classes - $body.className.split(/\s+/).forEach(function (className) { - if (className.indexOf(VIEWING_PREFIX) === 0) { - removeClass($body, className); - } - }); - - //removing added classes - $(SECTION_SEL + ', ' + SLIDE_SEL).forEach(function(item){ - if(options.scrollOverflowHandler){ - options.scrollOverflowHandler.remove(item); - } - removeClass(item, TABLE + ' ' + ACTIVE + ' ' + COMPLETELY); - var previousStyles = item.getAttribute('data-fp-styles'); - if(previousStyles){ - item.setAttribute('style', item.getAttribute('data-fp-styles')); - } - }); - - //removing the applied transition from the fullpage wrapper - removeAnimation(container); - - //Unwrapping content - [TABLE_CELL_SEL, SLIDES_CONTAINER_SEL,SLIDES_WRAPPER_SEL].forEach(function(selector){ - $(selector, container).forEach(function(item){ - //unwrap not being use in case there's no child element inside and its just text - unwrap(item); - }); - }); - - //scrolling the page to the top with no animation - //scrolling the page to the top with no animation - window.scrollTo(0, 0); - - //removing selectors - var usedSelectors = [SECTION, SLIDE, SLIDES_CONTAINER]; - usedSelectors.forEach(function(item){ - removeClass($('.' + item), item); - }); - } - - function removeAnimation(element){ - return css(element, { - '-webkit-transition': 'none', - 'transition': 'none' - }); - } - - function usingExtension(name){ - //is an array? - if(options[name] !== null && Object.prototype.toString.call( options[name] ) === '[object Array]'){ - return options[name].length && FP[name]; - } - return options[name] && FP[name]; - } - - function extensionCall(extensionName, method, params){ - if(usingExtension(extensionName)){ - return FP[extensionName][method](params); - } - } - - /** - * DragAndMove Extension - */ - function isAnimatingDragging(){ - return ( usingExtension('dragAndMove') && FP.dragAndMove.isAnimating); - } - - function isDragging(){ - return (usingExtension('dragAndMove') && FP.dragAndMove.isGrabbing); - } - - /* - * Sets the state for a variable with multiple states (original, and temporal) - * Some variables such as `autoScrolling` or `recordHistory` might change automatically its state when using `responsive` or `autoScrolling:false`. - * This function is used to keep track of both states, the original and the temporal one. - * If type is not 'internal', then we assume the user is globally changing the variable. - */ - function setVariableState(variable, value, type){ - options[variable] = value; - if(type !== 'internal'){ - originals[variable] = value; - } - } - - /** - * Displays warnings - */ - function displayWarnings(){ - if(!isLicenseValid){ - showError('error', 'Fullpage.js version 3 has changed its license to GPLv3 and it requires a `licenseKey` option. Read about it here:'); - showError('error', 'https://github.com/alvarotrigo/fullPage.js#options.'); - } - - if(hasClass($('html'), ENABLED)){ - showError('error', 'Fullpage.js can only be initialized once and you are doing it multiple times!'); - return; - } - - // Disable mutually exclusive settings - if (options.continuousVertical && - (options.loopTop || options.loopBottom)) { - options.continuousVertical = false; - showError('warn', 'Option `loopTop/loopBottom` is mutually exclusive with `continuousVertical`; `continuousVertical` disabled'); - } - - if(options.scrollOverflow && - (options.scrollBar || !options.autoScrolling)){ - showError('warn', 'Options scrollBar:true and autoScrolling:false are mutually exclusive with scrollOverflow:true. Sections with scrollOverflow might not work well in Firefox'); - } - - if(options.continuousVertical && (options.scrollBar || !options.autoScrolling)){ - options.continuousVertical = false; - showError('warn', 'Scroll bars (`scrollBar:true` or `autoScrolling:false`) are mutually exclusive with `continuousVertical`; `continuousVertical` disabled'); - } - - if(options.scrollOverflow && options.scrollOverflowHandler == null){ - options.scrollOverflow = false; - showError('error', 'The option `scrollOverflow:true` requires the file `scrolloverflow.min.js`. Please include it before fullPage.js.'); - } - - //anchors can not have the same value as any element ID or NAME - options.anchors.forEach(function(name){ - - //case insensitive selectors (http://stackoverflow.com/a/19465187/1081396) - var nameAttr = [].slice.call($('[name]')).filter(function(item) { - return item.getAttribute('name') && item.getAttribute('name').toLowerCase() == name.toLowerCase(); - }); - - var idAttr = [].slice.call($('[id]')).filter(function(item) { - return item.getAttribute('id') && item.getAttribute('id').toLowerCase() == name.toLowerCase(); - }); - - if(idAttr.length || nameAttr.length ){ - showError('error', 'data-anchor tags can not have the same value as any `id` element on the site (or `name` element for IE).'); - if(idAttr.length){ - showError('error', '"' + name + '" is is being used by another element `id` property'); - } - if(nameAttr.length){ - showError('error', '"' + name + '" is is being used by another element `name` property'); - } - } - }); - } - - /** - * Getting the position of the element to scroll when using jQuery animations - */ - function getScrolledPosition(element){ - var position; - - //is not the window element and is a slide? - if(element.self != window && hasClass(element, SLIDES_WRAPPER)){ - position = element.scrollLeft; - } - else if(!options.autoScrolling || options.scrollBar){ - position = getScrollTop(); - } - else{ - position = element.offsetTop; - } - - //gets the top property of the wrapper - return position; - } - - /** - * Simulates the animated scrollTop of jQuery. Used when css3:false or scrollBar:true or autoScrolling:false - * http://stackoverflow.com/a/16136789/1081396 - */ - function scrollTo(element, to, duration, callback) { - var start = getScrolledPosition(element); - var change = to - start; - var currentTime = 0; - var increment = 20; - activeAnimation = true; - - var animateScroll = function(){ - if(activeAnimation){ //in order to stope it from other function whenever we want - var val = to; - - currentTime += increment; - - if(duration){ - val = window.fp_easings[options.easing](currentTime, start, change, duration); - } - - setScrolling(element, val); - - if(currentTime < duration) { - setTimeout(animateScroll, increment); - }else if(typeof callback !== 'undefined'){ - callback(); - } - }else if (currentTime < duration){ - callback(); - } - }; - - animateScroll(); - } - - /** - * Scrolls the page / slider the given number of pixels. - * It will do it one or another way dependiong on the library's config. - */ - function setScrolling(element, val){ - if(!options.autoScrolling || options.scrollBar || (element.self != window && hasClass(element, SLIDES_WRAPPER))){ - - //scrolling horizontally through the slides? - if(element.self != window && hasClass(element, SLIDES_WRAPPER)){ - element.scrollLeft = val; - } - //vertical scroll - else{ - element.scrollTo(0, val); - } - }else{ - element.style.top = val + 'px'; - } - } - - /** - * Gets the active slide. - */ - function getActiveSlide(){ - var activeSlide = $(SLIDE_ACTIVE_SEL, $(SECTION_ACTIVE_SEL)[0])[0]; - return nullOrSlide(activeSlide); - } - - /** - * Gets the active section. - */ - function getActiveSection(){ - return new Section($(SECTION_ACTIVE_SEL)[0]); - } - - /** - * Item. Slide or Section objects share the same properties. - */ - function Item(el, selector){ - this.anchor = el.getAttribute('data-anchor'); - this.item = el; - this.index = index(el, selector); - this.isLast = this.index === $(selector).length -1; - this.isFirst = !this.index; - } - - /** - * Section object - */ - function Section(el){ - Item.call(this, el, SECTION_SEL); - } - - /** - * Slide object - */ - function Slide(el){ - Item.call(this, el, SLIDE_SEL); - } - - return FP; - }//end of $.fn.fullpage - - //utils - /** - * Shows a message in the console of the given type. - */ - function showError(type, text){ - window.console && window.console[type] && window.console[type]('fullPage: ' + text); - } - - /** - * Equivalent or jQuery function $(). - */ - function $(selector, context){ - context = arguments.length > 1 ? context : document; - return context ? context.querySelectorAll(selector) : null; - } - - /** - * Extends a given Object properties and its childs. - */ - function deepExtend(out) { - out = out || {}; - for (var i = 1, len = arguments.length; i < len; ++i){ - var obj = arguments[i]; - - if(!obj){ - continue; - } - - for(var key in obj){ - if (!obj.hasOwnProperty(key)){ - continue; - } - - // based on https://javascriptweblog.wordpress.com/2011/08/08/fixing-the-javascript-typeof-operator/ - if (Object.prototype.toString.call(obj[key]) === '[object Object]'){ - out[key] = deepExtend(out[key], obj[key]); - continue; - } - - out[key] = obj[key]; - } - } - return out; - } - - /** - * Checks if the passed element contains the passed class. - */ - function hasClass(el, className){ - if(el == null){ - return false; - } - if (el.classList){ - return el.classList.contains(className); - } - return new RegExp('(^| )' + className + '( |$)', 'gi').test(el.className); - } - - /** - * Gets the window height. Crossbrowser. - */ - function getWindowHeight(){ - return 'innerHeight' in window ? window.innerHeight : document.documentElement.offsetHeight; - } - - /** - * Set's the CSS properties for the passed item/s. - * @param {NodeList|HTMLElement} items - * @param {Object} props css properties and values. - */ - function css(items, props) { - items = getList(items); - - var key; - for (key in props) { - if (props.hasOwnProperty(key)) { - if (key !== null) { - for (var i = 0; i < items.length; i++) { - var item = items[i]; - item.style[key] = props[key]; - } - } - } - } - - return items; - } - - /** - * Generic function to get the previous or next element. - */ - function until(item, selector, fn){ - var sibling = item[fn]; - while(sibling && !matches(sibling, selector)){ - sibling = sibling[fn]; - } - - return sibling; - } - - /** - * Gets the previous element to the passed element that matches the passed selector. - */ - function prevUntil(item, selector){ - return until(item, selector, 'previousElementSibling'); - } - - /** - * Gets the next element to the passed element that matches the passed selector. - */ - function nextUntil(item, selector){ - return until(item, selector, 'nextElementSibling'); - } - - /** - * Gets the previous element to the passed element. - */ - function prev(item, selector){ - if(selector == null){ - return item.previousElementSibling; - } - var prevItem = prev(item); - return prevItem && matches(prevItem, selector) ? prevItem : null; - } - - /** - * Gets the next element to the passed element. - */ - function next(item, selector){ - if(selector == null){ - return item.nextElementSibling; - } - var nextItem = next(item); - return nextItem && matches(nextItem, selector) ? nextItem : null; - } - - /** - * Gets the last element from the passed list of elements. - */ - function last(item){ - return item[item.length-1]; - } - - /** - * Gets index from the passed element. - * @param {String} selector is optional. - */ - function index(item, selector) { - item = isArrayOrList(item) ? item[0] : item; - var children = selector != null? $(selector, item.parentNode) : item.parentNode.childNodes; - var num = 0; - for (var i=0; iafdas'); - * wrapInner(document.querySelector('#pepe'), element); - * - * https://jsfiddle.net/zexxz0tw/6/ - * - * https://stackoverflow.com/a/21817590/1081396 - */ - function wrapInner(parent, wrapper) { - if (typeof wrapper === "string"){ - wrapper = createElementFromHTML(wrapper); - } - - parent.appendChild(wrapper); - - while(parent.firstChild !== wrapper){ - wrapper.appendChild(parent.firstChild); - } - } - - /** - * Usage: - * unwrap(document.querySelector('#pepe')); - * unwrap(element); - * - * https://jsfiddle.net/szjt0hxq/1/ - * - */ - function unwrap(wrapper) { - var wrapperContent = document.createDocumentFragment(); - while (wrapper.firstChild) { - wrapperContent.appendChild(wrapper.firstChild); - } - wrapper.parentNode.replaceChild(wrapperContent, wrapper); - } - - /** - * http://stackoverflow.com/questions/22100853/dom-pure-javascript-solution-to-jquery-closest-implementation - * Returns the element or `false` if there's none - */ - function closest(el, selector) { - if(el && el.nodeType === 1){ - if(matches(el, selector)){ - return el; - } - return closest(el.parentNode, selector); - } - return null; - } - - /** - * Places one element (rel) after another one or group of them (reference). - * @param {HTMLElement} reference - * @param {HTMLElement|NodeList|String} el - * https://jsfiddle.net/9s97hhzv/1/ - */ - function after(reference, el) { - insertBefore(reference, reference.nextSibling, el); - } - - /** - * Places one element (rel) before another one or group of them (reference). - * @param {HTMLElement} reference - * @param {HTMLElement|NodeList|String} el - * https://jsfiddle.net/9s97hhzv/1/ - */ - function before(reference, el) { - insertBefore(reference, reference, el); - } - - /** - * Based in https://stackoverflow.com/a/19316024/1081396 - * and https://stackoverflow.com/a/4793630/1081396 - */ - function insertBefore(reference, beforeElement, el){ - if(!isArrayOrList(el)){ - if(typeof el == 'string'){ - el = createElementFromHTML(el); - } - el = [el]; - } - - for(var i = 0; i1?n:t)?n.querySelectorAll(e):null}function Q(e){e=e||{};for(var t=1,n=arguments.length;t-1;if(!J(_("html"),a)){var le=_("html, body"),ce=_("body")[0],ve={};Z=Q({menu:!1,anchors:[],lockAnchors:!1,navigation:!1,navigationPosition:"right",navigationTooltips:[],showActiveTooltip:!1,slidesNavigation:!1,slidesNavPosition:"bottom",scrollBar:!1,hybrid:!1,css3:!0,scrollingSpeed:700,autoScrolling:!0,fitToSection:!0,fitToSectionDelay:1e3,easing:"easeInOutCubic",easingcss3:"ease",loopBottom:!1,loopTop:!1,loopHorizontal:!0,continuousVertical:!1,continuousHorizontal:!1,scrollHorizontally:!1,interlockedSlides:!1,dragAndMove:!1,offsetSections:!1,resetSliders:!1,fadingEffect:!1,normalScrollElements:null,scrollOverflow:!1,scrollOverflowReset:!1,scrollOverflowHandler:e.fp_scrolloverflow?e.fp_scrolloverflow.iscrollHandler:null,scrollOverflowOptions:null,touchSensitivity:5,normalScrollElementTouchThreshold:5,bigSectionsDestination:null,keyboardScrolling:!0,animateAnchor:!0,recordHistory:!0,controlArrows:!0,controlArrowColor:"#fff",verticalCentered:!0,sectionsColor:[],paddingTop:0,paddingBottom:0,fixedElements:null,responsive:0,responsiveWidth:0,responsiveHeight:0,responsiveSlides:!1,parallax:!1,parallaxOptions:{type:"reveal",percentage:62,property:"translate"},sectionSelector:v,slideSelector:M,v2compatible:!1,afterLoad:null,onLeave:null,afterRender:null,afterResize:null,afterReBuild:null,afterSlideLoad:null,onSlideLeave:null,afterResponsive:null,lazyLoading:!0},Z);var we,Ce,ze,Be,Ne=!1,je=navigator.userAgent.match(/(iPhone|iPod|iPad|Android|playbook|silk|BlackBerry|BB10|Windows Phone|Tizen|Bada|webOS|IEMobile|Opera Mini)/),Pe="ontouchstart"in e||navigator.msMaxTouchPoints>0||navigator.maxTouchPoints,De="string"==typeof D?_(D)[0]:D,Ye=K(),We=!1,Ve=!0,Xe=!0,Ze=[],Ge={m:{up:!0,down:!0,left:!0,right:!0}};Ge.k=Q({},Ge.m);var Fe,Ue,_e,Qe,Je,Ke,qe,$e,et,tt=Kn(),nt={touchmove:"ontouchmove"in e?"touchmove":tt.move,touchstart:"ontouchstart"in e?"touchstart":tt.down},ot=!1,rt='a[href], area[href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), button:not([disabled]), iframe, object, embed, [tabindex="0"], [contenteditable]',it=Q({},Z),lt={};co(),e.fp_easings=Q(e.fp_easings,{easeInOutCubic:function(e,t,n,o){return(e/=o/2)<1?n/2*e*e*e+t:n/2*((e-=2)*e*e+2)+t}}),De&&(ve.version="3.0.2",ve.setAutoScrolling=bt,ve.setRecordHistory=wt,ve.setScrollingSpeed=yt,ve.setFitToSection=Et,ve.setLockAnchors=function(e){Z.lockAnchors=e},ve.setMouseWheelScrolling=xt,ve.setAllowScrolling=Lt,ve.setKeyboardScrolling=Mt,ve.moveSectionUp=Tt,ve.moveSectionDown=Ot,ve.silentMoveTo=kt,ve.moveTo=Ct,ve.moveSlideRight=Ht,ve.moveSlideLeft=Rt,ve.fitToSection=Zt,ve.reBuild=It,ve.setResponsive=zt,ve.getFullpageData=function(){return{options:Z,internals:{container:De,canScroll:Xe,isScrollAllowed:Ge,getDestinationPosition:en,isTouch:Pe,c:Sn,getXmovement:Yn,removeAnimation:jn,getTransforms:to,lazyLoad:cn,addAnimation:Nn,performHorizontalMove:In,landscapeScroll:Cn,silentLandscapeScroll:$n,keepSlidesPosition:$t,silentScroll:eo,styleSlides:Dt,scrollHandler:Xt,getEventsPage:qn,getMSPointer:Kn,isReallyTouch:_t,usingExtension:ro,toggleControlArrows:Hn,touchStartHandler:Qt,touchMoveHandler:Ut}}},ve.destroy=function(n){Ae(De,"destroy",n),bt(!1,"internal"),Lt(!0),At(!1),Mt(!1),ue(De,l),clearTimeout(Qe),clearTimeout(_e),clearTimeout(Ue),clearTimeout(Je),clearTimeout(Ke),e.removeEventListener("scroll",Xt),e.removeEventListener("hashchange",yn),e.removeEventListener("resize",zn),t.removeEventListener("keydown",xn),t.removeEventListener("keyup",Ln),["click","touchstart"].forEach(function(e){t.removeEventListener(e,Bt)}),["mouseenter","touchstart","mouseleave","touchend"].forEach(function(e){t.removeEventListener(e,jt,!0)}),ro("dragAndMove")&&ve.dragAndMove.destroy(),clearTimeout(Qe),clearTimeout(_e),n&&(eo(0),_("img[data-src], source[data-src], audio[data-src], iframe[data-src]",De).forEach(function(e){sn(e,"src")}),_("img[data-srcset]").forEach(function(e){sn(e,"srcset")}),ke(_(E+", "+j+", "+Y)),q(_(h),{height:"","background-color":"",padding:""}),q(_(O),{width:""}),q(De,{height:"",position:"","-ms-touch-action":"","touch-action":""}),q(le,{overflow:"",height:""}),de(_("html"),a),de(ce,r),ce.className.split(/\s+/).forEach(function(e){0===e.indexOf(s)&&de(ce,e)}),_(h+", "+O).forEach(function(e){Z.scrollOverflowHandler&&Z.scrollOverflow&&Z.scrollOverflowHandler.remove(e),de(e,z+" "+c+" "+d);var t=e.getAttribute("data-fp-styles");t&&e.setAttribute("style",e.getAttribute("data-fp-styles"))}),oo(De),[S,I,H].forEach(function(e){_(e,De).forEach(function(e){ge(e)})}),e.scrollTo(0,0),[p,T,R].forEach(function(e){de(_("."+e),e)}))},ve.getActiveSection=function(){return new po(_(g)[0])},ve.getActiveSlide=function(){return rn(_(k,_(g)[0])[0])},ve.landscapeScroll=Cn,ve.test={top:"0px",translate3d:"translate3d(0px, 0px, 0px)",translate3dH:function(){for(var e=[],t=0;t<_(Z.sectionSelector,De).length;t++)e.push("translate3d(0px, 0px, 0px)");return e}(),left:function(){for(var e=[],t=0;t<_(Z.sectionSelector,De).length;t++)e.push(0);return e}(),options:Z,setAutoScrolling:bt},ve.shared={afterRenderActions:Vt},e.fullpage_api=ve,Pt("continuousHorizontal"),Pt("scrollHorizontally"),Pt("resetSliders"),Pt("interlockedSlides"),Pt("responsiveSlides"),Pt("fadingEffect"),Pt("dragAndMove"),Pt("offsetSections"),Pt("scrollOverflowReset"),Pt("parallax"),ro("dragAndMove")&&ve.dragAndMove.init(),Z.css3&&(Z.css3=function(){var n,o=t.createElement("p"),r={webkitTransform:"-webkit-transform",OTransform:"-o-transform",msTransform:"-ms-transform",MozTransform:"-moz-transform",transform:"transform"};for(var i in o.style.display="block",t.body.insertBefore(o,null),r)void 0!==o.style[i]&&(o.style[i]="translate3d(1px,1px,1px)",n=e.getComputedStyle(o).getPropertyValue(r[i]));return t.body.removeChild(o),void 0!==n&&n.length>0&&"none"!==n}()),Z.scrollBar=Z.scrollBar||Z.hybrid,function(){if(!Z.anchors.length){var e="[data-anchor]",t=_(Z.sectionSelector.split(",").join(e+",")+e,De);t.length&&t.forEach(function(e){Z.anchors.push(e.getAttribute("data-anchor").toString())})}if(!Z.navigationTooltips.length){var e="[data-tooltip]",n=_(Z.sectionSelector.split(",").join(e+",")+e,De);n.length&&n.forEach(function(e){Z.navigationTooltips.push(e.getAttribute("data-tooltip").toString())})}}(),function(){q(De,{height:"100%",position:"relative"}),ue(De,n),ue(_("html"),a),Ye=K(),de(De,l),ue(_(Z.sectionSelector,De),p),ue(_(Z.slideSelector,De),T),io("parallax","init");for(var e=_(h),r=0;r0?Dt(s,u,d):Z.verticalCentered&&Wn(s)}var f,v,m,S;Z.fixedElements&&Z.css3&&_(Z.fixedElements).forEach(function(e){ce.appendChild(e)}),Z.navigation&&function(){var e=t.createElement("div");e.setAttribute("id",y);var n=t.createElement("ul");e.appendChild(n),fe(e,ce);var o=_(E)[0];ue(o,"fp-"+Z.navigationPosition),Z.showActiveTooltip&&ue(o,A);for(var r="",i=0;i<_(h).length;i++){var l="";Z.anchors.length&&(l=Z.anchors[i]),r+='
        • '+Wt(i,"Section")+"";var a=Z.navigationTooltips[i];void 0!==a&&""!==a&&(r+='
          '+a+"
          "),r+="
        • "}_("ul",o)[0].innerHTML=r,q(_(E),{"margin-top":"-"+_(E)[0].offsetHeight/2+"px"}),ue(_("a",_("li",_(E)[0])[ie(_(g)[0],h)]),c)}(),_('iframe[src*="youtube.com/embed/"]',De).forEach(function(e){var t,n,o;n="enablejsapi=1",o=(t=e).getAttribute("src"),t.setAttribute("src",o+(/\?/.test(o)?"&":"?")+n)}),Z.fadingEffect&&ve.fadingEffect&&ve.fadingEffect.apply(),Z.scrollOverflow?Fe=Z.scrollOverflowHandler.init(Z):Vt()}(),Lt(!0),At(!0),bt(Z.autoScrolling,"internal"),Bn(),Jn(),"complete"===t.readyState&&wn(),e.addEventListener("load",wn),e.addEventListener("scroll",Xt),e.addEventListener("hashchange",yn),e.addEventListener("blur",On),e.addEventListener("resize",zn),t.addEventListener("keydown",xn),t.addEventListener("keyup",Ln),["click","touchstart"].forEach(function(e){t.addEventListener(e,Bt)}),Z.normalScrollElements&&(["mouseenter","touchstart"].forEach(function(e){Nt(e,!1)}),["mouseleave","touchend"].forEach(function(e){Nt(e,!0)})),ro("dragAndMove")&&ve.dragAndMove.turnOffTouch());var at,st,ct,ut=!1,dt=0,ft=0,vt=0,pt=0,ht=(new Date).getTime(),gt=0,mt=0,St=Ye;return ve}function bt(e,t){e||eo(0),so("autoScrolling",e,t);var n=_(g)[0];if(Z.autoScrolling&&!Z.scrollBar)q(le,{overflow:"hidden",height:"100%"}),wt(it.recordHistory,"internal"),q(De,{"-ms-touch-action":"none","touch-action":"none"}),null!=n&&eo(n.offsetTop);else if(q(le,{overflow:"visible",height:"initial"}),wt(!1,"internal"),q(De,{"-ms-touch-action":"","touch-action":""}),oo(De),null!=n){var o=ln(n.offsetTop);o.element.scrollTo(0,o.options)}Ae(De,"setAutoScrolling",e)}function wt(e,t){so("recordHistory",e,t)}function yt(e,t){"internal"!==t&&Z.fadingEffect&&ve.fadingEffect&&ve.fadingEffect.update(e),so("scrollingSpeed",e,t)}function Et(e,t){so("fitToSection",e,t)}function xt(n){n?(function(){var n,o="";e.addEventListener?n="addEventListener":(n="attachEvent",o="on");var r="onwheel"in t.createElement("div")?"wheel":void 0!==t.onmousewheel?"mousewheel":"DOMMouseScroll";"DOMMouseScroll"==r?t[n](o+"MozMousePixelScroll",Kt,!1):t[n](o+r,Kt,!1)}(),De.addEventListener("mousedown",An),De.addEventListener("mouseup",Mn)):(t.addEventListener?(t.removeEventListener("mousewheel",Kt,!1),t.removeEventListener("wheel",Kt,!1),t.removeEventListener("MozMousePixelScroll",Kt,!1)):t.detachEvent("onmousewheel",Kt),De.removeEventListener("mousedown",An),De.removeEventListener("mouseup",Mn))}function Lt(e,t){void 0!==t?(t=t.replace(/ /g,"").split(",")).forEach(function(t){no(e,t,"m")}):no(e,"all","m"),Ae(De,"setAllowScrolling",{value:e,directions:t})}function At(e){e?(xt(!0),(je||Pe)&&(Z.autoScrolling&&(ce.removeEventListener(nt.touchmove,Ft,{passive:!1}),ce.addEventListener(nt.touchmove,Ft,{passive:!1})),_(o).length>0&&(_(o)[0].removeEventListener(nt.touchstart,Qt),_(o)[0].removeEventListener(nt.touchmove,Ut,{passive:!1}),_(o)[0].addEventListener(nt.touchstart,Qt),_(o)[0].addEventListener(nt.touchmove,Ut,{passive:!1})))):(xt(!1),(je||Pe)&&(Z.autoScrolling&&(ce.removeEventListener(nt.touchmove,Ut,{passive:!1}),ce.removeEventListener(nt.touchmove,Ft,{passive:!1})),_(o).length>0&&(_(o)[0].removeEventListener(nt.touchstart,Qt),_(o)[0].removeEventListener(nt.touchmove,Ut,{passive:!1}))))}function Mt(e,t){void 0!==t?(t=t.replace(/ /g,"").split(",")).forEach(function(t){no(e,t,"k")}):(no(e,"all","k"),Z.keyboardScrolling=e)}function Tt(){var e=ee(_(g)[0],h);e||!Z.loopTop&&!Z.continuousVertical||(e=re(_(h))),null!=e&&tn(e,null,!0)}function Ot(){var e=te(_(g)[0],h);e||!Z.loopBottom&&!Z.continuousVertical||(e=_(h)[0]),null!=e&&tn(e,null,!1)}function kt(e,t){yt(0,"internal"),Ct(e,t),yt(it.scrollingSpeed,"internal")}function Ct(e,t){var n=Zn(e);void 0!==t?Gn(e,t):null!=n&&tn(n)}function Ht(e){qt("right",e)}function Rt(e){qt("left",e)}function It(t){if(!J(De,l)){We=!0,Ye=K();for(var n=_(h),o=0;o1&&Cn(i,_(k,i)[0])}Z.scrollOverflow&&Fe.createScrollBarForAll();var s=ie(_(g)[0],h);s&&!ro("fadingEffect")&&kt(s+1),We=!1,Le(Z.afterResize)&&t&&Z.afterResize.call(De,e.innerWidth,e.innerHeight),Le(Z.afterReBuild)&&!t&&Z.afterReBuild.call(De),Ae(De,"afterRebuild")}}function zt(e){var t=J(ce,r);e?t||(bt(!1,"internal"),Et(!1,"internal"),ae(_(E)),ue(ce,r),Le(Z.afterResponsive)&&Z.afterResponsive.call(De,e),Z.responsiveSlides&&ve.responsiveSlides&&ve.responsiveSlides.toSections(),Ae(De,"afterResponsive",e),Z.scrollOverflow&&Fe.createScrollBarForAll()):t&&(bt(it.autoScrolling,"internal"),Et(it.autoScrolling,"internal"),se(_(E)),de(ce,r),Le(Z.afterResponsive)&&Z.afterResponsive.call(De,e),Z.responsiveSlides&&ve.responsiveSlides&&ve.responsiveSlides.toSlides(),Ae(De,"afterResponsive",e))}function Bt(e){var t=e.target;t&&me(t,E+" a")?function(e){xe(e);var t=ie(me(this,E+" li"));tn(_(h)[t])}.call(t,e):Me(t,L)?function(){Ae(ne(this),"click")}.call(t):Me(t,Y)?function(){var e=me(this,h);J(this,W)?Ge.m.left&&Rt(e):Ge.m.right&&Ht(e)}.call(t,e):(Me(t,P)||null!=me(t,P))&&function(e){xe(e);var t=_(H,me(this,h))[0],n=_(O,t)[ie(me(this,"li"))];Cn(t,n)}.call(t,e)}function Nt(e,n){t["fp_"+e]=n,t.addEventListener(e,jt,!0)}function jt(e){e.target!=t&&Z.normalScrollElements.split(",").forEach(function(n){Me(e.target,n)&&At(t["fp_"+e.type])})}function Pt(t){var n="fp_"+t+"Extension";lt[t]=Z[t+"Key"],ve[t]=void 0!==e[n]?new e[n]:null,ve[t]&&ve[t].c(t)}function Dt(e,n,o){var r=100*o,i=100/o,l=t.createElement("div");l.className=C,pe(n,l);var a,s,u=t.createElement("div");u.className=R,pe(n,u),q(_(I,e),{width:r+"%"}),o>1&&(Z.controlArrows&&(a=e,s=[Oe('
          '),Oe('
          ')],Se(_(H,a)[0],s),"#fff"!==Z.controlArrowColor&&(q(_(F,a),{"border-color":"transparent transparent transparent "+Z.controlArrowColor}),q(_(X,a),{"border-color":"transparent "+Z.controlArrowColor+" transparent transparent"})),Z.loopHorizontal||ae(_(X,a))),Z.slidesNavigation&&function(e,t){fe(Oe('
            '),e);var n=_(j,e)[0];ue(n,"fp-"+Z.slidesNavPosition);for(var o=0;o'+Wt(o,"Slide")+""),_("ul",n)[0]);q(n,{"margin-left":"-"+n.innerWidth/2+"px"}),ue(_("a",_("li",n)[0]),c)}(e,o)),n.forEach(function(e){q(e,{width:i+"%"}),Z.verticalCentered&&Wn(e)});var d=_(k,e)[0];null!=d&&(0!==ie(_(g),h)||0===ie(_(g),h)&&0!==ie(d))?($n(d,"internal"),ue(d,B)):ue(n[0],c)}function Yt(e){return Z.offsetSections&&ve.offsetSections?Math.round(ve.offsetSections.getWindowHeight(e)):K()}function Wt(e,t){return Z.navigationTooltips[e]||Z.anchors[e]||t+" "+(e+1)}function Vt(){var e,t=_(g)[0];ue(t,d),cn(t),un(t),Z.scrollOverflow&&Z.scrollOverflowHandler.afterLoad(),(!(e=Zn(En().section))||void 0!==e&&ie(e)===ie(Be))&&Le(Z.afterLoad)&&nn("afterLoad",{activeSection:null,element:t,direction:null,anchorLink:t.getAttribute("data-anchor"),sectionIndex:ie(t,h)}),Le(Z.afterRender)&&nn("afterRender"),Ae(De,"afterRender")}function Xt(){var e;if(Ae(De,"onScroll"),(!Z.autoScrolling||Z.scrollBar||ro("dragAndMove"))&&!ao()){var t=ro("dragAndMove")?Math.abs(ve.dragAndMove.getCurrentScroll()):ye(),n=0,o=t+K()/2,r=(ro("dragAndMove")?ve.dragAndMove.getDocumentHeight():ce.offsetHeight-K())===t,i=_(h);if(r)n=i.length-1;else if(t)for(var l=0;lMath.abs(dt-vt)?!Ne&&Math.abs(ft-pt)>e.innerWidth/100*Z.touchSensitivity&&(ft>pt?Ge.m.right&&Ht(n):Ge.m.left&&Rt(n)):Z.autoScrolling&&Xe&&Math.abs(dt-vt)>e.innerHeight/100*Z.touchSensitivity&&(dt>vt?Gt("down"):vt>dt&&Gt("up"))}}function _t(e){return void 0===e.pointerType||"mouse"!=e.pointerType}function Qt(e){if(Z.fitToSection&&(et=!1),_t(e)){var t=qn(e);dt=t.y,ft=t.x}}function Jt(e,t){for(var n=0,o=e.slice(Math.max(e.length-t,1)),r=0;r149&&Ze.shift(),Ze.push(Math.abs(r)),Z.scrollBar&&xe(t);var s=n-ht;return ht=n,s>200&&(Ze=[]),Xe&&!lo()&&Jt(Ze,10)>=Jt(Ze,70)&&a&&Gt(i<0?"down":"up"),!1}Z.fitToSection&&(et=!1)}function qt(e,t){var n=null==t?_(g)[0]:t,o=_(H,n)[0];if(!(null==o||lo()||Ne||_(O,o).length<2)){var r=_(k,o)[0],i=null;if(null==(i="left"===e?ee(r,O):te(r,O))){if(!Z.loopHorizontal)return;var l=Ee(r);i="left"===e?l[l.length-1]:l[0]}Ne=!ve.test.isTesting,Cn(o,i,e)}}function $t(){for(var e=_(k),t=0;tgt,i=o-Ye+t,l=Z.bigSectionsDestination;return t>Ye?(r||l)&&"bottom"!==l||(o=i):(r||We&&null==oe(e))&&(o=i),Z.offsetSections&&ve.offsetSections&&(o=ve.offsetSections.getSectionPosition(r,o,e)),gt=o,o}function tn(e,t,n){if(null!=e){var r,i,l={element:e,callback:t,isMovementUp:n,dtop:en(e),yMovement:Dn(e),anchorLink:e.getAttribute("data-anchor"),sectionIndex:ie(e,h),activeSlide:_(k,e)[0],activeSection:_(g)[0],leavingSection:ie(_(g),h)+1,localIsResizing:We};if(!(l.activeSection==e&&!We||Z.scrollBar&&ye()===l.dtop&&!J(e,b))){if(null!=l.activeSlide&&(r=l.activeSlide.getAttribute("data-anchor"),i=ie(l.activeSlide)),Le(Z.onLeave)&&!l.localIsResizing){var a=l.yMovement;if(void 0!==n&&(a=n?"up":"down"),l.direction=a,!1===nn("onLeave",l))return}io("parallax","apply",l),Z.autoScrolling&&Z.continuousVertical&&void 0!==l.isMovementUp&&(!l.isMovementUp&&"up"==l.yMovement||l.isMovementUp&&"down"==l.yMovement)&&((u=l).isMovementUp?be(_(g)[0],He(u.activeSection,h)):Se(_(g)[0],Re(u.activeSection,h).reverse()),eo(_(g)[0].offsetTop),$t(),u.wrapAroundElements=u.activeSection,u.dtop=u.element.offsetTop,u.yMovement=Dn(u.element),u.leavingSection=ie(u.activeSection,h)+1,u.sectionIndex=ie(u.element,h),Ae(_(o)[0],"onContinuousVertical",u),l=u),ro("scrollOverflowReset")&&ve.scrollOverflowReset.setPrevious(l.activeSection),l.localIsResizing||fn(l.activeSection),Z.scrollOverflow&&Z.scrollOverflowHandler.beforeLeave(),ue(e,c),de(Ee(e),c),cn(e),Z.scrollOverflow&&Z.scrollOverflowHandler.onLeave(),Xe=ve.test.isTesting,Un(i,r,l.anchorLink,l.sectionIndex),function(e){if(Z.css3&&Z.autoScrolling&&!Z.scrollBar){var t="translate3d(0px, -"+Math.round(e.dtop)+"px, 0px)";Xn(t,!0),Z.scrollingSpeed?(clearTimeout(_e),_e=setTimeout(function(){an(e)},Z.scrollingSpeed)):an(e)}else{var n=ln(e.dtop);ve.test.top=-e.dtop+"px",uo(n.element,n.options,Z.scrollingSpeed,function(){Z.scrollBar?setTimeout(function(){an(e)},30):an(e)})}}(l),we=l.anchorLink,Pn(l.anchorLink,null!=(s=l).wrapAroundElements?s.isMovementUp?_(h).length-1:0:s.sectionIndex)}}var s,u}function nn(e,t){var n,o,r,i,l=(o=e,r=t,(i=Z.v2compatible?{afterRender:function(){return[De]},onLeave:function(){return[r.activeSection,r.leavingSection,r.sectionIndex+1,r.direction]},afterLoad:function(){return[r.element,r.anchorLink,r.sectionIndex+1]},afterSlideLoad:function(){return[r.destiny,r.anchorLink,r.sectionIndex+1,r.slideAnchor,r.slideIndex]},onSlideLeave:function(){return[r.prevSlide,r.anchorLink,r.sectionIndex+1,r.prevSlideIndex,r.direction,r.slideIndex]}}:{afterRender:function(){return{section:on(_(g)[0]),slide:rn(_(k,_(g)[0])[0])}},onLeave:function(){return{origin:on(r.activeSection),destination:on(r.element),direction:r.direction}},afterLoad:function(){return i.onLeave()},afterSlideLoad:function(){return{section:on(r.section),origin:rn(r.prevSlide),destination:rn(r.destiny),direction:r.direction}},onSlideLeave:function(){return i.afterSlideLoad()}})[o]());if(Z.v2compatible){if(!1===Z[e].apply(l[0],l.slice(1)))return!1}else if(Ae(De,e,l),!1===Z[e].apply(l[Object.keys(l)[0]],(n=l,Object.keys(n).map(function(e){return n[e]}))))return!1;return!0}function on(e){return e?new po(e):null}function rn(e){return e?new function(e){vo.call(this,e,O)}(e):null}function ln(t){var n={};return Z.autoScrolling&&!Z.scrollBar?(n.options=-t,n.element=_(o)[0]):(n.options=t,n.element=e),n}function an(e){var t;null!=(t=e).wrapAroundElements&&(t.isMovementUp?be(_(h)[0],t.wrapAroundElements):Se(_(h)[_(h).length-1],t.wrapAroundElements),eo(_(g)[0].offsetTop),$t(),t.sectionIndex=ie(t.element,h),t.leavingSection=ie(t.activeSection,h)+1),Le(Z.afterLoad)&&!e.localIsResizing&&nn("afterLoad",e),Z.scrollOverflow&&Z.scrollOverflowHandler.afterLoad(),io("parallax","afterLoad"),ro("scrollOverflowReset")&&ve.scrollOverflowReset.reset(),ro("resetSliders")&&ve.resetSliders.apply(e),e.localIsResizing||un(e.element),ue(e.element,d),de(Ee(e.element),d),Xe=!0,Le(e.callback)&&e.callback()}function sn(e,t){e.setAttribute(t,e.getAttribute("data-"+t)),e.removeAttribute("data-"+t)}function cn(e){Z.lazyLoading&&_("img[data-src], img[data-srcset], source[data-src], source[data-srcset], video[data-src], audio[data-src], iframe[data-src]",vn(e)).forEach(function(e){if(["src","srcset"].forEach(function(t){var n=e.getAttribute("data-"+t);null!=n&&n&&sn(e,t)}),Me(e,"source")){var t=me(e,"video, audio");t&&t.load()}})}function un(e){var t=vn(e);_("video, audio",t).forEach(function(e){e.hasAttribute("data-autoplay")&&"function"==typeof e.play&&e.play()}),_('iframe[src*="youtube.com/embed/"]',t).forEach(function(e){e.hasAttribute("data-autoplay")&&dn(e),e.onload=function(){e.hasAttribute("data-autoplay")&&dn(e)}})}function dn(e){e.contentWindow.postMessage('{"event":"command","func":"playVideo","args":""}',"*")}function fn(e){var t=vn(e);_("video, audio",t).forEach(function(e){e.hasAttribute("data-keepplaying")||"function"!=typeof e.pause||e.pause()}),_('iframe[src*="youtube.com/embed/"]',t).forEach(function(e){/youtube\.com\/embed\//.test(e.getAttribute("src"))&&!e.hasAttribute("data-keepplaying")&&e.contentWindow.postMessage('{"event":"command","func":"pauseVideo","args":""}',"*")})}function vn(e){var t=_(k,e);return t.length&&(e=t[0]),e}function pn(e){var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";function n(e){var n,o,r,i,l,a,s="",c=0;for(e=e.replace(/[^A-Za-z0-9+/=]/g,"");c>4,o=(15&i)<<4|(l=t.indexOf(e.charAt(c++)))>>2,r=(3&l)<<6|(a=t.indexOf(e.charAt(c++))),s+=String.fromCharCode(n),64!=l&&(s+=String.fromCharCode(o)),64!=a&&(s+=String.fromCharCode(r));return s=function(e){for(var t,n="",o=0,r=0,i=0;o191&&r<224?(i=e.charCodeAt(o+1),n+=String.fromCharCode((31&r)<<6|63&i),o+=2):(i=e.charCodeAt(o+1),t=e.charCodeAt(o+2),n+=String.fromCharCode((15&r)<<12|(63&i)<<6|63&t),o+=3);return n}(s)}function o(e){return e.slice(3).slice(0,-3)}return function(e){var t=e.split("_");if(t.length>1){var r=t[1];return e.replace(o(t[1]),"").split("_")[0]+"_"+n(r.slice(3).slice(0,-3))}return o(e)}(n(e))}function hn(e){var n=function(){if(t.domain.length){for(var e=t.domain.replace(/^(www\.)/,"").split(".");e.length>2;)e.shift();return e.join(".").replace(/(^\.*)|(\.*$)/g,"")}return""}(),o=["MTM0bG9jYWxob3N0MjM0","MTM0MC4xMjM0","MTM0anNoZWxsLm5ldDIzNA==","UDdDQU5ZNlNN"],r=pn(o[0]),i=pn(o[1]),l=pn(o[2]),a=pn(o[3]),s=[r,i,l].indexOf(n)<0&&0!==n.length,c=void 0!==lt[e]&<[e].length;if(!c&&s)return!1;var u=c?pn(lt[e]):"",d=(u=u.split("_")).length>1&&u[1].indexOf(e,u[1].length-e.length)>-1;return!(u[0].indexOf(n,u[0].length-n.length)<0&&s&&a!=u[0])&&d||!s}function gn(e){e.forEach(function(e){e.removedNodes[0]&&e.removedNodes[0].isEqualNode(st)&&(clearTimeout(ct),ct=setTimeout(mn,900))})}function mn(){ot=!1}function Sn(n){st=t.createElement("div"),at=pn("MTIzPGRpdj48YSBocmVmPSJodHRwOi8vYWx2YXJvdHJpZ28uY29tL2Z1bGxQYWdlL2V4dGVuc2lvbnMvIiBzdHlsZT0iY29sb3I6ICNmZmYgIWltcG9ydGFudDsgdGV4dC1kZWNvcmF0aW9uOm5vbmUgIWltcG9ydGFudDsiPlVubGljZW5zZWQgZnVsbFBhZ2UuanMgRXh0ZW5zaW9uPC9hPjwvZGl2PjEyMw=="),st.innerHTML=at,st=st.firstChild,"MutationObserver"in e&&new MutationObserver(gn).observe(t.body,{childList:!0,subtree:!1}),ro(n)&&ve[n]&&(hn(n)||(bn(),setInterval(bn,2e3)))}function bn(){st&&(ot||(Math.random()<.5?Ie(ce,st):fe(st,ce),ot=!0),st.setAttribute("style",pn("MTIzei1pbmRleDo5OTk5OTk5O3Bvc2l0aW9uOmZpeGVkO3RvcDoyMHB4O2JvdHRvbTphdXRvO2xlZnQ6MjBweDtyaWdodDphdXRvO2JhY2tncm91bmQ6cmVkO3BhZGRpbmc6N3B4IDE1cHg7Zm9udC1zaXplOjE0cHg7Zm9udC1mYW1pbHk6YXJpYWw7Y29sb3I6I2ZmZjtkaXNwbGF5OmlubGluZS1ibG9jazt0cmFuc2Zvcm06dHJhbnNsYXRlM2QoMCwwLDApO29wYWNpdHk6MTtoZWlnaHQ6YXV0bzt3aWR0aDphdXRvO3pvb206MTttYXJnaW46YXV0bztib3JkZXI6bm9uZTt2aXNpYmlsaXR5OnZpc2libGU7Y2xpcC1wYXRoOm5vbmU7MTIz").replace(/;/g,pn("MTIzICFpbXBvcnRhbnQ7MzQ1"))))}function wn(){var e=En(),t=e.section,n=e.slide;t&&(Z.animateAnchor?Gn(t,n):kt(t,n))}function yn(){if(!ut&&!Z.lockAnchors){var e=En(),t=e.section,n=e.slide,o=void 0===we,r=void 0===we&&void 0===n&&!Ne;t&&t.length&&(t&&t!==we&&!o||r||!Ne&&Ce!=n)&&Gn(t,n)}}function En(){var t,n,o=e.location.hash;if(o.length){var r=o.replace("#","").split("/"),i=o.indexOf("#/")>-1;t=i?"/"+r[1]:decodeURIComponent(r[0]);var l=i?r[2]:r[1];l&&l.length&&(n=decodeURIComponent(l))}return{section:t,slide:n}}function xn(e){clearTimeout(qe);var n=t.activeElement,o=e.keyCode;9===o?function(e){var n,o,r,i,l,a,s,c=e.shiftKey,u=t.activeElement,d=Tn(vn(_(g)[0]));function f(e){return xe(e),d[0]?d[0].focus():null}(n=e,o=Tn(t),r=o.indexOf(t.activeElement),i=n.shiftKey?r-1:r+1,l=o[i],a=rn(me(l,O)),s=on(me(l,h)),a||s)&&(u?null==me(u,g+","+g+" "+k)&&(u=f(e)):f(e),(!c&&u==d[d.length-1]||c&&u==d[0])&&xe(e))}(e):Me(n,"textarea")||Me(n,"input")||Me(n,"select")||"true"===n.getAttribute("contentEditable")||""===n.getAttribute("contentEditable")||!Z.keyboardScrolling||!Z.autoScrolling||([40,38,32,33,34].indexOf(o)>-1&&xe(e),ze=e.ctrlKey,qe=setTimeout(function(){!function(e){var t=e.shiftKey;if(Xe||!([37,39].indexOf(e.keyCode)<0))switch(e.keyCode){case 38:case 33:Ge.k.up&&Tt();break;case 32:if(t&&Ge.k.up){Tt();break}case 40:case 34:Ge.k.down&&Ot();break;case 36:Ge.k.up&&Ct(1);break;case 35:Ge.k.down&&Ct(_(h).length);break;case 37:Ge.k.left&&Rt();break;case 39:Ge.k.right&&Ht()}}(e)},150))}function Ln(e){Ve&&(ze=e.ctrlKey)}function An(e){2==e.which&&(mt=e.pageY,De.addEventListener("mousemove",kn))}function Mn(e){2==e.which&&De.removeEventListener("mousemove",kn)}function Tn(e){return[].slice.call(_(rt,e)).filter(function(e){return"-1"!==e.getAttribute("tabindex")&&null!==e.offsetParent})}function On(){Ve=!1,ze=!1}function kn(e){Xe&&(e.pageYmt&&Ge.m.down&&Ot()),mt=e.pageY}function Cn(e,t,n){var o=me(e,h),r={slides:e,destiny:t,direction:n,destinyPos:{left:t.offsetLeft},slideIndex:ie(t),section:o,sectionIndex:ie(o,h),anchorLink:o.getAttribute("data-anchor"),slidesNav:_(j,o)[0],slideAnchor:Qn(t),prevSlide:_(k,o)[0],prevSlideIndex:ie(_(k,o)[0]),localIsResizing:We};r.xMovement=Yn(r.prevSlideIndex,r.slideIndex),r.localIsResizing||(Xe=!1),io("parallax","applyHorizontal",r),Z.onSlideLeave&&!r.localIsResizing&&"none"!==r.xMovement&&Le(Z.onSlideLeave)&&!1===nn("onSlideLeave",r)?Ne=!1:(ue(t,c),de(Ee(t),c),r.localIsResizing||(fn(r.prevSlide),cn(t)),Hn(r),J(o,c)&&!r.localIsResizing&&Un(r.slideIndex,r.slideAnchor,r.anchorLink,r.sectionIndex),ve.continuousHorizontal&&ve.continuousHorizontal.apply(r),ao()?Rn(r):In(e,r,!0),Z.interlockedSlides&&ve.interlockedSlides&&(ro("continuousHorizontal")&&void 0!==n&&n!==r.xMovement||ve.interlockedSlides.apply(r)))}function Hn(e){!Z.loopHorizontal&&Z.controlArrows&&(Te(_(X,e.section),0!==e.slideIndex),Te(_(F,e.section),null!=oe(e.destiny)))}function Rn(e){var t,n;ve.continuousHorizontal&&ve.continuousHorizontal.afterSlideLoads(e),t=e.slidesNav,n=e.slideIndex,Z.slidesNavigation&&null!=t&&(de(_(u,t),c),ue(_("a",_("li",t)[n]),c)),e.localIsResizing||(io("parallax","afterSlideLoads"),Le(Z.afterSlideLoad)&&nn("afterSlideLoad",e),Xe=!0,un(e.destiny)),Ne=!1,ro("interlockedSlides")&&ve.interlockedSlides.apply(e)}function In(e,t,n){var o=t.destinyPos;if(Z.css3){var r="translate3d(-"+Math.round(o.left)+"px, 0px, 0px)";ve.test.translate3dH[t.sectionIndex]=r,q(Nn(_(I,e)),to(r)),Qe=setTimeout(function(){n&&Rn(t)},Z.scrollingSpeed)}else ve.test.left[t.sectionIndex]=Math.round(o.left),uo(e,Math.round(o.left),Z.scrollingSpeed,function(){n&&Rn(t)})}function zn(){if(Ae(De,"onResize"),Bn(),je){var e=t.activeElement;if(!Me(e,"textarea")&&!Me(e,"input")&&!Me(e,"select")){var n=K();Math.abs(n-St)>20*Math.max(St,n)/100&&(It(!0),St=n)}}else clearTimeout(Ue),Ue=setTimeout(function(){It(!0)},350)}function Bn(){var t=Z.responsive||Z.responsiveWidth,n=Z.responsiveHeight,o=t&&e.innerWidthn?"up":"down"}function Yn(e,t){return e==t?"none":e>t?"left":"right"}function Wn(e){if(!J(e,z)){var n=t.createElement("div");n.className=m,n.style.height=Vn(e)+"px",ue(e,z),he(e,n)}}function Vn(e){var t=Yt(e);if(Z.paddingTop||Z.paddingBottom){var n=e;J(n,p)||(n=me(e,h)),t-=parseInt(getComputedStyle(n)["padding-top"])+parseInt(getComputedStyle(n)["padding-bottom"])}return t}function Xn(e,t){t?Nn(De):jn(De),clearTimeout($e),q(De,to(e)),ve.test.translate3d=e,$e=setTimeout(function(){de(De,i)},10)}function Zn(e){var t=_(h+'[data-anchor="'+e+'"]',De)[0];if(!t){var n=void 0!==e?e-1:0;t=_(h)[n]}return t}function Gn(e,t){var n=Zn(e);if(null!=n){var o,r,i,l=(null==(i=_(O+'[data-anchor="'+(o=t)+'"]',r=n)[0])&&(o=void 0!==o?o:0,i=_(O,r)[o]),i);Qn(n)===we||J(n,c)?Fn(l):tn(n,function(){Fn(l)})}}function Fn(e){null!=e&&Cn(me(e,H),e)}function Un(e,t,n,o){var r="";Z.anchors.length&&!Z.lockAnchors&&(e?(null!=n&&(r=n),null==t&&(t=e),Ce=t,_n(r+"/"+t)):null!=e?(Ce=t,_n(n)):_n(n)),Jn()}function _n(t){if(Z.recordHistory)location.hash=t;else if(je||Pe)e.history.replaceState(void 0,void 0,"#"+t);else{var n=e.location.href.split("#")[0];e.location.replace(n+"#"+t)}}function Qn(e){if(!e)return null;var t=e.getAttribute("data-anchor"),n=ie(e);return null==t&&(t=n),t}function Jn(){var e=_(g)[0],t=_(k,e)[0],n=Qn(e),o=Qn(t),r=String(n);t&&(r=r+"-"+o),r=r.replace("/","-").replace("#","");var i=new RegExp("\\b\\s?"+s+"-[^\\s]+\\b","g");ce.className=ce.className.replace(i,""),ue(ce,s+"-"+r)}function Kn(){return e.PointerEvent?{down:"pointerdown",move:"pointermove"}:{down:"MSPointerDown",move:"MSPointerMove"}}function qn(e){var t=[];return t.y=void 0!==e.pageY&&(e.pageY||e.pageX)?e.pageY:e.touches[0].pageY,t.x=void 0!==e.pageX&&(e.pageY||e.pageX)?e.pageX:e.touches[0].pageX,Pe&&_t(e)&&Z.scrollBar&&void 0!==e.touches&&(t.y=e.touches[0].pageY,t.x=e.touches[0].pageX),t}function $n(e,t){yt(0,"internal"),void 0!==t&&(We=!0),Cn(me(e,H),e),void 0!==t&&(We=!1),yt(it.scrollingSpeed,"internal")}function eo(e){var t=Math.round(e);if(Z.css3&&Z.autoScrolling&&!Z.scrollBar)Xn("translate3d(0px, -"+t+"px, 0px)",!1);else if(Z.autoScrolling&&!Z.scrollBar)q(De,{top:-t+"px"}),ve.test.top=-t+"px";else{var n=ln(t);fo(n.element,n.options)}}function to(e){return{"-webkit-transform":e,"-moz-transform":e,"-ms-transform":e,transform:e}}function no(e,t,n){"all"!==t?Ge[n][t]=e:Object.keys(Ge[n]).forEach(function(t){Ge[n][t]=e})}function oo(e){return q(e,{"-webkit-transition":"none",transition:"none"})}function ro(e){return null!==Z[e]&&"[object Array]"===Object.prototype.toString.call(Z[e])?Z[e].length&&ve[e]:Z[e]&&ve[e]}function io(e,t,n){if(ro(e))return ve[e][t](n)}function lo(){return ro("dragAndMove")&&ve.dragAndMove.isAnimating}function ao(){return ro("dragAndMove")&&ve.dragAndMove.isGrabbing}function so(e,t,n){Z[e]=t,"internal"!==n&&(it[e]=t)}function co(){$||(U("error","Fullpage.js version 3 has changed its license to GPLv3 and it requires a `licenseKey` option. Read about it here:"),U("error","https://github.com/alvarotrigo/fullPage.js#options.")),J(_("html"),a)?U("error","Fullpage.js can only be initialized once and you are doing it multiple times!"):(Z.continuousVertical&&(Z.loopTop||Z.loopBottom)&&(Z.continuousVertical=!1,U("warn","Option `loopTop/loopBottom` is mutually exclusive with `continuousVertical`; `continuousVertical` disabled")),!Z.scrollOverflow||!Z.scrollBar&&Z.autoScrolling||U("warn","Options scrollBar:true and autoScrolling:false are mutually exclusive with scrollOverflow:true. Sections with scrollOverflow might not work well in Firefox"),!Z.continuousVertical||!Z.scrollBar&&Z.autoScrolling||(Z.continuousVertical=!1,U("warn","Scroll bars (`scrollBar:true` or `autoScrolling:false`) are mutually exclusive with `continuousVertical`; `continuousVertical` disabled")),Z.scrollOverflow&&null==Z.scrollOverflowHandler&&(Z.scrollOverflow=!1,U("error","The option `scrollOverflow:true` requires the file `scrolloverflow.min.js`. Please include it before fullPage.js.")),Z.anchors.forEach(function(e){var t=[].slice.call(_("[name]")).filter(function(t){return t.getAttribute("name")&&t.getAttribute("name").toLowerCase()==e.toLowerCase()}),n=[].slice.call(_("[id]")).filter(function(t){return t.getAttribute("id")&&t.getAttribute("id").toLowerCase()==e.toLowerCase()});(n.length||t.length)&&(U("error","data-anchor tags can not have the same value as any `id` element on the site (or `name` element for IE)."),n.length&&U("error",'"'+e+'" is is being used by another element `id` property'),t.length&&U("error",'"'+e+'" is is being used by another element `name` property'))}))}function uo(t,n,o,r){var i,l=(i=t).self!=e&&J(i,C)?i.scrollLeft:!Z.autoScrolling||Z.scrollBar?ye():i.offsetTop,a=n-l,s=0;et=!0;var c=function(){if(et){var i=n;s+=20,o&&(i=e.fp_easings[Z.easing](s,l,a,o)),fo(t,i),s');}_this.state={initialized:false};return _this;}_createClass(ReactFullpage,[{key:'componentDidMount',value:function componentDidMount(){var _props=this.props,$=_props.$,_props$v2compatible=_props.v2compatible,v2compatible=_props$v2compatible===undefined?false:_props$v2compatible;var opts=this.buildOptions();if(v2compatible){if(!$||$ instanceof window.jQuery===false){throw new Error('Must provide $ (jQuery) as a prop if using v2 API');}$(document).ready(function(){// eslint-disable-line -$('#fullpage').fullpage(opts);});}else if(fullpage_js_dist_fullpage_extensions_min__WEBPACK_IMPORTED_MODULE_1___default.a){this.init(opts);this.markInitialized();}}},{key:'componentDidUpdate',value:function componentDidUpdate(prevProps,prevState){if(prevState.initialized===this.state.initialized){return;}var props=this.props,fpUtils=this.fpUtils;var slideSelector=props.slideSelector||'.slide';var sectionSelector=props.sectionSelector||'.section';var activeSection=document.querySelector(sectionSelector+'.active');var activeSectionIndex=activeSection?fpUtils.index(activeSection):-1;var activeSlide=document.querySelector(sectionSelector+'.active'+slideSelector+'.active');var activeSlideIndex=activeSlide?fpUtils.index(activeSlide):-1;this.destroy();if(activeSectionIndex>-1){fpUtils.addClass(document.querySelectorAll(sectionSelector)[activeSectionIndex],'active');}if(activeSlideIndex>-1){fpUtils.addClass(activeSlide,'active');}this.init(this.buildOptions());}},{key:'componentWillUnmount',value:function componentWillUnmount(){this.destroy();}},{key:'init',value:function init(opts){new fullpage_js_dist_fullpage_extensions_min__WEBPACK_IMPORTED_MODULE_1___default.a('#fullpage',opts);// eslint-disable-line +var isFunc=function isFunc(val){return typeof val==='function';};var fullpageCallbacks=['afterLoad','afterRender','afterResize','afterResponsive','afterSlideLoad','onLeave','onSlideLeave'];var ReactFullpage=function(_React$Component){_inherits(ReactFullpage,_React$Component);function ReactFullpage(props){_classCallCheck(this,ReactFullpage);var _this=_possibleConstructorReturn(this,(ReactFullpage.__proto__||Object.getPrototypeOf(ReactFullpage)).call(this,props));var render=_this.props.render;if(!isFunc(render)){throw new Error('must provide render prop to ');}_this.state={initialized:false};return _this;}_createClass(ReactFullpage,[{key:'componentDidMount',value:function componentDidMount(){var opts=this.buildOptions();if(fullpage_js_dist_fullpage_extensions_min__WEBPACK_IMPORTED_MODULE_1___default.a){this.init(opts);this.markInitialized();}}},{key:'componentDidUpdate',value:function componentDidUpdate(prevProps,prevState){var newSectionCount=this.getSectionCount();var newSlideCount=this.getSlideCount();var _state=this.state,sectionCount=_state.sectionCount,slideCount=_state.slideCount;/* TODO: add a list of fullpage.js specific props to subscribe too + similar to how callbacks are handled) + */if(this.props.sectionsColor!==prevProps.sectionsColor){console.log('rebuilding due to a change in fullpage.js props');// NOTE: if fullpage props have changed we need to rebuild +this.destroy();this.init(this.buildOptions());return;}if(sectionCount===newSectionCount&&slideCount===newSlideCount){return;}console.log('rebuilding due to a change in fullpage.js sections/slides');// NOTE: if sections have changed we need to rebuild +this.destroy();this.init(this.buildOptions());}},{key:'componentWillUnmount',value:function componentWillUnmount(){this.destroy();}},{key:'getSectionCount',value:function getSectionCount(){var _props$sectionSelecto=this.props.sectionSelector,sectionSelector=_props$sectionSelecto===undefined?'.section':_props$sectionSelecto;return document.querySelectorAll(sectionSelector).length;}},{key:'getSlideCount',value:function getSlideCount(){var _props$slideSelector=this.props.slideSelector,slideSelector=_props$slideSelector===undefined?'.slide':_props$slideSelector;return document.querySelectorAll(slideSelector).length;}},{key:'init',value:function init(opts){new fullpage_js_dist_fullpage_extensions_min__WEBPACK_IMPORTED_MODULE_1___default.a('#fullpage',opts);// eslint-disable-line this.fullpageApi=window.fullpage_api;this.fpUtils=window.fp_utils;this.fpEasings=window.fp_easings;}},{key:'destroy',value:function destroy(){// NOTE: need to check for init to support SSR -if(!this.state.initialized)return;this.fullpageApi.destroy('all');}},{key:'markInitialized',value:function markInitialized(){this.setState({initialized:true});}},{key:'buildOptions',value:function buildOptions(){var _this2=this;var filterCb=function filterCb(key){return!!Object.keys(_this2.props).find(function(cb){return cb===key;});};var registered=fullpageCallbacks.filter(filterCb);var listeners=registered.reduce(function(result,key){var agg=_extends({},result);agg[key]=function(){for(var _len=arguments.length,args=Array(_len),_key=0;_key<_len;_key++){args[_key]=arguments[_key];}var newArgs=[key].concat(args);_this2.update.apply(_this2,_toConsumableArray(newArgs));};return agg;},{});return _extends({},this.props,listeners);}},{key:'update',value:function update(lastEvent){var _this3=this;for(var _len2=arguments.length,args=Array(_len2>1?_len2-1:0),_key2=1;_key2<_len2;_key2++){args[_key2-1]=arguments[_key2];}var _props$v2compatible2=this.props.v2compatible,v2compatible=_props$v2compatible2===undefined?false:_props$v2compatible2;var state=_extends({},this.state);var makeState=function makeState(callbackParameters){return _extends({},state,callbackParameters,{lastEvent:lastEvent});};var fromArgs=function fromArgs(argList){return argList.reduce(function(result,key,i){var value=args[i];result[key]=value;// eslint-disable-line -return result;},{});};// TODO: change all fromArgs to constants After-* -if(v2compatible){// NOTE: remapping callback args for v2 +if(typeof window!=='undefined'){this.fullpageApi.destroy('all');}}},{key:'markInitialized',value:function markInitialized(){this.setState({initialized:true,sectionCount:this.getSectionCount(),slideCount:this.getSlideCount()});}},{key:'buildOptions',value:function buildOptions(){var _this2=this;var filterCb=function filterCb(key){return!!Object.keys(_this2.props).find(function(cb){return cb===key;});};var registered=fullpageCallbacks.filter(filterCb);var listeners=registered.reduce(function(result,key){var agg=_extends({},result);agg[key]=function(){for(var _len=arguments.length,args=Array(_len),_key=0;_key<_len;_key++){args[_key]=arguments[_key];}var newArgs=[key].concat(args);_this2.update.apply(_this2,_toConsumableArray(newArgs));};return agg;},{});return _extends({},this.props,listeners);}},{key:'update',value:function update(lastEvent){var _this3=this;for(var _len2=arguments.length,args=Array(_len2>1?_len2-1:0),_key2=1;_key2<_len2;_key2++){args[_key2-1]=arguments[_key2];}var state=_extends({},this.state,{sectionCount:this.getSectionCount(),getSlideCount:this.getSlideCount()});var makeState=function makeState(callbackParameters){return _extends({},state,callbackParameters,{lastEvent:lastEvent});};var fromArgs=function fromArgs(argList){return argList.reduce(function(result,key,i){var value=args[i];result[key]=value;// eslint-disable-line +return result;},{});};// NOTE: remapping callback args to v3 // https://github.com/alvarotrigo/fullPage.js#callbacks switch(lastEvent){// After-* -case'afterLoad':state=makeState(fromArgs(['anchorLink','index']));break;case'afterResponsive':state=makeState(fromArgs(['isResponsive']));break;case'afterSlideLoad':state=makeState(fromArgs(['anchorLink','index','slideAnchor','slideIndex']));break;// On-* -case'onLeave':state=makeState(fromArgs(['index','nextIndex','direction']));break;case'onSlideLeave':state=makeState(fromArgs(['anchorLink','index','slideIndex','direction','nextSlideIndex']));break;default:break;}}else{// NOTE: remapping callback args to v3 -// https://github.com/alvarotrigo/fullPage.js#callbacks -switch(lastEvent){// After-* -case'afterLoad':state=makeState(fromArgs(['origin','destination','direction']));break;// TODO: update accoding to new API -case'afterResize':state=makeState(fromArgs(['']));break;case'afterResponsive':state=makeState(fromArgs(['isResponsive']));break;case'afterSlideLoad':state=makeState(fromArgs(['section','origin','destination','direction']));break;// On-* -case'onLeave':state=makeState(fromArgs(['origin','destination','direction']));break;case'onSlideLeave':state=makeState(fromArgs(['section','origin','slideIndex','destination','direction']));break;default:break;}}this.setState(state,function(){var _props2;(_props2=_this3.props)[lastEvent].apply(_props2,args);});}},{key:'render',value:function render(){return react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement('div',{id:'fullpage'},this.state.initialized?this.props.render(this):react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement('div',{className:'section'}));}}]);return ReactFullpage;}(react__WEBPACK_IMPORTED_MODULE_0___default.a.Component);/* harmony default export */ __webpack_exports__["default"] = (ReactFullpage); +case'afterLoad':state=makeState(fromArgs(['origin','destination','direction']));break;case'afterResize':state=makeState(fromArgs(['']));break;case'afterResponsive':state=makeState(fromArgs(['isResponsive']));break;case'afterSlideLoad':state=makeState(fromArgs(['section','origin','destination','direction']));break;// On-* +case'onLeave':state=makeState(fromArgs(['origin','destination','direction']));break;case'onSlideLeave':state=makeState(fromArgs(['section','origin','slideIndex','destination','direction']));break;default:break;}this.setState(state,function(){var _props;(_props=_this3.props)[lastEvent].apply(_props,args);});}},{key:'render',value:function render(){return react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement('div',{id:'fullpage'},this.props.render(this));}}]);return ReactFullpage;}(react__WEBPACK_IMPORTED_MODULE_0___default.a.Component);/* harmony default export */ __webpack_exports__["default"] = (ReactFullpage); /***/ }) /******/ ]); diff --git a/example/dist/index.html b/example/dist/index.html index 05d86f6..ef73178 100644 --- a/example/dist/index.html +++ b/example/dist/index.html @@ -9,9 +9,6 @@ - - -