/var/www/pm-investor.com/www/public/js
Edit: /var/www/pm-investor.com/www/public/js/script.js (538189B)
/******/ (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 = "/js/";
/******/
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = "./js/script.js");
/******/ })
/************************************************************************/
/******/ ({
/***/ "./js/components/component.js":
/*!************************************!*\
!*** ./js/components/component.js ***!
\************************************/
/*! exports provided: Component */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* WEBPACK VAR INJECTION */(function($) {/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Component", function() { return Component; });
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a 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); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
/**
* Will set params:
* this.element{node}
* this.errors{bool} error on define this.element
*/
var Component = /*#__PURE__*/function () {
function Component(el) {
_classCallCheck(this, Component);
this.errors = false;
this.init = el;
}
/**
* Set this.element, before check for correctness.
*
* @param el{string} - class of init element.
*/
_createClass(Component, [{
key: "checkOnExistElement",
/**
* Check is element exist.
* Check is element has ('.' or '#').
*
* @param el{string} - element.
* @returns {*} - element.
*/
value: function checkOnExistElement(el) {
var elementClass = $(el);
if (!el) {
this.errors = true;
console.error("Error in Component: '".concat(el, "' has error with init"));
return false;
}
if (!elementClass.length) {
if (el.indexOf('.') != 0 && el.indexOf('#') != 0) {
this.errors = true;
console.error("Error in Component: '".concat(el, "' does not contain the identification '.' or '#'"));
return false;
}
this.errors = true;
console.warn("Warning in Component: '".concat(el, "' is not define on page"));
return false;
}
return elementClass;
}
}, {
key: "init",
set: function set(el) {
var elementClass = this.checkOnExistElement(el);
if (elementClass) {
this.element = elementClass;
this.errors = false;
return;
}
this.errors = true;
}
/**
* Getter for element.
*
* @returns {node} - element of slider init.
*/
}, {
key: "getElement",
get: function get() {
return this.element;
}
}]);
return Component;
}();
/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js")))
/***/ }),
/***/ "./js/libs/maskedinput.min.js":
/*!************************************!*\
!*** ./js/libs/maskedinput.min.js ***!
\************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
/*
jQuery Masked Input Plugin
Copyright (c) 2007 - 2014 Josh Bush (digitalbush.com)
Licensed under the MIT license (http://digitalbush.com/projects/masked-input-plugin/#license)
Version: 1.4.0
*/
!function (a) {
true ? !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js")], __WEBPACK_AMD_DEFINE_FACTORY__ = (a),
__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)) : undefined;
}(function (a) {
var b,
c = navigator.userAgent,
d = /iphone/i.test(c),
e = /chrome/i.test(c),
f = /android/i.test(c);
a.mask = {
definitions: {
9: "[0-9]",
a: "[A-Za-z]",
"*": "[A-Za-z0-9]"
},
autoclear: !0,
dataName: "rawMaskFn",
placeholder: "_"
}, a.fn.extend({
caret: function caret(a, b) {
var c;
if (0 !== this.length && !this.is(":hidden")) return "number" == typeof a ? (b = "number" == typeof b ? b : a, this.each(function () {
this.setSelectionRange ? this.setSelectionRange(a, b) : this.createTextRange && (c = this.createTextRange(), c.collapse(!0), c.moveEnd("character", b), c.moveStart("character", a), c.select());
})) : (this[0].setSelectionRange ? (a = this[0].selectionStart, b = this[0].selectionEnd) : document.selection && document.selection.createRange && (c = document.selection.createRange(), a = 0 - c.duplicate().moveStart("character", -1e5), b = a + c.text.length), {
begin: a,
end: b
});
},
unmask: function unmask() {
return this.trigger("unmask");
},
mask: function mask(c, g) {
var h, i, j, k, l, m, n, o;
if (!c && this.length > 0) {
h = a(this[0]);
var p = h.data(a.mask.dataName);
return p ? p() : void 0;
}
return g = a.extend({
autoclear: a.mask.autoclear,
placeholder: a.mask.placeholder,
completed: null
}, g), i = a.mask.definitions, j = [], k = n = c.length, l = null, a.each(c.split(""), function (a, b) {
"?" == b ? (n--, k = a) : i[b] ? (j.push(new RegExp(i[b])), null === l && (l = j.length - 1), k > a && (m = j.length - 1)) : j.push(null);
}), this.trigger("unmask").each(function () {
function h() {
if (g.completed) {
for (var a = l; m >= a; a++) {
if (j[a] && C[a] === p(a)) return;
}
g.completed.call(B);
}
}
function p(a) {
return g.placeholder.charAt(a < g.placeholder.length ? a : 0);
}
function q(a) {
for (; ++a < n && !j[a];) {
;
}
return a;
}
function r(a) {
for (; --a >= 0 && !j[a];) {
;
}
return a;
}
function s(a, b) {
var c, d;
if (!(0 > a)) {
for (c = a, d = q(b); n > c; c++) {
if (j[c]) {
if (!(n > d && j[c].test(C[d]))) break;
C[c] = C[d], C[d] = p(d), d = q(d);
}
}
z(), B.caret(Math.max(l, a));
}
}
function t(a) {
var b, c, d, e;
for (b = a, c = p(a); n > b; b++) {
if (j[b]) {
if (d = q(b), e = C[b], C[b] = c, !(n > d && j[d].test(e))) break;
c = e;
}
}
}
function u() {
var a = B.val(),
b = B.caret();
if (a.length < o.length) {
for (A(!0); b.begin > 0 && !j[b.begin - 1];) {
b.begin--;
}
if (0 === b.begin) for (; b.begin < l && !j[b.begin];) {
b.begin++;
}
B.caret(b.begin, b.begin);
} else {
for (A(!0); b.begin < n && !j[b.begin];) {
b.begin++;
}
B.caret(b.begin, b.begin);
}
h();
}
function v() {
A(), B.val() != E && B.change();
}
function w(a) {
if (!B.prop("readonly")) {
var b,
c,
e,
f = a.which || a.keyCode;
o = B.val(), 8 === f || 46 === f || d && 127 === f ? (b = B.caret(), c = b.begin, e = b.end, e - c === 0 && (c = 46 !== f ? r(c) : e = q(c - 1), e = 46 === f ? q(e) : e), y(c, e), s(c, e - 1), a.preventDefault()) : 13 === f ? v.call(this, a) : 27 === f && (B.val(E), B.caret(0, A()), a.preventDefault());
}
}
function x(b) {
if (!B.prop("readonly")) {
var c,
d,
e,
g = b.which || b.keyCode,
i = B.caret();
if (!(b.ctrlKey || b.altKey || b.metaKey || 32 > g) && g && 13 !== g) {
if (i.end - i.begin !== 0 && (y(i.begin, i.end), s(i.begin, i.end - 1)), c = q(i.begin - 1), n > c && (d = String.fromCharCode(g), j[c].test(d))) {
if (t(c), C[c] = d, z(), e = q(c), f) {
var k = function k() {
a.proxy(a.fn.caret, B, e)();
};
setTimeout(k, 0);
} else B.caret(e);
i.begin <= m && h();
}
b.preventDefault();
}
}
}
function y(a, b) {
var c;
for (c = a; b > c && n > c; c++) {
j[c] && (C[c] = p(c));
}
}
function z() {
B.val(C.join(""));
}
function A(a) {
var b,
c,
d,
e = B.val(),
f = -1;
for (b = 0, d = 0; n > b; b++) {
if (j[b]) {
for (C[b] = p(b); d++ < e.length;) {
if (c = e.charAt(d - 1), j[b].test(c)) {
C[b] = c, f = b;
break;
}
}
if (d > e.length) {
y(b + 1, n);
break;
}
} else C[b] === e.charAt(d) && d++, k > b && (f = b);
}
return a ? z() : k > f + 1 ? g.autoclear || C.join("") === D ? (B.val() && B.val(""), y(0, n)) : z() : (z(), B.val(B.val().substring(0, f + 1))), k ? b : l;
}
var B = a(this),
C = a.map(c.split(""), function (a, b) {
return "?" != a ? i[a] ? p(b) : a : void 0;
}),
D = C.join(""),
E = B.val();
B.data(a.mask.dataName, function () {
return a.map(C, function (a, b) {
return j[b] && a != p(b) ? a : null;
}).join("");
}), B.one("unmask", function () {
B.off(".mask").removeData(a.mask.dataName);
}).on("focus.mask", function () {
if (!B.prop("readonly")) {
clearTimeout(b);
var a;
E = B.val(), a = A(), b = setTimeout(function () {
z(), a == c.replace("?", "").length ? B.caret(0, a) : B.caret(a);
}, 10);
}
}).on("blur.mask", v).on("keydown.mask", w).on("keypress.mask", x).on("input.mask paste.mask", function () {
B.prop("readonly") || setTimeout(function () {
var a = A(!0);
B.caret(a), h();
}, 0);
}), e && f && B.off("input.mask").on("input.mask", u), A();
});
}
});
});
/***/ }),
/***/ "./js/libs/sendform/field.js":
/*!***********************************!*\
!*** ./js/libs/sendform/field.js ***!
\***********************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* WEBPACK VAR INJECTION */(function($) {/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return Field; });
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(n); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); }
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a 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); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
/**
* Class Field.
*/
var Field = /*#__PURE__*/function () {
function Field(field, state, reference, settings, position) {
_classCallCheck(this, Field);
this.field = field;
this.reference = Object.assign({}, reference);
this.isValid = true;
this.type = this.field.getAttribute('type');
this.isRequired = this.field.hasAttribute('required');
this.firstCheck = true;
this.settings = settings;
this.regularExp = this.field.getAttribute('pattern');
this.position = position;
this.removeRequired();
this.onKeyUp();
this.onChange();
if (this.regularExp != null) {
this.createValidation();
}
}
_createClass(Field, [{
key: "createValidation",
value: function createValidation() {
this.field.removeAttribute('pattern');
if (this.reference[this.type] == undefined || null) {
this.reference[this.type] = ['regExp'];
return;
}
this.reference[this.type] = [].concat(_toConsumableArray(this.reference[this.type]), ['regExp']);
}
}, {
key: "removeRequired",
value: function removeRequired() {
if (!this.isRequired) return;
this.field.removeAttribute("required");
this.field.classList.add(this.settings.requiredClass);
}
}, {
key: "onKeyUp",
value: function onKeyUp() {
var _this = this;
this.field.addEventListener('keyup', function (el) {
if (_this.firstCheck) return;
var value = el.target.value;
_this.validate(value);
});
}
}, {
key: "onChange",
value: function onChange() {
var _this2 = this;
this.field.addEventListener('change', function (el) {
var value = el.target.value;
_this2.validate(value);
_this2.firstCheck = false;
});
}
}, {
key: "validate",
value: function validate() {
var _this3 = this;
if (!this.needValidate()) {
this.removeError();
return;
}
var value = this.field.value;
var validationFunc = this.reference[this.type];
var valid = true;
if (validationFunc == undefined) {
validationFunc = this.reference['required'];
}
validationFunc.forEach(function (func) {
var result = _this3[func](value);
valid = valid * result;
});
if (valid) {
this.removeError();
} else {
this.addError();
}
this.isValid = valid;
return {
valid: this.isValid,
position: this.position
};
}
}, {
key: "addError",
value: function addError() {
this.field.classList.add(this.settings.errorClass);
}
}, {
key: "removeError",
value: function removeError() {
this.field.classList.remove(this.settings.errorClass);
}
}, {
key: "needValidate",
value: function needValidate() {
var noEmpty = this.field.value != 0;
if (this.isRequired) {
return true;
}
if (noEmpty && this.type == 'email') {
return true;
}
if (noEmpty && this.regularExp != null) {
return true;
}
return false;
}
}, {
key: "resetSelf",
value: function resetSelf() {
this.field.value = '';
this.field.checked = false;
} //Is on no empty value testing
}, {
key: "isEmpty",
value: function isEmpty(val) {
if (val == '') {
return false;
} else {
return true;
}
} //Is email testing
}, {
key: "isEmail",
value: function isEmail(val) {
var email = /^[-\w.]+@([A-z0-9]+\.)+[A-z]{2,4}$/;
return email.test(val);
} //Is url testing
}, {
key: "isUrl",
value: function isUrl(element) {
var url = /[^\s\.]+\.[^\s]{2,}|www\.[^\s]+\.[^\s]{2,}/;
return url.test($(element).val());
} //Is min 5 charachter
}, {
key: "minLength",
value: function minLength(val) {
if (val.length > 5) return true;
}
}, {
key: "isChecked",
value: function isChecked() {
if (this.field.checked) {
return true;
}
return false;
} //Is cyrillic testing
}, {
key: "isCyr",
value: function isCyr(val) {
var cyr = /[\u0400-\u04FF]/gi;
return cyr.test(val);
}
}, {
key: "isCheckedRadio",
value: function isCheckedRadio() {
var collection = document.querySelectorAll("input[name=".concat(this.field.name, "]"));
var isSomeChecked = false;
collection.forEach(function (el) {
if (el.checked) isSomeChecked = true;
});
return isSomeChecked;
}
}, {
key: "regExp",
value: function regExp(val) {
var reqular = new RegExp(this.regularExp);
return reqular.test(val);
}
}]);
return Field;
}();
/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js")))
/***/ }),
/***/ "./js/libs/sendform/form.js":
/*!**********************************!*\
!*** ./js/libs/sendform/form.js ***!
\**********************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return Form; });
/* harmony import */ var _field__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./field */ "./js/libs/sendform/field.js");
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a 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); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
/**
* @param formClass {string} - class of form.
* @param settings {Object} - settings object.
* @param reference {Object} - reference for validation.
*/
var Form = /*#__PURE__*/function () {
function Form(formClass, settings, reference) {
var _this = this;
_classCallCheck(this, Form);
this.form = document.querySelector(formClass);
if (this.form == null || undefined) return;
this.inputs = Array.from(this.form.querySelectorAll('input:not([type="hidden"]), select'));
/**
* Set action(url for request)
*/
var action = this.form.getAttribute('action');
this.action = action != null ? action : '/'; // Form state if it contain errors
this.state = true; //determine if there are any mistakes now.
this.error = false; // Show spunner activity
this.isSpinnerActive = false; // Text of status field.
this.statusText = null; // Contain all field of this form
this.items = []; // Contain errors field with position
this.errorItems = {};
var customSettings = {
resetAfterSubmit: true,
onlyValidate: false,
statusId: 'form-status',
statusErrorClass: 'with_error',
statusSucssClass: 'with_success',
errorClass: 'error',
validateClass: '.js_sendform-validate',
requiredClass: 'form-required',
modalOpen: true,
modalId: '#thanks',
msgSend: '',
msgDone: '',
msgError: 'Ошибка отправки',
msgValError: 'Одно из полей не заполнено',
spinnerColor: '#000',
formPosition: 'relative',
resetClass: '.js_senform-reset',
method: 'POST',
success: function success(data) {
_this.successSubmit(data);
},
error: function error(data) {
_this.errorSubmit(data);
},
validationSuccess: function validationSuccess() {},
validationError: function validationError() {
_this.validationErrorCallback();
}
};
var customReference = {
email: ['isEmail', 'isEmpty'],
text: ['isEmpty'],
phone: ['minLength'],
required: ['isEmpty'],
checkbox: ['isChecked'],
radio: ['isCheckedRadio']
};
this.settings = Object.assign({}, customSettings, settings);
this.reference = Object.assign({}, customReference, reference);
this.onInit();
}
/**
* On initialize class.
* Creating all inputs of this form.
* if setting for only validate true init this func.
* else init function on submitting.
* creating status text field.
* init function for reset field.
*/
_createClass(Form, [{
key: "onInit",
value: function onInit() {
var _this2 = this;
this.createInputsValidate();
if (this.settings.onlyValidate) {
this.onValidate();
} else {
this.form.addEventListener('submit', function (event) {
event.preventDefault();
_this2.preSubmit();
});
}
this.createStatusField();
this.onReset();
}
/**
* Creating for each input, select, checkboxes own class.
* And pushing this classes into array.
*/
}, {
key: "createInputsValidate",
value: function createInputsValidate() {
var _this3 = this;
this.inputs.forEach(function (el, i) {
var item = new _field__WEBPACK_IMPORTED_MODULE_0__["default"](el, _this3.state, _this3.reference, _this3.settings, i);
_this3.items.push(item);
});
}
/**
* Create hidden field for status text.
*/
}, {
key: "createStatusField",
value: function createStatusField() {
var div = document.createElement('div');
div.innerHTML = '';
div.id = this.settings.statusId;
this.form.appendChild(div);
this.statusText = this.form.querySelector("#".concat(this.settings.statusId));
}
/**
* checking on error.
* prepare for submitting:
* add spinner, add status text.
* call submit function.
*/
}, {
key: "preSubmit",
value: function preSubmit() {
this.validateField();
if (!this.state) {
this.errorOnForm();
return;
}
this.error = false;
if (!this.isSpinnerActive) this.addSpinner();
this.statusText.innerHTML = this.settings.msgSend;
this.submitData();
}
/**
* Foreach in all items call validation function.
* @param result {object} - variable keep return from
* validation function.Object contain 2 attr
* result.valid {boolean} -show is field pass validation.
* result.position {string} - position of field.
*
*/
}, {
key: "validateField",
value: function validateField() {
var _this4 = this;
var localState = true;
this.items.forEach(function (item) {
var result = item.validate();
if (result == undefined) return;
localState = localState * result.valid;
if (localState) {
delete _this4.errorItems[result.position];
} else {
_this4.errorItems[result.position] = false;
}
});
this.state = localState;
if (this.state) {
this.removeStatusText();
}
}
/**
* Call reset method on all items.
*/
}, {
key: "resetField",
value: function resetField() {
this.items.forEach(function (item) {
item.resetSelf();
});
}
/**
* Adding spinner.
*/
}, {
key: "addSpinner",
value: function addSpinner() {
var div = document.createElement('div');
div.innerHTML = '
';
div.id = 'formsendHover';
this.form.appendChild(div);
this.isSpinnerActive = true;
}
/**
* Removing spinner.
*/
}, {
key: "removeSpinner",
value: function removeSpinner() {
if (!document.querySelector('#formsendHover')) return;
document.querySelector('#formsendHover').remove();
this.isSpinnerActive = false;
}
/**
* init validation by press on btn.
*/
}, {
key: "onValidate",
value: function onValidate() {
var _this5 = this;
var validateBtn = this.form.querySelector(this.settings.validateClass);
validateBtn.addEventListener('click', function (event) {
event.preventDefault();
_this5.validateField();
if (_this5.state) {
_this5.settings.validationSuccess();
return;
}
_this5.settings.validationError();
});
}
/**
* init function reseting by press btn.
*/
}, {
key: "onReset",
value: function onReset() {
var _this6 = this;
var resetClass = this.form.querySelector(this.settings.resetClass);
if (resetClass == null || undefined) return;
resetClass.addEventListener('click', function () {
_this6.resetField();
});
}
/**
* Add text and set error on true.
* And add text error.
*/
}, {
key: "errorOnForm",
value: function errorOnForm() {
if (this.error) return;
this.error = true;
this.statusText.innerHTML = this.settings.msgValError;
this.statusText.classList.add('with_error');
}
/**
* On error
*/
}, {
key: "validationErrorCallback",
value: function validationErrorCallback() {
this.errorStatusText();
this.printText(this.settings.msgValError);
}
/**
* Change status text
*
* @param text
*/
}, {
key: "printText",
value: function printText(text) {
this.statusText.innerHTML = text;
}
/**
* Clear status
*/
}, {
key: "removeStatusText",
value: function removeStatusText() {
this.statusText.innerHTML = '';
this.statusText.classList = '';
}
/**
* Add class error on status
*/
}, {
key: "errorStatusText",
value: function errorStatusText() {
this.statusText.classList.add(this.settings.statusErrorClass);
}
/**
* Submitting data to server ajax type
*/
}, {
key: "submitData",
value: function submitData() {
var _this7 = this;
var request = new XMLHttpRequest();
request.open(this.settings.method, this.action, true);
var filesInput = this.form.querySelectorAll('input[type="file"]');
var data = new FormData(this.form);
if (filesInput.length) {
filesInput = Array.from(filesInput);
data = this.prepareFiles(filesInput, data);
}
request.onload = function (data) {
if (request.status >= 200 && request.status < 400) {
// Success!
_this7.settings.success(request);
} else {
// We reached our target server, but it returned an error
_this7.settings.error();
}
_this7.removeSpinner();
};
request.send(data);
}
/**
* Check input with files on existing files
* run function to prepare files
*
* @param inputsWithFile
* @param data
* @returns {*}
*/
}, {
key: "prepareFiles",
value: function prepareFiles(inputsWithFile, data) {
var _this8 = this;
inputsWithFile.forEach(function (input) {
if (!input.files.length) return;
data = _this8.appendFilesIntoData(input, data);
});
return data;
}
/**
* Add files into data with new names
* @param input
* @param data
* @returns {*}
*/
}, {
key: "appendFilesIntoData",
value: function appendFilesIntoData(input, data) {
var files = Array.from(input.files);
files.forEach(function (file, i) {
data.append("".concat(input.name).concat(i), file);
});
return data;
}
/**
* On error submit
*/
}, {
key: "errorSubmit",
value: function errorSubmit() {
this.errorStatusText();
this.printText(this.settings.msgError);
}
/**
* On success submit
* @param data
*/
}, {
key: "successSubmit",
value: function successSubmit(data) {
this.printText(this.settings.msgDone);
}
}]);
return Form;
}();
/***/ }),
/***/ "./js/libs/sendform/sendform2.js":
/*!***************************************!*\
!*** ./js/libs/sendform/sendform2.js ***!
\***************************************/
/*! exports provided: Sendform */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _form__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./form */ "./js/libs/sendform/form.js");
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Sendform", function() { return _form__WEBPACK_IMPORTED_MODULE_0__["default"]; });
/***/ }),
/***/ "./js/libs/slider.js":
/*!***************************!*\
!*** ./js/libs/slider.js ***!
\***************************/
/*! exports provided: Slider */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* WEBPACK VAR INJECTION */(function($, jQuery) {/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Slider", function() { return Slider; });
/* harmony import */ var owl_carousel__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! owl.carousel */ "./node_modules/owl.carousel/dist/owl.carousel.js");
/* harmony import */ var owl_carousel__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(owl_carousel__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _components_component__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../components/component */ "./js/components/component.js");
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a 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); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
function _createSuper(Derived) { return function () { var Super = _getPrototypeOf(Derived), result; if (_isNativeReflectConstruct()) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
/**
* Owl carousel slider class.
*/
var defaultSetting = {
loop: true,
margin: 0,
items: 1,
nav: true,
autoPlay: true,
stopOnHover: true,
navText: ['', '']
};
/**
* Class for init slider.
*
*/
var Slider = /*#__PURE__*/function (_Component) {
_inherits(Slider, _Component);
var _super = _createSuper(Slider);
/**
* @param el{string} - slider class.
* @param btnPrev{string} - slider class prev.
* @param btnNext{string} - slider class next.
* @param settings{Object} - settings.
* @param plugin{string} - plugin define.
*/
function Slider() {
var _this;
var el = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '.js_owl-carousel';
var btnPrev = arguments.length > 1 ? arguments[1] : undefined;
var btnNext = arguments.length > 2 ? arguments[2] : undefined;
var countSlides = arguments.length > 3 ? arguments[3] : undefined;
var settings = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : defaultSetting;
var plugin = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 'owlCarousel';
_classCallCheck(this, Slider);
_this = _super.call(this, el);
_this.settings = Object.assign({}, defaultSetting, settings);
_this.plugin = plugin;
if (!_this.errors) {
if (countSlides) {
_this.settings.onInitialized = _this.counterSlides;
_this.settings.onChanged = _this.counterSlides;
}
_this.inetedPlugin = _this.initSlider();
_this.newBtn(_this.inetedPlugin, btnNext, btnPrev);
}
return _this;
}
_createClass(Slider, [{
key: "counterSlides",
value: function counterSlides(event) {
if (!event.namespace) {
return;
}
var slides = event.relatedTarget;
$('.js_slider-counter').text(slides.relative(slides.current()) + 1 + ' / ' + slides.items().length);
}
}, {
key: "newBtn",
value: function newBtn(owl, btnNext, btnPrev) {
// Go to the next item
$(btnNext).click(function (e) {
e.preventDefault();
owl.trigger('next.owl.carousel');
}); // Go to the previous item
$(btnPrev).click(function (e) {
e.preventDefault();
owl.trigger('prev.owl.carousel', [300]);
});
}
/**
* Set new plugin.
*
* @param plugin{string} - name of function which init plugin.
*/
}, {
key: "initSlider",
/**
* Initialize slider with owlCarousel.
*/
value: function initSlider() {
return this.sliderPlugin.call(this.element, this.settings);
}
}, {
key: "plugin",
set: function set(plugin) {
plugin = jQuery()[plugin];
if (plugin == undefined) {
console.error('Error in Slider: plugin of slider is not defined.');
return;
}
this.sliderPlugin = plugin;
}
}]);
return Slider;
}(_components_component__WEBPACK_IMPORTED_MODULE_1__["Component"]);
/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js"), __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js")))
/***/ }),
/***/ "./js/script.js":
/*!**********************!*\
!*** ./js/script.js ***!
\**********************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
__webpack_require__(/*! ./script/main.js */ "./js/script/main.js");
/***/ }),
/***/ "./js/script/main.js":
/*!***************************!*\
!*** ./js/script/main.js ***!
\***************************/
/*! no exports provided */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* WEBPACK VAR INJECTION */(function($, global) {/* harmony import */ var _libs_sendform_sendform2__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../libs/sendform/sendform2 */ "./js/libs/sendform/sendform2.js");
/* harmony import */ var _libs_slider__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../libs/slider */ "./js/libs/slider.js");
/* harmony import */ var _node_modules_select2_dist_js_select2_min_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../node_modules/select2/dist/js/select2.min.js */ "./node_modules/select2/dist/js/select2.min.js");
/* harmony import */ var _node_modules_select2_dist_js_select2_min_js__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_node_modules_select2_dist_js_select2_min_js__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var _libs_maskedinput_min_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../libs/maskedinput.min.js */ "./js/libs/maskedinput.min.js");
/* harmony import */ var _libs_maskedinput_min_js__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_libs_maskedinput_min_js__WEBPACK_IMPORTED_MODULE_3__);
/* harmony import */ var _node_modules_magnific_popup_dist_jquery_magnific_popup_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../node_modules/magnific-popup/dist/jquery.magnific-popup.js */ "./node_modules/magnific-popup/dist/jquery.magnific-popup.js");
/* harmony import */ var _node_modules_magnific_popup_dist_jquery_magnific_popup_js__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_node_modules_magnific_popup_dist_jquery_magnific_popup_js__WEBPACK_IMPORTED_MODULE_4__);
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a 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); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
//JQuery Mask
$(document).ready(function () {
var projectApp = new App();
global.app = projectApp;
projectApp.init();
});
var App = /*#__PURE__*/function () {
// Define global visible variable inside app
function App() {
_classCallCheck(this, App);
}
_createClass(App, [{
key: "init",
value: function init() {
//Fixed header on mobile
$(window).scroll(function () {
var header = $('.header'),
scroll = $(window).scrollTop();
if (scroll >= 60) header.addClass('__fixed');else header.removeClass('__fixed');
}); //Scroll
var $links = $('.js_scroll-lnk');
$links.each(function () {
$(this).click(function () {
$links.each(function () {
$(this).removeClass('__active');
});
$(this).addClass('__active');
$('html, body').animate({
scrollTop: $($(this).attr('href')).offset().top
}, 1000);
return false;
});
}); //Select
$('.js_select').each(function () {
var $thisSelect = $(this);
$thisSelect.select2({
minimumResultsForSearch: Infinity,
dropdownParent: $thisSelect.parent()
});
}); //Mobile menu
$('body').on('click', '.js_menu-btn', function (e) {
e.preventDefault();
$(this).toggleClass('__active');
if ($(this).hasClass('__active')) {
$('.js_menu-cnt').addClass('__show-menu');
} else {
$('.js_menu-cnt').removeClass('__show-menu');
}
});
this.accordion('.js_accordion-ttl', '.js_accordion-cnt', '__active'); //Slider for main block
new _libs_slider__WEBPACK_IMPORTED_MODULE_1__["Slider"]('.js_carousel-main', '.js_carousel-main-prev', '.js_carousel-main-next', true, {
loop: true,
margin: 0,
items: 1,
nav: false,
autoHeight: false,
autoplay: true,
autoplayTimeout: 5000,
autoplayHoverPause: true,
dots: false,
paginationNumbers: true
}); //Slider for about block
new _libs_slider__WEBPACK_IMPORTED_MODULE_1__["Slider"]('.js_carousel-gallery', '.js_carousel-gallery-prev', '.js_carousel-gallery-next', false, {
loop: true,
margin: 0,
items: 1,
nav: false,
autoHeight: false,
autoplay: true,
autoplayTimeout: 5000,
autoplayHoverPause: true,
dots: false
}); //Slider for project block
new _libs_slider__WEBPACK_IMPORTED_MODULE_1__["Slider"]('.js_carousel-project', '.js_carousel-project-prev', '.js_carousel-project-next', false, {
loop: true,
margin: 0,
items: 1,
nav: false,
autoHeight: false,
autoplay: true,
autoplayTimeout: 5000,
autoplayHoverPause: true,
dots: true
}); //PhoneMask init
this.initPhoneMask(); //Send form
new _libs_sendform_sendform2__WEBPACK_IMPORTED_MODULE_0__["Sendform"]('.js_send-form');
new _libs_sendform_sendform2__WEBPACK_IMPORTED_MODULE_0__["Sendform"]('.js_send-form-popup');
this.openPopup('.js_popup-open', '#modal-consultation');
this.closePopup('.js_popup-close');
}
}, {
key: "accordion",
value: function accordion(accordionTtl, accordionCnt, activeClassTtl) {
$('body').on('click', accordionTtl, function (event) {
event.preventDefault();
if ($(accordionTtl).hasClass(activeClassTtl) && !$(this).hasClass(activeClassTtl)) {
$(accordionTtl).removeClass(activeClassTtl);
$(accordionCnt).slideUp(400);
}
$(this).toggleClass(activeClassTtl);
$(this).next(accordionCnt).slideToggle(400);
});
}
}, {
key: "initPhoneMask",
value: function initPhoneMask() {
$('input[type="phone"]').mask('+99 (999) 999-99-99');
}
}, {
key: "openPopup",
value: function openPopup(btn, modalEL) {
$('body').on('click', btn, function (event) {
event.preventDefault();
$.magnificPopup.open({
showCloseBtn: false,
type: 'inline',
tLoading: 'Загрузка...',
items: {
src: modalEL
}
});
});
}
}, {
key: "closePopup",
value: function closePopup(el) {
$('body').on('click', el, function (event) {
event.preventDefault();
$.magnificPopup.close();
});
}
}]);
return App;
}();
;
/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js"), __webpack_require__(/*! ./../../node_modules/webpack-stream/node_modules/webpack/buildin/global.js */ "./node_modules/webpack-stream/node_modules/webpack/buildin/global.js")))
/***/ }),
/***/ "./node_modules/jquery/dist/jquery.js":
/*!********************************************!*\
!*** ./node_modules/jquery/dist/jquery.js ***!
\********************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
* jQuery JavaScript Library v3.4.1
* https://jquery.com/
*
* Includes Sizzle.js
* https://sizzlejs.com/
*
* Copyright JS Foundation and other contributors
* Released under the MIT license
* https://jquery.org/license
*
* Date: 2019-05-01T21:04Z
*/
( function( global, factory ) {
"use strict";
if ( true && typeof module.exports === "object" ) {
// For CommonJS and CommonJS-like environments where a proper `window`
// is present, execute the factory and get jQuery.
// For environments that do not have a `window` with a `document`
// (such as Node.js), expose a factory as module.exports.
// This accentuates the need for the creation of a real `window`.
// e.g. var jQuery = require("jquery")(window);
// See ticket #14549 for more info.
module.exports = global.document ?
factory( global, true ) :
function( w ) {
if ( !w.document ) {
throw new Error( "jQuery requires a window with a document" );
}
return factory( w );
};
} else {
factory( global );
}
// Pass this if window is not defined yet
} )( typeof window !== "undefined" ? window : this, function( window, noGlobal ) {
// Edge <= 12 - 13+, Firefox <=18 - 45+, IE 10 - 11, Safari 5.1 - 9+, iOS 6 - 9.1
// throw exceptions when non-strict code (e.g., ASP.NET 4.5) accesses strict mode
// arguments.callee.caller (trac-13335). But as of jQuery 3.0 (2016), strict mode should be common
// enough that all such attempts are guarded in a try block.
"use strict";
var arr = [];
var document = window.document;
var getProto = Object.getPrototypeOf;
var slice = arr.slice;
var concat = arr.concat;
var push = arr.push;
var indexOf = arr.indexOf;
var class2type = {};
var toString = class2type.toString;
var hasOwn = class2type.hasOwnProperty;
var fnToString = hasOwn.toString;
var ObjectFunctionString = fnToString.call( Object );
var support = {};
var isFunction = function isFunction( obj ) {
// Support: Chrome <=57, Firefox <=52
// In some browsers, typeof returns "function" for HTML