From 5a4872b6c38d27151b355e920c7e18a3a518b84e Mon Sep 17 00:00:00 2001 From: Mikkel Hastrup Date: Fri, 5 Apr 2019 16:34:45 +0200 Subject: [PATCH 1/4] [FEATURE] nav-height-md variable for separating mobile nav-height with desktop one. --- Resources/Public/css/main.css | 22 ++++++++++++++-- Resources/Public/less/bootstrap.less | 1 + Resources/Public/less/main.less | 26 +++++++++++++++++-- .../dev/styles/customVariables.less | 1 + .../dev/styles/main/header/header.less | 25 ++++++++++++++++-- 5 files changed, 69 insertions(+), 6 deletions(-) diff --git a/Resources/Public/css/main.css b/Resources/Public/css/main.css index 55e57982..80b990fd 100644 --- a/Resources/Public/css/main.css +++ b/Resources/Public/css/main.css @@ -425,6 +425,11 @@ .main-navigation .header-top__language-menu-btn { line-height: 60px; } +@media (min-width: 992px) { + .main-navigation .header-top__language-menu-btn { + line-height: 300px; + } +} .main-navigation .header-top__language-menu-box { width: 100%; height: 100%; @@ -434,6 +439,11 @@ color: #fff; line-height: 60px; } +@media (min-width: 992px) { + .main-navigation .header-top__language-menu-box .header-top__language-menu-box-item { + line-height: 300px; + } +} .main-navigation .header-top__language-menu { display: none; } @@ -473,6 +483,7 @@ opacity: 0; visibility: hidden; transition: opacity 0.3s 0s, visibility 0s 0.3s; + height: 60px; } .main-navigation__search-box._header-top-search-btn._search-box-visible { opacity: 1; @@ -683,7 +694,7 @@ z-index: 7000; } .main-navigation-fixed .header { - padding-bottom: 60px; + padding-bottom: 300px; } .main-navigation__items-wrp { max-width: 970px; @@ -715,6 +726,7 @@ } .main-navigation__item-link { border: none; + line-height: 300px; } .main-navigation__open-sub-menu-link { display: none; @@ -834,7 +846,7 @@ color: rgba(255, 255, 255, 0.5); position: relative; font-size: 30px; - line-height: 60px; + line-height: 300px; top: auto; left: auto; margin: 0; @@ -896,6 +908,11 @@ margin: 0 auto; -webkit-tap-highlight-color: rgba(120, 120, 120, 0.3); } +@media (min-width: 992px) { + .main-navigation__search-btn { + height: 300px; + } +} .main-navigation__search-btn:after, .main-navigation__search-btn:before { content: ''; @@ -1042,6 +1059,7 @@ opacity: 0; visibility: hidden; transition: opacity 0.3s 0s, visibility 0s 0.3s; + height: 300px; } } @media (min-width: 1200px) { diff --git a/Resources/Public/less/bootstrap.less b/Resources/Public/less/bootstrap.less index f0f8a714..198c3ef2 100644 --- a/Resources/Public/less/bootstrap.less +++ b/Resources/Public/less/bootstrap.less @@ -907,6 +907,7 @@ // Navigation @nav-height: 60px; +@nav-height-md: 300px; @nav-link-color: #fff; @nav-link-hover-color: @nav-link-color; @nav-link-active-color: @main-color; diff --git a/Resources/Public/less/main.less b/Resources/Public/less/main.less index fcade3d1..49627ec9 100644 --- a/Resources/Public/less/main.less +++ b/Resources/Public/less/main.less @@ -2067,6 +2067,7 @@ // Navigation @nav-height: 60px; +@nav-height-md: 300px; @nav-link-color: #fff; @nav-link-hover-color: @nav-link-color; @nav-link-active-color: @main-color; @@ -2689,6 +2690,12 @@ line-height: @nav-height; } +@media (min-width: @screen-md-min) { + .main-navigation .header-top__language-menu-btn { + line-height: @nav-height-md; + } +} + .main-navigation .header-top__language-menu-box { width: 100%; height: 100%; @@ -2700,6 +2707,12 @@ line-height: @nav-height; } +@media (min-width: @screen-md-min) { + .main-navigation .header-top__language-menu-box .header-top__language-menu-box-item { + line-height: @nav-height-md; + } +} + .main-navigation .header-top__language-menu { display: none; } @@ -2747,6 +2760,7 @@ opacity: 0; visibility: hidden; transition: opacity 0.3s 0s, visibility 0s 0.3s; + height: @nav-height; } .main-navigation__search-box._header-top-search-btn._search-box-visible { @@ -3023,7 +3037,7 @@ } .main-navigation-fixed .header { - padding-bottom: @nav-height; + padding-bottom: @nav-height-md; } .main-navigation__items-wrp { @@ -3063,6 +3077,7 @@ .main-navigation__item-link { border: none; + line-height: @nav-height-md; } .main-navigation__open-sub-menu-link { @@ -3159,7 +3174,7 @@ color: @nav-link-arrow-color; position: relative; font-size: 30px; - line-height: @nav-height; + line-height: @nav-height-md; top: auto; left: auto; margin: 0; @@ -3236,6 +3251,12 @@ -webkit-tap-highlight-color: rgba(120, 120, 120, 0.3); } +@media (min-width: @screen-md-min) { + .main-navigation__search-btn { + height: @nav-height-md; + } +} + .main-navigation__search-btn:after, .main-navigation__search-btn:before { content: ''; @@ -3416,6 +3437,7 @@ opacity: 0; visibility: hidden; transition: opacity 0.3s 0s, visibility 0s 0.3s; + height: @nav-height-md; } } diff --git a/felayout_t3kit/dev/styles/customVariables.less b/felayout_t3kit/dev/styles/customVariables.less index 1fe8ba2f..958d75f4 100644 --- a/felayout_t3kit/dev/styles/customVariables.less +++ b/felayout_t3kit/dev/styles/customVariables.less @@ -37,6 +37,7 @@ // Navigation @nav-height: 60px; +@nav-height-md: 300px; @nav-link-color: #fff; @nav-link-hover-color: @nav-link-color; @nav-link-active-color: @main-color; diff --git a/felayout_t3kit/dev/styles/main/header/header.less b/felayout_t3kit/dev/styles/main/header/header.less index 0c243e62..35a19de9 100644 --- a/felayout_t3kit/dev/styles/main/header/header.less +++ b/felayout_t3kit/dev/styles/main/header/header.less @@ -391,6 +391,12 @@ line-height: @nav-height; } +@media (min-width: @screen-md-min) { + .main-navigation .header-top__language-menu-btn { + line-height: @nav-height-md; + } +} + .main-navigation .header-top__language-menu-box { width: 100%; height: 100%; @@ -402,6 +408,12 @@ line-height: @nav-height; } +@media (min-width: @screen-md-min) { + .main-navigation .header-top__language-menu-box .header-top__language-menu-box-item { + line-height: @nav-height-md; + } +} + .main-navigation .header-top__language-menu { display: none; } @@ -449,6 +461,7 @@ opacity: 0; visibility: hidden; transition: opacity 0.3s 0s, visibility 0s 0.3s; + height: @nav-height; } .main-navigation__search-box._header-top-search-btn._search-box-visible { @@ -725,7 +738,7 @@ } .main-navigation-fixed .header { - padding-bottom: @nav-height; + padding-bottom: @nav-height-md; } .main-navigation__items-wrp { @@ -765,6 +778,7 @@ .main-navigation__item-link { border: none; + line-height: @nav-height-md; } .main-navigation__open-sub-menu-link { @@ -861,7 +875,7 @@ color: @nav-link-arrow-color; position: relative; font-size: 30px; - line-height: @nav-height; + line-height: @nav-height-md; top: auto; left: auto; margin: 0; @@ -938,6 +952,12 @@ -webkit-tap-highlight-color: rgba(120, 120, 120, 0.3); } +@media (min-width: @screen-md-min) { + .main-navigation__search-btn { + height: @nav-height-md; + } +} + .main-navigation__search-btn:after, .main-navigation__search-btn:before { content: ''; @@ -1118,6 +1138,7 @@ opacity: 0; visibility: hidden; transition: opacity 0.3s 0s, visibility 0s 0.3s; + height: @nav-height-md; } } From 0f602371384f65963ce1fc566b1bb23c1cca52dd Mon Sep 17 00:00:00 2001 From: Mikkel Hastrup Date: Tue, 9 Apr 2019 10:54:25 +0200 Subject: [PATCH 2/4] [TASK] - fixed vertical positioning of language-menu checkbox in main-navigation. - fixed positioning of touch button in main-navigation - fixed positioning of small arrow in _open-sub-menu-link (main-navigation) when using dropdownColumns --- felayout_t3kit/dev/styles/customVariables.less | 2 +- felayout_t3kit/dev/styles/main/header/header.less | 14 +++++++++----- .../styles/main/nav/dropdownMenuWithColumns.less | 8 ++++---- 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/felayout_t3kit/dev/styles/customVariables.less b/felayout_t3kit/dev/styles/customVariables.less index 958d75f4..74fd2fb8 100644 --- a/felayout_t3kit/dev/styles/customVariables.less +++ b/felayout_t3kit/dev/styles/customVariables.less @@ -37,7 +37,7 @@ // Navigation @nav-height: 60px; -@nav-height-md: 300px; +@nav-height-md: @nav-height; // change to have unique nav-height in desktop @nav-link-color: #fff; @nav-link-hover-color: @nav-link-color; @nav-link-active-color: @main-color; diff --git a/felayout_t3kit/dev/styles/main/header/header.less b/felayout_t3kit/dev/styles/main/header/header.less index 35a19de9..a594bcd2 100644 --- a/felayout_t3kit/dev/styles/main/header/header.less +++ b/felayout_t3kit/dev/styles/main/header/header.less @@ -383,24 +383,29 @@ top: 1px; } -.main-navigation .header-top__language-menu-box-close-btn { - top: 5px; -} - .main-navigation .header-top__language-menu-btn { line-height: @nav-height; } +.main-navigation .header-top__language-menu-box-close-btn { + height: @nav-height; +} + @media (min-width: @screen-md-min) { .main-navigation .header-top__language-menu-btn { line-height: @nav-height-md; } + + .main-navigation .header-top__language-menu-box-close-btn { + height: @nav-height-md; + } } .main-navigation .header-top__language-menu-box { width: 100%; height: 100%; background-color: @nav-background-color; + border-bottom-width: 0; } .main-navigation .header-top__language-menu-box .header-top__language-menu-box-item { @@ -424,7 +429,6 @@ } ._header-top-search-btn .main-navigation__search-btn { - // height: 50px; height: @header-top-height; } diff --git a/felayout_t3kit/dev/styles/main/nav/dropdownMenuWithColumns.less b/felayout_t3kit/dev/styles/main/nav/dropdownMenuWithColumns.less index 5e6a127f..1388d3d0 100644 --- a/felayout_t3kit/dev/styles/main/nav/dropdownMenuWithColumns.less +++ b/felayout_t3kit/dev/styles/main/nav/dropdownMenuWithColumns.less @@ -64,7 +64,7 @@ ._dropdown-menu-with-columns .main-navigation__item._sub.open > .main-navigation__item-link:before { content: ''; position: absolute; - top: 52px; + bottom: 0; left: 50%; margin-left: -8px; width: 0; @@ -81,8 +81,8 @@ } .touch ._dropdown-menu-with-columns .tablet-arrow .main-navigation__open-sub-menu-link { - top: -@nav-height; - height: @nav-height; + top: -@nav-height-md; + height: @nav-height-md; } .touch ._dropdown-menu-with-columns .main-navigation__item._sub._open-tablet-dropdown > .main-navigation__item-link { @@ -96,7 +96,7 @@ .touch ._dropdown-menu-with-columns .main-navigation__item._sub._open-tablet-dropdown > .main-navigation__item-link:before { content: ''; position: absolute; - top: 52px; + bottom: 0; left: 50%; margin-left: -8px; width: 0; From 3eea729592184e04eee3e0f72140ac648d65e3a1 Mon Sep 17 00:00:00 2001 From: Mikkel Hastrup Date: Tue, 9 Apr 2019 10:55:39 +0200 Subject: [PATCH 3/4] [CHORE] grunt production --- Resources/Public/css/bootstrap.js | 898 +-- Resources/Public/css/components.js | 9147 +--------------------- Resources/Public/css/jquery.js | 10369 +------------------------ Resources/Public/css/main.css | 28 +- Resources/Public/css/main.js | 802 +- Resources/Public/less/bootstrap.js | 898 +-- Resources/Public/less/bootstrap.less | 2 +- Resources/Public/less/components.js | 9147 +--------------------- Resources/Public/less/jquery.js | 10369 +------------------------ Resources/Public/less/main.js | 802 +- Resources/Public/less/main.less | 24 +- 11 files changed, 39 insertions(+), 42447 deletions(-) diff --git a/Resources/Public/css/bootstrap.js b/Resources/Public/css/bootstrap.js index eed1f85a..47592d44 100644 --- a/Resources/Public/css/bootstrap.js +++ b/Resources/Public/css/bootstrap.js @@ -1,897 +1 @@ -// BOOTSTRAP -//========================================================== -/* ======================================================================== - * Bootstrap: transition.js v3.3.7 - * http://getbootstrap.com/javascript/#transitions - * ======================================================================== - * Copyright 2011-2016 Twitter, Inc. - * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) - * ======================================================================== */ - - -+function ($) { - 'use strict'; - - // CSS TRANSITION SUPPORT (Shoutout: http://www.modernizr.com/) - // ============================================================ - - function transitionEnd() { - var el = document.createElement('bootstrap') - - var transEndEventNames = { - WebkitTransition : 'webkitTransitionEnd', - MozTransition : 'transitionend', - OTransition : 'oTransitionEnd otransitionend', - transition : 'transitionend' - } - - for (var name in transEndEventNames) { - if (el.style[name] !== undefined) { - return { end: transEndEventNames[name] } - } - } - - return false // explicit for ie8 ( ._.) - } - - // http://blog.alexmaccaw.com/css-transitions - $.fn.emulateTransitionEnd = function (duration) { - var called = false - var $el = this - $(this).one('bsTransitionEnd', function () { called = true }) - var callback = function () { if (!called) $($el).trigger($.support.transition.end) } - setTimeout(callback, duration) - return this - } - - $(function () { - $.support.transition = transitionEnd() - - if (!$.support.transition) return - - $.event.special.bsTransitionEnd = { - bindType: $.support.transition.end, - delegateType: $.support.transition.end, - handle: function (e) { - if ($(e.target).is(this)) return e.handleObj.handler.apply(this, arguments) - } - } - }) - -}(jQuery); - -/* ======================================================================== - * Bootstrap: alert.js v3.3.7 - * http://getbootstrap.com/javascript/#alerts - * ======================================================================== - * Copyright 2011-2016 Twitter, Inc. - * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) - * ======================================================================== */ - - -+function ($) { - 'use strict'; - - // ALERT CLASS DEFINITION - // ====================== - - var dismiss = '[data-dismiss="alert"]' - var Alert = function (el) { - $(el).on('click', dismiss, this.close) - } - - Alert.VERSION = '3.3.7' - - Alert.TRANSITION_DURATION = 150 - - Alert.prototype.close = function (e) { - var $this = $(this) - var selector = $this.attr('data-target') - - if (!selector) { - selector = $this.attr('href') - selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7 - } - - var $parent = $(selector === '#' ? [] : selector) - - if (e) e.preventDefault() - - if (!$parent.length) { - $parent = $this.closest('.alert') - } - - $parent.trigger(e = $.Event('close.bs.alert')) - - if (e.isDefaultPrevented()) return - - $parent.removeClass('in') - - function removeElement() { - // detach from parent, fire event then clean up data - $parent.detach().trigger('closed.bs.alert').remove() - } - - $.support.transition && $parent.hasClass('fade') ? - $parent - .one('bsTransitionEnd', removeElement) - .emulateTransitionEnd(Alert.TRANSITION_DURATION) : - removeElement() - } - - - // ALERT PLUGIN DEFINITION - // ======================= - - function Plugin(option) { - return this.each(function () { - var $this = $(this) - var data = $this.data('bs.alert') - - if (!data) $this.data('bs.alert', (data = new Alert(this))) - if (typeof option == 'string') data[option].call($this) - }) - } - - var old = $.fn.alert - - $.fn.alert = Plugin - $.fn.alert.Constructor = Alert - - - // ALERT NO CONFLICT - // ================= - - $.fn.alert.noConflict = function () { - $.fn.alert = old - return this - } - - - // ALERT DATA-API - // ============== - - $(document).on('click.bs.alert.data-api', dismiss, Alert.prototype.close) - -}(jQuery); - -/* ======================================================================== - * Bootstrap: button.js v3.3.7 - * http://getbootstrap.com/javascript/#buttons - * ======================================================================== - * Copyright 2011-2016 Twitter, Inc. - * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) - * ======================================================================== */ - - -+function ($) { - 'use strict'; - - // BUTTON PUBLIC CLASS DEFINITION - // ============================== - - var Button = function (element, options) { - this.$element = $(element) - this.options = $.extend({}, Button.DEFAULTS, options) - this.isLoading = false - } - - Button.VERSION = '3.3.7' - - Button.DEFAULTS = { - loadingText: 'loading...' - } - - Button.prototype.setState = function (state) { - var d = 'disabled' - var $el = this.$element - var val = $el.is('input') ? 'val' : 'html' - var data = $el.data() - - state += 'Text' - - if (data.resetText == null) $el.data('resetText', $el[val]()) - - // push to event loop to allow forms to submit - setTimeout($.proxy(function () { - $el[val](data[state] == null ? this.options[state] : data[state]) - - if (state == 'loadingText') { - this.isLoading = true - $el.addClass(d).attr(d, d).prop(d, true) - } else if (this.isLoading) { - this.isLoading = false - $el.removeClass(d).removeAttr(d).prop(d, false) - } - }, this), 0) - } - - Button.prototype.toggle = function () { - var changed = true - var $parent = this.$element.closest('[data-toggle="buttons"]') - - if ($parent.length) { - var $input = this.$element.find('input') - if ($input.prop('type') == 'radio') { - if ($input.prop('checked')) changed = false - $parent.find('.active').removeClass('active') - this.$element.addClass('active') - } else if ($input.prop('type') == 'checkbox') { - if (($input.prop('checked')) !== this.$element.hasClass('active')) changed = false - this.$element.toggleClass('active') - } - $input.prop('checked', this.$element.hasClass('active')) - if (changed) $input.trigger('change') - } else { - this.$element.attr('aria-pressed', !this.$element.hasClass('active')) - this.$element.toggleClass('active') - } - } - - - // BUTTON PLUGIN DEFINITION - // ======================== - - function Plugin(option) { - return this.each(function () { - var $this = $(this) - var data = $this.data('bs.button') - var options = typeof option == 'object' && option - - if (!data) $this.data('bs.button', (data = new Button(this, options))) - - if (option == 'toggle') data.toggle() - else if (option) data.setState(option) - }) - } - - var old = $.fn.button - - $.fn.button = Plugin - $.fn.button.Constructor = Button - - - // BUTTON NO CONFLICT - // ================== - - $.fn.button.noConflict = function () { - $.fn.button = old - return this - } - - - // BUTTON DATA-API - // =============== - - $(document) - .on('click.bs.button.data-api', '[data-toggle^="button"]', function (e) { - var $btn = $(e.target).closest('.btn') - Plugin.call($btn, 'toggle') - if (!($(e.target).is('input[type="radio"], input[type="checkbox"]'))) { - // Prevent double click on radios, and the double selections (so cancellation) on checkboxes - e.preventDefault() - // The target component still receive the focus - if ($btn.is('input,button')) $btn.trigger('focus') - else $btn.find('input:visible,button:visible').first().trigger('focus') - } - }) - .on('focus.bs.button.data-api blur.bs.button.data-api', '[data-toggle^="button"]', function (e) { - $(e.target).closest('.btn').toggleClass('focus', /^focus(in)?$/.test(e.type)) - }) - -}(jQuery); - -/* ======================================================================== - * Bootstrap: carousel.js v3.3.7 - * http://getbootstrap.com/javascript/#carousel - * ======================================================================== - * Copyright 2011-2016 Twitter, Inc. - * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) - * ======================================================================== */ - - -+function ($) { - 'use strict'; - - // CAROUSEL CLASS DEFINITION - // ========================= - - var Carousel = function (element, options) { - this.$element = $(element) - this.$indicators = this.$element.find('.carousel-indicators') - this.options = options - this.paused = null - this.sliding = null - this.interval = null - this.$active = null - this.$items = null - - this.options.keyboard && this.$element.on('keydown.bs.carousel', $.proxy(this.keydown, this)) - - this.options.pause == 'hover' && !('ontouchstart' in document.documentElement) && this.$element - .on('mouseenter.bs.carousel', $.proxy(this.pause, this)) - .on('mouseleave.bs.carousel', $.proxy(this.cycle, this)) - } - - Carousel.VERSION = '3.3.7' - - Carousel.TRANSITION_DURATION = 600 - - Carousel.DEFAULTS = { - interval: 5000, - pause: 'hover', - wrap: true, - keyboard: true - } - - Carousel.prototype.keydown = function (e) { - if (/input|textarea/i.test(e.target.tagName)) return - switch (e.which) { - case 37: this.prev(); break - case 39: this.next(); break - default: return - } - - e.preventDefault() - } - - Carousel.prototype.cycle = function (e) { - e || (this.paused = false) - - this.interval && clearInterval(this.interval) - - this.options.interval - && !this.paused - && (this.interval = setInterval($.proxy(this.next, this), this.options.interval)) - - return this - } - - Carousel.prototype.getItemIndex = function (item) { - this.$items = item.parent().children('.item') - return this.$items.index(item || this.$active) - } - - Carousel.prototype.getItemForDirection = function (direction, active) { - var activeIndex = this.getItemIndex(active) - var willWrap = (direction == 'prev' && activeIndex === 0) - || (direction == 'next' && activeIndex == (this.$items.length - 1)) - if (willWrap && !this.options.wrap) return active - var delta = direction == 'prev' ? -1 : 1 - var itemIndex = (activeIndex + delta) % this.$items.length - return this.$items.eq(itemIndex) - } - - Carousel.prototype.to = function (pos) { - var that = this - var activeIndex = this.getItemIndex(this.$active = this.$element.find('.item.active')) - - if (pos > (this.$items.length - 1) || pos < 0) return - - if (this.sliding) return this.$element.one('slid.bs.carousel', function () { that.to(pos) }) // yes, "slid" - if (activeIndex == pos) return this.pause().cycle() - - return this.slide(pos > activeIndex ? 'next' : 'prev', this.$items.eq(pos)) - } - - Carousel.prototype.pause = function (e) { - e || (this.paused = true) - - if (this.$element.find('.next, .prev').length && $.support.transition) { - this.$element.trigger($.support.transition.end) - this.cycle(true) - } - - this.interval = clearInterval(this.interval) - - return this - } - - Carousel.prototype.next = function () { - if (this.sliding) return - return this.slide('next') - } - - Carousel.prototype.prev = function () { - if (this.sliding) return - return this.slide('prev') - } - - Carousel.prototype.slide = function (type, next) { - var $active = this.$element.find('.item.active') - var $next = next || this.getItemForDirection(type, $active) - var isCycling = this.interval - var direction = type == 'next' ? 'left' : 'right' - var that = this - - if ($next.hasClass('active')) return (this.sliding = false) - - var relatedTarget = $next[0] - var slideEvent = $.Event('slide.bs.carousel', { - relatedTarget: relatedTarget, - direction: direction - }) - this.$element.trigger(slideEvent) - if (slideEvent.isDefaultPrevented()) return - - this.sliding = true - - isCycling && this.pause() - - if (this.$indicators.length) { - this.$indicators.find('.active').removeClass('active') - var $nextIndicator = $(this.$indicators.children()[this.getItemIndex($next)]) - $nextIndicator && $nextIndicator.addClass('active') - } - - var slidEvent = $.Event('slid.bs.carousel', { relatedTarget: relatedTarget, direction: direction }) // yes, "slid" - if ($.support.transition && this.$element.hasClass('slide')) { - $next.addClass(type) - $next[0].offsetWidth // force reflow - $active.addClass(direction) - $next.addClass(direction) - $active - .one('bsTransitionEnd', function () { - $next.removeClass([type, direction].join(' ')).addClass('active') - $active.removeClass(['active', direction].join(' ')) - that.sliding = false - setTimeout(function () { - that.$element.trigger(slidEvent) - }, 0) - }) - .emulateTransitionEnd(Carousel.TRANSITION_DURATION) - } else { - $active.removeClass('active') - $next.addClass('active') - this.sliding = false - this.$element.trigger(slidEvent) - } - - isCycling && this.cycle() - - return this - } - - - // CAROUSEL PLUGIN DEFINITION - // ========================== - - function Plugin(option) { - return this.each(function () { - var $this = $(this) - var data = $this.data('bs.carousel') - var options = $.extend({}, Carousel.DEFAULTS, $this.data(), typeof option == 'object' && option) - var action = typeof option == 'string' ? option : options.slide - - if (!data) $this.data('bs.carousel', (data = new Carousel(this, options))) - if (typeof option == 'number') data.to(option) - else if (action) data[action]() - else if (options.interval) data.pause().cycle() - }) - } - - var old = $.fn.carousel - - $.fn.carousel = Plugin - $.fn.carousel.Constructor = Carousel - - - // CAROUSEL NO CONFLICT - // ==================== - - $.fn.carousel.noConflict = function () { - $.fn.carousel = old - return this - } - - - // CAROUSEL DATA-API - // ================= - - var clickHandler = function (e) { - var href - var $this = $(this) - var $target = $($this.attr('data-target') || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) // strip for ie7 - if (!$target.hasClass('carousel')) return - var options = $.extend({}, $target.data(), $this.data()) - var slideIndex = $this.attr('data-slide-to') - if (slideIndex) options.interval = false - - Plugin.call($target, options) - - if (slideIndex) { - $target.data('bs.carousel').to(slideIndex) - } - - e.preventDefault() - } - - $(document) - .on('click.bs.carousel.data-api', '[data-slide]', clickHandler) - .on('click.bs.carousel.data-api', '[data-slide-to]', clickHandler) - - $(window).on('load', function () { - $('[data-ride="carousel"]').each(function () { - var $carousel = $(this) - Plugin.call($carousel, $carousel.data()) - }) - }) - -}(jQuery); - -/* ======================================================================== - * Bootstrap: collapse.js v3.3.7 - * http://getbootstrap.com/javascript/#collapse - * ======================================================================== - * Copyright 2011-2016 Twitter, Inc. - * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) - * ======================================================================== */ - -/* jshint latedef: false */ - -+function ($) { - 'use strict'; - - // COLLAPSE PUBLIC CLASS DEFINITION - // ================================ - - var Collapse = function (element, options) { - this.$element = $(element) - this.options = $.extend({}, Collapse.DEFAULTS, options) - this.$trigger = $('[data-toggle="collapse"][href="#' + element.id + '"],' + - '[data-toggle="collapse"][data-target="#' + element.id + '"]') - this.transitioning = null - - if (this.options.parent) { - this.$parent = this.getParent() - } else { - this.addAriaAndCollapsedClass(this.$element, this.$trigger) - } - - if (this.options.toggle) this.toggle() - } - - Collapse.VERSION = '3.3.7' - - Collapse.TRANSITION_DURATION = 350 - - Collapse.DEFAULTS = { - toggle: true - } - - Collapse.prototype.dimension = function () { - var hasWidth = this.$element.hasClass('width') - return hasWidth ? 'width' : 'height' - } - - Collapse.prototype.show = function () { - if (this.transitioning || this.$element.hasClass('in')) return - - var activesData - var actives = this.$parent && this.$parent.children('.panel').children('.in, .collapsing') - - if (actives && actives.length) { - activesData = actives.data('bs.collapse') - if (activesData && activesData.transitioning) return - } - - var startEvent = $.Event('show.bs.collapse') - this.$element.trigger(startEvent) - if (startEvent.isDefaultPrevented()) return - - if (actives && actives.length) { - Plugin.call(actives, 'hide') - activesData || actives.data('bs.collapse', null) - } - - var dimension = this.dimension() - - this.$element - .removeClass('collapse') - .addClass('collapsing')[dimension](0) - .attr('aria-expanded', true) - - this.$trigger - .removeClass('collapsed') - .attr('aria-expanded', true) - - this.transitioning = 1 - - var complete = function () { - this.$element - .removeClass('collapsing') - .addClass('collapse in')[dimension]('') - this.transitioning = 0 - this.$element - .trigger('shown.bs.collapse') - } - - if (!$.support.transition) return complete.call(this) - - var scrollSize = $.camelCase(['scroll', dimension].join('-')) - - this.$element - .one('bsTransitionEnd', $.proxy(complete, this)) - .emulateTransitionEnd(Collapse.TRANSITION_DURATION)[dimension](this.$element[0][scrollSize]) - } - - Collapse.prototype.hide = function () { - if (this.transitioning || !this.$element.hasClass('in')) return - - var startEvent = $.Event('hide.bs.collapse') - this.$element.trigger(startEvent) - if (startEvent.isDefaultPrevented()) return - - var dimension = this.dimension() - - this.$element[dimension](this.$element[dimension]())[0].offsetHeight - - this.$element - .addClass('collapsing') - .removeClass('collapse in') - .attr('aria-expanded', false) - - this.$trigger - .addClass('collapsed') - .attr('aria-expanded', false) - - this.transitioning = 1 - - var complete = function () { - this.transitioning = 0 - this.$element - .removeClass('collapsing') - .addClass('collapse') - .trigger('hidden.bs.collapse') - } - - if (!$.support.transition) return complete.call(this) - - this.$element - [dimension](0) - .one('bsTransitionEnd', $.proxy(complete, this)) - .emulateTransitionEnd(Collapse.TRANSITION_DURATION) - } - - Collapse.prototype.toggle = function () { - this[this.$element.hasClass('in') ? 'hide' : 'show']() - } - - Collapse.prototype.getParent = function () { - return $(this.options.parent) - .find('[data-toggle="collapse"][data-parent="' + this.options.parent + '"]') - .each($.proxy(function (i, element) { - var $element = $(element) - this.addAriaAndCollapsedClass(getTargetFromTrigger($element), $element) - }, this)) - .end() - } - - Collapse.prototype.addAriaAndCollapsedClass = function ($element, $trigger) { - var isOpen = $element.hasClass('in') - - $element.attr('aria-expanded', isOpen) - $trigger - .toggleClass('collapsed', !isOpen) - .attr('aria-expanded', isOpen) - } - - function getTargetFromTrigger($trigger) { - var href - var target = $trigger.attr('data-target') - || (href = $trigger.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '') // strip for ie7 - - return $(target) - } - - - // COLLAPSE PLUGIN DEFINITION - // ========================== - - function Plugin(option) { - return this.each(function () { - var $this = $(this) - var data = $this.data('bs.collapse') - var options = $.extend({}, Collapse.DEFAULTS, $this.data(), typeof option == 'object' && option) - - if (!data && options.toggle && /show|hide/.test(option)) options.toggle = false - if (!data) $this.data('bs.collapse', (data = new Collapse(this, options))) - if (typeof option == 'string') data[option]() - }) - } - - var old = $.fn.collapse - - $.fn.collapse = Plugin - $.fn.collapse.Constructor = Collapse - - - // COLLAPSE NO CONFLICT - // ==================== - - $.fn.collapse.noConflict = function () { - $.fn.collapse = old - return this - } - - - // COLLAPSE DATA-API - // ================= - - $(document).on('click.bs.collapse.data-api', '[data-toggle="collapse"]', function (e) { - var $this = $(this) - - if (!$this.attr('data-target')) e.preventDefault() - - var $target = getTargetFromTrigger($this) - var data = $target.data('bs.collapse') - var option = data ? 'toggle' : $this.data() - - Plugin.call($target, option) - }) - -}(jQuery); - -// @import '../../node_modules/bootstrap/js/dropdown.js'; -// @import '../../node_modules/bootstrap/js/modal.js'; -// @import '../../node_modules/bootstrap/js/tooltip.js'; -// @import '../../node_modules/bootstrap/js/popover.js'; -// @import '../../node_modules/bootstrap/js/scrollspy.js'; -/* ======================================================================== - * Bootstrap: tab.js v3.3.7 - * http://getbootstrap.com/javascript/#tabs - * ======================================================================== - * Copyright 2011-2016 Twitter, Inc. - * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) - * ======================================================================== */ - - -+function ($) { - 'use strict'; - - // TAB CLASS DEFINITION - // ==================== - - var Tab = function (element) { - // jscs:disable requireDollarBeforejQueryAssignment - this.element = $(element) - // jscs:enable requireDollarBeforejQueryAssignment - } - - Tab.VERSION = '3.3.7' - - Tab.TRANSITION_DURATION = 150 - - Tab.prototype.show = function () { - var $this = this.element - var $ul = $this.closest('ul:not(.dropdown-menu)') - var selector = $this.data('target') - - if (!selector) { - selector = $this.attr('href') - selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7 - } - - if ($this.parent('li').hasClass('active')) return - - var $previous = $ul.find('.active:last a') - var hideEvent = $.Event('hide.bs.tab', { - relatedTarget: $this[0] - }) - var showEvent = $.Event('show.bs.tab', { - relatedTarget: $previous[0] - }) - - $previous.trigger(hideEvent) - $this.trigger(showEvent) - - if (showEvent.isDefaultPrevented() || hideEvent.isDefaultPrevented()) return - - var $target = $(selector) - - this.activate($this.closest('li'), $ul) - this.activate($target, $target.parent(), function () { - $previous.trigger({ - type: 'hidden.bs.tab', - relatedTarget: $this[0] - }) - $this.trigger({ - type: 'shown.bs.tab', - relatedTarget: $previous[0] - }) - }) - } - - Tab.prototype.activate = function (element, container, callback) { - var $active = container.find('> .active') - var transition = callback - && $.support.transition - && ($active.length && $active.hasClass('fade') || !!container.find('> .fade').length) - - function next() { - $active - .removeClass('active') - .find('> .dropdown-menu > .active') - .removeClass('active') - .end() - .find('[data-toggle="tab"]') - .attr('aria-expanded', false) - - element - .addClass('active') - .find('[data-toggle="tab"]') - .attr('aria-expanded', true) - - if (transition) { - element[0].offsetWidth // reflow for transition - element.addClass('in') - } else { - element.removeClass('fade') - } - - if (element.parent('.dropdown-menu').length) { - element - .closest('li.dropdown') - .addClass('active') - .end() - .find('[data-toggle="tab"]') - .attr('aria-expanded', true) - } - - callback && callback() - } - - $active.length && transition ? - $active - .one('bsTransitionEnd', next) - .emulateTransitionEnd(Tab.TRANSITION_DURATION) : - next() - - $active.removeClass('in') - } - - - // TAB PLUGIN DEFINITION - // ===================== - - function Plugin(option) { - return this.each(function () { - var $this = $(this) - var data = $this.data('bs.tab') - - if (!data) $this.data('bs.tab', (data = new Tab(this))) - if (typeof option == 'string') data[option]() - }) - } - - var old = $.fn.tab - - $.fn.tab = Plugin - $.fn.tab.Constructor = Tab - - - // TAB NO CONFLICT - // =============== - - $.fn.tab.noConflict = function () { - $.fn.tab = old - return this - } - - - // TAB DATA-API - // ============ - - var clickHandler = function (e) { - e.preventDefault() - Plugin.call($(this), 'show') - } - - $(document) - .on('click.bs.tab.data-api', '[data-toggle="tab"]', clickHandler) - .on('click.bs.tab.data-api', '[data-toggle="pill"]', clickHandler) - -}(jQuery); - -// @import '../../node_modules/bootstrap/js/affix.js'; -//========================================================== +!function(n){"use strict";n.fn.emulateTransitionEnd=function(t){var e=!1,i=this;n(this).one("bsTransitionEnd",function(){e=!0});return setTimeout(function(){e||n(i).trigger(n.support.transition.end)},t),this},n(function(){n.support.transition=function(){var t=document.createElement("bootstrap"),e={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"};for(var i in e)if(void 0!==t.style[i])return{end:e[i]};return!1}(),n.support.transition&&(n.event.special.bsTransitionEnd={bindType:n.support.transition.end,delegateType:n.support.transition.end,handle:function(t){if(n(t.target).is(this))return t.handleObj.handler.apply(this,arguments)}})})}(jQuery),function(s){"use strict";var e='[data-dismiss="alert"]',r=function(t){s(t).on("click",e,this.close)};r.VERSION="3.3.7",r.TRANSITION_DURATION=150,r.prototype.close=function(t){var e=s(this),i=e.attr("data-target");i||(i=(i=e.attr("href"))&&i.replace(/.*(?=#[^\s]*$)/,""));var n=s("#"===i?[]:i);function a(){n.detach().trigger("closed.bs.alert").remove()}t&&t.preventDefault(),n.length||(n=e.closest(".alert")),n.trigger(t=s.Event("close.bs.alert")),t.isDefaultPrevented()||(n.removeClass("in"),s.support.transition&&n.hasClass("fade")?n.one("bsTransitionEnd",a).emulateTransitionEnd(r.TRANSITION_DURATION):a())};var t=s.fn.alert;s.fn.alert=function(i){return this.each(function(){var t=s(this),e=t.data("bs.alert");e||t.data("bs.alert",e=new r(this)),"string"==typeof i&&e[i].call(t)})},s.fn.alert.Constructor=r,s.fn.alert.noConflict=function(){return s.fn.alert=t,this},s(document).on("click.bs.alert.data-api",e,r.prototype.close)}(jQuery),function(s){"use strict";var a=function(t,e){this.$element=s(t),this.options=s.extend({},a.DEFAULTS,e),this.isLoading=!1};function i(n){return this.each(function(){var t=s(this),e=t.data("bs.button"),i="object"==typeof n&&n;e||t.data("bs.button",e=new a(this,i)),"toggle"==n?e.toggle():n&&e.setState(n)})}a.VERSION="3.3.7",a.DEFAULTS={loadingText:"loading..."},a.prototype.setState=function(t){var e="disabled",i=this.$element,n=i.is("input")?"val":"html",a=i.data();t+="Text",null==a.resetText&&i.data("resetText",i[n]()),setTimeout(s.proxy(function(){i[n](null==a[t]?this.options[t]:a[t]),"loadingText"==t?(this.isLoading=!0,i.addClass(e).attr(e,e).prop(e,!0)):this.isLoading&&(this.isLoading=!1,i.removeClass(e).removeAttr(e).prop(e,!1))},this),0)},a.prototype.toggle=function(){var t=!0,e=this.$element.closest('[data-toggle="buttons"]');if(e.length){var i=this.$element.find("input");"radio"==i.prop("type")?(i.prop("checked")&&(t=!1),e.find(".active").removeClass("active"),this.$element.addClass("active")):"checkbox"==i.prop("type")&&(i.prop("checked")!==this.$element.hasClass("active")&&(t=!1),this.$element.toggleClass("active")),i.prop("checked",this.$element.hasClass("active")),t&&i.trigger("change")}else this.$element.attr("aria-pressed",!this.$element.hasClass("active")),this.$element.toggleClass("active")};var t=s.fn.button;s.fn.button=i,s.fn.button.Constructor=a,s.fn.button.noConflict=function(){return s.fn.button=t,this},s(document).on("click.bs.button.data-api",'[data-toggle^="button"]',function(t){var e=s(t.target).closest(".btn");i.call(e,"toggle"),s(t.target).is('input[type="radio"], input[type="checkbox"]')||(t.preventDefault(),e.is("input,button")?e.trigger("focus"):e.find("input:visible,button:visible").first().trigger("focus"))}).on("focus.bs.button.data-api blur.bs.button.data-api",'[data-toggle^="button"]',function(t){s(t.target).closest(".btn").toggleClass("focus",/^focus(in)?$/.test(t.type))})}(jQuery),function(h){"use strict";var u=function(t,e){this.$element=h(t),this.$indicators=this.$element.find(".carousel-indicators"),this.options=e,this.paused=null,this.sliding=null,this.interval=null,this.$active=null,this.$items=null,this.options.keyboard&&this.$element.on("keydown.bs.carousel",h.proxy(this.keydown,this)),"hover"==this.options.pause&&!("ontouchstart"in document.documentElement)&&this.$element.on("mouseenter.bs.carousel",h.proxy(this.pause,this)).on("mouseleave.bs.carousel",h.proxy(this.cycle,this))};function r(a){return this.each(function(){var t=h(this),e=t.data("bs.carousel"),i=h.extend({},u.DEFAULTS,t.data(),"object"==typeof a&&a),n="string"==typeof a?a:i.slide;e||t.data("bs.carousel",e=new u(this,i)),"number"==typeof a?e.to(a):n?e[n]():i.interval&&e.pause().cycle()})}u.VERSION="3.3.7",u.TRANSITION_DURATION=600,u.DEFAULTS={interval:5e3,pause:"hover",wrap:!0,keyboard:!0},u.prototype.keydown=function(t){if(!/input|textarea/i.test(t.target.tagName)){switch(t.which){case 37:this.prev();break;case 39:this.next();break;default:return}t.preventDefault()}},u.prototype.cycle=function(t){return t||(this.paused=!1),this.interval&&clearInterval(this.interval),this.options.interval&&!this.paused&&(this.interval=setInterval(h.proxy(this.next,this),this.options.interval)),this},u.prototype.getItemIndex=function(t){return this.$items=t.parent().children(".item"),this.$items.index(t||this.$active)},u.prototype.getItemForDirection=function(t,e){var i=this.getItemIndex(e);if(("prev"==t&&0===i||"next"==t&&i==this.$items.length-1)&&!this.options.wrap)return e;var n=(i+("prev"==t?-1:1))%this.$items.length;return this.$items.eq(n)},u.prototype.to=function(t){var e=this,i=this.getItemIndex(this.$active=this.$element.find(".item.active"));if(!(t>this.$items.length-1||t<0))return this.sliding?this.$element.one("slid.bs.carousel",function(){e.to(t)}):i==t?this.pause().cycle():this.slide(i .active"),a=i&&o.support.transition&&(n.length&&n.hasClass("fade")||!!e.find("> .fade").length);function s(){n.removeClass("active").find("> .dropdown-menu > .active").removeClass("active").end().find('[data-toggle="tab"]').attr("aria-expanded",!1),t.addClass("active").find('[data-toggle="tab"]').attr("aria-expanded",!0),a?(t[0].offsetWidth,t.addClass("in")):t.removeClass("fade"),t.parent(".dropdown-menu").length&&t.closest("li.dropdown").addClass("active").end().find('[data-toggle="tab"]').attr("aria-expanded",!0),i&&i()}n.length&&a?n.one("bsTransitionEnd",s).emulateTransitionEnd(r.TRANSITION_DURATION):s(),n.removeClass("in")};var t=o.fn.tab;o.fn.tab=e,o.fn.tab.Constructor=r,o.fn.tab.noConflict=function(){return o.fn.tab=t,this};var i=function(t){t.preventDefault(),e.call(o(this),"show")};o(document).on("click.bs.tab.data-api",'[data-toggle="tab"]',i).on("click.bs.tab.data-api",'[data-toggle="pill"]',i)}(jQuery); \ No newline at end of file diff --git a/Resources/Public/css/components.js b/Resources/Public/css/components.js index db107911..3bbcf0d8 100644 --- a/Resources/Public/css/components.js +++ b/Resources/Public/css/components.js @@ -1,9146 +1 @@ -// Components - -// Swiper -//============================================================================== -/** - * Swiper 3.4.2 - * Most modern mobile touch slider and framework with hardware accelerated transitions - * - * http://www.idangero.us/swiper/ - * - * Copyright 2017, Vladimir Kharlampidi - * The iDangero.us - * http://www.idangero.us/ - * - * Licensed under MIT - * - * Released on: March 10, 2017 - */ -(function () { - 'use strict'; - var $; - - /*=========================== - Swiper - ===========================*/ - var Swiper = function (container, params) { - if (!(this instanceof Swiper)) return new Swiper(container, params); - - - var defaults = { - direction: 'horizontal', - touchEventsTarget: 'container', - initialSlide: 0, - speed: 300, - // autoplay - autoplay: false, - autoplayDisableOnInteraction: true, - autoplayStopOnLast: false, - // To support iOS's swipe-to-go-back gesture (when being used in-app, with UIWebView). - iOSEdgeSwipeDetection: false, - iOSEdgeSwipeThreshold: 20, - // Free mode - freeMode: false, - freeModeMomentum: true, - freeModeMomentumRatio: 1, - freeModeMomentumBounce: true, - freeModeMomentumBounceRatio: 1, - freeModeMomentumVelocityRatio: 1, - freeModeSticky: false, - freeModeMinimumVelocity: 0.02, - // Autoheight - autoHeight: false, - // Set wrapper width - setWrapperSize: false, - // Virtual Translate - virtualTranslate: false, - // Effects - effect: 'slide', // 'slide' or 'fade' or 'cube' or 'coverflow' or 'flip' - coverflow: { - rotate: 50, - stretch: 0, - depth: 100, - modifier: 1, - slideShadows : true - }, - flip: { - slideShadows : true, - limitRotation: true - }, - cube: { - slideShadows: true, - shadow: true, - shadowOffset: 20, - shadowScale: 0.94 - }, - fade: { - crossFade: false - }, - // Parallax - parallax: false, - // Zoom - zoom: false, - zoomMax: 3, - zoomMin: 1, - zoomToggle: true, - // Scrollbar - scrollbar: null, - scrollbarHide: true, - scrollbarDraggable: false, - scrollbarSnapOnRelease: false, - // Keyboard Mousewheel - keyboardControl: false, - mousewheelControl: false, - mousewheelReleaseOnEdges: false, - mousewheelInvert: false, - mousewheelForceToAxis: false, - mousewheelSensitivity: 1, - mousewheelEventsTarged: 'container', - // Hash Navigation - hashnav: false, - hashnavWatchState: false, - // History - history: false, - // Commong Nav State - replaceState: false, - // Breakpoints - breakpoints: undefined, - // Slides grid - spaceBetween: 0, - slidesPerView: 1, - slidesPerColumn: 1, - slidesPerColumnFill: 'column', - slidesPerGroup: 1, - centeredSlides: false, - slidesOffsetBefore: 0, // in px - slidesOffsetAfter: 0, // in px - // Round length - roundLengths: false, - // Touches - touchRatio: 1, - touchAngle: 45, - simulateTouch: true, - shortSwipes: true, - longSwipes: true, - longSwipesRatio: 0.5, - longSwipesMs: 300, - followFinger: true, - onlyExternal: false, - threshold: 0, - touchMoveStopPropagation: true, - touchReleaseOnEdges: false, - // Unique Navigation Elements - uniqueNavElements: true, - // Pagination - pagination: null, - paginationElement: 'span', - paginationClickable: false, - paginationHide: false, - paginationBulletRender: null, - paginationProgressRender: null, - paginationFractionRender: null, - paginationCustomRender: null, - paginationType: 'bullets', // 'bullets' or 'progress' or 'fraction' or 'custom' - // Resistance - resistance: true, - resistanceRatio: 0.85, - // Next/prev buttons - nextButton: null, - prevButton: null, - // Progress - watchSlidesProgress: false, - watchSlidesVisibility: false, - // Cursor - grabCursor: false, - // Clicks - preventClicks: true, - preventClicksPropagation: true, - slideToClickedSlide: false, - // Lazy Loading - lazyLoading: false, - lazyLoadingInPrevNext: false, - lazyLoadingInPrevNextAmount: 1, - lazyLoadingOnTransitionStart: false, - // Images - preloadImages: true, - updateOnImagesReady: true, - // loop - loop: false, - loopAdditionalSlides: 0, - loopedSlides: null, - // Control - control: undefined, - controlInverse: false, - controlBy: 'slide', //or 'container' - normalizeSlideIndex: true, - // Swiping/no swiping - allowSwipeToPrev: true, - allowSwipeToNext: true, - swipeHandler: null, //'.swipe-handler', - noSwiping: true, - noSwipingClass: 'swiper-no-swiping', - // Passive Listeners - passiveListeners: true, - // NS - containerModifierClass: 'swiper-container-', // NEW - slideClass: 'swiper-slide', - slideActiveClass: 'swiper-slide-active', - slideDuplicateActiveClass: 'swiper-slide-duplicate-active', - slideVisibleClass: 'swiper-slide-visible', - slideDuplicateClass: 'swiper-slide-duplicate', - slideNextClass: 'swiper-slide-next', - slideDuplicateNextClass: 'swiper-slide-duplicate-next', - slidePrevClass: 'swiper-slide-prev', - slideDuplicatePrevClass: 'swiper-slide-duplicate-prev', - wrapperClass: 'swiper-wrapper', - bulletClass: 'swiper-pagination-bullet', - bulletActiveClass: 'swiper-pagination-bullet-active', - buttonDisabledClass: 'swiper-button-disabled', - paginationCurrentClass: 'swiper-pagination-current', - paginationTotalClass: 'swiper-pagination-total', - paginationHiddenClass: 'swiper-pagination-hidden', - paginationProgressbarClass: 'swiper-pagination-progressbar', - paginationClickableClass: 'swiper-pagination-clickable', // NEW - paginationModifierClass: 'swiper-pagination-', // NEW - lazyLoadingClass: 'swiper-lazy', - lazyStatusLoadingClass: 'swiper-lazy-loading', - lazyStatusLoadedClass: 'swiper-lazy-loaded', - lazyPreloaderClass: 'swiper-lazy-preloader', - notificationClass: 'swiper-notification', - preloaderClass: 'preloader', - zoomContainerClass: 'swiper-zoom-container', - - // Observer - observer: false, - observeParents: false, - // Accessibility - a11y: false, - prevSlideMessage: 'Previous slide', - nextSlideMessage: 'Next slide', - firstSlideMessage: 'This is the first slide', - lastSlideMessage: 'This is the last slide', - paginationBulletMessage: 'Go to slide {{index}}', - // Callbacks - runCallbacksOnInit: true - /* - Callbacks: - onInit: function (swiper) - onDestroy: function (swiper) - onBeforeResize: function (swiper) - onAfterResize: function (swiper) - onClick: function (swiper, e) - onTap: function (swiper, e) - onDoubleTap: function (swiper, e) - onSliderMove: function (swiper, e) - onSlideChangeStart: function (swiper) - onSlideChangeEnd: function (swiper) - onTransitionStart: function (swiper) - onTransitionEnd: function (swiper) - onImagesReady: function (swiper) - onProgress: function (swiper, progress) - onTouchStart: function (swiper, e) - onTouchMove: function (swiper, e) - onTouchMoveOpposite: function (swiper, e) - onTouchEnd: function (swiper, e) - onReachBeginning: function (swiper) - onReachEnd: function (swiper) - onSetTransition: function (swiper, duration) - onSetTranslate: function (swiper, translate) - onAutoplayStart: function (swiper) - onAutoplayStop: function (swiper), - onLazyImageLoad: function (swiper, slide, image) - onLazyImageReady: function (swiper, slide, image) - onKeyPress: function (swiper, keyCode) - */ - - }; - var initialVirtualTranslate = params && params.virtualTranslate; - - params = params || {}; - var originalParams = {}; - for (var param in params) { - if (typeof params[param] === 'object' && params[param] !== null && !(params[param].nodeType || params[param] === window || params[param] === document || (typeof Dom7 !== 'undefined' && params[param] instanceof Dom7) || (typeof jQuery !== 'undefined' && params[param] instanceof jQuery))) { - originalParams[param] = {}; - for (var deepParam in params[param]) { - originalParams[param][deepParam] = params[param][deepParam]; - } - } - else { - originalParams[param] = params[param]; - } - } - for (var def in defaults) { - if (typeof params[def] === 'undefined') { - params[def] = defaults[def]; - } - else if (typeof params[def] === 'object') { - for (var deepDef in defaults[def]) { - if (typeof params[def][deepDef] === 'undefined') { - params[def][deepDef] = defaults[def][deepDef]; - } - } - } - } - - // Swiper - var s = this; - - // Params - s.params = params; - s.originalParams = originalParams; - - // Classname - s.classNames = []; - /*========================= - Dom Library and plugins - ===========================*/ - if (typeof $ !== 'undefined' && typeof Dom7 !== 'undefined'){ - $ = Dom7; - } - if (typeof $ === 'undefined') { - if (typeof Dom7 === 'undefined') { - $ = window.Dom7 || window.Zepto || window.jQuery; - } - else { - $ = Dom7; - } - if (!$) return; - } - // Export it to Swiper instance - s.$ = $; - - /*========================= - Breakpoints - ===========================*/ - s.currentBreakpoint = undefined; - s.getActiveBreakpoint = function () { - //Get breakpoint for window width - if (!s.params.breakpoints) return false; - var breakpoint = false; - var points = [], point; - for ( point in s.params.breakpoints ) { - if (s.params.breakpoints.hasOwnProperty(point)) { - points.push(point); - } - } - points.sort(function (a, b) { - return parseInt(a, 10) > parseInt(b, 10); - }); - for (var i = 0; i < points.length; i++) { - point = points[i]; - if (point >= window.innerWidth && !breakpoint) { - breakpoint = point; - } - } - return breakpoint || 'max'; - }; - s.setBreakpoint = function () { - //Set breakpoint for window width and update parameters - var breakpoint = s.getActiveBreakpoint(); - if (breakpoint && s.currentBreakpoint !== breakpoint) { - var breakPointsParams = breakpoint in s.params.breakpoints ? s.params.breakpoints[breakpoint] : s.originalParams; - var needsReLoop = s.params.loop && (breakPointsParams.slidesPerView !== s.params.slidesPerView); - for ( var param in breakPointsParams ) { - s.params[param] = breakPointsParams[param]; - } - s.currentBreakpoint = breakpoint; - if(needsReLoop && s.destroyLoop) { - s.reLoop(true); - } - } - }; - // Set breakpoint on load - if (s.params.breakpoints) { - s.setBreakpoint(); - } - - /*========================= - Preparation - Define Container, Wrapper and Pagination - ===========================*/ - s.container = $(container); - if (s.container.length === 0) return; - if (s.container.length > 1) { - var swipers = []; - s.container.each(function () { - var container = this; - swipers.push(new Swiper(this, params)); - }); - return swipers; - } - - // Save instance in container HTML Element and in data - s.container[0].swiper = s; - s.container.data('swiper', s); - - s.classNames.push(s.params.containerModifierClass + s.params.direction); - - if (s.params.freeMode) { - s.classNames.push(s.params.containerModifierClass + 'free-mode'); - } - if (!s.support.flexbox) { - s.classNames.push(s.params.containerModifierClass + 'no-flexbox'); - s.params.slidesPerColumn = 1; - } - if (s.params.autoHeight) { - s.classNames.push(s.params.containerModifierClass + 'autoheight'); - } - // Enable slides progress when required - if (s.params.parallax || s.params.watchSlidesVisibility) { - s.params.watchSlidesProgress = true; - } - // Max resistance when touchReleaseOnEdges - if (s.params.touchReleaseOnEdges) { - s.params.resistanceRatio = 0; - } - // Coverflow / 3D - if (['cube', 'coverflow', 'flip'].indexOf(s.params.effect) >= 0) { - if (s.support.transforms3d) { - s.params.watchSlidesProgress = true; - s.classNames.push(s.params.containerModifierClass + '3d'); - } - else { - s.params.effect = 'slide'; - } - } - if (s.params.effect !== 'slide') { - s.classNames.push(s.params.containerModifierClass + s.params.effect); - } - if (s.params.effect === 'cube') { - s.params.resistanceRatio = 0; - s.params.slidesPerView = 1; - s.params.slidesPerColumn = 1; - s.params.slidesPerGroup = 1; - s.params.centeredSlides = false; - s.params.spaceBetween = 0; - s.params.virtualTranslate = true; - } - if (s.params.effect === 'fade' || s.params.effect === 'flip') { - s.params.slidesPerView = 1; - s.params.slidesPerColumn = 1; - s.params.slidesPerGroup = 1; - s.params.watchSlidesProgress = true; - s.params.spaceBetween = 0; - if (typeof initialVirtualTranslate === 'undefined') { - s.params.virtualTranslate = true; - } - } - - // Grab Cursor - if (s.params.grabCursor && s.support.touch) { - s.params.grabCursor = false; - } - - // Wrapper - s.wrapper = s.container.children('.' + s.params.wrapperClass); - - // Pagination - if (s.params.pagination) { - s.paginationContainer = $(s.params.pagination); - if (s.params.uniqueNavElements && typeof s.params.pagination === 'string' && s.paginationContainer.length > 1 && s.container.find(s.params.pagination).length === 1) { - s.paginationContainer = s.container.find(s.params.pagination); - } - - if (s.params.paginationType === 'bullets' && s.params.paginationClickable) { - s.paginationContainer.addClass(s.params.paginationModifierClass + 'clickable'); - } - else { - s.params.paginationClickable = false; - } - s.paginationContainer.addClass(s.params.paginationModifierClass + s.params.paginationType); - } - // Next/Prev Buttons - if (s.params.nextButton || s.params.prevButton) { - if (s.params.nextButton) { - s.nextButton = $(s.params.nextButton); - if (s.params.uniqueNavElements && typeof s.params.nextButton === 'string' && s.nextButton.length > 1 && s.container.find(s.params.nextButton).length === 1) { - s.nextButton = s.container.find(s.params.nextButton); - } - } - if (s.params.prevButton) { - s.prevButton = $(s.params.prevButton); - if (s.params.uniqueNavElements && typeof s.params.prevButton === 'string' && s.prevButton.length > 1 && s.container.find(s.params.prevButton).length === 1) { - s.prevButton = s.container.find(s.params.prevButton); - } - } - } - - // Is Horizontal - s.isHorizontal = function () { - return s.params.direction === 'horizontal'; - }; - // s.isH = isH; - - // RTL - s.rtl = s.isHorizontal() && (s.container[0].dir.toLowerCase() === 'rtl' || s.container.css('direction') === 'rtl'); - if (s.rtl) { - s.classNames.push(s.params.containerModifierClass + 'rtl'); - } - - // Wrong RTL support - if (s.rtl) { - s.wrongRTL = s.wrapper.css('display') === '-webkit-box'; - } - - // Columns - if (s.params.slidesPerColumn > 1) { - s.classNames.push(s.params.containerModifierClass + 'multirow'); - } - - // Check for Android - if (s.device.android) { - s.classNames.push(s.params.containerModifierClass + 'android'); - } - - // Add classes - s.container.addClass(s.classNames.join(' ')); - - // Translate - s.translate = 0; - - // Progress - s.progress = 0; - - // Velocity - s.velocity = 0; - - /*========================= - Locks, unlocks - ===========================*/ - s.lockSwipeToNext = function () { - s.params.allowSwipeToNext = false; - if (s.params.allowSwipeToPrev === false && s.params.grabCursor) { - s.unsetGrabCursor(); - } - }; - s.lockSwipeToPrev = function () { - s.params.allowSwipeToPrev = false; - if (s.params.allowSwipeToNext === false && s.params.grabCursor) { - s.unsetGrabCursor(); - } - }; - s.lockSwipes = function () { - s.params.allowSwipeToNext = s.params.allowSwipeToPrev = false; - if (s.params.grabCursor) s.unsetGrabCursor(); - }; - s.unlockSwipeToNext = function () { - s.params.allowSwipeToNext = true; - if (s.params.allowSwipeToPrev === true && s.params.grabCursor) { - s.setGrabCursor(); - } - }; - s.unlockSwipeToPrev = function () { - s.params.allowSwipeToPrev = true; - if (s.params.allowSwipeToNext === true && s.params.grabCursor) { - s.setGrabCursor(); - } - }; - s.unlockSwipes = function () { - s.params.allowSwipeToNext = s.params.allowSwipeToPrev = true; - if (s.params.grabCursor) s.setGrabCursor(); - }; - - /*========================= - Round helper - ===========================*/ - function round(a) { - return Math.floor(a); - } - /*========================= - Set grab cursor - ===========================*/ - s.setGrabCursor = function(moving) { - s.container[0].style.cursor = 'move'; - s.container[0].style.cursor = moving ? '-webkit-grabbing' : '-webkit-grab'; - s.container[0].style.cursor = moving ? '-moz-grabbin' : '-moz-grab'; - s.container[0].style.cursor = moving ? 'grabbing': 'grab'; - }; - s.unsetGrabCursor = function () { - s.container[0].style.cursor = ''; - }; - if (s.params.grabCursor) { - s.setGrabCursor(); - } - /*========================= - Update on Images Ready - ===========================*/ - s.imagesToLoad = []; - s.imagesLoaded = 0; - - s.loadImage = function (imgElement, src, srcset, sizes, checkForComplete, callback) { - var image; - function onReady () { - if (callback) callback(); - } - if (!imgElement.complete || !checkForComplete) { - if (src) { - image = new window.Image(); - image.onload = onReady; - image.onerror = onReady; - if (sizes) { - image.sizes = sizes; - } - if (srcset) { - image.srcset = srcset; - } - if (src) { - image.src = src; - } - } else { - onReady(); - } - - } else {//image already loaded... - onReady(); - } - }; - s.preloadImages = function () { - s.imagesToLoad = s.container.find('img'); - function _onReady() { - if (typeof s === 'undefined' || s === null || !s) return; - if (s.imagesLoaded !== undefined) s.imagesLoaded++; - if (s.imagesLoaded === s.imagesToLoad.length) { - if (s.params.updateOnImagesReady) s.update(); - s.emit('onImagesReady', s); - } - } - for (var i = 0; i < s.imagesToLoad.length; i++) { - s.loadImage(s.imagesToLoad[i], (s.imagesToLoad[i].currentSrc || s.imagesToLoad[i].getAttribute('src')), (s.imagesToLoad[i].srcset || s.imagesToLoad[i].getAttribute('srcset')), s.imagesToLoad[i].sizes || s.imagesToLoad[i].getAttribute('sizes'), true, _onReady); - } - }; - - /*========================= - Autoplay - ===========================*/ - s.autoplayTimeoutId = undefined; - s.autoplaying = false; - s.autoplayPaused = false; - function autoplay() { - var autoplayDelay = s.params.autoplay; - var activeSlide = s.slides.eq(s.activeIndex); - if (activeSlide.attr('data-swiper-autoplay')) { - autoplayDelay = activeSlide.attr('data-swiper-autoplay') || s.params.autoplay; - } - s.autoplayTimeoutId = setTimeout(function () { - if (s.params.loop) { - s.fixLoop(); - s._slideNext(); - s.emit('onAutoplay', s); - } - else { - if (!s.isEnd) { - s._slideNext(); - s.emit('onAutoplay', s); - } - else { - if (!params.autoplayStopOnLast) { - s._slideTo(0); - s.emit('onAutoplay', s); - } - else { - s.stopAutoplay(); - } - } - } - }, autoplayDelay); - } - s.startAutoplay = function () { - if (typeof s.autoplayTimeoutId !== 'undefined') return false; - if (!s.params.autoplay) return false; - if (s.autoplaying) return false; - s.autoplaying = true; - s.emit('onAutoplayStart', s); - autoplay(); - }; - s.stopAutoplay = function (internal) { - if (!s.autoplayTimeoutId) return; - if (s.autoplayTimeoutId) clearTimeout(s.autoplayTimeoutId); - s.autoplaying = false; - s.autoplayTimeoutId = undefined; - s.emit('onAutoplayStop', s); - }; - s.pauseAutoplay = function (speed) { - if (s.autoplayPaused) return; - if (s.autoplayTimeoutId) clearTimeout(s.autoplayTimeoutId); - s.autoplayPaused = true; - if (speed === 0) { - s.autoplayPaused = false; - autoplay(); - } - else { - s.wrapper.transitionEnd(function () { - if (!s) return; - s.autoplayPaused = false; - if (!s.autoplaying) { - s.stopAutoplay(); - } - else { - autoplay(); - } - }); - } - }; - /*========================= - Min/Max Translate - ===========================*/ - s.minTranslate = function () { - return (-s.snapGrid[0]); - }; - s.maxTranslate = function () { - return (-s.snapGrid[s.snapGrid.length - 1]); - }; - /*========================= - Slider/slides sizes - ===========================*/ - s.updateAutoHeight = function () { - var activeSlides = []; - var newHeight = 0; - var i; - - // Find slides currently in view - if(s.params.slidesPerView !== 'auto' && s.params.slidesPerView > 1) { - for (i = 0; i < Math.ceil(s.params.slidesPerView); i++) { - var index = s.activeIndex + i; - if(index > s.slides.length) break; - activeSlides.push(s.slides.eq(index)[0]); - } - } else { - activeSlides.push(s.slides.eq(s.activeIndex)[0]); - } - - // Find new height from heighest slide in view - for (i = 0; i < activeSlides.length; i++) { - if (typeof activeSlides[i] !== 'undefined') { - var height = activeSlides[i].offsetHeight; - newHeight = height > newHeight ? height : newHeight; - } - } - - // Update Height - if (newHeight) s.wrapper.css('height', newHeight + 'px'); - }; - s.updateContainerSize = function () { - var width, height; - if (typeof s.params.width !== 'undefined') { - width = s.params.width; - } - else { - width = s.container[0].clientWidth; - } - if (typeof s.params.height !== 'undefined') { - height = s.params.height; - } - else { - height = s.container[0].clientHeight; - } - if (width === 0 && s.isHorizontal() || height === 0 && !s.isHorizontal()) { - return; - } - - //Subtract paddings - width = width - parseInt(s.container.css('padding-left'), 10) - parseInt(s.container.css('padding-right'), 10); - height = height - parseInt(s.container.css('padding-top'), 10) - parseInt(s.container.css('padding-bottom'), 10); - - // Store values - s.width = width; - s.height = height; - s.size = s.isHorizontal() ? s.width : s.height; - }; - - s.updateSlidesSize = function () { - s.slides = s.wrapper.children('.' + s.params.slideClass); - s.snapGrid = []; - s.slidesGrid = []; - s.slidesSizesGrid = []; - - var spaceBetween = s.params.spaceBetween, - slidePosition = -s.params.slidesOffsetBefore, - i, - prevSlideSize = 0, - index = 0; - if (typeof s.size === 'undefined') return; - if (typeof spaceBetween === 'string' && spaceBetween.indexOf('%') >= 0) { - spaceBetween = parseFloat(spaceBetween.replace('%', '')) / 100 * s.size; - } - - s.virtualSize = -spaceBetween; - // reset margins - if (s.rtl) s.slides.css({marginLeft: '', marginTop: ''}); - else s.slides.css({marginRight: '', marginBottom: ''}); - - var slidesNumberEvenToRows; - if (s.params.slidesPerColumn > 1) { - if (Math.floor(s.slides.length / s.params.slidesPerColumn) === s.slides.length / s.params.slidesPerColumn) { - slidesNumberEvenToRows = s.slides.length; - } - else { - slidesNumberEvenToRows = Math.ceil(s.slides.length / s.params.slidesPerColumn) * s.params.slidesPerColumn; - } - if (s.params.slidesPerView !== 'auto' && s.params.slidesPerColumnFill === 'row') { - slidesNumberEvenToRows = Math.max(slidesNumberEvenToRows, s.params.slidesPerView * s.params.slidesPerColumn); - } - } - - // Calc slides - var slideSize; - var slidesPerColumn = s.params.slidesPerColumn; - var slidesPerRow = slidesNumberEvenToRows / slidesPerColumn; - var numFullColumns = slidesPerRow - (s.params.slidesPerColumn * slidesPerRow - s.slides.length); - for (i = 0; i < s.slides.length; i++) { - slideSize = 0; - var slide = s.slides.eq(i); - if (s.params.slidesPerColumn > 1) { - // Set slides order - var newSlideOrderIndex; - var column, row; - if (s.params.slidesPerColumnFill === 'column') { - column = Math.floor(i / slidesPerColumn); - row = i - column * slidesPerColumn; - if (column > numFullColumns || (column === numFullColumns && row === slidesPerColumn-1)) { - if (++row >= slidesPerColumn) { - row = 0; - column++; - } - } - newSlideOrderIndex = column + row * slidesNumberEvenToRows / slidesPerColumn; - slide - .css({ - '-webkit-box-ordinal-group': newSlideOrderIndex, - '-moz-box-ordinal-group': newSlideOrderIndex, - '-ms-flex-order': newSlideOrderIndex, - '-webkit-order': newSlideOrderIndex, - 'order': newSlideOrderIndex - }); - } - else { - row = Math.floor(i / slidesPerRow); - column = i - row * slidesPerRow; - } - slide - .css( - 'margin-' + (s.isHorizontal() ? 'top' : 'left'), - (row !== 0 && s.params.spaceBetween) && (s.params.spaceBetween + 'px') - ) - .attr('data-swiper-column', column) - .attr('data-swiper-row', row); - - } - if (slide.css('display') === 'none') continue; - if (s.params.slidesPerView === 'auto') { - slideSize = s.isHorizontal() ? slide.outerWidth(true) : slide.outerHeight(true); - if (s.params.roundLengths) slideSize = round(slideSize); - } - else { - slideSize = (s.size - (s.params.slidesPerView - 1) * spaceBetween) / s.params.slidesPerView; - if (s.params.roundLengths) slideSize = round(slideSize); - - if (s.isHorizontal()) { - s.slides[i].style.width = slideSize + 'px'; - } - else { - s.slides[i].style.height = slideSize + 'px'; - } - } - s.slides[i].swiperSlideSize = slideSize; - s.slidesSizesGrid.push(slideSize); - - - if (s.params.centeredSlides) { - slidePosition = slidePosition + slideSize / 2 + prevSlideSize / 2 + spaceBetween; - if(prevSlideSize === 0 && i !== 0) slidePosition = slidePosition - s.size / 2 - spaceBetween; - if (i === 0) slidePosition = slidePosition - s.size / 2 - spaceBetween; - if (Math.abs(slidePosition) < 1 / 1000) slidePosition = 0; - if ((index) % s.params.slidesPerGroup === 0) s.snapGrid.push(slidePosition); - s.slidesGrid.push(slidePosition); - } - else { - if ((index) % s.params.slidesPerGroup === 0) s.snapGrid.push(slidePosition); - s.slidesGrid.push(slidePosition); - slidePosition = slidePosition + slideSize + spaceBetween; - } - - s.virtualSize += slideSize + spaceBetween; - - prevSlideSize = slideSize; - - index ++; - } - s.virtualSize = Math.max(s.virtualSize, s.size) + s.params.slidesOffsetAfter; - var newSlidesGrid; - - if ( - s.rtl && s.wrongRTL && (s.params.effect === 'slide' || s.params.effect === 'coverflow')) { - s.wrapper.css({width: s.virtualSize + s.params.spaceBetween + 'px'}); - } - if (!s.support.flexbox || s.params.setWrapperSize) { - if (s.isHorizontal()) s.wrapper.css({width: s.virtualSize + s.params.spaceBetween + 'px'}); - else s.wrapper.css({height: s.virtualSize + s.params.spaceBetween + 'px'}); - } - - if (s.params.slidesPerColumn > 1) { - s.virtualSize = (slideSize + s.params.spaceBetween) * slidesNumberEvenToRows; - s.virtualSize = Math.ceil(s.virtualSize / s.params.slidesPerColumn) - s.params.spaceBetween; - if (s.isHorizontal()) s.wrapper.css({width: s.virtualSize + s.params.spaceBetween + 'px'}); - else s.wrapper.css({height: s.virtualSize + s.params.spaceBetween + 'px'}); - if (s.params.centeredSlides) { - newSlidesGrid = []; - for (i = 0; i < s.snapGrid.length; i++) { - if (s.snapGrid[i] < s.virtualSize + s.snapGrid[0]) newSlidesGrid.push(s.snapGrid[i]); - } - s.snapGrid = newSlidesGrid; - } - } - - // Remove last grid elements depending on width - if (!s.params.centeredSlides) { - newSlidesGrid = []; - for (i = 0; i < s.snapGrid.length; i++) { - if (s.snapGrid[i] <= s.virtualSize - s.size) { - newSlidesGrid.push(s.snapGrid[i]); - } - } - s.snapGrid = newSlidesGrid; - if (Math.floor(s.virtualSize - s.size) - Math.floor(s.snapGrid[s.snapGrid.length - 1]) > 1) { - s.snapGrid.push(s.virtualSize - s.size); - } - } - if (s.snapGrid.length === 0) s.snapGrid = [0]; - - if (s.params.spaceBetween !== 0) { - if (s.isHorizontal()) { - if (s.rtl) s.slides.css({marginLeft: spaceBetween + 'px'}); - else s.slides.css({marginRight: spaceBetween + 'px'}); - } - else s.slides.css({marginBottom: spaceBetween + 'px'}); - } - if (s.params.watchSlidesProgress) { - s.updateSlidesOffset(); - } - }; - s.updateSlidesOffset = function () { - for (var i = 0; i < s.slides.length; i++) { - s.slides[i].swiperSlideOffset = s.isHorizontal() ? s.slides[i].offsetLeft : s.slides[i].offsetTop; - } - }; - - /*========================= - Dynamic Slides Per View - ===========================*/ - s.currentSlidesPerView = function () { - var spv = 1, i, j; - if (s.params.centeredSlides) { - var size = s.slides[s.activeIndex].swiperSlideSize; - var breakLoop; - for (i = s.activeIndex + 1; i < s.slides.length; i++) { - if (s.slides[i] && !breakLoop) { - size += s.slides[i].swiperSlideSize; - spv ++; - if (size > s.size) breakLoop = true; - } - } - for (j = s.activeIndex - 1; j >= 0; j--) { - if (s.slides[j] && !breakLoop) { - size += s.slides[j].swiperSlideSize; - spv ++; - if (size > s.size) breakLoop = true; - } - } - } - else { - for (i = s.activeIndex + 1; i < s.slides.length; i++) { - if (s.slidesGrid[i] - s.slidesGrid[s.activeIndex] < s.size) { - spv++; - } - } - } - return spv; - }; - /*========================= - Slider/slides progress - ===========================*/ - s.updateSlidesProgress = function (translate) { - if (typeof translate === 'undefined') { - translate = s.translate || 0; - } - if (s.slides.length === 0) return; - if (typeof s.slides[0].swiperSlideOffset === 'undefined') s.updateSlidesOffset(); - - var offsetCenter = -translate; - if (s.rtl) offsetCenter = translate; - - // Visible Slides - s.slides.removeClass(s.params.slideVisibleClass); - for (var i = 0; i < s.slides.length; i++) { - var slide = s.slides[i]; - var slideProgress = (offsetCenter + (s.params.centeredSlides ? s.minTranslate() : 0) - slide.swiperSlideOffset) / (slide.swiperSlideSize + s.params.spaceBetween); - if (s.params.watchSlidesVisibility) { - var slideBefore = -(offsetCenter - slide.swiperSlideOffset); - var slideAfter = slideBefore + s.slidesSizesGrid[i]; - var isVisible = - (slideBefore >= 0 && slideBefore < s.size) || - (slideAfter > 0 && slideAfter <= s.size) || - (slideBefore <= 0 && slideAfter >= s.size); - if (isVisible) { - s.slides.eq(i).addClass(s.params.slideVisibleClass); - } - } - slide.progress = s.rtl ? -slideProgress : slideProgress; - } - }; - s.updateProgress = function (translate) { - if (typeof translate === 'undefined') { - translate = s.translate || 0; - } - var translatesDiff = s.maxTranslate() - s.minTranslate(); - var wasBeginning = s.isBeginning; - var wasEnd = s.isEnd; - if (translatesDiff === 0) { - s.progress = 0; - s.isBeginning = s.isEnd = true; - } - else { - s.progress = (translate - s.minTranslate()) / (translatesDiff); - s.isBeginning = s.progress <= 0; - s.isEnd = s.progress >= 1; - } - if (s.isBeginning && !wasBeginning) s.emit('onReachBeginning', s); - if (s.isEnd && !wasEnd) s.emit('onReachEnd', s); - - if (s.params.watchSlidesProgress) s.updateSlidesProgress(translate); - s.emit('onProgress', s, s.progress); - }; - s.updateActiveIndex = function () { - var translate = s.rtl ? s.translate : -s.translate; - var newActiveIndex, i, snapIndex; - for (i = 0; i < s.slidesGrid.length; i ++) { - if (typeof s.slidesGrid[i + 1] !== 'undefined') { - if (translate >= s.slidesGrid[i] && translate < s.slidesGrid[i + 1] - (s.slidesGrid[i + 1] - s.slidesGrid[i]) / 2) { - newActiveIndex = i; - } - else if (translate >= s.slidesGrid[i] && translate < s.slidesGrid[i + 1]) { - newActiveIndex = i + 1; - } - } - else { - if (translate >= s.slidesGrid[i]) { - newActiveIndex = i; - } - } - } - // Normalize slideIndex - if(s.params.normalizeSlideIndex){ - if (newActiveIndex < 0 || typeof newActiveIndex === 'undefined') newActiveIndex = 0; - } - // for (i = 0; i < s.slidesGrid.length; i++) { - // if (- translate >= s.slidesGrid[i]) { - // newActiveIndex = i; - // } - // } - snapIndex = Math.floor(newActiveIndex / s.params.slidesPerGroup); - if (snapIndex >= s.snapGrid.length) snapIndex = s.snapGrid.length - 1; - - if (newActiveIndex === s.activeIndex) { - return; - } - s.snapIndex = snapIndex; - s.previousIndex = s.activeIndex; - s.activeIndex = newActiveIndex; - s.updateClasses(); - s.updateRealIndex(); - }; - s.updateRealIndex = function(){ - s.realIndex = parseInt(s.slides.eq(s.activeIndex).attr('data-swiper-slide-index') || s.activeIndex, 10); - }; - - /*========================= - Classes - ===========================*/ - s.updateClasses = function () { - s.slides.removeClass(s.params.slideActiveClass + ' ' + s.params.slideNextClass + ' ' + s.params.slidePrevClass + ' ' + s.params.slideDuplicateActiveClass + ' ' + s.params.slideDuplicateNextClass + ' ' + s.params.slideDuplicatePrevClass); - var activeSlide = s.slides.eq(s.activeIndex); - // Active classes - activeSlide.addClass(s.params.slideActiveClass); - if (params.loop) { - // Duplicate to all looped slides - if (activeSlide.hasClass(s.params.slideDuplicateClass)) { - s.wrapper.children('.' + s.params.slideClass + ':not(.' + s.params.slideDuplicateClass + ')[data-swiper-slide-index="' + s.realIndex + '"]').addClass(s.params.slideDuplicateActiveClass); - } - else { - s.wrapper.children('.' + s.params.slideClass + '.' + s.params.slideDuplicateClass + '[data-swiper-slide-index="' + s.realIndex + '"]').addClass(s.params.slideDuplicateActiveClass); - } - } - // Next Slide - var nextSlide = activeSlide.next('.' + s.params.slideClass).addClass(s.params.slideNextClass); - if (s.params.loop && nextSlide.length === 0) { - nextSlide = s.slides.eq(0); - nextSlide.addClass(s.params.slideNextClass); - } - // Prev Slide - var prevSlide = activeSlide.prev('.' + s.params.slideClass).addClass(s.params.slidePrevClass); - if (s.params.loop && prevSlide.length === 0) { - prevSlide = s.slides.eq(-1); - prevSlide.addClass(s.params.slidePrevClass); - } - if (params.loop) { - // Duplicate to all looped slides - if (nextSlide.hasClass(s.params.slideDuplicateClass)) { - s.wrapper.children('.' + s.params.slideClass + ':not(.' + s.params.slideDuplicateClass + ')[data-swiper-slide-index="' + nextSlide.attr('data-swiper-slide-index') + '"]').addClass(s.params.slideDuplicateNextClass); - } - else { - s.wrapper.children('.' + s.params.slideClass + '.' + s.params.slideDuplicateClass + '[data-swiper-slide-index="' + nextSlide.attr('data-swiper-slide-index') + '"]').addClass(s.params.slideDuplicateNextClass); - } - if (prevSlide.hasClass(s.params.slideDuplicateClass)) { - s.wrapper.children('.' + s.params.slideClass + ':not(.' + s.params.slideDuplicateClass + ')[data-swiper-slide-index="' + prevSlide.attr('data-swiper-slide-index') + '"]').addClass(s.params.slideDuplicatePrevClass); - } - else { - s.wrapper.children('.' + s.params.slideClass + '.' + s.params.slideDuplicateClass + '[data-swiper-slide-index="' + prevSlide.attr('data-swiper-slide-index') + '"]').addClass(s.params.slideDuplicatePrevClass); - } - } - - // Pagination - if (s.paginationContainer && s.paginationContainer.length > 0) { - // Current/Total - var current, - total = s.params.loop ? Math.ceil((s.slides.length - s.loopedSlides * 2) / s.params.slidesPerGroup) : s.snapGrid.length; - if (s.params.loop) { - current = Math.ceil((s.activeIndex - s.loopedSlides)/s.params.slidesPerGroup); - if (current > s.slides.length - 1 - s.loopedSlides * 2) { - current = current - (s.slides.length - s.loopedSlides * 2); - } - if (current > total - 1) current = current - total; - if (current < 0 && s.params.paginationType !== 'bullets') current = total + current; - } - else { - if (typeof s.snapIndex !== 'undefined') { - current = s.snapIndex; - } - else { - current = s.activeIndex || 0; - } - } - // Types - if (s.params.paginationType === 'bullets' && s.bullets && s.bullets.length > 0) { - s.bullets.removeClass(s.params.bulletActiveClass); - if (s.paginationContainer.length > 1) { - s.bullets.each(function () { - if ($(this).index() === current) $(this).addClass(s.params.bulletActiveClass); - }); - } - else { - s.bullets.eq(current).addClass(s.params.bulletActiveClass); - } - } - if (s.params.paginationType === 'fraction') { - s.paginationContainer.find('.' + s.params.paginationCurrentClass).text(current + 1); - s.paginationContainer.find('.' + s.params.paginationTotalClass).text(total); - } - if (s.params.paginationType === 'progress') { - var scale = (current + 1) / total, - scaleX = scale, - scaleY = 1; - if (!s.isHorizontal()) { - scaleY = scale; - scaleX = 1; - } - s.paginationContainer.find('.' + s.params.paginationProgressbarClass).transform('translate3d(0,0,0) scaleX(' + scaleX + ') scaleY(' + scaleY + ')').transition(s.params.speed); - } - if (s.params.paginationType === 'custom' && s.params.paginationCustomRender) { - s.paginationContainer.html(s.params.paginationCustomRender(s, current + 1, total)); - s.emit('onPaginationRendered', s, s.paginationContainer[0]); - } - } - - // Next/active buttons - if (!s.params.loop) { - if (s.params.prevButton && s.prevButton && s.prevButton.length > 0) { - if (s.isBeginning) { - s.prevButton.addClass(s.params.buttonDisabledClass); - if (s.params.a11y && s.a11y) s.a11y.disable(s.prevButton); - } - else { - s.prevButton.removeClass(s.params.buttonDisabledClass); - if (s.params.a11y && s.a11y) s.a11y.enable(s.prevButton); - } - } - if (s.params.nextButton && s.nextButton && s.nextButton.length > 0) { - if (s.isEnd) { - s.nextButton.addClass(s.params.buttonDisabledClass); - if (s.params.a11y && s.a11y) s.a11y.disable(s.nextButton); - } - else { - s.nextButton.removeClass(s.params.buttonDisabledClass); - if (s.params.a11y && s.a11y) s.a11y.enable(s.nextButton); - } - } - } - }; - - /*========================= - Pagination - ===========================*/ - s.updatePagination = function () { - if (!s.params.pagination) return; - if (s.paginationContainer && s.paginationContainer.length > 0) { - var paginationHTML = ''; - if (s.params.paginationType === 'bullets') { - var numberOfBullets = s.params.loop ? Math.ceil((s.slides.length - s.loopedSlides * 2) / s.params.slidesPerGroup) : s.snapGrid.length; - for (var i = 0; i < numberOfBullets; i++) { - if (s.params.paginationBulletRender) { - paginationHTML += s.params.paginationBulletRender(s, i, s.params.bulletClass); - } - else { - paginationHTML += '<' + s.params.paginationElement+' class="' + s.params.bulletClass + '">'; - } - } - s.paginationContainer.html(paginationHTML); - s.bullets = s.paginationContainer.find('.' + s.params.bulletClass); - if (s.params.paginationClickable && s.params.a11y && s.a11y) { - s.a11y.initPagination(); - } - } - if (s.params.paginationType === 'fraction') { - if (s.params.paginationFractionRender) { - paginationHTML = s.params.paginationFractionRender(s, s.params.paginationCurrentClass, s.params.paginationTotalClass); - } - else { - paginationHTML = - '' + - ' / ' + - ''; - } - s.paginationContainer.html(paginationHTML); - } - if (s.params.paginationType === 'progress') { - if (s.params.paginationProgressRender) { - paginationHTML = s.params.paginationProgressRender(s, s.params.paginationProgressbarClass); - } - else { - paginationHTML = ''; - } - s.paginationContainer.html(paginationHTML); - } - if (s.params.paginationType !== 'custom') { - s.emit('onPaginationRendered', s, s.paginationContainer[0]); - } - } - }; - /*========================= - Common update method - ===========================*/ - s.update = function (updateTranslate) { - if (!s) return; - s.updateContainerSize(); - s.updateSlidesSize(); - s.updateProgress(); - s.updatePagination(); - s.updateClasses(); - if (s.params.scrollbar && s.scrollbar) { - s.scrollbar.set(); - } - var newTranslate; - function forceSetTranslate() { - var translate = s.rtl ? -s.translate : s.translate; - newTranslate = Math.min(Math.max(s.translate, s.maxTranslate()), s.minTranslate()); - s.setWrapperTranslate(newTranslate); - s.updateActiveIndex(); - s.updateClasses(); - } - if (updateTranslate) { - var translated; - if (s.controller && s.controller.spline) { - s.controller.spline = undefined; - } - if (s.params.freeMode) { - forceSetTranslate(); - if (s.params.autoHeight) { - s.updateAutoHeight(); - } - } - else { - if ((s.params.slidesPerView === 'auto' || s.params.slidesPerView > 1) && s.isEnd && !s.params.centeredSlides) { - translated = s.slideTo(s.slides.length - 1, 0, false, true); - } - else { - translated = s.slideTo(s.activeIndex, 0, false, true); - } - if (!translated) { - forceSetTranslate(); - } - } - } - else if (s.params.autoHeight) { - s.updateAutoHeight(); - } - }; - - /*========================= - Resize Handler - ===========================*/ - s.onResize = function (forceUpdatePagination) { - if (s.params.onBeforeResize) s.params.onBeforeResize(s); - //Breakpoints - if (s.params.breakpoints) { - s.setBreakpoint(); - } - - // Disable locks on resize - var allowSwipeToPrev = s.params.allowSwipeToPrev; - var allowSwipeToNext = s.params.allowSwipeToNext; - s.params.allowSwipeToPrev = s.params.allowSwipeToNext = true; - - s.updateContainerSize(); - s.updateSlidesSize(); - if (s.params.slidesPerView === 'auto' || s.params.freeMode || forceUpdatePagination) s.updatePagination(); - if (s.params.scrollbar && s.scrollbar) { - s.scrollbar.set(); - } - if (s.controller && s.controller.spline) { - s.controller.spline = undefined; - } - var slideChangedBySlideTo = false; - if (s.params.freeMode) { - var newTranslate = Math.min(Math.max(s.translate, s.maxTranslate()), s.minTranslate()); - s.setWrapperTranslate(newTranslate); - s.updateActiveIndex(); - s.updateClasses(); - - if (s.params.autoHeight) { - s.updateAutoHeight(); - } - } - else { - s.updateClasses(); - if ((s.params.slidesPerView === 'auto' || s.params.slidesPerView > 1) && s.isEnd && !s.params.centeredSlides) { - slideChangedBySlideTo = s.slideTo(s.slides.length - 1, 0, false, true); - } - else { - slideChangedBySlideTo = s.slideTo(s.activeIndex, 0, false, true); - } - } - if (s.params.lazyLoading && !slideChangedBySlideTo && s.lazy) { - s.lazy.load(); - } - // Return locks after resize - s.params.allowSwipeToPrev = allowSwipeToPrev; - s.params.allowSwipeToNext = allowSwipeToNext; - if (s.params.onAfterResize) s.params.onAfterResize(s); - }; - - /*========================= - Events - ===========================*/ - - //Define Touch Events - s.touchEventsDesktop = {start: 'mousedown', move: 'mousemove', end: 'mouseup'}; - if (window.navigator.pointerEnabled) s.touchEventsDesktop = {start: 'pointerdown', move: 'pointermove', end: 'pointerup'}; - else if (window.navigator.msPointerEnabled) s.touchEventsDesktop = {start: 'MSPointerDown', move: 'MSPointerMove', end: 'MSPointerUp'}; - s.touchEvents = { - start : s.support.touch || !s.params.simulateTouch ? 'touchstart' : s.touchEventsDesktop.start, - move : s.support.touch || !s.params.simulateTouch ? 'touchmove' : s.touchEventsDesktop.move, - end : s.support.touch || !s.params.simulateTouch ? 'touchend' : s.touchEventsDesktop.end - }; - - - // WP8 Touch Events Fix - if (window.navigator.pointerEnabled || window.navigator.msPointerEnabled) { - (s.params.touchEventsTarget === 'container' ? s.container : s.wrapper).addClass('swiper-wp8-' + s.params.direction); - } - - // Attach/detach events - s.initEvents = function (detach) { - var actionDom = detach ? 'off' : 'on'; - var action = detach ? 'removeEventListener' : 'addEventListener'; - var touchEventsTarget = s.params.touchEventsTarget === 'container' ? s.container[0] : s.wrapper[0]; - var target = s.support.touch ? touchEventsTarget : document; - - var moveCapture = s.params.nested ? true : false; - - //Touch Events - if (s.browser.ie) { - touchEventsTarget[action](s.touchEvents.start, s.onTouchStart, false); - target[action](s.touchEvents.move, s.onTouchMove, moveCapture); - target[action](s.touchEvents.end, s.onTouchEnd, false); - } - else { - if (s.support.touch) { - var passiveListener = s.touchEvents.start === 'touchstart' && s.support.passiveListener && s.params.passiveListeners ? {passive: true, capture: false} : false; - touchEventsTarget[action](s.touchEvents.start, s.onTouchStart, passiveListener); - touchEventsTarget[action](s.touchEvents.move, s.onTouchMove, moveCapture); - touchEventsTarget[action](s.touchEvents.end, s.onTouchEnd, passiveListener); - } - if ((params.simulateTouch && !s.device.ios && !s.device.android) || (params.simulateTouch && !s.support.touch && s.device.ios)) { - touchEventsTarget[action]('mousedown', s.onTouchStart, false); - document[action]('mousemove', s.onTouchMove, moveCapture); - document[action]('mouseup', s.onTouchEnd, false); - } - } - window[action]('resize', s.onResize); - - // Next, Prev, Index - if (s.params.nextButton && s.nextButton && s.nextButton.length > 0) { - s.nextButton[actionDom]('click', s.onClickNext); - if (s.params.a11y && s.a11y) s.nextButton[actionDom]('keydown', s.a11y.onEnterKey); - } - if (s.params.prevButton && s.prevButton && s.prevButton.length > 0) { - s.prevButton[actionDom]('click', s.onClickPrev); - if (s.params.a11y && s.a11y) s.prevButton[actionDom]('keydown', s.a11y.onEnterKey); - } - if (s.params.pagination && s.params.paginationClickable) { - s.paginationContainer[actionDom]('click', '.' + s.params.bulletClass, s.onClickIndex); - if (s.params.a11y && s.a11y) s.paginationContainer[actionDom]('keydown', '.' + s.params.bulletClass, s.a11y.onEnterKey); - } - - // Prevent Links Clicks - if (s.params.preventClicks || s.params.preventClicksPropagation) touchEventsTarget[action]('click', s.preventClicks, true); - }; - s.attachEvents = function () { - s.initEvents(); - }; - s.detachEvents = function () { - s.initEvents(true); - }; - - /*========================= - Handle Clicks - ===========================*/ - // Prevent Clicks - s.allowClick = true; - s.preventClicks = function (e) { - if (!s.allowClick) { - if (s.params.preventClicks) e.preventDefault(); - if (s.params.preventClicksPropagation && s.animating) { - e.stopPropagation(); - e.stopImmediatePropagation(); - } - } - }; - // Clicks - s.onClickNext = function (e) { - e.preventDefault(); - if (s.isEnd && !s.params.loop) return; - s.slideNext(); - }; - s.onClickPrev = function (e) { - e.preventDefault(); - if (s.isBeginning && !s.params.loop) return; - s.slidePrev(); - }; - s.onClickIndex = function (e) { - e.preventDefault(); - var index = $(this).index() * s.params.slidesPerGroup; - if (s.params.loop) index = index + s.loopedSlides; - s.slideTo(index); - }; - - /*========================= - Handle Touches - ===========================*/ - function findElementInEvent(e, selector) { - var el = $(e.target); - if (!el.is(selector)) { - if (typeof selector === 'string') { - el = el.parents(selector); - } - else if (selector.nodeType) { - var found; - el.parents().each(function (index, _el) { - if (_el === selector) found = selector; - }); - if (!found) return undefined; - else return selector; - } - } - if (el.length === 0) { - return undefined; - } - return el[0]; - } - s.updateClickedSlide = function (e) { - var slide = findElementInEvent(e, '.' + s.params.slideClass); - var slideFound = false; - if (slide) { - for (var i = 0; i < s.slides.length; i++) { - if (s.slides[i] === slide) slideFound = true; - } - } - - if (slide && slideFound) { - s.clickedSlide = slide; - s.clickedIndex = $(slide).index(); - } - else { - s.clickedSlide = undefined; - s.clickedIndex = undefined; - return; - } - if (s.params.slideToClickedSlide && s.clickedIndex !== undefined && s.clickedIndex !== s.activeIndex) { - var slideToIndex = s.clickedIndex, - realIndex, - duplicatedSlides, - slidesPerView = s.params.slidesPerView === 'auto' ? s.currentSlidesPerView() : s.params.slidesPerView; - if (s.params.loop) { - if (s.animating) return; - realIndex = parseInt($(s.clickedSlide).attr('data-swiper-slide-index'), 10); - if (s.params.centeredSlides) { - if ((slideToIndex < s.loopedSlides - slidesPerView/2) || (slideToIndex > s.slides.length - s.loopedSlides + slidesPerView/2)) { - s.fixLoop(); - slideToIndex = s.wrapper.children('.' + s.params.slideClass + '[data-swiper-slide-index="' + realIndex + '"]:not(.' + s.params.slideDuplicateClass + ')').eq(0).index(); - setTimeout(function () { - s.slideTo(slideToIndex); - }, 0); - } - else { - s.slideTo(slideToIndex); - } - } - else { - if (slideToIndex > s.slides.length - slidesPerView) { - s.fixLoop(); - slideToIndex = s.wrapper.children('.' + s.params.slideClass + '[data-swiper-slide-index="' + realIndex + '"]:not(.' + s.params.slideDuplicateClass + ')').eq(0).index(); - setTimeout(function () { - s.slideTo(slideToIndex); - }, 0); - } - else { - s.slideTo(slideToIndex); - } - } - } - else { - s.slideTo(slideToIndex); - } - } - }; - - var isTouched, - isMoved, - allowTouchCallbacks, - touchStartTime, - isScrolling, - currentTranslate, - startTranslate, - allowThresholdMove, - // Form elements to match - formElements = 'input, select, textarea, button, video', - // Last click time - lastClickTime = Date.now(), clickTimeout, - //Velocities - velocities = [], - allowMomentumBounce; - - // Animating Flag - s.animating = false; - - // Touches information - s.touches = { - startX: 0, - startY: 0, - currentX: 0, - currentY: 0, - diff: 0 - }; - - // Touch handlers - var isTouchEvent, startMoving; - s.onTouchStart = function (e) { - if (e.originalEvent) e = e.originalEvent; - isTouchEvent = e.type === 'touchstart'; - if (!isTouchEvent && 'which' in e && e.which === 3) return; - if (s.params.noSwiping && findElementInEvent(e, '.' + s.params.noSwipingClass)) { - s.allowClick = true; - return; - } - if (s.params.swipeHandler) { - if (!findElementInEvent(e, s.params.swipeHandler)) return; - } - - var startX = s.touches.currentX = e.type === 'touchstart' ? e.targetTouches[0].pageX : e.pageX; - var startY = s.touches.currentY = e.type === 'touchstart' ? e.targetTouches[0].pageY : e.pageY; - - // Do NOT start if iOS edge swipe is detected. Otherwise iOS app (UIWebView) cannot swipe-to-go-back anymore - if(s.device.ios && s.params.iOSEdgeSwipeDetection && startX <= s.params.iOSEdgeSwipeThreshold) { - return; - } - - isTouched = true; - isMoved = false; - allowTouchCallbacks = true; - isScrolling = undefined; - startMoving = undefined; - s.touches.startX = startX; - s.touches.startY = startY; - touchStartTime = Date.now(); - s.allowClick = true; - s.updateContainerSize(); - s.swipeDirection = undefined; - if (s.params.threshold > 0) allowThresholdMove = false; - if (e.type !== 'touchstart') { - var preventDefault = true; - if ($(e.target).is(formElements)) preventDefault = false; - if (document.activeElement && $(document.activeElement).is(formElements)) { - document.activeElement.blur(); - } - if (preventDefault) { - e.preventDefault(); - } - } - s.emit('onTouchStart', s, e); - }; - - s.onTouchMove = function (e) { - if (e.originalEvent) e = e.originalEvent; - if (isTouchEvent && e.type === 'mousemove') return; - if (e.preventedByNestedSwiper) { - s.touches.startX = e.type === 'touchmove' ? e.targetTouches[0].pageX : e.pageX; - s.touches.startY = e.type === 'touchmove' ? e.targetTouches[0].pageY : e.pageY; - return; - } - if (s.params.onlyExternal) { - // isMoved = true; - s.allowClick = false; - if (isTouched) { - s.touches.startX = s.touches.currentX = e.type === 'touchmove' ? e.targetTouches[0].pageX : e.pageX; - s.touches.startY = s.touches.currentY = e.type === 'touchmove' ? e.targetTouches[0].pageY : e.pageY; - touchStartTime = Date.now(); - } - return; - } - if (isTouchEvent && s.params.touchReleaseOnEdges && !s.params.loop) { - if (!s.isHorizontal()) { - // Vertical - if ( - (s.touches.currentY < s.touches.startY && s.translate <= s.maxTranslate()) || - (s.touches.currentY > s.touches.startY && s.translate >= s.minTranslate()) - ) { - return; - } - } - else { - if ( - (s.touches.currentX < s.touches.startX && s.translate <= s.maxTranslate()) || - (s.touches.currentX > s.touches.startX && s.translate >= s.minTranslate()) - ) { - return; - } - } - } - if (isTouchEvent && document.activeElement) { - if (e.target === document.activeElement && $(e.target).is(formElements)) { - isMoved = true; - s.allowClick = false; - return; - } - } - if (allowTouchCallbacks) { - s.emit('onTouchMove', s, e); - } - if (e.targetTouches && e.targetTouches.length > 1) return; - - s.touches.currentX = e.type === 'touchmove' ? e.targetTouches[0].pageX : e.pageX; - s.touches.currentY = e.type === 'touchmove' ? e.targetTouches[0].pageY : e.pageY; - - if (typeof isScrolling === 'undefined') { - var touchAngle; - if (s.isHorizontal() && s.touches.currentY === s.touches.startY || !s.isHorizontal() && s.touches.currentX === s.touches.startX) { - isScrolling = false; - } - else { - touchAngle = Math.atan2(Math.abs(s.touches.currentY - s.touches.startY), Math.abs(s.touches.currentX - s.touches.startX)) * 180 / Math.PI; - isScrolling = s.isHorizontal() ? touchAngle > s.params.touchAngle : (90 - touchAngle > s.params.touchAngle); - } - } - if (isScrolling) { - s.emit('onTouchMoveOpposite', s, e); - } - if (typeof startMoving === 'undefined') { - if (s.touches.currentX !== s.touches.startX || s.touches.currentY !== s.touches.startY) { - startMoving = true; - } - } - if (!isTouched) return; - if (isScrolling) { - isTouched = false; - return; - } - if (!startMoving) { - return; - } - s.allowClick = false; - s.emit('onSliderMove', s, e); - e.preventDefault(); - if (s.params.touchMoveStopPropagation && !s.params.nested) { - e.stopPropagation(); - } - - if (!isMoved) { - if (params.loop) { - s.fixLoop(); - } - startTranslate = s.getWrapperTranslate(); - s.setWrapperTransition(0); - if (s.animating) { - s.wrapper.trigger('webkitTransitionEnd transitionend oTransitionEnd MSTransitionEnd msTransitionEnd'); - } - if (s.params.autoplay && s.autoplaying) { - if (s.params.autoplayDisableOnInteraction) { - s.stopAutoplay(); - } - else { - s.pauseAutoplay(); - } - } - allowMomentumBounce = false; - //Grab Cursor - if (s.params.grabCursor && (s.params.allowSwipeToNext === true || s.params.allowSwipeToPrev === true)) { - s.setGrabCursor(true); - } - } - isMoved = true; - - var diff = s.touches.diff = s.isHorizontal() ? s.touches.currentX - s.touches.startX : s.touches.currentY - s.touches.startY; - - diff = diff * s.params.touchRatio; - if (s.rtl) diff = -diff; - - s.swipeDirection = diff > 0 ? 'prev' : 'next'; - currentTranslate = diff + startTranslate; - - var disableParentSwiper = true; - if ((diff > 0 && currentTranslate > s.minTranslate())) { - disableParentSwiper = false; - if (s.params.resistance) currentTranslate = s.minTranslate() - 1 + Math.pow(-s.minTranslate() + startTranslate + diff, s.params.resistanceRatio); - } - else if (diff < 0 && currentTranslate < s.maxTranslate()) { - disableParentSwiper = false; - if (s.params.resistance) currentTranslate = s.maxTranslate() + 1 - Math.pow(s.maxTranslate() - startTranslate - diff, s.params.resistanceRatio); - } - - if (disableParentSwiper) { - e.preventedByNestedSwiper = true; - } - - // Directions locks - if (!s.params.allowSwipeToNext && s.swipeDirection === 'next' && currentTranslate < startTranslate) { - currentTranslate = startTranslate; - } - if (!s.params.allowSwipeToPrev && s.swipeDirection === 'prev' && currentTranslate > startTranslate) { - currentTranslate = startTranslate; - } - - - // Threshold - if (s.params.threshold > 0) { - if (Math.abs(diff) > s.params.threshold || allowThresholdMove) { - if (!allowThresholdMove) { - allowThresholdMove = true; - s.touches.startX = s.touches.currentX; - s.touches.startY = s.touches.currentY; - currentTranslate = startTranslate; - s.touches.diff = s.isHorizontal() ? s.touches.currentX - s.touches.startX : s.touches.currentY - s.touches.startY; - return; - } - } - else { - currentTranslate = startTranslate; - return; - } - } - - if (!s.params.followFinger) return; - - // Update active index in free mode - if (s.params.freeMode || s.params.watchSlidesProgress) { - s.updateActiveIndex(); - } - if (s.params.freeMode) { - //Velocity - if (velocities.length === 0) { - velocities.push({ - position: s.touches[s.isHorizontal() ? 'startX' : 'startY'], - time: touchStartTime - }); - } - velocities.push({ - position: s.touches[s.isHorizontal() ? 'currentX' : 'currentY'], - time: (new window.Date()).getTime() - }); - } - // Update progress - s.updateProgress(currentTranslate); - // Update translate - s.setWrapperTranslate(currentTranslate); - }; - s.onTouchEnd = function (e) { - if (e.originalEvent) e = e.originalEvent; - if (allowTouchCallbacks) { - s.emit('onTouchEnd', s, e); - } - allowTouchCallbacks = false; - if (!isTouched) return; - //Return Grab Cursor - if (s.params.grabCursor && isMoved && isTouched && (s.params.allowSwipeToNext === true || s.params.allowSwipeToPrev === true)) { - s.setGrabCursor(false); - } - - // Time diff - var touchEndTime = Date.now(); - var timeDiff = touchEndTime - touchStartTime; - - // Tap, doubleTap, Click - if (s.allowClick) { - s.updateClickedSlide(e); - s.emit('onTap', s, e); - if (timeDiff < 300 && (touchEndTime - lastClickTime) > 300) { - if (clickTimeout) clearTimeout(clickTimeout); - clickTimeout = setTimeout(function () { - if (!s) return; - if (s.params.paginationHide && s.paginationContainer.length > 0 && !$(e.target).hasClass(s.params.bulletClass)) { - s.paginationContainer.toggleClass(s.params.paginationHiddenClass); - } - s.emit('onClick', s, e); - }, 300); - - } - if (timeDiff < 300 && (touchEndTime - lastClickTime) < 300) { - if (clickTimeout) clearTimeout(clickTimeout); - s.emit('onDoubleTap', s, e); - } - } - - lastClickTime = Date.now(); - setTimeout(function () { - if (s) s.allowClick = true; - }, 0); - - if (!isTouched || !isMoved || !s.swipeDirection || s.touches.diff === 0 || currentTranslate === startTranslate) { - isTouched = isMoved = false; - return; - } - isTouched = isMoved = false; - - var currentPos; - if (s.params.followFinger) { - currentPos = s.rtl ? s.translate : -s.translate; - } - else { - currentPos = -currentTranslate; - } - if (s.params.freeMode) { - if (currentPos < -s.minTranslate()) { - s.slideTo(s.activeIndex); - return; - } - else if (currentPos > -s.maxTranslate()) { - if (s.slides.length < s.snapGrid.length) { - s.slideTo(s.snapGrid.length - 1); - } - else { - s.slideTo(s.slides.length - 1); - } - return; - } - - if (s.params.freeModeMomentum) { - if (velocities.length > 1) { - var lastMoveEvent = velocities.pop(), velocityEvent = velocities.pop(); - - var distance = lastMoveEvent.position - velocityEvent.position; - var time = lastMoveEvent.time - velocityEvent.time; - s.velocity = distance / time; - s.velocity = s.velocity / 2; - if (Math.abs(s.velocity) < s.params.freeModeMinimumVelocity) { - s.velocity = 0; - } - // this implies that the user stopped moving a finger then released. - // There would be no events with distance zero, so the last event is stale. - if (time > 150 || (new window.Date().getTime() - lastMoveEvent.time) > 300) { - s.velocity = 0; - } - } else { - s.velocity = 0; - } - s.velocity = s.velocity * s.params.freeModeMomentumVelocityRatio; - - velocities.length = 0; - var momentumDuration = 1000 * s.params.freeModeMomentumRatio; - var momentumDistance = s.velocity * momentumDuration; - - var newPosition = s.translate + momentumDistance; - if (s.rtl) newPosition = - newPosition; - var doBounce = false; - var afterBouncePosition; - var bounceAmount = Math.abs(s.velocity) * 20 * s.params.freeModeMomentumBounceRatio; - if (newPosition < s.maxTranslate()) { - if (s.params.freeModeMomentumBounce) { - if (newPosition + s.maxTranslate() < -bounceAmount) { - newPosition = s.maxTranslate() - bounceAmount; - } - afterBouncePosition = s.maxTranslate(); - doBounce = true; - allowMomentumBounce = true; - } - else { - newPosition = s.maxTranslate(); - } - } - else if (newPosition > s.minTranslate()) { - if (s.params.freeModeMomentumBounce) { - if (newPosition - s.minTranslate() > bounceAmount) { - newPosition = s.minTranslate() + bounceAmount; - } - afterBouncePosition = s.minTranslate(); - doBounce = true; - allowMomentumBounce = true; - } - else { - newPosition = s.minTranslate(); - } - } - else if (s.params.freeModeSticky) { - var j = 0, - nextSlide; - for (j = 0; j < s.snapGrid.length; j += 1) { - if (s.snapGrid[j] > -newPosition) { - nextSlide = j; - break; - } - - } - if (Math.abs(s.snapGrid[nextSlide] - newPosition) < Math.abs(s.snapGrid[nextSlide - 1] - newPosition) || s.swipeDirection === 'next') { - newPosition = s.snapGrid[nextSlide]; - } else { - newPosition = s.snapGrid[nextSlide - 1]; - } - if (!s.rtl) newPosition = - newPosition; - } - //Fix duration - if (s.velocity !== 0) { - if (s.rtl) { - momentumDuration = Math.abs((-newPosition - s.translate) / s.velocity); - } - else { - momentumDuration = Math.abs((newPosition - s.translate) / s.velocity); - } - } - else if (s.params.freeModeSticky) { - s.slideReset(); - return; - } - - if (s.params.freeModeMomentumBounce && doBounce) { - s.updateProgress(afterBouncePosition); - s.setWrapperTransition(momentumDuration); - s.setWrapperTranslate(newPosition); - s.onTransitionStart(); - s.animating = true; - s.wrapper.transitionEnd(function () { - if (!s || !allowMomentumBounce) return; - s.emit('onMomentumBounce', s); - - s.setWrapperTransition(s.params.speed); - s.setWrapperTranslate(afterBouncePosition); - s.wrapper.transitionEnd(function () { - if (!s) return; - s.onTransitionEnd(); - }); - }); - } else if (s.velocity) { - s.updateProgress(newPosition); - s.setWrapperTransition(momentumDuration); - s.setWrapperTranslate(newPosition); - s.onTransitionStart(); - if (!s.animating) { - s.animating = true; - s.wrapper.transitionEnd(function () { - if (!s) return; - s.onTransitionEnd(); - }); - } - - } else { - s.updateProgress(newPosition); - } - - s.updateActiveIndex(); - } - if (!s.params.freeModeMomentum || timeDiff >= s.params.longSwipesMs) { - s.updateProgress(); - s.updateActiveIndex(); - } - return; - } - - // Find current slide - var i, stopIndex = 0, groupSize = s.slidesSizesGrid[0]; - for (i = 0; i < s.slidesGrid.length; i += s.params.slidesPerGroup) { - if (typeof s.slidesGrid[i + s.params.slidesPerGroup] !== 'undefined') { - if (currentPos >= s.slidesGrid[i] && currentPos < s.slidesGrid[i + s.params.slidesPerGroup]) { - stopIndex = i; - groupSize = s.slidesGrid[i + s.params.slidesPerGroup] - s.slidesGrid[i]; - } - } - else { - if (currentPos >= s.slidesGrid[i]) { - stopIndex = i; - groupSize = s.slidesGrid[s.slidesGrid.length - 1] - s.slidesGrid[s.slidesGrid.length - 2]; - } - } - } - - // Find current slide size - var ratio = (currentPos - s.slidesGrid[stopIndex]) / groupSize; - - if (timeDiff > s.params.longSwipesMs) { - // Long touches - if (!s.params.longSwipes) { - s.slideTo(s.activeIndex); - return; - } - if (s.swipeDirection === 'next') { - if (ratio >= s.params.longSwipesRatio) s.slideTo(stopIndex + s.params.slidesPerGroup); - else s.slideTo(stopIndex); - - } - if (s.swipeDirection === 'prev') { - if (ratio > (1 - s.params.longSwipesRatio)) s.slideTo(stopIndex + s.params.slidesPerGroup); - else s.slideTo(stopIndex); - } - } - else { - // Short swipes - if (!s.params.shortSwipes) { - s.slideTo(s.activeIndex); - return; - } - if (s.swipeDirection === 'next') { - s.slideTo(stopIndex + s.params.slidesPerGroup); - - } - if (s.swipeDirection === 'prev') { - s.slideTo(stopIndex); - } - } - }; - /*========================= - Transitions - ===========================*/ - s._slideTo = function (slideIndex, speed) { - return s.slideTo(slideIndex, speed, true, true); - }; - s.slideTo = function (slideIndex, speed, runCallbacks, internal) { - if (typeof runCallbacks === 'undefined') runCallbacks = true; - if (typeof slideIndex === 'undefined') slideIndex = 0; - if (slideIndex < 0) slideIndex = 0; - s.snapIndex = Math.floor(slideIndex / s.params.slidesPerGroup); - if (s.snapIndex >= s.snapGrid.length) s.snapIndex = s.snapGrid.length - 1; - - var translate = - s.snapGrid[s.snapIndex]; - // Stop autoplay - if (s.params.autoplay && s.autoplaying) { - if (internal || !s.params.autoplayDisableOnInteraction) { - s.pauseAutoplay(speed); - } - else { - s.stopAutoplay(); - } - } - // Update progress - s.updateProgress(translate); - - // Normalize slideIndex - if(s.params.normalizeSlideIndex){ - for (var i = 0; i < s.slidesGrid.length; i++) { - if (- Math.floor(translate * 100) >= Math.floor(s.slidesGrid[i] * 100)) { - slideIndex = i; - } - } - } - - // Directions locks - if (!s.params.allowSwipeToNext && translate < s.translate && translate < s.minTranslate()) { - return false; - } - if (!s.params.allowSwipeToPrev && translate > s.translate && translate > s.maxTranslate()) { - if ((s.activeIndex || 0) !== slideIndex ) return false; - } - - // Update Index - if (typeof speed === 'undefined') speed = s.params.speed; - s.previousIndex = s.activeIndex || 0; - s.activeIndex = slideIndex; - s.updateRealIndex(); - if ((s.rtl && -translate === s.translate) || (!s.rtl && translate === s.translate)) { - // Update Height - if (s.params.autoHeight) { - s.updateAutoHeight(); - } - s.updateClasses(); - if (s.params.effect !== 'slide') { - s.setWrapperTranslate(translate); - } - return false; - } - s.updateClasses(); - s.onTransitionStart(runCallbacks); - - if (speed === 0 || s.browser.lteIE9) { - s.setWrapperTranslate(translate); - s.setWrapperTransition(0); - s.onTransitionEnd(runCallbacks); - } - else { - s.setWrapperTranslate(translate); - s.setWrapperTransition(speed); - if (!s.animating) { - s.animating = true; - s.wrapper.transitionEnd(function () { - if (!s) return; - s.onTransitionEnd(runCallbacks); - }); - } - - } - - return true; - }; - - s.onTransitionStart = function (runCallbacks) { - if (typeof runCallbacks === 'undefined') runCallbacks = true; - if (s.params.autoHeight) { - s.updateAutoHeight(); - } - if (s.lazy) s.lazy.onTransitionStart(); - if (runCallbacks) { - s.emit('onTransitionStart', s); - if (s.activeIndex !== s.previousIndex) { - s.emit('onSlideChangeStart', s); - if (s.activeIndex > s.previousIndex) { - s.emit('onSlideNextStart', s); - } - else { - s.emit('onSlidePrevStart', s); - } - } - - } - }; - s.onTransitionEnd = function (runCallbacks) { - s.animating = false; - s.setWrapperTransition(0); - if (typeof runCallbacks === 'undefined') runCallbacks = true; - if (s.lazy) s.lazy.onTransitionEnd(); - if (runCallbacks) { - s.emit('onTransitionEnd', s); - if (s.activeIndex !== s.previousIndex) { - s.emit('onSlideChangeEnd', s); - if (s.activeIndex > s.previousIndex) { - s.emit('onSlideNextEnd', s); - } - else { - s.emit('onSlidePrevEnd', s); - } - } - } - if (s.params.history && s.history) { - s.history.setHistory(s.params.history, s.activeIndex); - } - if (s.params.hashnav && s.hashnav) { - s.hashnav.setHash(); - } - - }; - s.slideNext = function (runCallbacks, speed, internal) { - if (s.params.loop) { - if (s.animating) return false; - s.fixLoop(); - var clientLeft = s.container[0].clientLeft; - return s.slideTo(s.activeIndex + s.params.slidesPerGroup, speed, runCallbacks, internal); - } - else return s.slideTo(s.activeIndex + s.params.slidesPerGroup, speed, runCallbacks, internal); - }; - s._slideNext = function (speed) { - return s.slideNext(true, speed, true); - }; - s.slidePrev = function (runCallbacks, speed, internal) { - if (s.params.loop) { - if (s.animating) return false; - s.fixLoop(); - var clientLeft = s.container[0].clientLeft; - return s.slideTo(s.activeIndex - 1, speed, runCallbacks, internal); - } - else return s.slideTo(s.activeIndex - 1, speed, runCallbacks, internal); - }; - s._slidePrev = function (speed) { - return s.slidePrev(true, speed, true); - }; - s.slideReset = function (runCallbacks, speed, internal) { - return s.slideTo(s.activeIndex, speed, runCallbacks); - }; - - s.disableTouchControl = function () { - s.params.onlyExternal = true; - return true; - }; - s.enableTouchControl = function () { - s.params.onlyExternal = false; - return true; - }; - - /*========================= - Translate/transition helpers - ===========================*/ - s.setWrapperTransition = function (duration, byController) { - s.wrapper.transition(duration); - if (s.params.effect !== 'slide' && s.effects[s.params.effect]) { - s.effects[s.params.effect].setTransition(duration); - } - if (s.params.parallax && s.parallax) { - s.parallax.setTransition(duration); - } - if (s.params.scrollbar && s.scrollbar) { - s.scrollbar.setTransition(duration); - } - if (s.params.control && s.controller) { - s.controller.setTransition(duration, byController); - } - s.emit('onSetTransition', s, duration); - }; - s.setWrapperTranslate = function (translate, updateActiveIndex, byController) { - var x = 0, y = 0, z = 0; - if (s.isHorizontal()) { - x = s.rtl ? -translate : translate; - } - else { - y = translate; - } - - if (s.params.roundLengths) { - x = round(x); - y = round(y); - } - - if (!s.params.virtualTranslate) { - if (s.support.transforms3d) s.wrapper.transform('translate3d(' + x + 'px, ' + y + 'px, ' + z + 'px)'); - else s.wrapper.transform('translate(' + x + 'px, ' + y + 'px)'); - } - - s.translate = s.isHorizontal() ? x : y; - - // Check if we need to update progress - var progress; - var translatesDiff = s.maxTranslate() - s.minTranslate(); - if (translatesDiff === 0) { - progress = 0; - } - else { - progress = (translate - s.minTranslate()) / (translatesDiff); - } - if (progress !== s.progress) { - s.updateProgress(translate); - } - - if (updateActiveIndex) s.updateActiveIndex(); - if (s.params.effect !== 'slide' && s.effects[s.params.effect]) { - s.effects[s.params.effect].setTranslate(s.translate); - } - if (s.params.parallax && s.parallax) { - s.parallax.setTranslate(s.translate); - } - if (s.params.scrollbar && s.scrollbar) { - s.scrollbar.setTranslate(s.translate); - } - if (s.params.control && s.controller) { - s.controller.setTranslate(s.translate, byController); - } - s.emit('onSetTranslate', s, s.translate); - }; - - s.getTranslate = function (el, axis) { - var matrix, curTransform, curStyle, transformMatrix; - - // automatic axis detection - if (typeof axis === 'undefined') { - axis = 'x'; - } - - if (s.params.virtualTranslate) { - return s.rtl ? -s.translate : s.translate; - } - - curStyle = window.getComputedStyle(el, null); - if (window.WebKitCSSMatrix) { - curTransform = curStyle.transform || curStyle.webkitTransform; - if (curTransform.split(',').length > 6) { - curTransform = curTransform.split(', ').map(function(a){ - return a.replace(',','.'); - }).join(', '); - } - // Some old versions of Webkit choke when 'none' is passed; pass - // empty string instead in this case - transformMatrix = new window.WebKitCSSMatrix(curTransform === 'none' ? '' : curTransform); - } - else { - transformMatrix = curStyle.MozTransform || curStyle.OTransform || curStyle.MsTransform || curStyle.msTransform || curStyle.transform || curStyle.getPropertyValue('transform').replace('translate(', 'matrix(1, 0, 0, 1,'); - matrix = transformMatrix.toString().split(','); - } - - if (axis === 'x') { - //Latest Chrome and webkits Fix - if (window.WebKitCSSMatrix) - curTransform = transformMatrix.m41; - //Crazy IE10 Matrix - else if (matrix.length === 16) - curTransform = parseFloat(matrix[12]); - //Normal Browsers - else - curTransform = parseFloat(matrix[4]); - } - if (axis === 'y') { - //Latest Chrome and webkits Fix - if (window.WebKitCSSMatrix) - curTransform = transformMatrix.m42; - //Crazy IE10 Matrix - else if (matrix.length === 16) - curTransform = parseFloat(matrix[13]); - //Normal Browsers - else - curTransform = parseFloat(matrix[5]); - } - if (s.rtl && curTransform) curTransform = -curTransform; - return curTransform || 0; - }; - s.getWrapperTranslate = function (axis) { - if (typeof axis === 'undefined') { - axis = s.isHorizontal() ? 'x' : 'y'; - } - return s.getTranslate(s.wrapper[0], axis); - }; - - /*========================= - Observer - ===========================*/ - s.observers = []; - function initObserver(target, options) { - options = options || {}; - // create an observer instance - var ObserverFunc = window.MutationObserver || window.WebkitMutationObserver; - var observer = new ObserverFunc(function (mutations) { - mutations.forEach(function (mutation) { - s.onResize(true); - s.emit('onObserverUpdate', s, mutation); - }); - }); - - observer.observe(target, { - attributes: typeof options.attributes === 'undefined' ? true : options.attributes, - childList: typeof options.childList === 'undefined' ? true : options.childList, - characterData: typeof options.characterData === 'undefined' ? true : options.characterData - }); - - s.observers.push(observer); - } - s.initObservers = function () { - if (s.params.observeParents) { - var containerParents = s.container.parents(); - for (var i = 0; i < containerParents.length; i++) { - initObserver(containerParents[i]); - } - } - - // Observe container - initObserver(s.container[0], {childList: false}); - - // Observe wrapper - initObserver(s.wrapper[0], {attributes: false}); - }; - s.disconnectObservers = function () { - for (var i = 0; i < s.observers.length; i++) { - s.observers[i].disconnect(); - } - s.observers = []; - }; - /*========================= - Loop - ===========================*/ - // Create looped slides - s.createLoop = function () { - // Remove duplicated slides - s.wrapper.children('.' + s.params.slideClass + '.' + s.params.slideDuplicateClass).remove(); - - var slides = s.wrapper.children('.' + s.params.slideClass); - - if(s.params.slidesPerView === 'auto' && !s.params.loopedSlides) s.params.loopedSlides = slides.length; - - s.loopedSlides = parseInt(s.params.loopedSlides || s.params.slidesPerView, 10); - s.loopedSlides = s.loopedSlides + s.params.loopAdditionalSlides; - if (s.loopedSlides > slides.length) { - s.loopedSlides = slides.length; - } - - var prependSlides = [], appendSlides = [], i; - slides.each(function (index, el) { - var slide = $(this); - if (index < s.loopedSlides) appendSlides.push(el); - if (index < slides.length && index >= slides.length - s.loopedSlides) prependSlides.push(el); - slide.attr('data-swiper-slide-index', index); - }); - for (i = 0; i < appendSlides.length; i++) { - s.wrapper.append($(appendSlides[i].cloneNode(true)).addClass(s.params.slideDuplicateClass)); - } - for (i = prependSlides.length - 1; i >= 0; i--) { - s.wrapper.prepend($(prependSlides[i].cloneNode(true)).addClass(s.params.slideDuplicateClass)); - } - }; - s.destroyLoop = function () { - s.wrapper.children('.' + s.params.slideClass + '.' + s.params.slideDuplicateClass).remove(); - s.slides.removeAttr('data-swiper-slide-index'); - }; - s.reLoop = function (updatePosition) { - var oldIndex = s.activeIndex - s.loopedSlides; - s.destroyLoop(); - s.createLoop(); - s.updateSlidesSize(); - if (updatePosition) { - s.slideTo(oldIndex + s.loopedSlides, 0, false); - } - - }; - s.fixLoop = function () { - var newIndex; - //Fix For Negative Oversliding - if (s.activeIndex < s.loopedSlides) { - newIndex = s.slides.length - s.loopedSlides * 3 + s.activeIndex; - newIndex = newIndex + s.loopedSlides; - s.slideTo(newIndex, 0, false, true); - } - //Fix For Positive Oversliding - else if ((s.params.slidesPerView === 'auto' && s.activeIndex >= s.loopedSlides * 2) || (s.activeIndex > s.slides.length - s.params.slidesPerView * 2)) { - newIndex = -s.slides.length + s.activeIndex + s.loopedSlides; - newIndex = newIndex + s.loopedSlides; - s.slideTo(newIndex, 0, false, true); - } - }; - /*========================= - Append/Prepend/Remove Slides - ===========================*/ - s.appendSlide = function (slides) { - if (s.params.loop) { - s.destroyLoop(); - } - if (typeof slides === 'object' && slides.length) { - for (var i = 0; i < slides.length; i++) { - if (slides[i]) s.wrapper.append(slides[i]); - } - } - else { - s.wrapper.append(slides); - } - if (s.params.loop) { - s.createLoop(); - } - if (!(s.params.observer && s.support.observer)) { - s.update(true); - } - }; - s.prependSlide = function (slides) { - if (s.params.loop) { - s.destroyLoop(); - } - var newActiveIndex = s.activeIndex + 1; - if (typeof slides === 'object' && slides.length) { - for (var i = 0; i < slides.length; i++) { - if (slides[i]) s.wrapper.prepend(slides[i]); - } - newActiveIndex = s.activeIndex + slides.length; - } - else { - s.wrapper.prepend(slides); - } - if (s.params.loop) { - s.createLoop(); - } - if (!(s.params.observer && s.support.observer)) { - s.update(true); - } - s.slideTo(newActiveIndex, 0, false); - }; - s.removeSlide = function (slidesIndexes) { - if (s.params.loop) { - s.destroyLoop(); - s.slides = s.wrapper.children('.' + s.params.slideClass); - } - var newActiveIndex = s.activeIndex, - indexToRemove; - if (typeof slidesIndexes === 'object' && slidesIndexes.length) { - for (var i = 0; i < slidesIndexes.length; i++) { - indexToRemove = slidesIndexes[i]; - if (s.slides[indexToRemove]) s.slides.eq(indexToRemove).remove(); - if (indexToRemove < newActiveIndex) newActiveIndex--; - } - newActiveIndex = Math.max(newActiveIndex, 0); - } - else { - indexToRemove = slidesIndexes; - if (s.slides[indexToRemove]) s.slides.eq(indexToRemove).remove(); - if (indexToRemove < newActiveIndex) newActiveIndex--; - newActiveIndex = Math.max(newActiveIndex, 0); - } - - if (s.params.loop) { - s.createLoop(); - } - - if (!(s.params.observer && s.support.observer)) { - s.update(true); - } - if (s.params.loop) { - s.slideTo(newActiveIndex + s.loopedSlides, 0, false); - } - else { - s.slideTo(newActiveIndex, 0, false); - } - - }; - s.removeAllSlides = function () { - var slidesIndexes = []; - for (var i = 0; i < s.slides.length; i++) { - slidesIndexes.push(i); - } - s.removeSlide(slidesIndexes); - }; - - - /*========================= - Effects - ===========================*/ - s.effects = { - fade: { - setTranslate: function () { - for (var i = 0; i < s.slides.length; i++) { - var slide = s.slides.eq(i); - var offset = slide[0].swiperSlideOffset; - var tx = -offset; - if (!s.params.virtualTranslate) tx = tx - s.translate; - var ty = 0; - if (!s.isHorizontal()) { - ty = tx; - tx = 0; - } - var slideOpacity = s.params.fade.crossFade ? - Math.max(1 - Math.abs(slide[0].progress), 0) : - 1 + Math.min(Math.max(slide[0].progress, -1), 0); - slide - .css({ - opacity: slideOpacity - }) - .transform('translate3d(' + tx + 'px, ' + ty + 'px, 0px)'); - - } - - }, - setTransition: function (duration) { - s.slides.transition(duration); - if (s.params.virtualTranslate && duration !== 0) { - var eventTriggered = false; - s.slides.transitionEnd(function () { - if (eventTriggered) return; - if (!s) return; - eventTriggered = true; - s.animating = false; - var triggerEvents = ['webkitTransitionEnd', 'transitionend', 'oTransitionEnd', 'MSTransitionEnd', 'msTransitionEnd']; - for (var i = 0; i < triggerEvents.length; i++) { - s.wrapper.trigger(triggerEvents[i]); - } - }); - } - } - }, - flip: { - setTranslate: function () { - for (var i = 0; i < s.slides.length; i++) { - var slide = s.slides.eq(i); - var progress = slide[0].progress; - if (s.params.flip.limitRotation) { - progress = Math.max(Math.min(slide[0].progress, 1), -1); - } - var offset = slide[0].swiperSlideOffset; - var rotate = -180 * progress, - rotateY = rotate, - rotateX = 0, - tx = -offset, - ty = 0; - if (!s.isHorizontal()) { - ty = tx; - tx = 0; - rotateX = -rotateY; - rotateY = 0; - } - else if (s.rtl) { - rotateY = -rotateY; - } - - slide[0].style.zIndex = -Math.abs(Math.round(progress)) + s.slides.length; - - if (s.params.flip.slideShadows) { - //Set shadows - var shadowBefore = s.isHorizontal() ? slide.find('.swiper-slide-shadow-left') : slide.find('.swiper-slide-shadow-top'); - var shadowAfter = s.isHorizontal() ? slide.find('.swiper-slide-shadow-right') : slide.find('.swiper-slide-shadow-bottom'); - if (shadowBefore.length === 0) { - shadowBefore = $('
'); - slide.append(shadowBefore); - } - if (shadowAfter.length === 0) { - shadowAfter = $('
'); - slide.append(shadowAfter); - } - if (shadowBefore.length) shadowBefore[0].style.opacity = Math.max(-progress, 0); - if (shadowAfter.length) shadowAfter[0].style.opacity = Math.max(progress, 0); - } - - slide - .transform('translate3d(' + tx + 'px, ' + ty + 'px, 0px) rotateX(' + rotateX + 'deg) rotateY(' + rotateY + 'deg)'); - } - }, - setTransition: function (duration) { - s.slides.transition(duration).find('.swiper-slide-shadow-top, .swiper-slide-shadow-right, .swiper-slide-shadow-bottom, .swiper-slide-shadow-left').transition(duration); - if (s.params.virtualTranslate && duration !== 0) { - var eventTriggered = false; - s.slides.eq(s.activeIndex).transitionEnd(function () { - if (eventTriggered) return; - if (!s) return; - if (!$(this).hasClass(s.params.slideActiveClass)) return; - eventTriggered = true; - s.animating = false; - var triggerEvents = ['webkitTransitionEnd', 'transitionend', 'oTransitionEnd', 'MSTransitionEnd', 'msTransitionEnd']; - for (var i = 0; i < triggerEvents.length; i++) { - s.wrapper.trigger(triggerEvents[i]); - } - }); - } - } - }, - cube: { - setTranslate: function () { - var wrapperRotate = 0, cubeShadow; - if (s.params.cube.shadow) { - if (s.isHorizontal()) { - cubeShadow = s.wrapper.find('.swiper-cube-shadow'); - if (cubeShadow.length === 0) { - cubeShadow = $('
'); - s.wrapper.append(cubeShadow); - } - cubeShadow.css({height: s.width + 'px'}); - } - else { - cubeShadow = s.container.find('.swiper-cube-shadow'); - if (cubeShadow.length === 0) { - cubeShadow = $('
'); - s.container.append(cubeShadow); - } - } - } - for (var i = 0; i < s.slides.length; i++) { - var slide = s.slides.eq(i); - var slideAngle = i * 90; - var round = Math.floor(slideAngle / 360); - if (s.rtl) { - slideAngle = -slideAngle; - round = Math.floor(-slideAngle / 360); - } - var progress = Math.max(Math.min(slide[0].progress, 1), -1); - var tx = 0, ty = 0, tz = 0; - if (i % 4 === 0) { - tx = - round * 4 * s.size; - tz = 0; - } - else if ((i - 1) % 4 === 0) { - tx = 0; - tz = - round * 4 * s.size; - } - else if ((i - 2) % 4 === 0) { - tx = s.size + round * 4 * s.size; - tz = s.size; - } - else if ((i - 3) % 4 === 0) { - tx = - s.size; - tz = 3 * s.size + s.size * 4 * round; - } - if (s.rtl) { - tx = -tx; - } - - if (!s.isHorizontal()) { - ty = tx; - tx = 0; - } - - var transform = 'rotateX(' + (s.isHorizontal() ? 0 : -slideAngle) + 'deg) rotateY(' + (s.isHorizontal() ? slideAngle : 0) + 'deg) translate3d(' + tx + 'px, ' + ty + 'px, ' + tz + 'px)'; - if (progress <= 1 && progress > -1) { - wrapperRotate = i * 90 + progress * 90; - if (s.rtl) wrapperRotate = -i * 90 - progress * 90; - } - slide.transform(transform); - if (s.params.cube.slideShadows) { - //Set shadows - var shadowBefore = s.isHorizontal() ? slide.find('.swiper-slide-shadow-left') : slide.find('.swiper-slide-shadow-top'); - var shadowAfter = s.isHorizontal() ? slide.find('.swiper-slide-shadow-right') : slide.find('.swiper-slide-shadow-bottom'); - if (shadowBefore.length === 0) { - shadowBefore = $('
'); - slide.append(shadowBefore); - } - if (shadowAfter.length === 0) { - shadowAfter = $('
'); - slide.append(shadowAfter); - } - if (shadowBefore.length) shadowBefore[0].style.opacity = Math.max(-progress, 0); - if (shadowAfter.length) shadowAfter[0].style.opacity = Math.max(progress, 0); - } - } - s.wrapper.css({ - '-webkit-transform-origin': '50% 50% -' + (s.size / 2) + 'px', - '-moz-transform-origin': '50% 50% -' + (s.size / 2) + 'px', - '-ms-transform-origin': '50% 50% -' + (s.size / 2) + 'px', - 'transform-origin': '50% 50% -' + (s.size / 2) + 'px' - }); - - if (s.params.cube.shadow) { - if (s.isHorizontal()) { - cubeShadow.transform('translate3d(0px, ' + (s.width / 2 + s.params.cube.shadowOffset) + 'px, ' + (-s.width / 2) + 'px) rotateX(90deg) rotateZ(0deg) scale(' + (s.params.cube.shadowScale) + ')'); - } - else { - var shadowAngle = Math.abs(wrapperRotate) - Math.floor(Math.abs(wrapperRotate) / 90) * 90; - var multiplier = 1.5 - (Math.sin(shadowAngle * 2 * Math.PI / 360) / 2 + Math.cos(shadowAngle * 2 * Math.PI / 360) / 2); - var scale1 = s.params.cube.shadowScale, - scale2 = s.params.cube.shadowScale / multiplier, - offset = s.params.cube.shadowOffset; - cubeShadow.transform('scale3d(' + scale1 + ', 1, ' + scale2 + ') translate3d(0px, ' + (s.height / 2 + offset) + 'px, ' + (-s.height / 2 / scale2) + 'px) rotateX(-90deg)'); - } - } - var zFactor = (s.isSafari || s.isUiWebView) ? (-s.size / 2) : 0; - s.wrapper.transform('translate3d(0px,0,' + zFactor + 'px) rotateX(' + (s.isHorizontal() ? 0 : wrapperRotate) + 'deg) rotateY(' + (s.isHorizontal() ? -wrapperRotate : 0) + 'deg)'); - }, - setTransition: function (duration) { - s.slides.transition(duration).find('.swiper-slide-shadow-top, .swiper-slide-shadow-right, .swiper-slide-shadow-bottom, .swiper-slide-shadow-left').transition(duration); - if (s.params.cube.shadow && !s.isHorizontal()) { - s.container.find('.swiper-cube-shadow').transition(duration); - } - } - }, - coverflow: { - setTranslate: function () { - var transform = s.translate; - var center = s.isHorizontal() ? -transform + s.width / 2 : -transform + s.height / 2; - var rotate = s.isHorizontal() ? s.params.coverflow.rotate: -s.params.coverflow.rotate; - var translate = s.params.coverflow.depth; - //Each slide offset from center - for (var i = 0, length = s.slides.length; i < length; i++) { - var slide = s.slides.eq(i); - var slideSize = s.slidesSizesGrid[i]; - var slideOffset = slide[0].swiperSlideOffset; - var offsetMultiplier = (center - slideOffset - slideSize / 2) / slideSize * s.params.coverflow.modifier; - - var rotateY = s.isHorizontal() ? rotate * offsetMultiplier : 0; - var rotateX = s.isHorizontal() ? 0 : rotate * offsetMultiplier; - // var rotateZ = 0 - var translateZ = -translate * Math.abs(offsetMultiplier); - - var translateY = s.isHorizontal() ? 0 : s.params.coverflow.stretch * (offsetMultiplier); - var translateX = s.isHorizontal() ? s.params.coverflow.stretch * (offsetMultiplier) : 0; - - //Fix for ultra small values - if (Math.abs(translateX) < 0.001) translateX = 0; - if (Math.abs(translateY) < 0.001) translateY = 0; - if (Math.abs(translateZ) < 0.001) translateZ = 0; - if (Math.abs(rotateY) < 0.001) rotateY = 0; - if (Math.abs(rotateX) < 0.001) rotateX = 0; - - var slideTransform = 'translate3d(' + translateX + 'px,' + translateY + 'px,' + translateZ + 'px) rotateX(' + rotateX + 'deg) rotateY(' + rotateY + 'deg)'; - - slide.transform(slideTransform); - slide[0].style.zIndex = -Math.abs(Math.round(offsetMultiplier)) + 1; - if (s.params.coverflow.slideShadows) { - //Set shadows - var shadowBefore = s.isHorizontal() ? slide.find('.swiper-slide-shadow-left') : slide.find('.swiper-slide-shadow-top'); - var shadowAfter = s.isHorizontal() ? slide.find('.swiper-slide-shadow-right') : slide.find('.swiper-slide-shadow-bottom'); - if (shadowBefore.length === 0) { - shadowBefore = $('
'); - slide.append(shadowBefore); - } - if (shadowAfter.length === 0) { - shadowAfter = $('
'); - slide.append(shadowAfter); - } - if (shadowBefore.length) shadowBefore[0].style.opacity = offsetMultiplier > 0 ? offsetMultiplier : 0; - if (shadowAfter.length) shadowAfter[0].style.opacity = (-offsetMultiplier) > 0 ? -offsetMultiplier : 0; - } - } - - //Set correct perspective for IE10 - if (s.browser.ie) { - var ws = s.wrapper[0].style; - ws.perspectiveOrigin = center + 'px 50%'; - } - }, - setTransition: function (duration) { - s.slides.transition(duration).find('.swiper-slide-shadow-top, .swiper-slide-shadow-right, .swiper-slide-shadow-bottom, .swiper-slide-shadow-left').transition(duration); - } - } - }; - - - /*========================= - Images Lazy Loading - ===========================*/ - s.lazy = { - initialImageLoaded: false, - loadImageInSlide: function (index, loadInDuplicate) { - if (typeof index === 'undefined') return; - if (typeof loadInDuplicate === 'undefined') loadInDuplicate = true; - if (s.slides.length === 0) return; - - var slide = s.slides.eq(index); - var img = slide.find('.' + s.params.lazyLoadingClass + ':not(.' + s.params.lazyStatusLoadedClass + '):not(.' + s.params.lazyStatusLoadingClass + ')'); - if (slide.hasClass(s.params.lazyLoadingClass) && !slide.hasClass(s.params.lazyStatusLoadedClass) && !slide.hasClass(s.params.lazyStatusLoadingClass)) { - img = img.add(slide[0]); - } - if (img.length === 0) return; - - img.each(function () { - var _img = $(this); - _img.addClass(s.params.lazyStatusLoadingClass); - var background = _img.attr('data-background'); - var src = _img.attr('data-src'), - srcset = _img.attr('data-srcset'), - sizes = _img.attr('data-sizes'); - s.loadImage(_img[0], (src || background), srcset, sizes, false, function () { - if (typeof s === 'undefined' || s === null || !s) return; - if (background) { - _img.css('background-image', 'url("' + background + '")'); - _img.removeAttr('data-background'); - } - else { - if (srcset) { - _img.attr('srcset', srcset); - _img.removeAttr('data-srcset'); - } - if (sizes) { - _img.attr('sizes', sizes); - _img.removeAttr('data-sizes'); - } - if (src) { - _img.attr('src', src); - _img.removeAttr('data-src'); - } - - } - - _img.addClass(s.params.lazyStatusLoadedClass).removeClass(s.params.lazyStatusLoadingClass); - slide.find('.' + s.params.lazyPreloaderClass + ', .' + s.params.preloaderClass).remove(); - if (s.params.loop && loadInDuplicate) { - var slideOriginalIndex = slide.attr('data-swiper-slide-index'); - if (slide.hasClass(s.params.slideDuplicateClass)) { - var originalSlide = s.wrapper.children('[data-swiper-slide-index="' + slideOriginalIndex + '"]:not(.' + s.params.slideDuplicateClass + ')'); - s.lazy.loadImageInSlide(originalSlide.index(), false); - } - else { - var duplicatedSlide = s.wrapper.children('.' + s.params.slideDuplicateClass + '[data-swiper-slide-index="' + slideOriginalIndex + '"]'); - s.lazy.loadImageInSlide(duplicatedSlide.index(), false); - } - } - s.emit('onLazyImageReady', s, slide[0], _img[0]); - }); - - s.emit('onLazyImageLoad', s, slide[0], _img[0]); - }); - - }, - load: function () { - var i; - var slidesPerView = s.params.slidesPerView; - if (slidesPerView === 'auto') { - slidesPerView = 0; - } - if (!s.lazy.initialImageLoaded) s.lazy.initialImageLoaded = true; - if (s.params.watchSlidesVisibility) { - s.wrapper.children('.' + s.params.slideVisibleClass).each(function () { - s.lazy.loadImageInSlide($(this).index()); - }); - } - else { - if (slidesPerView > 1) { - for (i = s.activeIndex; i < s.activeIndex + slidesPerView ; i++) { - if (s.slides[i]) s.lazy.loadImageInSlide(i); - } - } - else { - s.lazy.loadImageInSlide(s.activeIndex); - } - } - if (s.params.lazyLoadingInPrevNext) { - if (slidesPerView > 1 || (s.params.lazyLoadingInPrevNextAmount && s.params.lazyLoadingInPrevNextAmount > 1)) { - var amount = s.params.lazyLoadingInPrevNextAmount; - var spv = slidesPerView; - var maxIndex = Math.min(s.activeIndex + spv + Math.max(amount, spv), s.slides.length); - var minIndex = Math.max(s.activeIndex - Math.max(spv, amount), 0); - // Next Slides - for (i = s.activeIndex + slidesPerView; i < maxIndex; i++) { - if (s.slides[i]) s.lazy.loadImageInSlide(i); - } - // Prev Slides - for (i = minIndex; i < s.activeIndex ; i++) { - if (s.slides[i]) s.lazy.loadImageInSlide(i); - } - } - else { - var nextSlide = s.wrapper.children('.' + s.params.slideNextClass); - if (nextSlide.length > 0) s.lazy.loadImageInSlide(nextSlide.index()); - - var prevSlide = s.wrapper.children('.' + s.params.slidePrevClass); - if (prevSlide.length > 0) s.lazy.loadImageInSlide(prevSlide.index()); - } - } - }, - onTransitionStart: function () { - if (s.params.lazyLoading) { - if (s.params.lazyLoadingOnTransitionStart || (!s.params.lazyLoadingOnTransitionStart && !s.lazy.initialImageLoaded)) { - s.lazy.load(); - } - } - }, - onTransitionEnd: function () { - if (s.params.lazyLoading && !s.params.lazyLoadingOnTransitionStart) { - s.lazy.load(); - } - } - }; - - - /*========================= - Scrollbar - ===========================*/ - s.scrollbar = { - isTouched: false, - setDragPosition: function (e) { - var sb = s.scrollbar; - var x = 0, y = 0; - var translate; - var pointerPosition = s.isHorizontal() ? - ((e.type === 'touchstart' || e.type === 'touchmove') ? e.targetTouches[0].pageX : e.pageX || e.clientX) : - ((e.type === 'touchstart' || e.type === 'touchmove') ? e.targetTouches[0].pageY : e.pageY || e.clientY) ; - var position = (pointerPosition) - sb.track.offset()[s.isHorizontal() ? 'left' : 'top'] - sb.dragSize / 2; - var positionMin = -s.minTranslate() * sb.moveDivider; - var positionMax = -s.maxTranslate() * sb.moveDivider; - if (position < positionMin) { - position = positionMin; - } - else if (position > positionMax) { - position = positionMax; - } - position = -position / sb.moveDivider; - s.updateProgress(position); - s.setWrapperTranslate(position, true); - }, - dragStart: function (e) { - var sb = s.scrollbar; - sb.isTouched = true; - e.preventDefault(); - e.stopPropagation(); - - sb.setDragPosition(e); - clearTimeout(sb.dragTimeout); - - sb.track.transition(0); - if (s.params.scrollbarHide) { - sb.track.css('opacity', 1); - } - s.wrapper.transition(100); - sb.drag.transition(100); - s.emit('onScrollbarDragStart', s); - }, - dragMove: function (e) { - var sb = s.scrollbar; - if (!sb.isTouched) return; - if (e.preventDefault) e.preventDefault(); - else e.returnValue = false; - sb.setDragPosition(e); - s.wrapper.transition(0); - sb.track.transition(0); - sb.drag.transition(0); - s.emit('onScrollbarDragMove', s); - }, - dragEnd: function (e) { - var sb = s.scrollbar; - if (!sb.isTouched) return; - sb.isTouched = false; - if (s.params.scrollbarHide) { - clearTimeout(sb.dragTimeout); - sb.dragTimeout = setTimeout(function () { - sb.track.css('opacity', 0); - sb.track.transition(400); - }, 1000); - - } - s.emit('onScrollbarDragEnd', s); - if (s.params.scrollbarSnapOnRelease) { - s.slideReset(); - } - }, - draggableEvents: (function () { - if ((s.params.simulateTouch === false && !s.support.touch)) return s.touchEventsDesktop; - else return s.touchEvents; - })(), - enableDraggable: function () { - var sb = s.scrollbar; - var target = s.support.touch ? sb.track : document; - $(sb.track).on(sb.draggableEvents.start, sb.dragStart); - $(target).on(sb.draggableEvents.move, sb.dragMove); - $(target).on(sb.draggableEvents.end, sb.dragEnd); - }, - disableDraggable: function () { - var sb = s.scrollbar; - var target = s.support.touch ? sb.track : document; - $(sb.track).off(sb.draggableEvents.start, sb.dragStart); - $(target).off(sb.draggableEvents.move, sb.dragMove); - $(target).off(sb.draggableEvents.end, sb.dragEnd); - }, - set: function () { - if (!s.params.scrollbar) return; - var sb = s.scrollbar; - sb.track = $(s.params.scrollbar); - if (s.params.uniqueNavElements && typeof s.params.scrollbar === 'string' && sb.track.length > 1 && s.container.find(s.params.scrollbar).length === 1) { - sb.track = s.container.find(s.params.scrollbar); - } - sb.drag = sb.track.find('.swiper-scrollbar-drag'); - if (sb.drag.length === 0) { - sb.drag = $('
'); - sb.track.append(sb.drag); - } - sb.drag[0].style.width = ''; - sb.drag[0].style.height = ''; - sb.trackSize = s.isHorizontal() ? sb.track[0].offsetWidth : sb.track[0].offsetHeight; - - sb.divider = s.size / s.virtualSize; - sb.moveDivider = sb.divider * (sb.trackSize / s.size); - sb.dragSize = sb.trackSize * sb.divider; - - if (s.isHorizontal()) { - sb.drag[0].style.width = sb.dragSize + 'px'; - } - else { - sb.drag[0].style.height = sb.dragSize + 'px'; - } - - if (sb.divider >= 1) { - sb.track[0].style.display = 'none'; - } - else { - sb.track[0].style.display = ''; - } - if (s.params.scrollbarHide) { - sb.track[0].style.opacity = 0; - } - }, - setTranslate: function () { - if (!s.params.scrollbar) return; - var diff; - var sb = s.scrollbar; - var translate = s.translate || 0; - var newPos; - - var newSize = sb.dragSize; - newPos = (sb.trackSize - sb.dragSize) * s.progress; - if (s.rtl && s.isHorizontal()) { - newPos = -newPos; - if (newPos > 0) { - newSize = sb.dragSize - newPos; - newPos = 0; - } - else if (-newPos + sb.dragSize > sb.trackSize) { - newSize = sb.trackSize + newPos; - } - } - else { - if (newPos < 0) { - newSize = sb.dragSize + newPos; - newPos = 0; - } - else if (newPos + sb.dragSize > sb.trackSize) { - newSize = sb.trackSize - newPos; - } - } - if (s.isHorizontal()) { - if (s.support.transforms3d) { - sb.drag.transform('translate3d(' + (newPos) + 'px, 0, 0)'); - } - else { - sb.drag.transform('translateX(' + (newPos) + 'px)'); - } - sb.drag[0].style.width = newSize + 'px'; - } - else { - if (s.support.transforms3d) { - sb.drag.transform('translate3d(0px, ' + (newPos) + 'px, 0)'); - } - else { - sb.drag.transform('translateY(' + (newPos) + 'px)'); - } - sb.drag[0].style.height = newSize + 'px'; - } - if (s.params.scrollbarHide) { - clearTimeout(sb.timeout); - sb.track[0].style.opacity = 1; - sb.timeout = setTimeout(function () { - sb.track[0].style.opacity = 0; - sb.track.transition(400); - }, 1000); - } - }, - setTransition: function (duration) { - if (!s.params.scrollbar) return; - s.scrollbar.drag.transition(duration); - } - }; - - - /*========================= - Controller - ===========================*/ - s.controller = { - LinearSpline: function (x, y) { - var binarySearch = (function() { - var maxIndex, minIndex, guess; - return function(array, val) { - minIndex = -1; - maxIndex = array.length; - while (maxIndex - minIndex > 1) - if (array[guess = maxIndex + minIndex >> 1] <= val) { - minIndex = guess; - } else { - maxIndex = guess; - } - return maxIndex; - }; - })(); - this.x = x; - this.y = y; - this.lastIndex = x.length - 1; - // Given an x value (x2), return the expected y2 value: - // (x1,y1) is the known point before given value, - // (x3,y3) is the known point after given value. - var i1, i3; - var l = this.x.length; - - this.interpolate = function (x2) { - if (!x2) return 0; - - // Get the indexes of x1 and x3 (the array indexes before and after given x2): - i3 = binarySearch(this.x, x2); - i1 = i3 - 1; - - // We have our indexes i1 & i3, so we can calculate already: - // y2 := ((x2−x1) × (y3−y1)) ÷ (x3−x1) + y1 - return ((x2 - this.x[i1]) * (this.y[i3] - this.y[i1])) / (this.x[i3] - this.x[i1]) + this.y[i1]; - }; - }, - //xxx: for now i will just save one spline function to to - getInterpolateFunction: function(c){ - if(!s.controller.spline) s.controller.spline = s.params.loop ? - new s.controller.LinearSpline(s.slidesGrid, c.slidesGrid) : - new s.controller.LinearSpline(s.snapGrid, c.snapGrid); - }, - setTranslate: function (translate, byController) { - var controlled = s.params.control; - var multiplier, controlledTranslate; - function setControlledTranslate(c) { - // this will create an Interpolate function based on the snapGrids - // x is the Grid of the scrolled scroller and y will be the controlled scroller - // it makes sense to create this only once and recall it for the interpolation - // the function does a lot of value caching for performance - translate = c.rtl && c.params.direction === 'horizontal' ? -s.translate : s.translate; - if (s.params.controlBy === 'slide') { - s.controller.getInterpolateFunction(c); - // i am not sure why the values have to be multiplicated this way, tried to invert the snapGrid - // but it did not work out - controlledTranslate = -s.controller.spline.interpolate(-translate); - } - - if(!controlledTranslate || s.params.controlBy === 'container'){ - multiplier = (c.maxTranslate() - c.minTranslate()) / (s.maxTranslate() - s.minTranslate()); - controlledTranslate = (translate - s.minTranslate()) * multiplier + c.minTranslate(); - } - - if (s.params.controlInverse) { - controlledTranslate = c.maxTranslate() - controlledTranslate; - } - c.updateProgress(controlledTranslate); - c.setWrapperTranslate(controlledTranslate, false, s); - c.updateActiveIndex(); - } - if (Array.isArray(controlled)) { - for (var i = 0; i < controlled.length; i++) { - if (controlled[i] !== byController && controlled[i] instanceof Swiper) { - setControlledTranslate(controlled[i]); - } - } - } - else if (controlled instanceof Swiper && byController !== controlled) { - - setControlledTranslate(controlled); - } - }, - setTransition: function (duration, byController) { - var controlled = s.params.control; - var i; - function setControlledTransition(c) { - c.setWrapperTransition(duration, s); - if (duration !== 0) { - c.onTransitionStart(); - c.wrapper.transitionEnd(function(){ - if (!controlled) return; - if (c.params.loop && s.params.controlBy === 'slide') { - c.fixLoop(); - } - c.onTransitionEnd(); - - }); - } - } - if (Array.isArray(controlled)) { - for (i = 0; i < controlled.length; i++) { - if (controlled[i] !== byController && controlled[i] instanceof Swiper) { - setControlledTransition(controlled[i]); - } - } - } - else if (controlled instanceof Swiper && byController !== controlled) { - setControlledTransition(controlled); - } - } - }; - - - /*========================= - Hash Navigation - ===========================*/ - s.hashnav = { - onHashCange: function (e, a) { - var newHash = document.location.hash.replace('#', ''); - var activeSlideHash = s.slides.eq(s.activeIndex).attr('data-hash'); - if (newHash !== activeSlideHash) { - s.slideTo(s.wrapper.children('.' + s.params.slideClass + '[data-hash="' + (newHash) + '"]').index()); - } - }, - attachEvents: function (detach) { - var action = detach ? 'off' : 'on'; - $(window)[action]('hashchange', s.hashnav.onHashCange); - }, - setHash: function () { - if (!s.hashnav.initialized || !s.params.hashnav) return; - if (s.params.replaceState && window.history && window.history.replaceState) { - window.history.replaceState(null, null, ('#' + s.slides.eq(s.activeIndex).attr('data-hash') || '')); - } else { - var slide = s.slides.eq(s.activeIndex); - var hash = slide.attr('data-hash') || slide.attr('data-history'); - document.location.hash = hash || ''; - } - }, - init: function () { - if (!s.params.hashnav || s.params.history) return; - s.hashnav.initialized = true; - var hash = document.location.hash.replace('#', ''); - if (hash) { - var speed = 0; - for (var i = 0, length = s.slides.length; i < length; i++) { - var slide = s.slides.eq(i); - var slideHash = slide.attr('data-hash') || slide.attr('data-history'); - if (slideHash === hash && !slide.hasClass(s.params.slideDuplicateClass)) { - var index = slide.index(); - s.slideTo(index, speed, s.params.runCallbacksOnInit, true); - } - } - } - if (s.params.hashnavWatchState) s.hashnav.attachEvents(); - }, - destroy: function () { - if (s.params.hashnavWatchState) s.hashnav.attachEvents(true); - } - }; - - - /*========================= - History Api with fallback to Hashnav - ===========================*/ - s.history = { - init: function () { - if (!s.params.history) return; - if (!window.history || !window.history.pushState) { - s.params.history = false; - s.params.hashnav = true; - return; - } - s.history.initialized = true; - this.paths = this.getPathValues(); - if (!this.paths.key && !this.paths.value) return; - this.scrollToSlide(0, this.paths.value, s.params.runCallbacksOnInit); - if (!s.params.replaceState) { - window.addEventListener('popstate', this.setHistoryPopState); - } - }, - setHistoryPopState: function() { - s.history.paths = s.history.getPathValues(); - s.history.scrollToSlide(s.params.speed, s.history.paths.value, false); - }, - getPathValues: function() { - var pathArray = window.location.pathname.slice(1).split('/'); - var total = pathArray.length; - var key = pathArray[total - 2]; - var value = pathArray[total - 1]; - return { key: key, value: value }; - }, - setHistory: function (key, index) { - if (!s.history.initialized || !s.params.history) return; - var slide = s.slides.eq(index); - var value = this.slugify(slide.attr('data-history')); - if (!window.location.pathname.includes(key)) { - value = key + '/' + value; - } - if (s.params.replaceState) { - window.history.replaceState(null, null, value); - } else { - window.history.pushState(null, null, value); - } - }, - slugify: function(text) { - return text.toString().toLowerCase() - .replace(/\s+/g, '-') - .replace(/[^\w\-]+/g, '') - .replace(/\-\-+/g, '-') - .replace(/^-+/, '') - .replace(/-+$/, ''); - }, - scrollToSlide: function(speed, value, runCallbacks) { - if (value) { - for (var i = 0, length = s.slides.length; i < length; i++) { - var slide = s.slides.eq(i); - var slideHistory = this.slugify(slide.attr('data-history')); - if (slideHistory === value && !slide.hasClass(s.params.slideDuplicateClass)) { - var index = slide.index(); - s.slideTo(index, speed, runCallbacks); - } - } - } else { - s.slideTo(0, speed, runCallbacks); - } - } - }; - - - /*========================= - Keyboard Control - ===========================*/ - function handleKeyboard(e) { - if (e.originalEvent) e = e.originalEvent; //jquery fix - var kc = e.keyCode || e.charCode; - // Directions locks - if (!s.params.allowSwipeToNext && (s.isHorizontal() && kc === 39 || !s.isHorizontal() && kc === 40)) { - return false; - } - if (!s.params.allowSwipeToPrev && (s.isHorizontal() && kc === 37 || !s.isHorizontal() && kc === 38)) { - return false; - } - if (e.shiftKey || e.altKey || e.ctrlKey || e.metaKey) { - return; - } - if (document.activeElement && document.activeElement.nodeName && (document.activeElement.nodeName.toLowerCase() === 'input' || document.activeElement.nodeName.toLowerCase() === 'textarea')) { - return; - } - if (kc === 37 || kc === 39 || kc === 38 || kc === 40) { - var inView = false; - //Check that swiper should be inside of visible area of window - if (s.container.parents('.' + s.params.slideClass).length > 0 && s.container.parents('.' + s.params.slideActiveClass).length === 0) { - return; - } - var windowScroll = { - left: window.pageXOffset, - top: window.pageYOffset - }; - var windowWidth = window.innerWidth; - var windowHeight = window.innerHeight; - var swiperOffset = s.container.offset(); - if (s.rtl) swiperOffset.left = swiperOffset.left - s.container[0].scrollLeft; - var swiperCoord = [ - [swiperOffset.left, swiperOffset.top], - [swiperOffset.left + s.width, swiperOffset.top], - [swiperOffset.left, swiperOffset.top + s.height], - [swiperOffset.left + s.width, swiperOffset.top + s.height] - ]; - for (var i = 0; i < swiperCoord.length; i++) { - var point = swiperCoord[i]; - if ( - point[0] >= windowScroll.left && point[0] <= windowScroll.left + windowWidth && - point[1] >= windowScroll.top && point[1] <= windowScroll.top + windowHeight - ) { - inView = true; - } - - } - if (!inView) return; - } - if (s.isHorizontal()) { - if (kc === 37 || kc === 39) { - if (e.preventDefault) e.preventDefault(); - else e.returnValue = false; - } - if ((kc === 39 && !s.rtl) || (kc === 37 && s.rtl)) s.slideNext(); - if ((kc === 37 && !s.rtl) || (kc === 39 && s.rtl)) s.slidePrev(); - } - else { - if (kc === 38 || kc === 40) { - if (e.preventDefault) e.preventDefault(); - else e.returnValue = false; - } - if (kc === 40) s.slideNext(); - if (kc === 38) s.slidePrev(); - } - s.emit('onKeyPress', s, kc); - } - s.disableKeyboardControl = function () { - s.params.keyboardControl = false; - $(document).off('keydown', handleKeyboard); - }; - s.enableKeyboardControl = function () { - s.params.keyboardControl = true; - $(document).on('keydown', handleKeyboard); - }; - - - /*========================= - Mousewheel Control - ===========================*/ - s.mousewheel = { - event: false, - lastScrollTime: (new window.Date()).getTime() - }; - function isEventSupported() { - var eventName = 'onwheel'; - var isSupported = eventName in document; - - if (!isSupported) { - var element = document.createElement('div'); - element.setAttribute(eventName, 'return;'); - isSupported = typeof element[eventName] === 'function'; - } - - if (!isSupported && - document.implementation && - document.implementation.hasFeature && - // always returns true in newer browsers as per the standard. - // @see http://dom.spec.whatwg.org/#dom-domimplementation-hasfeature - document.implementation.hasFeature('', '') !== true ) { - // This is the only way to test support for the `wheel` event in IE9+. - isSupported = document.implementation.hasFeature('Events.wheel', '3.0'); - } - - return isSupported; - } - /** - * Mouse wheel (and 2-finger trackpad) support on the web sucks. It is - * complicated, thus this doc is long and (hopefully) detailed enough to answer - * your questions. - * - * If you need to react to the mouse wheel in a predictable way, this code is - * like your bestest friend. * hugs * - * - * As of today, there are 4 DOM event types you can listen to: - * - * 'wheel' -- Chrome(31+), FF(17+), IE(9+) - * 'mousewheel' -- Chrome, IE(6+), Opera, Safari - * 'MozMousePixelScroll' -- FF(3.5 only!) (2010-2013) -- don't bother! - * 'DOMMouseScroll' -- FF(0.9.7+) since 2003 - * - * So what to do? The is the best: - * - * normalizeWheel.getEventType(); - * - * In your event callback, use this code to get sane interpretation of the - * deltas. This code will return an object with properties: - * - * spinX -- normalized spin speed (use for zoom) - x plane - * spinY -- " - y plane - * pixelX -- normalized distance (to pixels) - x plane - * pixelY -- " - y plane - * - * Wheel values are provided by the browser assuming you are using the wheel to - * scroll a web page by a number of lines or pixels (or pages). Values can vary - * significantly on different platforms and browsers, forgetting that you can - * scroll at different speeds. Some devices (like trackpads) emit more events - * at smaller increments with fine granularity, and some emit massive jumps with - * linear speed or acceleration. - * - * This code does its best to normalize the deltas for you: - * - * - spin is trying to normalize how far the wheel was spun (or trackpad - * dragged). This is super useful for zoom support where you want to - * throw away the chunky scroll steps on the PC and make those equal to - * the slow and smooth tiny steps on the Mac. Key data: This code tries to - * resolve a single slow step on a wheel to 1. - * - * - pixel is normalizing the desired scroll delta in pixel units. You'll - * get the crazy differences between browsers, but at least it'll be in - * pixels! - * - * - positive value indicates scrolling DOWN/RIGHT, negative UP/LEFT. This - * should translate to positive value zooming IN, negative zooming OUT. - * This matches the newer 'wheel' event. - * - * Why are there spinX, spinY (or pixels)? - * - * - spinX is a 2-finger side drag on the trackpad, and a shift + wheel turn - * with a mouse. It results in side-scrolling in the browser by default. - * - * - spinY is what you expect -- it's the classic axis of a mouse wheel. - * - * - I dropped spinZ/pixelZ. It is supported by the DOM 3 'wheel' event and - * probably is by browsers in conjunction with fancy 3D controllers .. but - * you know. - * - * Implementation info: - * - * Examples of 'wheel' event if you scroll slowly (down) by one step with an - * average mouse: - * - * OS X + Chrome (mouse) - 4 pixel delta (wheelDelta -120) - * OS X + Safari (mouse) - N/A pixel delta (wheelDelta -12) - * OS X + Firefox (mouse) - 0.1 line delta (wheelDelta N/A) - * Win8 + Chrome (mouse) - 100 pixel delta (wheelDelta -120) - * Win8 + Firefox (mouse) - 3 line delta (wheelDelta -120) - * - * On the trackpad: - * - * OS X + Chrome (trackpad) - 2 pixel delta (wheelDelta -6) - * OS X + Firefox (trackpad) - 1 pixel delta (wheelDelta N/A) - * - * On other/older browsers.. it's more complicated as there can be multiple and - * also missing delta values. - * - * The 'wheel' event is more standard: - * - * http://www.w3.org/TR/DOM-Level-3-Events/#events-wheelevents - * - * The basics is that it includes a unit, deltaMode (pixels, lines, pages), and - * deltaX, deltaY and deltaZ. Some browsers provide other values to maintain - * backward compatibility with older events. Those other values help us - * better normalize spin speed. Example of what the browsers provide: - * - * | event.wheelDelta | event.detail - * ------------------+------------------+-------------- - * Safari v5/OS X | -120 | 0 - * Safari v5/Win7 | -120 | 0 - * Chrome v17/OS X | -120 | 0 - * Chrome v17/Win7 | -120 | 0 - * IE9/Win7 | -120 | undefined - * Firefox v4/OS X | undefined | 1 - * Firefox v4/Win7 | undefined | 3 - * - */ - function normalizeWheel( /*object*/ event ) /*object*/ { - // Reasonable defaults - var PIXEL_STEP = 10; - var LINE_HEIGHT = 40; - var PAGE_HEIGHT = 800; - - var sX = 0, sY = 0, // spinX, spinY - pX = 0, pY = 0; // pixelX, pixelY - - // Legacy - if( 'detail' in event ) { - sY = event.detail; - } - if( 'wheelDelta' in event ) { - sY = -event.wheelDelta / 120; - } - if( 'wheelDeltaY' in event ) { - sY = -event.wheelDeltaY / 120; - } - if( 'wheelDeltaX' in event ) { - sX = -event.wheelDeltaX / 120; - } - - // side scrolling on FF with DOMMouseScroll - if( 'axis' in event && event.axis === event.HORIZONTAL_AXIS ) { - sX = sY; - sY = 0; - } - - pX = sX * PIXEL_STEP; - pY = sY * PIXEL_STEP; - - if( 'deltaY' in event ) { - pY = event.deltaY; - } - if( 'deltaX' in event ) { - pX = event.deltaX; - } - - if( (pX || pY) && event.deltaMode ) { - if( event.deltaMode === 1 ) { // delta in LINE units - pX *= LINE_HEIGHT; - pY *= LINE_HEIGHT; - } else { // delta in PAGE units - pX *= PAGE_HEIGHT; - pY *= PAGE_HEIGHT; - } - } - - // Fall-back if spin cannot be determined - if( pX && !sX ) { - sX = (pX < 1) ? -1 : 1; - } - if( pY && !sY ) { - sY = (pY < 1) ? -1 : 1; - } - - return { - spinX: sX, - spinY: sY, - pixelX: pX, - pixelY: pY - }; - } - if (s.params.mousewheelControl) { - /** - * The best combination if you prefer spinX + spinY normalization. It favors - * the older DOMMouseScroll for Firefox, as FF does not include wheelDelta with - * 'wheel' event, making spin speed determination impossible. - */ - s.mousewheel.event = (navigator.userAgent.indexOf('firefox') > -1) ? - 'DOMMouseScroll' : - isEventSupported() ? - 'wheel' : 'mousewheel'; - } - function handleMousewheel(e) { - if (e.originalEvent) e = e.originalEvent; //jquery fix - var delta = 0; - var rtlFactor = s.rtl ? -1 : 1; - - var data = normalizeWheel( e ); - - if (s.params.mousewheelForceToAxis) { - if (s.isHorizontal()) { - if (Math.abs(data.pixelX) > Math.abs(data.pixelY)) delta = data.pixelX * rtlFactor; - else return; - } - else { - if (Math.abs(data.pixelY) > Math.abs(data.pixelX)) delta = data.pixelY; - else return; - } - } - else { - delta = Math.abs(data.pixelX) > Math.abs(data.pixelY) ? - data.pixelX * rtlFactor : - data.pixelY; - } - - if (delta === 0) return; - - if (s.params.mousewheelInvert) delta = -delta; - - if (!s.params.freeMode) { - if ((new window.Date()).getTime() - s.mousewheel.lastScrollTime > 60) { - if (delta < 0) { - if ((!s.isEnd || s.params.loop) && !s.animating) { - s.slideNext(); - s.emit('onScroll', s, e); - } - else if (s.params.mousewheelReleaseOnEdges) return true; - } - else { - if ((!s.isBeginning || s.params.loop) && !s.animating) { - s.slidePrev(); - s.emit('onScroll', s, e); - } - else if (s.params.mousewheelReleaseOnEdges) return true; - } - } - s.mousewheel.lastScrollTime = (new window.Date()).getTime(); - - } - else { - //Freemode or scrollContainer: - var position = s.getWrapperTranslate() + delta * s.params.mousewheelSensitivity; - var wasBeginning = s.isBeginning, - wasEnd = s.isEnd; - - if (position >= s.minTranslate()) position = s.minTranslate(); - if (position <= s.maxTranslate()) position = s.maxTranslate(); - - s.setWrapperTransition(0); - s.setWrapperTranslate(position); - s.updateProgress(); - s.updateActiveIndex(); - - if (!wasBeginning && s.isBeginning || !wasEnd && s.isEnd) { - s.updateClasses(); - } - - if (s.params.freeModeSticky) { - clearTimeout(s.mousewheel.timeout); - s.mousewheel.timeout = setTimeout(function () { - s.slideReset(); - }, 300); - } - else { - if (s.params.lazyLoading && s.lazy) { - s.lazy.load(); - } - } - // Emit event - s.emit('onScroll', s, e); - - // Stop autoplay - if (s.params.autoplay && s.params.autoplayDisableOnInteraction) s.stopAutoplay(); - - // Return page scroll on edge positions - if (position === 0 || position === s.maxTranslate()) return; - } - - if (e.preventDefault) e.preventDefault(); - else e.returnValue = false; - return false; - } - s.disableMousewheelControl = function () { - if (!s.mousewheel.event) return false; - var target = s.container; - if (s.params.mousewheelEventsTarged !== 'container') { - target = $(s.params.mousewheelEventsTarged); - } - target.off(s.mousewheel.event, handleMousewheel); - s.params.mousewheelControl = false; - return true; - }; - - s.enableMousewheelControl = function () { - if (!s.mousewheel.event) return false; - var target = s.container; - if (s.params.mousewheelEventsTarged !== 'container') { - target = $(s.params.mousewheelEventsTarged); - } - target.on(s.mousewheel.event, handleMousewheel); - s.params.mousewheelControl = true; - return true; - }; - - - /*========================= - Parallax - ===========================*/ - function setParallaxTransform(el, progress) { - el = $(el); - var p, pX, pY; - var rtlFactor = s.rtl ? -1 : 1; - - p = el.attr('data-swiper-parallax') || '0'; - pX = el.attr('data-swiper-parallax-x'); - pY = el.attr('data-swiper-parallax-y'); - if (pX || pY) { - pX = pX || '0'; - pY = pY || '0'; - } - else { - if (s.isHorizontal()) { - pX = p; - pY = '0'; - } - else { - pY = p; - pX = '0'; - } - } - - if ((pX).indexOf('%') >= 0) { - pX = parseInt(pX, 10) * progress * rtlFactor + '%'; - } - else { - pX = pX * progress * rtlFactor + 'px' ; - } - if ((pY).indexOf('%') >= 0) { - pY = parseInt(pY, 10) * progress + '%'; - } - else { - pY = pY * progress + 'px' ; - } - - el.transform('translate3d(' + pX + ', ' + pY + ',0px)'); - } - s.parallax = { - setTranslate: function () { - s.container.children('[data-swiper-parallax], [data-swiper-parallax-x], [data-swiper-parallax-y]').each(function(){ - setParallaxTransform(this, s.progress); - - }); - s.slides.each(function () { - var slide = $(this); - slide.find('[data-swiper-parallax], [data-swiper-parallax-x], [data-swiper-parallax-y]').each(function () { - var progress = Math.min(Math.max(slide[0].progress, -1), 1); - setParallaxTransform(this, progress); - }); - }); - }, - setTransition: function (duration) { - if (typeof duration === 'undefined') duration = s.params.speed; - s.container.find('[data-swiper-parallax], [data-swiper-parallax-x], [data-swiper-parallax-y]').each(function(){ - var el = $(this); - var parallaxDuration = parseInt(el.attr('data-swiper-parallax-duration'), 10) || duration; - if (duration === 0) parallaxDuration = 0; - el.transition(parallaxDuration); - }); - } - }; - - - /*========================= - Zoom - ===========================*/ - s.zoom = { - // "Global" Props - scale: 1, - currentScale: 1, - isScaling: false, - gesture: { - slide: undefined, - slideWidth: undefined, - slideHeight: undefined, - image: undefined, - imageWrap: undefined, - zoomMax: s.params.zoomMax - }, - image: { - isTouched: undefined, - isMoved: undefined, - currentX: undefined, - currentY: undefined, - minX: undefined, - minY: undefined, - maxX: undefined, - maxY: undefined, - width: undefined, - height: undefined, - startX: undefined, - startY: undefined, - touchesStart: {}, - touchesCurrent: {} - }, - velocity: { - x: undefined, - y: undefined, - prevPositionX: undefined, - prevPositionY: undefined, - prevTime: undefined - }, - // Calc Scale From Multi-touches - getDistanceBetweenTouches: function (e) { - if (e.targetTouches.length < 2) return 1; - var x1 = e.targetTouches[0].pageX, - y1 = e.targetTouches[0].pageY, - x2 = e.targetTouches[1].pageX, - y2 = e.targetTouches[1].pageY; - var distance = Math.sqrt(Math.pow(x2 - x1, 2) + Math.pow(y2 - y1, 2)); - return distance; - }, - // Events - onGestureStart: function (e) { - var z = s.zoom; - if (!s.support.gestures) { - if (e.type !== 'touchstart' || e.type === 'touchstart' && e.targetTouches.length < 2) { - return; - } - z.gesture.scaleStart = z.getDistanceBetweenTouches(e); - } - if (!z.gesture.slide || !z.gesture.slide.length) { - z.gesture.slide = $(this); - if (z.gesture.slide.length === 0) z.gesture.slide = s.slides.eq(s.activeIndex); - z.gesture.image = z.gesture.slide.find('img, svg, canvas'); - z.gesture.imageWrap = z.gesture.image.parent('.' + s.params.zoomContainerClass); - z.gesture.zoomMax = z.gesture.imageWrap.attr('data-swiper-zoom') || s.params.zoomMax ; - if (z.gesture.imageWrap.length === 0) { - z.gesture.image = undefined; - return; - } - } - z.gesture.image.transition(0); - z.isScaling = true; - }, - onGestureChange: function (e) { - var z = s.zoom; - if (!s.support.gestures) { - if (e.type !== 'touchmove' || e.type === 'touchmove' && e.targetTouches.length < 2) { - return; - } - z.gesture.scaleMove = z.getDistanceBetweenTouches(e); - } - if (!z.gesture.image || z.gesture.image.length === 0) return; - if (s.support.gestures) { - z.scale = e.scale * z.currentScale; - } - else { - z.scale = (z.gesture.scaleMove / z.gesture.scaleStart) * z.currentScale; - } - if (z.scale > z.gesture.zoomMax) { - z.scale = z.gesture.zoomMax - 1 + Math.pow((z.scale - z.gesture.zoomMax + 1), 0.5); - } - if (z.scale < s.params.zoomMin) { - z.scale = s.params.zoomMin + 1 - Math.pow((s.params.zoomMin - z.scale + 1), 0.5); - } - z.gesture.image.transform('translate3d(0,0,0) scale(' + z.scale + ')'); - }, - onGestureEnd: function (e) { - var z = s.zoom; - if (!s.support.gestures) { - if (e.type !== 'touchend' || e.type === 'touchend' && e.changedTouches.length < 2) { - return; - } - } - if (!z.gesture.image || z.gesture.image.length === 0) return; - z.scale = Math.max(Math.min(z.scale, z.gesture.zoomMax), s.params.zoomMin); - z.gesture.image.transition(s.params.speed).transform('translate3d(0,0,0) scale(' + z.scale + ')'); - z.currentScale = z.scale; - z.isScaling = false; - if (z.scale === 1) z.gesture.slide = undefined; - }, - onTouchStart: function (s, e) { - var z = s.zoom; - if (!z.gesture.image || z.gesture.image.length === 0) return; - if (z.image.isTouched) return; - if (s.device.os === 'android') e.preventDefault(); - z.image.isTouched = true; - z.image.touchesStart.x = e.type === 'touchstart' ? e.targetTouches[0].pageX : e.pageX; - z.image.touchesStart.y = e.type === 'touchstart' ? e.targetTouches[0].pageY : e.pageY; - }, - onTouchMove: function (e) { - var z = s.zoom; - if (!z.gesture.image || z.gesture.image.length === 0) return; - s.allowClick = false; - if (!z.image.isTouched || !z.gesture.slide) return; - - if (!z.image.isMoved) { - z.image.width = z.gesture.image[0].offsetWidth; - z.image.height = z.gesture.image[0].offsetHeight; - z.image.startX = s.getTranslate(z.gesture.imageWrap[0], 'x') || 0; - z.image.startY = s.getTranslate(z.gesture.imageWrap[0], 'y') || 0; - z.gesture.slideWidth = z.gesture.slide[0].offsetWidth; - z.gesture.slideHeight = z.gesture.slide[0].offsetHeight; - z.gesture.imageWrap.transition(0); - if (s.rtl) z.image.startX = -z.image.startX; - if (s.rtl) z.image.startY = -z.image.startY; - } - // Define if we need image drag - var scaledWidth = z.image.width * z.scale; - var scaledHeight = z.image.height * z.scale; - - if (scaledWidth < z.gesture.slideWidth && scaledHeight < z.gesture.slideHeight) return; - - z.image.minX = Math.min((z.gesture.slideWidth / 2 - scaledWidth / 2), 0); - z.image.maxX = -z.image.minX; - z.image.minY = Math.min((z.gesture.slideHeight / 2 - scaledHeight / 2), 0); - z.image.maxY = -z.image.minY; - - z.image.touchesCurrent.x = e.type === 'touchmove' ? e.targetTouches[0].pageX : e.pageX; - z.image.touchesCurrent.y = e.type === 'touchmove' ? e.targetTouches[0].pageY : e.pageY; - - if (!z.image.isMoved && !z.isScaling) { - if (s.isHorizontal() && - (Math.floor(z.image.minX) === Math.floor(z.image.startX) && z.image.touchesCurrent.x < z.image.touchesStart.x) || - (Math.floor(z.image.maxX) === Math.floor(z.image.startX) && z.image.touchesCurrent.x > z.image.touchesStart.x) - ) { - z.image.isTouched = false; - return; - } - else if (!s.isHorizontal() && - (Math.floor(z.image.minY) === Math.floor(z.image.startY) && z.image.touchesCurrent.y < z.image.touchesStart.y) || - (Math.floor(z.image.maxY) === Math.floor(z.image.startY) && z.image.touchesCurrent.y > z.image.touchesStart.y) - ) { - z.image.isTouched = false; - return; - } - } - e.preventDefault(); - e.stopPropagation(); - - z.image.isMoved = true; - z.image.currentX = z.image.touchesCurrent.x - z.image.touchesStart.x + z.image.startX; - z.image.currentY = z.image.touchesCurrent.y - z.image.touchesStart.y + z.image.startY; - - if (z.image.currentX < z.image.minX) { - z.image.currentX = z.image.minX + 1 - Math.pow((z.image.minX - z.image.currentX + 1), 0.8); - } - if (z.image.currentX > z.image.maxX) { - z.image.currentX = z.image.maxX - 1 + Math.pow((z.image.currentX - z.image.maxX + 1), 0.8); - } - - if (z.image.currentY < z.image.minY) { - z.image.currentY = z.image.minY + 1 - Math.pow((z.image.minY - z.image.currentY + 1), 0.8); - } - if (z.image.currentY > z.image.maxY) { - z.image.currentY = z.image.maxY - 1 + Math.pow((z.image.currentY - z.image.maxY + 1), 0.8); - } - - //Velocity - if (!z.velocity.prevPositionX) z.velocity.prevPositionX = z.image.touchesCurrent.x; - if (!z.velocity.prevPositionY) z.velocity.prevPositionY = z.image.touchesCurrent.y; - if (!z.velocity.prevTime) z.velocity.prevTime = Date.now(); - z.velocity.x = (z.image.touchesCurrent.x - z.velocity.prevPositionX) / (Date.now() - z.velocity.prevTime) / 2; - z.velocity.y = (z.image.touchesCurrent.y - z.velocity.prevPositionY) / (Date.now() - z.velocity.prevTime) / 2; - if (Math.abs(z.image.touchesCurrent.x - z.velocity.prevPositionX) < 2) z.velocity.x = 0; - if (Math.abs(z.image.touchesCurrent.y - z.velocity.prevPositionY) < 2) z.velocity.y = 0; - z.velocity.prevPositionX = z.image.touchesCurrent.x; - z.velocity.prevPositionY = z.image.touchesCurrent.y; - z.velocity.prevTime = Date.now(); - - z.gesture.imageWrap.transform('translate3d(' + z.image.currentX + 'px, ' + z.image.currentY + 'px,0)'); - }, - onTouchEnd: function (s, e) { - var z = s.zoom; - if (!z.gesture.image || z.gesture.image.length === 0) return; - if (!z.image.isTouched || !z.image.isMoved) { - z.image.isTouched = false; - z.image.isMoved = false; - return; - } - z.image.isTouched = false; - z.image.isMoved = false; - var momentumDurationX = 300; - var momentumDurationY = 300; - var momentumDistanceX = z.velocity.x * momentumDurationX; - var newPositionX = z.image.currentX + momentumDistanceX; - var momentumDistanceY = z.velocity.y * momentumDurationY; - var newPositionY = z.image.currentY + momentumDistanceY; - - //Fix duration - if (z.velocity.x !== 0) momentumDurationX = Math.abs((newPositionX - z.image.currentX) / z.velocity.x); - if (z.velocity.y !== 0) momentumDurationY = Math.abs((newPositionY - z.image.currentY) / z.velocity.y); - var momentumDuration = Math.max(momentumDurationX, momentumDurationY); - - z.image.currentX = newPositionX; - z.image.currentY = newPositionY; - - // Define if we need image drag - var scaledWidth = z.image.width * z.scale; - var scaledHeight = z.image.height * z.scale; - z.image.minX = Math.min((z.gesture.slideWidth / 2 - scaledWidth / 2), 0); - z.image.maxX = -z.image.minX; - z.image.minY = Math.min((z.gesture.slideHeight / 2 - scaledHeight / 2), 0); - z.image.maxY = -z.image.minY; - z.image.currentX = Math.max(Math.min(z.image.currentX, z.image.maxX), z.image.minX); - z.image.currentY = Math.max(Math.min(z.image.currentY, z.image.maxY), z.image.minY); - - z.gesture.imageWrap.transition(momentumDuration).transform('translate3d(' + z.image.currentX + 'px, ' + z.image.currentY + 'px,0)'); - }, - onTransitionEnd: function (s) { - var z = s.zoom; - if (z.gesture.slide && s.previousIndex !== s.activeIndex) { - z.gesture.image.transform('translate3d(0,0,0) scale(1)'); - z.gesture.imageWrap.transform('translate3d(0,0,0)'); - z.gesture.slide = z.gesture.image = z.gesture.imageWrap = undefined; - z.scale = z.currentScale = 1; - } - }, - // Toggle Zoom - toggleZoom: function (s, e) { - var z = s.zoom; - if (!z.gesture.slide) { - z.gesture.slide = s.clickedSlide ? $(s.clickedSlide) : s.slides.eq(s.activeIndex); - z.gesture.image = z.gesture.slide.find('img, svg, canvas'); - z.gesture.imageWrap = z.gesture.image.parent('.' + s.params.zoomContainerClass); - } - if (!z.gesture.image || z.gesture.image.length === 0) return; - - var touchX, touchY, offsetX, offsetY, diffX, diffY, translateX, translateY, imageWidth, imageHeight, scaledWidth, scaledHeight, translateMinX, translateMinY, translateMaxX, translateMaxY, slideWidth, slideHeight; - - if (typeof z.image.touchesStart.x === 'undefined' && e) { - touchX = e.type === 'touchend' ? e.changedTouches[0].pageX : e.pageX; - touchY = e.type === 'touchend' ? e.changedTouches[0].pageY : e.pageY; - } - else { - touchX = z.image.touchesStart.x; - touchY = z.image.touchesStart.y; - } - - if (z.scale && z.scale !== 1) { - // Zoom Out - z.scale = z.currentScale = 1; - z.gesture.imageWrap.transition(300).transform('translate3d(0,0,0)'); - z.gesture.image.transition(300).transform('translate3d(0,0,0) scale(1)'); - z.gesture.slide = undefined; - } - else { - // Zoom In - z.scale = z.currentScale = z.gesture.imageWrap.attr('data-swiper-zoom') || s.params.zoomMax; - if (e) { - slideWidth = z.gesture.slide[0].offsetWidth; - slideHeight = z.gesture.slide[0].offsetHeight; - offsetX = z.gesture.slide.offset().left; - offsetY = z.gesture.slide.offset().top; - diffX = offsetX + slideWidth/2 - touchX; - diffY = offsetY + slideHeight/2 - touchY; - - imageWidth = z.gesture.image[0].offsetWidth; - imageHeight = z.gesture.image[0].offsetHeight; - scaledWidth = imageWidth * z.scale; - scaledHeight = imageHeight * z.scale; - - translateMinX = Math.min((slideWidth / 2 - scaledWidth / 2), 0); - translateMinY = Math.min((slideHeight / 2 - scaledHeight / 2), 0); - translateMaxX = -translateMinX; - translateMaxY = -translateMinY; - - translateX = diffX * z.scale; - translateY = diffY * z.scale; - - if (translateX < translateMinX) { - translateX = translateMinX; - } - if (translateX > translateMaxX) { - translateX = translateMaxX; - } - - if (translateY < translateMinY) { - translateY = translateMinY; - } - if (translateY > translateMaxY) { - translateY = translateMaxY; - } - } - else { - translateX = 0; - translateY = 0; - } - z.gesture.imageWrap.transition(300).transform('translate3d(' + translateX + 'px, ' + translateY + 'px,0)'); - z.gesture.image.transition(300).transform('translate3d(0,0,0) scale(' + z.scale + ')'); - } - }, - // Attach/Detach Events - attachEvents: function (detach) { - var action = detach ? 'off' : 'on'; - - if (s.params.zoom) { - var target = s.slides; - var passiveListener = s.touchEvents.start === 'touchstart' && s.support.passiveListener && s.params.passiveListeners ? {passive: true, capture: false} : false; - // Scale image - if (s.support.gestures) { - s.slides[action]('gesturestart', s.zoom.onGestureStart, passiveListener); - s.slides[action]('gesturechange', s.zoom.onGestureChange, passiveListener); - s.slides[action]('gestureend', s.zoom.onGestureEnd, passiveListener); - } - else if (s.touchEvents.start === 'touchstart') { - s.slides[action](s.touchEvents.start, s.zoom.onGestureStart, passiveListener); - s.slides[action](s.touchEvents.move, s.zoom.onGestureChange, passiveListener); - s.slides[action](s.touchEvents.end, s.zoom.onGestureEnd, passiveListener); - } - - // Move image - s[action]('touchStart', s.zoom.onTouchStart); - s.slides.each(function (index, slide){ - if ($(slide).find('.' + s.params.zoomContainerClass).length > 0) { - $(slide)[action](s.touchEvents.move, s.zoom.onTouchMove); - } - }); - s[action]('touchEnd', s.zoom.onTouchEnd); - - // Scale Out - s[action]('transitionEnd', s.zoom.onTransitionEnd); - if (s.params.zoomToggle) { - s.on('doubleTap', s.zoom.toggleZoom); - } - } - }, - init: function () { - s.zoom.attachEvents(); - }, - destroy: function () { - s.zoom.attachEvents(true); - } - }; - - - /*========================= - Plugins API. Collect all and init all plugins - ===========================*/ - s._plugins = []; - for (var plugin in s.plugins) { - var p = s.plugins[plugin](s, s.params[plugin]); - if (p) s._plugins.push(p); - } - // Method to call all plugins event/method - s.callPlugins = function (eventName) { - for (var i = 0; i < s._plugins.length; i++) { - if (eventName in s._plugins[i]) { - s._plugins[i][eventName](arguments[1], arguments[2], arguments[3], arguments[4], arguments[5]); - } - } - }; - - - /*========================= - Events/Callbacks/Plugins Emitter - ===========================*/ - function normalizeEventName (eventName) { - if (eventName.indexOf('on') !== 0) { - if (eventName[0] !== eventName[0].toUpperCase()) { - eventName = 'on' + eventName[0].toUpperCase() + eventName.substring(1); - } - else { - eventName = 'on' + eventName; - } - } - return eventName; - } - s.emitterEventListeners = { - - }; - s.emit = function (eventName) { - // Trigger callbacks - if (s.params[eventName]) { - s.params[eventName](arguments[1], arguments[2], arguments[3], arguments[4], arguments[5]); - } - var i; - // Trigger events - if (s.emitterEventListeners[eventName]) { - for (i = 0; i < s.emitterEventListeners[eventName].length; i++) { - s.emitterEventListeners[eventName][i](arguments[1], arguments[2], arguments[3], arguments[4], arguments[5]); - } - } - // Trigger plugins - if (s.callPlugins) s.callPlugins(eventName, arguments[1], arguments[2], arguments[3], arguments[4], arguments[5]); - }; - s.on = function (eventName, handler) { - eventName = normalizeEventName(eventName); - if (!s.emitterEventListeners[eventName]) s.emitterEventListeners[eventName] = []; - s.emitterEventListeners[eventName].push(handler); - return s; - }; - s.off = function (eventName, handler) { - var i; - eventName = normalizeEventName(eventName); - if (typeof handler === 'undefined') { - // Remove all handlers for such event - s.emitterEventListeners[eventName] = []; - return s; - } - if (!s.emitterEventListeners[eventName] || s.emitterEventListeners[eventName].length === 0) return; - for (i = 0; i < s.emitterEventListeners[eventName].length; i++) { - if(s.emitterEventListeners[eventName][i] === handler) s.emitterEventListeners[eventName].splice(i, 1); - } - return s; - }; - s.once = function (eventName, handler) { - eventName = normalizeEventName(eventName); - var _handler = function () { - handler(arguments[0], arguments[1], arguments[2], arguments[3], arguments[4]); - s.off(eventName, _handler); - }; - s.on(eventName, _handler); - return s; - }; - - - // Accessibility tools - s.a11y = { - makeFocusable: function ($el) { - $el.attr('tabIndex', '0'); - return $el; - }, - addRole: function ($el, role) { - $el.attr('role', role); - return $el; - }, - - addLabel: function ($el, label) { - $el.attr('aria-label', label); - return $el; - }, - - disable: function ($el) { - $el.attr('aria-disabled', true); - return $el; - }, - - enable: function ($el) { - $el.attr('aria-disabled', false); - return $el; - }, - - onEnterKey: function (event) { - if (event.keyCode !== 13) return; - if ($(event.target).is(s.params.nextButton)) { - s.onClickNext(event); - if (s.isEnd) { - s.a11y.notify(s.params.lastSlideMessage); - } - else { - s.a11y.notify(s.params.nextSlideMessage); - } - } - else if ($(event.target).is(s.params.prevButton)) { - s.onClickPrev(event); - if (s.isBeginning) { - s.a11y.notify(s.params.firstSlideMessage); - } - else { - s.a11y.notify(s.params.prevSlideMessage); - } - } - if ($(event.target).is('.' + s.params.bulletClass)) { - $(event.target)[0].click(); - } - }, - - liveRegion: $(''), - - notify: function (message) { - var notification = s.a11y.liveRegion; - if (notification.length === 0) return; - notification.html(''); - notification.html(message); - }, - init: function () { - // Setup accessibility - if (s.params.nextButton && s.nextButton && s.nextButton.length > 0) { - s.a11y.makeFocusable(s.nextButton); - s.a11y.addRole(s.nextButton, 'button'); - s.a11y.addLabel(s.nextButton, s.params.nextSlideMessage); - } - if (s.params.prevButton && s.prevButton && s.prevButton.length > 0) { - s.a11y.makeFocusable(s.prevButton); - s.a11y.addRole(s.prevButton, 'button'); - s.a11y.addLabel(s.prevButton, s.params.prevSlideMessage); - } - - $(s.container).append(s.a11y.liveRegion); - }, - initPagination: function () { - if (s.params.pagination && s.params.paginationClickable && s.bullets && s.bullets.length) { - s.bullets.each(function () { - var bullet = $(this); - s.a11y.makeFocusable(bullet); - s.a11y.addRole(bullet, 'button'); - s.a11y.addLabel(bullet, s.params.paginationBulletMessage.replace(/{{index}}/, bullet.index() + 1)); - }); - } - }, - destroy: function () { - if (s.a11y.liveRegion && s.a11y.liveRegion.length > 0) s.a11y.liveRegion.remove(); - } - }; - - - /*========================= - Init/Destroy - ===========================*/ - s.init = function () { - if (s.params.loop) s.createLoop(); - s.updateContainerSize(); - s.updateSlidesSize(); - s.updatePagination(); - if (s.params.scrollbar && s.scrollbar) { - s.scrollbar.set(); - if (s.params.scrollbarDraggable) { - s.scrollbar.enableDraggable(); - } - } - if (s.params.effect !== 'slide' && s.effects[s.params.effect]) { - if (!s.params.loop) s.updateProgress(); - s.effects[s.params.effect].setTranslate(); - } - if (s.params.loop) { - s.slideTo(s.params.initialSlide + s.loopedSlides, 0, s.params.runCallbacksOnInit); - } - else { - s.slideTo(s.params.initialSlide, 0, s.params.runCallbacksOnInit); - if (s.params.initialSlide === 0) { - if (s.parallax && s.params.parallax) s.parallax.setTranslate(); - if (s.lazy && s.params.lazyLoading) { - s.lazy.load(); - s.lazy.initialImageLoaded = true; - } - } - } - s.attachEvents(); - if (s.params.observer && s.support.observer) { - s.initObservers(); - } - if (s.params.preloadImages && !s.params.lazyLoading) { - s.preloadImages(); - } - if (s.params.zoom && s.zoom) { - s.zoom.init(); - } - if (s.params.autoplay) { - s.startAutoplay(); - } - if (s.params.keyboardControl) { - if (s.enableKeyboardControl) s.enableKeyboardControl(); - } - if (s.params.mousewheelControl) { - if (s.enableMousewheelControl) s.enableMousewheelControl(); - } - // Deprecated hashnavReplaceState changed to replaceState for use in hashnav and history - if (s.params.hashnavReplaceState) { - s.params.replaceState = s.params.hashnavReplaceState; - } - if (s.params.history) { - if (s.history) s.history.init(); - } - if (s.params.hashnav) { - if (s.hashnav) s.hashnav.init(); - } - if (s.params.a11y && s.a11y) s.a11y.init(); - s.emit('onInit', s); - }; - - // Cleanup dynamic styles - s.cleanupStyles = function () { - // Container - s.container.removeClass(s.classNames.join(' ')).removeAttr('style'); - - // Wrapper - s.wrapper.removeAttr('style'); - - // Slides - if (s.slides && s.slides.length) { - s.slides - .removeClass([ - s.params.slideVisibleClass, - s.params.slideActiveClass, - s.params.slideNextClass, - s.params.slidePrevClass - ].join(' ')) - .removeAttr('style') - .removeAttr('data-swiper-column') - .removeAttr('data-swiper-row'); - } - - // Pagination/Bullets - if (s.paginationContainer && s.paginationContainer.length) { - s.paginationContainer.removeClass(s.params.paginationHiddenClass); - } - if (s.bullets && s.bullets.length) { - s.bullets.removeClass(s.params.bulletActiveClass); - } - - // Buttons - if (s.params.prevButton) $(s.params.prevButton).removeClass(s.params.buttonDisabledClass); - if (s.params.nextButton) $(s.params.nextButton).removeClass(s.params.buttonDisabledClass); - - // Scrollbar - if (s.params.scrollbar && s.scrollbar) { - if (s.scrollbar.track && s.scrollbar.track.length) s.scrollbar.track.removeAttr('style'); - if (s.scrollbar.drag && s.scrollbar.drag.length) s.scrollbar.drag.removeAttr('style'); - } - }; - - // Destroy - s.destroy = function (deleteInstance, cleanupStyles) { - // Detach evebts - s.detachEvents(); - // Stop autoplay - s.stopAutoplay(); - // Disable draggable - if (s.params.scrollbar && s.scrollbar) { - if (s.params.scrollbarDraggable) { - s.scrollbar.disableDraggable(); - } - } - // Destroy loop - if (s.params.loop) { - s.destroyLoop(); - } - // Cleanup styles - if (cleanupStyles) { - s.cleanupStyles(); - } - // Disconnect observer - s.disconnectObservers(); - - // Destroy zoom - if (s.params.zoom && s.zoom) { - s.zoom.destroy(); - } - // Disable keyboard/mousewheel - if (s.params.keyboardControl) { - if (s.disableKeyboardControl) s.disableKeyboardControl(); - } - if (s.params.mousewheelControl) { - if (s.disableMousewheelControl) s.disableMousewheelControl(); - } - // Disable a11y - if (s.params.a11y && s.a11y) s.a11y.destroy(); - // Delete history popstate - if (s.params.history && !s.params.replaceState) { - window.removeEventListener('popstate', s.history.setHistoryPopState); - } - if (s.params.hashnav && s.hashnav) { - s.hashnav.destroy(); - } - // Destroy callback - s.emit('onDestroy'); - // Delete instance - if (deleteInstance !== false) s = null; - }; - - s.init(); - - - - // Return swiper instance - return s; - }; - - - /*================================================== - Prototype - ====================================================*/ - Swiper.prototype = { - isSafari: (function () { - var ua = window.navigator.userAgent.toLowerCase(); - return (ua.indexOf('safari') >= 0 && ua.indexOf('chrome') < 0 && ua.indexOf('android') < 0); - })(), - isUiWebView: /(iPhone|iPod|iPad).*AppleWebKit(?!.*Safari)/i.test(window.navigator.userAgent), - isArray: function (arr) { - return Object.prototype.toString.apply(arr) === '[object Array]'; - }, - /*================================================== - Browser - ====================================================*/ - browser: { - ie: window.navigator.pointerEnabled || window.navigator.msPointerEnabled, - ieTouch: (window.navigator.msPointerEnabled && window.navigator.msMaxTouchPoints > 1) || (window.navigator.pointerEnabled && window.navigator.maxTouchPoints > 1), - lteIE9: (function() { - // create temporary DIV - var div = document.createElement('div'); - // add content to tmp DIV which is wrapped into the IE HTML conditional statement - div.innerHTML = ''; - // return true / false value based on what will browser render - return div.getElementsByTagName('i').length === 1; - })() - }, - /*================================================== - Devices - ====================================================*/ - device: (function () { - var ua = window.navigator.userAgent; - var android = ua.match(/(Android);?[\s\/]+([\d.]+)?/); - var ipad = ua.match(/(iPad).*OS\s([\d_]+)/); - var ipod = ua.match(/(iPod)(.*OS\s([\d_]+))?/); - var iphone = !ipad && ua.match(/(iPhone\sOS|iOS)\s([\d_]+)/); - return { - ios: ipad || iphone || ipod, - android: android - }; - })(), - /*================================================== - Feature Detection - ====================================================*/ - support: { - touch : (window.Modernizr && Modernizr.touch === true) || (function () { - return !!(('ontouchstart' in window) || window.DocumentTouch && document instanceof DocumentTouch); - })(), - - transforms3d : (window.Modernizr && Modernizr.csstransforms3d === true) || (function () { - var div = document.createElement('div').style; - return ('webkitPerspective' in div || 'MozPerspective' in div || 'OPerspective' in div || 'MsPerspective' in div || 'perspective' in div); - })(), - - flexbox: (function () { - var div = document.createElement('div').style; - var styles = ('alignItems webkitAlignItems webkitBoxAlign msFlexAlign mozBoxAlign webkitFlexDirection msFlexDirection mozBoxDirection mozBoxOrient webkitBoxDirection webkitBoxOrient').split(' '); - for (var i = 0; i < styles.length; i++) { - if (styles[i] in div) return true; - } - })(), - - observer: (function () { - return ('MutationObserver' in window || 'WebkitMutationObserver' in window); - })(), - - passiveListener: (function () { - var supportsPassive = false; - try { - var opts = Object.defineProperty({}, 'passive', { - get: function() { - supportsPassive = true; - } - }); - window.addEventListener('testPassiveListener', null, opts); - } catch (e) {} - return supportsPassive; - })(), - - gestures: (function () { - return 'ongesturestart' in window; - })() - }, - /*================================================== - Plugins - ====================================================*/ - plugins: {} - }; - - - /*=========================== - Get Dom libraries - ===========================*/ - var swiperDomPlugins = ['jQuery', 'Zepto', 'Dom7']; - for (var i = 0; i < swiperDomPlugins.length; i++) { - if (window[swiperDomPlugins[i]]) { - addLibraryPlugin(window[swiperDomPlugins[i]]); - } - } - // Required DOM Plugins - var domLib; - if (typeof Dom7 === 'undefined') { - domLib = window.Dom7 || window.Zepto || window.jQuery; - } - else { - domLib = Dom7; - } - - - /*=========================== - Add .swiper plugin from Dom libraries - ===========================*/ - function addLibraryPlugin(lib) { - lib.fn.swiper = function (params) { - var firstInstance; - lib(this).each(function () { - var s = new Swiper(this, params); - if (!firstInstance) firstInstance = s; - }); - return firstInstance; - }; - } - - if (domLib) { - if (!('transitionEnd' in domLib.fn)) { - domLib.fn.transitionEnd = function (callback) { - var events = ['webkitTransitionEnd', 'transitionend', 'oTransitionEnd', 'MSTransitionEnd', 'msTransitionEnd'], - i, j, dom = this; - function fireCallBack(e) { - /*jshint validthis:true */ - if (e.target !== this) return; - callback.call(this, e); - for (i = 0; i < events.length; i++) { - dom.off(events[i], fireCallBack); - } - } - if (callback) { - for (i = 0; i < events.length; i++) { - dom.on(events[i], fireCallBack); - } - } - return this; - }; - } - if (!('transform' in domLib.fn)) { - domLib.fn.transform = function (transform) { - for (var i = 0; i < this.length; i++) { - var elStyle = this[i].style; - elStyle.webkitTransform = elStyle.MsTransform = elStyle.msTransform = elStyle.MozTransform = elStyle.OTransform = elStyle.transform = transform; - } - return this; - }; - } - if (!('transition' in domLib.fn)) { - domLib.fn.transition = function (duration) { - if (typeof duration !== 'string') { - duration = duration + 'ms'; - } - for (var i = 0; i < this.length; i++) { - var elStyle = this[i].style; - elStyle.webkitTransitionDuration = elStyle.MsTransitionDuration = elStyle.msTransitionDuration = elStyle.MozTransitionDuration = elStyle.OTransitionDuration = elStyle.transitionDuration = duration; - } - return this; - }; - } - if (!('outerWidth' in domLib.fn)) { - domLib.fn.outerWidth = function (includeMargins) { - if (this.length > 0) { - if (includeMargins) - return this[0].offsetWidth + parseFloat(this.css('margin-right')) + parseFloat(this.css('margin-left')); - else - return this[0].offsetWidth; - } - else return null; - }; - } - } - - - window.Swiper = Swiper; -})(); - -/*=========================== -Swiper AMD Export -===========================*/ -if (typeof(module) !== 'undefined') -{ - module.exports = window.Swiper; -} -else if (typeof define === 'function' && define.amd) { - define([], function () { - 'use strict'; - return window.Swiper; - }); -} - -//# sourceMappingURL=maps/swiper.jquery.js.map - -//============================================================================== - - -// Jquery dot dot dot -//============================================================================== -/* - * jQuery dotdotdot 1.8.3 - * - * Copyright (c) Fred Heusschen - * www.frebsite.nl - * - * Plugin website: - * dotdotdot.frebsite.nl - * - * Licensed under the MIT license. - * http://en.wikipedia.org/wiki/MIT_License - */ - -(function($, undef) { - 'use strict'; - if ($.fn.dotdotdot) { - return; - } - - $.fn.dotdotdot = function(o) { - if (this.length === 0) { - $.fn.dotdotdot.debug('No element found for "' + this.selector + '".'); - return this; - } - if (this.length > 1) { - return this.each( - function() { - $(this).dotdotdot(o); - } - ); - } - - var $dot = this; - var orgContent = $dot.contents(); - - if ($dot.data('dotdotdot')) { - $dot.trigger('destroy.dot'); - } - - $dot.data('dotdotdot-style', $dot.attr('style') || ''); - $dot.css('word-wrap', 'break-word'); - if ($dot.css('white-space') === 'nowrap') { - $dot.css('white-space', 'normal'); - } - - $dot.bind_events = function() { - $dot.bind( - 'update.dot', - function(e, c) { - $dot.removeClass("is-truncated"); - e.preventDefault(); - e.stopPropagation(); - - switch (typeof opts.height) { - case 'number': - opts.maxHeight = opts.height; - break; - - case 'function': - opts.maxHeight = opts.height.call($dot[0]); - break; - - default: - opts.maxHeight = getTrueInnerHeight($dot); - break; - } - - opts.maxHeight += opts.tolerance; - - if (typeof c != 'undefined') { - if (typeof c == 'string' || ('nodeType' in c && c.nodeType === 1)) { - c = $('
').append(c).contents(); - } - if (c instanceof $) { - orgContent = c; - } - } - - $inr = $dot.wrapInner('
').children(); - $inr.contents() - .detach() - .end() - .append(orgContent.clone(true)) - .find('br') - .replaceWith('
') - .end() - .css({ - 'height': 'auto', - 'width': 'auto', - 'border': 'none', - 'padding': 0, - 'margin': 0 - }); - - var after = false, - trunc = false; - - if (conf.afterElement) { - after = conf.afterElement.clone(true); - after.show(); - conf.afterElement.detach(); - } - - if (test($inr, opts)) { - if (opts.wrap == 'children') { - trunc = children($inr, opts, after); - } else { - trunc = ellipsis($inr, $dot, $inr, opts, after); - } - } - $inr.replaceWith($inr.contents()); - $inr = null; - - if ($.isFunction(opts.callback)) { - opts.callback.call($dot[0], trunc, orgContent); - } - - conf.isTruncated = trunc; - return trunc; - } - - ).bind( - 'isTruncated.dot', - function(e, fn) { - e.preventDefault(); - e.stopPropagation(); - - if (typeof fn == 'function') { - fn.call($dot[0], conf.isTruncated); - } - return conf.isTruncated; - } - - ).bind( - 'originalContent.dot', - function(e, fn) { - e.preventDefault(); - e.stopPropagation(); - - if (typeof fn == 'function') { - fn.call($dot[0], orgContent); - } - return orgContent; - } - - ).bind( - 'destroy.dot', - function(e) { - e.preventDefault(); - e.stopPropagation(); - - $dot.unwatch() - .unbind_events() - .contents() - .detach() - .end() - .append(orgContent) - .attr('style', $dot.data('dotdotdot-style') || '') - .removeClass('is-truncated') - .data('dotdotdot', false); - } - ); - return $dot; - }; // /bind_events - - $dot.unbind_events = function() { - $dot.unbind('.dot'); - return $dot; - }; // /unbind_events - - $dot.watch = function() { - $dot.unwatch(); - if (opts.watch == 'window') { - var $window = $(window), - _wWidth = $window.width(), - _wHeight = $window.height(); - - $window.bind( - 'resize.dot' + conf.dotId, - function() { - if (_wWidth != $window.width() || _wHeight != $window.height() || !opts.windowResizeFix) { - _wWidth = $window.width(); - _wHeight = $window.height(); - - if (watchInt) { - clearInterval(watchInt); - } - watchInt = setTimeout( - function() { - $dot.trigger('update.dot'); - }, 100 - ); - } - } - ); - } else { - watchOrg = getSizes($dot); - watchInt = setInterval( - function() { - if ($dot.is(':visible')) { - var watchNew = getSizes($dot); - if (watchOrg.width != watchNew.width || - watchOrg.height != watchNew.height) { - $dot.trigger('update.dot'); - watchOrg = watchNew; - } - } - }, 500 - ); - } - return $dot; - }; - $dot.unwatch = function() { - $(window).unbind('resize.dot' + conf.dotId); - if (watchInt) { - clearInterval(watchInt); - } - return $dot; - }; - - var opts = $.extend(true, {}, $.fn.dotdotdot.defaults, o), - conf = {}, - watchOrg = {}, - watchInt = null, - $inr = null; - - - if (!(opts.lastCharacter.remove instanceof Array)) { - opts.lastCharacter.remove = $.fn.dotdotdot.defaultArrays.lastCharacter.remove; - } - if (!(opts.lastCharacter.noEllipsis instanceof Array)) { - opts.lastCharacter.noEllipsis = $.fn.dotdotdot.defaultArrays.lastCharacter.noEllipsis; - } - - - conf.afterElement = getElement(opts.after, $dot); - conf.isTruncated = false; - conf.dotId = dotId++; - - - $dot.data('dotdotdot', true) - .bind_events() - .trigger('update.dot'); - - if (opts.watch) { - $dot.watch(); - } - - return $dot; - }; - - - // public - $.fn.dotdotdot.defaults = { - 'ellipsis': '... ', - 'wrap': 'word', - 'fallbackToLetter': true, - 'lastCharacter': {}, - 'tolerance': 0, - 'callback': null, - 'after': null, - 'height': null, - 'watch': false, - 'windowResizeFix': true, - 'maxLength': null - }; - $.fn.dotdotdot.defaultArrays = { - 'lastCharacter': { - 'remove': [' ', '\u3000', ',', ';', '.', '!', '?'], - 'noEllipsis': [] - } - }; - $.fn.dotdotdot.debug = function(msg) {}; - - - // private - var dotId = 1; - - function children($elem, o, after) { - var $elements = $elem.children(), - isTruncated = false; - - $elem.empty(); - - for (var a = 0, l = $elements.length; a < l; a++) { - var $e = $elements.eq(a); - $elem.append($e); - if (after) { - $elem.append(after); - } - if (test($elem, o)) { - $e.remove(); - isTruncated = true; - break; - } else { - if (after) { - after.detach(); - } - } - } - return isTruncated; - } - - function ellipsis($elem, $d, $i, o, after) { - var isTruncated = false; - - // Don't put the ellipsis directly inside these elements - var notx = 'a, table, thead, tbody, tfoot, tr, col, colgroup, object, embed, param, ol, ul, dl, blockquote, select, optgroup, option, textarea, script, style'; - - // Don't remove these elements even if they are after the ellipsis - var noty = 'script, .dotdotdot-keep'; - - $elem - .contents() - .detach() - .each( - function() { - - var e = this, - $e = $(e); - - if (typeof e == 'undefined') { - return true; - } else if ($e.is(noty)) { - $elem.append($e); - } else if (isTruncated) { - return true; - } else { - $elem.append($e); - if (after && !$e.is(o.after) && !$e.find(o.after).length) { - $elem[$elem.is(notx) ? 'after' : 'append'](after); - } - if (test($i, o)) { - if (e.nodeType == 3) // node is TEXT - { - isTruncated = ellipsisElement($e, $d, $i, o, after); - } else { - isTruncated = ellipsis($e, $d, $i, o, after); - } - } - - if (!isTruncated) { - if (after) { - after.detach(); - } - } - } - } - ); - $d.addClass("is-truncated"); - return isTruncated; - } - - function ellipsisElement($e, $d, $i, o, after) { - var e = $e[0]; - - if (!e) { - return false; - } - - var txt = getTextContent(e), - space = (txt.indexOf(' ') !== -1) ? ' ' : '\u3000', - separator = (o.wrap == 'letter') ? '' : space, - textArr = txt.split(separator), - position = -1, - midPos = -1, - startPos = 0, - endPos = textArr.length - 1; - - - // Only one word - if (o.fallbackToLetter && startPos === 0 && endPos === 0) { - separator = ''; - textArr = txt.split(separator); - endPos = textArr.length - 1; - } - - if (o.maxLength) { - txt = addEllipsis(txt.trim().substr(0, o.maxLength), o); - setTextContent(e, txt); - } else { - - while (startPos <= endPos && !(startPos === 0 && endPos === 0)) { - var m = Math.floor((startPos + endPos) / 2); - if (m == midPos) { - break; - } - midPos = m; - - setTextContent(e, textArr.slice(0, midPos + 1).join(separator) + o.ellipsis); - - $i.children().each(function() { - $(this).toggle().toggle(); - }); - - if (!test($i, o)) { - position = midPos; - startPos = midPos; - } else { - endPos = midPos; - - // Fallback to letter - if (o.fallbackToLetter && startPos === 0 && endPos === 0) { - separator = ''; - textArr = textArr[0].split(separator); - position = -1; - midPos = -1; - startPos = 0; - endPos = textArr.length - 1; - } - } - } - - if (position != -1 && !(textArr.length === 1 && textArr[0].length === 0)) { - txt = addEllipsis(textArr.slice(0, position + 1).join(separator), o); - setTextContent(e, txt); - } else { - var $w = $e.parent(); - $e.detach(); - - var afterLength = (after && after.closest($w).length) ? after.length : 0; - - if ($w.contents().length > afterLength) { - e = findLastTextNode($w.contents().eq(-1 - afterLength), $d); - } else { - e = findLastTextNode($w, $d, true); - if (!afterLength) { - $w.detach(); - } - } - if (e) { - txt = addEllipsis(getTextContent(e), o); - setTextContent(e, txt); - if (afterLength && after) { - var $parent = after.parent(); - - $(e).parent().append(after); - - if (!$.trim($parent.html())) { - $parent.remove(); - } - } - } - } - } - - return true; - } - - function test($i, o) { - return ($i.innerHeight() > o.maxHeight || (o.maxLength && $i.text().trim().length > o.maxLength)); - } - - function addEllipsis(txt, o) { - while ($.inArray(txt.slice(-1), o.lastCharacter.remove) > -1) { - txt = txt.slice(0, -1); - } - if ($.inArray(txt.slice(-1), o.lastCharacter.noEllipsis) < 0) { - txt += o.ellipsis; - } - return txt; - } - - function getSizes($d) { - return { - 'width': $d.innerWidth(), - 'height': $d.innerHeight() - }; - } - - function setTextContent(e, content) { - if (e.innerText) { - e.innerText = content; - } else if (e.nodeValue) { - e.nodeValue = content; - } else if (e.textContent) { - e.textContent = content; - } - - } - - function getTextContent(e) { - if (e.innerText) { - return e.innerText; - } else if (e.nodeValue) { - return e.nodeValue; - } else if (e.textContent) { - return e.textContent; - } else { - return ""; - } - } - - function getPrevNode(n) { - do { - n = n.previousSibling; - } - while (n && n.nodeType !== 1 && n.nodeType !== 3); - - return n; - } - - function findLastTextNode($el, $top, excludeCurrent) { - var e = $el && $el[0], - p; - if (e) { - if (!excludeCurrent) { - if (e.nodeType === 3) { - return e; - } - if ($.trim($el.text())) { - return findLastTextNode($el.contents().last(), $top); - } - } - p = getPrevNode(e); - while (!p) { - $el = $el.parent(); - if ($el.is($top) || !$el.length) { - return false; - } - p = getPrevNode($el[0]); - } - if (p) { - return findLastTextNode($(p), $top); - } - } - return false; - } - - function getElement(e, $i) { - if (!e) { - return false; - } - if (typeof e === 'string') { - e = $(e, $i); - return (e.length) ? - e : - false; - } - return !e.jquery ? - false : - e; - } - - function getTrueInnerHeight($el) { - var h = $el.innerHeight(), - a = ['paddingTop', 'paddingBottom']; - - for (var z = 0, l = a.length; z < l; z++) { - var m = parseInt($el.css(a[z]), 10); - if (isNaN(m)) { - m = 0; - } - h -= m; - } - return h; - } - - - // override jQuery.html - var _orgHtml = $.fn.html; - $.fn.html = function(str) { - if (str != undef && !$.isFunction(str) && this.data('dotdotdot')) { - return this.trigger('update', [str]); - } - return _orgHtml.apply(this, arguments); - }; - - - // override jQuery.text - var _orgText = $.fn.text; - $.fn.text = function(str) { - if (str != undef && !$.isFunction(str) && this.data('dotdotdot')) { - str = $('
').text(str).html(); - return this.trigger('update', [str]); - } - return _orgText.apply(this, arguments); - }; - - -})(jQuery); - -/* - -## Automatic parsing for CSS classes -Contributed by [Ramil Valitov](https://github.com/rvalitov) - -### The idea -You can add one or several CSS classes to HTML elements to automatically invoke "jQuery.dotdotdot functionality" and some extra features. It allows to use jQuery.dotdotdot only by adding appropriate CSS classes without JS programming. - -### Available classes and their description -* dot-ellipsis - automatically invoke jQuery.dotdotdot to this element. This class must be included if you plan to use other classes below. -* dot-resize-update - automatically update if window resize event occurs. It's equivalent to option `watch:'window'`. -* dot-timer-update - automatically update at regular intervals using setInterval. It's equivalent to option `watch:true`. -* dot-load-update - automatically update after the window has beem completely rendered. Can be useful if your content is generated dynamically using using JS and, hence, jQuery.dotdotdot can't correctly detect the height of the element before it's rendered completely. -* dot-height-XXX - available height of content area in pixels, where XXX is a number, e.g. can be `dot-height-35` if you want to set maximum height for 35 pixels. It's equivalent to option `height:'XXX'`. - -### Usage examples -*Adding jQuery.dotdotdot to element* - -
-

Lorem Ipsum is simply dummy text.

-
- -*Adding jQuery.dotdotdot to element with update on window resize* - -
-

Lorem Ipsum is simply dummy text.

-
- -*Adding jQuery.dotdotdot to element with predefined height of 50px* - -
-

Lorem Ipsum is simply dummy text.

-
- -*/ - -jQuery(document).ready(function($) { - //We only invoke jQuery.dotdotdot on elements that have dot-ellipsis class - $(".dot-ellipsis").each(function() { - //Checking if update on window resize required - var watch_window = $(this).hasClass("dot-resize-update"); - - //Checking if update on timer required - var watch_timer = $(this).hasClass("dot-timer-update"); - - //Checking if height set - var height = 0; - var classList = $(this).attr('class').split(/\s+/); - $.each(classList, function(index, item) { - var matchResult = item.match(/^dot-height-(\d+)$/); - if (matchResult !== null) - height = Number(matchResult[1]); - }); - - //Invoking jQuery.dotdotdot - var x = {}; - if (watch_timer) - x.watch = true; - if (watch_window) - x.watch = 'window'; - if (height > 0) - x.height = height; - $(this).dotdotdot(x); - }); -}); - -//Updating elements (if any) on window.load event -jQuery(window).on('load', function() { - jQuery(".dot-ellipsis.dot-load-update").trigger("update.dot"); -}); - -//============================================================================== - - -// Ultra lightweight, usable, beautiful autocomplete with zero dependencies. -// http://leaverou.github.io/awesomplete/ -//============================================================================== -/** - * Simple, lightweight, usable local autocomplete library for modern browsers - * Because there weren’t enough autocomplete scripts in the world? Because I’m completely insane and have NIH syndrome? Probably both. :P - * @author Lea Verou http://leaverou.github.io/awesomplete - * MIT license - */ - -(function () { - -var _ = function (input, o) { - var me = this; - - // Setup - - this.isOpened = false; - - this.input = $(input); - this.input.setAttribute("autocomplete", "off"); - this.input.setAttribute("aria-autocomplete", "list"); - - o = o || {}; - - configure(this, { - minChars: 2, - maxItems: 10, - autoFirst: false, - data: _.DATA, - filter: _.FILTER_CONTAINS, - sort: o.sort === false ? false : _.SORT_BYLENGTH, - item: _.ITEM, - replace: _.REPLACE - }, o); - - this.index = -1; - - // Create necessary elements - - this.container = $.create("div", { - className: "awesomplete", - around: input - }); - - this.ul = $.create("ul", { - hidden: "hidden", - inside: this.container - }); - - this.status = $.create("span", { - className: "visually-hidden", - role: "status", - "aria-live": "assertive", - "aria-relevant": "additions", - inside: this.container - }); - - // Bind events - - this._events = { - input: { - "input": this.evaluate.bind(this), - "blur": this.close.bind(this, { reason: "blur" }), - "keydown": function(evt) { - var c = evt.keyCode; - - // If the dropdown `ul` is in view, then act on keydown for the following keys: - // Enter / Esc / Up / Down - if(me.opened) { - if (c === 13 && me.selected) { // Enter - evt.preventDefault(); - me.select(); - } - else if (c === 27) { // Esc - me.close({ reason: "esc" }); - } - else if (c === 38 || c === 40) { // Down/Up arrow - evt.preventDefault(); - me[c === 38? "previous" : "next"](); - } - } - } - }, - form: { - "submit": this.close.bind(this, { reason: "submit" }) - }, - ul: { - "mousedown": function(evt) { - var li = evt.target; - - if (li !== this) { - - while (li && !/li/i.test(li.nodeName)) { - li = li.parentNode; - } - - if (li && evt.button === 0) { // Only select on left click - evt.preventDefault(); - me.select(li, evt.target); - } - } - } - } - }; - - $.bind(this.input, this._events.input); - $.bind(this.input.form, this._events.form); - $.bind(this.ul, this._events.ul); - - if (this.input.hasAttribute("list")) { - this.list = "#" + this.input.getAttribute("list"); - this.input.removeAttribute("list"); - } - else { - this.list = this.input.getAttribute("data-list") || o.list || []; - } - - _.all.push(this); -}; - -_.prototype = { - set list(list) { - if (Array.isArray(list)) { - this._list = list; - } - else if (typeof list === "string" && list.indexOf(",") > -1) { - this._list = list.split(/\s*,\s*/); - } - else { // Element or CSS selector - list = $(list); - - if (list && list.children) { - var items = []; - slice.apply(list.children).forEach(function (el) { - if (!el.disabled) { - var text = el.textContent.trim(); - var value = el.value || text; - var label = el.label || text; - if (value !== "") { - items.push({ label: label, value: value }); - } - } - }); - this._list = items; - } - } - - if (document.activeElement === this.input) { - this.evaluate(); - } - }, - - get selected() { - return this.index > -1; - }, - - get opened() { - return this.isOpened; - }, - - close: function (o) { - if (!this.opened) { - return; - } - - this.ul.setAttribute("hidden", ""); - this.isOpened = false; - this.index = -1; - - $.fire(this.input, "awesomplete-close", o || {}); - }, - - open: function () { - this.ul.removeAttribute("hidden"); - this.isOpened = true; - - if (this.autoFirst && this.index === -1) { - this.goto(0); - } - - $.fire(this.input, "awesomplete-open"); - }, - - destroy: function() { - //remove events from the input and its form - $.unbind(this.input, this._events.input); - $.unbind(this.input.form, this._events.form); - - //move the input out of the awesomplete container and remove the container and its children - var parentNode = this.container.parentNode; - - parentNode.insertBefore(this.input, this.container); - parentNode.removeChild(this.container); - - //remove autocomplete and aria-autocomplete attributes - this.input.removeAttribute("autocomplete"); - this.input.removeAttribute("aria-autocomplete"); - - //remove this awesomeplete instance from the global array of instances - var indexOfAwesomplete = _.all.indexOf(this); - - if (indexOfAwesomplete !== -1) { - _.all.splice(indexOfAwesomplete, 1); - } - }, - - next: function () { - var count = this.ul.children.length; - this.goto(this.index < count - 1 ? this.index + 1 : (count ? 0 : -1) ); - }, - - previous: function () { - var count = this.ul.children.length; - var pos = this.index - 1; - - this.goto(this.selected && pos !== -1 ? pos : count - 1); - }, - - // Should not be used, highlights specific item without any checks! - goto: function (i) { - var lis = this.ul.children; - - if (this.selected) { - lis[this.index].setAttribute("aria-selected", "false"); - } - - this.index = i; - - if (i > -1 && lis.length > 0) { - lis[i].setAttribute("aria-selected", "true"); - this.status.textContent = lis[i].textContent; - - // scroll to highlighted element in case parent's height is fixed - this.ul.scrollTop = lis[i].offsetTop - this.ul.clientHeight + lis[i].clientHeight; - - $.fire(this.input, "awesomplete-highlight", { - text: this.suggestions[this.index] - }); - } - }, - - select: function (selected, origin) { - if (selected) { - this.index = $.siblingIndex(selected); - } else { - selected = this.ul.children[this.index]; - } - - if (selected) { - var suggestion = this.suggestions[this.index]; - - var allowed = $.fire(this.input, "awesomplete-select", { - text: suggestion, - origin: origin || selected - }); - - if (allowed) { - this.replace(suggestion); - this.close({ reason: "select" }); - $.fire(this.input, "awesomplete-selectcomplete", { - text: suggestion - }); - } - } - }, - - evaluate: function() { - var me = this; - var value = this.input.value; - - if (value.length >= this.minChars && this._list.length > 0) { - this.index = -1; - // Populate list with options that match - this.ul.innerHTML = ""; - - this.suggestions = this._list - .map(function(item) { - return new Suggestion(me.data(item, value)); - }) - .filter(function(item) { - return me.filter(item, value); - }); - - if (this.sort !== false) { - this.suggestions = this.suggestions.sort(this.sort); - } - - this.suggestions = this.suggestions.slice(0, this.maxItems); - - this.suggestions.forEach(function(text) { - me.ul.appendChild(me.item(text, value)); - }); - - if (this.ul.children.length === 0) { - this.close({ reason: "nomatches" }); - } else { - this.open(); - } - } - else { - this.close({ reason: "nomatches" }); - } - } -}; - -// Static methods/properties - -_.all = []; - -_.FILTER_CONTAINS = function (text, input) { - return RegExp($.regExpEscape(input.trim()), "i").test(text); -}; - -_.FILTER_STARTSWITH = function (text, input) { - return RegExp("^" + $.regExpEscape(input.trim()), "i").test(text); -}; - -_.SORT_BYLENGTH = function (a, b) { - if (a.length !== b.length) { - return a.length - b.length; - } - - return a < b? -1 : 1; -}; - -_.ITEM = function (text, input) { - var html = input.trim() === "" ? text : text.replace(RegExp($.regExpEscape(input.trim()), "gi"), "$&"); - return $.create("li", { - innerHTML: html, - "aria-selected": "false" - }); -}; - -_.REPLACE = function (text) { - this.input.value = text.value; -}; - -_.DATA = function (item/*, input*/) { return item; }; - -// Private functions - -function Suggestion(data) { - var o = Array.isArray(data) - ? { label: data[0], value: data[1] } - : typeof data === "object" && "label" in data && "value" in data ? data : { label: data, value: data }; - - this.label = o.label || o.value; - this.value = o.value; -} -Object.defineProperty(Suggestion.prototype = Object.create(String.prototype), "length", { - get: function() { return this.label.length; } -}); -Suggestion.prototype.toString = Suggestion.prototype.valueOf = function () { - return "" + this.label; -}; - -function configure(instance, properties, o) { - for (var i in properties) { - var initial = properties[i], - attrValue = instance.input.getAttribute("data-" + i.toLowerCase()); - - if (typeof initial === "number") { - instance[i] = parseInt(attrValue); - } - else if (initial === false) { // Boolean options must be false by default anyway - instance[i] = attrValue !== null; - } - else if (initial instanceof Function) { - instance[i] = null; - } - else { - instance[i] = attrValue; - } - - if (!instance[i] && instance[i] !== 0) { - instance[i] = (i in o)? o[i] : initial; - } - } -} - -// Helpers - -var slice = Array.prototype.slice; - -function $(expr, con) { - return typeof expr === "string"? (con || document).querySelector(expr) : expr || null; -} - -function $$(expr, con) { - return slice.call((con || document).querySelectorAll(expr)); -} - -$.create = function(tag, o) { - var element = document.createElement(tag); - - for (var i in o) { - var val = o[i]; - - if (i === "inside") { - $(val).appendChild(element); - } - else if (i === "around") { - var ref = $(val); - ref.parentNode.insertBefore(element, ref); - element.appendChild(ref); - } - else if (i in element) { - element[i] = val; - } - else { - element.setAttribute(i, val); - } - } - - return element; -}; - -$.bind = function(element, o) { - if (element) { - for (var event in o) { - var callback = o[event]; - - event.split(/\s+/).forEach(function (event) { - element.addEventListener(event, callback); - }); - } - } -}; - -$.unbind = function(element, o) { - if (element) { - for (var event in o) { - var callback = o[event]; - - event.split(/\s+/).forEach(function(event) { - element.removeEventListener(event, callback); - }); - } - } -}; - -$.fire = function(target, type, properties) { - var evt = document.createEvent("HTMLEvents"); - - evt.initEvent(type, true, true ); - - for (var j in properties) { - evt[j] = properties[j]; - } - - return target.dispatchEvent(evt); -}; - -$.regExpEscape = function (s) { - return s.replace(/[-\\^$*+?.()|[\]{}]/g, "\\$&"); -}; - -$.siblingIndex = function (el) { - /* eslint-disable no-cond-assign */ - for (var i = 0; el = el.previousElementSibling; i++); - return i; -}; - -// Initialization - -function init() { - $$("input.awesomplete").forEach(function (input) { - new _(input); - }); -} - -// Are we in a browser? Check for Document constructor -if (typeof Document !== "undefined") { - // DOM already loaded? - if (document.readyState !== "loading") { - init(); - } - else { - // Wait for it - document.addEventListener("DOMContentLoaded", init); - } -} - -_.$ = $; -_.$$ = $$; - -// Make sure to export Awesomplete on self when in a browser -if (typeof self !== "undefined") { - self.Awesomplete = _; -} - -// Expose Awesomplete as a CJS module -if (typeof module === "object" && module.exports) { - module.exports = _; -} - -return _; - -}()); - -//============================================================================== - - -// Simplelightbox -// Touch-friendly image lightbox for mobile and desktop with jQuery -// https://github.com/andreknieriem/simplelightbox -//============================================================================== -/* - By André Rinas, www.andrerinas.de - Available for use under the MIT License - 1.12.1 -*/ -;( function( $, window, document, undefined ) -{ - 'use strict'; - -$.fn.simpleLightbox = function( options ) -{ - - var options = $.extend({ - sourceAttr: 'href', - overlay: true, - spinner: true, - nav: true, - navText: ['‹', '›'], - captions: true, - captionDelay: 0, - captionSelector: 'img', - captionType: 'attr', - captionsData: 'title', - captionPosition: 'bottom', - captionClass: '', - close: true, - closeText: '×', - swipeClose: true, - showCounter: true, - fileExt: 'png|jpg|jpeg|gif', - animationSlide: true, - animationSpeed: 250, - preloading: true, - enableKeyboard: true, - loop: true, - rel: false, - docClose: true, - swipeTolerance: 50, - className: 'simple-lightbox', - widthRatio: 0.8, - heightRatio: 0.9, - disableRightClick: false, - disableScroll: true, - alertError: true, - alertErrorMessage: 'Image not found, next image will be loaded', - additionalHtml: false, - history: true - }, options); - - // global variables - var touchDevice = ( 'ontouchstart' in window ), - pointerEnabled = window.navigator.pointerEnabled || window.navigator.msPointerEnabled, - touched = function( event ){ - if( touchDevice ) return true; - if( !pointerEnabled || typeof event === 'undefined' || typeof event.pointerType === 'undefined' ) return false; - if( typeof event.MSPOINTER_TYPE_MOUSE !== 'undefined' ) { - if( event.MSPOINTER_TYPE_MOUSE != event.pointerType ) return true; - } - else { - if( event.pointerType != 'mouse' ) return true; - } - return false; - }, - swipeDiff = 0, - swipeYDiff = 0, - curImg = $(), - transPrefix = function(){ - var s = document.body || document.documentElement; - s = s.style; - if( s.WebkitTransition === '' ) return '-webkit-'; - if( s.MozTransition === '' ) return '-moz-'; - if( s.OTransition === '' ) return '-o-'; - if( s.transition === '' ) return ''; - return false; - }, - opened = false, - loaded = [], - getRelated = function(rel, jqObj) { - var $related = $(jqObj.selector).filter(function () { - return ($(this).attr('rel') === rel); - }); - return $related; - }, - objects = (options.rel && options.rel !== false) ? getRelated(options.rel, this) : this, - transPrefix = transPrefix(), - globalScrollbarwidth = 0, - canTransisions = (transPrefix !== false) ? true : false, - supportsPushState = ('pushState' in history), - historyhasChanged = false, - historyUpdateTimeout, - winLoc = window.location, - getHash = function(){ - return winLoc.hash.substring(1); - }, - initialHash = getHash(), - updateHash = function(){ - var hash = getHash(), - newHash = 'pid='+(index+1); - var newURL = winLoc.href.split('#')[0] + '#' + newHash; - - if(supportsPushState){ - history[historyhasChanged ? 'replaceState' : 'pushState']('', document.title, newURL); - }else { - if(historyhasChanged) { - winLoc.replace( newURL ); - } else { - winLoc.hash = newHash; - } - } - historyhasChanged = true; - }, - resetHash = function() { - if (supportsPushState) { - history.pushState('', document.title, winLoc.pathname + winLoc.search ); - } else { - winLoc.hash = ''; - } - clearTimeout(historyUpdateTimeout); - - }, - updateURL = function(){ - if(!historyhasChanged) { - updateHash(); // first time - } else { - historyUpdateTimeout = setTimeout(updateHash, 800); - } - }, - prefix = 'simplelb', - overlay = $('
').addClass('sl-overlay'), - closeBtn = $(''), - counter = $('
').addClass('sl-counter').html('/'), - animating = false, - index = 0, - caption = $('
').addClass('sl-caption '+options.captionClass+' pos-'+options.captionPosition), - image = $('
').addClass('sl-image'), - wrapper = $('
').addClass('sl-wrapper').addClass(options.className), - isValidLink = function( element ){ - if(!options.fileExt) return true; - var filEext = /\.([0-9a-z]+)(?=[?#])|(\.)(?:[\w]+)$/gmi; - var testExt = $( element ).attr( options.sourceAttr ).match(filEext); - return testExt && $( element ).prop( 'tagName' ).toLowerCase() == 'a' && ( new RegExp( '\.(' + options.fileExt + ')$', 'i' ) ).test( testExt ); - }, - setup = function(){ - if(options.close) closeBtn.appendTo(wrapper); - if(options.showCounter){ - if(objects.length > 1){ - counter.appendTo(wrapper); - counter.find('.sl-total').text(objects.length); - } - } - if(options.nav) nav.appendTo(wrapper); - if(options.spinner) spinner.appendTo(wrapper); - }, - openImage = function(elem){ - elem.trigger($.Event('show.simplelightbox')); - if(options.disableScroll) globalScrollbarwidth = handleScrollbar('hide'); - wrapper.appendTo('body'); - image.appendTo(wrapper); - if(options.overlay) overlay.appendTo($('body')); - animating = true; - index = objects.index(elem); - curImg = $( '' ) - .hide() - .attr('src', elem.attr(options.sourceAttr)); - if(loaded.indexOf(elem.attr(options.sourceAttr)) == -1){ - loaded.push(elem.attr(options.sourceAttr)); - } - image.html('').attr('style',''); - curImg.appendTo(image); - addEvents(); - overlay.fadeIn('fast'); - $('.sl-close').fadeIn('fast'); - spinner.show(); - nav.fadeIn('fast'); - $('.sl-wrapper .sl-counter .sl-current').text(index +1); - counter.fadeIn('fast'); - adjustImage(); - if(options.preloading) preload(); - setTimeout( function(){ elem.trigger($.Event('shown.simplelightbox')); } ,options.animationSpeed); - }, - adjustImage = function(dir){ - if(!curImg.length) return; - var tmpImage = new Image(), - windowWidth = $( window ).width() * options.widthRatio, - windowHeight = $( window ).height() * options.heightRatio; - tmpImage.src = curImg.attr( 'src' ); - - $(tmpImage).on('error',function(ev){ - //no image was found - objects.eq(index).trigger($.Event('error.simplelightbox')); - animating = false; - opened = true; - spinner.hide(); - if(options.alertError){ - alert(options.alertErrorMessage); - } - if(dir == 1 || dir == -1){ - loadImage(dir); - } else { - loadImage(1); - } - return; - }); - - - tmpImage.onload = function() { - if (typeof dir !== 'undefined') { - objects.eq(index) - .trigger($.Event('changed.simplelightbox')) - .trigger($.Event( (dir===1?'nextDone':'prevDone')+'.simplelightbox')); - } - - // history - if(options.history){ - updateURL(); - } - - if(loaded.indexOf(curImg.attr( 'src' )) == -1){ - loaded.push(curImg.attr( 'src' )); - } - var imageWidth = tmpImage.width, - imageHeight = tmpImage.height; - - if( imageWidth > windowWidth || imageHeight > windowHeight ){ - var ratio = imageWidth / imageHeight > windowWidth / windowHeight ? imageWidth / windowWidth : imageHeight / windowHeight; - imageWidth /= ratio; - imageHeight /= ratio; - } - - $('.sl-image').css({ - 'top': ( $( window ).height() - imageHeight ) / 2 + 'px', - 'left': ( $( window ).width() - imageWidth - globalScrollbarwidth)/ 2 + 'px' - }); - spinner.hide(); - curImg - .css({ - 'width': imageWidth + 'px', - 'height': imageHeight + 'px' - }) - .fadeIn('fast'); - opened = true; - var cSel = (options.captionSelector == 'self') ? objects.eq(index) : objects.eq(index).find(options.captionSelector); - var captionText; - if(options.captionType == 'data'){ - captionText = cSel.data(options.captionsData); - } else if(options.captionType == 'text'){ - captionText = cSel.html(); - } else { - captionText = cSel.prop(options.captionsData); - } - - if(!options.loop) { - if(index === 0){ $('.sl-prev').hide();} - if(index >= objects.length -1) {$('.sl-next').hide();} - if(index > 0){ $('.sl-prev').show(); } - if(index < objects.length -1){ $('.sl-next').show(); } - } - - if(objects.length == 1) $('.sl-prev, .sl-next').hide(); - - if(dir == 1 || dir == -1){ - var css = { 'opacity': 1.0 }; - if( options.animationSlide ) { - if( canTransisions ) { - slide(0, 100 * dir + 'px'); - setTimeout( function(){ slide( options.animationSpeed / 1000, 0 + 'px'); }, 50 ); - } - else { - css.left = parseInt( $('.sl-image').css( 'left' ) ) + 100 * dir + 'px'; - } - } - - $('.sl-image').animate( css, options.animationSpeed, function(){ - animating = false; - setCaption(captionText); - }); - } else { - animating = false; - setCaption(captionText); - } - if(options.additionalHtml && $('.sl-additional-html').length === 0){ - $('
').html(options.additionalHtml).addClass('sl-additional-html').appendTo($('.sl-image')); - } - }; - }, - setCaption = function(captiontext){ - if(captiontext !== '' && typeof captiontext !== "undefined" && options.captions){ - caption.html(captiontext).hide().appendTo($('.sl-image')).delay(options.captionDelay).fadeIn('fast'); - } - }, - slide = function(speed, pos){ - var styles = {}; - styles[transPrefix + 'transform'] = 'translateX(' + pos + ')'; - styles[transPrefix + 'transition'] = transPrefix + 'transform ' + speed + 's linear'; - $('.sl-image').css(styles); - }, - addEvents = function(){ - // resize/responsive - $( window ).on( 'resize.'+prefix, adjustImage ); - - // close lightbox on close btn - $( document ).on('click.'+prefix+ ' touchstart.'+prefix, '.sl-close', function(e){ - e.preventDefault(); - if(opened){ close();} - }); - - if(options.history){ - setTimeout(function() { - $(window).on('hashchange.'+prefix,function(){ - if(opened){ - if(getHash() === initialHash) { - close(); - return; - } - } - }); - }, 40); - } - - // nav-buttons - nav.on('click.'+prefix, 'button', function(e){ - e.preventDefault(); - swipeDiff = 0; - loadImage( $(this).hasClass('sl-next') ? 1 : -1 ); - }); - - // touchcontrols - var swipeStart = 0, - swipeEnd = 0, - swipeYStart = 0, - swipeYEnd = 0, - mousedown = false, - imageLeft = 0; - - image - .on( 'touchstart.'+prefix+' mousedown.'+prefix, function(e) - { - if(mousedown) return true; - if( canTransisions ) imageLeft = parseInt( image.css( 'left' ) ); - mousedown = true; - swipeDiff = 0; - swipeYDiff = 0; - swipeStart = e.originalEvent.pageX || e.originalEvent.touches[ 0 ].pageX; - swipeYStart = e.originalEvent.pageY || e.originalEvent.touches[ 0 ].pageY; - return false; - }) - .on( 'touchmove.'+prefix+' mousemove.'+prefix+' pointermove MSPointerMove', function(e) - { - if(!mousedown) return true; - e.preventDefault(); - swipeEnd = e.originalEvent.pageX || e.originalEvent.touches[ 0 ].pageX; - swipeYEnd = e.originalEvent.pageY || e.originalEvent.touches[ 0 ].pageY; - swipeDiff = swipeStart - swipeEnd; - swipeYDiff = swipeYStart - swipeYEnd; - if( options.animationSlide ) { - if( canTransisions ) slide( 0, -swipeDiff + 'px' ); - else image.css( 'left', imageLeft - swipeDiff + 'px' ); - } - }) - .on( 'touchend.'+prefix+' mouseup.'+prefix+' touchcancel.'+prefix+' mouseleave.'+prefix+' pointerup pointercancel MSPointerUp MSPointerCancel',function(e) - { - if(mousedown){ - mousedown = false; - var possibleDir = true; - if(!options.loop) { - if(index === 0 && swipeDiff < 0){ possibleDir = false; } - if(index >= objects.length -1 && swipeDiff > 0) { possibleDir = false; } - } - if( Math.abs( swipeDiff ) > options.swipeTolerance && possibleDir ) { - loadImage( swipeDiff > 0 ? 1 : -1 ); - } - else if( options.animationSlide ) - { - if( canTransisions ) slide( options.animationSpeed / 1000, 0 + 'px' ); - else image.animate({ 'left': imageLeft + 'px' }, options.animationSpeed / 2 ); - } - - if( options.swipeClose && Math.abs(swipeYDiff) > 50 && Math.abs( swipeDiff ) < options.swipeTolerance) { - close(); - } - } - }); - }, - removeEvents = function(){ - nav.off('click', 'button'); - $( document ).off('click.'+prefix, '.sl-close'); - $( window ).off( 'resize.'+prefix); - $( window ).off( 'hashchange.'+prefix); - }, - preload = function(){ - var next = (index+1 < 0) ? objects.length -1: (index+1 >= objects.length -1) ? 0 : index+1, - prev = (index-1 < 0) ? objects.length -1: (index-1 >= objects.length -1) ? 0 : index-1; - $( '' ).attr( 'src', objects.eq(next).attr( options.sourceAttr ) ).on('load', function(){ - if(loaded.indexOf($(this).attr('src')) == -1){ - loaded.push($(this).attr('src')); - } - objects.eq(index).trigger($.Event('nextImageLoaded.simplelightbox')); - }); - $( '' ).attr( 'src', objects.eq(prev).attr( options.sourceAttr ) ).on('load', function(){ - if(loaded.indexOf($(this).attr('src')) == -1){ - loaded.push($(this).attr('src')); - } - objects.eq(index).trigger($.Event('prevImageLoaded.simplelightbox')); - }); - - }, - loadImage = function(dir){ - objects.eq(index) - .trigger($.Event('change.simplelightbox')) - .trigger($.Event( (dir===1?'next':'prev')+'.simplelightbox')); - - var newIndex = index + dir; - if(animating || (newIndex < 0 || newIndex >= objects.length) && options.loop === false ) return; - index = (newIndex < 0) ? objects.length -1: (newIndex > objects.length -1) ? 0 : newIndex; - $('.sl-wrapper .sl-counter .sl-current').text(index +1); - var css = { 'opacity': 0 }; - if( options.animationSlide ) { - if( canTransisions ) slide(options.animationSpeed / 1000, ( -100 * dir ) - swipeDiff + 'px'); - else css.left = parseInt( $('.sl-image').css( 'left' ) ) + -100 * dir + 'px'; - } - - $('.sl-image').animate( css, options.animationSpeed, function(){ - setTimeout( function(){ - // fadeout old image - var elem = objects.eq(index); - curImg - .attr('src', elem.attr(options.sourceAttr)); - if(loaded.indexOf(elem.attr(options.sourceAttr)) == -1){ - spinner.show(); - } - $('.sl-caption').remove(); - adjustImage(dir); - if(options.preloading) preload(); - }, 100); - }); - }, - close = function(){ - if(animating) return; - var elem = objects.eq(index), - triggered = false; - - elem.trigger($.Event('close.simplelightbox')); - if(options.history){ - resetHash(); - } - $('.sl-image img, .sl-overlay, .sl-close, .sl-navigation, .sl-image .sl-caption, .sl-counter').fadeOut('fast', function(){ - if(options.disableScroll) handleScrollbar('show'); - $('.sl-wrapper, .sl-overlay').remove(); - removeEvents(); - if(!triggered) elem.trigger($.Event('closed.simplelightbox')); - triggered = true; - }); - curImg = $(); - opened = false; - animating = false; - }, - handleScrollbar = function(type){ - var scrollbarWidth = 0; - if(type == 'hide'){ - var fullWindowWidth = window.innerWidth; - if (!fullWindowWidth) { - var documentElementRect = document.documentElement.getBoundingClientRect(); - fullWindowWidth = documentElementRect.right - Math.abs(documentElementRect.left); - } - if(document.body.clientWidth < fullWindowWidth){ - var scrollDiv = document.createElement('div'), - padding = parseInt($('body').css('padding-right'),10); - scrollDiv.className = 'sl-scrollbar-measure'; - $('body').append(scrollDiv); - scrollbarWidth = scrollDiv.offsetWidth - scrollDiv.clientWidth; - $(document.body)[0].removeChild(scrollDiv); - $('body').data('padding',padding); - if(scrollbarWidth > 0){ - $('body').addClass('hidden-scroll').css({'padding-right':padding+scrollbarWidth}); - } - } - } else { - $('body').removeClass('hidden-scroll').css({'padding-right':$('body').data('padding')}); - } - return scrollbarWidth; - }; - - // events - setup(); - - // open lightbox - objects.on( 'click.'+prefix, function( e ){ - if(isValidLink(this)){ - e.preventDefault(); - if(animating) return false; - openImage($(this)); - } - }); - - // close on click on doc - $( document ).on('click.'+prefix+ ' touchstart.'+prefix, function(e){ - if(opened){ - if((options.docClose && $(e.target).closest('.sl-image').length === 0 && $(e.target).closest('.sl-navigation').length === 0)){ - close(); - } - } - }); - - // disable rightclick - if(options.disableRightClick){ - $( document ).on('contextmenu', '.sl-image img', function(e){ - return false; - }); - } - - - // keyboard-control - if( options.enableKeyboard ){ - $( document ).on( 'keyup.'+prefix, function( e ){ - swipeDiff = 0; - // keyboard control only if lightbox is open - if(opened){ - e.preventDefault(); - var key = e.keyCode; - if( key == 27 ) { - close(); - } - if( key == 37 || e.keyCode == 39 ) { - loadImage( e.keyCode == 39 ? 1 : -1 ); - } - } - }); - } - - // Public methods - this.open = function(elem){ - elem = elem || $(this[0]); - openImage(elem); - }; - - this.next = function(){ - loadImage( 1 ); - }; - - this.prev = function(){ - loadImage( -1 ); - }; - - this.close = function(){ - close(); - }; - - this.destroy = function(){ - $( document ).off('click.'+prefix).off('keyup.'+prefix); - close(); - $('.sl-overlay, .sl-wrapper').remove(); - this.off('click'); - }; - - this.refresh = function(){ - this.destroy(); - $(this).simpleLightbox(options); - }; - - return this; - -}; -})( jQuery, window, document ); - -//============================================================================== - - -// Parallax -// JavaScript parallax scrolling -// https://github.com/nk-o/jarallax -//============================================================================== -/*! - * Name : Just Another Parallax [Jarallax] - * Version : 1.10.7 - * Author : nK - * GitHub : https://github.com/nk-o/jarallax - */ -/******/ (function(modules) { // webpackBootstrap -/******/ // The module cache -/******/ var installedModules = {}; -/******/ -/******/ // The require function -/******/ function __webpack_require__(moduleId) { -/******/ -/******/ // Check if module is in cache -/******/ if(installedModules[moduleId]) { -/******/ return installedModules[moduleId].exports; -/******/ } -/******/ // Create a new module (and put it into the cache) -/******/ var module = installedModules[moduleId] = { -/******/ i: moduleId, -/******/ l: false, -/******/ exports: {} -/******/ }; -/******/ -/******/ // Execute the module function -/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); -/******/ -/******/ // Flag the module as loaded -/******/ module.l = true; -/******/ -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } -/******/ -/******/ -/******/ // expose the modules object (__webpack_modules__) -/******/ __webpack_require__.m = modules; -/******/ -/******/ // expose the module cache -/******/ __webpack_require__.c = installedModules; -/******/ -/******/ // define getter function for harmony exports -/******/ __webpack_require__.d = function(exports, name, getter) { -/******/ if(!__webpack_require__.o(exports, name)) { -/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); -/******/ } -/******/ }; -/******/ -/******/ // define __esModule on exports -/******/ __webpack_require__.r = function(exports) { -/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { -/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); -/******/ } -/******/ Object.defineProperty(exports, '__esModule', { value: true }); -/******/ }; -/******/ -/******/ // create a fake namespace object -/******/ // mode & 1: value is a module id, require it -/******/ // mode & 2: merge all properties of value into the ns -/******/ // mode & 4: return value when already ns object -/******/ // mode & 8|1: behave like require -/******/ __webpack_require__.t = function(value, mode) { -/******/ if(mode & 1) value = __webpack_require__(value); -/******/ if(mode & 8) return value; -/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; -/******/ var ns = Object.create(null); -/******/ __webpack_require__.r(ns); -/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); -/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); -/******/ return ns; -/******/ }; -/******/ -/******/ // getDefaultExport function for compatibility with non-harmony modules -/******/ __webpack_require__.n = function(module) { -/******/ var getter = module && module.__esModule ? -/******/ function getDefault() { return module['default']; } : -/******/ function getModuleExports() { return module; }; -/******/ __webpack_require__.d(getter, 'a', getter); -/******/ return getter; -/******/ }; -/******/ -/******/ // Object.prototype.hasOwnProperty.call -/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; -/******/ -/******/ // __webpack_public_path__ -/******/ __webpack_require__.p = ""; -/******/ -/******/ -/******/ // Load entry module and return exports -/******/ return __webpack_require__(__webpack_require__.s = 11); -/******/ }) -/************************************************************************/ -/******/ ([ -/* 0 */, -/* 1 */, -/* 2 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -module.exports = function (callback) { - - if (document.readyState === 'complete' || document.readyState === 'interactive') { - // Already ready or interactive, execute callback - callback.call(); - } else if (document.attachEvent) { - // Old browsers - document.attachEvent('onreadystatechange', function () { - if (document.readyState === 'interactive') callback.call(); - }); - } else if (document.addEventListener) { - // Modern browsers - document.addEventListener('DOMContentLoaded', callback); - } -}; - -/***/ }), -/* 3 */, -/* 4 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -/* WEBPACK VAR INJECTION */(function(global) { - -var win; - -if (typeof window !== "undefined") { - win = window; -} else if (typeof global !== "undefined") { - win = global; -} else if (typeof self !== "undefined") { - win = self; -} else { - win = {}; -} - -module.exports = win; -/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(5))) - -/***/ }), -/* 5 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; - -var g; - -// This works in non-strict mode -g = function () { - return this; -}(); - -try { - // This works if eval is allowed (see CSP) - g = g || Function("return this")() || (1, eval)("this"); -} catch (e) { - // This works if the window reference is available - if ((typeof window === "undefined" ? "undefined" : _typeof(window)) === "object") g = window; -} - -// g can still be undefined, but nothing to do about it... -// We return undefined, instead of nothing here, so it's -// easier to handle this case. if(!global) { ...} - -module.exports = g; - -/***/ }), -/* 6 */, -/* 7 */, -/* 8 */, -/* 9 */, -/* 10 */, -/* 11 */ -/***/ (function(module, exports, __webpack_require__) { - -module.exports = __webpack_require__(12); - - -/***/ }), -/* 12 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; - -var _liteReady = __webpack_require__(2); - -var _liteReady2 = _interopRequireDefault(_liteReady); - -var _global = __webpack_require__(4); - -var _jarallax = __webpack_require__(13); - -var _jarallax2 = _interopRequireDefault(_jarallax); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -// no conflict -var oldPlugin = _global.window.jarallax; -_global.window.jarallax = _jarallax2.default; -_global.window.jarallax.noConflict = function () { - _global.window.jarallax = oldPlugin; - return this; -}; - -// jQuery support -if (typeof _global.jQuery !== 'undefined') { - var jQueryPlugin = function jQueryPlugin() { - var args = arguments || []; - Array.prototype.unshift.call(args, this); - var res = _jarallax2.default.apply(_global.window, args); - return (typeof res === 'undefined' ? 'undefined' : _typeof(res)) !== 'object' ? res : this; - }; - jQueryPlugin.constructor = _jarallax2.default.constructor; - - // no conflict - var oldJqPlugin = _global.jQuery.fn.jarallax; - _global.jQuery.fn.jarallax = jQueryPlugin; - _global.jQuery.fn.jarallax.noConflict = function () { - _global.jQuery.fn.jarallax = oldJqPlugin; - return this; - }; -} - -// data-jarallax initialization -(0, _liteReady2.default)(function () { - (0, _jarallax2.default)(document.querySelectorAll('[data-jarallax]')); -}); - -/***/ }), -/* 13 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -/* WEBPACK VAR INJECTION */(function(global) { - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }(); - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - -var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; - -var _liteReady = __webpack_require__(2); - -var _liteReady2 = _interopRequireDefault(_liteReady); - -var _rafl = __webpack_require__(14); - -var _rafl2 = _interopRequireDefault(_rafl); - -var _global = __webpack_require__(4); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -var isIE = navigator.userAgent.indexOf('MSIE ') > -1 || navigator.userAgent.indexOf('Trident/') > -1 || navigator.userAgent.indexOf('Edge/') > -1; - -var supportTransform = function () { - var prefixes = 'transform WebkitTransform MozTransform'.split(' '); - var div = document.createElement('div'); - for (var i = 0; i < prefixes.length; i++) { - if (div && div.style[prefixes[i]] !== undefined) { - return prefixes[i]; - } - } - return false; -}(); - -// Window data -var wndW = void 0; -var wndH = void 0; -var wndY = void 0; -var forceResizeParallax = false; -var forceScrollParallax = false; -function updateWndVars(e) { - wndW = _global.window.innerWidth || document.documentElement.clientWidth; - wndH = _global.window.innerHeight || document.documentElement.clientHeight; - if ((typeof e === 'undefined' ? 'undefined' : _typeof(e)) === 'object' && (e.type === 'load' || e.type === 'dom-loaded')) { - forceResizeParallax = true; - } -} -updateWndVars(); -_global.window.addEventListener('resize', updateWndVars); -_global.window.addEventListener('orientationchange', updateWndVars); -_global.window.addEventListener('load', updateWndVars); -(0, _liteReady2.default)(function () { - updateWndVars({ - type: 'dom-loaded' - }); -}); - -// list with all jarallax instances -// need to render all in one scroll/resize event -var jarallaxList = []; - -// Animate if changed window size or scrolled page -var oldPageData = false; -function updateParallax() { - if (!jarallaxList.length) { - return; - } - - if (_global.window.pageYOffset !== undefined) { - wndY = _global.window.pageYOffset; - } else { - wndY = (document.documentElement || document.body.parentNode || document.body).scrollTop; - } - - var isResized = forceResizeParallax || !oldPageData || oldPageData.width !== wndW || oldPageData.height !== wndH; - var isScrolled = forceScrollParallax || isResized || !oldPageData || oldPageData.y !== wndY; - - forceResizeParallax = false; - forceScrollParallax = false; - - if (isResized || isScrolled) { - jarallaxList.forEach(function (item) { - if (isResized) { - item.onResize(); - } - if (isScrolled) { - item.onScroll(); - } - }); - - oldPageData = { - width: wndW, - height: wndH, - y: wndY - }; - } - - (0, _rafl2.default)(updateParallax); -} - -// ResizeObserver -var resizeObserver = global.ResizeObserver ? new global.ResizeObserver(function (entry) { - if (entry && entry.length) { - (0, _rafl2.default)(function () { - entry.forEach(function (item) { - if (item.target && item.target.jarallax) { - if (!forceResizeParallax) { - item.target.jarallax.onResize(); - } - forceScrollParallax = true; - } - }); - }); - } -}) : false; - -var instanceID = 0; - -// Jarallax class - -var Jarallax = function () { - function Jarallax(item, userOptions) { - _classCallCheck(this, Jarallax); - - var self = this; - - self.instanceID = instanceID++; - - self.$item = item; - - self.defaults = { - type: 'scroll', // type of parallax: scroll, scale, opacity, scale-opacity, scroll-opacity - speed: 0.5, // supported value from -1 to 2 - imgSrc: null, - imgElement: '.jarallax-img', - imgSize: 'cover', - imgPosition: '50% 50%', - imgRepeat: 'no-repeat', // supported only for background, not for tag - keepImg: false, // keep tag in it's default place - elementInViewport: null, - zIndex: -100, - disableParallax: false, - disableVideo: false, - automaticResize: true, // use ResizeObserver to recalculate position and size of parallax image - - // video - videoSrc: null, - videoStartTime: 0, - videoEndTime: 0, - videoVolume: 0, - videoLoop: true, - videoPlayOnlyVisible: true, - - // events - onScroll: null, // function(calculations) {} - onInit: null, // function() {} - onDestroy: null, // function() {} - onCoverImage: null // function() {} - }; - - // DEPRECATED: old data-options - var deprecatedDataAttribute = self.$item.getAttribute('data-jarallax'); - var oldDataOptions = JSON.parse(deprecatedDataAttribute || '{}'); - if (deprecatedDataAttribute) { - // eslint-disable-next-line no-console - console.warn('Detected usage of deprecated data-jarallax JSON options, you should use pure data-attribute options. See info here - https://github.com/nk-o/jarallax/issues/53'); - } - - // prepare data-options - var dataOptions = self.$item.dataset || {}; - var pureDataOptions = {}; - Object.keys(dataOptions).forEach(function (key) { - var loweCaseOption = key.substr(0, 1).toLowerCase() + key.substr(1); - if (loweCaseOption && typeof self.defaults[loweCaseOption] !== 'undefined') { - pureDataOptions[loweCaseOption] = dataOptions[key]; - } - }); - - self.options = self.extend({}, self.defaults, oldDataOptions, pureDataOptions, userOptions); - self.pureOptions = self.extend({}, self.options); - - // prepare 'true' and 'false' strings to boolean - Object.keys(self.options).forEach(function (key) { - if (self.options[key] === 'true') { - self.options[key] = true; - } else if (self.options[key] === 'false') { - self.options[key] = false; - } - }); - - // fix speed option [-1.0, 2.0] - self.options.speed = Math.min(2, Math.max(-1, parseFloat(self.options.speed))); - - // deprecated noAndroid and noIos options - if (self.options.noAndroid || self.options.noIos) { - // eslint-disable-next-line no-console - console.warn('Detected usage of deprecated noAndroid or noIos options, you should use disableParallax option. See info here - https://github.com/nk-o/jarallax/#disable-on-mobile-devices'); - - // prepare fallback if disableParallax option is not used - if (!self.options.disableParallax) { - if (self.options.noIos && self.options.noAndroid) { - self.options.disableParallax = /iPad|iPhone|iPod|Android/; - } else if (self.options.noIos) { - self.options.disableParallax = /iPad|iPhone|iPod/; - } else if (self.options.noAndroid) { - self.options.disableParallax = /Android/; - } - } - } - - // prepare disableParallax callback - if (typeof self.options.disableParallax === 'string') { - self.options.disableParallax = new RegExp(self.options.disableParallax); - } - if (self.options.disableParallax instanceof RegExp) { - var disableParallaxRegexp = self.options.disableParallax; - self.options.disableParallax = function () { - return disableParallaxRegexp.test(navigator.userAgent); - }; - } - if (typeof self.options.disableParallax !== 'function') { - self.options.disableParallax = function () { - return false; - }; - } - - // prepare disableVideo callback - if (typeof self.options.disableVideo === 'string') { - self.options.disableVideo = new RegExp(self.options.disableVideo); - } - if (self.options.disableVideo instanceof RegExp) { - var disableVideoRegexp = self.options.disableVideo; - self.options.disableVideo = function () { - return disableVideoRegexp.test(navigator.userAgent); - }; - } - if (typeof self.options.disableVideo !== 'function') { - self.options.disableVideo = function () { - return false; - }; - } - - // custom element to check if parallax in viewport - var elementInVP = self.options.elementInViewport; - // get first item from array - if (elementInVP && (typeof elementInVP === 'undefined' ? 'undefined' : _typeof(elementInVP)) === 'object' && typeof elementInVP.length !== 'undefined') { - var _elementInVP = elementInVP; - - var _elementInVP2 = _slicedToArray(_elementInVP, 1); - - elementInVP = _elementInVP2[0]; - } - // check if dom element - if (!(elementInVP instanceof Element)) { - elementInVP = null; - } - self.options.elementInViewport = elementInVP; - - self.image = { - src: self.options.imgSrc || null, - $container: null, - useImgTag: false, - - // position fixed is needed for the most of browsers because absolute position have glitches - // on MacOS with smooth scroll there is a huge lags with absolute position - https://github.com/nk-o/jarallax/issues/75 - // on mobile devices better scrolled with absolute position - position: /iPad|iPhone|iPod|Android/.test(navigator.userAgent) ? 'absolute' : 'fixed' - }; - - if (self.initImg() && self.canInitParallax()) { - self.init(); - } - } - - // add styles to element - - - _createClass(Jarallax, [{ - key: 'css', - value: function css(el, styles) { - if (typeof styles === 'string') { - return _global.window.getComputedStyle(el).getPropertyValue(styles); - } - - // add transform property with vendor prefix - if (styles.transform && supportTransform) { - styles[supportTransform] = styles.transform; - } - - Object.keys(styles).forEach(function (key) { - el.style[key] = styles[key]; - }); - return el; - } - - // Extend like jQuery.extend - - }, { - key: 'extend', - value: function extend(out) { - var _arguments = arguments; - - out = out || {}; - Object.keys(arguments).forEach(function (i) { - if (!_arguments[i]) { - return; - } - Object.keys(_arguments[i]).forEach(function (key) { - out[key] = _arguments[i][key]; - }); - }); - return out; - } - - // get window size and scroll position. Useful for extensions - - }, { - key: 'getWindowData', - value: function getWindowData() { - return { - width: wndW, - height: wndH, - y: wndY - }; - } - - // Jarallax functions - - }, { - key: 'initImg', - value: function initImg() { - var self = this; - - // find image element - var $imgElement = self.options.imgElement; - if ($imgElement && typeof $imgElement === 'string') { - $imgElement = self.$item.querySelector($imgElement); - } - // check if dom element - if (!($imgElement instanceof Element)) { - $imgElement = null; - } - - if ($imgElement) { - if (self.options.keepImg) { - self.image.$item = $imgElement.cloneNode(true); - } else { - self.image.$item = $imgElement; - self.image.$itemParent = $imgElement.parentNode; - } - self.image.useImgTag = true; - } - - // true if there is img tag - if (self.image.$item) { - return true; - } - - // get image src - if (self.image.src === null) { - self.image.src = self.css(self.$item, 'background-image').replace(/^url\(['"]?/g, '').replace(/['"]?\)$/g, ''); - } - return !(!self.image.src || self.image.src === 'none'); - } - }, { - key: 'canInitParallax', - value: function canInitParallax() { - return supportTransform && !this.options.disableParallax(); - } - }, { - key: 'init', - value: function init() { - var self = this; - var containerStyles = { - position: 'absolute', - top: 0, - left: 0, - width: '100%', - height: '100%', - overflow: 'hidden', - pointerEvents: 'none' - }; - var imageStyles = {}; - - if (!self.options.keepImg) { - // save default user styles - var curStyle = self.$item.getAttribute('style'); - if (curStyle) { - self.$item.setAttribute('data-jarallax-original-styles', curStyle); - } - if (self.image.useImgTag) { - var curImgStyle = self.image.$item.getAttribute('style'); - if (curImgStyle) { - self.image.$item.setAttribute('data-jarallax-original-styles', curImgStyle); - } - } - } - - // set relative position and z-index to the parent - if (self.css(self.$item, 'position') === 'static') { - self.css(self.$item, { - position: 'relative' - }); - } - if (self.css(self.$item, 'z-index') === 'auto') { - self.css(self.$item, { - zIndex: 0 - }); - } - - // container for parallax image - self.image.$container = document.createElement('div'); - self.css(self.image.$container, containerStyles); - self.css(self.image.$container, { - 'z-index': self.options.zIndex - }); - - // fix for IE https://github.com/nk-o/jarallax/issues/110 - if (isIE) { - self.css(self.image.$container, { - opacity: 0.9999 - }); - } - - self.image.$container.setAttribute('id', 'jarallax-container-' + self.instanceID); - self.$item.appendChild(self.image.$container); - - // use img tag - if (self.image.useImgTag) { - imageStyles = self.extend({ - 'object-fit': self.options.imgSize, - 'object-position': self.options.imgPosition, - // support for plugin https://github.com/bfred-it/object-fit-images - 'font-family': 'object-fit: ' + self.options.imgSize + '; object-position: ' + self.options.imgPosition + ';', - 'max-width': 'none' - }, containerStyles, imageStyles); - - // use div with background image - } else { - self.image.$item = document.createElement('div'); - if (self.image.src) { - imageStyles = self.extend({ - 'background-position': self.options.imgPosition, - 'background-size': self.options.imgSize, - 'background-repeat': self.options.imgRepeat, - 'background-image': 'url("' + self.image.src + '")' - }, containerStyles, imageStyles); - } - } - - if (self.options.type === 'opacity' || self.options.type === 'scale' || self.options.type === 'scale-opacity' || self.options.speed === 1) { - self.image.position = 'absolute'; - } - - // check if one of parents have transform style (without this check, scroll transform will be inverted if used parallax with position fixed) - // discussion - https://github.com/nk-o/jarallax/issues/9 - if (self.image.position === 'fixed') { - var parentWithTransform = 0; - var $itemParents = self.$item; - while ($itemParents !== null && $itemParents !== document && parentWithTransform === 0) { - var parentTransform = self.css($itemParents, '-webkit-transform') || self.css($itemParents, '-moz-transform') || self.css($itemParents, 'transform'); - if (parentTransform && parentTransform !== 'none') { - parentWithTransform = 1; - self.image.position = 'absolute'; - } - $itemParents = $itemParents.parentNode; - } - } - - // add position to parallax block - imageStyles.position = self.image.position; - - // insert parallax image - self.css(self.image.$item, imageStyles); - self.image.$container.appendChild(self.image.$item); - - // set initial position and size - self.onResize(); - self.onScroll(true); - - // ResizeObserver - if (self.options.automaticResize && resizeObserver) { - resizeObserver.observe(self.$item); - } - - // call onInit event - if (self.options.onInit) { - self.options.onInit.call(self); - } - - // remove default user background - if (self.css(self.$item, 'background-image') !== 'none') { - self.css(self.$item, { - 'background-image': 'none' - }); - } - - self.addToParallaxList(); - } - - // add to parallax instances list - - }, { - key: 'addToParallaxList', - value: function addToParallaxList() { - jarallaxList.push(this); - - if (jarallaxList.length === 1) { - updateParallax(); - } - } - - // remove from parallax instances list - - }, { - key: 'removeFromParallaxList', - value: function removeFromParallaxList() { - var self = this; - - jarallaxList.forEach(function (item, key) { - if (item.instanceID === self.instanceID) { - jarallaxList.splice(key, 1); - } - }); - } - }, { - key: 'destroy', - value: function destroy() { - var self = this; - - self.removeFromParallaxList(); - - // return styles on container as before jarallax init - var originalStylesTag = self.$item.getAttribute('data-jarallax-original-styles'); - self.$item.removeAttribute('data-jarallax-original-styles'); - // null occurs if there is no style tag before jarallax init - if (!originalStylesTag) { - self.$item.removeAttribute('style'); - } else { - self.$item.setAttribute('style', originalStylesTag); - } - - if (self.image.useImgTag) { - // return styles on img tag as before jarallax init - var originalStylesImgTag = self.image.$item.getAttribute('data-jarallax-original-styles'); - self.image.$item.removeAttribute('data-jarallax-original-styles'); - // null occurs if there is no style tag before jarallax init - if (!originalStylesImgTag) { - self.image.$item.removeAttribute('style'); - } else { - self.image.$item.setAttribute('style', originalStylesTag); - } - - // move img tag to its default position - if (self.image.$itemParent) { - self.image.$itemParent.appendChild(self.image.$item); - } - } - - // remove additional dom elements - if (self.$clipStyles) { - self.$clipStyles.parentNode.removeChild(self.$clipStyles); - } - if (self.image.$container) { - self.image.$container.parentNode.removeChild(self.image.$container); - } - - // call onDestroy event - if (self.options.onDestroy) { - self.options.onDestroy.call(self); - } - - // delete jarallax from item - delete self.$item.jarallax; - } - - // it will remove some image overlapping - // overlapping occur due to an image position fixed inside absolute position element - - }, { - key: 'clipContainer', - value: function clipContainer() { - // needed only when background in fixed position - if (this.image.position !== 'fixed') { - return; - } - - var self = this; - var rect = self.image.$container.getBoundingClientRect(); - var width = rect.width, - height = rect.height; - - - if (!self.$clipStyles) { - self.$clipStyles = document.createElement('style'); - self.$clipStyles.setAttribute('type', 'text/css'); - self.$clipStyles.setAttribute('id', 'jarallax-clip-' + self.instanceID); - var head = document.head || document.getElementsByTagName('head')[0]; - head.appendChild(self.$clipStyles); - } - - var styles = '#jarallax-container-' + self.instanceID + ' {\n clip: rect(0 ' + width + 'px ' + height + 'px 0);\n clip: rect(0, ' + width + 'px, ' + height + 'px, 0);\n }'; - - // add clip styles inline (this method need for support IE8 and less browsers) - if (self.$clipStyles.styleSheet) { - self.$clipStyles.styleSheet.cssText = styles; - } else { - self.$clipStyles.innerHTML = styles; - } - } - }, { - key: 'coverImage', - value: function coverImage() { - var self = this; - - var rect = self.image.$container.getBoundingClientRect(); - var contH = rect.height; - var speed = self.options.speed; - - var isScroll = self.options.type === 'scroll' || self.options.type === 'scroll-opacity'; - var scrollDist = 0; - var resultH = contH; - var resultMT = 0; - - // scroll parallax - if (isScroll) { - // scroll distance and height for image - if (speed < 0) { - scrollDist = speed * Math.max(contH, wndH); - - if (wndH < contH) { - scrollDist -= speed * (contH - wndH); - } - } else { - scrollDist = speed * (contH + wndH); - } - - // size for scroll parallax - if (speed > 1) { - resultH = Math.abs(scrollDist - wndH); - } else if (speed < 0) { - resultH = scrollDist / speed + Math.abs(scrollDist); - } else { - resultH += (wndH - contH) * (1 - speed); - } - - scrollDist /= 2; - } - - // store scroll distance - self.parallaxScrollDistance = scrollDist; - - // vertical center - if (isScroll) { - resultMT = (wndH - resultH) / 2; - } else { - resultMT = (contH - resultH) / 2; - } - - // apply result to item - self.css(self.image.$item, { - height: resultH + 'px', - marginTop: resultMT + 'px', - left: self.image.position === 'fixed' ? rect.left + 'px' : '0', - width: rect.width + 'px' - }); - - // call onCoverImage event - if (self.options.onCoverImage) { - self.options.onCoverImage.call(self); - } - - // return some useful data. Used in the video cover function - return { - image: { - height: resultH, - marginTop: resultMT - }, - container: rect - }; - } - }, { - key: 'isVisible', - value: function isVisible() { - return this.isElementInViewport || false; - } - }, { - key: 'onScroll', - value: function onScroll(force) { - var self = this; - - var rect = self.$item.getBoundingClientRect(); - var contT = rect.top; - var contH = rect.height; - var styles = {}; - - // check if in viewport - var viewportRect = rect; - if (self.options.elementInViewport) { - viewportRect = self.options.elementInViewport.getBoundingClientRect(); - } - self.isElementInViewport = viewportRect.bottom >= 0 && viewportRect.right >= 0 && viewportRect.top <= wndH && viewportRect.left <= wndW; - - // stop calculations if item is not in viewport - if (force ? false : !self.isElementInViewport) { - return; - } - - // calculate parallax helping variables - var beforeTop = Math.max(0, contT); - var beforeTopEnd = Math.max(0, contH + contT); - var afterTop = Math.max(0, -contT); - var beforeBottom = Math.max(0, contT + contH - wndH); - var beforeBottomEnd = Math.max(0, contH - (contT + contH - wndH)); - var afterBottom = Math.max(0, -contT + wndH - contH); - var fromViewportCenter = 1 - 2 * (wndH - contT) / (wndH + contH); - - // calculate on how percent of section is visible - var visiblePercent = 1; - if (contH < wndH) { - visiblePercent = 1 - (afterTop || beforeBottom) / contH; - } else if (beforeTopEnd <= wndH) { - visiblePercent = beforeTopEnd / wndH; - } else if (beforeBottomEnd <= wndH) { - visiblePercent = beforeBottomEnd / wndH; - } - - // opacity - if (self.options.type === 'opacity' || self.options.type === 'scale-opacity' || self.options.type === 'scroll-opacity') { - styles.transform = 'translate3d(0,0,0)'; - styles.opacity = visiblePercent; - } - - // scale - if (self.options.type === 'scale' || self.options.type === 'scale-opacity') { - var scale = 1; - if (self.options.speed < 0) { - scale -= self.options.speed * visiblePercent; - } else { - scale += self.options.speed * (1 - visiblePercent); - } - styles.transform = 'scale(' + scale + ') translate3d(0,0,0)'; - } - - // scroll - if (self.options.type === 'scroll' || self.options.type === 'scroll-opacity') { - var positionY = self.parallaxScrollDistance * fromViewportCenter; - - // fix if parallax block in absolute position - if (self.image.position === 'absolute') { - positionY -= contT; - } - - styles.transform = 'translate3d(0,' + positionY + 'px,0)'; - } - - self.css(self.image.$item, styles); - - // call onScroll event - if (self.options.onScroll) { - self.options.onScroll.call(self, { - section: rect, - - beforeTop: beforeTop, - beforeTopEnd: beforeTopEnd, - afterTop: afterTop, - beforeBottom: beforeBottom, - beforeBottomEnd: beforeBottomEnd, - afterBottom: afterBottom, - - visiblePercent: visiblePercent, - fromViewportCenter: fromViewportCenter - }); - } - } - }, { - key: 'onResize', - value: function onResize() { - this.coverImage(); - this.clipContainer(); - } - }]); - - return Jarallax; -}(); - -// global definition - - -var plugin = function plugin(items) { - // check for dom element - // thanks: http://stackoverflow.com/questions/384286/javascript-isdom-how-do-you-check-if-a-javascript-object-is-a-dom-object - if ((typeof HTMLElement === 'undefined' ? 'undefined' : _typeof(HTMLElement)) === 'object' ? items instanceof HTMLElement : items && (typeof items === 'undefined' ? 'undefined' : _typeof(items)) === 'object' && items !== null && items.nodeType === 1 && typeof items.nodeName === 'string') { - items = [items]; - } - - var options = arguments[1]; - var args = Array.prototype.slice.call(arguments, 2); - var len = items.length; - var k = 0; - var ret = void 0; - - for (k; k < len; k++) { - if ((typeof options === 'undefined' ? 'undefined' : _typeof(options)) === 'object' || typeof options === 'undefined') { - if (!items[k].jarallax) { - items[k].jarallax = new Jarallax(items[k], options); - } - } else if (items[k].jarallax) { - // eslint-disable-next-line prefer-spread - ret = items[k].jarallax[options].apply(items[k].jarallax, args); - } - if (typeof ret !== 'undefined') { - return ret; - } - } - - return items; -}; -plugin.constructor = Jarallax; - -exports.default = plugin; -/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(5))) - -/***/ }), -/* 14 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -var global = __webpack_require__(4); - -/** - * `requestAnimationFrame()` - */ - -var request = global.requestAnimationFrame || global.webkitRequestAnimationFrame || global.mozRequestAnimationFrame || fallback; - -var prev = +new Date(); -function fallback(fn) { - var curr = +new Date(); - var ms = Math.max(0, 16 - (curr - prev)); - var req = setTimeout(fn, ms); - return prev = curr, req; -} - -/** - * `cancelAnimationFrame()` - */ - -var cancel = global.cancelAnimationFrame || global.webkitCancelAnimationFrame || global.mozCancelAnimationFrame || clearTimeout; - -if (Function.prototype.bind) { - request = request.bind(global); - cancel = cancel.bind(global); -} - -exports = module.exports = request; -exports.cancel = cancel; - -/***/ }) -/******/ ]); -/*! - * Name : Video Background Extension for Jarallax - * Version : 1.0.1 - * Author : nK - * GitHub : https://github.com/nk-o/jarallax - */ -/******/ (function(modules) { // webpackBootstrap -/******/ // The module cache -/******/ var installedModules = {}; -/******/ -/******/ // The require function -/******/ function __webpack_require__(moduleId) { -/******/ -/******/ // Check if module is in cache -/******/ if(installedModules[moduleId]) { -/******/ return installedModules[moduleId].exports; -/******/ } -/******/ // Create a new module (and put it into the cache) -/******/ var module = installedModules[moduleId] = { -/******/ i: moduleId, -/******/ l: false, -/******/ exports: {} -/******/ }; -/******/ -/******/ // Execute the module function -/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); -/******/ -/******/ // Flag the module as loaded -/******/ module.l = true; -/******/ -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } -/******/ -/******/ -/******/ // expose the modules object (__webpack_modules__) -/******/ __webpack_require__.m = modules; -/******/ -/******/ // expose the module cache -/******/ __webpack_require__.c = installedModules; -/******/ -/******/ // define getter function for harmony exports -/******/ __webpack_require__.d = function(exports, name, getter) { -/******/ if(!__webpack_require__.o(exports, name)) { -/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); -/******/ } -/******/ }; -/******/ -/******/ // define __esModule on exports -/******/ __webpack_require__.r = function(exports) { -/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { -/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); -/******/ } -/******/ Object.defineProperty(exports, '__esModule', { value: true }); -/******/ }; -/******/ -/******/ // create a fake namespace object -/******/ // mode & 1: value is a module id, require it -/******/ // mode & 2: merge all properties of value into the ns -/******/ // mode & 4: return value when already ns object -/******/ // mode & 8|1: behave like require -/******/ __webpack_require__.t = function(value, mode) { -/******/ if(mode & 1) value = __webpack_require__(value); -/******/ if(mode & 8) return value; -/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; -/******/ var ns = Object.create(null); -/******/ __webpack_require__.r(ns); -/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); -/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); -/******/ return ns; -/******/ }; -/******/ -/******/ // getDefaultExport function for compatibility with non-harmony modules -/******/ __webpack_require__.n = function(module) { -/******/ var getter = module && module.__esModule ? -/******/ function getDefault() { return module['default']; } : -/******/ function getModuleExports() { return module; }; -/******/ __webpack_require__.d(getter, 'a', getter); -/******/ return getter; -/******/ }; -/******/ -/******/ // Object.prototype.hasOwnProperty.call -/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; -/******/ -/******/ // __webpack_public_path__ -/******/ __webpack_require__.p = ""; -/******/ -/******/ -/******/ // Load entry module and return exports -/******/ return __webpack_require__(__webpack_require__.s = 6); -/******/ }) -/************************************************************************/ -/******/ ([ -/* 0 */, -/* 1 */, -/* 2 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -module.exports = function (callback) { - - if (document.readyState === 'complete' || document.readyState === 'interactive') { - // Already ready or interactive, execute callback - callback.call(); - } else if (document.attachEvent) { - // Old browsers - document.attachEvent('onreadystatechange', function () { - if (document.readyState === 'interactive') callback.call(); - }); - } else if (document.addEventListener) { - // Modern browsers - document.addEventListener('DOMContentLoaded', callback); - } -}; - -/***/ }), -/* 3 */, -/* 4 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -/* WEBPACK VAR INJECTION */(function(global) { - -var win; - -if (typeof window !== "undefined") { - win = window; -} else if (typeof global !== "undefined") { - win = global; -} else if (typeof self !== "undefined") { - win = self; -} else { - win = {}; -} - -module.exports = win; -/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(5))) - -/***/ }), -/* 5 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; - -var g; - -// This works in non-strict mode -g = function () { - return this; -}(); - -try { - // This works if eval is allowed (see CSP) - g = g || Function("return this")() || (1, eval)("this"); -} catch (e) { - // This works if the window reference is available - if ((typeof window === "undefined" ? "undefined" : _typeof(window)) === "object") g = window; -} - -// g can still be undefined, but nothing to do about it... -// We return undefined, instead of nothing here, so it's -// easier to handle this case. if(!global) { ...} - -module.exports = g; - -/***/ }), -/* 6 */ -/***/ (function(module, exports, __webpack_require__) { - -module.exports = __webpack_require__(7); - - -/***/ }), -/* 7 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -var _videoWorker = __webpack_require__(8); - -var _videoWorker2 = _interopRequireDefault(_videoWorker); - -var _global = __webpack_require__(4); - -var _global2 = _interopRequireDefault(_global); - -var _liteReady = __webpack_require__(2); - -var _liteReady2 = _interopRequireDefault(_liteReady); - -var _jarallaxVideo = __webpack_require__(10); - -var _jarallaxVideo2 = _interopRequireDefault(_jarallaxVideo); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -// add video worker globally to fallback jarallax < 1.10 versions -_global2.default.VideoWorker = _global2.default.VideoWorker || _videoWorker2.default; - -(0, _jarallaxVideo2.default)(); - -// data-jarallax-video initialization -(0, _liteReady2.default)(function () { - if (typeof jarallax !== 'undefined') { - jarallax(document.querySelectorAll('[data-jarallax-video]')); - } -}); - -/***/ }), -/* 8 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -module.exports = __webpack_require__(9); - -/***/ }), -/* 9 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; - -var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -// Deferred -// thanks http://stackoverflow.com/questions/18096715/implement-deferred-object-without-using-jquery -function Deferred() { - this._done = []; - this._fail = []; -} -Deferred.prototype = { - execute: function execute(list, args) { - var i = list.length; - args = Array.prototype.slice.call(args); - while (i--) { - list[i].apply(null, args); - } - }, - resolve: function resolve() { - this.execute(this._done, arguments); - }, - reject: function reject() { - this.execute(this._fail, arguments); - }, - done: function done(callback) { - this._done.push(callback); - }, - fail: function fail(callback) { - this._fail.push(callback); - } -}; - -var ID = 0; -var YoutubeAPIadded = 0; -var VimeoAPIadded = 0; -var loadingYoutubePlayer = 0; -var loadingVimeoPlayer = 0; -var loadingYoutubeDefer = new Deferred(); -var loadingVimeoDefer = new Deferred(); - -var VideoWorker = function () { - function VideoWorker(url, options) { - _classCallCheck(this, VideoWorker); - - var self = this; - - self.url = url; - - self.options_default = { - autoplay: false, - loop: false, - mute: false, - volume: 100, - showContols: true, - - // start / end video time in seconds - startTime: 0, - endTime: 0 - }; - - self.options = self.extend({}, self.options_default, options); - - // check URL - self.videoID = self.parseURL(url); - - // init - if (self.videoID) { - self.ID = ID++; - self.loadAPI(); - self.init(); - } - } - - // Extend like jQuery.extend - - - _createClass(VideoWorker, [{ - key: 'extend', - value: function extend(out) { - var _arguments = arguments; - - out = out || {}; - Object.keys(arguments).forEach(function (i) { - if (!_arguments[i]) { - return; - } - Object.keys(_arguments[i]).forEach(function (key) { - out[key] = _arguments[i][key]; - }); - }); - return out; - } - }, { - key: 'parseURL', - value: function parseURL(url) { - // parse youtube ID - function getYoutubeID(ytUrl) { - // eslint-disable-next-line no-useless-escape - var regExp = /.*(?:youtu.be\/|v\/|u\/\w\/|embed\/|watch\?v=)([^#\&\?]*).*/; - var match = ytUrl.match(regExp); - return match && match[1].length === 11 ? match[1] : false; - } - - // parse vimeo ID - function getVimeoID(vmUrl) { - // eslint-disable-next-line no-useless-escape - var regExp = /https?:\/\/(?:www\.|player\.)?vimeo.com\/(?:channels\/(?:\w+\/)?|groups\/([^\/]*)\/videos\/|album\/(\d+)\/video\/|video\/|)(\d+)(?:$|\/|\?)/; - var match = vmUrl.match(regExp); - return match && match[3] ? match[3] : false; - } - - // parse local string - function getLocalVideos(locUrl) { - // eslint-disable-next-line no-useless-escape - var videoFormats = locUrl.split(/,(?=mp4\:|webm\:|ogv\:|ogg\:)/); - var result = {}; - var ready = 0; - videoFormats.forEach(function (val) { - // eslint-disable-next-line no-useless-escape - var match = val.match(/^(mp4|webm|ogv|ogg)\:(.*)/); - if (match && match[1] && match[2]) { - // eslint-disable-next-line prefer-destructuring - result[match[1] === 'ogv' ? 'ogg' : match[1]] = match[2]; - ready = 1; - } - }); - return ready ? result : false; - } - - var Youtube = getYoutubeID(url); - var Vimeo = getVimeoID(url); - var Local = getLocalVideos(url); - - if (Youtube) { - this.type = 'youtube'; - return Youtube; - } else if (Vimeo) { - this.type = 'vimeo'; - return Vimeo; - } else if (Local) { - this.type = 'local'; - return Local; - } - - return false; - } - }, { - key: 'isValid', - value: function isValid() { - return !!this.videoID; - } - - // events - - }, { - key: 'on', - value: function on(name, callback) { - this.userEventsList = this.userEventsList || []; - - // add new callback in events list - (this.userEventsList[name] || (this.userEventsList[name] = [])).push(callback); - } - }, { - key: 'off', - value: function off(name, callback) { - var _this = this; - - if (!this.userEventsList || !this.userEventsList[name]) { - return; - } - - if (!callback) { - delete this.userEventsList[name]; - } else { - this.userEventsList[name].forEach(function (val, key) { - if (val === callback) { - _this.userEventsList[name][key] = false; - } - }); - } - } - }, { - key: 'fire', - value: function fire(name) { - var _this2 = this; - - var args = [].slice.call(arguments, 1); - if (this.userEventsList && typeof this.userEventsList[name] !== 'undefined') { - this.userEventsList[name].forEach(function (val) { - // call with all arguments - if (val) { - val.apply(_this2, args); - } - }); - } - } - }, { - key: 'play', - value: function play(start) { - var self = this; - if (!self.player) { - return; - } - - if (self.type === 'youtube' && self.player.playVideo) { - if (typeof start !== 'undefined') { - self.player.seekTo(start || 0); - } - if (YT.PlayerState.PLAYING !== self.player.getPlayerState()) { - self.player.playVideo(); - } - } - - if (self.type === 'vimeo') { - if (typeof start !== 'undefined') { - self.player.setCurrentTime(start); - } - self.player.getPaused().then(function (paused) { - if (paused) { - self.player.play(); - } - }); - } - - if (self.type === 'local') { - if (typeof start !== 'undefined') { - self.player.currentTime = start; - } - if (self.player.paused) { - self.player.play(); - } - } - } - }, { - key: 'pause', - value: function pause() { - var self = this; - if (!self.player) { - return; - } - - if (self.type === 'youtube' && self.player.pauseVideo) { - if (YT.PlayerState.PLAYING === self.player.getPlayerState()) { - self.player.pauseVideo(); - } - } - - if (self.type === 'vimeo') { - self.player.getPaused().then(function (paused) { - if (!paused) { - self.player.pause(); - } - }); - } - - if (self.type === 'local') { - if (!self.player.paused) { - self.player.pause(); - } - } - } - }, { - key: 'mute', - value: function mute() { - var self = this; - if (!self.player) { - return; - } - - if (self.type === 'youtube' && self.player.mute) { - self.player.mute(); - } - - if (self.type === 'vimeo' && self.player.setVolume) { - self.player.setVolume(0); - } - - if (self.type === 'local') { - self.$video.muted = true; - } - } - }, { - key: 'unmute', - value: function unmute() { - var self = this; - if (!self.player) { - return; - } - - if (self.type === 'youtube' && self.player.mute) { - self.player.unMute(); - } - - if (self.type === 'vimeo' && self.player.setVolume) { - self.player.setVolume(self.options.volume); - } - - if (self.type === 'local') { - self.$video.muted = false; - } - } - }, { - key: 'setVolume', - value: function setVolume() { - var volume = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; - - var self = this; - if (!self.player || !volume) { - return; - } - - if (self.type === 'youtube' && self.player.setVolume) { - self.player.setVolume(volume); - } - - if (self.type === 'vimeo' && self.player.setVolume) { - self.player.setVolume(volume); - } - - if (self.type === 'local') { - self.$video.volume = volume / 100; - } - } - }, { - key: 'getVolume', - value: function getVolume(callback) { - var self = this; - if (!self.player) { - callback(false); - return; - } - - if (self.type === 'youtube' && self.player.getVolume) { - callback(self.player.getVolume()); - } - - if (self.type === 'vimeo' && self.player.getVolume) { - self.player.getVolume().then(function (volume) { - callback(volume); - }); - } - - if (self.type === 'local') { - callback(self.$video.volume * 100); - } - } - }, { - key: 'getMuted', - value: function getMuted(callback) { - var self = this; - if (!self.player) { - callback(null); - return; - } - - if (self.type === 'youtube' && self.player.isMuted) { - callback(self.player.isMuted()); - } - - if (self.type === 'vimeo' && self.player.getVolume) { - self.player.getVolume().then(function (volume) { - callback(!!volume); - }); - } - - if (self.type === 'local') { - callback(self.$video.muted); - } - } - }, { - key: 'getImageURL', - value: function getImageURL(callback) { - var self = this; - - if (self.videoImage) { - callback(self.videoImage); - return; - } - - if (self.type === 'youtube') { - var availableSizes = ['maxresdefault', 'sddefault', 'hqdefault', '0']; - var step = 0; - - var tempImg = new Image(); - tempImg.onload = function () { - // if no thumbnail, youtube add their own image with width = 120px - if ((this.naturalWidth || this.width) !== 120 || step === availableSizes.length - 1) { - // ok - self.videoImage = 'https://img.youtube.com/vi/' + self.videoID + '/' + availableSizes[step] + '.jpg'; - callback(self.videoImage); - } else { - // try another size - step++; - this.src = 'https://img.youtube.com/vi/' + self.videoID + '/' + availableSizes[step] + '.jpg'; - } - }; - tempImg.src = 'https://img.youtube.com/vi/' + self.videoID + '/' + availableSizes[step] + '.jpg'; - } - - if (self.type === 'vimeo') { - var request = new XMLHttpRequest(); - request.open('GET', 'https://vimeo.com/api/v2/video/' + self.videoID + '.json', true); - request.onreadystatechange = function () { - if (this.readyState === 4) { - if (this.status >= 200 && this.status < 400) { - // Success! - var response = JSON.parse(this.responseText); - self.videoImage = response[0].thumbnail_large; - callback(self.videoImage); - } else { - // Error :( - } - } - }; - request.send(); - request = null; - } - } - - // fallback to the old version. - - }, { - key: 'getIframe', - value: function getIframe(callback) { - this.getVideo(callback); - } - }, { - key: 'getVideo', - value: function getVideo(callback) { - var self = this; - - // return generated video block - if (self.$video) { - callback(self.$video); - return; - } - - // generate new video block - self.onAPIready(function () { - var hiddenDiv = void 0; - if (!self.$video) { - hiddenDiv = document.createElement('div'); - hiddenDiv.style.display = 'none'; - } - - // Youtube - if (self.type === 'youtube') { - self.playerOptions = {}; - self.playerOptions.videoId = self.videoID; - self.playerOptions.playerVars = { - autohide: 1, - rel: 0, - autoplay: 0, - // autoplay enable on mobile devices - playsinline: 1 - }; - - // hide controls - if (!self.options.showContols) { - self.playerOptions.playerVars.iv_load_policy = 3; - self.playerOptions.playerVars.modestbranding = 1; - self.playerOptions.playerVars.controls = 0; - self.playerOptions.playerVars.showinfo = 0; - self.playerOptions.playerVars.disablekb = 1; - } - - // events - var ytStarted = void 0; - var ytProgressInterval = void 0; - self.playerOptions.events = { - onReady: function onReady(e) { - // mute - if (self.options.mute) { - e.target.mute(); - } else if (self.options.volume) { - e.target.setVolume(self.options.volume); - } - - // autoplay - if (self.options.autoplay) { - self.play(self.options.startTime); - } - self.fire('ready', e); - - // For seamless loops, set the endTime to 0.1 seconds less than the video's duration - // https://github.com/nk-o/video-worker/issues/2 - if (self.options.loop && !self.options.endTime) { - var secondsOffset = 0.1; - self.options.endTime = self.player.getDuration() - secondsOffset; - } - - // volumechange - setInterval(function () { - self.getVolume(function (volume) { - if (self.options.volume !== volume) { - self.options.volume = volume; - self.fire('volumechange', e); - } - }); - }, 150); - }, - onStateChange: function onStateChange(e) { - // loop - if (self.options.loop && e.data === YT.PlayerState.ENDED) { - self.play(self.options.startTime); - } - if (!ytStarted && e.data === YT.PlayerState.PLAYING) { - ytStarted = 1; - self.fire('started', e); - } - if (e.data === YT.PlayerState.PLAYING) { - self.fire('play', e); - } - if (e.data === YT.PlayerState.PAUSED) { - self.fire('pause', e); - } - if (e.data === YT.PlayerState.ENDED) { - self.fire('ended', e); - } - - // progress check - if (e.data === YT.PlayerState.PLAYING) { - ytProgressInterval = setInterval(function () { - self.fire('timeupdate', e); - - // check for end of video and play again or stop - if (self.options.endTime && self.player.getCurrentTime() >= self.options.endTime) { - if (self.options.loop) { - self.play(self.options.startTime); - } else { - self.pause(); - } - } - }, 150); - } else { - clearInterval(ytProgressInterval); - } - } - }; - - var firstInit = !self.$video; - if (firstInit) { - var div = document.createElement('div'); - div.setAttribute('id', self.playerID); - hiddenDiv.appendChild(div); - document.body.appendChild(hiddenDiv); - } - self.player = self.player || new window.YT.Player(self.playerID, self.playerOptions); - if (firstInit) { - self.$video = document.getElementById(self.playerID); - - // get video width and height - self.videoWidth = parseInt(self.$video.getAttribute('width'), 10) || 1280; - self.videoHeight = parseInt(self.$video.getAttribute('height'), 10) || 720; - } - } - - // Vimeo - if (self.type === 'vimeo') { - self.playerOptions = { - id: self.videoID, - autopause: 0, - transparent: 0, - autoplay: self.options.autoplay ? 1 : 0, - loop: self.options.loop ? 1 : 0, - muted: self.options.mute ? 1 : 0 - }; - - if (self.options.volume) { - self.playerOptions.volume = self.options.volume; - } - - // hide controls - if (!self.options.showContols) { - self.playerOptions.badge = 0; - self.playerOptions.byline = 0; - self.playerOptions.portrait = 0; - self.playerOptions.title = 0; - } - - if (!self.$video) { - var playerOptionsString = ''; - Object.keys(self.playerOptions).forEach(function (key) { - if (playerOptionsString !== '') { - playerOptionsString += '&'; - } - playerOptionsString += key + '=' + encodeURIComponent(self.playerOptions[key]); - }); - - // we need to create iframe manually because when we create it using API - // js events won't triggers after iframe moved to another place - self.$video = document.createElement('iframe'); - self.$video.setAttribute('id', self.playerID); - self.$video.setAttribute('src', 'https://player.vimeo.com/video/' + self.videoID + '?' + playerOptionsString); - self.$video.setAttribute('frameborder', '0'); - self.$video.setAttribute('mozallowfullscreen', ''); - self.$video.setAttribute('allowfullscreen', ''); - - hiddenDiv.appendChild(self.$video); - document.body.appendChild(hiddenDiv); - } - self.player = self.player || new Vimeo.Player(self.$video, self.playerOptions); - - // set current time for autoplay - if (self.options.startTime && self.options.autoplay) { - self.player.setCurrentTime(self.options.startTime); - } - - // get video width and height - self.player.getVideoWidth().then(function (width) { - self.videoWidth = width || 1280; - }); - self.player.getVideoHeight().then(function (height) { - self.videoHeight = height || 720; - }); - - // events - var vmStarted = void 0; - self.player.on('timeupdate', function (e) { - if (!vmStarted) { - self.fire('started', e); - vmStarted = 1; - } - - self.fire('timeupdate', e); - - // check for end of video and play again or stop - if (self.options.endTime) { - if (self.options.endTime && e.seconds >= self.options.endTime) { - if (self.options.loop) { - self.play(self.options.startTime); - } else { - self.pause(); - } - } - } - }); - self.player.on('play', function (e) { - self.fire('play', e); - - // check for the start time and start with it - if (self.options.startTime && e.seconds === 0) { - self.play(self.options.startTime); - } - }); - self.player.on('pause', function (e) { - self.fire('pause', e); - }); - self.player.on('ended', function (e) { - self.fire('ended', e); - }); - self.player.on('loaded', function (e) { - self.fire('ready', e); - }); - self.player.on('volumechange', function (e) { - self.fire('volumechange', e); - }); - } - - // Local - function addSourceToLocal(element, src, type) { - var source = document.createElement('source'); - source.src = src; - source.type = type; - element.appendChild(source); - } - if (self.type === 'local') { - if (!self.$video) { - self.$video = document.createElement('video'); - - // show controls - if (self.options.showContols) { - self.$video.controls = true; - } - - // mute - if (self.options.mute) { - self.$video.muted = true; - } else if (self.$video.volume) { - self.$video.volume = self.options.volume / 100; - } - - // loop - if (self.options.loop) { - self.$video.loop = true; - } - - // autoplay enable on mobile devices - self.$video.setAttribute('playsinline', ''); - self.$video.setAttribute('webkit-playsinline', ''); - - self.$video.setAttribute('id', self.playerID); - hiddenDiv.appendChild(self.$video); - document.body.appendChild(hiddenDiv); - - Object.keys(self.videoID).forEach(function (key) { - addSourceToLocal(self.$video, self.videoID[key], 'video/' + key); - }); - } - - self.player = self.player || self.$video; - - var locStarted = void 0; - self.player.addEventListener('playing', function (e) { - if (!locStarted) { - self.fire('started', e); - } - locStarted = 1; - }); - self.player.addEventListener('timeupdate', function (e) { - self.fire('timeupdate', e); - - // check for end of video and play again or stop - if (self.options.endTime) { - if (self.options.endTime && this.currentTime >= self.options.endTime) { - if (self.options.loop) { - self.play(self.options.startTime); - } else { - self.pause(); - } - } - } - }); - self.player.addEventListener('play', function (e) { - self.fire('play', e); - }); - self.player.addEventListener('pause', function (e) { - self.fire('pause', e); - }); - self.player.addEventListener('ended', function (e) { - self.fire('ended', e); - }); - self.player.addEventListener('loadedmetadata', function () { - // get video width and height - self.videoWidth = this.videoWidth || 1280; - self.videoHeight = this.videoHeight || 720; - - self.fire('ready'); - - // autoplay - if (self.options.autoplay) { - self.play(self.options.startTime); - } - }); - self.player.addEventListener('volumechange', function (e) { - self.getVolume(function (volume) { - self.options.volume = volume; - }); - self.fire('volumechange', e); - }); - } - callback(self.$video); - }); - } - }, { - key: 'init', - value: function init() { - var self = this; - - self.playerID = 'VideoWorker-' + self.ID; - } - }, { - key: 'loadAPI', - value: function loadAPI() { - var self = this; - - if (YoutubeAPIadded && VimeoAPIadded) { - return; - } - - var src = ''; - - // load Youtube API - if (self.type === 'youtube' && !YoutubeAPIadded) { - YoutubeAPIadded = 1; - src = 'https://www.youtube.com/iframe_api'; - } - - // load Vimeo API - if (self.type === 'vimeo' && !VimeoAPIadded) { - VimeoAPIadded = 1; - src = 'https://player.vimeo.com/api/player.js'; - } - - if (!src) { - return; - } - - // add script in head section - var tag = document.createElement('script'); - var head = document.getElementsByTagName('head')[0]; - tag.src = src; - - head.appendChild(tag); - - head = null; - tag = null; - } - }, { - key: 'onAPIready', - value: function onAPIready(callback) { - var self = this; - - // Youtube - if (self.type === 'youtube') { - // Listen for global YT player callback - if ((typeof YT === 'undefined' || YT.loaded === 0) && !loadingYoutubePlayer) { - // Prevents Ready event from being called twice - loadingYoutubePlayer = 1; - - // Creates deferred so, other players know when to wait. - window.onYouTubeIframeAPIReady = function () { - window.onYouTubeIframeAPIReady = null; - loadingYoutubeDefer.resolve('done'); - callback(); - }; - } else if ((typeof YT === 'undefined' ? 'undefined' : _typeof(YT)) === 'object' && YT.loaded === 1) { - callback(); - } else { - loadingYoutubeDefer.done(function () { - callback(); - }); - } - } - - // Vimeo - if (self.type === 'vimeo') { - if (typeof Vimeo === 'undefined' && !loadingVimeoPlayer) { - loadingVimeoPlayer = 1; - var vimeoInterval = setInterval(function () { - if (typeof Vimeo !== 'undefined') { - clearInterval(vimeoInterval); - loadingVimeoDefer.resolve('done'); - callback(); - } - }, 20); - } else if (typeof Vimeo !== 'undefined') { - callback(); - } else { - loadingVimeoDefer.done(function () { - callback(); - }); - } - } - - // Local - if (self.type === 'local') { - callback(); - } - } - }]); - - return VideoWorker; -}(); - -exports.default = VideoWorker; - -/***/ }), -/* 10 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = jarallaxVideo; - -var _videoWorker = __webpack_require__(8); - -var _videoWorker2 = _interopRequireDefault(_videoWorker); - -var _global = __webpack_require__(4); - -var _global2 = _interopRequireDefault(_global); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function jarallaxVideo() { - var jarallax = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _global2.default.jarallax; - - if (typeof jarallax === 'undefined') { - return; - } - - var Jarallax = jarallax.constructor; - - // append video after init Jarallax - var defInit = Jarallax.prototype.init; - Jarallax.prototype.init = function () { - var self = this; - - defInit.apply(self); - - if (self.video && !self.options.disableVideo()) { - self.video.getVideo(function (video) { - var $parent = video.parentNode; - self.css(video, { - position: self.image.position, - top: '0px', - left: '0px', - right: '0px', - bottom: '0px', - width: '100%', - height: '100%', - maxWidth: 'none', - maxHeight: 'none', - margin: 0, - zIndex: -1 - }); - self.$video = video; - self.image.$container.appendChild(video); - - // remove parent video element (created by VideoWorker) - $parent.parentNode.removeChild($parent); - }); - } - }; - - // cover video - var defCoverImage = Jarallax.prototype.coverImage; - Jarallax.prototype.coverImage = function () { - var self = this; - var imageData = defCoverImage.apply(self); - var node = self.image.$item ? self.image.$item.nodeName : false; - - if (imageData && self.video && node && (node === 'IFRAME' || node === 'VIDEO')) { - var h = imageData.image.height; - var w = h * self.image.width / self.image.height; - var ml = (imageData.container.width - w) / 2; - var mt = imageData.image.marginTop; - - if (imageData.container.width > w) { - w = imageData.container.width; - h = w * self.image.height / self.image.width; - ml = 0; - mt += (imageData.image.height - h) / 2; - } - - // add video height over than need to hide controls - if (node === 'IFRAME') { - h += 400; - mt -= 200; - } - - self.css(self.$video, { - width: w + 'px', - marginLeft: ml + 'px', - height: h + 'px', - marginTop: mt + 'px' - }); - } - - return imageData; - }; - - // init video - var defInitImg = Jarallax.prototype.initImg; - Jarallax.prototype.initImg = function () { - var self = this; - var defaultResult = defInitImg.apply(self); - - if (!self.options.videoSrc) { - self.options.videoSrc = self.$item.getAttribute('data-jarallax-video') || null; - } - - if (self.options.videoSrc) { - self.defaultInitImgResult = defaultResult; - return true; - } - - return defaultResult; - }; - - var defCanInitParallax = Jarallax.prototype.canInitParallax; - Jarallax.prototype.canInitParallax = function () { - var self = this; - var defaultResult = defCanInitParallax.apply(self); - - if (!self.options.videoSrc) { - return defaultResult; - } - - var video = new _videoWorker2.default(self.options.videoSrc, { - autoplay: true, - loop: self.options.videoLoop, - showContols: false, - startTime: self.options.videoStartTime || 0, - endTime: self.options.videoEndTime || 0, - mute: self.options.videoVolume ? 0 : 1, - volume: self.options.videoVolume || 0 - }); - - if (video.isValid()) { - // if parallax will not be inited, we can add thumbnail on background. - if (!defaultResult) { - if (!self.defaultInitImgResult) { - video.getImageURL(function (url) { - // save default user styles - var curStyle = self.$item.getAttribute('style'); - if (curStyle) { - self.$item.setAttribute('data-jarallax-original-styles', curStyle); - } - - // set new background - self.css(self.$item, { - 'background-image': 'url("' + url + '")', - 'background-position': 'center', - 'background-size': 'cover' - }); - }); - } - - // init video - } else { - video.on('ready', function () { - if (self.options.videoPlayOnlyVisible) { - var oldOnScroll = self.onScroll; - self.onScroll = function () { - oldOnScroll.apply(self); - if (self.options.videoLoop || !self.options.videoLoop && !self.videoEnded) { - if (self.isVisible()) { - video.play(); - } else { - video.pause(); - } - } - }; - } else { - video.play(); - } - }); - - video.on('started', function () { - self.image.$default_item = self.image.$item; - self.image.$item = self.$video; - - // set video width and height - self.image.width = self.video.videoWidth || 1280; - self.image.height = self.video.videoHeight || 720; - self.coverImage(); - self.clipContainer(); - self.onScroll(); - - // hide image - if (self.image.$default_item) { - self.image.$default_item.style.display = 'none'; - } - }); - - video.on('ended', function () { - self.videoEnded = true; - - if (!self.options.videoLoop) { - // show image if Loop disabled - if (self.image.$default_item) { - self.image.$item = self.image.$default_item; - self.image.$item.style.display = 'block'; - - // set image width and height - self.coverImage(); - self.clipContainer(); - self.onScroll(); - } - } - }); - - self.video = video; - - // set image if not exists - if (!self.defaultInitImgResult) { - if (video.type !== 'local') { - video.getImageURL(function (url) { - self.image.src = url; - self.init(); - }); - - return false; - } - - // set empty image on local video if not defined - self.image.src = 'data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7'; - return true; - } - } - } - - return defaultResult; - }; - - // Destroy video parallax - var defDestroy = Jarallax.prototype.destroy; - Jarallax.prototype.destroy = function () { - var self = this; - - if (self.image.$default_item) { - self.image.$item = self.image.$default_item; - delete self.image.$default_item; - } - - defDestroy.apply(self); - }; -} - -/***/ }) -/******/ ]); -//============================================================================== - - -// jQuery touch swipe -// https://github.com/mattbryson/TouchSwipe-Jquery-Plugin -//============================================================================== -/*! - * @fileOverview TouchSwipe - jQuery Plugin - * @version 1.6.18 - * - * @author Matt Bryson http://www.github.com/mattbryson - * @see https://github.com/mattbryson/TouchSwipe-Jquery-Plugin - * @see http://labs.rampinteractive.co.uk/touchSwipe/ - * @see http://plugins.jquery.com/project/touchSwipe - * @license - * Copyright (c) 2010-2015 Matt Bryson - * Dual licensed under the MIT or GPL Version 2 licenses. - * - */ -!function(factory){"function"==typeof define&&define.amd&&define.amd.jQuery?define(["jquery"],factory):factory("undefined"!=typeof module&&module.exports?require("jquery"):jQuery)}(function($){"use strict";function init(options){return!options||void 0!==options.allowPageScroll||void 0===options.swipe&&void 0===options.swipeStatus||(options.allowPageScroll=NONE),void 0!==options.click&&void 0===options.tap&&(options.tap=options.click),options||(options={}),options=$.extend({},$.fn.swipe.defaults,options),this.each(function(){var $this=$(this),plugin=$this.data(PLUGIN_NS);plugin||(plugin=new TouchSwipe(this,options),$this.data(PLUGIN_NS,plugin))})}function TouchSwipe(element,options){function touchStart(jqEvent){if(!(getTouchInProgress()||$(jqEvent.target).closest(options.excludedElements,$element).length>0)){var event=jqEvent.originalEvent?jqEvent.originalEvent:jqEvent;if(!event.pointerType||"mouse"!=event.pointerType||0!=options.fallbackToMouseEvents){var ret,touches=event.touches,evt=touches?touches[0]:event;return phase=PHASE_START,touches?fingerCount=touches.length:options.preventDefaultEvents!==!1&&jqEvent.preventDefault(),distance=0,direction=null,currentDirection=null,pinchDirection=null,duration=0,startTouchesDistance=0,endTouchesDistance=0,pinchZoom=1,pinchDistance=0,maximumsMap=createMaximumsData(),cancelMultiFingerRelease(),createFingerData(0,evt),!touches||fingerCount===options.fingers||options.fingers===ALL_FINGERS||hasPinches()?(startTime=getTimeStamp(),2==fingerCount&&(createFingerData(1,touches[1]),startTouchesDistance=endTouchesDistance=calculateTouchesDistance(fingerData[0].start,fingerData[1].start)),(options.swipeStatus||options.pinchStatus)&&(ret=triggerHandler(event,phase))):ret=!1,ret===!1?(phase=PHASE_CANCEL,triggerHandler(event,phase),ret):(options.hold&&(holdTimeout=setTimeout($.proxy(function(){$element.trigger("hold",[event.target]),options.hold&&(ret=options.hold.call($element,event,event.target))},this),options.longTapThreshold)),setTouchInProgress(!0),null)}}}function touchMove(jqEvent){var event=jqEvent.originalEvent?jqEvent.originalEvent:jqEvent;if(phase!==PHASE_END&&phase!==PHASE_CANCEL&&!inMultiFingerRelease()){var ret,touches=event.touches,evt=touches?touches[0]:event,currentFinger=updateFingerData(evt);if(endTime=getTimeStamp(),touches&&(fingerCount=touches.length),options.hold&&clearTimeout(holdTimeout),phase=PHASE_MOVE,2==fingerCount&&(0==startTouchesDistance?(createFingerData(1,touches[1]),startTouchesDistance=endTouchesDistance=calculateTouchesDistance(fingerData[0].start,fingerData[1].start)):(updateFingerData(touches[1]),endTouchesDistance=calculateTouchesDistance(fingerData[0].end,fingerData[1].end),pinchDirection=calculatePinchDirection(fingerData[0].end,fingerData[1].end)),pinchZoom=calculatePinchZoom(startTouchesDistance,endTouchesDistance),pinchDistance=Math.abs(startTouchesDistance-endTouchesDistance)),fingerCount===options.fingers||options.fingers===ALL_FINGERS||!touches||hasPinches()){if(direction=calculateDirection(currentFinger.start,currentFinger.end),currentDirection=calculateDirection(currentFinger.last,currentFinger.end),validateDefaultEvent(jqEvent,currentDirection),distance=calculateDistance(currentFinger.start,currentFinger.end),duration=calculateDuration(),setMaxDistance(direction,distance),ret=triggerHandler(event,phase),!options.triggerOnTouchEnd||options.triggerOnTouchLeave){var inBounds=!0;if(options.triggerOnTouchLeave){var bounds=getbounds(this);inBounds=isInBounds(currentFinger.end,bounds)}!options.triggerOnTouchEnd&&inBounds?phase=getNextPhase(PHASE_MOVE):options.triggerOnTouchLeave&&!inBounds&&(phase=getNextPhase(PHASE_END)),phase!=PHASE_CANCEL&&phase!=PHASE_END||triggerHandler(event,phase)}}else phase=PHASE_CANCEL,triggerHandler(event,phase);ret===!1&&(phase=PHASE_CANCEL,triggerHandler(event,phase))}}function touchEnd(jqEvent){var event=jqEvent.originalEvent?jqEvent.originalEvent:jqEvent,touches=event.touches;if(touches){if(touches.length&&!inMultiFingerRelease())return startMultiFingerRelease(event),!0;if(touches.length&&inMultiFingerRelease())return!0}return inMultiFingerRelease()&&(fingerCount=fingerCountAtRelease),endTime=getTimeStamp(),duration=calculateDuration(),didSwipeBackToCancel()||!validateSwipeDistance()?(phase=PHASE_CANCEL,triggerHandler(event,phase)):options.triggerOnTouchEnd||options.triggerOnTouchEnd===!1&&phase===PHASE_MOVE?(options.preventDefaultEvents!==!1&&jqEvent.cancelable!==!1&&jqEvent.preventDefault(),phase=PHASE_END,triggerHandler(event,phase)):!options.triggerOnTouchEnd&&hasTap()?(phase=PHASE_END,triggerHandlerForGesture(event,phase,TAP)):phase===PHASE_MOVE&&(phase=PHASE_CANCEL,triggerHandler(event,phase)),setTouchInProgress(!1),null}function touchCancel(){fingerCount=0,endTime=0,startTime=0,startTouchesDistance=0,endTouchesDistance=0,pinchZoom=1,cancelMultiFingerRelease(),setTouchInProgress(!1)}function touchLeave(jqEvent){var event=jqEvent.originalEvent?jqEvent.originalEvent:jqEvent;options.triggerOnTouchLeave&&(phase=getNextPhase(PHASE_END),triggerHandler(event,phase))}function removeListeners(){$element.unbind(START_EV,touchStart),$element.unbind(CANCEL_EV,touchCancel),$element.unbind(MOVE_EV,touchMove),$element.unbind(END_EV,touchEnd),LEAVE_EV&&$element.unbind(LEAVE_EV,touchLeave),setTouchInProgress(!1)}function getNextPhase(currentPhase){var nextPhase=currentPhase,validTime=validateSwipeTime(),validDistance=validateSwipeDistance(),didCancel=didSwipeBackToCancel();return!validTime||didCancel?nextPhase=PHASE_CANCEL:!validDistance||currentPhase!=PHASE_MOVE||options.triggerOnTouchEnd&&!options.triggerOnTouchLeave?!validDistance&¤tPhase==PHASE_END&&options.triggerOnTouchLeave&&(nextPhase=PHASE_CANCEL):nextPhase=PHASE_END,nextPhase}function triggerHandler(event,phase){var ret,touches=event.touches;return(didSwipe()||hasSwipes())&&(ret=triggerHandlerForGesture(event,phase,SWIPE)),(didPinch()||hasPinches())&&ret!==!1&&(ret=triggerHandlerForGesture(event,phase,PINCH)),didDoubleTap()&&ret!==!1?ret=triggerHandlerForGesture(event,phase,DOUBLE_TAP):didLongTap()&&ret!==!1?ret=triggerHandlerForGesture(event,phase,LONG_TAP):didTap()&&ret!==!1&&(ret=triggerHandlerForGesture(event,phase,TAP)),phase===PHASE_CANCEL&&touchCancel(event),phase===PHASE_END&&(touches?touches.length||touchCancel(event):touchCancel(event)),ret}function triggerHandlerForGesture(event,phase,gesture){var ret;if(gesture==SWIPE){if($element.trigger("swipeStatus",[phase,direction||null,distance||0,duration||0,fingerCount,fingerData,currentDirection]),options.swipeStatus&&(ret=options.swipeStatus.call($element,event,phase,direction||null,distance||0,duration||0,fingerCount,fingerData,currentDirection),ret===!1))return!1;if(phase==PHASE_END&&validateSwipe()){if(clearTimeout(singleTapTimeout),clearTimeout(holdTimeout),$element.trigger("swipe",[direction,distance,duration,fingerCount,fingerData,currentDirection]),options.swipe&&(ret=options.swipe.call($element,event,direction,distance,duration,fingerCount,fingerData,currentDirection),ret===!1))return!1;switch(direction){case LEFT:$element.trigger("swipeLeft",[direction,distance,duration,fingerCount,fingerData,currentDirection]),options.swipeLeft&&(ret=options.swipeLeft.call($element,event,direction,distance,duration,fingerCount,fingerData,currentDirection));break;case RIGHT:$element.trigger("swipeRight",[direction,distance,duration,fingerCount,fingerData,currentDirection]),options.swipeRight&&(ret=options.swipeRight.call($element,event,direction,distance,duration,fingerCount,fingerData,currentDirection));break;case UP:$element.trigger("swipeUp",[direction,distance,duration,fingerCount,fingerData,currentDirection]),options.swipeUp&&(ret=options.swipeUp.call($element,event,direction,distance,duration,fingerCount,fingerData,currentDirection));break;case DOWN:$element.trigger("swipeDown",[direction,distance,duration,fingerCount,fingerData,currentDirection]),options.swipeDown&&(ret=options.swipeDown.call($element,event,direction,distance,duration,fingerCount,fingerData,currentDirection))}}}if(gesture==PINCH){if($element.trigger("pinchStatus",[phase,pinchDirection||null,pinchDistance||0,duration||0,fingerCount,pinchZoom,fingerData]),options.pinchStatus&&(ret=options.pinchStatus.call($element,event,phase,pinchDirection||null,pinchDistance||0,duration||0,fingerCount,pinchZoom,fingerData),ret===!1))return!1;if(phase==PHASE_END&&validatePinch())switch(pinchDirection){case IN:$element.trigger("pinchIn",[pinchDirection||null,pinchDistance||0,duration||0,fingerCount,pinchZoom,fingerData]),options.pinchIn&&(ret=options.pinchIn.call($element,event,pinchDirection||null,pinchDistance||0,duration||0,fingerCount,pinchZoom,fingerData));break;case OUT:$element.trigger("pinchOut",[pinchDirection||null,pinchDistance||0,duration||0,fingerCount,pinchZoom,fingerData]),options.pinchOut&&(ret=options.pinchOut.call($element,event,pinchDirection||null,pinchDistance||0,duration||0,fingerCount,pinchZoom,fingerData))}}return gesture==TAP?phase!==PHASE_CANCEL&&phase!==PHASE_END||(clearTimeout(singleTapTimeout),clearTimeout(holdTimeout),hasDoubleTap()&&!inDoubleTap()?(doubleTapStartTime=getTimeStamp(),singleTapTimeout=setTimeout($.proxy(function(){doubleTapStartTime=null,$element.trigger("tap",[event.target]),options.tap&&(ret=options.tap.call($element,event,event.target))},this),options.doubleTapThreshold)):(doubleTapStartTime=null,$element.trigger("tap",[event.target]),options.tap&&(ret=options.tap.call($element,event,event.target)))):gesture==DOUBLE_TAP?phase!==PHASE_CANCEL&&phase!==PHASE_END||(clearTimeout(singleTapTimeout),clearTimeout(holdTimeout),doubleTapStartTime=null,$element.trigger("doubletap",[event.target]),options.doubleTap&&(ret=options.doubleTap.call($element,event,event.target))):gesture==LONG_TAP&&(phase!==PHASE_CANCEL&&phase!==PHASE_END||(clearTimeout(singleTapTimeout),doubleTapStartTime=null,$element.trigger("longtap",[event.target]),options.longTap&&(ret=options.longTap.call($element,event,event.target)))),ret}function validateSwipeDistance(){var valid=!0;return null!==options.threshold&&(valid=distance>=options.threshold),valid}function didSwipeBackToCancel(){var cancelled=!1;return null!==options.cancelThreshold&&null!==direction&&(cancelled=getMaxDistance(direction)-distance>=options.cancelThreshold),cancelled}function validatePinchDistance(){return null===options.pinchThreshold||pinchDistance>=options.pinchThreshold}function validateSwipeTime(){var result;return result=!options.maxTimeThreshold||!(duration>=options.maxTimeThreshold)}function validateDefaultEvent(jqEvent,direction){if(options.preventDefaultEvents!==!1)if(options.allowPageScroll===NONE)jqEvent.preventDefault();else{var auto=options.allowPageScroll===AUTO;switch(direction){case LEFT:(options.swipeLeft&&auto||!auto&&options.allowPageScroll!=HORIZONTAL)&&jqEvent.preventDefault();break;case RIGHT:(options.swipeRight&&auto||!auto&&options.allowPageScroll!=HORIZONTAL)&&jqEvent.preventDefault();break;case UP:(options.swipeUp&&auto||!auto&&options.allowPageScroll!=VERTICAL)&&jqEvent.preventDefault();break;case DOWN:(options.swipeDown&&auto||!auto&&options.allowPageScroll!=VERTICAL)&&jqEvent.preventDefault();break;case NONE:}}}function validatePinch(){var hasCorrectFingerCount=validateFingers(),hasEndPoint=validateEndPoint(),hasCorrectDistance=validatePinchDistance();return hasCorrectFingerCount&&hasEndPoint&&hasCorrectDistance}function hasPinches(){return!!(options.pinchStatus||options.pinchIn||options.pinchOut)}function didPinch(){return!(!validatePinch()||!hasPinches())}function validateSwipe(){var hasValidTime=validateSwipeTime(),hasValidDistance=validateSwipeDistance(),hasCorrectFingerCount=validateFingers(),hasEndPoint=validateEndPoint(),didCancel=didSwipeBackToCancel(),valid=!didCancel&&hasEndPoint&&hasCorrectFingerCount&&hasValidDistance&&hasValidTime;return valid}function hasSwipes(){return!!(options.swipe||options.swipeStatus||options.swipeLeft||options.swipeRight||options.swipeUp||options.swipeDown)}function didSwipe(){return!(!validateSwipe()||!hasSwipes())}function validateFingers(){return fingerCount===options.fingers||options.fingers===ALL_FINGERS||!SUPPORTS_TOUCH}function validateEndPoint(){return 0!==fingerData[0].end.x}function hasTap(){return!!options.tap}function hasDoubleTap(){return!!options.doubleTap}function hasLongTap(){return!!options.longTap}function validateDoubleTap(){if(null==doubleTapStartTime)return!1;var now=getTimeStamp();return hasDoubleTap()&&now-doubleTapStartTime<=options.doubleTapThreshold}function inDoubleTap(){return validateDoubleTap()}function validateTap(){return(1===fingerCount||!SUPPORTS_TOUCH)&&(isNaN(distance)||distanceoptions.longTapThreshold&&distance=0?LEFT:angle<=360&&angle>=315?LEFT:angle>=135&&angle<=225?RIGHT:angle>45&&angle<135?DOWN:UP}function getTimeStamp(){var now=new Date;return now.getTime()}function getbounds(el){el=$(el);var offset=el.offset(),bounds={left:offset.left,right:offset.left+el.outerWidth(),top:offset.top,bottom:offset.top+el.outerHeight()};return bounds}function isInBounds(point,bounds){return point.x>bounds.left&&point.xbounds.top&&point.y: IE9, IE10, IE11, Edge, Safari -// https://github.com/bfred-it/object-fit-images -//============================================================================== -/*! npm.im/object-fit-images 3.2.3 */ -var objectFitImages = (function () { -'use strict'; - -var OFI = 'bfred-it:object-fit-images'; -var propRegex = /(object-fit|object-position)\s*:\s*([-\w\s%]+)/g; -var testImg = typeof Image === 'undefined' ? {style: {'object-position': 1}} : new Image(); -var supportsObjectFit = 'object-fit' in testImg.style; -var supportsObjectPosition = 'object-position' in testImg.style; -var supportsOFI = 'background-size' in testImg.style; -var supportsCurrentSrc = typeof testImg.currentSrc === 'string'; -var nativeGetAttribute = testImg.getAttribute; -var nativeSetAttribute = testImg.setAttribute; -var autoModeEnabled = false; - -function createPlaceholder(w, h) { - return ("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='" + w + "' height='" + h + "'%3E%3C/svg%3E"); -} - -function polyfillCurrentSrc(el) { - if (el.srcset && !supportsCurrentSrc && window.picturefill) { - var pf = window.picturefill._; - // parse srcset with picturefill where currentSrc isn't available - if (!el[pf.ns] || !el[pf.ns].evaled) { - // force synchronous srcset parsing - pf.fillImg(el, {reselect: true}); - } - - if (!el[pf.ns].curSrc) { - // force picturefill to parse srcset - el[pf.ns].supported = false; - pf.fillImg(el, {reselect: true}); - } - - // retrieve parsed currentSrc, if any - el.currentSrc = el[pf.ns].curSrc || el.src; - } -} - -function getStyle(el) { - var style = getComputedStyle(el).fontFamily; - var parsed; - var props = {}; - while ((parsed = propRegex.exec(style)) !== null) { - props[parsed[1]] = parsed[2]; - } - return props; -} - -function setPlaceholder(img, width, height) { - // Default: fill width, no height - var placeholder = createPlaceholder(width || 1, height || 0); - - // Only set placeholder if it's different - if (nativeGetAttribute.call(img, 'src') !== placeholder) { - nativeSetAttribute.call(img, 'src', placeholder); - } -} - -function onImageReady(img, callback) { - // naturalWidth is only available when the image headers are loaded, - // this loop will poll it every 100ms. - if (img.naturalWidth) { - callback(img); - } else { - setTimeout(onImageReady, 100, img, callback); - } -} - -function fixOne(el) { - var style = getStyle(el); - var ofi = el[OFI]; - style['object-fit'] = style['object-fit'] || 'fill'; // default value - - // Avoid running where unnecessary, unless OFI had already done its deed - if (!ofi.img) { - // fill is the default behavior so no action is necessary - if (style['object-fit'] === 'fill') { - return; - } - - // Where object-fit is supported and object-position isn't (Safari < 10) - if ( - !ofi.skipTest && // unless user wants to apply regardless of browser support - supportsObjectFit && // if browser already supports object-fit - !style['object-position'] // unless object-position is used - ) { - return; - } - } - - // keep a clone in memory while resetting the original to a blank - if (!ofi.img) { - ofi.img = new Image(el.width, el.height); - ofi.img.srcset = nativeGetAttribute.call(el, "data-ofi-srcset") || el.srcset; - ofi.img.src = nativeGetAttribute.call(el, "data-ofi-src") || el.src; - - // preserve for any future cloneNode calls - // https://github.com/bfred-it/object-fit-images/issues/53 - nativeSetAttribute.call(el, "data-ofi-src", el.src); - if (el.srcset) { - nativeSetAttribute.call(el, "data-ofi-srcset", el.srcset); - } - - setPlaceholder(el, el.naturalWidth || el.width, el.naturalHeight || el.height); - - // remove srcset because it overrides src - if (el.srcset) { - el.srcset = ''; - } - try { - keepSrcUsable(el); - } catch (err) { - if (window.console) { - console.warn('https://bit.ly/ofi-old-browser'); - } - } - } - - polyfillCurrentSrc(ofi.img); - - el.style.backgroundImage = "url(\"" + ((ofi.img.currentSrc || ofi.img.src).replace(/"/g, '\\"')) + "\")"; - el.style.backgroundPosition = style['object-position'] || 'center'; - el.style.backgroundRepeat = 'no-repeat'; - el.style.backgroundOrigin = 'content-box'; - - if (/scale-down/.test(style['object-fit'])) { - onImageReady(ofi.img, function () { - if (ofi.img.naturalWidth > el.width || ofi.img.naturalHeight > el.height) { - el.style.backgroundSize = 'contain'; - } else { - el.style.backgroundSize = 'auto'; - } - }); - } else { - el.style.backgroundSize = style['object-fit'].replace('none', 'auto').replace('fill', '100% 100%'); - } - - onImageReady(ofi.img, function (img) { - setPlaceholder(el, img.naturalWidth, img.naturalHeight); - }); -} - -function keepSrcUsable(el) { - var descriptors = { - get: function get(prop) { - return el[OFI].img[prop ? prop : 'src']; - }, - set: function set(value, prop) { - el[OFI].img[prop ? prop : 'src'] = value; - nativeSetAttribute.call(el, ("data-ofi-" + prop), value); // preserve for any future cloneNode - fixOne(el); - return value; - } - }; - Object.defineProperty(el, 'src', descriptors); - Object.defineProperty(el, 'currentSrc', { - get: function () { return descriptors.get('currentSrc'); } - }); - Object.defineProperty(el, 'srcset', { - get: function () { return descriptors.get('srcset'); }, - set: function (ss) { return descriptors.set(ss, 'srcset'); } - }); -} - -function hijackAttributes() { - function getOfiImageMaybe(el, name) { - return el[OFI] && el[OFI].img && (name === 'src' || name === 'srcset') ? el[OFI].img : el; - } - if (!supportsObjectPosition) { - HTMLImageElement.prototype.getAttribute = function (name) { - return nativeGetAttribute.call(getOfiImageMaybe(this, name), name); - }; - - HTMLImageElement.prototype.setAttribute = function (name, value) { - return nativeSetAttribute.call(getOfiImageMaybe(this, name), name, String(value)); - }; - } -} - -function fix(imgs, opts) { - var startAutoMode = !autoModeEnabled && !imgs; - opts = opts || {}; - imgs = imgs || 'img'; - - if ((supportsObjectPosition && !opts.skipTest) || !supportsOFI) { - return false; - } - - // use imgs as a selector or just select all images - if (imgs === 'img') { - imgs = document.getElementsByTagName('img'); - } else if (typeof imgs === 'string') { - imgs = document.querySelectorAll(imgs); - } else if (!('length' in imgs)) { - imgs = [imgs]; - } - - // apply fix to all - for (var i = 0; i < imgs.length; i++) { - imgs[i][OFI] = imgs[i][OFI] || { - skipTest: opts.skipTest - }; - fixOne(imgs[i]); - } - - if (startAutoMode) { - document.body.addEventListener('load', function (e) { - if (e.target.tagName === 'IMG') { - fix(e.target, { - skipTest: opts.skipTest - }); - } - }, true); - autoModeEnabled = true; - imgs = 'img'; // reset to a generic selector for watchMQ - } - - // if requested, watch media queries for object-fit change - if (opts.watchMQ) { - window.addEventListener('resize', fix.bind(null, imgs, { - skipTest: opts.skipTest - })); - } -} - -fix.supportsObjectFit = supportsObjectFit; -fix.supportsObjectPosition = supportsObjectPosition; - -hijackAttributes(); - -return fix; - -}()); - -//============================================================================== +!function(){"use strict";var j,e,t,a,i,n,r,s,o,B=function(e,l){if(!(this instanceof B))return new B(e,l);var t={direction:"horizontal",touchEventsTarget:"container",initialSlide:0,speed:300,autoplay:!1,autoplayDisableOnInteraction:!0,autoplayStopOnLast:!1,iOSEdgeSwipeDetection:!1,iOSEdgeSwipeThreshold:20,freeMode:!1,freeModeMomentum:!0,freeModeMomentumRatio:1,freeModeMomentumBounce:!0,freeModeMomentumBounceRatio:1,freeModeMomentumVelocityRatio:1,freeModeSticky:!1,freeModeMinimumVelocity:.02,autoHeight:!1,setWrapperSize:!1,virtualTranslate:!1,effect:"slide",coverflow:{rotate:50,stretch:0,depth:100,modifier:1,slideShadows:!0},flip:{slideShadows:!0,limitRotation:!0},cube:{slideShadows:!0,shadow:!0,shadowOffset:20,shadowScale:.94},fade:{crossFade:!1},parallax:!1,zoom:!1,zoomMax:3,zoomMin:1,zoomToggle:!0,scrollbar:null,scrollbarHide:!0,scrollbarDraggable:!1,scrollbarSnapOnRelease:!1,keyboardControl:!1,mousewheelControl:!1,mousewheelReleaseOnEdges:!1,mousewheelInvert:!1,mousewheelForceToAxis:!1,mousewheelSensitivity:1,mousewheelEventsTarged:"container",hashnav:!1,hashnavWatchState:!1,history:!1,replaceState:!1,breakpoints:void 0,spaceBetween:0,slidesPerView:1,slidesPerColumn:1,slidesPerColumnFill:"column",slidesPerGroup:1,centeredSlides:!1,slidesOffsetBefore:0,slidesOffsetAfter:0,roundLengths:!1,touchRatio:1,touchAngle:45,simulateTouch:!0,shortSwipes:!0,longSwipes:!0,longSwipesRatio:.5,longSwipesMs:300,followFinger:!0,onlyExternal:!1,threshold:0,touchMoveStopPropagation:!0,touchReleaseOnEdges:!1,uniqueNavElements:!0,pagination:null,paginationElement:"span",paginationClickable:!1,paginationHide:!1,paginationBulletRender:null,paginationProgressRender:null,paginationFractionRender:null,paginationCustomRender:null,paginationType:"bullets",resistance:!0,resistanceRatio:.85,nextButton:null,prevButton:null,watchSlidesProgress:!1,watchSlidesVisibility:!1,grabCursor:!1,preventClicks:!0,preventClicksPropagation:!0,slideToClickedSlide:!1,lazyLoading:!1,lazyLoadingInPrevNext:!1,lazyLoadingInPrevNextAmount:1,lazyLoadingOnTransitionStart:!1,preloadImages:!0,updateOnImagesReady:!0,loop:!1,loopAdditionalSlides:0,loopedSlides:null,control:void 0,controlInverse:!1,controlBy:"slide",normalizeSlideIndex:!0,allowSwipeToPrev:!0,allowSwipeToNext:!0,swipeHandler:null,noSwiping:!0,noSwipingClass:"swiper-no-swiping",passiveListeners:!0,containerModifierClass:"swiper-container-",slideClass:"swiper-slide",slideActiveClass:"swiper-slide-active",slideDuplicateActiveClass:"swiper-slide-duplicate-active",slideVisibleClass:"swiper-slide-visible",slideDuplicateClass:"swiper-slide-duplicate",slideNextClass:"swiper-slide-next",slideDuplicateNextClass:"swiper-slide-duplicate-next",slidePrevClass:"swiper-slide-prev",slideDuplicatePrevClass:"swiper-slide-duplicate-prev",wrapperClass:"swiper-wrapper",bulletClass:"swiper-pagination-bullet",bulletActiveClass:"swiper-pagination-bullet-active",buttonDisabledClass:"swiper-button-disabled",paginationCurrentClass:"swiper-pagination-current",paginationTotalClass:"swiper-pagination-total",paginationHiddenClass:"swiper-pagination-hidden",paginationProgressbarClass:"swiper-pagination-progressbar",paginationClickableClass:"swiper-pagination-clickable",paginationModifierClass:"swiper-pagination-",lazyLoadingClass:"swiper-lazy",lazyStatusLoadingClass:"swiper-lazy-loading",lazyStatusLoadedClass:"swiper-lazy-loaded",lazyPreloaderClass:"swiper-lazy-preloader",notificationClass:"swiper-notification",preloaderClass:"preloader",zoomContainerClass:"swiper-zoom-container",observer:!1,observeParents:!1,a11y:!1,prevSlideMessage:"Previous slide",nextSlideMessage:"Next slide",firstSlideMessage:"This is the first slide",lastSlideMessage:"This is the last slide",paginationBulletMessage:"Go to slide {{index}}",runCallbacksOnInit:!0},a=l&&l.virtualTranslate;l=l||{};var i={};for(var n in l)if("object"!=typeof l[n]||null===l[n]||(l[n].nodeType||l[n]===window||l[n]===document||"undefined"!=typeof Dom7&&l[n]instanceof Dom7||"undefined"!=typeof jQuery&&l[n]instanceof jQuery))i[n]=l[n];else for(var r in i[n]={},l[n])i[n][r]=l[n][r];for(var s in t)if(void 0===l[s])l[s]=t[s];else if("object"==typeof l[s])for(var o in t[s])void 0===l[s][o]&&(l[s][o]=t[s][o]);var b=this;if(b.params=l,b.originalParams=i,b.classNames=[],void 0!==j&&"undefined"!=typeof Dom7&&(j=Dom7),(void 0!==j||(j="undefined"==typeof Dom7?window.Dom7||window.Zepto||window.jQuery:Dom7))&&(b.$=j,b.currentBreakpoint=void 0,b.getActiveBreakpoint=function(){if(!b.params.breakpoints)return!1;var e,t=!1,a=[];for(e in b.params.breakpoints)b.params.breakpoints.hasOwnProperty(e)&&a.push(e);a.sort(function(e,t){return parseInt(e,10)>parseInt(t,10)});for(var i=0;i=window.innerWidth&&!t&&(t=e);return t||"max"},b.setBreakpoint=function(){var e=b.getActiveBreakpoint();if(e&&b.currentBreakpoint!==e){var t=e in b.params.breakpoints?b.params.breakpoints[e]:b.originalParams,a=b.params.loop&&t.slidesPerView!==b.params.slidesPerView;for(var i in t)b.params[i]=t[i];b.currentBreakpoint=e,a&&b.destroyLoop&&b.reLoop(!0)}},b.params.breakpoints&&b.setBreakpoint(),b.container=j(e),0!==b.container.length)){if(1b.slides.length)break;t.push(b.slides.eq(i)[0])}else t.push(b.slides.eq(b.activeIndex)[0]);for(e=0;e=l&&(m=0,c++),u=c+m*r/l,h.css({"-webkit-box-ordinal-group":u,"-moz-box-ordinal-group":u,"-ms-flex-order":u,"-webkit-order":u,order:u})):c=e-(m=Math.floor(e/p))*p,h.css("margin-"+(b.isHorizontal()?"top":"left"),0!==m&&b.params.spaceBetween&&b.params.spaceBetween+"px").attr("data-swiper-column",c).attr("data-swiper-row",m);"none"!==h.css("display")&&("auto"===b.params.slidesPerView?(s=b.isHorizontal()?h.outerWidth(!0):h.outerHeight(!0),b.params.roundLengths&&(s=v(s))):(s=(b.size-(b.params.slidesPerView-1)*t)/b.params.slidesPerView,b.params.roundLengths&&(s=v(s)),b.isHorizontal()?b.slides[e].style.width=s+"px":b.slides[e].style.height=s+"px"),b.slides[e].swiperSlideSize=s,b.slidesSizesGrid.push(s),b.params.centeredSlides?(a=a+s/2+i/2+t,0===i&&0!==e&&(a=a-b.size/2-t),0===e&&(a=a-b.size/2-t),Math.abs(a)<.001&&(a=0),n%b.params.slidesPerGroup==0&&b.snapGrid.push(a),b.slidesGrid.push(a)):(n%b.params.slidesPerGroup==0&&b.snapGrid.push(a),b.slidesGrid.push(a),a=a+s+t),b.virtualSize+=s+t,i=s,n++)}if(b.virtualSize=Math.max(b.virtualSize,b.size)+b.params.slidesOffsetAfter,b.rtl&&b.wrongRTL&&("slide"===b.params.effect||"coverflow"===b.params.effect)&&b.wrapper.css({width:b.virtualSize+b.params.spaceBetween+"px"}),b.support.flexbox&&!b.params.setWrapperSize||(b.isHorizontal()?b.wrapper.css({width:b.virtualSize+b.params.spaceBetween+"px"}):b.wrapper.css({height:b.virtualSize+b.params.spaceBetween+"px"})),1b.size&&(i=!0));for(t=b.activeIndex-1;0<=t;t--)b.slides[t]&&!i&&(a++,(n+=b.slides[t].swiperSlideSize)>b.size&&(i=!0))}else for(e=b.activeIndex+1;e=b.size)&&b.slides.eq(a).addClass(b.params.slideVisibleClass)}i.progress=b.rtl?-n:n}}},b.updateProgress=function(e){void 0===e&&(e=b.translate||0);var t=b.maxTranslate()-b.minTranslate(),a=b.isBeginning,i=b.isEnd;0===t?(b.progress=0,b.isBeginning=b.isEnd=!0):(b.progress=(e-b.minTranslate())/t,b.isBeginning=b.progress<=0,b.isEnd=1<=b.progress),b.isBeginning&&!a&&b.emit("onReachBeginning",b),b.isEnd&&!i&&b.emit("onReachEnd",b),b.params.watchSlidesProgress&&b.updateSlidesProgress(e),b.emit("onProgress",b,b.progress)},b.updateActiveIndex=function(){var e,t,a,i=b.rtl?b.translate:-b.translate;for(t=0;t=b.slidesGrid[t]&&i=b.slidesGrid[t]&&i=b.slidesGrid[t]&&(e=t);b.params.normalizeSlideIndex&&(e<0||void 0===e)&&(e=0),(a=Math.floor(e/b.params.slidesPerGroup))>=b.snapGrid.length&&(a=b.snapGrid.length-1),e!==b.activeIndex&&(b.snapIndex=a,b.previousIndex=b.activeIndex,b.activeIndex=e,b.updateClasses(),b.updateRealIndex())},b.updateRealIndex=function(){b.realIndex=parseInt(b.slides.eq(b.activeIndex).attr("data-swiper-slide-index")||b.activeIndex,10)},b.updateClasses=function(){b.slides.removeClass(b.params.slideActiveClass+" "+b.params.slideNextClass+" "+b.params.slidePrevClass+" "+b.params.slideDuplicateActiveClass+" "+b.params.slideDuplicateNextClass+" "+b.params.slideDuplicatePrevClass);var e=b.slides.eq(b.activeIndex);e.addClass(b.params.slideActiveClass),l.loop&&(e.hasClass(b.params.slideDuplicateClass)?b.wrapper.children("."+b.params.slideClass+":not(."+b.params.slideDuplicateClass+')[data-swiper-slide-index="'+b.realIndex+'"]').addClass(b.params.slideDuplicateActiveClass):b.wrapper.children("."+b.params.slideClass+"."+b.params.slideDuplicateClass+'[data-swiper-slide-index="'+b.realIndex+'"]').addClass(b.params.slideDuplicateActiveClass));var t=e.next("."+b.params.slideClass).addClass(b.params.slideNextClass);b.params.loop&&0===t.length&&(t=b.slides.eq(0)).addClass(b.params.slideNextClass);var a=e.prev("."+b.params.slideClass).addClass(b.params.slidePrevClass);if(b.params.loop&&0===a.length&&(a=b.slides.eq(-1)).addClass(b.params.slidePrevClass),l.loop&&(t.hasClass(b.params.slideDuplicateClass)?b.wrapper.children("."+b.params.slideClass+":not(."+b.params.slideDuplicateClass+')[data-swiper-slide-index="'+t.attr("data-swiper-slide-index")+'"]').addClass(b.params.slideDuplicateNextClass):b.wrapper.children("."+b.params.slideClass+"."+b.params.slideDuplicateClass+'[data-swiper-slide-index="'+t.attr("data-swiper-slide-index")+'"]').addClass(b.params.slideDuplicateNextClass),a.hasClass(b.params.slideDuplicateClass)?b.wrapper.children("."+b.params.slideClass+":not(."+b.params.slideDuplicateClass+')[data-swiper-slide-index="'+a.attr("data-swiper-slide-index")+'"]').addClass(b.params.slideDuplicatePrevClass):b.wrapper.children("."+b.params.slideClass+"."+b.params.slideDuplicateClass+'[data-swiper-slide-index="'+a.attr("data-swiper-slide-index")+'"]').addClass(b.params.slideDuplicatePrevClass)),b.paginationContainer&&0b.slides.length-1-2*b.loopedSlides&&(i-=b.slides.length-2*b.loopedSlides),n-1";b.paginationContainer.html(e),b.bullets=b.paginationContainer.find("."+b.params.bulletClass),b.params.paginationClickable&&b.params.a11y&&b.a11y&&b.a11y.initPagination()}"fraction"===b.params.paginationType&&(e=b.params.paginationFractionRender?b.params.paginationFractionRender(b,b.params.paginationCurrentClass,b.params.paginationTotalClass):' / ',b.paginationContainer.html(e)),"progress"===b.params.paginationType&&(e=b.params.paginationProgressRender?b.params.paginationProgressRender(b,b.params.paginationProgressbarClass):'',b.paginationContainer.html(e)),"custom"!==b.params.paginationType&&b.emit("onPaginationRendered",b,b.paginationContainer[0])}},b.update=function(e){var t;b&&(b.updateContainerSize(),b.updateSlidesSize(),b.updateProgress(),b.updatePagination(),b.updateClasses(),b.params.scrollbar&&b.scrollbar&&b.scrollbar.set(),e?(b.controller&&b.controller.spline&&(b.controller.spline=void 0),b.params.freeMode?(a(),b.params.autoHeight&&b.updateAutoHeight()):(("auto"===b.params.slidesPerView||1b.slides.length-b.loopedSlides+s/2?(b.fixLoop(),r=b.wrapper.children("."+b.params.slideClass+'[data-swiper-slide-index="'+n+'"]:not(.'+b.params.slideDuplicateClass+")").eq(0).index(),setTimeout(function(){b.slideTo(r)},0)):b.slideTo(r):r>b.slides.length-s?(b.fixLoop(),r=b.wrapper.children("."+b.params.slideClass+'[data-swiper-slide-index="'+n+'"]:not(.'+b.params.slideDuplicateClass+")").eq(0).index(),setTimeout(function(){b.slideTo(r)},0)):b.slideTo(r)}else b.slideTo(r)}};var x,T,S,C,d,E,I,u,z,M,c,m,h="input, select, textarea, button, video",P=Date.now(),k=[];for(var g in b.animating=!1,b.touches={startX:0,startY:0,currentX:0,currentY:0,diff:0},b.onTouchStart=function(e){if(e.originalEvent&&(e=e.originalEvent),(c="touchstart"===e.type)||!("which"in e)||3!==e.which)if(b.params.noSwiping&&w(e,"."+b.params.noSwipingClass))b.allowClick=!0;else if(!b.params.swipeHandler||w(e,b.params.swipeHandler)){var t=b.touches.currentX="touchstart"===e.type?e.targetTouches[0].pageX:e.pageX,a=b.touches.currentY="touchstart"===e.type?e.targetTouches[0].pageY:e.pageY;if(!(b.device.ios&&b.params.iOSEdgeSwipeDetection&&t<=b.params.iOSEdgeSwipeThreshold)){if(S=!(T=!(x=!0)),m=d=void 0,b.touches.startX=t,b.touches.startY=a,C=Date.now(),b.allowClick=!0,b.updateContainerSize(),b.swipeDirection=void 0,0b.touches.startX&&b.translate>=b.minTranslate())return}else if(b.touches.currentYb.touches.startY&&b.translate>=b.minTranslate())return;if(c&&document.activeElement&&e.target===document.activeElement&&j(e.target).is(h))return T=!0,void(b.allowClick=!1);if(S&&b.emit("onTouchMove",b,e),!(e.targetTouches&&1b.params.touchAngle:90-t>b.params.touchAngle);if(d&&b.emit("onTouchMoveOpposite",b,e),void 0===m&&(b.touches.currentX===b.touches.startX&&b.touches.currentY===b.touches.startY||(m=!0)),x)if(d)x=!1;else if(m){b.allowClick=!1,b.emit("onSliderMove",b,e),e.preventDefault(),b.params.touchMoveStopPropagation&&!b.params.nested&&e.stopPropagation(),T||(l.loop&&b.fixLoop(),I=b.getWrapperTranslate(),b.setWrapperTransition(0),b.animating&&b.wrapper.trigger("webkitTransitionEnd transitionend oTransitionEnd MSTransitionEnd msTransitionEnd"),b.params.autoplay&&b.autoplaying&&(b.params.autoplayDisableOnInteraction?b.stopAutoplay():b.pauseAutoplay()),M=!1,!b.params.grabCursor||!0!==b.params.allowSwipeToNext&&!0!==b.params.allowSwipeToPrev||b.setGrabCursor(!0)),T=!0;var a=b.touches.diff=b.isHorizontal()?b.touches.currentX-b.touches.startX:b.touches.currentY-b.touches.startY;a*=b.params.touchRatio,b.rtl&&(a=-a),b.swipeDirection=0b.minTranslate()?(i=!1,b.params.resistance&&(E=b.minTranslate()-1+Math.pow(-b.minTranslate()+I+a,b.params.resistanceRatio))):a<0&&Eb.params.threshold||u))return void(E=I);if(!u)return u=!0,b.touches.startX=b.touches.currentX,b.touches.startY=b.touches.currentY,E=I,void(b.touches.diff=b.isHorizontal()?b.touches.currentX-b.touches.startX:b.touches.currentY-b.touches.startY)}b.params.followFinger&&((b.params.freeMode||b.params.watchSlidesProgress)&&b.updateActiveIndex(),b.params.freeMode&&(0===k.length&&k.push({position:b.touches[b.isHorizontal()?"startX":"startY"],time:C}),k.push({position:b.touches[b.isHorizontal()?"currentX":"currentY"],time:(new window.Date).getTime()})),b.updateProgress(E),b.setWrapperTranslate(E))}}}},b.onTouchEnd=function(e){if(e.originalEvent&&(e=e.originalEvent),S&&b.emit("onTouchEnd",b,e),S=!1,x){b.params.grabCursor&&T&&x&&(!0===b.params.allowSwipeToNext||!0===b.params.allowSwipeToPrev)&&b.setGrabCursor(!1);var t,a=Date.now(),i=a-C;if(b.allowClick&&(b.updateClickedSlide(e),b.emit("onTap",b,e),i<300&&300-b.maxTranslate())return void(b.slides.lengthb.minTranslate())b.params.freeModeMomentumBounce?(d-b.minTranslate()>m&&(d=b.minTranslate()+m),u=b.minTranslate(),M=c=!0):d=b.minTranslate();else if(b.params.freeModeSticky){var h,g=0;for(g=0;g-d){h=g;break}d=Math.abs(b.snapGrid[h]-d)=b.params.longSwipesMs)&&(b.updateProgress(),b.updateActiveIndex())}else{var f,v=0,y=b.slidesSizesGrid[0];for(f=0;f=b.slidesGrid[f]&&t=b.slidesGrid[f]&&(v=f,y=b.slidesGrid[b.slidesGrid.length-1]-b.slidesGrid[b.slidesGrid.length-2]);var w=(t-b.slidesGrid[v])/y;if(i>b.params.longSwipesMs){if(!b.params.longSwipes)return void b.slideTo(b.activeIndex);"next"===b.swipeDirection&&(w>=b.params.longSwipesRatio?b.slideTo(v+b.params.slidesPerGroup):b.slideTo(v)),"prev"===b.swipeDirection&&(w>1-b.params.longSwipesRatio?b.slideTo(v+b.params.slidesPerGroup):b.slideTo(v))}else{if(!b.params.shortSwipes)return void b.slideTo(b.activeIndex);"next"===b.swipeDirection&&b.slideTo(v+b.params.slidesPerGroup),"prev"===b.swipeDirection&&b.slideTo(v)}}else x=T=!1}},b._slideTo=function(e,t){return b.slideTo(e,t,!0,!0)},b.slideTo=function(e,t,a,i){void 0===a&&(a=!0),void 0===e&&(e=0),e<0&&(e=0),b.snapIndex=Math.floor(e/b.params.slidesPerGroup),b.snapIndex>=b.snapGrid.length&&(b.snapIndex=b.snapGrid.length-1);var n=-b.snapGrid[b.snapIndex];if(b.params.autoplay&&b.autoplaying&&(i||!b.params.autoplayDisableOnInteraction?b.pauseAutoplay(t):b.stopAutoplay()),b.updateProgress(n),b.params.normalizeSlideIndex)for(var r=0;r=Math.floor(100*b.slidesGrid[r])&&(e=r);return!(!b.params.allowSwipeToNext&&nb.translate&&n>b.maxTranslate()&&(b.activeIndex||0)!==e)&&(void 0===t&&(t=b.params.speed),b.previousIndex=b.activeIndex||0,b.activeIndex=e,b.updateRealIndex(),b.rtl&&-n===b.translate||!b.rtl&&n===b.translate?(b.params.autoHeight&&b.updateAutoHeight(),b.updateClasses(),"slide"!==b.params.effect&&b.setWrapperTranslate(n),!1):(b.updateClasses(),b.onTransitionStart(a),0===t||b.browser.lteIE9?(b.setWrapperTranslate(n),b.setWrapperTransition(0),b.onTransitionEnd(a)):(b.setWrapperTranslate(n),b.setWrapperTransition(t),b.animating||(b.animating=!0,b.wrapper.transitionEnd(function(){b&&b.onTransitionEnd(a)}))),!0)))},b.onTransitionStart=function(e){void 0===e&&(e=!0),b.params.autoHeight&&b.updateAutoHeight(),b.lazy&&b.lazy.onTransitionStart(),e&&(b.emit("onTransitionStart",b),b.activeIndex!==b.previousIndex&&(b.emit("onSlideChangeStart",b),b.activeIndex>b.previousIndex?b.emit("onSlideNextStart",b):b.emit("onSlidePrevStart",b)))},b.onTransitionEnd=function(e){b.animating=!1,b.setWrapperTransition(0),void 0===e&&(e=!0),b.lazy&&b.lazy.onTransitionEnd(),e&&(b.emit("onTransitionEnd",b),b.activeIndex!==b.previousIndex&&(b.emit("onSlideChangeEnd",b),b.activeIndex>b.previousIndex?b.emit("onSlideNextEnd",b):b.emit("onSlidePrevEnd",b))),b.params.history&&b.history&&b.history.setHistory(b.params.history,b.activeIndex),b.params.hashnav&&b.hashnav&&b.hashnav.setHash()},b.slideNext=function(e,t,a){if(b.params.loop){if(b.animating)return!1;b.fixLoop();b.container[0].clientLeft;return b.slideTo(b.activeIndex+b.params.slidesPerGroup,t,e,a)}return b.slideTo(b.activeIndex+b.params.slidesPerGroup,t,e,a)},b._slideNext=function(e){return b.slideNext(!0,e,!0)},b.slidePrev=function(e,t,a){if(b.params.loop){if(b.animating)return!1;b.fixLoop();b.container[0].clientLeft;return b.slideTo(b.activeIndex-1,t,e,a)}return b.slideTo(b.activeIndex-1,t,e,a)},b._slidePrev=function(e){return b.slidePrev(!0,e,!0)},b.slideReset=function(e,t,a){return b.slideTo(b.activeIndex,t,e)},b.disableTouchControl=function(){return b.params.onlyExternal=!0},b.enableTouchControl=function(){return!(b.params.onlyExternal=!1)},b.setWrapperTransition=function(e,t){b.wrapper.transition(e),"slide"!==b.params.effect&&b.effects[b.params.effect]&&b.effects[b.params.effect].setTransition(e),b.params.parallax&&b.parallax&&b.parallax.setTransition(e),b.params.scrollbar&&b.scrollbar&&b.scrollbar.setTransition(e),b.params.control&&b.controller&&b.controller.setTransition(e,t),b.emit("onSetTransition",b,e)},b.setWrapperTranslate=function(e,t,a){var i=0,n=0;b.isHorizontal()?i=b.rtl?-e:e:n=e,b.params.roundLengths&&(i=v(i),n=v(n)),b.params.virtualTranslate||(b.support.transforms3d?b.wrapper.transform("translate3d("+i+"px, "+n+"px, 0px)"):b.wrapper.transform("translate("+i+"px, "+n+"px)")),b.translate=b.isHorizontal()?i:n;var r=b.maxTranslate()-b.minTranslate();(0===r?0:(e-b.minTranslate())/r)!==b.progress&&b.updateProgress(e),t&&b.updateActiveIndex(),"slide"!==b.params.effect&&b.effects[b.params.effect]&&b.effects[b.params.effect].setTranslate(b.translate),b.params.parallax&&b.parallax&&b.parallax.setTranslate(b.translate),b.params.scrollbar&&b.scrollbar&&b.scrollbar.setTranslate(b.translate),b.params.control&&b.controller&&b.controller.setTranslate(b.translate,a),b.emit("onSetTranslate",b,b.translate)},b.getTranslate=function(e,t){var a,i,n,r;return void 0===t&&(t="x"),b.params.virtualTranslate?b.rtl?-b.translate:b.translate:(n=window.getComputedStyle(e,null),window.WebKitCSSMatrix?(6<(i=n.transform||n.webkitTransform).split(",").length&&(i=i.split(", ").map(function(e){return e.replace(",",".")}).join(", ")),r=new window.WebKitCSSMatrix("none"===i?"":i)):a=(r=n.MozTransform||n.OTransform||n.MsTransform||n.msTransform||n.transform||n.getPropertyValue("transform").replace("translate(","matrix(1, 0, 0, 1,")).toString().split(","),"x"===t&&(i=window.WebKitCSSMatrix?r.m41:16===a.length?parseFloat(a[12]):parseFloat(a[4])),"y"===t&&(i=window.WebKitCSSMatrix?r.m42:16===a.length?parseFloat(a[13]):parseFloat(a[5])),b.rtl&&i&&(i=-i),i||0)},b.getWrapperTranslate=function(e){return void 0===e&&(e=b.isHorizontal()?"x":"y"),b.getTranslate(b.wrapper[0],e)},b.observers=[],b.initObservers=function(){if(b.params.observeParents)for(var e=b.container.parents(),t=0;ti.length&&(b.loopedSlides=i.length);var e,n=[],r=[];for(i.each(function(e,t){var a=j(this);e=i.length-b.loopedSlides&&n.push(t),a.attr("data-swiper-slide-index",e)}),e=0;e=2*b.loopedSlides||b.activeIndex>b.slides.length-2*b.params.slidesPerView)&&(e=-b.slides.length+b.activeIndex+b.loopedSlides,e+=b.loopedSlides,b.slideTo(e,0,!1,!0))},b.appendSlide=function(e){if(b.params.loop&&b.destroyLoop(),"object"==typeof e&&e.length)for(var t=0;t
'),t.append(o)),0===l.length&&(l=j('
'),t.append(l)),o.length&&(o[0].style.opacity=Math.max(-a,0)),l.length&&(l[0].style.opacity=Math.max(a,0))}t.transform("translate3d("+r+"px, "+s+"px, 0px) rotateX("+n+"deg) rotateY("+i+"deg)")}},setTransition:function(e){if(b.slides.transition(e).find(".swiper-slide-shadow-top, .swiper-slide-shadow-right, .swiper-slide-shadow-bottom, .swiper-slide-shadow-left").transition(e),b.params.virtualTranslate&&0!==e){var a=!1;b.slides.eq(b.activeIndex).transitionEnd(function(){if(!a&&b&&j(this).hasClass(b.params.slideActiveClass)){a=!0,b.animating=!1;for(var e=["webkitTransitionEnd","transitionend","oTransitionEnd","MSTransitionEnd","msTransitionEnd"],t=0;t
'),b.wrapper.append(e)),e.css({height:b.width+"px"})):0===(e=b.container.find(".swiper-cube-shadow")).length&&(e=j('
'),b.container.append(e)));for(var a=0;a
'),i.append(u)),0===c.length&&(c=j('
'),i.append(c)),u.length&&(u[0].style.opacity=Math.max(-s,0)),c.length&&(c[0].style.opacity=Math.max(s,0))}}if(b.wrapper.css({"-webkit-transform-origin":"50% 50% -"+b.size/2+"px","-moz-transform-origin":"50% 50% -"+b.size/2+"px","-ms-transform-origin":"50% 50% -"+b.size/2+"px","transform-origin":"50% 50% -"+b.size/2+"px"}),b.params.cube.shadow)if(b.isHorizontal())e.transform("translate3d(0px, "+(b.width/2+b.params.cube.shadowOffset)+"px, "+-b.width/2+"px) rotateX(90deg) rotateZ(0deg) scale("+b.params.cube.shadowScale+")");else{var m=Math.abs(t)-90*Math.floor(Math.abs(t)/90),h=1.5-(Math.sin(2*m*Math.PI/360)/2+Math.cos(2*m*Math.PI/360)/2),g=b.params.cube.shadowScale,f=b.params.cube.shadowScale/h,v=b.params.cube.shadowOffset;e.transform("scale3d("+g+", 1, "+f+") translate3d(0px, "+(b.height/2+v)+"px, "+-b.height/2/f+"px) rotateX(-90deg)")}var y=b.isSafari||b.isUiWebView?-b.size/2:0;b.wrapper.transform("translate3d(0px,0,"+y+"px) rotateX("+(b.isHorizontal()?0:t)+"deg) rotateY("+(b.isHorizontal()?-t:0)+"deg)")},setTransition:function(e){b.slides.transition(e).find(".swiper-slide-shadow-top, .swiper-slide-shadow-right, .swiper-slide-shadow-bottom, .swiper-slide-shadow-left").transition(e),b.params.cube.shadow&&!b.isHorizontal()&&b.container.find(".swiper-cube-shadow").transition(e)}},coverflow:{setTranslate:function(){for(var e=b.translate,t=b.isHorizontal()?-e+b.width/2:-e+b.height/2,a=b.isHorizontal()?b.params.coverflow.rotate:-b.params.coverflow.rotate,i=b.params.coverflow.depth,n=0,r=b.slides.length;n
'),s.append(g)),0===f.length&&(f=j('
'),s.append(f)),g.length&&(g[0].style.opacity=0
'),e.track.append(e.drag)),e.drag[0].style.width="",e.drag[0].style.height="",e.trackSize=b.isHorizontal()?e.track[0].offsetWidth:e.track[0].offsetHeight,e.divider=b.size/b.virtualSize,e.moveDivider=e.divider*(e.trackSize/b.size),e.dragSize=e.trackSize*e.divider,b.isHorizontal()?e.drag[0].style.width=e.dragSize+"px":e.drag[0].style.height=e.dragSize+"px",1<=e.divider?e.track[0].style.display="none":e.track[0].style.display="",b.params.scrollbarHide&&(e.track[0].style.opacity=0)}},setTranslate:function(){if(b.params.scrollbar){var e,t=b.scrollbar,a=(b.translate,t.dragSize);e=(t.trackSize-t.dragSize)*b.progress,b.rtl&&b.isHorizontal()?0<(e=-e)?(a=t.dragSize-e,e=0):-e+t.dragSize>t.trackSize&&(a=t.trackSize+e):e<0?(a=t.dragSize+e,e=0):e+t.dragSize>t.trackSize&&(a=t.trackSize-e),b.isHorizontal()?(b.support.transforms3d?t.drag.transform("translate3d("+e+"px, 0, 0)"):t.drag.transform("translateX("+e+"px)"),t.drag[0].style.width=a+"px"):(b.support.transforms3d?t.drag.transform("translate3d(0px, "+e+"px, 0)"):t.drag.transform("translateY("+e+"px)"),t.drag[0].style.height=a+"px"),b.params.scrollbarHide&&(clearTimeout(t.timeout),t.track[0].style.opacity=1,t.timeout=setTimeout(function(){t.track[0].style.opacity=0,t.track.transition(400)},1e3))}},setTransition:function(e){b.params.scrollbar&&b.scrollbar.drag.transition(e)}},b.controller={LinearSpline:function(e,t){var a,i,n,r,s,o=function(e,t){for(i=-1,a=e.length;1>1]<=t?i=n:a=n;return a};this.x=e,this.y=t,this.lastIndex=e.length-1;this.x.length;this.interpolate=function(e){return e?(s=o(this.x,e),r=s-1,(e-this.x[r])*(this.y[s]-this.y[r])/(this.x[s]-this.x[r])+this.y[r]):0}},getInterpolateFunction:function(e){b.controller.spline||(b.controller.spline=b.params.loop?new b.controller.LinearSpline(b.slidesGrid,e.slidesGrid):new b.controller.LinearSpline(b.snapGrid,e.snapGrid))},setTranslate:function(t,e){var a,i,n=b.params.control;function r(e){t=e.rtl&&"horizontal"===e.params.direction?-b.translate:b.translate,"slide"===b.params.controlBy&&(b.controller.getInterpolateFunction(e),i=-b.controller.spline.interpolate(-t)),i&&"container"!==b.params.controlBy||(a=(e.maxTranslate()-e.minTranslate())/(b.maxTranslate()-b.minTranslate()),i=(t-b.minTranslate())*a+e.minTranslate()),b.params.controlInverse&&(i=e.maxTranslate()-i),e.updateProgress(i),e.setWrapperTranslate(i,!1,b),e.updateActiveIndex()}if(Array.isArray(n))for(var s=0;st.gesture.zoomMax&&(t.scale=t.gesture.zoomMax-1+Math.pow(t.scale-t.gesture.zoomMax+1,.5)),t.scalet.image.touchesStart.x)return void(t.image.isTouched=!1);if(!b.isHorizontal()&&Math.floor(t.image.minY)===Math.floor(t.image.startY)&&t.image.touchesCurrent.yt.image.touchesStart.y)return void(t.image.isTouched=!1)}e.preventDefault(),e.stopPropagation(),t.image.isMoved=!0,t.image.currentX=t.image.touchesCurrent.x-t.image.touchesStart.x+t.image.startX,t.image.currentY=t.image.touchesCurrent.y-t.image.touchesStart.y+t.image.startY,t.image.currentXt.image.maxX&&(t.image.currentX=t.image.maxX-1+Math.pow(t.image.currentX-t.image.maxX+1,.8)),t.image.currentYt.image.maxY&&(t.image.currentY=t.image.maxY-1+Math.pow(t.image.currentY-t.image.maxY+1,.8)),t.velocity.prevPositionX||(t.velocity.prevPositionX=t.image.touchesCurrent.x),t.velocity.prevPositionY||(t.velocity.prevPositionY=t.image.touchesCurrent.y),t.velocity.prevTime||(t.velocity.prevTime=Date.now()),t.velocity.x=(t.image.touchesCurrent.x-t.velocity.prevPositionX)/(Date.now()-t.velocity.prevTime)/2,t.velocity.y=(t.image.touchesCurrent.y-t.velocity.prevPositionY)/(Date.now()-t.velocity.prevTime)/2,Math.abs(t.image.touchesCurrent.x-t.velocity.prevPositionX)<2&&(t.velocity.x=0),Math.abs(t.image.touchesCurrent.y-t.velocity.prevPositionY)<2&&(t.velocity.y=0),t.velocity.prevPositionX=t.image.touchesCurrent.x,t.velocity.prevPositionY=t.image.touchesCurrent.y,t.velocity.prevTime=Date.now(),t.gesture.imageWrap.transform("translate3d("+t.image.currentX+"px, "+t.image.currentY+"px,0)")}}},onTouchEnd:function(e,t){var a=e.zoom;if(a.gesture.image&&0!==a.gesture.image.length){if(!a.image.isTouched||!a.image.isMoved)return a.image.isTouched=!1,void(a.image.isMoved=!1);a.image.isTouched=!1,a.image.isMoved=!1;var i=300,n=300,r=a.velocity.x*i,s=a.image.currentX+r,o=a.velocity.y*n,l=a.image.currentY+o;0!==a.velocity.x&&(i=Math.abs((s-a.image.currentX)/a.velocity.x)),0!==a.velocity.y&&(n=Math.abs((l-a.image.currentY)/a.velocity.y));var p=Math.max(i,n);a.image.currentX=s,a.image.currentY=l;var d=a.image.width*a.scale,u=a.image.height*a.scale;a.image.minX=Math.min(a.gesture.slideWidth/2-d/2,0),a.image.maxX=-a.image.minX,a.image.minY=Math.min(a.gesture.slideHeight/2-u/2,0),a.image.maxY=-a.image.minY,a.image.currentX=Math.max(Math.min(a.image.currentX,a.image.maxX),a.image.minX),a.image.currentY=Math.max(Math.min(a.image.currentY,a.image.maxY),a.image.minY),a.gesture.imageWrap.transition(p).transform("translate3d("+a.image.currentX+"px, "+a.image.currentY+"px,0)")}},onTransitionEnd:function(e){var t=e.zoom;t.gesture.slide&&e.previousIndex!==e.activeIndex&&(t.gesture.image.transform("translate3d(0,0,0) scale(1)"),t.gesture.imageWrap.transform("translate3d(0,0,0)"),t.gesture.slide=t.gesture.image=t.gesture.imageWrap=void 0,t.scale=t.currentScale=1)},toggleZoom:function(e,t){var a,i,n,r,s,o,l,p,d,u,c,m,h,g,f,v,y=e.zoom;(y.gesture.slide||(y.gesture.slide=e.clickedSlide?j(e.clickedSlide):e.slides.eq(e.activeIndex),y.gesture.image=y.gesture.slide.find("img, svg, canvas"),y.gesture.imageWrap=y.gesture.image.parent("."+e.params.zoomContainerClass)),y.gesture.image&&0!==y.gesture.image.length)&&(void 0===y.image.touchesStart.x&&t?(a="touchend"===t.type?t.changedTouches[0].pageX:t.pageX,i="touchend"===t.type?t.changedTouches[0].pageY:t.pageY):(a=y.image.touchesStart.x,i=y.image.touchesStart.y),y.scale&&1!==y.scale?(y.scale=y.currentScale=1,y.gesture.imageWrap.transition(300).transform("translate3d(0,0,0)"),y.gesture.image.transition(300).transform("translate3d(0,0,0) scale(1)"),y.gesture.slide=void 0):(y.scale=y.currentScale=y.gesture.imageWrap.attr("data-swiper-zoom")||e.params.zoomMax,t?(f=y.gesture.slide[0].offsetWidth,v=y.gesture.slide[0].offsetHeight,n=y.gesture.slide.offset().left+f/2-a,r=y.gesture.slide.offset().top+v/2-i,l=y.gesture.image[0].offsetWidth,p=y.gesture.image[0].offsetHeight,d=l*y.scale,u=p*y.scale,h=-(c=Math.min(f/2-d/2,0)),g=-(m=Math.min(v/2-u/2,0)),(s=n*y.scale)'),notify:function(e){var t=b.a11y.liveRegion;0!==t.length&&(t.html(""),t.html(e))},init:function(){b.params.nextButton&&b.nextButton&&0=i&&d[0]<=i+r&&d[1]>=n&&d[1]<=n+s&&(a=!0)}if(!a)return}b.isHorizontal()?(37!==t&&39!==t||(e.preventDefault?e.preventDefault():e.returnValue=!1),(39===t&&!b.rtl||37===t&&b.rtl)&&b.slideNext(),(37===t&&!b.rtl||39===t&&b.rtl)&&b.slidePrev()):(38!==t&&40!==t||(e.preventDefault?e.preventDefault():e.returnValue=!1),40===t&&b.slideNext(),38===t&&b.slidePrev()),b.emit("onKeyPress",b,t)}}function L(e){e.originalEvent&&(e=e.originalEvent);var t,a,i,n,r,s=0,o=b.rtl?-1:1,l=(r=n=i=a=0,"detail"in(t=e)&&(i=t.detail),"wheelDelta"in t&&(i=-t.wheelDelta/120),"wheelDeltaY"in t&&(i=-t.wheelDeltaY/120),"wheelDeltaX"in t&&(a=-t.wheelDeltaX/120),"axis"in t&&t.axis===t.HORIZONTAL_AXIS&&(a=i,i=0),n=10*a,r=10*i,"deltaY"in t&&(r=t.deltaY),"deltaX"in t&&(n=t.deltaX),(n||r)&&t.deltaMode&&(1===t.deltaMode?(n*=40,r*=40):(n*=800,r*=800)),n&&!a&&(a=n<1?-1:1),r&&!i&&(i=r<1?-1:1),{spinX:a,spinY:i,pixelX:n,pixelY:r});if(b.params.mousewheelForceToAxis)if(b.isHorizontal()){if(!(Math.abs(l.pixelX)>Math.abs(l.pixelY)))return;s=l.pixelX*o}else{if(!(Math.abs(l.pixelY)>Math.abs(l.pixelX)))return;s=l.pixelY}else s=Math.abs(l.pixelX)>Math.abs(l.pixelY)?-l.pixelX*o:-l.pixelY;if(0!==s){if(b.params.mousewheelInvert&&(s=-s),b.params.freeMode){var p=b.getWrapperTranslate()+s*b.params.mousewheelSensitivity,d=b.isBeginning,u=b.isEnd;if(p>=b.minTranslate()&&(p=b.minTranslate()),p<=b.maxTranslate()&&(p=b.maxTranslate()),b.setWrapperTransition(0),b.setWrapperTranslate(p),b.updateProgress(),b.updateActiveIndex(),(!d&&b.isBeginning||!u&&b.isEnd)&&b.updateClasses(),b.params.freeModeSticky?(clearTimeout(b.mousewheel.timeout),b.mousewheel.timeout=setTimeout(function(){b.slideReset()},300)):b.params.lazyLoading&&b.lazy&&b.lazy.load(),b.emit("onScroll",b,e),b.params.autoplay&&b.params.autoplayDisableOnInteraction&&b.stopAutoplay(),0===p||p===b.maxTranslate())return}else{if(60<(new window.Date).getTime()-b.mousewheel.lastScrollTime)if(s<0)if(b.isEnd&&!b.params.loop||b.animating){if(b.params.mousewheelReleaseOnEdges)return!0}else b.slideNext(),b.emit("onScroll",b,e);else if(b.isBeginning&&!b.params.loop||b.animating){if(b.params.mousewheelReleaseOnEdges)return!0}else b.slidePrev(),b.emit("onScroll",b,e);b.mousewheel.lastScrollTime=(new window.Date).getTime()}return e.preventDefault?e.preventDefault():e.returnValue=!1,!1}}function O(e,t){var a,i,n;e=j(e);var r=b.rtl?-1:1;a=e.attr("data-swiper-parallax")||"0",i=e.attr("data-swiper-parallax-x"),n=e.attr("data-swiper-parallax-y"),i||n?(i=i||"0",n=n||"0"):b.isHorizontal()?(i=a,n="0"):(n=a,i="0"),i=0<=i.indexOf("%")?parseInt(i,10)*t*r+"%":i*t*r+"px",n=0<=n.indexOf("%")?parseInt(n,10)*t+"%":n*t+"px",e.transform("translate3d("+i+", "+n+",0px)")}function H(e){return 0!==e.indexOf("on")&&(e=e[0]!==e[0].toUpperCase()?"on"+e[0].toUpperCase()+e.substring(1):"on"+e),e}};B.prototype={isSafari:(o=window.navigator.userAgent.toLowerCase(),0<=o.indexOf("safari")&&o.indexOf("chrome")<0&&o.indexOf("android")<0),isUiWebView:/(iPhone|iPod|iPad).*AppleWebKit(?!.*Safari)/i.test(window.navigator.userAgent),isArray:function(e){return"[object Array]"===Object.prototype.toString.apply(e)},browser:{ie:window.navigator.pointerEnabled||window.navigator.msPointerEnabled,ieTouch:window.navigator.msPointerEnabled&&1").append(t).contents()),t instanceof y&&(r=t)),(p=n.wrapInner('
').children()).contents().detach().end().append(r.clone(!0)).find("br").replaceWith("
").end().css({height:"auto",width:"auto",border:"none",padding:0,margin:0});var a=!1,i=!1;return o.afterElement&&((a=o.afterElement.clone(!0)).show(),o.afterElement.detach()),w(p,s)&&(i="children"==s.wrap?function(e,t,a){var i=e.children(),n=!1;e.empty();for(var r=0,s=i.length;rf?r=S(g.contents().eq(-1-f),t):(r=S(g,t,!0),f||g.detach()),r&&(s=b(T(r),i),x(r,s),f&&n)){var v=n.parent();y(r).parent().append(n),y.trim(v.html())||v.remove()}}else s=b(p.slice(0,d+1).join(l),i),x(r,s)}return!0}(e,i,n,r,s):t(e,i,n,r,s)),o||s&&s.detach()}});i.addClass("is-truncated");return o}(p,n,p,s,a)),p.replaceWith(p.contents()),p=null,y.isFunction(s.callback)&&s.callback.call(n[0],i,r),o.isTruncated=i}).bind("isTruncated.dot",function(e,t){return e.preventDefault(),e.stopPropagation(),"function"==typeof t&&t.call(n[0],o.isTruncated),o.isTruncated}).bind("originalContent.dot",function(e,t){return e.preventDefault(),e.stopPropagation(),"function"==typeof t&&t.call(n[0],r),r}).bind("destroy.dot",function(e){e.preventDefault(),e.stopPropagation(),n.unwatch().unbind_events().contents().detach().end().append(r).attr("style",n.data("dotdotdot-style")||"").removeClass("is-truncated").data("dotdotdot",!1)}),n},n.unbind_events=function(){return n.unbind(".dot"),n},n.watch=function(){if(n.unwatch(),"window"==s.watch){var e=y(window),t=e.width(),a=e.height();e.bind("resize.dot"+o.dotId,function(){t==e.width()&&a==e.height()&&s.windowResizeFix||(t=e.width(),a=e.height(),l&&clearInterval(l),l=setTimeout(function(){n.trigger("update.dot")},100))})}else i=d(n),l=setInterval(function(){if(n.is(":visible")){var e=d(n);i.width==e.width&&i.height==e.height||(n.trigger("update.dot"),i=e)}},500);return n},n.unwatch=function(){return y(window).unbind("resize.dot"+o.dotId),l&&clearInterval(l),n};var s=y.extend(!0,{},y.fn.dotdotdot.defaults,e),o={},i={},l=null,p=null;return s.lastCharacter.remove instanceof Array||(s.lastCharacter.remove=y.fn.dotdotdot.defaultArrays.lastCharacter.remove),s.lastCharacter.noEllipsis instanceof Array||(s.lastCharacter.noEllipsis=y.fn.dotdotdot.defaultArrays.lastCharacter.noEllipsis),o.afterElement=function(e,t){if(!e)return!1;if("string"==typeof e)return!!(e=y(e,t)).length&&e;return!!e.jquery&&e}(s.after,n),o.isTruncated=!1,o.dotId=t++,n.data("dotdotdot",!0).bind_events().trigger("update.dot"),s.watch&&n.watch(),n},y.fn.dotdotdot.defaults={ellipsis:"... ",wrap:"word",fallbackToLetter:!0,lastCharacter:{},tolerance:0,callback:null,after:null,height:null,watch:!1,windowResizeFix:!0,maxLength:null},y.fn.dotdotdot.defaultArrays={lastCharacter:{remove:[" "," ",",",";",".","!","?"],noEllipsis:[]}},y.fn.dotdotdot.debug=function(e){};var t=1,a=y.fn.html;y.fn.html=function(e){return null!=e&&!y.isFunction(e)&&this.data("dotdotdot")?this.trigger("update",[e]):a.apply(this,arguments)};var i=y.fn.text;y.fn.text=function(e){return null!=e&&!y.isFunction(e)&&this.data("dotdotdot")?(e=y("
").text(e).html(),this.trigger("update",[e])):i.apply(this,arguments)}}function w(e,t){return e.innerHeight()>t.maxHeight||t.maxLength&&e.text().trim().length>t.maxLength}function b(e,t){for(;-1=this.minChars&&0$&");return s.create("li",{innerHTML:a,"aria-selected":"false"})},i.REPLACE=function(e){this.input.value=e.value},i.DATA=function(e){return e},Object.defineProperty(n.prototype=Object.create(String.prototype),"length",{get:function(){return this.label.length}}),n.prototype.toString=n.prototype.valueOf=function(){return""+this.label};var a=Array.prototype.slice;function s(e,t){return"string"==typeof e?(t||document).querySelector(e):e||null}function e(e,t){return a.call((t||document).querySelectorAll(e))}function t(){e("input.awesomplete").forEach(function(e){new i(e)})}s.create=function(e,t){var a=document.createElement(e);for(var i in t){var n=t[i];if("inside"===i)s(n).appendChild(a);else if("around"===i){var r=s(n);r.parentNode.insertBefore(a,r),a.appendChild(r)}else i in a?a[i]=n:a.setAttribute(i,n)}return a},s.bind=function(t,e){if(t)for(var a in e){var i=e[a];a.split(/\s+/).forEach(function(e){t.addEventListener(e,i)})}},s.unbind=function(t,e){if(t)for(var a in e){var i=e[a];a.split(/\s+/).forEach(function(e){t.removeEventListener(e,i)})}},s.fire=function(e,t,a){var i=document.createEvent("HTMLEvents");for(var n in i.initEvent(t,!0,!0),a)i[n]=a[n];return e.dispatchEvent(i)},s.regExpEscape=function(e){return e.replace(/[-\\^$*+?.()|[\]{}]/g,"\\$&")},s.siblingIndex=function(e){for(var t=0;e=e.previousElementSibling;t++);return t},"undefined"!=typeof Document&&("loading"!==document.readyState?t():document.addEventListener("DOMContentLoaded",t)),i.$=s,i.$$=e,"undefined"!=typeof self&&(self.Awesomplete=i),"object"==typeof module&&module.exports&&(module.exports=i)}(),function(R,Y,$,e){"use strict";R.fn.simpleLightbox=function(d){d=R.extend({sourceAttr:"href",overlay:!0,spinner:!0,nav:!0,navText:["‹","›"],captions:!0,captionDelay:0,captionSelector:"img",captionType:"attr",captionsData:"title",captionPosition:"bottom",captionClass:"",close:!0,closeText:"×",swipeClose:!0,showCounter:!0,fileExt:"png|jpg|jpeg|gif",animationSlide:!0,animationSpeed:250,preloading:!0,enableKeyboard:!0,loop:!0,rel:!1,docClose:!0,swipeTolerance:50,className:"simple-lightbox",widthRatio:.8,heightRatio:.9,disableRightClick:!1,disableScroll:!0,alertError:!0,alertErrorMessage:"Image not found, next image will be loaded",additionalHtml:!1,history:!0},d),Y.navigator.pointerEnabled||Y.navigator.msPointerEnabled;var u,e,o=0,l=0,c=R(),i=function(){var e=$.body||$.documentElement;return""===(e=e.style).WebkitTransition?"-webkit-":""===e.MozTransition?"-moz-":""===e.OTransition?"-o-":""===e.transition&&""},m=!1,h=[],g=d.rel&&!1!==d.rel?(e=d.rel,R(this.selector).filter(function(){return R(this).attr("rel")===e})):this,f=(i=i(),0),v=!1!==i,a="pushState"in history,y=!1,n=Y.location,p=function(){return n.hash.substring(1)},w=p(),b=function(){p();var e="pid="+(E+1),t=n.href.split("#")[0]+"#"+e;a?history[y?"replaceState":"pushState"]("",$.title,t):y?n.replace(t):n.hash=e,y=!0},x="simplelb",t=R("
").addClass("sl-overlay"),r=R(""),s=R("
").addClass("sl-counter").html('/'),C=!1,E=0,I=R("
").addClass("sl-caption "+d.captionClass+" pos-"+d.captionPosition),z=R("
").addClass("sl-image"),M=R("
").addClass("sl-wrapper").addClass(d.className),P=function(e){e.trigger(R.Event("show.simplelightbox")),d.disableScroll&&(f=B("hide")),M.appendTo("body"),z.appendTo(M),d.overlay&&t.appendTo(R("body")),C=!0,E=g.index(e),c=R("").hide().attr("src",e.attr(d.sourceAttr)),-1==h.indexOf(e.attr(d.sourceAttr))&&h.push(e.attr(d.sourceAttr)),z.html("").attr("style",""),c.appendTo(z),L(),t.fadeIn("fast"),R(".sl-close").fadeIn("fast"),T.show(),S.fadeIn("fast"),R(".sl-wrapper .sl-counter .sl-current").text(E+1),s.fadeIn("fast"),k(),d.preloading&&O(),setTimeout(function(){e.trigger(R.Event("shown.simplelightbox"))},d.animationSpeed)},k=function(s){if(c.length){var o=new Image,l=R(Y).width()*d.widthRatio,p=R(Y).height()*d.heightRatio;o.src=c.attr("src"),R(o).on("error",function(e){g.eq(E).trigger(R.Event("error.simplelightbox")),m=!(C=!1),T.hide(),d.alertError&&alert(d.alertErrorMessage),H(1==s||-1==s?s:1)}),o.onload=function(){void 0!==s&&g.eq(E).trigger(R.Event("changed.simplelightbox")).trigger(R.Event((1===s?"nextDone":"prevDone")+".simplelightbox")),d.history&&(y?u=setTimeout(b,800):b()),-1==h.indexOf(c.attr("src"))&&h.push(c.attr("src"));var e=o.width,t=o.height;if(l=g.length-1&&R(".sl-next").hide(),0").html(d.additionalHtml).addClass("sl-additional-html").appendTo(R(".sl-image"))}}},A=function(e){""!==e&&void 0!==e&&d.captions&&I.html(e).hide().appendTo(R(".sl-image")).delay(d.captionDelay).fadeIn("fast")},D=function(e,t){var a={};a[i+"transform"]="translateX("+t+")",a[i+"transition"]=i+"transform "+e+"s linear",R(".sl-image").css(a)},L=function(){R(Y).on("resize."+x,k),R($).on("click."+x+" touchstart."+x,".sl-close",function(e){e.preventDefault(),m&&j()}),d.history&&setTimeout(function(){R(Y).on("hashchange."+x,function(){m&&p()===w&&j()})},40),S.on("click."+x,"button",function(e){e.preventDefault(),o=0,H(R(this).hasClass("sl-next")?1:-1)});var t=0,a=0,i=0,n=0,r=!1,s=0;z.on("touchstart."+x+" mousedown."+x,function(e){return!!r||(v&&(s=parseInt(z.css("left"))),r=!0,l=o=0,t=e.originalEvent.pageX||e.originalEvent.touches[0].pageX,i=e.originalEvent.pageY||e.originalEvent.touches[0].pageY,!1)}).on("touchmove."+x+" mousemove."+x+" pointermove MSPointerMove",function(e){if(!r)return!0;e.preventDefault(),a=e.originalEvent.pageX||e.originalEvent.touches[0].pageX,n=e.originalEvent.pageY||e.originalEvent.touches[0].pageY,o=t-a,l=i-n,d.animationSlide&&(v?D(0,-o+"px"):z.css("left",s-o+"px"))}).on("touchend."+x+" mouseup."+x+" touchcancel."+x+" mouseleave."+x+" pointerup pointercancel MSPointerUp MSPointerCancel",function(e){if(r){var t=!(r=!1);d.loop||(0===E&&o<0&&(t=!1),E>=g.length-1&&0d.swipeTolerance&&t?H(0=g.length-1?0:E+1,t=E-1<0?g.length-1:E-1>=g.length-1?0:E-1;R("").attr("src",g.eq(e).attr(d.sourceAttr)).on("load",function(){-1==h.indexOf(R(this).attr("src"))&&h.push(R(this).attr("src")),g.eq(E).trigger(R.Event("nextImageLoaded.simplelightbox"))}),R("").attr("src",g.eq(t).attr(d.sourceAttr)).on("load",function(){-1==h.indexOf(R(this).attr("src"))&&h.push(R(this).attr("src")),g.eq(E).trigger(R.Event("prevImageLoaded.simplelightbox"))})},H=function(t){g.eq(E).trigger(R.Event("change.simplelightbox")).trigger(R.Event((1===t?"next":"prev")+".simplelightbox"));var e=E+t;if(!(C||(e<0||e>=g.length)&&!1===d.loop)){E=e<0?g.length-1:e>g.length-1?0:e,R(".sl-wrapper .sl-counter .sl-current").text(E+1);var a={opacity:0};d.animationSlide&&(v?D(d.animationSpeed/1e3,-100*t-o+"px"):a.left=parseInt(R(".sl-image").css("left"))+-100*t+"px"),R(".sl-image").animate(a,d.animationSpeed,function(){setTimeout(function(){var e=g.eq(E);c.attr("src",e.attr(d.sourceAttr)),-1==h.indexOf(e.attr(d.sourceAttr))&&T.show(),R(".sl-caption").remove(),k(t),d.preloading&&O()},100)})}},j=function(){if(!C){var e=g.eq(E),t=!1;e.trigger(R.Event("close.simplelightbox")),d.history&&(a?history.pushState("",$.title,n.pathname+n.search):n.hash="",clearTimeout(u)),R(".sl-image img, .sl-overlay, .sl-close, .sl-navigation, .sl-image .sl-caption, .sl-counter").fadeOut("fast",function(){d.disableScroll&&B("show"),R(".sl-wrapper, .sl-overlay").remove(),S.off("click","button"),R($).off("click."+x,".sl-close"),R(Y).off("resize."+x),R(Y).off("hashchange."+x),t||e.trigger(R.Event("closed.simplelightbox")),t=!0}),c=R(),C=m=!1}},B=function(e){var t=0;if("hide"==e){var a=Y.innerWidth;if(!a){var i=$.documentElement.getBoundingClientRect();a=i.right-Math.abs(i.left)}if($.body.clientWidth=p.options.endTime&&(p.options.loop?p.play(p.options.startTime):p.pause())},150):clearInterval(a)}};var i=!p.$video;if(i){var n=document.createElement("div");n.setAttribute("id",p.playerID),e.appendChild(n),document.body.appendChild(e)}p.player=p.player||new window.YT.Player(p.playerID,p.playerOptions),i&&(p.$video=document.getElementById(p.playerID),p.videoWidth=parseInt(p.$video.getAttribute("width"),10)||1280,p.videoHeight=parseInt(p.$video.getAttribute("height"),10)||720)}if("vimeo"===p.type){if(p.playerOptions={id:p.videoID,autopause:0,transparent:0,autoplay:p.options.autoplay?1:0,loop:p.options.loop?1:0,muted:p.options.mute?1:0},p.options.volume&&(p.playerOptions.volume=p.options.volume),p.options.showContols||(p.playerOptions.badge=0,p.playerOptions.byline=0,p.playerOptions.portrait=0,p.playerOptions.title=0),!p.$video){var r="";Object.keys(p.playerOptions).forEach(function(e){""!==r&&(r+="&"),r+=e+"="+encodeURIComponent(p.playerOptions[e])}),p.$video=document.createElement("iframe"),p.$video.setAttribute("id",p.playerID),p.$video.setAttribute("src","https://player.vimeo.com/video/"+p.videoID+"?"+r),p.$video.setAttribute("frameborder","0"),p.$video.setAttribute("mozallowfullscreen",""),p.$video.setAttribute("allowfullscreen",""),e.appendChild(p.$video),document.body.appendChild(e)}p.player=p.player||new Vimeo.Player(p.$video,p.playerOptions),p.options.startTime&&p.options.autoplay&&p.player.setCurrentTime(p.options.startTime),p.player.getVideoWidth().then(function(e){p.videoWidth=e||1280}),p.player.getVideoHeight().then(function(e){p.videoHeight=e||720});var s=void 0;p.player.on("timeupdate",function(e){s||(p.fire("started",e),s=1),p.fire("timeupdate",e),p.options.endTime&&p.options.endTime&&e.seconds>=p.options.endTime&&(p.options.loop?p.play(p.options.startTime):p.pause())}),p.player.on("play",function(e){p.fire("play",e),p.options.startTime&&0===e.seconds&&p.play(p.options.startTime)}),p.player.on("pause",function(e){p.fire("pause",e)}),p.player.on("ended",function(e){p.fire("ended",e)}),p.player.on("loaded",function(e){p.fire("ready",e)}),p.player.on("volumechange",function(e){p.fire("volumechange",e)})}if("local"===p.type){p.$video||(p.$video=document.createElement("video"),p.options.showContols&&(p.$video.controls=!0),p.options.mute?p.$video.muted=!0:p.$video.volume&&(p.$video.volume=p.options.volume/100),p.options.loop&&(p.$video.loop=!0),p.$video.setAttribute("playsinline",""),p.$video.setAttribute("webkit-playsinline",""),p.$video.setAttribute("id",p.playerID),e.appendChild(p.$video),document.body.appendChild(e),Object.keys(p.videoID).forEach(function(e){var t,a,i,n;t=p.$video,a=p.videoID[e],i="video/"+e,(n=document.createElement("source")).src=a,n.type=i,t.appendChild(n)})),p.player=p.player||p.$video;var o=void 0;p.player.addEventListener("playing",function(e){o||p.fire("started",e),o=1}),p.player.addEventListener("timeupdate",function(e){p.fire("timeupdate",e),p.options.endTime&&p.options.endTime&&this.currentTime>=p.options.endTime&&(p.options.loop?p.play(p.options.startTime):p.pause())}),p.player.addEventListener("play",function(e){p.fire("play",e)}),p.player.addEventListener("pause",function(e){p.fire("pause",e)}),p.player.addEventListener("ended",function(e){p.fire("ended",e)}),p.player.addEventListener("loadedmetadata",function(){p.videoWidth=this.videoWidth||1280,p.videoHeight=this.videoHeight||720,p.fire("ready"),p.options.autoplay&&p.play(p.options.startTime)}),p.player.addEventListener("volumechange",function(e){p.getVolume(function(e){p.options.volume=e}),p.fire("volumechange",e)})}l(p.$video)})}},{key:"init",value:function(){this.playerID="VideoWorker-"+this.ID}},{key:"loadAPI",value:function(){if(!o||!l){var e="";if("youtube"!==this.type||o||(o=1,e="https://www.youtube.com/iframe_api"),"vimeo"!==this.type||l||(l=1,e="https://player.vimeo.com/api/player.js"),e){var t=document.createElement("script"),a=document.getElementsByTagName("head")[0];t.src=e,a.appendChild(t),t=a=null}}}},{key:"onAPIready",value:function(e){if("youtube"===this.type&&("undefined"!=typeof YT&&0!==YT.loaded||p?"object"===("undefined"==typeof YT?"undefined":n(YT))&&1===YT.loaded?e():u.done(function(){e()}):(p=1,window.onYouTubeIframeAPIReady=function(){window.onYouTubeIframeAPIReady=null,u.resolve("done"),e()})),"vimeo"===this.type)if("undefined"!=typeof Vimeo||d)"undefined"!=typeof Vimeo?e():c.done(function(){e()});else{d=1;var t=setInterval(function(){"undefined"!=typeof Vimeo&&(clearInterval(t),c.resolve("done"),e())},20)}"local"===this.type&&e()}}]),i}();t.default=m},function(e,t,a){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(){var e=0n&&(n=t.container.width,i=n*e.image.height/e.image.width,r=0,s+=(t.image.height-i)/2),"IFRAME"===a&&(i+=400,s-=200),e.css(e.$video,{width:n+"px",marginLeft:r+"px",height:i+"px",marginTop:s+"px"})}return t};var a=t.prototype.initImg;t.prototype.initImg=function(){var e=this,t=a.apply(e);return e.options.videoSrc||(e.options.videoSrc=e.$item.getAttribute("data-jarallax-video")||null),e.options.videoSrc?(e.defaultInitImgResult=t,!0):t};var n=t.prototype.canInitParallax;t.prototype.canInitParallax=function(){var a=this,e=n.apply(a);if(!a.options.videoSrc)return e;var t=new s.default(a.options.videoSrc,{autoplay:!0,loop:a.options.videoLoop,showContols:!1,startTime:a.options.videoStartTime||0,endTime:a.options.videoEndTime||0,mute:a.options.videoVolume?0:1,volume:a.options.videoVolume||0});if(t.isValid())if(e){if(t.on("ready",function(){if(a.options.videoPlayOnlyVisible){var e=a.onScroll;a.onScroll=function(){e.apply(a),(a.options.videoLoop||!a.options.videoLoop&&!a.videoEnded)&&(a.isVisible()?t.play():t.pause())}}else t.play()}),t.on("started",function(){a.image.$default_item=a.image.$item,a.image.$item=a.$video,a.image.width=a.video.videoWidth||1280,a.image.height=a.video.videoHeight||720,a.coverImage(),a.clipContainer(),a.onScroll(),a.image.$default_item&&(a.image.$default_item.style.display="none")}),t.on("ended",function(){a.videoEnded=!0,a.options.videoLoop||a.image.$default_item&&(a.image.$item=a.image.$default_item,a.image.$item.style.display="block",a.coverImage(),a.clipContainer(),a.onScroll())}),a.video=t,!a.defaultInitImgResult)return"local"!==t.type?(t.getImageURL(function(e){a.image.src=e,a.init()}),!1):(a.image.src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",!0)}else a.defaultInitImgResult||t.getImageURL(function(e){var t=a.$item.getAttribute("style");t&&a.$item.setAttribute("data-jarallax-original-styles",t),a.css(a.$item,{"background-image":'url("'+e+'")',"background-position":"center","background-size":"cover"})});return e};var r=t.prototype.destroy;t.prototype.destroy=function(){var e=this;e.image.$default_item&&(e.image.$item=e.image.$default_item,delete e.image.$default_item),r.apply(e)}};var s=i(a(8)),l=i(a(4));function i(e){return e&&e.__esModule?e:{default:e}}}]),function(e){"function"==typeof define&&define.amd&&define.amd.jQuery?define(["jquery"],e):e("undefined"!=typeof module&&module.exports?require("jquery"):jQuery)}(function(oe){"use strict";function i(e,g){function t(e){if(!(!0===K.data(De+"_intouch")||0a.left&&t.xa.top&&t.yg.longTapThreshold&&$=g.threshold),e}function p(){var e=!1;return null!==g.cancelThreshold&&null!==N&&(e=M(N)-$>=g.cancelThreshold),e}function d(){return!(g.maxTimeThreshold&&G>=g.maxTimeThreshold)}function u(){var e=h(),t=w(),a=null===g.pinchThreshold||q>=g.pinchThreshold;return e&&t&&a}function y(){return!!(g.pinchStatus||g.pinchIn||g.pinchOut)}function c(){var e=d(),t=l(),a=h(),i=w();return!p()&&i&&a&&t&&e}function m(){return!!(g.swipe||g.swipeStatus||g.swipeLeft||g.swipeRight||g.swipeUp||g.swipeDown)}function h(){return Z===g.fingers||g.fingers===Se||!Pe}function w(){return 0!==J[0].end.x}function b(){return!!g.tap}function x(){return!!g.doubleTap}function T(){if(null==ne)return!1;var e=L();return x()&&e-ne<=g.doubleTapThreshold}function S(){ie=ae=0}function C(){var e=!1;ae&&(L()-ae<=g.fingerReleaseThreshold&&(e=!0));return e}function E(e){K&&(!0===e?(K.bind(j,a),K.bind(B,i),R&&K.bind(R,r)):(K.unbind(j,a,!1),K.unbind(B,i,!1),R&&K.unbind(R,r,!1)),K.data(De+"_intouch",!0===e))}function I(e,t){var a={start:{x:0,y:0},last:{x:0,y:0},end:{x:0,y:0}};return a.start.x=a.last.x=a.end.x=t.pageX||t.clientX,a.start.y=a.last.y=a.end.y=t.pageY||t.clientY,J[e]=a}function z(e){var t=void 0!==e.identifier?e.identifier:0,a=J[t]||null;return null===a&&(a=I(t,e)),a.last.x=a.end.x,a.last.y=a.end.y,a.end.x=e.pageX||e.clientX,a.end.y=e.pageY||e.clientY,a}function M(e){if(U[e])return U[e].distance}function P(e){return{direction:e,distance:0}}function k(){return te-ee}function A(e,t){var a=Math.abs(e.x-t.x),i=Math.abs(e.y-t.y);return Math.round(Math.sqrt(a*a+i*i))}function D(e,t){if(i=t,(a=e).x==i.x&&a.y==i.y)return he;var a,i,n,r,s,o,l,p,d=(r=t,s=(n=e).x-r.x,o=r.y-n.y,l=Math.atan2(o,s),(p=Math.round(180*l/Math.PI))<0&&(p=360-Math.abs(p)),p);return d<=45&&0<=d?le:d<=360&&315<=d?le:135<=d&&d<=225?pe:45t.width||n.img.naturalHeight>t.height?t.style.backgroundSize="contain":t.style.backgroundSize="auto"}):t.style.backgroundSize=e["object-fit"].replace("none","auto").replace("fill","100% 100%"),h(n.img,function(e){m(t,e.naturalWidth,e.naturalHeight)})}function f(e,t){var a=!c&&!e;if(t=t||{},e=e||"img",n&&!t.skipTest||!l)return!1;"img"===e?e=document.getElementsByTagName("img"):"string"==typeof e?e=document.querySelectorAll(e):"length"in e||(e=[e]);for(var i=0;i elements - // (i.e., `typeof document.createElement( "object" ) === "function"`). - // We don't want to classify *any* DOM node as a function. - return typeof obj === "function" && typeof obj.nodeType !== "number"; - }; - - -var isWindow = function isWindow( obj ) { - return obj != null && obj === obj.window; - }; - - - - - var preservedScriptAttributes = { - type: true, - src: true, - noModule: true - }; - - function DOMEval( code, doc, node ) { - doc = doc || document; - - var i, - script = doc.createElement( "script" ); - - script.text = code; - if ( node ) { - for ( i in preservedScriptAttributes ) { - if ( node[ i ] ) { - script[ i ] = node[ i ]; - } - } - } - doc.head.appendChild( script ).parentNode.removeChild( script ); - } - - -function toType( obj ) { - if ( obj == null ) { - return obj + ""; - } - - // Support: Android <=2.3 only (functionish RegExp) - return typeof obj === "object" || typeof obj === "function" ? - class2type[ toString.call( obj ) ] || "object" : - typeof obj; -} -/* global Symbol */ -// Defining this global in .eslintrc.json would create a danger of using the global -// unguarded in another place, it seems safer to define global only for this module - - - -var - version = "3.3.1", - - // Define a local copy of jQuery - jQuery = function( selector, context ) { - - // The jQuery object is actually just the init constructor 'enhanced' - // Need init if jQuery is called (just allow error to be thrown if not included) - return new jQuery.fn.init( selector, context ); - }, - - // Support: Android <=4.0 only - // Make sure we trim BOM and NBSP - rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g; - -jQuery.fn = jQuery.prototype = { - - // The current version of jQuery being used - jquery: version, - - constructor: jQuery, - - // The default length of a jQuery object is 0 - length: 0, - - toArray: function() { - return slice.call( this ); - }, - - // Get the Nth element in the matched element set OR - // Get the whole matched element set as a clean array - get: function( num ) { - - // Return all the elements in a clean array - if ( num == null ) { - return slice.call( this ); - } - - // Return just the one element from the set - return num < 0 ? this[ num + this.length ] : this[ num ]; - }, - - // Take an array of elements and push it onto the stack - // (returning the new matched element set) - pushStack: function( elems ) { - - // Build a new jQuery matched element set - var ret = jQuery.merge( this.constructor(), elems ); - - // Add the old object onto the stack (as a reference) - ret.prevObject = this; - - // Return the newly-formed element set - return ret; - }, - - // Execute a callback for every element in the matched set. - each: function( callback ) { - return jQuery.each( this, callback ); - }, - - map: function( callback ) { - return this.pushStack( jQuery.map( this, function( elem, i ) { - return callback.call( elem, i, elem ); - } ) ); - }, - - slice: function() { - return this.pushStack( slice.apply( this, arguments ) ); - }, - - first: function() { - return this.eq( 0 ); - }, - - last: function() { - return this.eq( -1 ); - }, - - eq: function( i ) { - var len = this.length, - j = +i + ( i < 0 ? len : 0 ); - return this.pushStack( j >= 0 && j < len ? [ this[ j ] ] : [] ); - }, - - end: function() { - return this.prevObject || this.constructor(); - }, - - // For internal use only. - // Behaves like an Array's method, not like a jQuery method. - push: push, - sort: arr.sort, - splice: arr.splice -}; - -jQuery.extend = jQuery.fn.extend = function() { - var options, name, src, copy, copyIsArray, clone, - target = arguments[ 0 ] || {}, - i = 1, - length = arguments.length, - deep = false; - - // Handle a deep copy situation - if ( typeof target === "boolean" ) { - deep = target; - - // Skip the boolean and the target - target = arguments[ i ] || {}; - i++; - } - - // Handle case when target is a string or something (possible in deep copy) - if ( typeof target !== "object" && !isFunction( target ) ) { - target = {}; - } - - // Extend jQuery itself if only one argument is passed - if ( i === length ) { - target = this; - i--; - } - - for ( ; i < length; i++ ) { - - // Only deal with non-null/undefined values - if ( ( options = arguments[ i ] ) != null ) { - - // Extend the base object - for ( name in options ) { - src = target[ name ]; - copy = options[ name ]; - - // Prevent never-ending loop - if ( target === copy ) { - continue; - } - - // Recurse if we're merging plain objects or arrays - if ( deep && copy && ( jQuery.isPlainObject( copy ) || - ( copyIsArray = Array.isArray( copy ) ) ) ) { - - if ( copyIsArray ) { - copyIsArray = false; - clone = src && Array.isArray( src ) ? src : []; - - } else { - clone = src && jQuery.isPlainObject( src ) ? src : {}; - } - - // Never move original objects, clone them - target[ name ] = jQuery.extend( deep, clone, copy ); - - // Don't bring in undefined values - } else if ( copy !== undefined ) { - target[ name ] = copy; - } - } - } - } - - // Return the modified object - return target; -}; - -jQuery.extend( { - - // Unique for each copy of jQuery on the page - expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ), - - // Assume jQuery is ready without the ready module - isReady: true, - - error: function( msg ) { - throw new Error( msg ); - }, - - noop: function() {}, - - isPlainObject: function( obj ) { - var proto, Ctor; - - // Detect obvious negatives - // Use toString instead of jQuery.type to catch host objects - if ( !obj || toString.call( obj ) !== "[object Object]" ) { - return false; - } - - proto = getProto( obj ); - - // Objects with no prototype (e.g., `Object.create( null )`) are plain - if ( !proto ) { - return true; - } - - // Objects with prototype are plain iff they were constructed by a global Object function - Ctor = hasOwn.call( proto, "constructor" ) && proto.constructor; - return typeof Ctor === "function" && fnToString.call( Ctor ) === ObjectFunctionString; - }, - - isEmptyObject: function( obj ) { - - /* eslint-disable no-unused-vars */ - // See https://github.com/eslint/eslint/issues/6125 - var name; - - for ( name in obj ) { - return false; - } - return true; - }, - - // Evaluates a script in a global context - globalEval: function( code ) { - DOMEval( code ); - }, - - each: function( obj, callback ) { - var length, i = 0; - - if ( isArrayLike( obj ) ) { - length = obj.length; - for ( ; i < length; i++ ) { - if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) { - break; - } - } - } else { - for ( i in obj ) { - if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) { - break; - } - } - } - - return obj; - }, - - // Support: Android <=4.0 only - trim: function( text ) { - return text == null ? - "" : - ( text + "" ).replace( rtrim, "" ); - }, - - // results is for internal usage only - makeArray: function( arr, results ) { - var ret = results || []; - - if ( arr != null ) { - if ( isArrayLike( Object( arr ) ) ) { - jQuery.merge( ret, - typeof arr === "string" ? - [ arr ] : arr - ); - } else { - push.call( ret, arr ); - } - } - - return ret; - }, - - inArray: function( elem, arr, i ) { - return arr == null ? -1 : indexOf.call( arr, elem, i ); - }, - - // Support: Android <=4.0 only, PhantomJS 1 only - // push.apply(_, arraylike) throws on ancient WebKit - merge: function( first, second ) { - var len = +second.length, - j = 0, - i = first.length; - - for ( ; j < len; j++ ) { - first[ i++ ] = second[ j ]; - } - - first.length = i; - - return first; - }, - - grep: function( elems, callback, invert ) { - var callbackInverse, - matches = [], - i = 0, - length = elems.length, - callbackExpect = !invert; - - // Go through the array, only saving the items - // that pass the validator function - for ( ; i < length; i++ ) { - callbackInverse = !callback( elems[ i ], i ); - if ( callbackInverse !== callbackExpect ) { - matches.push( elems[ i ] ); - } - } - - return matches; - }, - - // arg is for internal usage only - map: function( elems, callback, arg ) { - var length, value, - i = 0, - ret = []; - - // Go through the array, translating each of the items to their new values - if ( isArrayLike( elems ) ) { - length = elems.length; - for ( ; i < length; i++ ) { - value = callback( elems[ i ], i, arg ); - - if ( value != null ) { - ret.push( value ); - } - } - - // Go through every key on the object, - } else { - for ( i in elems ) { - value = callback( elems[ i ], i, arg ); - - if ( value != null ) { - ret.push( value ); - } - } - } - - // Flatten any nested arrays - return concat.apply( [], ret ); - }, - - // A global GUID counter for objects - guid: 1, - - // jQuery.support is not used in Core but other projects attach their - // properties to it so it needs to exist. - support: support -} ); - -if ( typeof Symbol === "function" ) { - jQuery.fn[ Symbol.iterator ] = arr[ Symbol.iterator ]; -} - -// Populate the class2type map -jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ), -function( i, name ) { - class2type[ "[object " + name + "]" ] = name.toLowerCase(); -} ); - -function isArrayLike( obj ) { - - // Support: real iOS 8.2 only (not reproducible in simulator) - // `in` check used to prevent JIT error (gh-2145) - // hasOwn isn't used here due to false negatives - // regarding Nodelist length in IE - var length = !!obj && "length" in obj && obj.length, - type = toType( obj ); - - if ( isFunction( obj ) || isWindow( obj ) ) { - return false; - } - - return type === "array" || length === 0 || - typeof length === "number" && length > 0 && ( length - 1 ) in obj; -} -var Sizzle = -/*! - * Sizzle CSS Selector Engine v2.3.3 - * https://sizzlejs.com/ - * - * Copyright jQuery Foundation and other contributors - * Released under the MIT license - * http://jquery.org/license - * - * Date: 2016-08-08 - */ -(function( window ) { - -var i, - support, - Expr, - getText, - isXML, - tokenize, - compile, - select, - outermostContext, - sortInput, - hasDuplicate, - - // Local document vars - setDocument, - document, - docElem, - documentIsHTML, - rbuggyQSA, - rbuggyMatches, - matches, - contains, - - // Instance-specific data - expando = "sizzle" + 1 * new Date(), - preferredDoc = window.document, - dirruns = 0, - done = 0, - classCache = createCache(), - tokenCache = createCache(), - compilerCache = createCache(), - sortOrder = function( a, b ) { - if ( a === b ) { - hasDuplicate = true; - } - return 0; - }, - - // Instance methods - hasOwn = ({}).hasOwnProperty, - arr = [], - pop = arr.pop, - push_native = arr.push, - push = arr.push, - slice = arr.slice, - // Use a stripped-down indexOf as it's faster than native - // https://jsperf.com/thor-indexof-vs-for/5 - indexOf = function( list, elem ) { - var i = 0, - len = list.length; - for ( ; i < len; i++ ) { - if ( list[i] === elem ) { - return i; - } - } - return -1; - }, - - booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped", - - // Regular expressions - - // http://www.w3.org/TR/css3-selectors/#whitespace - whitespace = "[\\x20\\t\\r\\n\\f]", - - // http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier - identifier = "(?:\\\\.|[\\w-]|[^\0-\\xa0])+", - - // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors - attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace + - // Operator (capture 2) - "*([*^$|!~]?=)" + whitespace + - // "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]" - "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace + - "*\\]", - - pseudos = ":(" + identifier + ")(?:\\((" + - // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments: - // 1. quoted (capture 3; capture 4 or capture 5) - "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" + - // 2. simple (capture 6) - "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" + - // 3. anything else (capture 2) - ".*" + - ")\\)|)", - - // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter - rwhitespace = new RegExp( whitespace + "+", "g" ), - rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ), - - rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ), - rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ), - - rattributeQuotes = new RegExp( "=" + whitespace + "*([^\\]'\"]*?)" + whitespace + "*\\]", "g" ), - - rpseudo = new RegExp( pseudos ), - ridentifier = new RegExp( "^" + identifier + "$" ), - - matchExpr = { - "ID": new RegExp( "^#(" + identifier + ")" ), - "CLASS": new RegExp( "^\\.(" + identifier + ")" ), - "TAG": new RegExp( "^(" + identifier + "|[*])" ), - "ATTR": new RegExp( "^" + attributes ), - "PSEUDO": new RegExp( "^" + pseudos ), - "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace + - "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace + - "*(\\d+)|))" + whitespace + "*\\)|)", "i" ), - "bool": new RegExp( "^(?:" + booleans + ")$", "i" ), - // For use in libraries implementing .is() - // We use this for POS matching in `select` - "needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + - whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" ) - }, - - rinputs = /^(?:input|select|textarea|button)$/i, - rheader = /^h\d$/i, - - rnative = /^[^{]+\{\s*\[native \w/, - - // Easily-parseable/retrievable ID or TAG or CLASS selectors - rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/, - - rsibling = /[+~]/, - - // CSS escapes - // http://www.w3.org/TR/CSS21/syndata.html#escaped-characters - runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ), - funescape = function( _, escaped, escapedWhitespace ) { - var high = "0x" + escaped - 0x10000; - // NaN means non-codepoint - // Support: Firefox<24 - // Workaround erroneous numeric interpretation of +"0x" - return high !== high || escapedWhitespace ? - escaped : - high < 0 ? - // BMP codepoint - String.fromCharCode( high + 0x10000 ) : - // Supplemental Plane codepoint (surrogate pair) - String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 ); - }, - - // CSS string/identifier serialization - // https://drafts.csswg.org/cssom/#common-serializing-idioms - rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g, - fcssescape = function( ch, asCodePoint ) { - if ( asCodePoint ) { - - // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER - if ( ch === "\0" ) { - return "\uFFFD"; - } - - // Control characters and (dependent upon position) numbers get escaped as code points - return ch.slice( 0, -1 ) + "\\" + ch.charCodeAt( ch.length - 1 ).toString( 16 ) + " "; - } - - // Other potentially-special ASCII characters get backslash-escaped - return "\\" + ch; - }, - - // Used for iframes - // See setDocument() - // Removing the function wrapper causes a "Permission Denied" - // error in IE - unloadHandler = function() { - setDocument(); - }, - - disabledAncestor = addCombinator( - function( elem ) { - return elem.disabled === true && ("form" in elem || "label" in elem); - }, - { dir: "parentNode", next: "legend" } - ); - -// Optimize for push.apply( _, NodeList ) -try { - push.apply( - (arr = slice.call( preferredDoc.childNodes )), - preferredDoc.childNodes - ); - // Support: Android<4.0 - // Detect silently failing push.apply - arr[ preferredDoc.childNodes.length ].nodeType; -} catch ( e ) { - push = { apply: arr.length ? - - // Leverage slice if possible - function( target, els ) { - push_native.apply( target, slice.call(els) ); - } : - - // Support: IE<9 - // Otherwise append directly - function( target, els ) { - var j = target.length, - i = 0; - // Can't trust NodeList.length - while ( (target[j++] = els[i++]) ) {} - target.length = j - 1; - } - }; -} - -function Sizzle( selector, context, results, seed ) { - var m, i, elem, nid, match, groups, newSelector, - newContext = context && context.ownerDocument, - - // nodeType defaults to 9, since context defaults to document - nodeType = context ? context.nodeType : 9; - - results = results || []; - - // Return early from calls with invalid selector or context - if ( typeof selector !== "string" || !selector || - nodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) { - - return results; - } - - // Try to shortcut find operations (as opposed to filters) in HTML documents - if ( !seed ) { - - if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) { - setDocument( context ); - } - context = context || document; - - if ( documentIsHTML ) { - - // If the selector is sufficiently simple, try using a "get*By*" DOM method - // (excepting DocumentFragment context, where the methods don't exist) - if ( nodeType !== 11 && (match = rquickExpr.exec( selector )) ) { - - // ID selector - if ( (m = match[1]) ) { - - // Document context - if ( nodeType === 9 ) { - if ( (elem = context.getElementById( m )) ) { - - // Support: IE, Opera, Webkit - // TODO: identify versions - // getElementById can match elements by name instead of ID - if ( elem.id === m ) { - results.push( elem ); - return results; - } - } else { - return results; - } - - // Element context - } else { - - // Support: IE, Opera, Webkit - // TODO: identify versions - // getElementById can match elements by name instead of ID - if ( newContext && (elem = newContext.getElementById( m )) && - contains( context, elem ) && - elem.id === m ) { - - results.push( elem ); - return results; - } - } - - // Type selector - } else if ( match[2] ) { - push.apply( results, context.getElementsByTagName( selector ) ); - return results; - - // Class selector - } else if ( (m = match[3]) && support.getElementsByClassName && - context.getElementsByClassName ) { - - push.apply( results, context.getElementsByClassName( m ) ); - return results; - } - } - - // Take advantage of querySelectorAll - if ( support.qsa && - !compilerCache[ selector + " " ] && - (!rbuggyQSA || !rbuggyQSA.test( selector )) ) { - - if ( nodeType !== 1 ) { - newContext = context; - newSelector = selector; - - // qSA looks outside Element context, which is not what we want - // Thanks to Andrew Dupont for this workaround technique - // Support: IE <=8 - // Exclude object elements - } else if ( context.nodeName.toLowerCase() !== "object" ) { - - // Capture the context ID, setting it first if necessary - if ( (nid = context.getAttribute( "id" )) ) { - nid = nid.replace( rcssescape, fcssescape ); - } else { - context.setAttribute( "id", (nid = expando) ); - } - - // Prefix every selector in the list - groups = tokenize( selector ); - i = groups.length; - while ( i-- ) { - groups[i] = "#" + nid + " " + toSelector( groups[i] ); - } - newSelector = groups.join( "," ); - - // Expand context for sibling selectors - newContext = rsibling.test( selector ) && testContext( context.parentNode ) || - context; - } - - if ( newSelector ) { - try { - push.apply( results, - newContext.querySelectorAll( newSelector ) - ); - return results; - } catch ( qsaError ) { - } finally { - if ( nid === expando ) { - context.removeAttribute( "id" ); - } - } - } - } - } - } - - // All others - return select( selector.replace( rtrim, "$1" ), context, results, seed ); -} - -/** - * Create key-value caches of limited size - * @returns {function(string, object)} Returns the Object data after storing it on itself with - * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength) - * deleting the oldest entry - */ -function createCache() { - var keys = []; - - function cache( key, value ) { - // Use (key + " ") to avoid collision with native prototype properties (see Issue #157) - if ( keys.push( key + " " ) > Expr.cacheLength ) { - // Only keep the most recent entries - delete cache[ keys.shift() ]; - } - return (cache[ key + " " ] = value); - } - return cache; -} - -/** - * Mark a function for special use by Sizzle - * @param {Function} fn The function to mark - */ -function markFunction( fn ) { - fn[ expando ] = true; - return fn; -} - -/** - * Support testing using an element - * @param {Function} fn Passed the created element and returns a boolean result - */ -function assert( fn ) { - var el = document.createElement("fieldset"); - - try { - return !!fn( el ); - } catch (e) { - return false; - } finally { - // Remove from its parent by default - if ( el.parentNode ) { - el.parentNode.removeChild( el ); - } - // release memory in IE - el = null; - } -} - -/** - * Adds the same handler for all of the specified attrs - * @param {String} attrs Pipe-separated list of attributes - * @param {Function} handler The method that will be applied - */ -function addHandle( attrs, handler ) { - var arr = attrs.split("|"), - i = arr.length; - - while ( i-- ) { - Expr.attrHandle[ arr[i] ] = handler; - } -} - -/** - * Checks document order of two siblings - * @param {Element} a - * @param {Element} b - * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b - */ -function siblingCheck( a, b ) { - var cur = b && a, - diff = cur && a.nodeType === 1 && b.nodeType === 1 && - a.sourceIndex - b.sourceIndex; - - // Use IE sourceIndex if available on both nodes - if ( diff ) { - return diff; - } - - // Check if b follows a - if ( cur ) { - while ( (cur = cur.nextSibling) ) { - if ( cur === b ) { - return -1; - } - } - } - - return a ? 1 : -1; -} - -/** - * Returns a function to use in pseudos for input types - * @param {String} type - */ -function createInputPseudo( type ) { - return function( elem ) { - var name = elem.nodeName.toLowerCase(); - return name === "input" && elem.type === type; - }; -} - -/** - * Returns a function to use in pseudos for buttons - * @param {String} type - */ -function createButtonPseudo( type ) { - return function( elem ) { - var name = elem.nodeName.toLowerCase(); - return (name === "input" || name === "button") && elem.type === type; - }; -} - -/** - * Returns a function to use in pseudos for :enabled/:disabled - * @param {Boolean} disabled true for :disabled; false for :enabled - */ -function createDisabledPseudo( disabled ) { - - // Known :disabled false positives: fieldset[disabled] > legend:nth-of-type(n+2) :can-disable - return function( elem ) { - - // Only certain elements can match :enabled or :disabled - // https://html.spec.whatwg.org/multipage/scripting.html#selector-enabled - // https://html.spec.whatwg.org/multipage/scripting.html#selector-disabled - if ( "form" in elem ) { - - // Check for inherited disabledness on relevant non-disabled elements: - // * listed form-associated elements in a disabled fieldset - // https://html.spec.whatwg.org/multipage/forms.html#category-listed - // https://html.spec.whatwg.org/multipage/forms.html#concept-fe-disabled - // * option elements in a disabled optgroup - // https://html.spec.whatwg.org/multipage/forms.html#concept-option-disabled - // All such elements have a "form" property. - if ( elem.parentNode && elem.disabled === false ) { - - // Option elements defer to a parent optgroup if present - if ( "label" in elem ) { - if ( "label" in elem.parentNode ) { - return elem.parentNode.disabled === disabled; - } else { - return elem.disabled === disabled; - } - } - - // Support: IE 6 - 11 - // Use the isDisabled shortcut property to check for disabled fieldset ancestors - return elem.isDisabled === disabled || - - // Where there is no isDisabled, check manually - /* jshint -W018 */ - elem.isDisabled !== !disabled && - disabledAncestor( elem ) === disabled; - } - - return elem.disabled === disabled; - - // Try to winnow out elements that can't be disabled before trusting the disabled property. - // Some victims get caught in our net (label, legend, menu, track), but it shouldn't - // even exist on them, let alone have a boolean value. - } else if ( "label" in elem ) { - return elem.disabled === disabled; - } - - // Remaining elements are neither :enabled nor :disabled - return false; - }; -} - -/** - * Returns a function to use in pseudos for positionals - * @param {Function} fn - */ -function createPositionalPseudo( fn ) { - return markFunction(function( argument ) { - argument = +argument; - return markFunction(function( seed, matches ) { - var j, - matchIndexes = fn( [], seed.length, argument ), - i = matchIndexes.length; - - // Match elements found at the specified indexes - while ( i-- ) { - if ( seed[ (j = matchIndexes[i]) ] ) { - seed[j] = !(matches[j] = seed[j]); - } - } - }); - }); -} - -/** - * Checks a node for validity as a Sizzle context - * @param {Element|Object=} context - * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value - */ -function testContext( context ) { - return context && typeof context.getElementsByTagName !== "undefined" && context; -} - -// Expose support vars for convenience -support = Sizzle.support = {}; - -/** - * Detects XML nodes - * @param {Element|Object} elem An element or a document - * @returns {Boolean} True iff elem is a non-HTML XML node - */ -isXML = Sizzle.isXML = function( elem ) { - // documentElement is verified for cases where it doesn't yet exist - // (such as loading iframes in IE - #4833) - var documentElement = elem && (elem.ownerDocument || elem).documentElement; - return documentElement ? documentElement.nodeName !== "HTML" : false; -}; - -/** - * Sets document-related variables once based on the current document - * @param {Element|Object} [doc] An element or document object to use to set the document - * @returns {Object} Returns the current document - */ -setDocument = Sizzle.setDocument = function( node ) { - var hasCompare, subWindow, - doc = node ? node.ownerDocument || node : preferredDoc; - - // Return early if doc is invalid or already selected - if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) { - return document; - } - - // Update global variables - document = doc; - docElem = document.documentElement; - documentIsHTML = !isXML( document ); - - // Support: IE 9-11, Edge - // Accessing iframe documents after unload throws "permission denied" errors (jQuery #13936) - if ( preferredDoc !== document && - (subWindow = document.defaultView) && subWindow.top !== subWindow ) { - - // Support: IE 11, Edge - if ( subWindow.addEventListener ) { - subWindow.addEventListener( "unload", unloadHandler, false ); - - // Support: IE 9 - 10 only - } else if ( subWindow.attachEvent ) { - subWindow.attachEvent( "onunload", unloadHandler ); - } - } - - /* Attributes - ---------------------------------------------------------------------- */ - - // Support: IE<8 - // Verify that getAttribute really returns attributes and not properties - // (excepting IE8 booleans) - support.attributes = assert(function( el ) { - el.className = "i"; - return !el.getAttribute("className"); - }); - - /* getElement(s)By* - ---------------------------------------------------------------------- */ - - // Check if getElementsByTagName("*") returns only elements - support.getElementsByTagName = assert(function( el ) { - el.appendChild( document.createComment("") ); - return !el.getElementsByTagName("*").length; - }); - - // Support: IE<9 - support.getElementsByClassName = rnative.test( document.getElementsByClassName ); - - // Support: IE<10 - // Check if getElementById returns elements by name - // The broken getElementById methods don't pick up programmatically-set names, - // so use a roundabout getElementsByName test - support.getById = assert(function( el ) { - docElem.appendChild( el ).id = expando; - return !document.getElementsByName || !document.getElementsByName( expando ).length; - }); - - // ID filter and find - if ( support.getById ) { - Expr.filter["ID"] = function( id ) { - var attrId = id.replace( runescape, funescape ); - return function( elem ) { - return elem.getAttribute("id") === attrId; - }; - }; - Expr.find["ID"] = function( id, context ) { - if ( typeof context.getElementById !== "undefined" && documentIsHTML ) { - var elem = context.getElementById( id ); - return elem ? [ elem ] : []; - } - }; - } else { - Expr.filter["ID"] = function( id ) { - var attrId = id.replace( runescape, funescape ); - return function( elem ) { - var node = typeof elem.getAttributeNode !== "undefined" && - elem.getAttributeNode("id"); - return node && node.value === attrId; - }; - }; - - // Support: IE 6 - 7 only - // getElementById is not reliable as a find shortcut - Expr.find["ID"] = function( id, context ) { - if ( typeof context.getElementById !== "undefined" && documentIsHTML ) { - var node, i, elems, - elem = context.getElementById( id ); - - if ( elem ) { - - // Verify the id attribute - node = elem.getAttributeNode("id"); - if ( node && node.value === id ) { - return [ elem ]; - } - - // Fall back on getElementsByName - elems = context.getElementsByName( id ); - i = 0; - while ( (elem = elems[i++]) ) { - node = elem.getAttributeNode("id"); - if ( node && node.value === id ) { - return [ elem ]; - } - } - } - - return []; - } - }; - } - - // Tag - Expr.find["TAG"] = support.getElementsByTagName ? - function( tag, context ) { - if ( typeof context.getElementsByTagName !== "undefined" ) { - return context.getElementsByTagName( tag ); - - // DocumentFragment nodes don't have gEBTN - } else if ( support.qsa ) { - return context.querySelectorAll( tag ); - } - } : - - function( tag, context ) { - var elem, - tmp = [], - i = 0, - // By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too - results = context.getElementsByTagName( tag ); - - // Filter out possible comments - if ( tag === "*" ) { - while ( (elem = results[i++]) ) { - if ( elem.nodeType === 1 ) { - tmp.push( elem ); - } - } - - return tmp; - } - return results; - }; - - // Class - Expr.find["CLASS"] = support.getElementsByClassName && function( className, context ) { - if ( typeof context.getElementsByClassName !== "undefined" && documentIsHTML ) { - return context.getElementsByClassName( className ); - } - }; - - /* QSA/matchesSelector - ---------------------------------------------------------------------- */ - - // QSA and matchesSelector support - - // matchesSelector(:active) reports false when true (IE9/Opera 11.5) - rbuggyMatches = []; - - // qSa(:focus) reports false when true (Chrome 21) - // We allow this because of a bug in IE8/9 that throws an error - // whenever `document.activeElement` is accessed on an iframe - // So, we allow :focus to pass through QSA all the time to avoid the IE error - // See https://bugs.jquery.com/ticket/13378 - rbuggyQSA = []; - - if ( (support.qsa = rnative.test( document.querySelectorAll )) ) { - // Build QSA regex - // Regex strategy adopted from Diego Perini - assert(function( el ) { - // Select is set to empty string on purpose - // This is to test IE's treatment of not explicitly - // setting a boolean content attribute, - // since its presence should be enough - // https://bugs.jquery.com/ticket/12359 - docElem.appendChild( el ).innerHTML = "" + - ""; - - // Support: IE8, Opera 11-12.16 - // Nothing should be selected when empty strings follow ^= or $= or *= - // The test attribute must be unknown in Opera but "safe" for WinRT - // https://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section - if ( el.querySelectorAll("[msallowcapture^='']").length ) { - rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" ); - } - - // Support: IE8 - // Boolean attributes and "value" are not treated correctly - if ( !el.querySelectorAll("[selected]").length ) { - rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" ); - } - - // Support: Chrome<29, Android<4.4, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.8+ - if ( !el.querySelectorAll( "[id~=" + expando + "-]" ).length ) { - rbuggyQSA.push("~="); - } - - // Webkit/Opera - :checked should return selected option elements - // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked - // IE8 throws error here and will not see later tests - if ( !el.querySelectorAll(":checked").length ) { - rbuggyQSA.push(":checked"); - } - - // Support: Safari 8+, iOS 8+ - // https://bugs.webkit.org/show_bug.cgi?id=136851 - // In-page `selector#id sibling-combinator selector` fails - if ( !el.querySelectorAll( "a#" + expando + "+*" ).length ) { - rbuggyQSA.push(".#.+[+~]"); - } - }); - - assert(function( el ) { - el.innerHTML = "" + - ""; - - // Support: Windows 8 Native Apps - // The type and name attributes are restricted during .innerHTML assignment - var input = document.createElement("input"); - input.setAttribute( "type", "hidden" ); - el.appendChild( input ).setAttribute( "name", "D" ); - - // Support: IE8 - // Enforce case-sensitivity of name attribute - if ( el.querySelectorAll("[name=d]").length ) { - rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" ); - } - - // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled) - // IE8 throws error here and will not see later tests - if ( el.querySelectorAll(":enabled").length !== 2 ) { - rbuggyQSA.push( ":enabled", ":disabled" ); - } - - // Support: IE9-11+ - // IE's :disabled selector does not pick up the children of disabled fieldsets - docElem.appendChild( el ).disabled = true; - if ( el.querySelectorAll(":disabled").length !== 2 ) { - rbuggyQSA.push( ":enabled", ":disabled" ); - } - - // Opera 10-11 does not throw on post-comma invalid pseudos - el.querySelectorAll("*,:x"); - rbuggyQSA.push(",.*:"); - }); - } - - if ( (support.matchesSelector = rnative.test( (matches = docElem.matches || - docElem.webkitMatchesSelector || - docElem.mozMatchesSelector || - docElem.oMatchesSelector || - docElem.msMatchesSelector) )) ) { - - assert(function( el ) { - // Check to see if it's possible to do matchesSelector - // on a disconnected node (IE 9) - support.disconnectedMatch = matches.call( el, "*" ); - - // This should fail with an exception - // Gecko does not error, returns false instead - matches.call( el, "[s!='']:x" ); - rbuggyMatches.push( "!=", pseudos ); - }); - } - - rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join("|") ); - rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join("|") ); - - /* Contains - ---------------------------------------------------------------------- */ - hasCompare = rnative.test( docElem.compareDocumentPosition ); - - // Element contains another - // Purposefully self-exclusive - // As in, an element does not contain itself - contains = hasCompare || rnative.test( docElem.contains ) ? - function( a, b ) { - var adown = a.nodeType === 9 ? a.documentElement : a, - bup = b && b.parentNode; - return a === bup || !!( bup && bup.nodeType === 1 && ( - adown.contains ? - adown.contains( bup ) : - a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16 - )); - } : - function( a, b ) { - if ( b ) { - while ( (b = b.parentNode) ) { - if ( b === a ) { - return true; - } - } - } - return false; - }; - - /* Sorting - ---------------------------------------------------------------------- */ - - // Document order sorting - sortOrder = hasCompare ? - function( a, b ) { - - // Flag for duplicate removal - if ( a === b ) { - hasDuplicate = true; - return 0; - } - - // Sort on method existence if only one input has compareDocumentPosition - var compare = !a.compareDocumentPosition - !b.compareDocumentPosition; - if ( compare ) { - return compare; - } - - // Calculate position if both inputs belong to the same document - compare = ( a.ownerDocument || a ) === ( b.ownerDocument || b ) ? - a.compareDocumentPosition( b ) : - - // Otherwise we know they are disconnected - 1; - - // Disconnected nodes - if ( compare & 1 || - (!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) { - - // Choose the first element that is related to our preferred document - if ( a === document || a.ownerDocument === preferredDoc && contains(preferredDoc, a) ) { - return -1; - } - if ( b === document || b.ownerDocument === preferredDoc && contains(preferredDoc, b) ) { - return 1; - } - - // Maintain original order - return sortInput ? - ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) : - 0; - } - - return compare & 4 ? -1 : 1; - } : - function( a, b ) { - // Exit early if the nodes are identical - if ( a === b ) { - hasDuplicate = true; - return 0; - } - - var cur, - i = 0, - aup = a.parentNode, - bup = b.parentNode, - ap = [ a ], - bp = [ b ]; - - // Parentless nodes are either documents or disconnected - if ( !aup || !bup ) { - return a === document ? -1 : - b === document ? 1 : - aup ? -1 : - bup ? 1 : - sortInput ? - ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) : - 0; - - // If the nodes are siblings, we can do a quick check - } else if ( aup === bup ) { - return siblingCheck( a, b ); - } - - // Otherwise we need full lists of their ancestors for comparison - cur = a; - while ( (cur = cur.parentNode) ) { - ap.unshift( cur ); - } - cur = b; - while ( (cur = cur.parentNode) ) { - bp.unshift( cur ); - } - - // Walk down the tree looking for a discrepancy - while ( ap[i] === bp[i] ) { - i++; - } - - return i ? - // Do a sibling check if the nodes have a common ancestor - siblingCheck( ap[i], bp[i] ) : - - // Otherwise nodes in our document sort first - ap[i] === preferredDoc ? -1 : - bp[i] === preferredDoc ? 1 : - 0; - }; - - return document; -}; - -Sizzle.matches = function( expr, elements ) { - return Sizzle( expr, null, null, elements ); -}; - -Sizzle.matchesSelector = function( elem, expr ) { - // Set document vars if needed - if ( ( elem.ownerDocument || elem ) !== document ) { - setDocument( elem ); - } - - // Make sure that attribute selectors are quoted - expr = expr.replace( rattributeQuotes, "='$1']" ); - - if ( support.matchesSelector && documentIsHTML && - !compilerCache[ expr + " " ] && - ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) && - ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) { - - try { - var ret = matches.call( elem, expr ); - - // IE 9's matchesSelector returns false on disconnected nodes - if ( ret || support.disconnectedMatch || - // As well, disconnected nodes are said to be in a document - // fragment in IE 9 - elem.document && elem.document.nodeType !== 11 ) { - return ret; - } - } catch (e) {} - } - - return Sizzle( expr, document, null, [ elem ] ).length > 0; -}; - -Sizzle.contains = function( context, elem ) { - // Set document vars if needed - if ( ( context.ownerDocument || context ) !== document ) { - setDocument( context ); - } - return contains( context, elem ); -}; - -Sizzle.attr = function( elem, name ) { - // Set document vars if needed - if ( ( elem.ownerDocument || elem ) !== document ) { - setDocument( elem ); - } - - var fn = Expr.attrHandle[ name.toLowerCase() ], - // Don't get fooled by Object.prototype properties (jQuery #13807) - val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ? - fn( elem, name, !documentIsHTML ) : - undefined; - - return val !== undefined ? - val : - support.attributes || !documentIsHTML ? - elem.getAttribute( name ) : - (val = elem.getAttributeNode(name)) && val.specified ? - val.value : - null; -}; - -Sizzle.escape = function( sel ) { - return (sel + "").replace( rcssescape, fcssescape ); -}; - -Sizzle.error = function( msg ) { - throw new Error( "Syntax error, unrecognized expression: " + msg ); -}; - -/** - * Document sorting and removing duplicates - * @param {ArrayLike} results - */ -Sizzle.uniqueSort = function( results ) { - var elem, - duplicates = [], - j = 0, - i = 0; - - // Unless we *know* we can detect duplicates, assume their presence - hasDuplicate = !support.detectDuplicates; - sortInput = !support.sortStable && results.slice( 0 ); - results.sort( sortOrder ); - - if ( hasDuplicate ) { - while ( (elem = results[i++]) ) { - if ( elem === results[ i ] ) { - j = duplicates.push( i ); - } - } - while ( j-- ) { - results.splice( duplicates[ j ], 1 ); - } - } - - // Clear input after sorting to release objects - // See https://github.com/jquery/sizzle/pull/225 - sortInput = null; - - return results; -}; - -/** - * Utility function for retrieving the text value of an array of DOM nodes - * @param {Array|Element} elem - */ -getText = Sizzle.getText = function( elem ) { - var node, - ret = "", - i = 0, - nodeType = elem.nodeType; - - if ( !nodeType ) { - // If no nodeType, this is expected to be an array - while ( (node = elem[i++]) ) { - // Do not traverse comment nodes - ret += getText( node ); - } - } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) { - // Use textContent for elements - // innerText usage removed for consistency of new lines (jQuery #11153) - if ( typeof elem.textContent === "string" ) { - return elem.textContent; - } else { - // Traverse its children - for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { - ret += getText( elem ); - } - } - } else if ( nodeType === 3 || nodeType === 4 ) { - return elem.nodeValue; - } - // Do not include comment or processing instruction nodes - - return ret; -}; - -Expr = Sizzle.selectors = { - - // Can be adjusted by the user - cacheLength: 50, - - createPseudo: markFunction, - - match: matchExpr, - - attrHandle: {}, - - find: {}, - - relative: { - ">": { dir: "parentNode", first: true }, - " ": { dir: "parentNode" }, - "+": { dir: "previousSibling", first: true }, - "~": { dir: "previousSibling" } - }, - - preFilter: { - "ATTR": function( match ) { - match[1] = match[1].replace( runescape, funescape ); - - // Move the given value to match[3] whether quoted or unquoted - match[3] = ( match[3] || match[4] || match[5] || "" ).replace( runescape, funescape ); - - if ( match[2] === "~=" ) { - match[3] = " " + match[3] + " "; - } - - return match.slice( 0, 4 ); - }, - - "CHILD": function( match ) { - /* matches from matchExpr["CHILD"] - 1 type (only|nth|...) - 2 what (child|of-type) - 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...) - 4 xn-component of xn+y argument ([+-]?\d*n|) - 5 sign of xn-component - 6 x of xn-component - 7 sign of y-component - 8 y of y-component - */ - match[1] = match[1].toLowerCase(); - - if ( match[1].slice( 0, 3 ) === "nth" ) { - // nth-* requires argument - if ( !match[3] ) { - Sizzle.error( match[0] ); - } - - // numeric x and y parameters for Expr.filter.CHILD - // remember that false/true cast respectively to 0/1 - match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) ); - match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" ); - - // other types prohibit arguments - } else if ( match[3] ) { - Sizzle.error( match[0] ); - } - - return match; - }, - - "PSEUDO": function( match ) { - var excess, - unquoted = !match[6] && match[2]; - - if ( matchExpr["CHILD"].test( match[0] ) ) { - return null; - } - - // Accept quoted arguments as-is - if ( match[3] ) { - match[2] = match[4] || match[5] || ""; - - // Strip excess characters from unquoted arguments - } else if ( unquoted && rpseudo.test( unquoted ) && - // Get excess from tokenize (recursively) - (excess = tokenize( unquoted, true )) && - // advance to the next closing parenthesis - (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) { - - // excess is a negative index - match[0] = match[0].slice( 0, excess ); - match[2] = unquoted.slice( 0, excess ); - } - - // Return only captures needed by the pseudo filter method (type and argument) - return match.slice( 0, 3 ); - } - }, - - filter: { - - "TAG": function( nodeNameSelector ) { - var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase(); - return nodeNameSelector === "*" ? - function() { return true; } : - function( elem ) { - return elem.nodeName && elem.nodeName.toLowerCase() === nodeName; - }; - }, - - "CLASS": function( className ) { - var pattern = classCache[ className + " " ]; - - return pattern || - (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) && - classCache( className, function( elem ) { - return pattern.test( typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== "undefined" && elem.getAttribute("class") || "" ); - }); - }, - - "ATTR": function( name, operator, check ) { - return function( elem ) { - var result = Sizzle.attr( elem, name ); - - if ( result == null ) { - return operator === "!="; - } - if ( !operator ) { - return true; - } - - result += ""; - - return operator === "=" ? result === check : - operator === "!=" ? result !== check : - operator === "^=" ? check && result.indexOf( check ) === 0 : - operator === "*=" ? check && result.indexOf( check ) > -1 : - operator === "$=" ? check && result.slice( -check.length ) === check : - operator === "~=" ? ( " " + result.replace( rwhitespace, " " ) + " " ).indexOf( check ) > -1 : - operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" : - false; - }; - }, - - "CHILD": function( type, what, argument, first, last ) { - var simple = type.slice( 0, 3 ) !== "nth", - forward = type.slice( -4 ) !== "last", - ofType = what === "of-type"; - - return first === 1 && last === 0 ? - - // Shortcut for :nth-*(n) - function( elem ) { - return !!elem.parentNode; - } : - - function( elem, context, xml ) { - var cache, uniqueCache, outerCache, node, nodeIndex, start, - dir = simple !== forward ? "nextSibling" : "previousSibling", - parent = elem.parentNode, - name = ofType && elem.nodeName.toLowerCase(), - useCache = !xml && !ofType, - diff = false; - - if ( parent ) { - - // :(first|last|only)-(child|of-type) - if ( simple ) { - while ( dir ) { - node = elem; - while ( (node = node[ dir ]) ) { - if ( ofType ? - node.nodeName.toLowerCase() === name : - node.nodeType === 1 ) { - - return false; - } - } - // Reverse direction for :only-* (if we haven't yet done so) - start = dir = type === "only" && !start && "nextSibling"; - } - return true; - } - - start = [ forward ? parent.firstChild : parent.lastChild ]; - - // non-xml :nth-child(...) stores cache data on `parent` - if ( forward && useCache ) { - - // Seek `elem` from a previously-cached index - - // ...in a gzip-friendly way - node = parent; - outerCache = node[ expando ] || (node[ expando ] = {}); - - // Support: IE <9 only - // Defend against cloned attroperties (jQuery gh-1709) - uniqueCache = outerCache[ node.uniqueID ] || - (outerCache[ node.uniqueID ] = {}); - - cache = uniqueCache[ type ] || []; - nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ]; - diff = nodeIndex && cache[ 2 ]; - node = nodeIndex && parent.childNodes[ nodeIndex ]; - - while ( (node = ++nodeIndex && node && node[ dir ] || - - // Fallback to seeking `elem` from the start - (diff = nodeIndex = 0) || start.pop()) ) { - - // When found, cache indexes on `parent` and break - if ( node.nodeType === 1 && ++diff && node === elem ) { - uniqueCache[ type ] = [ dirruns, nodeIndex, diff ]; - break; - } - } - - } else { - // Use previously-cached element index if available - if ( useCache ) { - // ...in a gzip-friendly way - node = elem; - outerCache = node[ expando ] || (node[ expando ] = {}); - - // Support: IE <9 only - // Defend against cloned attroperties (jQuery gh-1709) - uniqueCache = outerCache[ node.uniqueID ] || - (outerCache[ node.uniqueID ] = {}); - - cache = uniqueCache[ type ] || []; - nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ]; - diff = nodeIndex; - } - - // xml :nth-child(...) - // or :nth-last-child(...) or :nth(-last)?-of-type(...) - if ( diff === false ) { - // Use the same loop as above to seek `elem` from the start - while ( (node = ++nodeIndex && node && node[ dir ] || - (diff = nodeIndex = 0) || start.pop()) ) { - - if ( ( ofType ? - node.nodeName.toLowerCase() === name : - node.nodeType === 1 ) && - ++diff ) { - - // Cache the index of each encountered element - if ( useCache ) { - outerCache = node[ expando ] || (node[ expando ] = {}); - - // Support: IE <9 only - // Defend against cloned attroperties (jQuery gh-1709) - uniqueCache = outerCache[ node.uniqueID ] || - (outerCache[ node.uniqueID ] = {}); - - uniqueCache[ type ] = [ dirruns, diff ]; - } - - if ( node === elem ) { - break; - } - } - } - } - } - - // Incorporate the offset, then check against cycle size - diff -= last; - return diff === first || ( diff % first === 0 && diff / first >= 0 ); - } - }; - }, - - "PSEUDO": function( pseudo, argument ) { - // pseudo-class names are case-insensitive - // http://www.w3.org/TR/selectors/#pseudo-classes - // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters - // Remember that setFilters inherits from pseudos - var args, - fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] || - Sizzle.error( "unsupported pseudo: " + pseudo ); - - // The user may use createPseudo to indicate that - // arguments are needed to create the filter function - // just as Sizzle does - if ( fn[ expando ] ) { - return fn( argument ); - } - - // But maintain support for old signatures - if ( fn.length > 1 ) { - args = [ pseudo, pseudo, "", argument ]; - return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ? - markFunction(function( seed, matches ) { - var idx, - matched = fn( seed, argument ), - i = matched.length; - while ( i-- ) { - idx = indexOf( seed, matched[i] ); - seed[ idx ] = !( matches[ idx ] = matched[i] ); - } - }) : - function( elem ) { - return fn( elem, 0, args ); - }; - } - - return fn; - } - }, - - pseudos: { - // Potentially complex pseudos - "not": markFunction(function( selector ) { - // Trim the selector passed to compile - // to avoid treating leading and trailing - // spaces as combinators - var input = [], - results = [], - matcher = compile( selector.replace( rtrim, "$1" ) ); - - return matcher[ expando ] ? - markFunction(function( seed, matches, context, xml ) { - var elem, - unmatched = matcher( seed, null, xml, [] ), - i = seed.length; - - // Match elements unmatched by `matcher` - while ( i-- ) { - if ( (elem = unmatched[i]) ) { - seed[i] = !(matches[i] = elem); - } - } - }) : - function( elem, context, xml ) { - input[0] = elem; - matcher( input, null, xml, results ); - // Don't keep the element (issue #299) - input[0] = null; - return !results.pop(); - }; - }), - - "has": markFunction(function( selector ) { - return function( elem ) { - return Sizzle( selector, elem ).length > 0; - }; - }), - - "contains": markFunction(function( text ) { - text = text.replace( runescape, funescape ); - return function( elem ) { - return ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1; - }; - }), - - // "Whether an element is represented by a :lang() selector - // is based solely on the element's language value - // being equal to the identifier C, - // or beginning with the identifier C immediately followed by "-". - // The matching of C against the element's language value is performed case-insensitively. - // The identifier C does not have to be a valid language name." - // http://www.w3.org/TR/selectors/#lang-pseudo - "lang": markFunction( function( lang ) { - // lang value must be a valid identifier - if ( !ridentifier.test(lang || "") ) { - Sizzle.error( "unsupported lang: " + lang ); - } - lang = lang.replace( runescape, funescape ).toLowerCase(); - return function( elem ) { - var elemLang; - do { - if ( (elemLang = documentIsHTML ? - elem.lang : - elem.getAttribute("xml:lang") || elem.getAttribute("lang")) ) { - - elemLang = elemLang.toLowerCase(); - return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0; - } - } while ( (elem = elem.parentNode) && elem.nodeType === 1 ); - return false; - }; - }), - - // Miscellaneous - "target": function( elem ) { - var hash = window.location && window.location.hash; - return hash && hash.slice( 1 ) === elem.id; - }, - - "root": function( elem ) { - return elem === docElem; - }, - - "focus": function( elem ) { - return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex); - }, - - // Boolean properties - "enabled": createDisabledPseudo( false ), - "disabled": createDisabledPseudo( true ), - - "checked": function( elem ) { - // In CSS3, :checked should return both checked and selected elements - // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked - var nodeName = elem.nodeName.toLowerCase(); - return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected); - }, - - "selected": function( elem ) { - // Accessing this property makes selected-by-default - // options in Safari work properly - if ( elem.parentNode ) { - elem.parentNode.selectedIndex; - } - - return elem.selected === true; - }, - - // Contents - "empty": function( elem ) { - // http://www.w3.org/TR/selectors/#empty-pseudo - // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5), - // but not by others (comment: 8; processing instruction: 7; etc.) - // nodeType < 6 works because attributes (2) do not appear as children - for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { - if ( elem.nodeType < 6 ) { - return false; - } - } - return true; - }, - - "parent": function( elem ) { - return !Expr.pseudos["empty"]( elem ); - }, - - // Element/input types - "header": function( elem ) { - return rheader.test( elem.nodeName ); - }, - - "input": function( elem ) { - return rinputs.test( elem.nodeName ); - }, - - "button": function( elem ) { - var name = elem.nodeName.toLowerCase(); - return name === "input" && elem.type === "button" || name === "button"; - }, - - "text": function( elem ) { - var attr; - return elem.nodeName.toLowerCase() === "input" && - elem.type === "text" && - - // Support: IE<8 - // New HTML5 attribute values (e.g., "search") appear with elem.type === "text" - ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text" ); - }, - - // Position-in-collection - "first": createPositionalPseudo(function() { - return [ 0 ]; - }), - - "last": createPositionalPseudo(function( matchIndexes, length ) { - return [ length - 1 ]; - }), - - "eq": createPositionalPseudo(function( matchIndexes, length, argument ) { - return [ argument < 0 ? argument + length : argument ]; - }), - - "even": createPositionalPseudo(function( matchIndexes, length ) { - var i = 0; - for ( ; i < length; i += 2 ) { - matchIndexes.push( i ); - } - return matchIndexes; - }), - - "odd": createPositionalPseudo(function( matchIndexes, length ) { - var i = 1; - for ( ; i < length; i += 2 ) { - matchIndexes.push( i ); - } - return matchIndexes; - }), - - "lt": createPositionalPseudo(function( matchIndexes, length, argument ) { - var i = argument < 0 ? argument + length : argument; - for ( ; --i >= 0; ) { - matchIndexes.push( i ); - } - return matchIndexes; - }), - - "gt": createPositionalPseudo(function( matchIndexes, length, argument ) { - var i = argument < 0 ? argument + length : argument; - for ( ; ++i < length; ) { - matchIndexes.push( i ); - } - return matchIndexes; - }) - } -}; - -Expr.pseudos["nth"] = Expr.pseudos["eq"]; - -// Add button/input type pseudos -for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) { - Expr.pseudos[ i ] = createInputPseudo( i ); -} -for ( i in { submit: true, reset: true } ) { - Expr.pseudos[ i ] = createButtonPseudo( i ); -} - -// Easy API for creating new setFilters -function setFilters() {} -setFilters.prototype = Expr.filters = Expr.pseudos; -Expr.setFilters = new setFilters(); - -tokenize = Sizzle.tokenize = function( selector, parseOnly ) { - var matched, match, tokens, type, - soFar, groups, preFilters, - cached = tokenCache[ selector + " " ]; - - if ( cached ) { - return parseOnly ? 0 : cached.slice( 0 ); - } - - soFar = selector; - groups = []; - preFilters = Expr.preFilter; - - while ( soFar ) { - - // Comma and first run - if ( !matched || (match = rcomma.exec( soFar )) ) { - if ( match ) { - // Don't consume trailing commas as valid - soFar = soFar.slice( match[0].length ) || soFar; - } - groups.push( (tokens = []) ); - } - - matched = false; - - // Combinators - if ( (match = rcombinators.exec( soFar )) ) { - matched = match.shift(); - tokens.push({ - value: matched, - // Cast descendant combinators to space - type: match[0].replace( rtrim, " " ) - }); - soFar = soFar.slice( matched.length ); - } - - // Filters - for ( type in Expr.filter ) { - if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] || - (match = preFilters[ type ]( match ))) ) { - matched = match.shift(); - tokens.push({ - value: matched, - type: type, - matches: match - }); - soFar = soFar.slice( matched.length ); - } - } - - if ( !matched ) { - break; - } - } - - // Return the length of the invalid excess - // if we're just parsing - // Otherwise, throw an error or return tokens - return parseOnly ? - soFar.length : - soFar ? - Sizzle.error( selector ) : - // Cache the tokens - tokenCache( selector, groups ).slice( 0 ); -}; - -function toSelector( tokens ) { - var i = 0, - len = tokens.length, - selector = ""; - for ( ; i < len; i++ ) { - selector += tokens[i].value; - } - return selector; -} - -function addCombinator( matcher, combinator, base ) { - var dir = combinator.dir, - skip = combinator.next, - key = skip || dir, - checkNonElements = base && key === "parentNode", - doneName = done++; - - return combinator.first ? - // Check against closest ancestor/preceding element - function( elem, context, xml ) { - while ( (elem = elem[ dir ]) ) { - if ( elem.nodeType === 1 || checkNonElements ) { - return matcher( elem, context, xml ); - } - } - return false; - } : - - // Check against all ancestor/preceding elements - function( elem, context, xml ) { - var oldCache, uniqueCache, outerCache, - newCache = [ dirruns, doneName ]; - - // We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching - if ( xml ) { - while ( (elem = elem[ dir ]) ) { - if ( elem.nodeType === 1 || checkNonElements ) { - if ( matcher( elem, context, xml ) ) { - return true; - } - } - } - } else { - while ( (elem = elem[ dir ]) ) { - if ( elem.nodeType === 1 || checkNonElements ) { - outerCache = elem[ expando ] || (elem[ expando ] = {}); - - // Support: IE <9 only - // Defend against cloned attroperties (jQuery gh-1709) - uniqueCache = outerCache[ elem.uniqueID ] || (outerCache[ elem.uniqueID ] = {}); - - if ( skip && skip === elem.nodeName.toLowerCase() ) { - elem = elem[ dir ] || elem; - } else if ( (oldCache = uniqueCache[ key ]) && - oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) { - - // Assign to newCache so results back-propagate to previous elements - return (newCache[ 2 ] = oldCache[ 2 ]); - } else { - // Reuse newcache so results back-propagate to previous elements - uniqueCache[ key ] = newCache; - - // A match means we're done; a fail means we have to keep checking - if ( (newCache[ 2 ] = matcher( elem, context, xml )) ) { - return true; - } - } - } - } - } - return false; - }; -} - -function elementMatcher( matchers ) { - return matchers.length > 1 ? - function( elem, context, xml ) { - var i = matchers.length; - while ( i-- ) { - if ( !matchers[i]( elem, context, xml ) ) { - return false; - } - } - return true; - } : - matchers[0]; -} - -function multipleContexts( selector, contexts, results ) { - var i = 0, - len = contexts.length; - for ( ; i < len; i++ ) { - Sizzle( selector, contexts[i], results ); - } - return results; -} - -function condense( unmatched, map, filter, context, xml ) { - var elem, - newUnmatched = [], - i = 0, - len = unmatched.length, - mapped = map != null; - - for ( ; i < len; i++ ) { - if ( (elem = unmatched[i]) ) { - if ( !filter || filter( elem, context, xml ) ) { - newUnmatched.push( elem ); - if ( mapped ) { - map.push( i ); - } - } - } - } - - return newUnmatched; -} - -function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) { - if ( postFilter && !postFilter[ expando ] ) { - postFilter = setMatcher( postFilter ); - } - if ( postFinder && !postFinder[ expando ] ) { - postFinder = setMatcher( postFinder, postSelector ); - } - return markFunction(function( seed, results, context, xml ) { - var temp, i, elem, - preMap = [], - postMap = [], - preexisting = results.length, - - // Get initial elements from seed or context - elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ), - - // Prefilter to get matcher input, preserving a map for seed-results synchronization - matcherIn = preFilter && ( seed || !selector ) ? - condense( elems, preMap, preFilter, context, xml ) : - elems, - - matcherOut = matcher ? - // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results, - postFinder || ( seed ? preFilter : preexisting || postFilter ) ? - - // ...intermediate processing is necessary - [] : - - // ...otherwise use results directly - results : - matcherIn; - - // Find primary matches - if ( matcher ) { - matcher( matcherIn, matcherOut, context, xml ); - } - - // Apply postFilter - if ( postFilter ) { - temp = condense( matcherOut, postMap ); - postFilter( temp, [], context, xml ); - - // Un-match failing elements by moving them back to matcherIn - i = temp.length; - while ( i-- ) { - if ( (elem = temp[i]) ) { - matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem); - } - } - } - - if ( seed ) { - if ( postFinder || preFilter ) { - if ( postFinder ) { - // Get the final matcherOut by condensing this intermediate into postFinder contexts - temp = []; - i = matcherOut.length; - while ( i-- ) { - if ( (elem = matcherOut[i]) ) { - // Restore matcherIn since elem is not yet a final match - temp.push( (matcherIn[i] = elem) ); - } - } - postFinder( null, (matcherOut = []), temp, xml ); - } - - // Move matched elements from seed to results to keep them synchronized - i = matcherOut.length; - while ( i-- ) { - if ( (elem = matcherOut[i]) && - (temp = postFinder ? indexOf( seed, elem ) : preMap[i]) > -1 ) { - - seed[temp] = !(results[temp] = elem); - } - } - } - - // Add elements to results, through postFinder if defined - } else { - matcherOut = condense( - matcherOut === results ? - matcherOut.splice( preexisting, matcherOut.length ) : - matcherOut - ); - if ( postFinder ) { - postFinder( null, results, matcherOut, xml ); - } else { - push.apply( results, matcherOut ); - } - } - }); -} - -function matcherFromTokens( tokens ) { - var checkContext, matcher, j, - len = tokens.length, - leadingRelative = Expr.relative[ tokens[0].type ], - implicitRelative = leadingRelative || Expr.relative[" "], - i = leadingRelative ? 1 : 0, - - // The foundational matcher ensures that elements are reachable from top-level context(s) - matchContext = addCombinator( function( elem ) { - return elem === checkContext; - }, implicitRelative, true ), - matchAnyContext = addCombinator( function( elem ) { - return indexOf( checkContext, elem ) > -1; - }, implicitRelative, true ), - matchers = [ function( elem, context, xml ) { - var ret = ( !leadingRelative && ( xml || context !== outermostContext ) ) || ( - (checkContext = context).nodeType ? - matchContext( elem, context, xml ) : - matchAnyContext( elem, context, xml ) ); - // Avoid hanging onto element (issue #299) - checkContext = null; - return ret; - } ]; - - for ( ; i < len; i++ ) { - if ( (matcher = Expr.relative[ tokens[i].type ]) ) { - matchers = [ addCombinator(elementMatcher( matchers ), matcher) ]; - } else { - matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches ); - - // Return special upon seeing a positional matcher - if ( matcher[ expando ] ) { - // Find the next relative operator (if any) for proper handling - j = ++i; - for ( ; j < len; j++ ) { - if ( Expr.relative[ tokens[j].type ] ) { - break; - } - } - return setMatcher( - i > 1 && elementMatcher( matchers ), - i > 1 && toSelector( - // If the preceding token was a descendant combinator, insert an implicit any-element `*` - tokens.slice( 0, i - 1 ).concat({ value: tokens[ i - 2 ].type === " " ? "*" : "" }) - ).replace( rtrim, "$1" ), - matcher, - i < j && matcherFromTokens( tokens.slice( i, j ) ), - j < len && matcherFromTokens( (tokens = tokens.slice( j )) ), - j < len && toSelector( tokens ) - ); - } - matchers.push( matcher ); - } - } - - return elementMatcher( matchers ); -} - -function matcherFromGroupMatchers( elementMatchers, setMatchers ) { - var bySet = setMatchers.length > 0, - byElement = elementMatchers.length > 0, - superMatcher = function( seed, context, xml, results, outermost ) { - var elem, j, matcher, - matchedCount = 0, - i = "0", - unmatched = seed && [], - setMatched = [], - contextBackup = outermostContext, - // We must always have either seed elements or outermost context - elems = seed || byElement && Expr.find["TAG"]( "*", outermost ), - // Use integer dirruns iff this is the outermost matcher - dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1), - len = elems.length; - - if ( outermost ) { - outermostContext = context === document || context || outermost; - } - - // Add elements passing elementMatchers directly to results - // Support: IE<9, Safari - // Tolerate NodeList properties (IE: "length"; Safari: ) matching elements by id - for ( ; i !== len && (elem = elems[i]) != null; i++ ) { - if ( byElement && elem ) { - j = 0; - if ( !context && elem.ownerDocument !== document ) { - setDocument( elem ); - xml = !documentIsHTML; - } - while ( (matcher = elementMatchers[j++]) ) { - if ( matcher( elem, context || document, xml) ) { - results.push( elem ); - break; - } - } - if ( outermost ) { - dirruns = dirrunsUnique; - } - } - - // Track unmatched elements for set filters - if ( bySet ) { - // They will have gone through all possible matchers - if ( (elem = !matcher && elem) ) { - matchedCount--; - } - - // Lengthen the array for every element, matched or not - if ( seed ) { - unmatched.push( elem ); - } - } - } - - // `i` is now the count of elements visited above, and adding it to `matchedCount` - // makes the latter nonnegative. - matchedCount += i; - - // Apply set filters to unmatched elements - // NOTE: This can be skipped if there are no unmatched elements (i.e., `matchedCount` - // equals `i`), unless we didn't visit _any_ elements in the above loop because we have - // no element matchers and no seed. - // Incrementing an initially-string "0" `i` allows `i` to remain a string only in that - // case, which will result in a "00" `matchedCount` that differs from `i` but is also - // numerically zero. - if ( bySet && i !== matchedCount ) { - j = 0; - while ( (matcher = setMatchers[j++]) ) { - matcher( unmatched, setMatched, context, xml ); - } - - if ( seed ) { - // Reintegrate element matches to eliminate the need for sorting - if ( matchedCount > 0 ) { - while ( i-- ) { - if ( !(unmatched[i] || setMatched[i]) ) { - setMatched[i] = pop.call( results ); - } - } - } - - // Discard index placeholder values to get only actual matches - setMatched = condense( setMatched ); - } - - // Add matches to results - push.apply( results, setMatched ); - - // Seedless set matches succeeding multiple successful matchers stipulate sorting - if ( outermost && !seed && setMatched.length > 0 && - ( matchedCount + setMatchers.length ) > 1 ) { - - Sizzle.uniqueSort( results ); - } - } - - // Override manipulation of globals by nested matchers - if ( outermost ) { - dirruns = dirrunsUnique; - outermostContext = contextBackup; - } - - return unmatched; - }; - - return bySet ? - markFunction( superMatcher ) : - superMatcher; -} - -compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) { - var i, - setMatchers = [], - elementMatchers = [], - cached = compilerCache[ selector + " " ]; - - if ( !cached ) { - // Generate a function of recursive functions that can be used to check each element - if ( !match ) { - match = tokenize( selector ); - } - i = match.length; - while ( i-- ) { - cached = matcherFromTokens( match[i] ); - if ( cached[ expando ] ) { - setMatchers.push( cached ); - } else { - elementMatchers.push( cached ); - } - } - - // Cache the compiled function - cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) ); - - // Save selector and tokenization - cached.selector = selector; - } - return cached; -}; - -/** - * A low-level selection function that works with Sizzle's compiled - * selector functions - * @param {String|Function} selector A selector or a pre-compiled - * selector function built with Sizzle.compile - * @param {Element} context - * @param {Array} [results] - * @param {Array} [seed] A set of elements to match against - */ -select = Sizzle.select = function( selector, context, results, seed ) { - var i, tokens, token, type, find, - compiled = typeof selector === "function" && selector, - match = !seed && tokenize( (selector = compiled.selector || selector) ); - - results = results || []; - - // Try to minimize operations if there is only one selector in the list and no seed - // (the latter of which guarantees us context) - if ( match.length === 1 ) { - - // Reduce context if the leading compound selector is an ID - tokens = match[0] = match[0].slice( 0 ); - if ( tokens.length > 2 && (token = tokens[0]).type === "ID" && - context.nodeType === 9 && documentIsHTML && Expr.relative[ tokens[1].type ] ) { - - context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0]; - if ( !context ) { - return results; - - // Precompiled matchers will still verify ancestry, so step up a level - } else if ( compiled ) { - context = context.parentNode; - } - - selector = selector.slice( tokens.shift().value.length ); - } - - // Fetch a seed set for right-to-left matching - i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length; - while ( i-- ) { - token = tokens[i]; - - // Abort if we hit a combinator - if ( Expr.relative[ (type = token.type) ] ) { - break; - } - if ( (find = Expr.find[ type ]) ) { - // Search, expanding context for leading sibling combinators - if ( (seed = find( - token.matches[0].replace( runescape, funescape ), - rsibling.test( tokens[0].type ) && testContext( context.parentNode ) || context - )) ) { - - // If seed is empty or no tokens remain, we can return early - tokens.splice( i, 1 ); - selector = seed.length && toSelector( tokens ); - if ( !selector ) { - push.apply( results, seed ); - return results; - } - - break; - } - } - } - } - - // Compile and execute a filtering function if one is not provided - // Provide `match` to avoid retokenization if we modified the selector above - ( compiled || compile( selector, match ) )( - seed, - context, - !documentIsHTML, - results, - !context || rsibling.test( selector ) && testContext( context.parentNode ) || context - ); - return results; -}; - -// One-time assignments - -// Sort stability -support.sortStable = expando.split("").sort( sortOrder ).join("") === expando; - -// Support: Chrome 14-35+ -// Always assume duplicates if they aren't passed to the comparison function -support.detectDuplicates = !!hasDuplicate; - -// Initialize against the default document -setDocument(); - -// Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27) -// Detached nodes confoundingly follow *each other* -support.sortDetached = assert(function( el ) { - // Should return 1, but returns 4 (following) - return el.compareDocumentPosition( document.createElement("fieldset") ) & 1; -}); - -// Support: IE<8 -// Prevent attribute/property "interpolation" -// https://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx -if ( !assert(function( el ) { - el.innerHTML = ""; - return el.firstChild.getAttribute("href") === "#" ; -}) ) { - addHandle( "type|href|height|width", function( elem, name, isXML ) { - if ( !isXML ) { - return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 ); - } - }); -} - -// Support: IE<9 -// Use defaultValue in place of getAttribute("value") -if ( !support.attributes || !assert(function( el ) { - el.innerHTML = ""; - el.firstChild.setAttribute( "value", "" ); - return el.firstChild.getAttribute( "value" ) === ""; -}) ) { - addHandle( "value", function( elem, name, isXML ) { - if ( !isXML && elem.nodeName.toLowerCase() === "input" ) { - return elem.defaultValue; - } - }); -} - -// Support: IE<9 -// Use getAttributeNode to fetch booleans when getAttribute lies -if ( !assert(function( el ) { - return el.getAttribute("disabled") == null; -}) ) { - addHandle( booleans, function( elem, name, isXML ) { - var val; - if ( !isXML ) { - return elem[ name ] === true ? name.toLowerCase() : - (val = elem.getAttributeNode( name )) && val.specified ? - val.value : - null; - } - }); -} - -return Sizzle; - -})( window ); - - - -jQuery.find = Sizzle; -jQuery.expr = Sizzle.selectors; - -// Deprecated -jQuery.expr[ ":" ] = jQuery.expr.pseudos; -jQuery.uniqueSort = jQuery.unique = Sizzle.uniqueSort; -jQuery.text = Sizzle.getText; -jQuery.isXMLDoc = Sizzle.isXML; -jQuery.contains = Sizzle.contains; -jQuery.escapeSelector = Sizzle.escape; - - - - -var dir = function( elem, dir, until ) { - var matched = [], - truncate = until !== undefined; - - while ( ( elem = elem[ dir ] ) && elem.nodeType !== 9 ) { - if ( elem.nodeType === 1 ) { - if ( truncate && jQuery( elem ).is( until ) ) { - break; - } - matched.push( elem ); - } - } - return matched; -}; - - -var siblings = function( n, elem ) { - var matched = []; - - for ( ; n; n = n.nextSibling ) { - if ( n.nodeType === 1 && n !== elem ) { - matched.push( n ); - } - } - - return matched; -}; - - -var rneedsContext = jQuery.expr.match.needsContext; - - - -function nodeName( elem, name ) { - - return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase(); - -}; -var rsingleTag = ( /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i ); - - - -// Implement the identical functionality for filter and not -function winnow( elements, qualifier, not ) { - if ( isFunction( qualifier ) ) { - return jQuery.grep( elements, function( elem, i ) { - return !!qualifier.call( elem, i, elem ) !== not; - } ); - } - - // Single element - if ( qualifier.nodeType ) { - return jQuery.grep( elements, function( elem ) { - return ( elem === qualifier ) !== not; - } ); - } - - // Arraylike of elements (jQuery, arguments, Array) - if ( typeof qualifier !== "string" ) { - return jQuery.grep( elements, function( elem ) { - return ( indexOf.call( qualifier, elem ) > -1 ) !== not; - } ); - } - - // Filtered directly for both simple and complex selectors - return jQuery.filter( qualifier, elements, not ); -} - -jQuery.filter = function( expr, elems, not ) { - var elem = elems[ 0 ]; - - if ( not ) { - expr = ":not(" + expr + ")"; - } - - if ( elems.length === 1 && elem.nodeType === 1 ) { - return jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : []; - } - - return jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) { - return elem.nodeType === 1; - } ) ); -}; - -jQuery.fn.extend( { - find: function( selector ) { - var i, ret, - len = this.length, - self = this; - - if ( typeof selector !== "string" ) { - return this.pushStack( jQuery( selector ).filter( function() { - for ( i = 0; i < len; i++ ) { - if ( jQuery.contains( self[ i ], this ) ) { - return true; - } - } - } ) ); - } - - ret = this.pushStack( [] ); - - for ( i = 0; i < len; i++ ) { - jQuery.find( selector, self[ i ], ret ); - } - - return len > 1 ? jQuery.uniqueSort( ret ) : ret; - }, - filter: function( selector ) { - return this.pushStack( winnow( this, selector || [], false ) ); - }, - not: function( selector ) { - return this.pushStack( winnow( this, selector || [], true ) ); - }, - is: function( selector ) { - return !!winnow( - this, - - // If this is a positional/relative selector, check membership in the returned set - // so $("p:first").is("p:last") won't return true for a doc with two "p". - typeof selector === "string" && rneedsContext.test( selector ) ? - jQuery( selector ) : - selector || [], - false - ).length; - } -} ); - - -// Initialize a jQuery object - - -// A central reference to the root jQuery(document) -var rootjQuery, - - // A simple way to check for HTML strings - // Prioritize #id over to avoid XSS via location.hash (#9521) - // Strict HTML recognition (#11290: must start with <) - // Shortcut simple #id case for speed - rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/, - - init = jQuery.fn.init = function( selector, context, root ) { - var match, elem; - - // HANDLE: $(""), $(null), $(undefined), $(false) - if ( !selector ) { - return this; - } - - // Method init() accepts an alternate rootjQuery - // so migrate can support jQuery.sub (gh-2101) - root = root || rootjQuery; - - // Handle HTML strings - if ( typeof selector === "string" ) { - if ( selector[ 0 ] === "<" && - selector[ selector.length - 1 ] === ">" && - selector.length >= 3 ) { - - // Assume that strings that start and end with <> are HTML and skip the regex check - match = [ null, selector, null ]; - - } else { - match = rquickExpr.exec( selector ); - } - - // Match html or make sure no context is specified for #id - if ( match && ( match[ 1 ] || !context ) ) { - - // HANDLE: $(html) -> $(array) - if ( match[ 1 ] ) { - context = context instanceof jQuery ? context[ 0 ] : context; - - // Option to run scripts is true for back-compat - // Intentionally let the error be thrown if parseHTML is not present - jQuery.merge( this, jQuery.parseHTML( - match[ 1 ], - context && context.nodeType ? context.ownerDocument || context : document, - true - ) ); - - // HANDLE: $(html, props) - if ( rsingleTag.test( match[ 1 ] ) && jQuery.isPlainObject( context ) ) { - for ( match in context ) { - - // Properties of context are called as methods if possible - if ( isFunction( this[ match ] ) ) { - this[ match ]( context[ match ] ); - - // ...and otherwise set as attributes - } else { - this.attr( match, context[ match ] ); - } - } - } - - return this; - - // HANDLE: $(#id) - } else { - elem = document.getElementById( match[ 2 ] ); - - if ( elem ) { - - // Inject the element directly into the jQuery object - this[ 0 ] = elem; - this.length = 1; - } - return this; - } - - // HANDLE: $(expr, $(...)) - } else if ( !context || context.jquery ) { - return ( context || root ).find( selector ); - - // HANDLE: $(expr, context) - // (which is just equivalent to: $(context).find(expr) - } else { - return this.constructor( context ).find( selector ); - } - - // HANDLE: $(DOMElement) - } else if ( selector.nodeType ) { - this[ 0 ] = selector; - this.length = 1; - return this; - - // HANDLE: $(function) - // Shortcut for document ready - } else if ( isFunction( selector ) ) { - return root.ready !== undefined ? - root.ready( selector ) : - - // Execute immediately if ready is not present - selector( jQuery ); - } - - return jQuery.makeArray( selector, this ); - }; - -// Give the init function the jQuery prototype for later instantiation -init.prototype = jQuery.fn; - -// Initialize central reference -rootjQuery = jQuery( document ); - - -var rparentsprev = /^(?:parents|prev(?:Until|All))/, - - // Methods guaranteed to produce a unique set when starting from a unique set - guaranteedUnique = { - children: true, - contents: true, - next: true, - prev: true - }; - -jQuery.fn.extend( { - has: function( target ) { - var targets = jQuery( target, this ), - l = targets.length; - - return this.filter( function() { - var i = 0; - for ( ; i < l; i++ ) { - if ( jQuery.contains( this, targets[ i ] ) ) { - return true; - } - } - } ); - }, - - closest: function( selectors, context ) { - var cur, - i = 0, - l = this.length, - matched = [], - targets = typeof selectors !== "string" && jQuery( selectors ); - - // Positional selectors never match, since there's no _selection_ context - if ( !rneedsContext.test( selectors ) ) { - for ( ; i < l; i++ ) { - for ( cur = this[ i ]; cur && cur !== context; cur = cur.parentNode ) { - - // Always skip document fragments - if ( cur.nodeType < 11 && ( targets ? - targets.index( cur ) > -1 : - - // Don't pass non-elements to Sizzle - cur.nodeType === 1 && - jQuery.find.matchesSelector( cur, selectors ) ) ) { - - matched.push( cur ); - break; - } - } - } - } - - return this.pushStack( matched.length > 1 ? jQuery.uniqueSort( matched ) : matched ); - }, - - // Determine the position of an element within the set - index: function( elem ) { - - // No argument, return index in parent - if ( !elem ) { - return ( this[ 0 ] && this[ 0 ].parentNode ) ? this.first().prevAll().length : -1; - } - - // Index in selector - if ( typeof elem === "string" ) { - return indexOf.call( jQuery( elem ), this[ 0 ] ); - } - - // Locate the position of the desired element - return indexOf.call( this, - - // If it receives a jQuery object, the first element is used - elem.jquery ? elem[ 0 ] : elem - ); - }, - - add: function( selector, context ) { - return this.pushStack( - jQuery.uniqueSort( - jQuery.merge( this.get(), jQuery( selector, context ) ) - ) - ); - }, - - addBack: function( selector ) { - return this.add( selector == null ? - this.prevObject : this.prevObject.filter( selector ) - ); - } -} ); - -function sibling( cur, dir ) { - while ( ( cur = cur[ dir ] ) && cur.nodeType !== 1 ) {} - return cur; -} - -jQuery.each( { - parent: function( elem ) { - var parent = elem.parentNode; - return parent && parent.nodeType !== 11 ? parent : null; - }, - parents: function( elem ) { - return dir( elem, "parentNode" ); - }, - parentsUntil: function( elem, i, until ) { - return dir( elem, "parentNode", until ); - }, - next: function( elem ) { - return sibling( elem, "nextSibling" ); - }, - prev: function( elem ) { - return sibling( elem, "previousSibling" ); - }, - nextAll: function( elem ) { - return dir( elem, "nextSibling" ); - }, - prevAll: function( elem ) { - return dir( elem, "previousSibling" ); - }, - nextUntil: function( elem, i, until ) { - return dir( elem, "nextSibling", until ); - }, - prevUntil: function( elem, i, until ) { - return dir( elem, "previousSibling", until ); - }, - siblings: function( elem ) { - return siblings( ( elem.parentNode || {} ).firstChild, elem ); - }, - children: function( elem ) { - return siblings( elem.firstChild ); - }, - contents: function( elem ) { - if ( nodeName( elem, "iframe" ) ) { - return elem.contentDocument; - } - - // Support: IE 9 - 11 only, iOS 7 only, Android Browser <=4.3 only - // Treat the template element as a regular one in browsers that - // don't support it. - if ( nodeName( elem, "template" ) ) { - elem = elem.content || elem; - } - - return jQuery.merge( [], elem.childNodes ); - } -}, function( name, fn ) { - jQuery.fn[ name ] = function( until, selector ) { - var matched = jQuery.map( this, fn, until ); - - if ( name.slice( -5 ) !== "Until" ) { - selector = until; - } - - if ( selector && typeof selector === "string" ) { - matched = jQuery.filter( selector, matched ); - } - - if ( this.length > 1 ) { - - // Remove duplicates - if ( !guaranteedUnique[ name ] ) { - jQuery.uniqueSort( matched ); - } - - // Reverse order for parents* and prev-derivatives - if ( rparentsprev.test( name ) ) { - matched.reverse(); - } - } - - return this.pushStack( matched ); - }; -} ); -var rnothtmlwhite = ( /[^\x20\t\r\n\f]+/g ); - - - -// Convert String-formatted options into Object-formatted ones -function createOptions( options ) { - var object = {}; - jQuery.each( options.match( rnothtmlwhite ) || [], function( _, flag ) { - object[ flag ] = true; - } ); - return object; -} - -/* - * Create a callback list using the following parameters: - * - * options: an optional list of space-separated options that will change how - * the callback list behaves or a more traditional option object - * - * By default a callback list will act like an event callback list and can be - * "fired" multiple times. - * - * Possible options: - * - * once: will ensure the callback list can only be fired once (like a Deferred) - * - * memory: will keep track of previous values and will call any callback added - * after the list has been fired right away with the latest "memorized" - * values (like a Deferred) - * - * unique: will ensure a callback can only be added once (no duplicate in the list) - * - * stopOnFalse: interrupt callings when a callback returns false - * - */ -jQuery.Callbacks = function( options ) { - - // Convert options from String-formatted to Object-formatted if needed - // (we check in cache first) - options = typeof options === "string" ? - createOptions( options ) : - jQuery.extend( {}, options ); - - var // Flag to know if list is currently firing - firing, - - // Last fire value for non-forgettable lists - memory, - - // Flag to know if list was already fired - fired, - - // Flag to prevent firing - locked, - - // Actual callback list - list = [], - - // Queue of execution data for repeatable lists - queue = [], - - // Index of currently firing callback (modified by add/remove as needed) - firingIndex = -1, - - // Fire callbacks - fire = function() { - - // Enforce single-firing - locked = locked || options.once; - - // Execute callbacks for all pending executions, - // respecting firingIndex overrides and runtime changes - fired = firing = true; - for ( ; queue.length; firingIndex = -1 ) { - memory = queue.shift(); - while ( ++firingIndex < list.length ) { - - // Run callback and check for early termination - if ( list[ firingIndex ].apply( memory[ 0 ], memory[ 1 ] ) === false && - options.stopOnFalse ) { - - // Jump to end and forget the data so .add doesn't re-fire - firingIndex = list.length; - memory = false; - } - } - } - - // Forget the data if we're done with it - if ( !options.memory ) { - memory = false; - } - - firing = false; - - // Clean up if we're done firing for good - if ( locked ) { - - // Keep an empty list if we have data for future add calls - if ( memory ) { - list = []; - - // Otherwise, this object is spent - } else { - list = ""; - } - } - }, - - // Actual Callbacks object - self = { - - // Add a callback or a collection of callbacks to the list - add: function() { - if ( list ) { - - // If we have memory from a past run, we should fire after adding - if ( memory && !firing ) { - firingIndex = list.length - 1; - queue.push( memory ); - } - - ( function add( args ) { - jQuery.each( args, function( _, arg ) { - if ( isFunction( arg ) ) { - if ( !options.unique || !self.has( arg ) ) { - list.push( arg ); - } - } else if ( arg && arg.length && toType( arg ) !== "string" ) { - - // Inspect recursively - add( arg ); - } - } ); - } )( arguments ); - - if ( memory && !firing ) { - fire(); - } - } - return this; - }, - - // Remove a callback from the list - remove: function() { - jQuery.each( arguments, function( _, arg ) { - var index; - while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) { - list.splice( index, 1 ); - - // Handle firing indexes - if ( index <= firingIndex ) { - firingIndex--; - } - } - } ); - return this; - }, - - // Check if a given callback is in the list. - // If no argument is given, return whether or not list has callbacks attached. - has: function( fn ) { - return fn ? - jQuery.inArray( fn, list ) > -1 : - list.length > 0; - }, - - // Remove all callbacks from the list - empty: function() { - if ( list ) { - list = []; - } - return this; - }, - - // Disable .fire and .add - // Abort any current/pending executions - // Clear all callbacks and values - disable: function() { - locked = queue = []; - list = memory = ""; - return this; - }, - disabled: function() { - return !list; - }, - - // Disable .fire - // Also disable .add unless we have memory (since it would have no effect) - // Abort any pending executions - lock: function() { - locked = queue = []; - if ( !memory && !firing ) { - list = memory = ""; - } - return this; - }, - locked: function() { - return !!locked; - }, - - // Call all callbacks with the given context and arguments - fireWith: function( context, args ) { - if ( !locked ) { - args = args || []; - args = [ context, args.slice ? args.slice() : args ]; - queue.push( args ); - if ( !firing ) { - fire(); - } - } - return this; - }, - - // Call all the callbacks with the given arguments - fire: function() { - self.fireWith( this, arguments ); - return this; - }, - - // To know if the callbacks have already been called at least once - fired: function() { - return !!fired; - } - }; - - return self; -}; - - -function Identity( v ) { - return v; -} -function Thrower( ex ) { - throw ex; -} - -function adoptValue( value, resolve, reject, noValue ) { - var method; - - try { - - // Check for promise aspect first to privilege synchronous behavior - if ( value && isFunction( ( method = value.promise ) ) ) { - method.call( value ).done( resolve ).fail( reject ); - - // Other thenables - } else if ( value && isFunction( ( method = value.then ) ) ) { - method.call( value, resolve, reject ); - - // Other non-thenables - } else { - - // Control `resolve` arguments by letting Array#slice cast boolean `noValue` to integer: - // * false: [ value ].slice( 0 ) => resolve( value ) - // * true: [ value ].slice( 1 ) => resolve() - resolve.apply( undefined, [ value ].slice( noValue ) ); - } - - // For Promises/A+, convert exceptions into rejections - // Since jQuery.when doesn't unwrap thenables, we can skip the extra checks appearing in - // Deferred#then to conditionally suppress rejection. - } catch ( value ) { - - // Support: Android 4.0 only - // Strict mode functions invoked without .call/.apply get global-object context - reject.apply( undefined, [ value ] ); - } -} - -jQuery.extend( { - - Deferred: function( func ) { - var tuples = [ - - // action, add listener, callbacks, - // ... .then handlers, argument index, [final state] - [ "notify", "progress", jQuery.Callbacks( "memory" ), - jQuery.Callbacks( "memory" ), 2 ], - [ "resolve", "done", jQuery.Callbacks( "once memory" ), - jQuery.Callbacks( "once memory" ), 0, "resolved" ], - [ "reject", "fail", jQuery.Callbacks( "once memory" ), - jQuery.Callbacks( "once memory" ), 1, "rejected" ] - ], - state = "pending", - promise = { - state: function() { - return state; - }, - always: function() { - deferred.done( arguments ).fail( arguments ); - return this; - }, - "catch": function( fn ) { - return promise.then( null, fn ); - }, - - // Keep pipe for back-compat - pipe: function( /* fnDone, fnFail, fnProgress */ ) { - var fns = arguments; - - return jQuery.Deferred( function( newDefer ) { - jQuery.each( tuples, function( i, tuple ) { - - // Map tuples (progress, done, fail) to arguments (done, fail, progress) - var fn = isFunction( fns[ tuple[ 4 ] ] ) && fns[ tuple[ 4 ] ]; - - // deferred.progress(function() { bind to newDefer or newDefer.notify }) - // deferred.done(function() { bind to newDefer or newDefer.resolve }) - // deferred.fail(function() { bind to newDefer or newDefer.reject }) - deferred[ tuple[ 1 ] ]( function() { - var returned = fn && fn.apply( this, arguments ); - if ( returned && isFunction( returned.promise ) ) { - returned.promise() - .progress( newDefer.notify ) - .done( newDefer.resolve ) - .fail( newDefer.reject ); - } else { - newDefer[ tuple[ 0 ] + "With" ]( - this, - fn ? [ returned ] : arguments - ); - } - } ); - } ); - fns = null; - } ).promise(); - }, - then: function( onFulfilled, onRejected, onProgress ) { - var maxDepth = 0; - function resolve( depth, deferred, handler, special ) { - return function() { - var that = this, - args = arguments, - mightThrow = function() { - var returned, then; - - // Support: Promises/A+ section 2.3.3.3.3 - // https://promisesaplus.com/#point-59 - // Ignore double-resolution attempts - if ( depth < maxDepth ) { - return; - } - - returned = handler.apply( that, args ); - - // Support: Promises/A+ section 2.3.1 - // https://promisesaplus.com/#point-48 - if ( returned === deferred.promise() ) { - throw new TypeError( "Thenable self-resolution" ); - } - - // Support: Promises/A+ sections 2.3.3.1, 3.5 - // https://promisesaplus.com/#point-54 - // https://promisesaplus.com/#point-75 - // Retrieve `then` only once - then = returned && - - // Support: Promises/A+ section 2.3.4 - // https://promisesaplus.com/#point-64 - // Only check objects and functions for thenability - ( typeof returned === "object" || - typeof returned === "function" ) && - returned.then; - - // Handle a returned thenable - if ( isFunction( then ) ) { - - // Special processors (notify) just wait for resolution - if ( special ) { - then.call( - returned, - resolve( maxDepth, deferred, Identity, special ), - resolve( maxDepth, deferred, Thrower, special ) - ); - - // Normal processors (resolve) also hook into progress - } else { - - // ...and disregard older resolution values - maxDepth++; - - then.call( - returned, - resolve( maxDepth, deferred, Identity, special ), - resolve( maxDepth, deferred, Thrower, special ), - resolve( maxDepth, deferred, Identity, - deferred.notifyWith ) - ); - } - - // Handle all other returned values - } else { - - // Only substitute handlers pass on context - // and multiple values (non-spec behavior) - if ( handler !== Identity ) { - that = undefined; - args = [ returned ]; - } - - // Process the value(s) - // Default process is resolve - ( special || deferred.resolveWith )( that, args ); - } - }, - - // Only normal processors (resolve) catch and reject exceptions - process = special ? - mightThrow : - function() { - try { - mightThrow(); - } catch ( e ) { - - if ( jQuery.Deferred.exceptionHook ) { - jQuery.Deferred.exceptionHook( e, - process.stackTrace ); - } - - // Support: Promises/A+ section 2.3.3.3.4.1 - // https://promisesaplus.com/#point-61 - // Ignore post-resolution exceptions - if ( depth + 1 >= maxDepth ) { - - // Only substitute handlers pass on context - // and multiple values (non-spec behavior) - if ( handler !== Thrower ) { - that = undefined; - args = [ e ]; - } - - deferred.rejectWith( that, args ); - } - } - }; - - // Support: Promises/A+ section 2.3.3.3.1 - // https://promisesaplus.com/#point-57 - // Re-resolve promises immediately to dodge false rejection from - // subsequent errors - if ( depth ) { - process(); - } else { - - // Call an optional hook to record the stack, in case of exception - // since it's otherwise lost when execution goes async - if ( jQuery.Deferred.getStackHook ) { - process.stackTrace = jQuery.Deferred.getStackHook(); - } - window.setTimeout( process ); - } - }; - } - - return jQuery.Deferred( function( newDefer ) { - - // progress_handlers.add( ... ) - tuples[ 0 ][ 3 ].add( - resolve( - 0, - newDefer, - isFunction( onProgress ) ? - onProgress : - Identity, - newDefer.notifyWith - ) - ); - - // fulfilled_handlers.add( ... ) - tuples[ 1 ][ 3 ].add( - resolve( - 0, - newDefer, - isFunction( onFulfilled ) ? - onFulfilled : - Identity - ) - ); - - // rejected_handlers.add( ... ) - tuples[ 2 ][ 3 ].add( - resolve( - 0, - newDefer, - isFunction( onRejected ) ? - onRejected : - Thrower - ) - ); - } ).promise(); - }, - - // Get a promise for this deferred - // If obj is provided, the promise aspect is added to the object - promise: function( obj ) { - return obj != null ? jQuery.extend( obj, promise ) : promise; - } - }, - deferred = {}; - - // Add list-specific methods - jQuery.each( tuples, function( i, tuple ) { - var list = tuple[ 2 ], - stateString = tuple[ 5 ]; - - // promise.progress = list.add - // promise.done = list.add - // promise.fail = list.add - promise[ tuple[ 1 ] ] = list.add; - - // Handle state - if ( stateString ) { - list.add( - function() { - - // state = "resolved" (i.e., fulfilled) - // state = "rejected" - state = stateString; - }, - - // rejected_callbacks.disable - // fulfilled_callbacks.disable - tuples[ 3 - i ][ 2 ].disable, - - // rejected_handlers.disable - // fulfilled_handlers.disable - tuples[ 3 - i ][ 3 ].disable, - - // progress_callbacks.lock - tuples[ 0 ][ 2 ].lock, - - // progress_handlers.lock - tuples[ 0 ][ 3 ].lock - ); - } - - // progress_handlers.fire - // fulfilled_handlers.fire - // rejected_handlers.fire - list.add( tuple[ 3 ].fire ); - - // deferred.notify = function() { deferred.notifyWith(...) } - // deferred.resolve = function() { deferred.resolveWith(...) } - // deferred.reject = function() { deferred.rejectWith(...) } - deferred[ tuple[ 0 ] ] = function() { - deferred[ tuple[ 0 ] + "With" ]( this === deferred ? undefined : this, arguments ); - return this; - }; - - // deferred.notifyWith = list.fireWith - // deferred.resolveWith = list.fireWith - // deferred.rejectWith = list.fireWith - deferred[ tuple[ 0 ] + "With" ] = list.fireWith; - } ); - - // Make the deferred a promise - promise.promise( deferred ); - - // Call given func if any - if ( func ) { - func.call( deferred, deferred ); - } - - // All done! - return deferred; - }, - - // Deferred helper - when: function( singleValue ) { - var - - // count of uncompleted subordinates - remaining = arguments.length, - - // count of unprocessed arguments - i = remaining, - - // subordinate fulfillment data - resolveContexts = Array( i ), - resolveValues = slice.call( arguments ), - - // the master Deferred - master = jQuery.Deferred(), - - // subordinate callback factory - updateFunc = function( i ) { - return function( value ) { - resolveContexts[ i ] = this; - resolveValues[ i ] = arguments.length > 1 ? slice.call( arguments ) : value; - if ( !( --remaining ) ) { - master.resolveWith( resolveContexts, resolveValues ); - } - }; - }; - - // Single- and empty arguments are adopted like Promise.resolve - if ( remaining <= 1 ) { - adoptValue( singleValue, master.done( updateFunc( i ) ).resolve, master.reject, - !remaining ); - - // Use .then() to unwrap secondary thenables (cf. gh-3000) - if ( master.state() === "pending" || - isFunction( resolveValues[ i ] && resolveValues[ i ].then ) ) { - - return master.then(); - } - } - - // Multiple arguments are aggregated like Promise.all array elements - while ( i-- ) { - adoptValue( resolveValues[ i ], updateFunc( i ), master.reject ); - } - - return master.promise(); - } -} ); - - -// These usually indicate a programmer mistake during development, -// warn about them ASAP rather than swallowing them by default. -var rerrorNames = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/; - -jQuery.Deferred.exceptionHook = function( error, stack ) { - - // Support: IE 8 - 9 only - // Console exists when dev tools are open, which can happen at any time - if ( window.console && window.console.warn && error && rerrorNames.test( error.name ) ) { - window.console.warn( "jQuery.Deferred exception: " + error.message, error.stack, stack ); - } -}; - - - - -jQuery.readyException = function( error ) { - window.setTimeout( function() { - throw error; - } ); -}; - - - - -// The deferred used on DOM ready -var readyList = jQuery.Deferred(); - -jQuery.fn.ready = function( fn ) { - - readyList - .then( fn ) - - // Wrap jQuery.readyException in a function so that the lookup - // happens at the time of error handling instead of callback - // registration. - .catch( function( error ) { - jQuery.readyException( error ); - } ); - - return this; -}; - -jQuery.extend( { - - // Is the DOM ready to be used? Set to true once it occurs. - isReady: false, - - // A counter to track how many items to wait for before - // the ready event fires. See #6781 - readyWait: 1, - - // Handle when the DOM is ready - ready: function( wait ) { - - // Abort if there are pending holds or we're already ready - if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) { - return; - } - - // Remember that the DOM is ready - jQuery.isReady = true; - - // If a normal DOM Ready event fired, decrement, and wait if need be - if ( wait !== true && --jQuery.readyWait > 0 ) { - return; - } - - // If there are functions bound, to execute - readyList.resolveWith( document, [ jQuery ] ); - } -} ); - -jQuery.ready.then = readyList.then; - -// The ready event handler and self cleanup method -function completed() { - document.removeEventListener( "DOMContentLoaded", completed ); - window.removeEventListener( "load", completed ); - jQuery.ready(); -} - -// Catch cases where $(document).ready() is called -// after the browser event has already occurred. -// Support: IE <=9 - 10 only -// Older IE sometimes signals "interactive" too soon -if ( document.readyState === "complete" || - ( document.readyState !== "loading" && !document.documentElement.doScroll ) ) { - - // Handle it asynchronously to allow scripts the opportunity to delay ready - window.setTimeout( jQuery.ready ); - -} else { - - // Use the handy event callback - document.addEventListener( "DOMContentLoaded", completed ); - - // A fallback to window.onload, that will always work - window.addEventListener( "load", completed ); -} - - - - -// Multifunctional method to get and set values of a collection -// The value/s can optionally be executed if it's a function -var access = function( elems, fn, key, value, chainable, emptyGet, raw ) { - var i = 0, - len = elems.length, - bulk = key == null; - - // Sets many values - if ( toType( key ) === "object" ) { - chainable = true; - for ( i in key ) { - access( elems, fn, i, key[ i ], true, emptyGet, raw ); - } - - // Sets one value - } else if ( value !== undefined ) { - chainable = true; - - if ( !isFunction( value ) ) { - raw = true; - } - - if ( bulk ) { - - // Bulk operations run against the entire set - if ( raw ) { - fn.call( elems, value ); - fn = null; - - // ...except when executing function values - } else { - bulk = fn; - fn = function( elem, key, value ) { - return bulk.call( jQuery( elem ), value ); - }; - } - } - - if ( fn ) { - for ( ; i < len; i++ ) { - fn( - elems[ i ], key, raw ? - value : - value.call( elems[ i ], i, fn( elems[ i ], key ) ) - ); - } - } - } - - if ( chainable ) { - return elems; - } - - // Gets - if ( bulk ) { - return fn.call( elems ); - } - - return len ? fn( elems[ 0 ], key ) : emptyGet; -}; - - -// Matches dashed string for camelizing -var rmsPrefix = /^-ms-/, - rdashAlpha = /-([a-z])/g; - -// Used by camelCase as callback to replace() -function fcamelCase( all, letter ) { - return letter.toUpperCase(); -} - -// Convert dashed to camelCase; used by the css and data modules -// Support: IE <=9 - 11, Edge 12 - 15 -// Microsoft forgot to hump their vendor prefix (#9572) -function camelCase( string ) { - return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase ); -} -var acceptData = function( owner ) { - - // Accepts only: - // - Node - // - Node.ELEMENT_NODE - // - Node.DOCUMENT_NODE - // - Object - // - Any - return owner.nodeType === 1 || owner.nodeType === 9 || !( +owner.nodeType ); -}; - - - - -function Data() { - this.expando = jQuery.expando + Data.uid++; -} - -Data.uid = 1; - -Data.prototype = { - - cache: function( owner ) { - - // Check if the owner object already has a cache - var value = owner[ this.expando ]; - - // If not, create one - if ( !value ) { - value = {}; - - // We can accept data for non-element nodes in modern browsers, - // but we should not, see #8335. - // Always return an empty object. - if ( acceptData( owner ) ) { - - // If it is a node unlikely to be stringify-ed or looped over - // use plain assignment - if ( owner.nodeType ) { - owner[ this.expando ] = value; - - // Otherwise secure it in a non-enumerable property - // configurable must be true to allow the property to be - // deleted when data is removed - } else { - Object.defineProperty( owner, this.expando, { - value: value, - configurable: true - } ); - } - } - } - - return value; - }, - set: function( owner, data, value ) { - var prop, - cache = this.cache( owner ); - - // Handle: [ owner, key, value ] args - // Always use camelCase key (gh-2257) - if ( typeof data === "string" ) { - cache[ camelCase( data ) ] = value; - - // Handle: [ owner, { properties } ] args - } else { - - // Copy the properties one-by-one to the cache object - for ( prop in data ) { - cache[ camelCase( prop ) ] = data[ prop ]; - } - } - return cache; - }, - get: function( owner, key ) { - return key === undefined ? - this.cache( owner ) : - - // Always use camelCase key (gh-2257) - owner[ this.expando ] && owner[ this.expando ][ camelCase( key ) ]; - }, - access: function( owner, key, value ) { - - // In cases where either: - // - // 1. No key was specified - // 2. A string key was specified, but no value provided - // - // Take the "read" path and allow the get method to determine - // which value to return, respectively either: - // - // 1. The entire cache object - // 2. The data stored at the key - // - if ( key === undefined || - ( ( key && typeof key === "string" ) && value === undefined ) ) { - - return this.get( owner, key ); - } - - // When the key is not a string, or both a key and value - // are specified, set or extend (existing objects) with either: - // - // 1. An object of properties - // 2. A key and value - // - this.set( owner, key, value ); - - // Since the "set" path can have two possible entry points - // return the expected data based on which path was taken[*] - return value !== undefined ? value : key; - }, - remove: function( owner, key ) { - var i, - cache = owner[ this.expando ]; - - if ( cache === undefined ) { - return; - } - - if ( key !== undefined ) { - - // Support array or space separated string of keys - if ( Array.isArray( key ) ) { - - // If key is an array of keys... - // We always set camelCase keys, so remove that. - key = key.map( camelCase ); - } else { - key = camelCase( key ); - - // If a key with the spaces exists, use it. - // Otherwise, create an array by matching non-whitespace - key = key in cache ? - [ key ] : - ( key.match( rnothtmlwhite ) || [] ); - } - - i = key.length; - - while ( i-- ) { - delete cache[ key[ i ] ]; - } - } - - // Remove the expando if there's no more data - if ( key === undefined || jQuery.isEmptyObject( cache ) ) { - - // Support: Chrome <=35 - 45 - // Webkit & Blink performance suffers when deleting properties - // from DOM nodes, so set to undefined instead - // https://bugs.chromium.org/p/chromium/issues/detail?id=378607 (bug restricted) - if ( owner.nodeType ) { - owner[ this.expando ] = undefined; - } else { - delete owner[ this.expando ]; - } - } - }, - hasData: function( owner ) { - var cache = owner[ this.expando ]; - return cache !== undefined && !jQuery.isEmptyObject( cache ); - } -}; -var dataPriv = new Data(); - -var dataUser = new Data(); - - - -// Implementation Summary -// -// 1. Enforce API surface and semantic compatibility with 1.9.x branch -// 2. Improve the module's maintainability by reducing the storage -// paths to a single mechanism. -// 3. Use the same single mechanism to support "private" and "user" data. -// 4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData) -// 5. Avoid exposing implementation details on user objects (eg. expando properties) -// 6. Provide a clear path for implementation upgrade to WeakMap in 2014 - -var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/, - rmultiDash = /[A-Z]/g; - -function getData( data ) { - if ( data === "true" ) { - return true; - } - - if ( data === "false" ) { - return false; - } - - if ( data === "null" ) { - return null; - } - - // Only convert to a number if it doesn't change the string - if ( data === +data + "" ) { - return +data; - } - - if ( rbrace.test( data ) ) { - return JSON.parse( data ); - } - - return data; -} - -function dataAttr( elem, key, data ) { - var name; - - // If nothing was found internally, try to fetch any - // data from the HTML5 data-* attribute - if ( data === undefined && elem.nodeType === 1 ) { - name = "data-" + key.replace( rmultiDash, "-$&" ).toLowerCase(); - data = elem.getAttribute( name ); - - if ( typeof data === "string" ) { - try { - data = getData( data ); - } catch ( e ) {} - - // Make sure we set the data so it isn't changed later - dataUser.set( elem, key, data ); - } else { - data = undefined; - } - } - return data; -} - -jQuery.extend( { - hasData: function( elem ) { - return dataUser.hasData( elem ) || dataPriv.hasData( elem ); - }, - - data: function( elem, name, data ) { - return dataUser.access( elem, name, data ); - }, - - removeData: function( elem, name ) { - dataUser.remove( elem, name ); - }, - - // TODO: Now that all calls to _data and _removeData have been replaced - // with direct calls to dataPriv methods, these can be deprecated. - _data: function( elem, name, data ) { - return dataPriv.access( elem, name, data ); - }, - - _removeData: function( elem, name ) { - dataPriv.remove( elem, name ); - } -} ); - -jQuery.fn.extend( { - data: function( key, value ) { - var i, name, data, - elem = this[ 0 ], - attrs = elem && elem.attributes; - - // Gets all values - if ( key === undefined ) { - if ( this.length ) { - data = dataUser.get( elem ); - - if ( elem.nodeType === 1 && !dataPriv.get( elem, "hasDataAttrs" ) ) { - i = attrs.length; - while ( i-- ) { - - // Support: IE 11 only - // The attrs elements can be null (#14894) - if ( attrs[ i ] ) { - name = attrs[ i ].name; - if ( name.indexOf( "data-" ) === 0 ) { - name = camelCase( name.slice( 5 ) ); - dataAttr( elem, name, data[ name ] ); - } - } - } - dataPriv.set( elem, "hasDataAttrs", true ); - } - } - - return data; - } - - // Sets multiple values - if ( typeof key === "object" ) { - return this.each( function() { - dataUser.set( this, key ); - } ); - } - - return access( this, function( value ) { - var data; - - // The calling jQuery object (element matches) is not empty - // (and therefore has an element appears at this[ 0 ]) and the - // `value` parameter was not undefined. An empty jQuery object - // will result in `undefined` for elem = this[ 0 ] which will - // throw an exception if an attempt to read a data cache is made. - if ( elem && value === undefined ) { - - // Attempt to get data from the cache - // The key will always be camelCased in Data - data = dataUser.get( elem, key ); - if ( data !== undefined ) { - return data; - } - - // Attempt to "discover" the data in - // HTML5 custom data-* attrs - data = dataAttr( elem, key ); - if ( data !== undefined ) { - return data; - } - - // We tried really hard, but the data doesn't exist. - return; - } - - // Set the data... - this.each( function() { - - // We always store the camelCased key - dataUser.set( this, key, value ); - } ); - }, null, value, arguments.length > 1, null, true ); - }, - - removeData: function( key ) { - return this.each( function() { - dataUser.remove( this, key ); - } ); - } -} ); - - -jQuery.extend( { - queue: function( elem, type, data ) { - var queue; - - if ( elem ) { - type = ( type || "fx" ) + "queue"; - queue = dataPriv.get( elem, type ); - - // Speed up dequeue by getting out quickly if this is just a lookup - if ( data ) { - if ( !queue || Array.isArray( data ) ) { - queue = dataPriv.access( elem, type, jQuery.makeArray( data ) ); - } else { - queue.push( data ); - } - } - return queue || []; - } - }, - - dequeue: function( elem, type ) { - type = type || "fx"; - - var queue = jQuery.queue( elem, type ), - startLength = queue.length, - fn = queue.shift(), - hooks = jQuery._queueHooks( elem, type ), - next = function() { - jQuery.dequeue( elem, type ); - }; - - // If the fx queue is dequeued, always remove the progress sentinel - if ( fn === "inprogress" ) { - fn = queue.shift(); - startLength--; - } - - if ( fn ) { - - // Add a progress sentinel to prevent the fx queue from being - // automatically dequeued - if ( type === "fx" ) { - queue.unshift( "inprogress" ); - } - - // Clear up the last queue stop function - delete hooks.stop; - fn.call( elem, next, hooks ); - } - - if ( !startLength && hooks ) { - hooks.empty.fire(); - } - }, - - // Not public - generate a queueHooks object, or return the current one - _queueHooks: function( elem, type ) { - var key = type + "queueHooks"; - return dataPriv.get( elem, key ) || dataPriv.access( elem, key, { - empty: jQuery.Callbacks( "once memory" ).add( function() { - dataPriv.remove( elem, [ type + "queue", key ] ); - } ) - } ); - } -} ); - -jQuery.fn.extend( { - queue: function( type, data ) { - var setter = 2; - - if ( typeof type !== "string" ) { - data = type; - type = "fx"; - setter--; - } - - if ( arguments.length < setter ) { - return jQuery.queue( this[ 0 ], type ); - } - - return data === undefined ? - this : - this.each( function() { - var queue = jQuery.queue( this, type, data ); - - // Ensure a hooks for this queue - jQuery._queueHooks( this, type ); - - if ( type === "fx" && queue[ 0 ] !== "inprogress" ) { - jQuery.dequeue( this, type ); - } - } ); - }, - dequeue: function( type ) { - return this.each( function() { - jQuery.dequeue( this, type ); - } ); - }, - clearQueue: function( type ) { - return this.queue( type || "fx", [] ); - }, - - // Get a promise resolved when queues of a certain type - // are emptied (fx is the type by default) - promise: function( type, obj ) { - var tmp, - count = 1, - defer = jQuery.Deferred(), - elements = this, - i = this.length, - resolve = function() { - if ( !( --count ) ) { - defer.resolveWith( elements, [ elements ] ); - } - }; - - if ( typeof type !== "string" ) { - obj = type; - type = undefined; - } - type = type || "fx"; - - while ( i-- ) { - tmp = dataPriv.get( elements[ i ], type + "queueHooks" ); - if ( tmp && tmp.empty ) { - count++; - tmp.empty.add( resolve ); - } - } - resolve(); - return defer.promise( obj ); - } -} ); -var pnum = ( /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/ ).source; - -var rcssNum = new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" ); - - -var cssExpand = [ "Top", "Right", "Bottom", "Left" ]; - -var isHiddenWithinTree = function( elem, el ) { - - // isHiddenWithinTree might be called from jQuery#filter function; - // in that case, element will be second argument - elem = el || elem; - - // Inline style trumps all - return elem.style.display === "none" || - elem.style.display === "" && - - // Otherwise, check computed style - // Support: Firefox <=43 - 45 - // Disconnected elements can have computed display: none, so first confirm that elem is - // in the document. - jQuery.contains( elem.ownerDocument, elem ) && - - jQuery.css( elem, "display" ) === "none"; - }; - -var swap = function( elem, options, callback, args ) { - var ret, name, - old = {}; - - // Remember the old values, and insert the new ones - for ( name in options ) { - old[ name ] = elem.style[ name ]; - elem.style[ name ] = options[ name ]; - } - - ret = callback.apply( elem, args || [] ); - - // Revert the old values - for ( name in options ) { - elem.style[ name ] = old[ name ]; - } - - return ret; -}; - - - - -function adjustCSS( elem, prop, valueParts, tween ) { - var adjusted, scale, - maxIterations = 20, - currentValue = tween ? - function() { - return tween.cur(); - } : - function() { - return jQuery.css( elem, prop, "" ); - }, - initial = currentValue(), - unit = valueParts && valueParts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ), - - // Starting value computation is required for potential unit mismatches - initialInUnit = ( jQuery.cssNumber[ prop ] || unit !== "px" && +initial ) && - rcssNum.exec( jQuery.css( elem, prop ) ); - - if ( initialInUnit && initialInUnit[ 3 ] !== unit ) { - - // Support: Firefox <=54 - // Halve the iteration target value to prevent interference from CSS upper bounds (gh-2144) - initial = initial / 2; - - // Trust units reported by jQuery.css - unit = unit || initialInUnit[ 3 ]; - - // Iteratively approximate from a nonzero starting point - initialInUnit = +initial || 1; - - while ( maxIterations-- ) { - - // Evaluate and update our best guess (doubling guesses that zero out). - // Finish if the scale equals or crosses 1 (making the old*new product non-positive). - jQuery.style( elem, prop, initialInUnit + unit ); - if ( ( 1 - scale ) * ( 1 - ( scale = currentValue() / initial || 0.5 ) ) <= 0 ) { - maxIterations = 0; - } - initialInUnit = initialInUnit / scale; - - } - - initialInUnit = initialInUnit * 2; - jQuery.style( elem, prop, initialInUnit + unit ); - - // Make sure we update the tween properties later on - valueParts = valueParts || []; - } - - if ( valueParts ) { - initialInUnit = +initialInUnit || +initial || 0; - - // Apply relative offset (+=/-=) if specified - adjusted = valueParts[ 1 ] ? - initialInUnit + ( valueParts[ 1 ] + 1 ) * valueParts[ 2 ] : - +valueParts[ 2 ]; - if ( tween ) { - tween.unit = unit; - tween.start = initialInUnit; - tween.end = adjusted; - } - } - return adjusted; -} - - -var defaultDisplayMap = {}; - -function getDefaultDisplay( elem ) { - var temp, - doc = elem.ownerDocument, - nodeName = elem.nodeName, - display = defaultDisplayMap[ nodeName ]; - - if ( display ) { - return display; - } - - temp = doc.body.appendChild( doc.createElement( nodeName ) ); - display = jQuery.css( temp, "display" ); - - temp.parentNode.removeChild( temp ); - - if ( display === "none" ) { - display = "block"; - } - defaultDisplayMap[ nodeName ] = display; - - return display; -} - -function showHide( elements, show ) { - var display, elem, - values = [], - index = 0, - length = elements.length; - - // Determine new display value for elements that need to change - for ( ; index < length; index++ ) { - elem = elements[ index ]; - if ( !elem.style ) { - continue; - } - - display = elem.style.display; - if ( show ) { - - // Since we force visibility upon cascade-hidden elements, an immediate (and slow) - // check is required in this first loop unless we have a nonempty display value (either - // inline or about-to-be-restored) - if ( display === "none" ) { - values[ index ] = dataPriv.get( elem, "display" ) || null; - if ( !values[ index ] ) { - elem.style.display = ""; - } - } - if ( elem.style.display === "" && isHiddenWithinTree( elem ) ) { - values[ index ] = getDefaultDisplay( elem ); - } - } else { - if ( display !== "none" ) { - values[ index ] = "none"; - - // Remember what we're overwriting - dataPriv.set( elem, "display", display ); - } - } - } - - // Set the display of the elements in a second loop to avoid constant reflow - for ( index = 0; index < length; index++ ) { - if ( values[ index ] != null ) { - elements[ index ].style.display = values[ index ]; - } - } - - return elements; -} - -jQuery.fn.extend( { - show: function() { - return showHide( this, true ); - }, - hide: function() { - return showHide( this ); - }, - toggle: function( state ) { - if ( typeof state === "boolean" ) { - return state ? this.show() : this.hide(); - } - - return this.each( function() { - if ( isHiddenWithinTree( this ) ) { - jQuery( this ).show(); - } else { - jQuery( this ).hide(); - } - } ); - } -} ); -var rcheckableType = ( /^(?:checkbox|radio)$/i ); - -var rtagName = ( /<([a-z][^\/\0>\x20\t\r\n\f]+)/i ); - -var rscriptType = ( /^$|^module$|\/(?:java|ecma)script/i ); - - - -// We have to close these tags to support XHTML (#13200) -var wrapMap = { - - // Support: IE <=9 only - option: [ 1, "" ], - - // XHTML parsers do not magically insert elements in the - // same way that tag soup parsers do. So we cannot shorten - // this by omitting or other required elements. - thead: [ 1, "", "
" ], - col: [ 2, "", "
" ], - tr: [ 2, "", "
" ], - td: [ 3, "", "
" ], - - _default: [ 0, "", "" ] -}; - -// Support: IE <=9 only -wrapMap.optgroup = wrapMap.option; - -wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead; -wrapMap.th = wrapMap.td; - - -function getAll( context, tag ) { - - // Support: IE <=9 - 11 only - // Use typeof to avoid zero-argument method invocation on host objects (#15151) - var ret; - - if ( typeof context.getElementsByTagName !== "undefined" ) { - ret = context.getElementsByTagName( tag || "*" ); - - } else if ( typeof context.querySelectorAll !== "undefined" ) { - ret = context.querySelectorAll( tag || "*" ); - - } else { - ret = []; - } - - if ( tag === undefined || tag && nodeName( context, tag ) ) { - return jQuery.merge( [ context ], ret ); - } - - return ret; -} - - -// Mark scripts as having already been evaluated -function setGlobalEval( elems, refElements ) { - var i = 0, - l = elems.length; - - for ( ; i < l; i++ ) { - dataPriv.set( - elems[ i ], - "globalEval", - !refElements || dataPriv.get( refElements[ i ], "globalEval" ) - ); - } -} - - -var rhtml = /<|&#?\w+;/; - -function buildFragment( elems, context, scripts, selection, ignored ) { - var elem, tmp, tag, wrap, contains, j, - fragment = context.createDocumentFragment(), - nodes = [], - i = 0, - l = elems.length; - - for ( ; i < l; i++ ) { - elem = elems[ i ]; - - if ( elem || elem === 0 ) { - - // Add nodes directly - if ( toType( elem ) === "object" ) { - - // Support: Android <=4.0 only, PhantomJS 1 only - // push.apply(_, arraylike) throws on ancient WebKit - jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem ); - - // Convert non-html into a text node - } else if ( !rhtml.test( elem ) ) { - nodes.push( context.createTextNode( elem ) ); - - // Convert html into DOM nodes - } else { - tmp = tmp || fragment.appendChild( context.createElement( "div" ) ); - - // Deserialize a standard representation - tag = ( rtagName.exec( elem ) || [ "", "" ] )[ 1 ].toLowerCase(); - wrap = wrapMap[ tag ] || wrapMap._default; - tmp.innerHTML = wrap[ 1 ] + jQuery.htmlPrefilter( elem ) + wrap[ 2 ]; - - // Descend through wrappers to the right content - j = wrap[ 0 ]; - while ( j-- ) { - tmp = tmp.lastChild; - } - - // Support: Android <=4.0 only, PhantomJS 1 only - // push.apply(_, arraylike) throws on ancient WebKit - jQuery.merge( nodes, tmp.childNodes ); - - // Remember the top-level container - tmp = fragment.firstChild; - - // Ensure the created nodes are orphaned (#12392) - tmp.textContent = ""; - } - } - } - - // Remove wrapper from fragment - fragment.textContent = ""; - - i = 0; - while ( ( elem = nodes[ i++ ] ) ) { - - // Skip elements already in the context collection (trac-4087) - if ( selection && jQuery.inArray( elem, selection ) > -1 ) { - if ( ignored ) { - ignored.push( elem ); - } - continue; - } - - contains = jQuery.contains( elem.ownerDocument, elem ); - - // Append to fragment - tmp = getAll( fragment.appendChild( elem ), "script" ); - - // Preserve script evaluation history - if ( contains ) { - setGlobalEval( tmp ); - } - - // Capture executables - if ( scripts ) { - j = 0; - while ( ( elem = tmp[ j++ ] ) ) { - if ( rscriptType.test( elem.type || "" ) ) { - scripts.push( elem ); - } - } - } - } - - return fragment; -} - - -( function() { - var fragment = document.createDocumentFragment(), - div = fragment.appendChild( document.createElement( "div" ) ), - input = document.createElement( "input" ); - - // Support: Android 4.0 - 4.3 only - // Check state lost if the name is set (#11217) - // Support: Windows Web Apps (WWA) - // `name` and `type` must use .setAttribute for WWA (#14901) - input.setAttribute( "type", "radio" ); - input.setAttribute( "checked", "checked" ); - input.setAttribute( "name", "t" ); - - div.appendChild( input ); - - // Support: Android <=4.1 only - // Older WebKit doesn't clone checked state correctly in fragments - support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked; - - // Support: IE <=11 only - // Make sure textarea (and checkbox) defaultValue is properly cloned - div.innerHTML = ""; - support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue; -} )(); -var documentElement = document.documentElement; - - - -var - rkeyEvent = /^key/, - rmouseEvent = /^(?:mouse|pointer|contextmenu|drag|drop)|click/, - rtypenamespace = /^([^.]*)(?:\.(.+)|)/; - -function returnTrue() { - return true; -} - -function returnFalse() { - return false; -} - -// Support: IE <=9 only -// See #13393 for more info -function safeActiveElement() { - try { - return document.activeElement; - } catch ( err ) { } -} - -function on( elem, types, selector, data, fn, one ) { - var origFn, type; - - // Types can be a map of types/handlers - if ( typeof types === "object" ) { - - // ( types-Object, selector, data ) - if ( typeof selector !== "string" ) { - - // ( types-Object, data ) - data = data || selector; - selector = undefined; - } - for ( type in types ) { - on( elem, type, selector, data, types[ type ], one ); - } - return elem; - } - - if ( data == null && fn == null ) { - - // ( types, fn ) - fn = selector; - data = selector = undefined; - } else if ( fn == null ) { - if ( typeof selector === "string" ) { - - // ( types, selector, fn ) - fn = data; - data = undefined; - } else { - - // ( types, data, fn ) - fn = data; - data = selector; - selector = undefined; - } - } - if ( fn === false ) { - fn = returnFalse; - } else if ( !fn ) { - return elem; - } - - if ( one === 1 ) { - origFn = fn; - fn = function( event ) { - - // Can use an empty set, since event contains the info - jQuery().off( event ); - return origFn.apply( this, arguments ); - }; - - // Use same guid so caller can remove using origFn - fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ ); - } - return elem.each( function() { - jQuery.event.add( this, types, fn, data, selector ); - } ); -} - -/* - * Helper functions for managing events -- not part of the public interface. - * Props to Dean Edwards' addEvent library for many of the ideas. - */ -jQuery.event = { - - global: {}, - - add: function( elem, types, handler, data, selector ) { - - var handleObjIn, eventHandle, tmp, - events, t, handleObj, - special, handlers, type, namespaces, origType, - elemData = dataPriv.get( elem ); - - // Don't attach events to noData or text/comment nodes (but allow plain objects) - if ( !elemData ) { - return; - } - - // Caller can pass in an object of custom data in lieu of the handler - if ( handler.handler ) { - handleObjIn = handler; - handler = handleObjIn.handler; - selector = handleObjIn.selector; - } - - // Ensure that invalid selectors throw exceptions at attach time - // Evaluate against documentElement in case elem is a non-element node (e.g., document) - if ( selector ) { - jQuery.find.matchesSelector( documentElement, selector ); - } - - // Make sure that the handler has a unique ID, used to find/remove it later - if ( !handler.guid ) { - handler.guid = jQuery.guid++; - } - - // Init the element's event structure and main handler, if this is the first - if ( !( events = elemData.events ) ) { - events = elemData.events = {}; - } - if ( !( eventHandle = elemData.handle ) ) { - eventHandle = elemData.handle = function( e ) { - - // Discard the second event of a jQuery.event.trigger() and - // when an event is called after a page has unloaded - return typeof jQuery !== "undefined" && jQuery.event.triggered !== e.type ? - jQuery.event.dispatch.apply( elem, arguments ) : undefined; - }; - } - - // Handle multiple events separated by a space - types = ( types || "" ).match( rnothtmlwhite ) || [ "" ]; - t = types.length; - while ( t-- ) { - tmp = rtypenamespace.exec( types[ t ] ) || []; - type = origType = tmp[ 1 ]; - namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort(); - - // There *must* be a type, no attaching namespace-only handlers - if ( !type ) { - continue; - } - - // If event changes its type, use the special event handlers for the changed type - special = jQuery.event.special[ type ] || {}; - - // If selector defined, determine special event api type, otherwise given type - type = ( selector ? special.delegateType : special.bindType ) || type; - - // Update special based on newly reset type - special = jQuery.event.special[ type ] || {}; - - // handleObj is passed to all event handlers - handleObj = jQuery.extend( { - type: type, - origType: origType, - data: data, - handler: handler, - guid: handler.guid, - selector: selector, - needsContext: selector && jQuery.expr.match.needsContext.test( selector ), - namespace: namespaces.join( "." ) - }, handleObjIn ); - - // Init the event handler queue if we're the first - if ( !( handlers = events[ type ] ) ) { - handlers = events[ type ] = []; - handlers.delegateCount = 0; - - // Only use addEventListener if the special events handler returns false - if ( !special.setup || - special.setup.call( elem, data, namespaces, eventHandle ) === false ) { - - if ( elem.addEventListener ) { - elem.addEventListener( type, eventHandle ); - } - } - } - - if ( special.add ) { - special.add.call( elem, handleObj ); - - if ( !handleObj.handler.guid ) { - handleObj.handler.guid = handler.guid; - } - } - - // Add to the element's handler list, delegates in front - if ( selector ) { - handlers.splice( handlers.delegateCount++, 0, handleObj ); - } else { - handlers.push( handleObj ); - } - - // Keep track of which events have ever been used, for event optimization - jQuery.event.global[ type ] = true; - } - - }, - - // Detach an event or set of events from an element - remove: function( elem, types, handler, selector, mappedTypes ) { - - var j, origCount, tmp, - events, t, handleObj, - special, handlers, type, namespaces, origType, - elemData = dataPriv.hasData( elem ) && dataPriv.get( elem ); - - if ( !elemData || !( events = elemData.events ) ) { - return; - } - - // Once for each type.namespace in types; type may be omitted - types = ( types || "" ).match( rnothtmlwhite ) || [ "" ]; - t = types.length; - while ( t-- ) { - tmp = rtypenamespace.exec( types[ t ] ) || []; - type = origType = tmp[ 1 ]; - namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort(); - - // Unbind all events (on this namespace, if provided) for the element - if ( !type ) { - for ( type in events ) { - jQuery.event.remove( elem, type + types[ t ], handler, selector, true ); - } - continue; - } - - special = jQuery.event.special[ type ] || {}; - type = ( selector ? special.delegateType : special.bindType ) || type; - handlers = events[ type ] || []; - tmp = tmp[ 2 ] && - new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ); - - // Remove matching events - origCount = j = handlers.length; - while ( j-- ) { - handleObj = handlers[ j ]; - - if ( ( mappedTypes || origType === handleObj.origType ) && - ( !handler || handler.guid === handleObj.guid ) && - ( !tmp || tmp.test( handleObj.namespace ) ) && - ( !selector || selector === handleObj.selector || - selector === "**" && handleObj.selector ) ) { - handlers.splice( j, 1 ); - - if ( handleObj.selector ) { - handlers.delegateCount--; - } - if ( special.remove ) { - special.remove.call( elem, handleObj ); - } - } - } - - // Remove generic event handler if we removed something and no more handlers exist - // (avoids potential for endless recursion during removal of special event handlers) - if ( origCount && !handlers.length ) { - if ( !special.teardown || - special.teardown.call( elem, namespaces, elemData.handle ) === false ) { - - jQuery.removeEvent( elem, type, elemData.handle ); - } - - delete events[ type ]; - } - } - - // Remove data and the expando if it's no longer used - if ( jQuery.isEmptyObject( events ) ) { - dataPriv.remove( elem, "handle events" ); - } - }, - - dispatch: function( nativeEvent ) { - - // Make a writable jQuery.Event from the native event object - var event = jQuery.event.fix( nativeEvent ); - - var i, j, ret, matched, handleObj, handlerQueue, - args = new Array( arguments.length ), - handlers = ( dataPriv.get( this, "events" ) || {} )[ event.type ] || [], - special = jQuery.event.special[ event.type ] || {}; - - // Use the fix-ed jQuery.Event rather than the (read-only) native event - args[ 0 ] = event; - - for ( i = 1; i < arguments.length; i++ ) { - args[ i ] = arguments[ i ]; - } - - event.delegateTarget = this; - - // Call the preDispatch hook for the mapped type, and let it bail if desired - if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) { - return; - } - - // Determine handlers - handlerQueue = jQuery.event.handlers.call( this, event, handlers ); - - // Run delegates first; they may want to stop propagation beneath us - i = 0; - while ( ( matched = handlerQueue[ i++ ] ) && !event.isPropagationStopped() ) { - event.currentTarget = matched.elem; - - j = 0; - while ( ( handleObj = matched.handlers[ j++ ] ) && - !event.isImmediatePropagationStopped() ) { - - // Triggered event must either 1) have no namespace, or 2) have namespace(s) - // a subset or equal to those in the bound event (both can have no namespace). - if ( !event.rnamespace || event.rnamespace.test( handleObj.namespace ) ) { - - event.handleObj = handleObj; - event.data = handleObj.data; - - ret = ( ( jQuery.event.special[ handleObj.origType ] || {} ).handle || - handleObj.handler ).apply( matched.elem, args ); - - if ( ret !== undefined ) { - if ( ( event.result = ret ) === false ) { - event.preventDefault(); - event.stopPropagation(); - } - } - } - } - } - - // Call the postDispatch hook for the mapped type - if ( special.postDispatch ) { - special.postDispatch.call( this, event ); - } - - return event.result; - }, - - handlers: function( event, handlers ) { - var i, handleObj, sel, matchedHandlers, matchedSelectors, - handlerQueue = [], - delegateCount = handlers.delegateCount, - cur = event.target; - - // Find delegate handlers - if ( delegateCount && - - // Support: IE <=9 - // Black-hole SVG instance trees (trac-13180) - cur.nodeType && - - // Support: Firefox <=42 - // Suppress spec-violating clicks indicating a non-primary pointer button (trac-3861) - // https://www.w3.org/TR/DOM-Level-3-Events/#event-type-click - // Support: IE 11 only - // ...but not arrow key "clicks" of radio inputs, which can have `button` -1 (gh-2343) - !( event.type === "click" && event.button >= 1 ) ) { - - for ( ; cur !== this; cur = cur.parentNode || this ) { - - // Don't check non-elements (#13208) - // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764) - if ( cur.nodeType === 1 && !( event.type === "click" && cur.disabled === true ) ) { - matchedHandlers = []; - matchedSelectors = {}; - for ( i = 0; i < delegateCount; i++ ) { - handleObj = handlers[ i ]; - - // Don't conflict with Object.prototype properties (#13203) - sel = handleObj.selector + " "; - - if ( matchedSelectors[ sel ] === undefined ) { - matchedSelectors[ sel ] = handleObj.needsContext ? - jQuery( sel, this ).index( cur ) > -1 : - jQuery.find( sel, this, null, [ cur ] ).length; - } - if ( matchedSelectors[ sel ] ) { - matchedHandlers.push( handleObj ); - } - } - if ( matchedHandlers.length ) { - handlerQueue.push( { elem: cur, handlers: matchedHandlers } ); - } - } - } - } - - // Add the remaining (directly-bound) handlers - cur = this; - if ( delegateCount < handlers.length ) { - handlerQueue.push( { elem: cur, handlers: handlers.slice( delegateCount ) } ); - } - - return handlerQueue; - }, - - addProp: function( name, hook ) { - Object.defineProperty( jQuery.Event.prototype, name, { - enumerable: true, - configurable: true, - - get: isFunction( hook ) ? - function() { - if ( this.originalEvent ) { - return hook( this.originalEvent ); - } - } : - function() { - if ( this.originalEvent ) { - return this.originalEvent[ name ]; - } - }, - - set: function( value ) { - Object.defineProperty( this, name, { - enumerable: true, - configurable: true, - writable: true, - value: value - } ); - } - } ); - }, - - fix: function( originalEvent ) { - return originalEvent[ jQuery.expando ] ? - originalEvent : - new jQuery.Event( originalEvent ); - }, - - special: { - load: { - - // Prevent triggered image.load events from bubbling to window.load - noBubble: true - }, - focus: { - - // Fire native event if possible so blur/focus sequence is correct - trigger: function() { - if ( this !== safeActiveElement() && this.focus ) { - this.focus(); - return false; - } - }, - delegateType: "focusin" - }, - blur: { - trigger: function() { - if ( this === safeActiveElement() && this.blur ) { - this.blur(); - return false; - } - }, - delegateType: "focusout" - }, - click: { - - // For checkbox, fire native event so checked state will be right - trigger: function() { - if ( this.type === "checkbox" && this.click && nodeName( this, "input" ) ) { - this.click(); - return false; - } - }, - - // For cross-browser consistency, don't fire native .click() on links - _default: function( event ) { - return nodeName( event.target, "a" ); - } - }, - - beforeunload: { - postDispatch: function( event ) { - - // Support: Firefox 20+ - // Firefox doesn't alert if the returnValue field is not set. - if ( event.result !== undefined && event.originalEvent ) { - event.originalEvent.returnValue = event.result; - } - } - } - } -}; - -jQuery.removeEvent = function( elem, type, handle ) { - - // This "if" is needed for plain objects - if ( elem.removeEventListener ) { - elem.removeEventListener( type, handle ); - } -}; - -jQuery.Event = function( src, props ) { - - // Allow instantiation without the 'new' keyword - if ( !( this instanceof jQuery.Event ) ) { - return new jQuery.Event( src, props ); - } - - // Event object - if ( src && src.type ) { - this.originalEvent = src; - this.type = src.type; - - // Events bubbling up the document may have been marked as prevented - // by a handler lower down the tree; reflect the correct value. - this.isDefaultPrevented = src.defaultPrevented || - src.defaultPrevented === undefined && - - // Support: Android <=2.3 only - src.returnValue === false ? - returnTrue : - returnFalse; - - // Create target properties - // Support: Safari <=6 - 7 only - // Target should not be a text node (#504, #13143) - this.target = ( src.target && src.target.nodeType === 3 ) ? - src.target.parentNode : - src.target; - - this.currentTarget = src.currentTarget; - this.relatedTarget = src.relatedTarget; - - // Event type - } else { - this.type = src; - } - - // Put explicitly provided properties onto the event object - if ( props ) { - jQuery.extend( this, props ); - } - - // Create a timestamp if incoming event doesn't have one - this.timeStamp = src && src.timeStamp || Date.now(); - - // Mark it as fixed - this[ jQuery.expando ] = true; -}; - -// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding -// https://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html -jQuery.Event.prototype = { - constructor: jQuery.Event, - isDefaultPrevented: returnFalse, - isPropagationStopped: returnFalse, - isImmediatePropagationStopped: returnFalse, - isSimulated: false, - - preventDefault: function() { - var e = this.originalEvent; - - this.isDefaultPrevented = returnTrue; - - if ( e && !this.isSimulated ) { - e.preventDefault(); - } - }, - stopPropagation: function() { - var e = this.originalEvent; - - this.isPropagationStopped = returnTrue; - - if ( e && !this.isSimulated ) { - e.stopPropagation(); - } - }, - stopImmediatePropagation: function() { - var e = this.originalEvent; - - this.isImmediatePropagationStopped = returnTrue; - - if ( e && !this.isSimulated ) { - e.stopImmediatePropagation(); - } - - this.stopPropagation(); - } -}; - -// Includes all common event props including KeyEvent and MouseEvent specific props -jQuery.each( { - altKey: true, - bubbles: true, - cancelable: true, - changedTouches: true, - ctrlKey: true, - detail: true, - eventPhase: true, - metaKey: true, - pageX: true, - pageY: true, - shiftKey: true, - view: true, - "char": true, - charCode: true, - key: true, - keyCode: true, - button: true, - buttons: true, - clientX: true, - clientY: true, - offsetX: true, - offsetY: true, - pointerId: true, - pointerType: true, - screenX: true, - screenY: true, - targetTouches: true, - toElement: true, - touches: true, - - which: function( event ) { - var button = event.button; - - // Add which for key events - if ( event.which == null && rkeyEvent.test( event.type ) ) { - return event.charCode != null ? event.charCode : event.keyCode; - } - - // Add which for click: 1 === left; 2 === middle; 3 === right - if ( !event.which && button !== undefined && rmouseEvent.test( event.type ) ) { - if ( button & 1 ) { - return 1; - } - - if ( button & 2 ) { - return 3; - } - - if ( button & 4 ) { - return 2; - } - - return 0; - } - - return event.which; - } -}, jQuery.event.addProp ); - -// Create mouseenter/leave events using mouseover/out and event-time checks -// so that event delegation works in jQuery. -// Do the same for pointerenter/pointerleave and pointerover/pointerout -// -// Support: Safari 7 only -// Safari sends mouseenter too often; see: -// https://bugs.chromium.org/p/chromium/issues/detail?id=470258 -// for the description of the bug (it existed in older Chrome versions as well). -jQuery.each( { - mouseenter: "mouseover", - mouseleave: "mouseout", - pointerenter: "pointerover", - pointerleave: "pointerout" -}, function( orig, fix ) { - jQuery.event.special[ orig ] = { - delegateType: fix, - bindType: fix, - - handle: function( event ) { - var ret, - target = this, - related = event.relatedTarget, - handleObj = event.handleObj; - - // For mouseenter/leave call the handler if related is outside the target. - // NB: No relatedTarget if the mouse left/entered the browser window - if ( !related || ( related !== target && !jQuery.contains( target, related ) ) ) { - event.type = handleObj.origType; - ret = handleObj.handler.apply( this, arguments ); - event.type = fix; - } - return ret; - } - }; -} ); - -jQuery.fn.extend( { - - on: function( types, selector, data, fn ) { - return on( this, types, selector, data, fn ); - }, - one: function( types, selector, data, fn ) { - return on( this, types, selector, data, fn, 1 ); - }, - off: function( types, selector, fn ) { - var handleObj, type; - if ( types && types.preventDefault && types.handleObj ) { - - // ( event ) dispatched jQuery.Event - handleObj = types.handleObj; - jQuery( types.delegateTarget ).off( - handleObj.namespace ? - handleObj.origType + "." + handleObj.namespace : - handleObj.origType, - handleObj.selector, - handleObj.handler - ); - return this; - } - if ( typeof types === "object" ) { - - // ( types-object [, selector] ) - for ( type in types ) { - this.off( type, selector, types[ type ] ); - } - return this; - } - if ( selector === false || typeof selector === "function" ) { - - // ( types [, fn] ) - fn = selector; - selector = undefined; - } - if ( fn === false ) { - fn = returnFalse; - } - return this.each( function() { - jQuery.event.remove( this, types, fn, selector ); - } ); - } -} ); - - -var - - /* eslint-disable max-len */ - - // See https://github.com/eslint/eslint/issues/3229 - rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([a-z][^\/\0>\x20\t\r\n\f]*)[^>]*)\/>/gi, - - /* eslint-enable */ - - // Support: IE <=10 - 11, Edge 12 - 13 only - // In IE/Edge using regex groups here causes severe slowdowns. - // See https://connect.microsoft.com/IE/feedback/details/1736512/ - rnoInnerhtml = /\s*$/g; - -// Prefer a tbody over its parent table for containing new rows -function manipulationTarget( elem, content ) { - if ( nodeName( elem, "table" ) && - nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ) { - - return jQuery( elem ).children( "tbody" )[ 0 ] || elem; - } - - return elem; -} - -// Replace/restore the type attribute of script elements for safe DOM manipulation -function disableScript( elem ) { - elem.type = ( elem.getAttribute( "type" ) !== null ) + "/" + elem.type; - return elem; -} -function restoreScript( elem ) { - if ( ( elem.type || "" ).slice( 0, 5 ) === "true/" ) { - elem.type = elem.type.slice( 5 ); - } else { - elem.removeAttribute( "type" ); - } - - return elem; -} - -function cloneCopyEvent( src, dest ) { - var i, l, type, pdataOld, pdataCur, udataOld, udataCur, events; - - if ( dest.nodeType !== 1 ) { - return; - } - - // 1. Copy private data: events, handlers, etc. - if ( dataPriv.hasData( src ) ) { - pdataOld = dataPriv.access( src ); - pdataCur = dataPriv.set( dest, pdataOld ); - events = pdataOld.events; - - if ( events ) { - delete pdataCur.handle; - pdataCur.events = {}; - - for ( type in events ) { - for ( i = 0, l = events[ type ].length; i < l; i++ ) { - jQuery.event.add( dest, type, events[ type ][ i ] ); - } - } - } - } - - // 2. Copy user data - if ( dataUser.hasData( src ) ) { - udataOld = dataUser.access( src ); - udataCur = jQuery.extend( {}, udataOld ); - - dataUser.set( dest, udataCur ); - } -} - -// Fix IE bugs, see support tests -function fixInput( src, dest ) { - var nodeName = dest.nodeName.toLowerCase(); - - // Fails to persist the checked state of a cloned checkbox or radio button. - if ( nodeName === "input" && rcheckableType.test( src.type ) ) { - dest.checked = src.checked; - - // Fails to return the selected option to the default selected state when cloning options - } else if ( nodeName === "input" || nodeName === "textarea" ) { - dest.defaultValue = src.defaultValue; - } -} - -function domManip( collection, args, callback, ignored ) { - - // Flatten any nested arrays - args = concat.apply( [], args ); - - var fragment, first, scripts, hasScripts, node, doc, - i = 0, - l = collection.length, - iNoClone = l - 1, - value = args[ 0 ], - valueIsFunction = isFunction( value ); - - // We can't cloneNode fragments that contain checked, in WebKit - if ( valueIsFunction || - ( l > 1 && typeof value === "string" && - !support.checkClone && rchecked.test( value ) ) ) { - return collection.each( function( index ) { - var self = collection.eq( index ); - if ( valueIsFunction ) { - args[ 0 ] = value.call( this, index, self.html() ); - } - domManip( self, args, callback, ignored ); - } ); - } - - if ( l ) { - fragment = buildFragment( args, collection[ 0 ].ownerDocument, false, collection, ignored ); - first = fragment.firstChild; - - if ( fragment.childNodes.length === 1 ) { - fragment = first; - } - - // Require either new content or an interest in ignored elements to invoke the callback - if ( first || ignored ) { - scripts = jQuery.map( getAll( fragment, "script" ), disableScript ); - hasScripts = scripts.length; - - // Use the original fragment for the last item - // instead of the first because it can end up - // being emptied incorrectly in certain situations (#8070). - for ( ; i < l; i++ ) { - node = fragment; - - if ( i !== iNoClone ) { - node = jQuery.clone( node, true, true ); - - // Keep references to cloned scripts for later restoration - if ( hasScripts ) { - - // Support: Android <=4.0 only, PhantomJS 1 only - // push.apply(_, arraylike) throws on ancient WebKit - jQuery.merge( scripts, getAll( node, "script" ) ); - } - } - - callback.call( collection[ i ], node, i ); - } - - if ( hasScripts ) { - doc = scripts[ scripts.length - 1 ].ownerDocument; - - // Reenable scripts - jQuery.map( scripts, restoreScript ); - - // Evaluate executable scripts on first document insertion - for ( i = 0; i < hasScripts; i++ ) { - node = scripts[ i ]; - if ( rscriptType.test( node.type || "" ) && - !dataPriv.access( node, "globalEval" ) && - jQuery.contains( doc, node ) ) { - - if ( node.src && ( node.type || "" ).toLowerCase() !== "module" ) { - - // Optional AJAX dependency, but won't run scripts if not present - if ( jQuery._evalUrl ) { - jQuery._evalUrl( node.src ); - } - } else { - DOMEval( node.textContent.replace( rcleanScript, "" ), doc, node ); - } - } - } - } - } - } - - return collection; -} - -function remove( elem, selector, keepData ) { - var node, - nodes = selector ? jQuery.filter( selector, elem ) : elem, - i = 0; - - for ( ; ( node = nodes[ i ] ) != null; i++ ) { - if ( !keepData && node.nodeType === 1 ) { - jQuery.cleanData( getAll( node ) ); - } - - if ( node.parentNode ) { - if ( keepData && jQuery.contains( node.ownerDocument, node ) ) { - setGlobalEval( getAll( node, "script" ) ); - } - node.parentNode.removeChild( node ); - } - } - - return elem; -} - -jQuery.extend( { - htmlPrefilter: function( html ) { - return html.replace( rxhtmlTag, "<$1>" ); - }, - - clone: function( elem, dataAndEvents, deepDataAndEvents ) { - var i, l, srcElements, destElements, - clone = elem.cloneNode( true ), - inPage = jQuery.contains( elem.ownerDocument, elem ); - - // Fix IE cloning issues - if ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) && - !jQuery.isXMLDoc( elem ) ) { - - // We eschew Sizzle here for performance reasons: https://jsperf.com/getall-vs-sizzle/2 - destElements = getAll( clone ); - srcElements = getAll( elem ); - - for ( i = 0, l = srcElements.length; i < l; i++ ) { - fixInput( srcElements[ i ], destElements[ i ] ); - } - } - - // Copy the events from the original to the clone - if ( dataAndEvents ) { - if ( deepDataAndEvents ) { - srcElements = srcElements || getAll( elem ); - destElements = destElements || getAll( clone ); - - for ( i = 0, l = srcElements.length; i < l; i++ ) { - cloneCopyEvent( srcElements[ i ], destElements[ i ] ); - } - } else { - cloneCopyEvent( elem, clone ); - } - } - - // Preserve script evaluation history - destElements = getAll( clone, "script" ); - if ( destElements.length > 0 ) { - setGlobalEval( destElements, !inPage && getAll( elem, "script" ) ); - } - - // Return the cloned set - return clone; - }, - - cleanData: function( elems ) { - var data, elem, type, - special = jQuery.event.special, - i = 0; - - for ( ; ( elem = elems[ i ] ) !== undefined; i++ ) { - if ( acceptData( elem ) ) { - if ( ( data = elem[ dataPriv.expando ] ) ) { - if ( data.events ) { - for ( type in data.events ) { - if ( special[ type ] ) { - jQuery.event.remove( elem, type ); - - // This is a shortcut to avoid jQuery.event.remove's overhead - } else { - jQuery.removeEvent( elem, type, data.handle ); - } - } - } - - // Support: Chrome <=35 - 45+ - // Assign undefined instead of using delete, see Data#remove - elem[ dataPriv.expando ] = undefined; - } - if ( elem[ dataUser.expando ] ) { - - // Support: Chrome <=35 - 45+ - // Assign undefined instead of using delete, see Data#remove - elem[ dataUser.expando ] = undefined; - } - } - } - } -} ); - -jQuery.fn.extend( { - detach: function( selector ) { - return remove( this, selector, true ); - }, - - remove: function( selector ) { - return remove( this, selector ); - }, - - text: function( value ) { - return access( this, function( value ) { - return value === undefined ? - jQuery.text( this ) : - this.empty().each( function() { - if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { - this.textContent = value; - } - } ); - }, null, value, arguments.length ); - }, - - append: function() { - return domManip( this, arguments, function( elem ) { - if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { - var target = manipulationTarget( this, elem ); - target.appendChild( elem ); - } - } ); - }, - - prepend: function() { - return domManip( this, arguments, function( elem ) { - if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { - var target = manipulationTarget( this, elem ); - target.insertBefore( elem, target.firstChild ); - } - } ); - }, - - before: function() { - return domManip( this, arguments, function( elem ) { - if ( this.parentNode ) { - this.parentNode.insertBefore( elem, this ); - } - } ); - }, - - after: function() { - return domManip( this, arguments, function( elem ) { - if ( this.parentNode ) { - this.parentNode.insertBefore( elem, this.nextSibling ); - } - } ); - }, - - empty: function() { - var elem, - i = 0; - - for ( ; ( elem = this[ i ] ) != null; i++ ) { - if ( elem.nodeType === 1 ) { - - // Prevent memory leaks - jQuery.cleanData( getAll( elem, false ) ); - - // Remove any remaining nodes - elem.textContent = ""; - } - } - - return this; - }, - - clone: function( dataAndEvents, deepDataAndEvents ) { - dataAndEvents = dataAndEvents == null ? false : dataAndEvents; - deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents; - - return this.map( function() { - return jQuery.clone( this, dataAndEvents, deepDataAndEvents ); - } ); - }, - - html: function( value ) { - return access( this, function( value ) { - var elem = this[ 0 ] || {}, - i = 0, - l = this.length; - - if ( value === undefined && elem.nodeType === 1 ) { - return elem.innerHTML; - } - - // See if we can take a shortcut and just use innerHTML - if ( typeof value === "string" && !rnoInnerhtml.test( value ) && - !wrapMap[ ( rtagName.exec( value ) || [ "", "" ] )[ 1 ].toLowerCase() ] ) { - - value = jQuery.htmlPrefilter( value ); - - try { - for ( ; i < l; i++ ) { - elem = this[ i ] || {}; - - // Remove element nodes and prevent memory leaks - if ( elem.nodeType === 1 ) { - jQuery.cleanData( getAll( elem, false ) ); - elem.innerHTML = value; - } - } - - elem = 0; - - // If using innerHTML throws an exception, use the fallback method - } catch ( e ) {} - } - - if ( elem ) { - this.empty().append( value ); - } - }, null, value, arguments.length ); - }, - - replaceWith: function() { - var ignored = []; - - // Make the changes, replacing each non-ignored context element with the new content - return domManip( this, arguments, function( elem ) { - var parent = this.parentNode; - - if ( jQuery.inArray( this, ignored ) < 0 ) { - jQuery.cleanData( getAll( this ) ); - if ( parent ) { - parent.replaceChild( elem, this ); - } - } - - // Force callback invocation - }, ignored ); - } -} ); - -jQuery.each( { - appendTo: "append", - prependTo: "prepend", - insertBefore: "before", - insertAfter: "after", - replaceAll: "replaceWith" -}, function( name, original ) { - jQuery.fn[ name ] = function( selector ) { - var elems, - ret = [], - insert = jQuery( selector ), - last = insert.length - 1, - i = 0; - - for ( ; i <= last; i++ ) { - elems = i === last ? this : this.clone( true ); - jQuery( insert[ i ] )[ original ]( elems ); - - // Support: Android <=4.0 only, PhantomJS 1 only - // .get() because push.apply(_, arraylike) throws on ancient WebKit - push.apply( ret, elems.get() ); - } - - return this.pushStack( ret ); - }; -} ); -var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" ); - -var getStyles = function( elem ) { - - // Support: IE <=11 only, Firefox <=30 (#15098, #14150) - // IE throws on elements created in popups - // FF meanwhile throws on frame elements through "defaultView.getComputedStyle" - var view = elem.ownerDocument.defaultView; - - if ( !view || !view.opener ) { - view = window; - } - - return view.getComputedStyle( elem ); - }; - -var rboxStyle = new RegExp( cssExpand.join( "|" ), "i" ); - - - -( function() { - - // Executing both pixelPosition & boxSizingReliable tests require only one layout - // so they're executed at the same time to save the second computation. - function computeStyleTests() { - - // This is a singleton, we need to execute it only once - if ( !div ) { - return; - } - - container.style.cssText = "position:absolute;left:-11111px;width:60px;" + - "margin-top:1px;padding:0;border:0"; - div.style.cssText = - "position:relative;display:block;box-sizing:border-box;overflow:scroll;" + - "margin:auto;border:1px;padding:1px;" + - "width:60%;top:1%"; - documentElement.appendChild( container ).appendChild( div ); - - var divStyle = window.getComputedStyle( div ); - pixelPositionVal = divStyle.top !== "1%"; - - // Support: Android 4.0 - 4.3 only, Firefox <=3 - 44 - reliableMarginLeftVal = roundPixelMeasures( divStyle.marginLeft ) === 12; - - // Support: Android 4.0 - 4.3 only, Safari <=9.1 - 10.1, iOS <=7.0 - 9.3 - // Some styles come back with percentage values, even though they shouldn't - div.style.right = "60%"; - pixelBoxStylesVal = roundPixelMeasures( divStyle.right ) === 36; - - // Support: IE 9 - 11 only - // Detect misreporting of content dimensions for box-sizing:border-box elements - boxSizingReliableVal = roundPixelMeasures( divStyle.width ) === 36; - - // Support: IE 9 only - // Detect overflow:scroll screwiness (gh-3699) - div.style.position = "absolute"; - scrollboxSizeVal = div.offsetWidth === 36 || "absolute"; - - documentElement.removeChild( container ); - - // Nullify the div so it wouldn't be stored in the memory and - // it will also be a sign that checks already performed - div = null; - } - - function roundPixelMeasures( measure ) { - return Math.round( parseFloat( measure ) ); - } - - var pixelPositionVal, boxSizingReliableVal, scrollboxSizeVal, pixelBoxStylesVal, - reliableMarginLeftVal, - container = document.createElement( "div" ), - div = document.createElement( "div" ); - - // Finish early in limited (non-browser) environments - if ( !div.style ) { - return; - } - - // Support: IE <=9 - 11 only - // Style of cloned element affects source element cloned (#8908) - div.style.backgroundClip = "content-box"; - div.cloneNode( true ).style.backgroundClip = ""; - support.clearCloneStyle = div.style.backgroundClip === "content-box"; - - jQuery.extend( support, { - boxSizingReliable: function() { - computeStyleTests(); - return boxSizingReliableVal; - }, - pixelBoxStyles: function() { - computeStyleTests(); - return pixelBoxStylesVal; - }, - pixelPosition: function() { - computeStyleTests(); - return pixelPositionVal; - }, - reliableMarginLeft: function() { - computeStyleTests(); - return reliableMarginLeftVal; - }, - scrollboxSize: function() { - computeStyleTests(); - return scrollboxSizeVal; - } - } ); -} )(); - - -function curCSS( elem, name, computed ) { - var width, minWidth, maxWidth, ret, - - // Support: Firefox 51+ - // Retrieving style before computed somehow - // fixes an issue with getting wrong values - // on detached elements - style = elem.style; - - computed = computed || getStyles( elem ); - - // getPropertyValue is needed for: - // .css('filter') (IE 9 only, #12537) - // .css('--customProperty) (#3144) - if ( computed ) { - ret = computed.getPropertyValue( name ) || computed[ name ]; - - if ( ret === "" && !jQuery.contains( elem.ownerDocument, elem ) ) { - ret = jQuery.style( elem, name ); - } - - // A tribute to the "awesome hack by Dean Edwards" - // Android Browser returns percentage for some values, - // but width seems to be reliably pixels. - // This is against the CSSOM draft spec: - // https://drafts.csswg.org/cssom/#resolved-values - if ( !support.pixelBoxStyles() && rnumnonpx.test( ret ) && rboxStyle.test( name ) ) { - - // Remember the original values - width = style.width; - minWidth = style.minWidth; - maxWidth = style.maxWidth; - - // Put in the new values to get a computed value out - style.minWidth = style.maxWidth = style.width = ret; - ret = computed.width; - - // Revert the changed values - style.width = width; - style.minWidth = minWidth; - style.maxWidth = maxWidth; - } - } - - return ret !== undefined ? - - // Support: IE <=9 - 11 only - // IE returns zIndex value as an integer. - ret + "" : - ret; -} - - -function addGetHookIf( conditionFn, hookFn ) { - - // Define the hook, we'll check on the first run if it's really needed. - return { - get: function() { - if ( conditionFn() ) { - - // Hook not needed (or it's not possible to use it due - // to missing dependency), remove it. - delete this.get; - return; - } - - // Hook needed; redefine it so that the support test is not executed again. - return ( this.get = hookFn ).apply( this, arguments ); - } - }; -} - - -var - - // Swappable if display is none or starts with table - // except "table", "table-cell", or "table-caption" - // See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display - rdisplayswap = /^(none|table(?!-c[ea]).+)/, - rcustomProp = /^--/, - cssShow = { position: "absolute", visibility: "hidden", display: "block" }, - cssNormalTransform = { - letterSpacing: "0", - fontWeight: "400" - }, - - cssPrefixes = [ "Webkit", "Moz", "ms" ], - emptyStyle = document.createElement( "div" ).style; - -// Return a css property mapped to a potentially vendor prefixed property -function vendorPropName( name ) { - - // Shortcut for names that are not vendor prefixed - if ( name in emptyStyle ) { - return name; - } - - // Check for vendor prefixed names - var capName = name[ 0 ].toUpperCase() + name.slice( 1 ), - i = cssPrefixes.length; - - while ( i-- ) { - name = cssPrefixes[ i ] + capName; - if ( name in emptyStyle ) { - return name; - } - } -} - -// Return a property mapped along what jQuery.cssProps suggests or to -// a vendor prefixed property. -function finalPropName( name ) { - var ret = jQuery.cssProps[ name ]; - if ( !ret ) { - ret = jQuery.cssProps[ name ] = vendorPropName( name ) || name; - } - return ret; -} - -function setPositiveNumber( elem, value, subtract ) { - - // Any relative (+/-) values have already been - // normalized at this point - var matches = rcssNum.exec( value ); - return matches ? - - // Guard against undefined "subtract", e.g., when used as in cssHooks - Math.max( 0, matches[ 2 ] - ( subtract || 0 ) ) + ( matches[ 3 ] || "px" ) : - value; -} - -function boxModelAdjustment( elem, dimension, box, isBorderBox, styles, computedVal ) { - var i = dimension === "width" ? 1 : 0, - extra = 0, - delta = 0; - - // Adjustment may not be necessary - if ( box === ( isBorderBox ? "border" : "content" ) ) { - return 0; - } - - for ( ; i < 4; i += 2 ) { - - // Both box models exclude margin - if ( box === "margin" ) { - delta += jQuery.css( elem, box + cssExpand[ i ], true, styles ); - } - - // If we get here with a content-box, we're seeking "padding" or "border" or "margin" - if ( !isBorderBox ) { - - // Add padding - delta += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles ); - - // For "border" or "margin", add border - if ( box !== "padding" ) { - delta += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); - - // But still keep track of it otherwise - } else { - extra += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); - } - - // If we get here with a border-box (content + padding + border), we're seeking "content" or - // "padding" or "margin" - } else { - - // For "content", subtract padding - if ( box === "content" ) { - delta -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles ); - } - - // For "content" or "padding", subtract border - if ( box !== "margin" ) { - delta -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); - } - } - } - - // Account for positive content-box scroll gutter when requested by providing computedVal - if ( !isBorderBox && computedVal >= 0 ) { - - // offsetWidth/offsetHeight is a rounded sum of content, padding, scroll gutter, and border - // Assuming integer scroll gutter, subtract the rest and round down - delta += Math.max( 0, Math.ceil( - elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] - - computedVal - - delta - - extra - - 0.5 - ) ); - } - - return delta; -} - -function getWidthOrHeight( elem, dimension, extra ) { - - // Start with computed style - var styles = getStyles( elem ), - val = curCSS( elem, dimension, styles ), - isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box", - valueIsBorderBox = isBorderBox; - - // Support: Firefox <=54 - // Return a confounding non-pixel value or feign ignorance, as appropriate. - if ( rnumnonpx.test( val ) ) { - if ( !extra ) { - return val; - } - val = "auto"; - } - - // Check for style in case a browser which returns unreliable values - // for getComputedStyle silently falls back to the reliable elem.style - valueIsBorderBox = valueIsBorderBox && - ( support.boxSizingReliable() || val === elem.style[ dimension ] ); - - // Fall back to offsetWidth/offsetHeight when value is "auto" - // This happens for inline elements with no explicit setting (gh-3571) - // Support: Android <=4.1 - 4.3 only - // Also use offsetWidth/offsetHeight for misreported inline dimensions (gh-3602) - if ( val === "auto" || - !parseFloat( val ) && jQuery.css( elem, "display", false, styles ) === "inline" ) { - - val = elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ]; - - // offsetWidth/offsetHeight provide border-box values - valueIsBorderBox = true; - } - - // Normalize "" and auto - val = parseFloat( val ) || 0; - - // Adjust for the element's box model - return ( val + - boxModelAdjustment( - elem, - dimension, - extra || ( isBorderBox ? "border" : "content" ), - valueIsBorderBox, - styles, - - // Provide the current computed size to request scroll gutter calculation (gh-3589) - val - ) - ) + "px"; -} - -jQuery.extend( { - - // Add in style property hooks for overriding the default - // behavior of getting and setting a style property - cssHooks: { - opacity: { - get: function( elem, computed ) { - if ( computed ) { - - // We should always get a number back from opacity - var ret = curCSS( elem, "opacity" ); - return ret === "" ? "1" : ret; - } - } - } - }, - - // Don't automatically add "px" to these possibly-unitless properties - cssNumber: { - "animationIterationCount": true, - "columnCount": true, - "fillOpacity": true, - "flexGrow": true, - "flexShrink": true, - "fontWeight": true, - "lineHeight": true, - "opacity": true, - "order": true, - "orphans": true, - "widows": true, - "zIndex": true, - "zoom": true - }, - - // Add in properties whose names you wish to fix before - // setting or getting the value - cssProps: {}, - - // Get and set the style property on a DOM Node - style: function( elem, name, value, extra ) { - - // Don't set styles on text and comment nodes - if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) { - return; - } - - // Make sure that we're working with the right name - var ret, type, hooks, - origName = camelCase( name ), - isCustomProp = rcustomProp.test( name ), - style = elem.style; - - // Make sure that we're working with the right name. We don't - // want to query the value if it is a CSS custom property - // since they are user-defined. - if ( !isCustomProp ) { - name = finalPropName( origName ); - } - - // Gets hook for the prefixed version, then unprefixed version - hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; - - // Check if we're setting a value - if ( value !== undefined ) { - type = typeof value; - - // Convert "+=" or "-=" to relative numbers (#7345) - if ( type === "string" && ( ret = rcssNum.exec( value ) ) && ret[ 1 ] ) { - value = adjustCSS( elem, name, ret ); - - // Fixes bug #9237 - type = "number"; - } - - // Make sure that null and NaN values aren't set (#7116) - if ( value == null || value !== value ) { - return; - } - - // If a number was passed in, add the unit (except for certain CSS properties) - if ( type === "number" ) { - value += ret && ret[ 3 ] || ( jQuery.cssNumber[ origName ] ? "" : "px" ); - } - - // background-* props affect original clone's values - if ( !support.clearCloneStyle && value === "" && name.indexOf( "background" ) === 0 ) { - style[ name ] = "inherit"; - } - - // If a hook was provided, use that value, otherwise just set the specified value - if ( !hooks || !( "set" in hooks ) || - ( value = hooks.set( elem, value, extra ) ) !== undefined ) { - - if ( isCustomProp ) { - style.setProperty( name, value ); - } else { - style[ name ] = value; - } - } - - } else { - - // If a hook was provided get the non-computed value from there - if ( hooks && "get" in hooks && - ( ret = hooks.get( elem, false, extra ) ) !== undefined ) { - - return ret; - } - - // Otherwise just get the value from the style object - return style[ name ]; - } - }, - - css: function( elem, name, extra, styles ) { - var val, num, hooks, - origName = camelCase( name ), - isCustomProp = rcustomProp.test( name ); - - // Make sure that we're working with the right name. We don't - // want to modify the value if it is a CSS custom property - // since they are user-defined. - if ( !isCustomProp ) { - name = finalPropName( origName ); - } - - // Try prefixed name followed by the unprefixed name - hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; - - // If a hook was provided get the computed value from there - if ( hooks && "get" in hooks ) { - val = hooks.get( elem, true, extra ); - } - - // Otherwise, if a way to get the computed value exists, use that - if ( val === undefined ) { - val = curCSS( elem, name, styles ); - } - - // Convert "normal" to computed value - if ( val === "normal" && name in cssNormalTransform ) { - val = cssNormalTransform[ name ]; - } - - // Make numeric if forced or a qualifier was provided and val looks numeric - if ( extra === "" || extra ) { - num = parseFloat( val ); - return extra === true || isFinite( num ) ? num || 0 : val; - } - - return val; - } -} ); - -jQuery.each( [ "height", "width" ], function( i, dimension ) { - jQuery.cssHooks[ dimension ] = { - get: function( elem, computed, extra ) { - if ( computed ) { - - // Certain elements can have dimension info if we invisibly show them - // but it must have a current display style that would benefit - return rdisplayswap.test( jQuery.css( elem, "display" ) ) && - - // Support: Safari 8+ - // Table columns in Safari have non-zero offsetWidth & zero - // getBoundingClientRect().width unless display is changed. - // Support: IE <=11 only - // Running getBoundingClientRect on a disconnected node - // in IE throws an error. - ( !elem.getClientRects().length || !elem.getBoundingClientRect().width ) ? - swap( elem, cssShow, function() { - return getWidthOrHeight( elem, dimension, extra ); - } ) : - getWidthOrHeight( elem, dimension, extra ); - } - }, - - set: function( elem, value, extra ) { - var matches, - styles = getStyles( elem ), - isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box", - subtract = extra && boxModelAdjustment( - elem, - dimension, - extra, - isBorderBox, - styles - ); - - // Account for unreliable border-box dimensions by comparing offset* to computed and - // faking a content-box to get border and padding (gh-3699) - if ( isBorderBox && support.scrollboxSize() === styles.position ) { - subtract -= Math.ceil( - elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] - - parseFloat( styles[ dimension ] ) - - boxModelAdjustment( elem, dimension, "border", false, styles ) - - 0.5 - ); - } - - // Convert to pixels if value adjustment is needed - if ( subtract && ( matches = rcssNum.exec( value ) ) && - ( matches[ 3 ] || "px" ) !== "px" ) { - - elem.style[ dimension ] = value; - value = jQuery.css( elem, dimension ); - } - - return setPositiveNumber( elem, value, subtract ); - } - }; -} ); - -jQuery.cssHooks.marginLeft = addGetHookIf( support.reliableMarginLeft, - function( elem, computed ) { - if ( computed ) { - return ( parseFloat( curCSS( elem, "marginLeft" ) ) || - elem.getBoundingClientRect().left - - swap( elem, { marginLeft: 0 }, function() { - return elem.getBoundingClientRect().left; - } ) - ) + "px"; - } - } -); - -// These hooks are used by animate to expand properties -jQuery.each( { - margin: "", - padding: "", - border: "Width" -}, function( prefix, suffix ) { - jQuery.cssHooks[ prefix + suffix ] = { - expand: function( value ) { - var i = 0, - expanded = {}, - - // Assumes a single number if not a string - parts = typeof value === "string" ? value.split( " " ) : [ value ]; - - for ( ; i < 4; i++ ) { - expanded[ prefix + cssExpand[ i ] + suffix ] = - parts[ i ] || parts[ i - 2 ] || parts[ 0 ]; - } - - return expanded; - } - }; - - if ( prefix !== "margin" ) { - jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber; - } -} ); - -jQuery.fn.extend( { - css: function( name, value ) { - return access( this, function( elem, name, value ) { - var styles, len, - map = {}, - i = 0; - - if ( Array.isArray( name ) ) { - styles = getStyles( elem ); - len = name.length; - - for ( ; i < len; i++ ) { - map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles ); - } - - return map; - } - - return value !== undefined ? - jQuery.style( elem, name, value ) : - jQuery.css( elem, name ); - }, name, value, arguments.length > 1 ); - } -} ); - - -function Tween( elem, options, prop, end, easing ) { - return new Tween.prototype.init( elem, options, prop, end, easing ); -} -jQuery.Tween = Tween; - -Tween.prototype = { - constructor: Tween, - init: function( elem, options, prop, end, easing, unit ) { - this.elem = elem; - this.prop = prop; - this.easing = easing || jQuery.easing._default; - this.options = options; - this.start = this.now = this.cur(); - this.end = end; - this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" ); - }, - cur: function() { - var hooks = Tween.propHooks[ this.prop ]; - - return hooks && hooks.get ? - hooks.get( this ) : - Tween.propHooks._default.get( this ); - }, - run: function( percent ) { - var eased, - hooks = Tween.propHooks[ this.prop ]; - - if ( this.options.duration ) { - this.pos = eased = jQuery.easing[ this.easing ]( - percent, this.options.duration * percent, 0, 1, this.options.duration - ); - } else { - this.pos = eased = percent; - } - this.now = ( this.end - this.start ) * eased + this.start; - - if ( this.options.step ) { - this.options.step.call( this.elem, this.now, this ); - } - - if ( hooks && hooks.set ) { - hooks.set( this ); - } else { - Tween.propHooks._default.set( this ); - } - return this; - } -}; - -Tween.prototype.init.prototype = Tween.prototype; - -Tween.propHooks = { - _default: { - get: function( tween ) { - var result; - - // Use a property on the element directly when it is not a DOM element, - // or when there is no matching style property that exists. - if ( tween.elem.nodeType !== 1 || - tween.elem[ tween.prop ] != null && tween.elem.style[ tween.prop ] == null ) { - return tween.elem[ tween.prop ]; - } - - // Passing an empty string as a 3rd parameter to .css will automatically - // attempt a parseFloat and fallback to a string if the parse fails. - // Simple values such as "10px" are parsed to Float; - // complex values such as "rotate(1rad)" are returned as-is. - result = jQuery.css( tween.elem, tween.prop, "" ); - - // Empty strings, null, undefined and "auto" are converted to 0. - return !result || result === "auto" ? 0 : result; - }, - set: function( tween ) { - - // Use step hook for back compat. - // Use cssHook if its there. - // Use .style if available and use plain properties where available. - if ( jQuery.fx.step[ tween.prop ] ) { - jQuery.fx.step[ tween.prop ]( tween ); - } else if ( tween.elem.nodeType === 1 && - ( tween.elem.style[ jQuery.cssProps[ tween.prop ] ] != null || - jQuery.cssHooks[ tween.prop ] ) ) { - jQuery.style( tween.elem, tween.prop, tween.now + tween.unit ); - } else { - tween.elem[ tween.prop ] = tween.now; - } - } - } -}; - -// Support: IE <=9 only -// Panic based approach to setting things on disconnected nodes -Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = { - set: function( tween ) { - if ( tween.elem.nodeType && tween.elem.parentNode ) { - tween.elem[ tween.prop ] = tween.now; - } - } -}; - -jQuery.easing = { - linear: function( p ) { - return p; - }, - swing: function( p ) { - return 0.5 - Math.cos( p * Math.PI ) / 2; - }, - _default: "swing" -}; - -jQuery.fx = Tween.prototype.init; - -// Back compat <1.8 extension point -jQuery.fx.step = {}; - - - - -var - fxNow, inProgress, - rfxtypes = /^(?:toggle|show|hide)$/, - rrun = /queueHooks$/; - -function schedule() { - if ( inProgress ) { - if ( document.hidden === false && window.requestAnimationFrame ) { - window.requestAnimationFrame( schedule ); - } else { - window.setTimeout( schedule, jQuery.fx.interval ); - } - - jQuery.fx.tick(); - } -} - -// Animations created synchronously will run synchronously -function createFxNow() { - window.setTimeout( function() { - fxNow = undefined; - } ); - return ( fxNow = Date.now() ); -} - -// Generate parameters to create a standard animation -function genFx( type, includeWidth ) { - var which, - i = 0, - attrs = { height: type }; - - // If we include width, step value is 1 to do all cssExpand values, - // otherwise step value is 2 to skip over Left and Right - includeWidth = includeWidth ? 1 : 0; - for ( ; i < 4; i += 2 - includeWidth ) { - which = cssExpand[ i ]; - attrs[ "margin" + which ] = attrs[ "padding" + which ] = type; - } - - if ( includeWidth ) { - attrs.opacity = attrs.width = type; - } - - return attrs; -} - -function createTween( value, prop, animation ) { - var tween, - collection = ( Animation.tweeners[ prop ] || [] ).concat( Animation.tweeners[ "*" ] ), - index = 0, - length = collection.length; - for ( ; index < length; index++ ) { - if ( ( tween = collection[ index ].call( animation, prop, value ) ) ) { - - // We're done with this property - return tween; - } - } -} - -function defaultPrefilter( elem, props, opts ) { - var prop, value, toggle, hooks, oldfire, propTween, restoreDisplay, display, - isBox = "width" in props || "height" in props, - anim = this, - orig = {}, - style = elem.style, - hidden = elem.nodeType && isHiddenWithinTree( elem ), - dataShow = dataPriv.get( elem, "fxshow" ); - - // Queue-skipping animations hijack the fx hooks - if ( !opts.queue ) { - hooks = jQuery._queueHooks( elem, "fx" ); - if ( hooks.unqueued == null ) { - hooks.unqueued = 0; - oldfire = hooks.empty.fire; - hooks.empty.fire = function() { - if ( !hooks.unqueued ) { - oldfire(); - } - }; - } - hooks.unqueued++; - - anim.always( function() { - - // Ensure the complete handler is called before this completes - anim.always( function() { - hooks.unqueued--; - if ( !jQuery.queue( elem, "fx" ).length ) { - hooks.empty.fire(); - } - } ); - } ); - } - - // Detect show/hide animations - for ( prop in props ) { - value = props[ prop ]; - if ( rfxtypes.test( value ) ) { - delete props[ prop ]; - toggle = toggle || value === "toggle"; - if ( value === ( hidden ? "hide" : "show" ) ) { - - // Pretend to be hidden if this is a "show" and - // there is still data from a stopped show/hide - if ( value === "show" && dataShow && dataShow[ prop ] !== undefined ) { - hidden = true; - - // Ignore all other no-op show/hide data - } else { - continue; - } - } - orig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop ); - } - } - - // Bail out if this is a no-op like .hide().hide() - propTween = !jQuery.isEmptyObject( props ); - if ( !propTween && jQuery.isEmptyObject( orig ) ) { - return; - } - - // Restrict "overflow" and "display" styles during box animations - if ( isBox && elem.nodeType === 1 ) { - - // Support: IE <=9 - 11, Edge 12 - 15 - // Record all 3 overflow attributes because IE does not infer the shorthand - // from identically-valued overflowX and overflowY and Edge just mirrors - // the overflowX value there. - opts.overflow = [ style.overflow, style.overflowX, style.overflowY ]; - - // Identify a display type, preferring old show/hide data over the CSS cascade - restoreDisplay = dataShow && dataShow.display; - if ( restoreDisplay == null ) { - restoreDisplay = dataPriv.get( elem, "display" ); - } - display = jQuery.css( elem, "display" ); - if ( display === "none" ) { - if ( restoreDisplay ) { - display = restoreDisplay; - } else { - - // Get nonempty value(s) by temporarily forcing visibility - showHide( [ elem ], true ); - restoreDisplay = elem.style.display || restoreDisplay; - display = jQuery.css( elem, "display" ); - showHide( [ elem ] ); - } - } - - // Animate inline elements as inline-block - if ( display === "inline" || display === "inline-block" && restoreDisplay != null ) { - if ( jQuery.css( elem, "float" ) === "none" ) { - - // Restore the original display value at the end of pure show/hide animations - if ( !propTween ) { - anim.done( function() { - style.display = restoreDisplay; - } ); - if ( restoreDisplay == null ) { - display = style.display; - restoreDisplay = display === "none" ? "" : display; - } - } - style.display = "inline-block"; - } - } - } - - if ( opts.overflow ) { - style.overflow = "hidden"; - anim.always( function() { - style.overflow = opts.overflow[ 0 ]; - style.overflowX = opts.overflow[ 1 ]; - style.overflowY = opts.overflow[ 2 ]; - } ); - } - - // Implement show/hide animations - propTween = false; - for ( prop in orig ) { - - // General show/hide setup for this element animation - if ( !propTween ) { - if ( dataShow ) { - if ( "hidden" in dataShow ) { - hidden = dataShow.hidden; - } - } else { - dataShow = dataPriv.access( elem, "fxshow", { display: restoreDisplay } ); - } - - // Store hidden/visible for toggle so `.stop().toggle()` "reverses" - if ( toggle ) { - dataShow.hidden = !hidden; - } - - // Show elements before animating them - if ( hidden ) { - showHide( [ elem ], true ); - } - - /* eslint-disable no-loop-func */ - - anim.done( function() { - - /* eslint-enable no-loop-func */ - - // The final step of a "hide" animation is actually hiding the element - if ( !hidden ) { - showHide( [ elem ] ); - } - dataPriv.remove( elem, "fxshow" ); - for ( prop in orig ) { - jQuery.style( elem, prop, orig[ prop ] ); - } - } ); - } - - // Per-property setup - propTween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim ); - if ( !( prop in dataShow ) ) { - dataShow[ prop ] = propTween.start; - if ( hidden ) { - propTween.end = propTween.start; - propTween.start = 0; - } - } - } -} - -function propFilter( props, specialEasing ) { - var index, name, easing, value, hooks; - - // camelCase, specialEasing and expand cssHook pass - for ( index in props ) { - name = camelCase( index ); - easing = specialEasing[ name ]; - value = props[ index ]; - if ( Array.isArray( value ) ) { - easing = value[ 1 ]; - value = props[ index ] = value[ 0 ]; - } - - if ( index !== name ) { - props[ name ] = value; - delete props[ index ]; - } - - hooks = jQuery.cssHooks[ name ]; - if ( hooks && "expand" in hooks ) { - value = hooks.expand( value ); - delete props[ name ]; - - // Not quite $.extend, this won't overwrite existing keys. - // Reusing 'index' because we have the correct "name" - for ( index in value ) { - if ( !( index in props ) ) { - props[ index ] = value[ index ]; - specialEasing[ index ] = easing; - } - } - } else { - specialEasing[ name ] = easing; - } - } -} - -function Animation( elem, properties, options ) { - var result, - stopped, - index = 0, - length = Animation.prefilters.length, - deferred = jQuery.Deferred().always( function() { - - // Don't match elem in the :animated selector - delete tick.elem; - } ), - tick = function() { - if ( stopped ) { - return false; - } - var currentTime = fxNow || createFxNow(), - remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ), - - // Support: Android 2.3 only - // Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (#12497) - temp = remaining / animation.duration || 0, - percent = 1 - temp, - index = 0, - length = animation.tweens.length; - - for ( ; index < length; index++ ) { - animation.tweens[ index ].run( percent ); - } - - deferred.notifyWith( elem, [ animation, percent, remaining ] ); - - // If there's more to do, yield - if ( percent < 1 && length ) { - return remaining; - } - - // If this was an empty animation, synthesize a final progress notification - if ( !length ) { - deferred.notifyWith( elem, [ animation, 1, 0 ] ); - } - - // Resolve the animation and report its conclusion - deferred.resolveWith( elem, [ animation ] ); - return false; - }, - animation = deferred.promise( { - elem: elem, - props: jQuery.extend( {}, properties ), - opts: jQuery.extend( true, { - specialEasing: {}, - easing: jQuery.easing._default - }, options ), - originalProperties: properties, - originalOptions: options, - startTime: fxNow || createFxNow(), - duration: options.duration, - tweens: [], - createTween: function( prop, end ) { - var tween = jQuery.Tween( elem, animation.opts, prop, end, - animation.opts.specialEasing[ prop ] || animation.opts.easing ); - animation.tweens.push( tween ); - return tween; - }, - stop: function( gotoEnd ) { - var index = 0, - - // If we are going to the end, we want to run all the tweens - // otherwise we skip this part - length = gotoEnd ? animation.tweens.length : 0; - if ( stopped ) { - return this; - } - stopped = true; - for ( ; index < length; index++ ) { - animation.tweens[ index ].run( 1 ); - } - - // Resolve when we played the last frame; otherwise, reject - if ( gotoEnd ) { - deferred.notifyWith( elem, [ animation, 1, 0 ] ); - deferred.resolveWith( elem, [ animation, gotoEnd ] ); - } else { - deferred.rejectWith( elem, [ animation, gotoEnd ] ); - } - return this; - } - } ), - props = animation.props; - - propFilter( props, animation.opts.specialEasing ); - - for ( ; index < length; index++ ) { - result = Animation.prefilters[ index ].call( animation, elem, props, animation.opts ); - if ( result ) { - if ( isFunction( result.stop ) ) { - jQuery._queueHooks( animation.elem, animation.opts.queue ).stop = - result.stop.bind( result ); - } - return result; - } - } - - jQuery.map( props, createTween, animation ); - - if ( isFunction( animation.opts.start ) ) { - animation.opts.start.call( elem, animation ); - } - - // Attach callbacks from options - animation - .progress( animation.opts.progress ) - .done( animation.opts.done, animation.opts.complete ) - .fail( animation.opts.fail ) - .always( animation.opts.always ); - - jQuery.fx.timer( - jQuery.extend( tick, { - elem: elem, - anim: animation, - queue: animation.opts.queue - } ) - ); - - return animation; -} - -jQuery.Animation = jQuery.extend( Animation, { - - tweeners: { - "*": [ function( prop, value ) { - var tween = this.createTween( prop, value ); - adjustCSS( tween.elem, prop, rcssNum.exec( value ), tween ); - return tween; - } ] - }, - - tweener: function( props, callback ) { - if ( isFunction( props ) ) { - callback = props; - props = [ "*" ]; - } else { - props = props.match( rnothtmlwhite ); - } - - var prop, - index = 0, - length = props.length; - - for ( ; index < length; index++ ) { - prop = props[ index ]; - Animation.tweeners[ prop ] = Animation.tweeners[ prop ] || []; - Animation.tweeners[ prop ].unshift( callback ); - } - }, - - prefilters: [ defaultPrefilter ], - - prefilter: function( callback, prepend ) { - if ( prepend ) { - Animation.prefilters.unshift( callback ); - } else { - Animation.prefilters.push( callback ); - } - } -} ); - -jQuery.speed = function( speed, easing, fn ) { - var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : { - complete: fn || !fn && easing || - isFunction( speed ) && speed, - duration: speed, - easing: fn && easing || easing && !isFunction( easing ) && easing - }; - - // Go to the end state if fx are off - if ( jQuery.fx.off ) { - opt.duration = 0; - - } else { - if ( typeof opt.duration !== "number" ) { - if ( opt.duration in jQuery.fx.speeds ) { - opt.duration = jQuery.fx.speeds[ opt.duration ]; - - } else { - opt.duration = jQuery.fx.speeds._default; - } - } - } - - // Normalize opt.queue - true/undefined/null -> "fx" - if ( opt.queue == null || opt.queue === true ) { - opt.queue = "fx"; - } - - // Queueing - opt.old = opt.complete; - - opt.complete = function() { - if ( isFunction( opt.old ) ) { - opt.old.call( this ); - } - - if ( opt.queue ) { - jQuery.dequeue( this, opt.queue ); - } - }; - - return opt; -}; - -jQuery.fn.extend( { - fadeTo: function( speed, to, easing, callback ) { - - // Show any hidden elements after setting opacity to 0 - return this.filter( isHiddenWithinTree ).css( "opacity", 0 ).show() - - // Animate to the value specified - .end().animate( { opacity: to }, speed, easing, callback ); - }, - animate: function( prop, speed, easing, callback ) { - var empty = jQuery.isEmptyObject( prop ), - optall = jQuery.speed( speed, easing, callback ), - doAnimation = function() { - - // Operate on a copy of prop so per-property easing won't be lost - var anim = Animation( this, jQuery.extend( {}, prop ), optall ); - - // Empty animations, or finishing resolves immediately - if ( empty || dataPriv.get( this, "finish" ) ) { - anim.stop( true ); - } - }; - doAnimation.finish = doAnimation; - - return empty || optall.queue === false ? - this.each( doAnimation ) : - this.queue( optall.queue, doAnimation ); - }, - stop: function( type, clearQueue, gotoEnd ) { - var stopQueue = function( hooks ) { - var stop = hooks.stop; - delete hooks.stop; - stop( gotoEnd ); - }; - - if ( typeof type !== "string" ) { - gotoEnd = clearQueue; - clearQueue = type; - type = undefined; - } - if ( clearQueue && type !== false ) { - this.queue( type || "fx", [] ); - } - - return this.each( function() { - var dequeue = true, - index = type != null && type + "queueHooks", - timers = jQuery.timers, - data = dataPriv.get( this ); - - if ( index ) { - if ( data[ index ] && data[ index ].stop ) { - stopQueue( data[ index ] ); - } - } else { - for ( index in data ) { - if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) { - stopQueue( data[ index ] ); - } - } - } - - for ( index = timers.length; index--; ) { - if ( timers[ index ].elem === this && - ( type == null || timers[ index ].queue === type ) ) { - - timers[ index ].anim.stop( gotoEnd ); - dequeue = false; - timers.splice( index, 1 ); - } - } - - // Start the next in the queue if the last step wasn't forced. - // Timers currently will call their complete callbacks, which - // will dequeue but only if they were gotoEnd. - if ( dequeue || !gotoEnd ) { - jQuery.dequeue( this, type ); - } - } ); - }, - finish: function( type ) { - if ( type !== false ) { - type = type || "fx"; - } - return this.each( function() { - var index, - data = dataPriv.get( this ), - queue = data[ type + "queue" ], - hooks = data[ type + "queueHooks" ], - timers = jQuery.timers, - length = queue ? queue.length : 0; - - // Enable finishing flag on private data - data.finish = true; - - // Empty the queue first - jQuery.queue( this, type, [] ); - - if ( hooks && hooks.stop ) { - hooks.stop.call( this, true ); - } - - // Look for any active animations, and finish them - for ( index = timers.length; index--; ) { - if ( timers[ index ].elem === this && timers[ index ].queue === type ) { - timers[ index ].anim.stop( true ); - timers.splice( index, 1 ); - } - } - - // Look for any animations in the old queue and finish them - for ( index = 0; index < length; index++ ) { - if ( queue[ index ] && queue[ index ].finish ) { - queue[ index ].finish.call( this ); - } - } - - // Turn off finishing flag - delete data.finish; - } ); - } -} ); - -jQuery.each( [ "toggle", "show", "hide" ], function( i, name ) { - var cssFn = jQuery.fn[ name ]; - jQuery.fn[ name ] = function( speed, easing, callback ) { - return speed == null || typeof speed === "boolean" ? - cssFn.apply( this, arguments ) : - this.animate( genFx( name, true ), speed, easing, callback ); - }; -} ); - -// Generate shortcuts for custom animations -jQuery.each( { - slideDown: genFx( "show" ), - slideUp: genFx( "hide" ), - slideToggle: genFx( "toggle" ), - fadeIn: { opacity: "show" }, - fadeOut: { opacity: "hide" }, - fadeToggle: { opacity: "toggle" } -}, function( name, props ) { - jQuery.fn[ name ] = function( speed, easing, callback ) { - return this.animate( props, speed, easing, callback ); - }; -} ); - -jQuery.timers = []; -jQuery.fx.tick = function() { - var timer, - i = 0, - timers = jQuery.timers; - - fxNow = Date.now(); - - for ( ; i < timers.length; i++ ) { - timer = timers[ i ]; - - // Run the timer and safely remove it when done (allowing for external removal) - if ( !timer() && timers[ i ] === timer ) { - timers.splice( i--, 1 ); - } - } - - if ( !timers.length ) { - jQuery.fx.stop(); - } - fxNow = undefined; -}; - -jQuery.fx.timer = function( timer ) { - jQuery.timers.push( timer ); - jQuery.fx.start(); -}; - -jQuery.fx.interval = 13; -jQuery.fx.start = function() { - if ( inProgress ) { - return; - } - - inProgress = true; - schedule(); -}; - -jQuery.fx.stop = function() { - inProgress = null; -}; - -jQuery.fx.speeds = { - slow: 600, - fast: 200, - - // Default speed - _default: 400 -}; - - -// Based off of the plugin by Clint Helfers, with permission. -// https://web.archive.org/web/20100324014747/http://blindsignals.com/index.php/2009/07/jquery-delay/ -jQuery.fn.delay = function( time, type ) { - time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time; - type = type || "fx"; - - return this.queue( type, function( next, hooks ) { - var timeout = window.setTimeout( next, time ); - hooks.stop = function() { - window.clearTimeout( timeout ); - }; - } ); -}; - - -( function() { - var input = document.createElement( "input" ), - select = document.createElement( "select" ), - opt = select.appendChild( document.createElement( "option" ) ); - - input.type = "checkbox"; - - // Support: Android <=4.3 only - // Default value for a checkbox should be "on" - support.checkOn = input.value !== ""; - - // Support: IE <=11 only - // Must access selectedIndex to make default options select - support.optSelected = opt.selected; - - // Support: IE <=11 only - // An input loses its value after becoming a radio - input = document.createElement( "input" ); - input.value = "t"; - input.type = "radio"; - support.radioValue = input.value === "t"; -} )(); - - -var boolHook, - attrHandle = jQuery.expr.attrHandle; - -jQuery.fn.extend( { - attr: function( name, value ) { - return access( this, jQuery.attr, name, value, arguments.length > 1 ); - }, - - removeAttr: function( name ) { - return this.each( function() { - jQuery.removeAttr( this, name ); - } ); - } -} ); - -jQuery.extend( { - attr: function( elem, name, value ) { - var ret, hooks, - nType = elem.nodeType; - - // Don't get/set attributes on text, comment and attribute nodes - if ( nType === 3 || nType === 8 || nType === 2 ) { - return; - } - - // Fallback to prop when attributes are not supported - if ( typeof elem.getAttribute === "undefined" ) { - return jQuery.prop( elem, name, value ); - } - - // Attribute hooks are determined by the lowercase version - // Grab necessary hook if one is defined - if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) { - hooks = jQuery.attrHooks[ name.toLowerCase() ] || - ( jQuery.expr.match.bool.test( name ) ? boolHook : undefined ); - } - - if ( value !== undefined ) { - if ( value === null ) { - jQuery.removeAttr( elem, name ); - return; - } - - if ( hooks && "set" in hooks && - ( ret = hooks.set( elem, value, name ) ) !== undefined ) { - return ret; - } - - elem.setAttribute( name, value + "" ); - return value; - } - - if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) { - return ret; - } - - ret = jQuery.find.attr( elem, name ); - - // Non-existent attributes return null, we normalize to undefined - return ret == null ? undefined : ret; - }, - - attrHooks: { - type: { - set: function( elem, value ) { - if ( !support.radioValue && value === "radio" && - nodeName( elem, "input" ) ) { - var val = elem.value; - elem.setAttribute( "type", value ); - if ( val ) { - elem.value = val; - } - return value; - } - } - } - }, - - removeAttr: function( elem, value ) { - var name, - i = 0, - - // Attribute names can contain non-HTML whitespace characters - // https://html.spec.whatwg.org/multipage/syntax.html#attributes-2 - attrNames = value && value.match( rnothtmlwhite ); - - if ( attrNames && elem.nodeType === 1 ) { - while ( ( name = attrNames[ i++ ] ) ) { - elem.removeAttribute( name ); - } - } - } -} ); - -// Hooks for boolean attributes -boolHook = { - set: function( elem, value, name ) { - if ( value === false ) { - - // Remove boolean attributes when set to false - jQuery.removeAttr( elem, name ); - } else { - elem.setAttribute( name, name ); - } - return name; - } -}; - -jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( i, name ) { - var getter = attrHandle[ name ] || jQuery.find.attr; - - attrHandle[ name ] = function( elem, name, isXML ) { - var ret, handle, - lowercaseName = name.toLowerCase(); - - if ( !isXML ) { - - // Avoid an infinite loop by temporarily removing this function from the getter - handle = attrHandle[ lowercaseName ]; - attrHandle[ lowercaseName ] = ret; - ret = getter( elem, name, isXML ) != null ? - lowercaseName : - null; - attrHandle[ lowercaseName ] = handle; - } - return ret; - }; -} ); - - - - -var rfocusable = /^(?:input|select|textarea|button)$/i, - rclickable = /^(?:a|area)$/i; - -jQuery.fn.extend( { - prop: function( name, value ) { - return access( this, jQuery.prop, name, value, arguments.length > 1 ); - }, - - removeProp: function( name ) { - return this.each( function() { - delete this[ jQuery.propFix[ name ] || name ]; - } ); - } -} ); - -jQuery.extend( { - prop: function( elem, name, value ) { - var ret, hooks, - nType = elem.nodeType; - - // Don't get/set properties on text, comment and attribute nodes - if ( nType === 3 || nType === 8 || nType === 2 ) { - return; - } - - if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) { - - // Fix name and attach hooks - name = jQuery.propFix[ name ] || name; - hooks = jQuery.propHooks[ name ]; - } - - if ( value !== undefined ) { - if ( hooks && "set" in hooks && - ( ret = hooks.set( elem, value, name ) ) !== undefined ) { - return ret; - } - - return ( elem[ name ] = value ); - } - - if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) { - return ret; - } - - return elem[ name ]; - }, - - propHooks: { - tabIndex: { - get: function( elem ) { - - // Support: IE <=9 - 11 only - // elem.tabIndex doesn't always return the - // correct value when it hasn't been explicitly set - // https://web.archive.org/web/20141116233347/http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/ - // Use proper attribute retrieval(#12072) - var tabindex = jQuery.find.attr( elem, "tabindex" ); - - if ( tabindex ) { - return parseInt( tabindex, 10 ); - } - - if ( - rfocusable.test( elem.nodeName ) || - rclickable.test( elem.nodeName ) && - elem.href - ) { - return 0; - } - - return -1; - } - } - }, - - propFix: { - "for": "htmlFor", - "class": "className" - } -} ); - -// Support: IE <=11 only -// Accessing the selectedIndex property -// forces the browser to respect setting selected -// on the option -// The getter ensures a default option is selected -// when in an optgroup -// eslint rule "no-unused-expressions" is disabled for this code -// since it considers such accessions noop -if ( !support.optSelected ) { - jQuery.propHooks.selected = { - get: function( elem ) { - - /* eslint no-unused-expressions: "off" */ - - var parent = elem.parentNode; - if ( parent && parent.parentNode ) { - parent.parentNode.selectedIndex; - } - return null; - }, - set: function( elem ) { - - /* eslint no-unused-expressions: "off" */ - - var parent = elem.parentNode; - if ( parent ) { - parent.selectedIndex; - - if ( parent.parentNode ) { - parent.parentNode.selectedIndex; - } - } - } - }; -} - -jQuery.each( [ - "tabIndex", - "readOnly", - "maxLength", - "cellSpacing", - "cellPadding", - "rowSpan", - "colSpan", - "useMap", - "frameBorder", - "contentEditable" -], function() { - jQuery.propFix[ this.toLowerCase() ] = this; -} ); - - - - - // Strip and collapse whitespace according to HTML spec - // https://infra.spec.whatwg.org/#strip-and-collapse-ascii-whitespace - function stripAndCollapse( value ) { - var tokens = value.match( rnothtmlwhite ) || []; - return tokens.join( " " ); - } - - -function getClass( elem ) { - return elem.getAttribute && elem.getAttribute( "class" ) || ""; -} - -function classesToArray( value ) { - if ( Array.isArray( value ) ) { - return value; - } - if ( typeof value === "string" ) { - return value.match( rnothtmlwhite ) || []; - } - return []; -} - -jQuery.fn.extend( { - addClass: function( value ) { - var classes, elem, cur, curValue, clazz, j, finalValue, - i = 0; - - if ( isFunction( value ) ) { - return this.each( function( j ) { - jQuery( this ).addClass( value.call( this, j, getClass( this ) ) ); - } ); - } - - classes = classesToArray( value ); - - if ( classes.length ) { - while ( ( elem = this[ i++ ] ) ) { - curValue = getClass( elem ); - cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " ); - - if ( cur ) { - j = 0; - while ( ( clazz = classes[ j++ ] ) ) { - if ( cur.indexOf( " " + clazz + " " ) < 0 ) { - cur += clazz + " "; - } - } - - // Only assign if different to avoid unneeded rendering. - finalValue = stripAndCollapse( cur ); - if ( curValue !== finalValue ) { - elem.setAttribute( "class", finalValue ); - } - } - } - } - - return this; - }, - - removeClass: function( value ) { - var classes, elem, cur, curValue, clazz, j, finalValue, - i = 0; - - if ( isFunction( value ) ) { - return this.each( function( j ) { - jQuery( this ).removeClass( value.call( this, j, getClass( this ) ) ); - } ); - } - - if ( !arguments.length ) { - return this.attr( "class", "" ); - } - - classes = classesToArray( value ); - - if ( classes.length ) { - while ( ( elem = this[ i++ ] ) ) { - curValue = getClass( elem ); - - // This expression is here for better compressibility (see addClass) - cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " ); - - if ( cur ) { - j = 0; - while ( ( clazz = classes[ j++ ] ) ) { - - // Remove *all* instances - while ( cur.indexOf( " " + clazz + " " ) > -1 ) { - cur = cur.replace( " " + clazz + " ", " " ); - } - } - - // Only assign if different to avoid unneeded rendering. - finalValue = stripAndCollapse( cur ); - if ( curValue !== finalValue ) { - elem.setAttribute( "class", finalValue ); - } - } - } - } - - return this; - }, - - toggleClass: function( value, stateVal ) { - var type = typeof value, - isValidValue = type === "string" || Array.isArray( value ); - - if ( typeof stateVal === "boolean" && isValidValue ) { - return stateVal ? this.addClass( value ) : this.removeClass( value ); - } - - if ( isFunction( value ) ) { - return this.each( function( i ) { - jQuery( this ).toggleClass( - value.call( this, i, getClass( this ), stateVal ), - stateVal - ); - } ); - } - - return this.each( function() { - var className, i, self, classNames; - - if ( isValidValue ) { - - // Toggle individual class names - i = 0; - self = jQuery( this ); - classNames = classesToArray( value ); - - while ( ( className = classNames[ i++ ] ) ) { - - // Check each className given, space separated list - if ( self.hasClass( className ) ) { - self.removeClass( className ); - } else { - self.addClass( className ); - } - } - - // Toggle whole class name - } else if ( value === undefined || type === "boolean" ) { - className = getClass( this ); - if ( className ) { - - // Store className if set - dataPriv.set( this, "__className__", className ); - } - - // If the element has a class name or if we're passed `false`, - // then remove the whole classname (if there was one, the above saved it). - // Otherwise bring back whatever was previously saved (if anything), - // falling back to the empty string if nothing was stored. - if ( this.setAttribute ) { - this.setAttribute( "class", - className || value === false ? - "" : - dataPriv.get( this, "__className__" ) || "" - ); - } - } - } ); - }, - - hasClass: function( selector ) { - var className, elem, - i = 0; - - className = " " + selector + " "; - while ( ( elem = this[ i++ ] ) ) { - if ( elem.nodeType === 1 && - ( " " + stripAndCollapse( getClass( elem ) ) + " " ).indexOf( className ) > -1 ) { - return true; - } - } - - return false; - } -} ); - - - - -var rreturn = /\r/g; - -jQuery.fn.extend( { - val: function( value ) { - var hooks, ret, valueIsFunction, - elem = this[ 0 ]; - - if ( !arguments.length ) { - if ( elem ) { - hooks = jQuery.valHooks[ elem.type ] || - jQuery.valHooks[ elem.nodeName.toLowerCase() ]; - - if ( hooks && - "get" in hooks && - ( ret = hooks.get( elem, "value" ) ) !== undefined - ) { - return ret; - } - - ret = elem.value; - - // Handle most common string cases - if ( typeof ret === "string" ) { - return ret.replace( rreturn, "" ); - } - - // Handle cases where value is null/undef or number - return ret == null ? "" : ret; - } - - return; - } - - valueIsFunction = isFunction( value ); - - return this.each( function( i ) { - var val; - - if ( this.nodeType !== 1 ) { - return; - } - - if ( valueIsFunction ) { - val = value.call( this, i, jQuery( this ).val() ); - } else { - val = value; - } - - // Treat null/undefined as ""; convert numbers to string - if ( val == null ) { - val = ""; - - } else if ( typeof val === "number" ) { - val += ""; - - } else if ( Array.isArray( val ) ) { - val = jQuery.map( val, function( value ) { - return value == null ? "" : value + ""; - } ); - } - - hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ]; - - // If set returns undefined, fall back to normal setting - if ( !hooks || !( "set" in hooks ) || hooks.set( this, val, "value" ) === undefined ) { - this.value = val; - } - } ); - } -} ); - -jQuery.extend( { - valHooks: { - option: { - get: function( elem ) { - - var val = jQuery.find.attr( elem, "value" ); - return val != null ? - val : - - // Support: IE <=10 - 11 only - // option.text throws exceptions (#14686, #14858) - // Strip and collapse whitespace - // https://html.spec.whatwg.org/#strip-and-collapse-whitespace - stripAndCollapse( jQuery.text( elem ) ); - } - }, - select: { - get: function( elem ) { - var value, option, i, - options = elem.options, - index = elem.selectedIndex, - one = elem.type === "select-one", - values = one ? null : [], - max = one ? index + 1 : options.length; - - if ( index < 0 ) { - i = max; - - } else { - i = one ? index : 0; - } - - // Loop through all the selected options - for ( ; i < max; i++ ) { - option = options[ i ]; - - // Support: IE <=9 only - // IE8-9 doesn't update selected after form reset (#2551) - if ( ( option.selected || i === index ) && - - // Don't return options that are disabled or in a disabled optgroup - !option.disabled && - ( !option.parentNode.disabled || - !nodeName( option.parentNode, "optgroup" ) ) ) { - - // Get the specific value for the option - value = jQuery( option ).val(); - - // We don't need an array for one selects - if ( one ) { - return value; - } - - // Multi-Selects return an array - values.push( value ); - } - } - - return values; - }, - - set: function( elem, value ) { - var optionSet, option, - options = elem.options, - values = jQuery.makeArray( value ), - i = options.length; - - while ( i-- ) { - option = options[ i ]; - - /* eslint-disable no-cond-assign */ - - if ( option.selected = - jQuery.inArray( jQuery.valHooks.option.get( option ), values ) > -1 - ) { - optionSet = true; - } - - /* eslint-enable no-cond-assign */ - } - - // Force browsers to behave consistently when non-matching value is set - if ( !optionSet ) { - elem.selectedIndex = -1; - } - return values; - } - } - } -} ); - -// Radios and checkboxes getter/setter -jQuery.each( [ "radio", "checkbox" ], function() { - jQuery.valHooks[ this ] = { - set: function( elem, value ) { - if ( Array.isArray( value ) ) { - return ( elem.checked = jQuery.inArray( jQuery( elem ).val(), value ) > -1 ); - } - } - }; - if ( !support.checkOn ) { - jQuery.valHooks[ this ].get = function( elem ) { - return elem.getAttribute( "value" ) === null ? "on" : elem.value; - }; - } -} ); - - - - -// Return jQuery for attributes-only inclusion - - -support.focusin = "onfocusin" in window; - - -var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/, - stopPropagationCallback = function( e ) { - e.stopPropagation(); - }; - -jQuery.extend( jQuery.event, { - - trigger: function( event, data, elem, onlyHandlers ) { - - var i, cur, tmp, bubbleType, ontype, handle, special, lastElement, - eventPath = [ elem || document ], - type = hasOwn.call( event, "type" ) ? event.type : event, - namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split( "." ) : []; - - cur = lastElement = tmp = elem = elem || document; - - // Don't do events on text and comment nodes - if ( elem.nodeType === 3 || elem.nodeType === 8 ) { - return; - } - - // focus/blur morphs to focusin/out; ensure we're not firing them right now - if ( rfocusMorph.test( type + jQuery.event.triggered ) ) { - return; - } - - if ( type.indexOf( "." ) > -1 ) { - - // Namespaced trigger; create a regexp to match event type in handle() - namespaces = type.split( "." ); - type = namespaces.shift(); - namespaces.sort(); - } - ontype = type.indexOf( ":" ) < 0 && "on" + type; - - // Caller can pass in a jQuery.Event object, Object, or just an event type string - event = event[ jQuery.expando ] ? - event : - new jQuery.Event( type, typeof event === "object" && event ); - - // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true) - event.isTrigger = onlyHandlers ? 2 : 3; - event.namespace = namespaces.join( "." ); - event.rnamespace = event.namespace ? - new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ) : - null; - - // Clean up the event in case it is being reused - event.result = undefined; - if ( !event.target ) { - event.target = elem; - } - - // Clone any incoming data and prepend the event, creating the handler arg list - data = data == null ? - [ event ] : - jQuery.makeArray( data, [ event ] ); - - // Allow special events to draw outside the lines - special = jQuery.event.special[ type ] || {}; - if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) { - return; - } - - // Determine event propagation path in advance, per W3C events spec (#9951) - // Bubble up to document, then to window; watch for a global ownerDocument var (#9724) - if ( !onlyHandlers && !special.noBubble && !isWindow( elem ) ) { - - bubbleType = special.delegateType || type; - if ( !rfocusMorph.test( bubbleType + type ) ) { - cur = cur.parentNode; - } - for ( ; cur; cur = cur.parentNode ) { - eventPath.push( cur ); - tmp = cur; - } - - // Only add window if we got to document (e.g., not plain obj or detached DOM) - if ( tmp === ( elem.ownerDocument || document ) ) { - eventPath.push( tmp.defaultView || tmp.parentWindow || window ); - } - } - - // Fire handlers on the event path - i = 0; - while ( ( cur = eventPath[ i++ ] ) && !event.isPropagationStopped() ) { - lastElement = cur; - event.type = i > 1 ? - bubbleType : - special.bindType || type; - - // jQuery handler - handle = ( dataPriv.get( cur, "events" ) || {} )[ event.type ] && - dataPriv.get( cur, "handle" ); - if ( handle ) { - handle.apply( cur, data ); - } - - // Native handler - handle = ontype && cur[ ontype ]; - if ( handle && handle.apply && acceptData( cur ) ) { - event.result = handle.apply( cur, data ); - if ( event.result === false ) { - event.preventDefault(); - } - } - } - event.type = type; - - // If nobody prevented the default action, do it now - if ( !onlyHandlers && !event.isDefaultPrevented() ) { - - if ( ( !special._default || - special._default.apply( eventPath.pop(), data ) === false ) && - acceptData( elem ) ) { - - // Call a native DOM method on the target with the same name as the event. - // Don't do default actions on window, that's where global variables be (#6170) - if ( ontype && isFunction( elem[ type ] ) && !isWindow( elem ) ) { - - // Don't re-trigger an onFOO event when we call its FOO() method - tmp = elem[ ontype ]; - - if ( tmp ) { - elem[ ontype ] = null; - } - - // Prevent re-triggering of the same event, since we already bubbled it above - jQuery.event.triggered = type; - - if ( event.isPropagationStopped() ) { - lastElement.addEventListener( type, stopPropagationCallback ); - } - - elem[ type ](); - - if ( event.isPropagationStopped() ) { - lastElement.removeEventListener( type, stopPropagationCallback ); - } - - jQuery.event.triggered = undefined; - - if ( tmp ) { - elem[ ontype ] = tmp; - } - } - } - } - - return event.result; - }, - - // Piggyback on a donor event to simulate a different one - // Used only for `focus(in | out)` events - simulate: function( type, elem, event ) { - var e = jQuery.extend( - new jQuery.Event(), - event, - { - type: type, - isSimulated: true - } - ); - - jQuery.event.trigger( e, null, elem ); - } - -} ); - -jQuery.fn.extend( { - - trigger: function( type, data ) { - return this.each( function() { - jQuery.event.trigger( type, data, this ); - } ); - }, - triggerHandler: function( type, data ) { - var elem = this[ 0 ]; - if ( elem ) { - return jQuery.event.trigger( type, data, elem, true ); - } - } -} ); - - -// Support: Firefox <=44 -// Firefox doesn't have focus(in | out) events -// Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787 -// -// Support: Chrome <=48 - 49, Safari <=9.0 - 9.1 -// focus(in | out) events fire after focus & blur events, -// which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order -// Related ticket - https://bugs.chromium.org/p/chromium/issues/detail?id=449857 -if ( !support.focusin ) { - jQuery.each( { focus: "focusin", blur: "focusout" }, function( orig, fix ) { - - // Attach a single capturing handler on the document while someone wants focusin/focusout - var handler = function( event ) { - jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ) ); - }; - - jQuery.event.special[ fix ] = { - setup: function() { - var doc = this.ownerDocument || this, - attaches = dataPriv.access( doc, fix ); - - if ( !attaches ) { - doc.addEventListener( orig, handler, true ); - } - dataPriv.access( doc, fix, ( attaches || 0 ) + 1 ); - }, - teardown: function() { - var doc = this.ownerDocument || this, - attaches = dataPriv.access( doc, fix ) - 1; - - if ( !attaches ) { - doc.removeEventListener( orig, handler, true ); - dataPriv.remove( doc, fix ); - - } else { - dataPriv.access( doc, fix, attaches ); - } - } - }; - } ); -} -var location = window.location; - -var nonce = Date.now(); - -var rquery = ( /\?/ ); - - - -// Cross-browser xml parsing -jQuery.parseXML = function( data ) { - var xml; - if ( !data || typeof data !== "string" ) { - return null; - } - - // Support: IE 9 - 11 only - // IE throws on parseFromString with invalid input. - try { - xml = ( new window.DOMParser() ).parseFromString( data, "text/xml" ); - } catch ( e ) { - xml = undefined; - } - - if ( !xml || xml.getElementsByTagName( "parsererror" ).length ) { - jQuery.error( "Invalid XML: " + data ); - } - return xml; -}; - - -var - rbracket = /\[\]$/, - rCRLF = /\r?\n/g, - rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i, - rsubmittable = /^(?:input|select|textarea|keygen)/i; - -function buildParams( prefix, obj, traditional, add ) { - var name; - - if ( Array.isArray( obj ) ) { - - // Serialize array item. - jQuery.each( obj, function( i, v ) { - if ( traditional || rbracket.test( prefix ) ) { - - // Treat each array item as a scalar. - add( prefix, v ); - - } else { - - // Item is non-scalar (array or object), encode its numeric index. - buildParams( - prefix + "[" + ( typeof v === "object" && v != null ? i : "" ) + "]", - v, - traditional, - add - ); - } - } ); - - } else if ( !traditional && toType( obj ) === "object" ) { - - // Serialize object item. - for ( name in obj ) { - buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add ); - } - - } else { - - // Serialize scalar item. - add( prefix, obj ); - } -} - -// Serialize an array of form elements or a set of -// key/values into a query string -jQuery.param = function( a, traditional ) { - var prefix, - s = [], - add = function( key, valueOrFunction ) { - - // If value is a function, invoke it and use its return value - var value = isFunction( valueOrFunction ) ? - valueOrFunction() : - valueOrFunction; - - s[ s.length ] = encodeURIComponent( key ) + "=" + - encodeURIComponent( value == null ? "" : value ); - }; - - // If an array was passed in, assume that it is an array of form elements. - if ( Array.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) { - - // Serialize the form elements - jQuery.each( a, function() { - add( this.name, this.value ); - } ); - - } else { - - // If traditional, encode the "old" way (the way 1.3.2 or older - // did it), otherwise encode params recursively. - for ( prefix in a ) { - buildParams( prefix, a[ prefix ], traditional, add ); - } - } - - // Return the resulting serialization - return s.join( "&" ); -}; - -jQuery.fn.extend( { - serialize: function() { - return jQuery.param( this.serializeArray() ); - }, - serializeArray: function() { - return this.map( function() { - - // Can add propHook for "elements" to filter or add form elements - var elements = jQuery.prop( this, "elements" ); - return elements ? jQuery.makeArray( elements ) : this; - } ) - .filter( function() { - var type = this.type; - - // Use .is( ":disabled" ) so that fieldset[disabled] works - return this.name && !jQuery( this ).is( ":disabled" ) && - rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) && - ( this.checked || !rcheckableType.test( type ) ); - } ) - .map( function( i, elem ) { - var val = jQuery( this ).val(); - - if ( val == null ) { - return null; - } - - if ( Array.isArray( val ) ) { - return jQuery.map( val, function( val ) { - return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) }; - } ); - } - - return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) }; - } ).get(); - } -} ); - - -var - r20 = /%20/g, - rhash = /#.*$/, - rantiCache = /([?&])_=[^&]*/, - rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg, - - // #7653, #8125, #8152: local protocol detection - rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/, - rnoContent = /^(?:GET|HEAD)$/, - rprotocol = /^\/\//, - - /* Prefilters - * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example) - * 2) These are called: - * - BEFORE asking for a transport - * - AFTER param serialization (s.data is a string if s.processData is true) - * 3) key is the dataType - * 4) the catchall symbol "*" can be used - * 5) execution will start with transport dataType and THEN continue down to "*" if needed - */ - prefilters = {}, - - /* Transports bindings - * 1) key is the dataType - * 2) the catchall symbol "*" can be used - * 3) selection will start with transport dataType and THEN go to "*" if needed - */ - transports = {}, - - // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression - allTypes = "*/".concat( "*" ), - - // Anchor tag for parsing the document origin - originAnchor = document.createElement( "a" ); - originAnchor.href = location.href; - -// Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport -function addToPrefiltersOrTransports( structure ) { - - // dataTypeExpression is optional and defaults to "*" - return function( dataTypeExpression, func ) { - - if ( typeof dataTypeExpression !== "string" ) { - func = dataTypeExpression; - dataTypeExpression = "*"; - } - - var dataType, - i = 0, - dataTypes = dataTypeExpression.toLowerCase().match( rnothtmlwhite ) || []; - - if ( isFunction( func ) ) { - - // For each dataType in the dataTypeExpression - while ( ( dataType = dataTypes[ i++ ] ) ) { - - // Prepend if requested - if ( dataType[ 0 ] === "+" ) { - dataType = dataType.slice( 1 ) || "*"; - ( structure[ dataType ] = structure[ dataType ] || [] ).unshift( func ); - - // Otherwise append - } else { - ( structure[ dataType ] = structure[ dataType ] || [] ).push( func ); - } - } - } - }; -} - -// Base inspection function for prefilters and transports -function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) { - - var inspected = {}, - seekingTransport = ( structure === transports ); - - function inspect( dataType ) { - var selected; - inspected[ dataType ] = true; - jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) { - var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR ); - if ( typeof dataTypeOrTransport === "string" && - !seekingTransport && !inspected[ dataTypeOrTransport ] ) { - - options.dataTypes.unshift( dataTypeOrTransport ); - inspect( dataTypeOrTransport ); - return false; - } else if ( seekingTransport ) { - return !( selected = dataTypeOrTransport ); - } - } ); - return selected; - } - - return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" ); -} - -// A special extend for ajax options -// that takes "flat" options (not to be deep extended) -// Fixes #9887 -function ajaxExtend( target, src ) { - var key, deep, - flatOptions = jQuery.ajaxSettings.flatOptions || {}; - - for ( key in src ) { - if ( src[ key ] !== undefined ) { - ( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ]; - } - } - if ( deep ) { - jQuery.extend( true, target, deep ); - } - - return target; -} - -/* Handles responses to an ajax request: - * - finds the right dataType (mediates between content-type and expected dataType) - * - returns the corresponding response - */ -function ajaxHandleResponses( s, jqXHR, responses ) { - - var ct, type, finalDataType, firstDataType, - contents = s.contents, - dataTypes = s.dataTypes; - - // Remove auto dataType and get content-type in the process - while ( dataTypes[ 0 ] === "*" ) { - dataTypes.shift(); - if ( ct === undefined ) { - ct = s.mimeType || jqXHR.getResponseHeader( "Content-Type" ); - } - } - - // Check if we're dealing with a known content-type - if ( ct ) { - for ( type in contents ) { - if ( contents[ type ] && contents[ type ].test( ct ) ) { - dataTypes.unshift( type ); - break; - } - } - } - - // Check to see if we have a response for the expected dataType - if ( dataTypes[ 0 ] in responses ) { - finalDataType = dataTypes[ 0 ]; - } else { - - // Try convertible dataTypes - for ( type in responses ) { - if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[ 0 ] ] ) { - finalDataType = type; - break; - } - if ( !firstDataType ) { - firstDataType = type; - } - } - - // Or just use first one - finalDataType = finalDataType || firstDataType; - } - - // If we found a dataType - // We add the dataType to the list if needed - // and return the corresponding response - if ( finalDataType ) { - if ( finalDataType !== dataTypes[ 0 ] ) { - dataTypes.unshift( finalDataType ); - } - return responses[ finalDataType ]; - } -} - -/* Chain conversions given the request and the original response - * Also sets the responseXXX fields on the jqXHR instance - */ -function ajaxConvert( s, response, jqXHR, isSuccess ) { - var conv2, current, conv, tmp, prev, - converters = {}, - - // Work with a copy of dataTypes in case we need to modify it for conversion - dataTypes = s.dataTypes.slice(); - - // Create converters map with lowercased keys - if ( dataTypes[ 1 ] ) { - for ( conv in s.converters ) { - converters[ conv.toLowerCase() ] = s.converters[ conv ]; - } - } - - current = dataTypes.shift(); - - // Convert to each sequential dataType - while ( current ) { - - if ( s.responseFields[ current ] ) { - jqXHR[ s.responseFields[ current ] ] = response; - } - - // Apply the dataFilter if provided - if ( !prev && isSuccess && s.dataFilter ) { - response = s.dataFilter( response, s.dataType ); - } - - prev = current; - current = dataTypes.shift(); - - if ( current ) { - - // There's only work to do if current dataType is non-auto - if ( current === "*" ) { - - current = prev; - - // Convert response if prev dataType is non-auto and differs from current - } else if ( prev !== "*" && prev !== current ) { - - // Seek a direct converter - conv = converters[ prev + " " + current ] || converters[ "* " + current ]; - - // If none found, seek a pair - if ( !conv ) { - for ( conv2 in converters ) { - - // If conv2 outputs current - tmp = conv2.split( " " ); - if ( tmp[ 1 ] === current ) { - - // If prev can be converted to accepted input - conv = converters[ prev + " " + tmp[ 0 ] ] || - converters[ "* " + tmp[ 0 ] ]; - if ( conv ) { - - // Condense equivalence converters - if ( conv === true ) { - conv = converters[ conv2 ]; - - // Otherwise, insert the intermediate dataType - } else if ( converters[ conv2 ] !== true ) { - current = tmp[ 0 ]; - dataTypes.unshift( tmp[ 1 ] ); - } - break; - } - } - } - } - - // Apply converter (if not an equivalence) - if ( conv !== true ) { - - // Unless errors are allowed to bubble, catch and return them - if ( conv && s.throws ) { - response = conv( response ); - } else { - try { - response = conv( response ); - } catch ( e ) { - return { - state: "parsererror", - error: conv ? e : "No conversion from " + prev + " to " + current - }; - } - } - } - } - } - } - - return { state: "success", data: response }; -} - -jQuery.extend( { - - // Counter for holding the number of active queries - active: 0, - - // Last-Modified header cache for next request - lastModified: {}, - etag: {}, - - ajaxSettings: { - url: location.href, - type: "GET", - isLocal: rlocalProtocol.test( location.protocol ), - global: true, - processData: true, - async: true, - contentType: "application/x-www-form-urlencoded; charset=UTF-8", - - /* - timeout: 0, - data: null, - dataType: null, - username: null, - password: null, - cache: null, - throws: false, - traditional: false, - headers: {}, - */ - - accepts: { - "*": allTypes, - text: "text/plain", - html: "text/html", - xml: "application/xml, text/xml", - json: "application/json, text/javascript" - }, - - contents: { - xml: /\bxml\b/, - html: /\bhtml/, - json: /\bjson\b/ - }, - - responseFields: { - xml: "responseXML", - text: "responseText", - json: "responseJSON" - }, - - // Data converters - // Keys separate source (or catchall "*") and destination types with a single space - converters: { - - // Convert anything to text - "* text": String, - - // Text to html (true = no transformation) - "text html": true, - - // Evaluate text as a json expression - "text json": JSON.parse, - - // Parse text as xml - "text xml": jQuery.parseXML - }, - - // For options that shouldn't be deep extended: - // you can add your own custom options here if - // and when you create one that shouldn't be - // deep extended (see ajaxExtend) - flatOptions: { - url: true, - context: true - } - }, - - // Creates a full fledged settings object into target - // with both ajaxSettings and settings fields. - // If target is omitted, writes into ajaxSettings. - ajaxSetup: function( target, settings ) { - return settings ? - - // Building a settings object - ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) : - - // Extending ajaxSettings - ajaxExtend( jQuery.ajaxSettings, target ); - }, - - ajaxPrefilter: addToPrefiltersOrTransports( prefilters ), - ajaxTransport: addToPrefiltersOrTransports( transports ), - - // Main method - ajax: function( url, options ) { - - // If url is an object, simulate pre-1.5 signature - if ( typeof url === "object" ) { - options = url; - url = undefined; - } - - // Force options to be an object - options = options || {}; - - var transport, - - // URL without anti-cache param - cacheURL, - - // Response headers - responseHeadersString, - responseHeaders, - - // timeout handle - timeoutTimer, - - // Url cleanup var - urlAnchor, - - // Request state (becomes false upon send and true upon completion) - completed, - - // To know if global events are to be dispatched - fireGlobals, - - // Loop variable - i, - - // uncached part of the url - uncached, - - // Create the final options object - s = jQuery.ajaxSetup( {}, options ), - - // Callbacks context - callbackContext = s.context || s, - - // Context for global events is callbackContext if it is a DOM node or jQuery collection - globalEventContext = s.context && - ( callbackContext.nodeType || callbackContext.jquery ) ? - jQuery( callbackContext ) : - jQuery.event, - - // Deferreds - deferred = jQuery.Deferred(), - completeDeferred = jQuery.Callbacks( "once memory" ), - - // Status-dependent callbacks - statusCode = s.statusCode || {}, - - // Headers (they are sent all at once) - requestHeaders = {}, - requestHeadersNames = {}, - - // Default abort message - strAbort = "canceled", - - // Fake xhr - jqXHR = { - readyState: 0, - - // Builds headers hashtable if needed - getResponseHeader: function( key ) { - var match; - if ( completed ) { - if ( !responseHeaders ) { - responseHeaders = {}; - while ( ( match = rheaders.exec( responseHeadersString ) ) ) { - responseHeaders[ match[ 1 ].toLowerCase() ] = match[ 2 ]; - } - } - match = responseHeaders[ key.toLowerCase() ]; - } - return match == null ? null : match; - }, - - // Raw string - getAllResponseHeaders: function() { - return completed ? responseHeadersString : null; - }, - - // Caches the header - setRequestHeader: function( name, value ) { - if ( completed == null ) { - name = requestHeadersNames[ name.toLowerCase() ] = - requestHeadersNames[ name.toLowerCase() ] || name; - requestHeaders[ name ] = value; - } - return this; - }, - - // Overrides response content-type header - overrideMimeType: function( type ) { - if ( completed == null ) { - s.mimeType = type; - } - return this; - }, - - // Status-dependent callbacks - statusCode: function( map ) { - var code; - if ( map ) { - if ( completed ) { - - // Execute the appropriate callbacks - jqXHR.always( map[ jqXHR.status ] ); - } else { - - // Lazy-add the new callbacks in a way that preserves old ones - for ( code in map ) { - statusCode[ code ] = [ statusCode[ code ], map[ code ] ]; - } - } - } - return this; - }, - - // Cancel the request - abort: function( statusText ) { - var finalText = statusText || strAbort; - if ( transport ) { - transport.abort( finalText ); - } - done( 0, finalText ); - return this; - } - }; - - // Attach deferreds - deferred.promise( jqXHR ); - - // Add protocol if not provided (prefilters might expect it) - // Handle falsy url in the settings object (#10093: consistency with old signature) - // We also use the url parameter if available - s.url = ( ( url || s.url || location.href ) + "" ) - .replace( rprotocol, location.protocol + "//" ); - - // Alias method option to type as per ticket #12004 - s.type = options.method || options.type || s.method || s.type; - - // Extract dataTypes list - s.dataTypes = ( s.dataType || "*" ).toLowerCase().match( rnothtmlwhite ) || [ "" ]; - - // A cross-domain request is in order when the origin doesn't match the current origin. - if ( s.crossDomain == null ) { - urlAnchor = document.createElement( "a" ); - - // Support: IE <=8 - 11, Edge 12 - 15 - // IE throws exception on accessing the href property if url is malformed, - // e.g. http://example.com:80x/ - try { - urlAnchor.href = s.url; - - // Support: IE <=8 - 11 only - // Anchor's host property isn't correctly set when s.url is relative - urlAnchor.href = urlAnchor.href; - s.crossDomain = originAnchor.protocol + "//" + originAnchor.host !== - urlAnchor.protocol + "//" + urlAnchor.host; - } catch ( e ) { - - // If there is an error parsing the URL, assume it is crossDomain, - // it can be rejected by the transport if it is invalid - s.crossDomain = true; - } - } - - // Convert data if not already a string - if ( s.data && s.processData && typeof s.data !== "string" ) { - s.data = jQuery.param( s.data, s.traditional ); - } - - // Apply prefilters - inspectPrefiltersOrTransports( prefilters, s, options, jqXHR ); - - // If request was aborted inside a prefilter, stop there - if ( completed ) { - return jqXHR; - } - - // We can fire global events as of now if asked to - // Don't fire events if jQuery.event is undefined in an AMD-usage scenario (#15118) - fireGlobals = jQuery.event && s.global; - - // Watch for a new set of requests - if ( fireGlobals && jQuery.active++ === 0 ) { - jQuery.event.trigger( "ajaxStart" ); - } - - // Uppercase the type - s.type = s.type.toUpperCase(); - - // Determine if request has content - s.hasContent = !rnoContent.test( s.type ); - - // Save the URL in case we're toying with the If-Modified-Since - // and/or If-None-Match header later on - // Remove hash to simplify url manipulation - cacheURL = s.url.replace( rhash, "" ); - - // More options handling for requests with no content - if ( !s.hasContent ) { - - // Remember the hash so we can put it back - uncached = s.url.slice( cacheURL.length ); - - // If data is available and should be processed, append data to url - if ( s.data && ( s.processData || typeof s.data === "string" ) ) { - cacheURL += ( rquery.test( cacheURL ) ? "&" : "?" ) + s.data; - - // #9682: remove data so that it's not used in an eventual retry - delete s.data; - } - - // Add or update anti-cache param if needed - if ( s.cache === false ) { - cacheURL = cacheURL.replace( rantiCache, "$1" ); - uncached = ( rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + ( nonce++ ) + uncached; - } - - // Put hash and anti-cache on the URL that will be requested (gh-1732) - s.url = cacheURL + uncached; - - // Change '%20' to '+' if this is encoded form body content (gh-2658) - } else if ( s.data && s.processData && - ( s.contentType || "" ).indexOf( "application/x-www-form-urlencoded" ) === 0 ) { - s.data = s.data.replace( r20, "+" ); - } - - // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. - if ( s.ifModified ) { - if ( jQuery.lastModified[ cacheURL ] ) { - jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] ); - } - if ( jQuery.etag[ cacheURL ] ) { - jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] ); - } - } - - // Set the correct header, if data is being sent - if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) { - jqXHR.setRequestHeader( "Content-Type", s.contentType ); - } - - // Set the Accepts header for the server, depending on the dataType - jqXHR.setRequestHeader( - "Accept", - s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[ 0 ] ] ? - s.accepts[ s.dataTypes[ 0 ] ] + - ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) : - s.accepts[ "*" ] - ); - - // Check for headers option - for ( i in s.headers ) { - jqXHR.setRequestHeader( i, s.headers[ i ] ); - } - - // Allow custom headers/mimetypes and early abort - if ( s.beforeSend && - ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || completed ) ) { - - // Abort if not done already and return - return jqXHR.abort(); - } - - // Aborting is no longer a cancellation - strAbort = "abort"; - - // Install callbacks on deferreds - completeDeferred.add( s.complete ); - jqXHR.done( s.success ); - jqXHR.fail( s.error ); - - // Get transport - transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR ); - - // If no transport, we auto-abort - if ( !transport ) { - done( -1, "No Transport" ); - } else { - jqXHR.readyState = 1; - - // Send global event - if ( fireGlobals ) { - globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] ); - } - - // If request was aborted inside ajaxSend, stop there - if ( completed ) { - return jqXHR; - } - - // Timeout - if ( s.async && s.timeout > 0 ) { - timeoutTimer = window.setTimeout( function() { - jqXHR.abort( "timeout" ); - }, s.timeout ); - } - - try { - completed = false; - transport.send( requestHeaders, done ); - } catch ( e ) { - - // Rethrow post-completion exceptions - if ( completed ) { - throw e; - } - - // Propagate others as results - done( -1, e ); - } - } - - // Callback for when everything is done - function done( status, nativeStatusText, responses, headers ) { - var isSuccess, success, error, response, modified, - statusText = nativeStatusText; - - // Ignore repeat invocations - if ( completed ) { - return; - } - - completed = true; - - // Clear timeout if it exists - if ( timeoutTimer ) { - window.clearTimeout( timeoutTimer ); - } - - // Dereference transport for early garbage collection - // (no matter how long the jqXHR object will be used) - transport = undefined; - - // Cache response headers - responseHeadersString = headers || ""; - - // Set readyState - jqXHR.readyState = status > 0 ? 4 : 0; - - // Determine if successful - isSuccess = status >= 200 && status < 300 || status === 304; - - // Get response data - if ( responses ) { - response = ajaxHandleResponses( s, jqXHR, responses ); - } - - // Convert no matter what (that way responseXXX fields are always set) - response = ajaxConvert( s, response, jqXHR, isSuccess ); - - // If successful, handle type chaining - if ( isSuccess ) { - - // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. - if ( s.ifModified ) { - modified = jqXHR.getResponseHeader( "Last-Modified" ); - if ( modified ) { - jQuery.lastModified[ cacheURL ] = modified; - } - modified = jqXHR.getResponseHeader( "etag" ); - if ( modified ) { - jQuery.etag[ cacheURL ] = modified; - } - } - - // if no content - if ( status === 204 || s.type === "HEAD" ) { - statusText = "nocontent"; - - // if not modified - } else if ( status === 304 ) { - statusText = "notmodified"; - - // If we have data, let's convert it - } else { - statusText = response.state; - success = response.data; - error = response.error; - isSuccess = !error; - } - } else { - - // Extract error from statusText and normalize for non-aborts - error = statusText; - if ( status || !statusText ) { - statusText = "error"; - if ( status < 0 ) { - status = 0; - } - } - } - - // Set data for the fake xhr object - jqXHR.status = status; - jqXHR.statusText = ( nativeStatusText || statusText ) + ""; - - // Success/Error - if ( isSuccess ) { - deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] ); - } else { - deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] ); - } - - // Status-dependent callbacks - jqXHR.statusCode( statusCode ); - statusCode = undefined; - - if ( fireGlobals ) { - globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError", - [ jqXHR, s, isSuccess ? success : error ] ); - } - - // Complete - completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] ); - - if ( fireGlobals ) { - globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] ); - - // Handle the global AJAX counter - if ( !( --jQuery.active ) ) { - jQuery.event.trigger( "ajaxStop" ); - } - } - } - - return jqXHR; - }, - - getJSON: function( url, data, callback ) { - return jQuery.get( url, data, callback, "json" ); - }, - - getScript: function( url, callback ) { - return jQuery.get( url, undefined, callback, "script" ); - } -} ); - -jQuery.each( [ "get", "post" ], function( i, method ) { - jQuery[ method ] = function( url, data, callback, type ) { - - // Shift arguments if data argument was omitted - if ( isFunction( data ) ) { - type = type || callback; - callback = data; - data = undefined; - } - - // The url can be an options object (which then must have .url) - return jQuery.ajax( jQuery.extend( { - url: url, - type: method, - dataType: type, - data: data, - success: callback - }, jQuery.isPlainObject( url ) && url ) ); - }; -} ); - - -jQuery._evalUrl = function( url ) { - return jQuery.ajax( { - url: url, - - // Make this explicit, since user can override this through ajaxSetup (#11264) - type: "GET", - dataType: "script", - cache: true, - async: false, - global: false, - "throws": true - } ); -}; - - -jQuery.fn.extend( { - wrapAll: function( html ) { - var wrap; - - if ( this[ 0 ] ) { - if ( isFunction( html ) ) { - html = html.call( this[ 0 ] ); - } - - // The elements to wrap the target around - wrap = jQuery( html, this[ 0 ].ownerDocument ).eq( 0 ).clone( true ); - - if ( this[ 0 ].parentNode ) { - wrap.insertBefore( this[ 0 ] ); - } - - wrap.map( function() { - var elem = this; - - while ( elem.firstElementChild ) { - elem = elem.firstElementChild; - } - - return elem; - } ).append( this ); - } - - return this; - }, - - wrapInner: function( html ) { - if ( isFunction( html ) ) { - return this.each( function( i ) { - jQuery( this ).wrapInner( html.call( this, i ) ); - } ); - } - - return this.each( function() { - var self = jQuery( this ), - contents = self.contents(); - - if ( contents.length ) { - contents.wrapAll( html ); - - } else { - self.append( html ); - } - } ); - }, - - wrap: function( html ) { - var htmlIsFunction = isFunction( html ); - - return this.each( function( i ) { - jQuery( this ).wrapAll( htmlIsFunction ? html.call( this, i ) : html ); - } ); - }, - - unwrap: function( selector ) { - this.parent( selector ).not( "body" ).each( function() { - jQuery( this ).replaceWith( this.childNodes ); - } ); - return this; - } -} ); - - -jQuery.expr.pseudos.hidden = function( elem ) { - return !jQuery.expr.pseudos.visible( elem ); -}; -jQuery.expr.pseudos.visible = function( elem ) { - return !!( elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length ); -}; - - - - -jQuery.ajaxSettings.xhr = function() { - try { - return new window.XMLHttpRequest(); - } catch ( e ) {} -}; - -var xhrSuccessStatus = { - - // File protocol always yields status code 0, assume 200 - 0: 200, - - // Support: IE <=9 only - // #1450: sometimes IE returns 1223 when it should be 204 - 1223: 204 - }, - xhrSupported = jQuery.ajaxSettings.xhr(); - -support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported ); -support.ajax = xhrSupported = !!xhrSupported; - -jQuery.ajaxTransport( function( options ) { - var callback, errorCallback; - - // Cross domain only allowed if supported through XMLHttpRequest - if ( support.cors || xhrSupported && !options.crossDomain ) { - return { - send: function( headers, complete ) { - var i, - xhr = options.xhr(); - - xhr.open( - options.type, - options.url, - options.async, - options.username, - options.password - ); - - // Apply custom fields if provided - if ( options.xhrFields ) { - for ( i in options.xhrFields ) { - xhr[ i ] = options.xhrFields[ i ]; - } - } - - // Override mime type if needed - if ( options.mimeType && xhr.overrideMimeType ) { - xhr.overrideMimeType( options.mimeType ); - } - - // X-Requested-With header - // For cross-domain requests, seeing as conditions for a preflight are - // akin to a jigsaw puzzle, we simply never set it to be sure. - // (it can always be set on a per-request basis or even using ajaxSetup) - // For same-domain requests, won't change header if already provided. - if ( !options.crossDomain && !headers[ "X-Requested-With" ] ) { - headers[ "X-Requested-With" ] = "XMLHttpRequest"; - } - - // Set headers - for ( i in headers ) { - xhr.setRequestHeader( i, headers[ i ] ); - } - - // Callback - callback = function( type ) { - return function() { - if ( callback ) { - callback = errorCallback = xhr.onload = - xhr.onerror = xhr.onabort = xhr.ontimeout = - xhr.onreadystatechange = null; - - if ( type === "abort" ) { - xhr.abort(); - } else if ( type === "error" ) { - - // Support: IE <=9 only - // On a manual native abort, IE9 throws - // errors on any property access that is not readyState - if ( typeof xhr.status !== "number" ) { - complete( 0, "error" ); - } else { - complete( - - // File: protocol always yields status 0; see #8605, #14207 - xhr.status, - xhr.statusText - ); - } - } else { - complete( - xhrSuccessStatus[ xhr.status ] || xhr.status, - xhr.statusText, - - // Support: IE <=9 only - // IE9 has no XHR2 but throws on binary (trac-11426) - // For XHR2 non-text, let the caller handle it (gh-2498) - ( xhr.responseType || "text" ) !== "text" || - typeof xhr.responseText !== "string" ? - { binary: xhr.response } : - { text: xhr.responseText }, - xhr.getAllResponseHeaders() - ); - } - } - }; - }; - - // Listen to events - xhr.onload = callback(); - errorCallback = xhr.onerror = xhr.ontimeout = callback( "error" ); - - // Support: IE 9 only - // Use onreadystatechange to replace onabort - // to handle uncaught aborts - if ( xhr.onabort !== undefined ) { - xhr.onabort = errorCallback; - } else { - xhr.onreadystatechange = function() { - - // Check readyState before timeout as it changes - if ( xhr.readyState === 4 ) { - - // Allow onerror to be called first, - // but that will not handle a native abort - // Also, save errorCallback to a variable - // as xhr.onerror cannot be accessed - window.setTimeout( function() { - if ( callback ) { - errorCallback(); - } - } ); - } - }; - } - - // Create the abort callback - callback = callback( "abort" ); - - try { - - // Do send the request (this may raise an exception) - xhr.send( options.hasContent && options.data || null ); - } catch ( e ) { - - // #14683: Only rethrow if this hasn't been notified as an error yet - if ( callback ) { - throw e; - } - } - }, - - abort: function() { - if ( callback ) { - callback(); - } - } - }; - } -} ); - - - - -// Prevent auto-execution of scripts when no explicit dataType was provided (See gh-2432) -jQuery.ajaxPrefilter( function( s ) { - if ( s.crossDomain ) { - s.contents.script = false; - } -} ); - -// Install script dataType -jQuery.ajaxSetup( { - accepts: { - script: "text/javascript, application/javascript, " + - "application/ecmascript, application/x-ecmascript" - }, - contents: { - script: /\b(?:java|ecma)script\b/ - }, - converters: { - "text script": function( text ) { - jQuery.globalEval( text ); - return text; - } - } -} ); - -// Handle cache's special case and crossDomain -jQuery.ajaxPrefilter( "script", function( s ) { - if ( s.cache === undefined ) { - s.cache = false; - } - if ( s.crossDomain ) { - s.type = "GET"; - } -} ); - -// Bind script tag hack transport -jQuery.ajaxTransport( "script", function( s ) { - - // This transport only deals with cross domain requests - if ( s.crossDomain ) { - var script, callback; - return { - send: function( _, complete ) { - script = jQuery( "