(window["webpackJsonp_name_"] = window["webpackJsonp_name_"] || []).push([[38,36,68],{ /***/ 176: /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); function whichAnimationEvent() { var t, el = document.createElement('fakeelement'); var animations = { 'animation': 'animationend', 'OAnimation': 'oAnimationEnd', 'MozAnimation': 'animationend', 'WebkitAnimation': 'webkitAnimationEnd' }; for (t in animations) { if (t && el.style[t] !== undefined) { return animations[t]; } } } var animationEvent = exports.animationEvent = whichAnimationEvent(); /***/ }), /***/ 196: /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); 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; }; }(); __webpack_require__(421); var _animationEvent = __webpack_require__(176); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } var AMSlider = function () { function AMSlider() { var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; _classCallCheck(this, AMSlider); this.inIsAnimating = false; this.outIsAnimating = false; this.currentSlideIndex = 0; this.previousSlideIndex = 0; this._params = Object.assign({}, AMSlider.default, params); this.elem = document.querySelector('.' + this.key); if (this.elem) { this._init(); } } _createClass(AMSlider, [{ key: 'getItemSetting', value: function getItemSetting(itemId) { return this.setting.items[itemId]; } }, { key: '_init', value: function _init() { if (!this.elem) { return false; } this.currentSlideIndex = 0; this.previousSlideIndex = 0; var currentClass = '.' + this.itemsKeys[this.currentSlideIndex]; this.elem.querySelector(currentClass).classList.add('active'); this.elem.querySelector(currentClass).classList.add('project-gallery_in'); this._setHeight()._initArrows()._initPagination()._initMouseWheel()._initTouch()._autoplay()._resize(); } }, { key: '_initArrows', value: function _initArrows() { if (this.setting['show_arrows']) { if (this.itemsKeys.length <= 1) { this.elem.classList.add('project-gallery_hide-arrows'); return this; } var prev = this.elem.querySelector('.project-gallery__arrows-prev'); var next = this.elem.querySelector('.project-gallery__arrows-next'); prev && prev.addEventListener('click', this._prevSlide.bind(this)); next && next.addEventListener('click', this._nextSlide.bind(this)); } return this; } }, { key: '_initPagination', value: function _initPagination() { var _this = this; if (this.setting['show_pagination']) { if (this.itemsKeys.length <= 1) { this.elem.classList.add('project-gallery_hide-pagination'); return this; } var pagination = this.elem.querySelector('.project-gallery__pagination'); pagination && pagination.addEventListener('click', function (event) { _this._currentSlide(event.target.getAttribute('data-pagination-id')); }); pagination && [].forEach.call(pagination.querySelectorAll('.project-gallery__pagination-item'), function (item) { var setting = _this.getItemSetting(item.getAttribute('data-pagination-id')); switch (setting['preview_type']) { case 'image': { var bg = item.querySelector('.project-gallery__pagination-bg-image'); if (bg) { bg.style.backgroundImage = 'url(' + setting['preview'] + ')'; } break; } case 'text': { item.insertAdjacentHTML('beforeend', '' + setting['preview'] + ''); break; } } }); this._activePagination(); } return this; } }, { key: '_initMouseWheel', value: function _initMouseWheel() { var _this2 = this; if (this.setting['mouse_wheel'] !== 'disable') { var goNext = false; var onWheel = function onWheel(e) { if (_this2.animationStatus) { return false; } e = e || window.event; e.preventDefault ? e.preventDefault() : e.returnValue = false; var delta = e.deltaY || e.detail || e.wheelDelta; if (/rv:11.0/i.test(navigator.userAgent) || /MSIE 9/i.test(navigator.userAgent) || /MSIE 10/i.test(navigator.userAgent)) { delta = -delta; } if (delta < 100 && delta > 0) { delta = 100; } else if (delta > -100 && delta < 0) { delta = -100; } goNext = delta > 0; if (goNext) { _this2._nextSlide(); } else { _this2._prevSlide(); } goNext = false; }; var elem = this.elem; if (elem.addEventListener) { if ('onwheel' in document) { // IE9+, FF17+, Ch31+ elem.addEventListener('wheel', onWheel); } else if ('onmousewheel' in document) { // устаревший вариант события elem.addEventListener('mousewheel', onWheel); } else { // Firefox < 17 elem.addEventListener('MozMousePixelScroll', onWheel); } } else { elem.attachEvent('onmousewheel', onWheel); } } return this; } }, { key: '_initTouch', value: function _initTouch() { var _this3 = this; if (this.setting['touch'] === 'disable') { return this; } var showPrev = false, showNext = false, startX = null, endX = null, translateX = 0; // touch start this.elem.addEventListener('touchstart', function (event) { if (_this3.animationStatus) { return false; } startX = event.touches[0].clientX; }); // touch move this.elem.addEventListener('touchmove', function (event) { if (_this3.animationStatus) { return false; } endX = event.touches[0].clientX; translateX = startX - endX; }); // touch end this.elem.addEventListener('touchend', function () { if (_this3.animationStatus) { return false; } if (translateX < -20) { showPrev = true; showNext = false; } else if (translateX > 20) { showNext = true; showPrev = false; } if (showPrev) { _this3._prevSlide(); } if (showNext) { _this3._nextSlide(); } showPrev = false; showNext = false; translateX = 0; }); return this; } }, { key: '_activePagination', value: function _activePagination() { var currentSelector = '[data-pagination-id="' + [this.itemsKeys[this.currentSlideIndex]] + '"'; var prevSelector = '[data-pagination-id="' + [this.itemsKeys[this.previousSlideIndex]] + '"'; var active = this.elem.querySelector(currentSelector); var prev = this.elem.querySelector(prevSelector); if (active) { active.classList.add('active'); } if (prev && this.currentSlideIndex !== this.previousSlideIndex) { prev.classList.remove('active'); } } }, { key: '_setHeight', value: function _setHeight() { this.elem.classList.remove('gallery-is-inited'); var content = this.elem.querySelector('.project-gallery__content'); content.style.height = ''; content.style.height = content.offsetHeight + 'px'; this.elem.classList.add('gallery-is-inited'); return this; } }, { key: '_currentSlide', value: function _currentSlide(id) { if (!id) { return false; } if (this.animationStatus) { return false; } this.previousSlideIndex = this.currentSlideIndex; this.currentSlideIndex = Object.keys(this.setting.items).indexOf(id); if (this.currentSlideIndex === -1) { this.currentSlideIndex = 0; } this._animateSlide(); } }, { key: '_nextSlide', value: function _nextSlide(event) { if (this.animationStatus) { return false; } if (event) { event.stopPropagation(); } this.previousSlideIndex = this.currentSlideIndex; this.currentSlideIndex += 1; if (this.currentSlideIndex >= this.itemsKeys.length) { this.currentSlideIndex = 0; } this._animateSlide(); } }, { key: '_prevSlide', value: function _prevSlide(event) { if (this.animationStatus) { return false; } if (event) { event.stopPropagation(); } this.previousSlideIndex = this.currentSlideIndex; this.currentSlideIndex -= 1; if (this.currentSlideIndex < 0) { this.currentSlideIndex = this.itemsKeys.length - 1; } this._animateSlide(); } }, { key: '_animateSlide', value: function _animateSlide() { var _this4 = this; if (this.previousSlideIndex === this.currentSlideIndex) { return false; } if (this['inIsAnimating'] || this['outIsAnimating']) { return false; } var f = function f(id, type) { var itemSetting = _this4.getItemSetting(id); if (itemSetting[type + '_animation_type'] === 'none' || !itemSetting[type + '_animation_duration']) { var item = _this4.elem.querySelector('.' + id); setTimeout(function () { if (type === 'in') { item.classList.add('active'); } setTimeout(function () { if (type === 'out') { item.classList.remove('active'); } _this4[type + 'IsAnimating'] = false; }, itemSetting[type + '_animation_duration'] || 0); item.classList.remove('project-gallery_in'); item.classList.remove('project-gallery_out'); item.classList.add('project-gallery_' + type); }, itemSetting[type + '_animation_delay'] || 0); _this4[type + 'IsAnimating'] = true; } else { var _item = _this4.elem.querySelector('.' + id); var _f = function _f(event) { if (event.currentTarget.classList.contains('animation-' + type + '-' + itemSetting[type + '_animation_type'])) { if (type === 'out') { event.currentTarget.classList.remove('active'); } event.currentTarget.classList.remove('animation-' + type + '-' + itemSetting[type + '_animation_type']); event.currentTarget.removeEventListener(_animationEvent.animationEvent, _f.bind(_this4)); _this4[type + 'IsAnimating'] = false; } }; _item.addEventListener(_animationEvent.animationEvent, _f.bind(_this4)); setTimeout(function () { if (type === 'in') { _item.classList.add('active'); } _item.style.webkitAnimationDuration = itemSetting[type + '_animation_duration'] + 'ms'; _item.style.animationDuration = itemSetting[type + '_animation_duration'] + 'ms'; _item.classList.add('animation-' + type + '-' + itemSetting[type + '_animation_type']); _item.classList.remove('project-gallery_in'); _item.classList.remove('project-gallery_out'); _item.classList.add('project-gallery_' + type); }, itemSetting[type + '_animation_delay'] || 0); _this4[type + 'IsAnimating'] = true; } }; var prevId = this.itemsKeys[this.previousSlideIndex]; f(prevId, 'out'); var nextId = this.itemsKeys[this.currentSlideIndex]; f(nextId, 'in'); this._activePagination(); } }, { key: '_autoplay', value: function _autoplay() { var _this5 = this; // run autoplay // stop autoplay on hover // run after lost focus if (this.setting['change_type'] === 'manual') { return this; } var currentTimeout = null; var run = function run() { currentTimeout = setTimeout(function () { _this5._nextSlide(); run(); }, _this5.setting['show_time'] || 0); }; run(); if (this.setting['on_hover'] === 'pause') { this.elem.addEventListener('mouseenter', function (event) { clearTimeout(currentTimeout); }); this.elem.addEventListener('mouseleave', function (event) { run(); }); } return this; } }, { key: '_resize', value: function _resize() { var _this6 = this; window.addEventListener('resize', function () { _this6._setHeight(); }); } }, { key: 'key', get: function get() { return this._params.key; } }, { key: 'setting', get: function get() { return this._params.setting; } }, { key: 'itemsKeys', get: function get() { return Object.keys(this.setting.items); } }, { key: 'animationStatus', get: function get() { return this.inIsAnimating || this.outIsAnimating; } }], [{ key: 'default', get: function get() { return { key: null, setting: {} }; } }]); return AMSlider; }(); exports.default = AMSlider; /***/ }), /***/ 421: /***/ (function(module, exports, __webpack_require__) { var content = __webpack_require__(440); if(typeof content === 'string') content = [[module.i, content, '']]; var transform; var insertInto; var options = {"hmr":true} options.transform = transform options.insertInto = undefined; var update = __webpack_require__(167)(content, options); if(content.locals) module.exports = content.locals; if(false) {} /***/ }), /***/ 440: /***/ (function(module, exports, __webpack_require__) { exports = module.exports = __webpack_require__(168)(false); // imports // module exports.push([module.i, ".project-gallery{position:relative}.project-gallery__content{position:relative;display:flex;flex-wrap:nowrap;align-items:stretch;width:100%;height:100%;overflow:hidden}.project-gallery_hide-arrows .project-gallery__arrows{display:none}.project-gallery__arrows_hover .project-gallery__arrows{opacity:0;pointer-events:none;transition:opacity .2s ease}.project-gallery__arrows_hover:hover .project-gallery__arrows{opacity:1;pointer-events:auto}.project-gallery__arrows-next,.project-gallery__arrows-prev{cursor:pointer}.project-gallery__arrows-next,.project-gallery__arrows-prev{position:absolute;display:block;transition:box-shadow .2s ease,border .2s ease,background-color .2s ease;z-index:2}.project-gallery__pagination{position:absolute;display:flex;flex-wrap:wrap}.project-gallery_hide-pagination .project-gallery__pagination{display:none}.project-gallery__pagination_hover .project-gallery__pagination{opacity:0;pointer-events:none;transition:opacity .2s ease}.project-gallery__pagination_hover:hover .project-gallery__pagination{opacity:1;pointer-events:auto}.project-gallery__pagination.pagination-direction_row{flex-direction:row}.project-gallery__pagination.pagination-direction_col{flex-direction:column}.project-gallery__pagination-item{position:relative;flex-shrink:0;min-width:0;height:100%;cursor:pointer;transition:box-shadow .4s ease-in-out,border .4s ease-in-out;overflow:hidden}.project-gallery__pagination-item:before{content:\"\";position:absolute;top:0;left:0;width:100%;height:100%;z-index:3;background-color:rgba(0,0,0,1e-05)}.project-gallery__pagination-bg{position:absolute;top:0;left:0;width:100%;height:100%;z-index:-1}.project-gallery__pagination-bg-image{background-repeat:no-repeat;background-size:cover;background-position:50%}.project-gallery__pagination-bg-color,.project-gallery__pagination-bg-image{position:absolute;top:0;left:0;width:100%;height:100%}.project-gallery__pagination-bg-image{z-index:1}.project-gallery__pagination-bg-color{z-index:2;transition:background-color .4s ease-in-out}.project-gallery__item{display:block;width:100%;flex-shrink:0}.project-gallery__item.animation-in-opacity{animation-name:a;animation-fill-mode:forwards}.project-gallery__item.animation-out-opacity{animation-name:b;animation-fill-mode:forwards}.project-gallery__item.animation-in-none,.project-gallery__item.animation-out-none{animation:none}.gallery-is-inited .project-gallery__item{position:absolute;left:0;right:0;width:100%;height:100%;display:none}.gallery-is-inited .project-gallery__item.active{display:block}@keyframes a{0%{opacity:0}to{opacity:1}}@keyframes b{0%{opacity:1}to{opacity:0}}", ""]); // exports /***/ }) }]);