(window["webpackJsonp_name_"] = window["webpackJsonp_name_"] || []).push([[42,43,44],{ /***/ 177: /***/ (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; }; }(); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } var Multiselect = function () { _createClass(Multiselect, null, [{ key: 'default', get: function get() { return { el: null, select: null, config: null }; } }]); function Multiselect(params) { _classCallCheck(this, Multiselect); this._params = Object.assign({}, Multiselect.default, params); this._createSelect(); this._onClick(); } _createClass(Multiselect, [{ key: '_createSelect', value: function _createSelect() { if (this.el.disabled) { return; } this.selected = []; if (this.el.classList.contains('cs-select_inited')) { return false; } this.el.classList.add('cs-select_inited'); this.wrapper = document.createElement('DIV'); this.wrapper.className = 'cs-select ' + this.el.className; this.title = document.createElement('SPAN'); this.title.classList.add('cs-placeholder'); this.title.classList.add('project-input'); this.title.classList.add('project-input_select'); this.options = document.createElement('DIV'); this.options.classList.add('cs-options'); this.list = document.createElement('UL'); var template = ''; for (var i = 0; i < this.el.options.length; i++) { if (this.el.options[i].value) { var className = ''; if (this.el.options[i].selected) { this.selected.push(this.el.options[i].textContent); className = 'cs-selected'; } template += '
  • ' + this.el.options[i].textContent + '
  • '; } } this.arrow = document.createElement('span'); this.arrow.className = 'cs-placeholder-before project-input__icon'; var settings = window.formSettings['select']; if (settings && !settings.use_defaults) { this.arrow.className += ' has-svg'; this.arrow.innerHTML = '\n
    \n \n \n
    '; } else { this.arrow.className += ' ' + (document.body.getAttribute('data-form-icon-font') || 'font-awesome'); this.arrow.innerHTML = ''; } this.title.innerHTML = '\n \n ' + (this.selected.length ? this.selected.join(', ') : 'Select') + '\n \n '; this.title.appendChild(this.arrow); this.list.innerHTML = template; this.wrapper.appendChild(this.title); this.wrapper.appendChild(this.options); this.options.appendChild(this.list); this.el.parentNode.insertBefore(this.wrapper, this.el); this.wrapper.appendChild(this.el); } }, { key: '_onClick', value: function _onClick() { var _this = this; if (!this.wrapper) { return false; } this.wrapper.addEventListener('click', function (event) { var target = event.target; _this.target = target; if (target.tagName === "LI") { _this._setActive(target); } if (target.tagName === "SPAN" && target.classList.contains('cs-placeholder')) { _this._setOpen(target); } }); } }, { key: '_setActive', value: function _setActive(target) { var index = target.getAttribute('data-index'); if (this.el.options[index].selected) { target.classList.remove('cs-selected'); this.el.options[index].selected = false; var i = this.selected.indexOf(this.el.options[index].textContent); i !== -1 ? this.selected.splice(i, 1) : []; this.select.hasActive = false; } else { target.classList.add('cs-selected'); this.el.options[index].selected = true; this.selected.push(this.el.options[index].textContent); this.select.hasActive = true; } this.title.innerHTML = '\n \n ' + (this.selected.length ? this.selected.join(', ') : 'Select') + '\n \n '; this.title.appendChild(this.arrow); } // TODO test this }, { key: '_setOpen', value: function _setOpen(target) { if (target.parentNode.classList.contains('cs-active')) { target.classList.remove('project-input_focused'); target.parentNode.classList.remove('cs-active'); this.isOpened = false; //document.removeEventListener('click', this.close.bind(this)); } else { target.classList.add('project-input_focused'); target.parentNode.classList.add('cs-active'); this.isOpened = true; //document.addEventListener('click', this.close.bind(this)); } } }, { key: 'close', value: function close() { if (!this.wrapper || !this.title) { return false; } this.title.classList.remove('project-input_focused'); this.wrapper.classList.remove('cs-active'); this.isOpened = false; } }, { key: 'el', get: function get() { return this._params.el; } }, { key: 'select', get: function get() { return this._params.select; } }]); return Multiselect; }(); exports.default = Multiselect; /***/ }), /***/ 178: /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = initSelectFx; __webpack_require__(445); var _inputControllerLoad = __webpack_require__(53); var _inputControllerLoad2 = _interopRequireDefault(_inputControllerLoad); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function initSelectFx() { var context = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document; [].slice.call(context.querySelectorAll('select')).forEach(function (el) { if (!el.multiple && !el.classList.contains('cs-select_inited')) { el.classList.add('cs-select'); el.classList.add('cs-select_inited'); var parent = el.parentNode; if (parent.classList.contains('cs-select')) { parent.parentNode.insertBefore(el, parent); parent.parentNode.removeChild(parent); } var arrow = document.createElement('span'); arrow.className = 'cs-placeholder-before project-input__icon'; var settings = window.formSettings['select']; if (settings && !settings.use_defaults) { arrow.className += ' has-svg'; arrow.innerHTML = '\n
    \n \n \n
    '; } else { arrow.className += ' ' + (document.body.getAttribute('data-form-icon-font') || 'font-awesome'); arrow.innerHTML = ''; } var fx = new window.SelectFx(el, { onChange: function onChange(link) { var event = new CustomEvent('change', { bubbles: true, cancelable: false }); el.dispatchEvent(event); if (el.parentNode.parentNode.classList.contains('widget')) { if (link && link.startsWith("http")) { document.location.href = link; } else { document.location.href = document.location.origin + document.location.pathname + "?cat=" + link; } } setTimeout(function () { if (el.classList.contains('country_select')) { (0, _inputControllerLoad2.default)(); } if (!link) { //fx.selPlaceholder.innerHTML = '' + "Select" + ''; if (settings.animation.type === 'form-animation-5' || settings.animation.type === 'form-animation-6') { fx.selPlaceholder.innerHTML = '\n S\n e\n l\n e\n c\n t'; } else if (settings.animation.type === 'form-animation-4') { fx.selPlaceholder.innerHTML = '\n \n \n \'Select\'}\n \n \n '; } else { fx.selPlaceholder.innerHTML = '\n \n Select\n \n '; } fx.selPlaceholder.appendChild(arrow); fx.selPlaceholder.classList.remove('project-input_focused'); } }, 0); } }); var removeFocus = function removeFocus() { fx.selPlaceholder.classList.remove('project-input_focused'); document.removeEventListener('click', removeFocus, false); }; if (!fx.selPlaceholder.textContent) { //fx.selPlaceholder.innerHTML = '' + "Select" + ''; if (settings.animation.type === 'form-animation-5' || settings.animation.type === 'form-animation-6') { fx.selPlaceholder.innerHTML = '\n S\n e\n l\n e\n c\n t'; } else if (settings.animation.type === 'form-animation-4') { fx.selPlaceholder.innerHTML = '\n \n \n \'Select\'}\n \n \n '; } else { fx.selPlaceholder.innerHTML = '\n \n Select\n \n '; } } fx.selPlaceholder.appendChild(arrow); fx.selPlaceholder.classList.add('project-input'); fx.selPlaceholder.classList.add('project-input_select'); fx.selPlaceholder.addEventListener('click', function () { if (!fx.selPlaceholder.classList.contains('project-input_focused')) { fx.selPlaceholder.classList.add('project-input_focused'); setTimeout(function () { document.addEventListener('click', removeFocus, false); }, 10); } }, false); } }); } /***/ }), /***/ 200: /***/ (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; }; }(); var _MultiSelect = __webpack_require__(177); var _MultiSelect2 = _interopRequireDefault(_MultiSelect); var _DefaultSelect = __webpack_require__(178); var _DefaultSelect2 = _interopRequireDefault(_DefaultSelect); 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 Select = function () { _createClass(Select, null, [{ key: 'default', get: function get() { return { selector: 'select', elems: null }; } }]); function Select(params) { var _this = this; _classCallCheck(this, Select); this._params = Object.assign({}, Select.default, params); if (!this.elems || !this.elems.length) { return; } this.multiselect = []; this.el = Array.from(this.elems); this.el.forEach(function (select) { if (select.multiple) { _this.multiselect.push(new _MultiSelect2.default({ el: select, select: _this })); } else { (0, _DefaultSelect2.default)(); } }); document.addEventListener('click', function (event) { var target = event.target; if (target.tagName === 'LI') { var parent = target.parentNode; if (parent) { var parentParent = parent.parentNode; parentParent && parentParent.classList.contains('cs-options'); } return false; } else { _this.multiselect.forEach(function (select) { if (select.title !== target && target.tagName !== 'SELECT') { select.close(); } }); } }); } _createClass(Select, [{ key: 'selector', get: function get() { return this._params.selector; } }, { key: 'elems', get: function get() { return this._params.elems; } }]); return Select; }(); exports.default = Select; /***/ }), /***/ 445: /***/ (function(module, exports, __webpack_require__) { "use strict"; var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__; /** * selectFx.js v1.0.0 * http://www.codrops.com * * Licensed under the MIT license. * http://www.opensource.org/licenses/mit-license.php * * Copyright 2014, Codrops * http://www.codrops.com */ /*eslint-disable*/ ;(function (window) { 'use strict'; /*! * classie - class helper functions * from bonzo https://github.com/ded/bonzo * * classie.has( elem, 'my-class' ) -> true/false * classie.add( elem, 'my-new-class' ) * classie.remove( elem, 'my-unwanted-class' ) * classie.toggle( elem, 'my-class' ) */ /*jshint browser: true, strict: true, undef: true */ /*global define: false */ function classReg(className) { return new RegExp("(^|\\s+)" + className + "(\\s+|$)"); } // classList support for class management // altho to be fair, the api sucks because it won't accept multiple classes at once var hasClass, addClass, removeClass; //********************************************************** var arrow = document.createElement('span'); arrow.className = "cs-placeholder-before project-input__icon"; arrow.className += " " + (document.body.getAttribute('data-form-icon-font') || 'font-awesome'); arrow.innerHTML = ""; //********************************************************** if ('classList' in document.documentElement) { hasClass = function hasClass(elem, c) { return elem.classList.contains(c); }; addClass = function addClass(elem, c) { elem.classList.add(c); }; removeClass = function removeClass(elem, c) { elem.classList.remove(c); }; } else { hasClass = function hasClass(elem, c) { return classReg(c).test(elem.className); }; addClass = function addClass(elem, c) { if (!hasClass(elem, c)) { elem.className = elem.className + ' ' + c; } }; removeClass = function removeClass(elem, c) { elem.className = elem.className.replace(classReg(c), ' '); }; } function toggleClass(elem, c) { var fn = hasClass(elem, c) ? removeClass : addClass; fn(elem, c); } var classie = { // full names hasClass: hasClass, addClass: addClass, removeClass: removeClass, toggleClass: toggleClass, // short names has: hasClass, add: addClass, remove: removeClass, toggle: toggleClass }; // transport if (true) { // AMD !(__WEBPACK_AMD_DEFINE_FACTORY__ = (classie), __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? (__WEBPACK_AMD_DEFINE_FACTORY__.call(exports, __webpack_require__, exports, module)) : __WEBPACK_AMD_DEFINE_FACTORY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); } else {} /** * based on from https://github.com/inuyaksa/jquery.nicescroll/blob/master/jquery.nicescroll.js */ function hasParent(e, p) { if (!e) return false; var el = e.target || e.srcElement || e || false; while (el && el != p) { el = el.parentNode || false; } return el !== false; }; /** * extend obj function */ function extend(a, b) { for (var key in b) { if (b.hasOwnProperty(key)) { a[key] = b[key]; } } return a; } /** * SelectFx function */ function SelectFx(el, options) { this.el = el; this.options = extend({}, this.options); extend(this.options, options); this._init(); } /** * SelectFx options */ SelectFx.prototype.options = { // if true all the links will open in a new tab. // if we want to be redirected when we click an option, we need to define a data-link attr on the option of the native select element newTab: true, // when opening the select element, the default placeholder (if any) is shown stickyPlaceholder: true, // callback when changing the value onChange: function onChange(val) { return false; } /** * init function * initialize and cache some vars */ };SelectFx.prototype._init = function () { // check if we are using a placeholder for the native select box // we assume the placeholder is disabled and selected by default var selectedOpt = this.el.querySelector('option[selected]'); this.hasDefaultPlaceholder = selectedOpt && selectedOpt.disabled; // get selected option (either the first option with attr selected or just the first option) this.selectedOpt = selectedOpt || this.el.querySelector('option'); // create structure this._createSelectEl(); // all options this.selOpts = [].slice.call(this.selEl.querySelectorAll('li[data-option]')); // total options this.selOptsCount = this.selOpts.length; // current index this.current = this.selOpts.indexOf(this.selEl.querySelector('li.cs-selected')) || -1; // placeholder elem this.selPlaceholder = this.selEl.querySelector('span.cs-placeholder'); /*********/ // init events this._initEvents(); }; /** * creates the structure for the select element */ SelectFx.prototype._createSelectEl = function () { var self = this, options = '', createOptionHTML = function createOptionHTML(el) { var optclass = '', classes = '', link = ''; if (el.selectedOpt && !this.foundSelected && !this.hasDefaultPlaceholder) { classes += 'cs-selected '; this.foundSelected = true; } // extra classes if (el.getAttribute('data-class')) { classes += el.getAttribute('data-class'); } // link options if (el.getAttribute('data-link')) { link = 'data-link=' + el.getAttribute('data-link'); } if (classes !== '') { optclass = 'class="' + classes + '" '; } return '
  • ' + el.textContent + '
  • '; }; [].slice.call(this.el.children).forEach(function (el) { if (el.disabled) { return; } var tag = el.tagName.toLowerCase(); if (tag === 'option') { options += createOptionHTML(el); } else if (tag === 'optgroup') { options += '
  • ' + el.label + '
  • '; } }); var opts_el = '
    '; this.selEl = document.createElement('div'); this.selEl.className = this.el.className; this.selEl.tabIndex = this.el.tabIndex; //this.selEl.innerHTML = '' + '' + this.selectedOpt.textContent + '' + '' + opts_el; this.selEl.innerHTML = "\n \n " + this.selectedOpt.textContent + "\n \n " + opts_el; this.selEl.appendChild(arrow); this.el.parentNode.appendChild(this.selEl); this.selEl.appendChild(this.el); }; /** * initialize the events */ SelectFx.prototype._initEvents = function () { var self = this; // open/close select this.selPlaceholder.addEventListener('click', function () { self._toggleSelect(); }); // clicking the options this.selOpts.forEach(function (opt, idx) { opt.addEventListener('click', function () { self.current = idx; self._changeOption(); // close select elem self._toggleSelect(); }); }); // close the select element if the target it´s not the select element or one of its descendants.. document.addEventListener('click', function (ev) { var target = ev.target; if (self._isOpen() && target !== self.selEl && !hasParent(target, self.selEl)) { self._toggleSelect(); } }); // keyboard navigation events this.selEl.addEventListener('keydown', function (ev) { var keyCode = ev.keyCode || ev.which; switch (keyCode) { // up key case 38: ev.preventDefault(); self._navigateOpts('prev'); break; // down key case 40: ev.preventDefault(); self._navigateOpts('next'); break; // space key case 32: ev.preventDefault(); if (self._isOpen() && typeof self.preSelCurrent != 'undefined' && self.preSelCurrent !== -1) { self._changeOption(); } self._toggleSelect(); break; // enter key case 13: ev.preventDefault(); if (self._isOpen() && typeof self.preSelCurrent != 'undefined' && self.preSelCurrent !== -1) { self._changeOption(); self._toggleSelect(); } break; // esc key case 27: ev.preventDefault(); if (self._isOpen()) { self._toggleSelect(); } break; } }); }; /** * navigate with up/dpwn keys */ SelectFx.prototype._navigateOpts = function (dir) { if (!this._isOpen()) { this._toggleSelect(); } var tmpcurrent = typeof this.preSelCurrent != 'undefined' && this.preSelCurrent !== -1 ? this.preSelCurrent : this.current; if (dir === 'prev' && tmpcurrent > 0 || dir === 'next' && tmpcurrent < this.selOptsCount - 1) { // save pre selected current - if we click on option, or press enter, or press space this is going to be the index of the current option this.preSelCurrent = dir === 'next' ? tmpcurrent + 1 : tmpcurrent - 1; // remove focus class if any.. this._removeFocus(); // add class focus - track which option we are navigating classie.add(this.selOpts[this.preSelCurrent], 'cs-focus'); } }; /** * open/close select * when opened show the default placeholder if any */ SelectFx.prototype._toggleSelect = function () { // remove focus class if any.. this._removeFocus(); if (this._isOpen()) { if (this.current !== -1) { // update placeholder text //this.selPlaceholder.textContent = this.selOpts[ this.current ].textContent; } classie.remove(this.selEl, 'cs-active'); } else { if (this.hasDefaultPlaceholder && this.options.stickyPlaceholder) { // everytime we open we wanna see the default placeholder text //this.selPlaceholder.innerHTML = '' + this.selectedOpt.textContent + ''; this.selPlaceholder.innerHTML = "\n \n " + this.selectedOpt.textContent + "\n \n "; this.selPlaceholder.appendChild(arrow); } classie.add(this.selEl, 'cs-active'); } }; /** * change option - the new value is set */ SelectFx.prototype._changeOption = function () { // if pre selected current (if we navigate with the keyboard)... if (typeof this.preSelCurrent != 'undefined' && this.preSelCurrent !== -1) { this.current = this.preSelCurrent; this.preSelCurrent = -1; } // current option var opt = this.selOpts[this.current]; // update current selected value //this.selPlaceholder.innerHTML = '' + opt.textContent + ''; this.selPlaceholder.innerHTML = "\n \n " + opt.textContent + "\n \n "; this.selPlaceholder.appendChild(arrow); // change native select element´s value this.el.value = opt.getAttribute('data-value'); // remove class cs-selected from old selected option and add it to current selected option var oldOpt = this.selEl.querySelector('li.cs-selected'); if (oldOpt) { classie.remove(oldOpt, 'cs-selected'); } classie.add(opt, 'cs-selected'); // if there´s a link defined if (opt.getAttribute('data-link')) { // open in new tab? if (this.options.newTab) { window.open(opt.getAttribute('data-link'), '_blank'); } else { window.location = opt.getAttribute('data-link'); } } // callback this.options.onChange(this.el.value); }; /** * returns true if select element is opened */ SelectFx.prototype._isOpen = function (opt) { return classie.has(this.selEl, 'cs-active'); }; /** * removes the focus class from the option */ SelectFx.prototype._removeFocus = function (opt) { var focusEl = this.selEl.querySelector('li.cs-focus'); if (focusEl) { classie.remove(focusEl, 'cs-focus'); } }; /** * add to global namespace */ window.SelectFx = SelectFx; })(window); /*eslint-enable*/ /***/ }) }]);