vendor: 4,692 bytes, lines 1-142
1console.log('test'); 2(function (modules) { // webpackBootstrap 3 /******/ // The module cache 4 /******/ 5 var installedModules = {}; 6 /******/ 7 /******/ // The require function 8 /******/ 9 function __webpack_require__(moduleId) { 10 /******/ 11 /******/ // Check if module is in cache 12 /******/ 13 if (installedModules[moduleId]) { 14 /******/ 15 return installedModules[moduleId].exports; 16 /******/ 17 } 18 /******/ // Create a new module (and put it into the cache) 19 /******/ 20 var module = installedModules[moduleId] = { 21 /******/ i: moduleId, 22 /******/ l: false, 23 /******/ exports: {} 24 /******/ 25 }; 26 /******/ 27 /******/ // Execute the module function 28 /******/ 29 modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); 30 /******/ 31 /******/ // Flag the module as loaded 32 /******/ 33 module.l = true; 34 /******/ 35 /******/ // Return the exports of the module 36 /******/ 37 return module.exports; 38 /******/ 39 } 40 41 /******/ 42 /******/ 43 /******/ // expose the modules object (__webpack_modules__) 44 /******/ 45 __webpack_require__.m = modules; 46 /******/ 47 /******/ // expose the module cache 48 /******/ 49 __webpack_require__.c = installedModules; 50 /******/ 51 /******/ // define getter function for harmony exports 52 /******/ 53 __webpack_require__.d = function (exports, name, getter) { 54 /******/ 55 if (!__webpack_require__.o(exports, name)) { 56 /******/ 57 Object.defineProperty(exports, name, { enumerable: true, get: getter }); 58 /******/ 59 } 60 /******/ 61 }; 62 /******/ 63 /******/ // define __esModule on exports 64 /******/ 65 __webpack_require__.r = function (exports) { 66 /******/ 67 if (typeof Symbol !== 'undefined' && Symbol.toStringTag) { 68 /******/ 69 Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); 70 /******/ 71 } 72 /******/ 73 Object.defineProperty(exports, '__esModule', { value: true }); 74 /******/ 75 }; 76 /******/ 77 /******/ // create a fake namespace object 78 /******/ // mode & 1: value is a module id, require it 79 /******/ // mode & 2: merge all properties of value into the ns 80 /******/ // mode & 4: return value when already ns object 81 /******/ // mode & 8|1: behave like require 82 /******/ 83 __webpack_require__.t = function (value, mode) { 84 /******/ 85 if (mode & 1) value = __webpack_require__(value); 86 /******/ 87 if (mode & 8) return value; 88 /******/ 89 if ((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; 90 /******/ 91 var ns = Object.create(null); 92 /******/ 93 __webpack_require__.r(ns); 94 /******/ 95 Object.defineProperty(ns, 'default', { enumerable: true, value: value }); 96 /******/ 97 if (mode & 2 && typeof value != 'string') for (var key in value) __webpack_require__.d(ns, key, function (key) { 98 return value[key]; 99 }.bind(null, key)); 100 /******/ 101 return ns; 102 /******/ 103 }; 104 /******/ 105 /******/ // getDefaultExport function for compatibility with non-harmony modules 106 /******/ 107 __webpack_require__.n = function (module) { 108 /******/ 109 var getter = module && module.__esModule ? 110 /******/ function getDefault() { 111 return module['default']; 112 } : 113 /******/ function getModuleExports() { 114 return module; 115 }; 116 /******/ 117 __webpack_require__.d(getter, 'a', getter); 118 /******/ 119 return getter; 120 /******/ 121 }; 122 /******/ 123 /******/ // Object.prototype.hasOwnProperty.call 124 /******/ 125 __webpack_require__.o = function (object, property) { 126 return Object.prototype.hasOwnProperty.call(object, property); 127 }; 128 /******/ 129 /******/ // __webpack_public_path__ 130 /******/ 131 __webpack_require__.p = ""; 132 /******/ 133 /******/ 134 /******/ // Load entry module and return exports 135 /******/ 136 return __webpack_require__(__webpack_require__.s = "./js/main.js"); 137 /******/ 138}) 139 /************************************************************************/ 140 /******/({ 141 142
142/***/ "./js/main.js": 143 /*!********************!*\ 144 !*** ./js/main.js ***! 145 \********************/ 146 /*! no exports provided */ 147 /***/ (function (module, __webpack_exports__, __webpack_require__) { 148 149 "use strict"; 150 __webpack_require__.r(__webpack_exports__); 151 /* harmony import */ 152 var _utils_ios_vh_fix__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./utils/ios-vh-fix */ "./js/utils/ios-vh-fix.js"); 153 /* harmony import */ 154 var _modules_modals_init_modals__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./modules/modals/init-modals */ "./js/modules/modals/init-modals.js"); 155 /* harmony import */ 156 var _modules_init_tabs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./modules/init-tabs */ "./js/modules/init-tabs.js"); 157 /* harmony import */ 158 var _modules_switch_on_login_in_modal__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./modules/switch-on-login-in-modal */ "./js/modules/switch-on-login-in-modal.js"); 159 /* harmony import */ 160 var _modules_custom_select__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./modules/custom-select */ "./js/modules/custom-select.js"); 161 /* harmony import */ 162 var _modules_init_form_validate__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./modules/init-form-validate */ "./js/modules/init-form-validate.js"); 163 /* harmony import */ 164 var _modules_init_mobile_menu__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./modules/init-mobile-menu */ "./js/modules/init-mobile-menu.js"); 165 /* harmony import */ 166 var _modules_change_options__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./modules/change-options */ "./js/modules/change-options.js"); 167 /* harmony import */ 168 var _modules_hide_instructions__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./modules/hide-instructions */ "./js/modules/hide-instructions.js"); 169 /* harmony import */ 170 var _modules_custom_input_type_file__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./modules/custom-input-type-file */ "./js/modules/custom-input-type-file.js"); 171 /* harmony import */ 172 var _modules_min_date_in_input__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./modules/min-date-in-input */ "./js/modules/min-date-in-input.js"); 173 /* harmony import */ 174 var _modules_init_accordion__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./modules/init-accordion */ "./js/modules/init-accordion.js"); 175 /* harmony import */ 176 var _modules_init_search_panel__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./modules/init-search-panel */ "./js/modules/init-search-panel.js"); 177 178 // import {ieFix} from './utils/ie-fix'; 179 // import {polyfillObjectFit} from './utils/polyfill-object-fit'; 180 181 182 // --------------------------------- 183 184 window.addEventListener('DOMContentLoaded', function () { 185 // Utils 186 // --------------------------------- 187 // ÑолÑко еÑли ie11 188 // ieFix(); 189 // https://github.com/fregante/object-fit-images 190 // polyfillObjectFit(); 191 Object(_utils_ios_vh_fix__WEBPACK_IMPORTED_MODULE_0__["iosVhFix"])(); 192 Object(_modules_init_search_panel__WEBPACK_IMPORTED_MODULE_4__["initSearchBar"])(); // Modules 193 // --------------------------------- 194 195 Object(_modules_hide_instructions__WEBPACK_IMPORTED_MODULE_8__["initHideInstruction"])(); // вÑе ÑкÑипÑÑ Ð´Ð¾Ð»Ð¶Ð½Ñ Ð±ÑÑÑ Ð² обÑабоÑÑике 'DOMContentLoaded', но не вÑе в 'load' 196 // в load ÑледÑÐµÑ Ð´Ð¾Ð±Ð°Ð²Ð¸ÑÑ ÑкÑипÑÑ, не ÑÑаÑÑвÑÑÑие в ÑабоÑе пеÑвого ÑкÑана 197 198 window.addEventListener('load', function () { 199 Object(_modules_modals_init_modals__WEBPACK_IMPORTED_MODULE_1__["initModals"])(); 200 Object(_modules_init_tabs__WEBPACK_IMPORTED_MODULE_2__["initTabs"])(); 201 Object(_modules_switch_on_login_in_modal__WEBPACK_IMPORTED_MODULE_3__["initSwitchOnLogInModal"])(); 202 Object(_modules_init_mobile_menu__WEBPACK_IMPORTED_MODULE_6__["initMobileMenu"])(); 203 Object(_modules_change_options__WEBPACK_IMPORTED_MODULE_7__["initChangeOption"])();
204 Object(_modules_custom_input_type_file__WEBPACK_IMPORTED_MODULE_9__["initCustomInputTypeFile"])(); 205 Object(_modules_min_date_in_input__WEBPACK_IMPORTED_MODULE_10__["minDate"])(); 206 Object(_modules_init_accordion__WEBPACK_IMPORTED_MODULE_11__["initAccordions"])(); 207 }); 208 }); // --------------------------------- 209 // иÑполÑзÑйÑе .closest(el) 210 // Ð´Ð»Ñ Ð°Ð´Ð°Ð¿Ñивного JS иÑполÑзÑейÑÑÑ matchMedia и addListener 211 // const breakpoint = window.matchMedia(`(min-width:1024px)`); 212 // const breakpointChecker = () => { 213 // if (breakpoint.matches) { 214 // } else { 215 // } 216 // }; 217 // breakpoint.addListener(breakpointChecker); 218 // breakpointChecker(); 219 // пÑивÑзÑвайÑе js не на бÑм, а на data-cookie 220 // вÑноÑим вÑе в data-attr - url до пинов каÑÑÑ, наÑÑÑойки авÑопÑокÑÑÑки, url к json и Ñ.д. 221 222 /***/ 223 }), 224 225
225/***/ "./js/modules/accordions.js": 226 /*!**********************************!*\ 227 !*** ./js/modules/accordions.js ***! 228 \**********************************/ 229 /*! exports provided: Accordions */ 230 /***/ (function (module, __webpack_exports__, __webpack_require__) { 231 232 "use strict"; 233 __webpack_require__.r(__webpack_exports__); 234 /* harmony export (binding) */ 235 __webpack_require__.d(__webpack_exports__, "Accordions", function () { 236 return Accordions; 237 }); 238 239 function _classCallCheck(instance, Constructor) { 240 if (!(instance instanceof Constructor)) { 241 throw new TypeError("Cannot call a class as a function"); 242 } 243 } 244 245 function _defineProperties(target, props) { 246 for (var i = 0; i < props.length; i++) { 247 var descriptor = props[i]; 248 descriptor.enumerable = descriptor.enumerable || false; 249 descriptor.configurable = true; 250 if ("value" in descriptor) descriptor.writable = true; 251 Object.defineProperty(target, descriptor.key, descriptor); 252 } 253 } 254 255 function _createClass(Constructor, protoProps, staticProps) { 256 if (protoProps) _defineProperties(Constructor.prototype, protoProps); 257 if (staticProps) _defineProperties(Constructor, staticProps); 258 return Constructor; 259 } 260 261 var Accordions = /*#__PURE__*/function () { 262 function Accordions() { 263 _classCallCheck(this, Accordions); 264 265 this._openHeight = 0; 266 this._windowWidth = window.innerWidth; 267 this._documentClickHandler = this._documentClickHandler.bind(this); 268 this._windowResizeHandler = this._windowResizeHandler.bind(this); 269 270 this._init(); 271 } 272 273 _createClass(Accordions, [{ 274 key: "_init", 275 value: function _init() { 276 this.fullUpdate(); 277 document.addEventListener('click', this._documentClickHandler); 278 window.addEventListener('resize', this._windowResizeHandler); 279 } 280 }, { 281 key: "_documentClickHandler", 282 value: function _documentClickHandler(evt) { 283 var target = evt.target; 284 285 if (!target.closest('[data-accordion="button"]')) { 286 return; 287 } 288 289 evt.preventDefault(); 290 var element = target.closest('[data-accordion="element"]'); 291 292 if (element.classList.contains('is-active')) { 293 this.closeAccordion(element); 294 return; 295 } 296 297 this.openAccordion(element); 298 } 299 }, { 300 key: "_windowResizeHandler", 301 value: function _windowResizeHandler() { 302 if (this._windowWidth === window.innerWidth) { 303 return; 304 } 305 306 this._windowWidth = window.innerWidth; 307 this.updateAccordionsHeight(); 308 } 309 }, { 310 key: "closeAllAccordion", 311 value: function closeAllAccordion(parent) { 312 var _this = this; 313 314 var elements = parent.querySelectorAll('[data-accordion="element"]'); 315 elements.forEach(function (element) { 316 var currentParent = element.closest('[data-accordion="parent"]'); 317 318 if (currentParent === parent) { 319 _this.closeAccordion(element); 320 } 321 }); 322 } 323 }, { 324 key: "updateAccordionsHeight", 325 value: function updateAccordionsHeight() { 326 var element = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null; 327 328 if (element) { 329 var content = element.querySelector('[data-accordion="content"]');
330 content.style.transition = 'none'; 331 content.style.maxHeight = "".concat(content.scrollHeight, "px"); 332 setTimeout(function () { 333 content.style.transition = null; 334 }); 335 return; 336 } 337 338 var openElements = document.querySelectorAll('[data-accordion="element"].is-active'); 339 openElements.forEach(function (openElement) { 340 var content = openElement.querySelector('[data-accordion="content"]'); 341 content.style.transition = 'none'; 342 content.style.maxHeight = "".concat(content.scrollHeight, "px"); 343 setTimeout(function () { 344 content.style.transition = null; 345 }); 346 }); 347 } 348 }, { 349 key: "fullUpdate", 350 value: function fullUpdate() { 351 var _this2 = this; 352 353 var parent = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null; 354 var transition = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; 355 var openElements; 356 357 if (parent) { 358 openElements = parent.querySelectorAll('[data-accordion="element"].is-active'); 359 } else { 360 openElements = document.querySelectorAll('[data-accordion="element"].is-active'); 361 } 362 363 openElements.forEach(function (openElement) { 364 var innerParent = openElement.querySelector('[data-accordion="parent"]'); 365 366 if (innerParent) { 367 return; 368 } 369 370 _this2.openAccordion(openElement, transition); 371 }); 372 } 373 }, { 374 key: "openAccordion", 375 value: function openAccordion(element) { 376 var transition = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; 377 var parentElement = element.closest('[data-accordion="parent"]'); 378 var contentElement = element.querySelector('[data-accordion="content"]'); 379 this._openHeight += contentElement.scrollHeight; 380 381 if (parentElement.hasAttribute('data-single')) { 382 this.closeAllAccordion(parentElement); 383 } 384 385 element.classList.add('is-active'); 386 387 if (transition) { 388 contentElement.style.maxHeight = "".concat(this._openHeight, "px"); 389 } else { 390 contentElement.style.transition = 'none'; 391 contentElement.style.maxHeight = "".concat(this._openHeight, "px"); 392 setTimeout(function () { 393 contentElement.style.transition = null; 394 }); 395 } 396 397 if (parentElement.closest('[data-accordion="element"]')) { 398 this.openAccordion(parentElement.closest('[data-accordion="element"]'), transition); 399 return; 400 } 401 402 this._openHeight = 0; 403 } 404 }, { 405 key: "closeAccordion", 406 value: function closeAccordion(element) { 407 var transition = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; 408 var contentElement = element.querySelector('[data-accordion="content"]'); 409 410 if (!contentElement) { 411 return; 412 } 413 414 element.classList.remove('is-active'); 415 416 if (transition) { 417 contentElement.style.maxHeight = '0'; 418 } else {
419 contentElement.style.transition = 'none'; 420 contentElement.style.maxHeight = '0'; 421 setTimeout(function () { 422 contentElement.style.transition = null; 423 }); 424 } 425 } 426 }]); 427 428 return Accordions; 429 }(); 430 431 /***/ 432 }), 433 434 435
435/***/ "./js/modules/change-options.js": 436 /*!**************************************!*\ 437 !*** ./js/modules/change-options.js ***! 438 \**************************************/ 439 /*! exports provided: initChangeOption */ 440 /***/ (function (module, __webpack_exports__, __webpack_require__) { 441 442 "use strict"; 443 __webpack_require__.r(__webpack_exports__); 444 /* harmony export (binding) */ 445 __webpack_require__.d(__webpack_exports__, "initChangeOption", function () { 446 return initChangeOption; 447 }); 448 // изменение конÑенÑа опÑенов в завиÑимоÑÑи Ð¾Ñ Ð²ÑбÑанного вида живоÑного в модалке на ÑÑÑаниÑе пÑогÑÐ°Ð¼Ð¼Ñ Ð»Ð¾ÑлÑноÑÑи Ð´Ð»Ñ Ð²ÐµÑеÑинаÑов - наÑало - 449 var initChangeOption = function initChangeOption() { 450 var recForm = document.querySelector('.recommendations__form'); 451 if (recForm) { 452 var petTypeSelect = recForm.querySelector('.pet-type'); 453 var petTypeSelectOptions = petTypeSelect.querySelectorAll('[data-value]'); 454 var recFoodSelect = recForm.querySelector('.rec-food'); 455 var recFoodSelectOptions = recFoodSelect.querySelectorAll('[data-value]'); 456 if (!recFoodSelect.classList.contains('pointer-events-none')) { 457 recFoodSelect.classList.add('pointer-events-none'); 458 } 459 recFoodSelectOptions.forEach(function (item) { 460 item.classList.add('_hidden'); 461 petTypeSelectOptions.forEach(function (option) { 462 option.addEventListener('click', function (e) { 463 recFoodSelect.classList.remove('pointer-events-none'); 464 recFoodSelect.classList.add('pointer-events-all'); 465 var target = e.target; 466 467 if (target.dataset.value === 'cat') { 468 showOrHideOptions('for-cats'); 469 } 470 471 if (target.dataset.value === 'dog') { 472 showOrHideOptions('for-dogs'); 473 } 474 }); 475 }); 476 477 var showOrHideOptions = function showOrHideOptions(dataValue) { 478 item.classList.add('_hidden'); 479 item.classList.remove('_show'); 480 481 if (item.dataset.value === dataValue) { 482 item.classList.remove('_hidden'); 483 item.classList.add('_show'); 484 } 485 }; 486 }); 487 } 488 }; 489 490 // изменение конÑенÑа опÑенов в завиÑимоÑÑи Ð¾Ñ Ð²ÑбÑанного вида живоÑного в модалке на ÑÑÑаниÑе пÑогÑÐ°Ð¼Ð¼Ñ Ð»Ð¾ÑлÑноÑÑи Ð´Ð»Ñ Ð²ÐµÑеÑинаÑов - ÐºÐ¾Ð½ÐµÑ - 491 492 /***/ 493 }), 494 495
495/***/ "./js/modules/custom-input-type-file.js": 496 /*!**********************************************!*\ 497 !*** ./js/modules/custom-input-type-file.js ***! 498 \**********************************************/ 499 /*! exports provided: initCustomInputTypeFile */ 500 /***/ (function (module, __webpack_exports__, __webpack_require__) { 501 502 "use strict"; 503 __webpack_require__.r(__webpack_exports__); 504 /* harmony export (binding) */ 505 __webpack_require__.d(__webpack_exports__, "initCustomInputTypeFile", function () { 506 return initCustomInputTypeFile; 507 }); 508 // ÐаÑÑомнÑй инпÑÑ type file - наÑало - 509 var initCustomInputTypeFile = function initCustomInputTypeFile() { 510 var inputs = document.querySelectorAll('.input-type-file'); 511 inputs.forEach(function (input) { 512 // var label = input.nextElementSibling; 513 var label = input.closest('.input-type-file-label'); 514 var labelVal = label.querySelector('span').innerText; 515 var delBtn = label.nextElementSibling; 516 var filePreviewBlock = document.querySelector('.report__form-preview'); 517 input.addEventListener('change', function (e) { 518 var countFiles = ''; 519 if (this.files && this.files.length >= 1) { 520 countFiles = this.files.length; 521 delBtn.classList.remove('is-hidden') 522 if (filePreviewBlock) { 523 delBtn.classList.add('is-hidden') 524 countFiles = ''; 525 label.querySelector('span').innerText = 'ÐагÑÑзиÑÑ ÑоÑогÑаÑии'; 526 uploadFilePreview(input.files); 527 } 528 } 529 530 if (countFiles) { 531 label.querySelector('span').innerText = 'ÐагÑÑжено Ñайлов: ' + countFiles; 532 533 } else if (countFiles = '') { 534 label.querySelector('span').innerText = labelVal; 535 } 536 document.addEventListener('click', function (e) { 537 if (e.target === delBtn) { 538 countFiles = ''; 539 label.querySelector('span').innerText = 'ÐагÑÑзиÑÑ'; 540 input.value = ''; 541 input.closest('.custom-input').classList.remove('is-valid') 542 } 543 }) 544 }); 545 function uploadFilePreview(files) { 546 for (var i = 0; i < files.length; i++) { 547 var file = files[i]; 548 if (!['image/jpeg', 'image/png', 'image/gif'].includes(file.type)) { 549 alert('РазÑеÑÐµÐ½Ñ ÑолÑко изобÑажениÑ!'); 550 label.querySelector('span').innerText = 'ÐагÑÑзиÑÑ ÑоÑогÑаÑии'; 551 input.value = ''; 552 553 return; 554 } 555 if (file.size > 5 * 1024 * 1024) { 556 alert('Файл должен бÑÑÑ Ð¼ÐµÐ½ÑÑе 5 ÐÐ!'); 557 label.querySelector('span').innerText = 'ÐагÑÑзиÑÑ ÑоÑогÑаÑии'; 558 input.value = ''; 559 return; 560 } 561 var reader = new FileReader(); 562 reader.onload = function (e) { 563 filePreviewBlock.insertAdjacentHTML('beforeend', `<div class="report__form-preview-item"><img src="${e.target.result}" alt="ФоÑо"><span class="btn btn--reset preview-remove-btn">x</span></div>`); 564 filePreviewBlock.addEventListener('click', function (e) { 565 if(e.target.classList.contains('preview-remove-btn')) { 566 var fileToBeDeleted = e.target.closest('.report__form-preview-item'); 567 setTimeout(() => fileToBeDeleted.remove(), 500); 568 569 if (e.target.closest('.report__form').querySelector('.report__form-input').value = '') { 570 e.target.closest('.report__form').querySelector('.custom-input').classList.remove('is-valid'); 571 } 572 573 console.log('file removed'); 574 } 575 }) 576 } 577 reader.onerror = function () { 578 alert('ÐÑоизоÑла оÑибка пÑи загÑÑзке Ñайла. ÐопÑобÑйÑе еÑе Ñаз'); 579 }
580 reader.readAsDataURL(file); 581 } 582 } 583 }); 584 }; 585 586 // ÐаÑÑомнÑй инпÑÑ type file - ÐºÐ¾Ð½ÐµÑ - 587 588 /***/ 589 }), 590 591
591/***/ "./js/modules/custom-select.js": 592 /*!*************************************!*\ 593 !*** ./js/modules/custom-select.js ***! 594 \*************************************/ 595 /*! exports provided: default */ 596 /***/ (function (module, __webpack_exports__, __webpack_require__) { 597 598 "use strict"; 599 __webpack_require__.r(__webpack_exports__); 600 601 function _classCallCheck(instance, Constructor) { 602 if (!(instance instanceof Constructor)) { 603 throw new TypeError("Cannot call a class as a function"); 604 } 605 } 606 607 function _defineProperties(target, props) { 608 for (var i = 0; i < props.length; i++) { 609 var descriptor = props[i]; 610 descriptor.enumerable = descriptor.enumerable || false; 611 descriptor.configurable = true; 612 if ("value" in descriptor) descriptor.writable = true; 613 Object.defineProperty(target, descriptor.key, descriptor); 614 } 615 } 616 617 function _createClass(Constructor, protoProps, staticProps) { 618 if (protoProps) _defineProperties(Constructor.prototype, protoProps); 619 if (staticProps) _defineProperties(Constructor, staticProps); 620 return Constructor; 621 } 622 623 // ФÑнкÑии ÑÐ¾Ð·Ð´Ð°Ð½Ð¸Ñ ÑазмеÑки и ÑендеÑа наÑивного ÑелекÑа 624 var createElement = function createElement(template) { 625 var newElement = document.createElement('div'); 626 newElement.innerHTML = template; 627 return newElement.firstChild; 628 }; 629 630 var renderElement = function renderElement(container, component) { 631 var place = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'beforeend'; 632 633 switch (place) { 634 case 'prepend': 635 container.prepend(component); 636 break; 637 638 case 'afterend': 639 container.after(component); 640 break; 641 642 case 'beforeend': 643 container.append(component); 644 break; 645 } 646 }; 647 648 var createNativeOptionsMarkup = function createNativeOptionsMarkup(items, activeIndex) { 649 return items.map(function (el, index) { 650 if (activeIndex.length) { 651 var currentIndex = activeIndex.find(function (item) { 652 return item === index; 653 }); 654 655 if (currentIndex === index) { 656 return "<option ".concat(el.value ? "value=".concat(el.value) : '', " selected>").concat(el.text ? "".concat(el.text) : '', "</option>"); 657 } else { 658 return "<option ".concat(el.value ? "value=".concat(el.value) : '', ">").concat(el.text ? "".concat(el.text) : '', "</option>"); 659 } 660 } else { 661 return "<option ".concat(el.value ? "value=".concat(el.value) : '', ">").concat(el.text ? "".concat(el.text) : '', "</option>"); 662 } 663 }).join('\n'); 664 }; 665 666 var createNativeSelectMarkup = function createNativeSelectMarkup(_ref) { 667 var id = _ref.id, 668 items = _ref.items, 669 multiple = _ref.multiple, 670 name = _ref.name, 671 required = _ref.required, 672 _ref$activeIndex = _ref.activeIndex, 673 activeIndex = _ref$activeIndex === void 0 ? [] : _ref$activeIndex; 674 return "<select ".concat(id ? "id='".concat(id, "'") : '', " ").concat(name ? "name='".concat(name, "'") : '', " ").concat(multiple ? 'multiple' : '', " ").concat(required ? 'required' : '', " tabindex=\"-1\" aria-hidden=\"true\">\n <option value=\"\"></option>\n ").concat(createNativeOptionsMarkup(items, activeIndex), "\n </select>"); 675 }; // ФÑнкÑÐ¸Ñ ÑаÑÑÑановки акÑивнÑÑ ÑоÑÑоÑний Ñ li по ÑмолÑÐ°Ð½Ð¸Ñ 676 677 678 var setActiveState = function setActiveState(multiple, selectItems) { 679 var flag = true; 680 var activeIndex = [];
681 selectItems.forEach(function (item, index) { 682 if (multiple) { 683 if (item.getAttribute('aria-selected') === 'true') { 684 activeIndex.push(index); 685 } 686 } else { 687 if (item.getAttribute('aria-selected') === 'true' && flag) { 688 activeIndex.push(index); 689 flag = false; 690 } else { 691 item.setAttribute('aria-selected', 'false'); 692 } 693 } 694 }); 695 return activeIndex; 696 }; // ФоÑмиÑование ÑÑÑоки Ð´Ð»Ñ Ð¼ÑлÑÑиÑелекÑа 697 698 699 var createMultiString = function createMultiString(arr) { 700 var str = ''; 701 702 if (arr.length) { 703 if (arr.length === 1) { 704 str = arr[0].innerHTML; 705 } else { 706 arr.forEach(function (el, index) { 707 if (index === arr.length - 1) { 708 str += el.innerHTML; 709 } else { 710 str += "".concat(el.innerHTML, ", "); 711 } 712 }); 713 } 714 } 715 716 return str; 717 }; // ФÑнкÑÐ¸Ñ ÑаÑÑÑановки акÑивнÑÑ ÑоÑÑоÑний Ñ li по ÑмолÑÐ°Ð½Ð¸Ñ 718 719 720 var setSelectActiveState = function setSelectActiveState(multiple, insert, item) { 721 var buttonTextBlock = item.querySelector('.custom-select__text'); 722 var activeItems = item.querySelectorAll('.custom-select__item[aria-selected="true"]'); 723 var label = item.querySelector('.custom-select__label'); 724 var str = createMultiString(activeItems); 725 buttonTextBlock.style.transition = '0s'; 726 label.style.transition = '0s'; 727 setTimeout(function () { 728 label.style.transition = null; 729 buttonTextBlock.style.transition = null; 730 }, 300); 731 732 if (multiple && insert) { 733 item.classList.add('not-empty'); 734 buttonTextBlock.innerHTML = str; 735 } else if (multiple) { 736 return; 737 } else { 738 item.classList.add('not-empty'); 739 buttonTextBlock.innerHTML = activeItems[0].innerHTML; 740 } 741 }; // ФÑнкÑÐ¸Ñ ÑÐ¾Ð·Ð´Ð°Ð½Ð¸Ñ ÑÑÑÑкÑÑÑÑ ÑелекÑа, поÑле ÑÐ¾Ð·Ð´Ð°Ð½Ð¸Ñ ÑелекÑа она ÑÑÐ°Ð·Ñ ÐµÐ³Ð¾ ÑендеÑÐ¸Ñ 742 743 744 var createSelectStructure = function createSelectStructure(item) { 745 var options = {}; 746 options.items = []; 747 var multiple = item.dataset.multiple; 748 var id = item.dataset.id; 749 var name = item.dataset.name; 750 var required = item.dataset.required; 751 var insert = item.dataset.insert; 752 var selectItems = item.querySelectorAll('.custom-select__item'); 753 var activeIndex = setActiveState(multiple, selectItems); 754 755 if (activeIndex.length) { 756 options.activeIndex = activeIndex; 757 setSelectActiveState(multiple, insert, item); 758 } 759 760 options.name = name || false; 761 options.id = id || false; 762 options.required = Boolean(required); 763 options.multiple = Boolean(multiple); 764 selectItems.forEach(function (selectItem) { 765 var value = selectItem.dataset.selectValue; 766 var itemInfo = {}; 767 itemInfo.text = selectItem.innerText; 768 itemInfo.value = value; 769 options.items.push(itemInfo); 770 }); 771 renderElement(item, createElement(createNativeSelectMarkup(options))); 772 return item; 773 }; // ÐакÑÑÑие ÑелекÑа 774 775 776 var closeSelect = function closeSelect() { 777 var activeSelect = document.querySelector('[data-select].is-open'); 778 document.removeEventListener('click', onDocumentClick); 779 document.removeEventListener('keydown', onEscapePress); 780 781 if (activeSelect) { 782 activeSelect.classList.remove('is-open'); 783 } 784 }; // ÐейÑÑÐ²Ð¸Ñ Ð¿Ñи клике на ÑÐ»ÐµÐ¼ÐµÐ½Ñ ÑпиÑка 785 786 787 var clickAction = function clickAction(el, index) { 788 var parent = el.closest('.custom-select'); 789 var multiple = parent.dataset.multiple; 790 var insert = parent.dataset.insert; 791 var buttonTextBlock = parent.querySelector('.custom-select__text'); 792 var itemText = el.innerText; 793 var options = parent.querySelectorAll('option'); 794 var select = parent.querySelector('select'); 795 var changeEv = new CustomEvent('change'); 796 var inputEv = new CustomEvent('input'); 797 select.dispatchEvent(changeEv); 798 select.dispatchEvent(inputEv); 799 var form = select.closest('form'); 800 801 if (form) { 802 var formChangeEv = new CustomEvent('change'); 803 var formInputEv = new CustomEvent('input'); 804 form.dispatchEvent(formChangeEv); 805 form.dispatchEvent(formInputEv); 806 } 807 808 if (multiple) { 809 if (insert === 'true') { 810 if (el.getAttribute('aria-selected') === 'true') { 811 el.setAttribute('aria-selected', 'false'); 812 var activeItems = parent.querySelectorAll('.custom-select__item[aria-selected="true"]'); 813 var str = createMultiString(activeItems); 814 options[index + 1].selected = false; 815 buttonTextBlock.innerText = str; 816 817 if (!str) { 818 parent.classList.remove('not-empty'); 819 parent.classList.remove('is-valid'); 820 } 821 } else { 822 el.setAttribute('aria-selected', 'true'); 823 824 var _activeItems = parent.querySelectorAll('.custom-select__item[aria-selected="true"]'); 825 826 var _str = createMultiString(_activeItems); 827 828 buttonTextBlock.innerText = _str; 829 parent.classList.add('not-empty'); 830 parent.classList.add('is-valid'); 831 options[index + 1].selected = true; 832 } 833 } else { 834 if (el.getAttribute('aria-selected') === 'true') { 835 el.setAttribute('aria-selected', 'false'); 836 options[index + 1].selected = false; 837 } else { 838 el.setAttribute('aria-selected', 'true'); 839 options[index + 1].selected = true; 840 } 841 } 842 } else { 843 var activeItem = parent.querySelector('.custom-select__item[aria-selected="true"]'); 844 845 if (el.getAttribute('aria-selected') === 'true') { 846 closeSelect(); 847 } else { 848 if (activeItem) { 849 activeItem.setAttribute('aria-selected', 'false'); 850 parent.classList.remove('not-empty'); 851 parent.classList.remove('is-valid'); 852 } 853 854 buttonTextBlock.innerText = itemText; 855 el.setAttribute('aria-selected', 'true'); 856 parent.classList.add('not-empty'); 857 parent.classList.add('is-valid'); 858 options[index + 1].selected = true; 859 closeSelect(); 860 } 861 } 862 }; // ÐбÑабоÑÑики ÑобÑÑий 863 864 865 var onDocumentClick = function onDocumentClick(_ref2) { 866 var target = _ref2.target; 867 868 if (!target.closest('.custom-select')) { 869 closeSelect(); 870 } 871 }; 872 873 var onEscapePress = function onEscapePress(e) { 874 var isEscape = e.key === 'Escape'; 875 876 if (isEscape) { 877 closeSelect(); 878 } 879 }; 880 881 var onItemClick = function onItemClick(el, index) { 882 clickAction(el, index); 883 }; 884 885 var onItemKeydown = function onItemKeydown(e, el, index) { 886 var isEnter = e.key === 'Enter'; 887 888 if (isEnter) { 889 clickAction(el, index); 890 } 891 }; 892 893 var onLastItemKeydown = function onLastItemKeydown(e) { 894 var isTab = e.key === 'Tab'; 895 896 if (isTab) { 897 closeSelect(); 898 } 899 }; 900 901 var onSelectClick = function onSelectClick(e) { 902 var parent = e.target.closest('[data-select]'); 903 var activeSelect = document.querySelector('[data-select].is-open'); 904 parent.classList.remove('is-invalid'); 905 906 if (activeSelect && activeSelect === parent) { 907 activeSelect.classList.remove('is-open'); 908 return; 909 } 910 911 if (activeSelect) { 912 closeSelect(); 913 } 914 915 document.addEventListener('click', onDocumentClick); 916 document.addEventListener('keydown', onEscapePress); 917 918 if (parent.classList.contains('is-open')) { 919 parent.classList.remove('is-open'); 920 } else { 921 parent.classList.add('is-open'); 922 } 923 }; 924 925 var onSelectKeydown = function onSelectKeydown(e) { 926 var parent = e.target.closest('[data-select]'); 927 parent.classList.remove('is-invalid'); 928 929 if (e.shiftKey && e.key === 'Tab' && parent.closest('.is-open')) { 930 closeSelect(); 931 } 932 }; // ÐÑе дейÑÑÐ²Ð¸Ñ Ñ ÑелекÑом 933 934 935 var setSelectAction = function setSelectAction(item) { 936 var customSelect = item; 937 var button = customSelect.querySelector('.custom-select__button'); 938 var selectItems = customSelect.querySelectorAll('.custom-select__item'); 939 button.addEventListener('click', onSelectClick); 940 button.addEventListener('keydown', onSelectKeydown);
941 selectItems.forEach(function (el, index) { 942 el.addEventListener('click', function () { 943 onItemClick(el, index); 944 }); 945 el.addEventListener('keydown', function (e) { 946 onItemKeydown(e, el, index); 947 }); 948 949 if (index === selectItems.length - 1) { 950 el.addEventListener('keydown', onLastItemKeydown); 951 } 952 }); 953 }; // ÐлаÑÑ CustomSelect 954 955 956 var CustomSelect = /*#__PURE__*/function () { 957 function CustomSelect() { 958 _classCallCheck(this, CustomSelect); 959 960 window.selectInit = this.init.bind(this); 961 } 962 963 _createClass(CustomSelect, [{ 964 key: "setAction", 965 value: function setAction(item) { 966 setSelectAction(item); 967 } 968 }, { 969 key: "createSelect", 970 value: function createSelect(item) { 971 createSelectStructure(item); 972 return item; 973 } 974 }, { 975 key: "initSelects", 976 value: function initSelects() { 977 var _this = this; 978 979 var selects = document.querySelectorAll('[data-select]'); 980 981 if (selects.length) { 982 selects.forEach(function (select) { 983 if (!select.classList.contains('is-initialized')) { 984 var newSelect = _this.createSelect(select); 985 986 _this.setAction(newSelect); 987 988 select.classList.add('is-initialized'); 989 } 990 }); 991 } 992 } 993 }, { 994 key: "init", 995 value: function init() { 996 this.initSelects(); 997 } 998 }]); 999 1000 return CustomSelect; 1001 }(); 1002 1003 var select = new CustomSelect(); 1004 /* harmony default export */ 1005 __webpack_exports__["default"] = (select.init()); 1006 1007 /***/ 1008 }), 1009 1010 1011 1012 1013 1014
1014/***/ "./js/modules/form-validate.js": 1015 /*!*************************************!*\ 1016 !*** ./js/modules/form-validate.js ***! 1017 \*************************************/ 1018 /*! exports provided: default */ 1019 /***/ (function (module, __webpack_exports__, __webpack_require__) { 1020 1021 "use strict"; 1022 __webpack_require__.r(__webpack_exports__); 1023 /* harmony export (binding) */ 1024 __webpack_require__.d(__webpack_exports__, "default", function () { 1025 return FormsValidate; 1026 }); 1027 1028 function _classCallCheck(instance, Constructor) { 1029 if (!(instance instanceof Constructor)) { 1030 throw new TypeError("Cannot call a class as a function"); 1031 } 1032 } 1033 1034 function _defineProperties(target, props) { 1035 for (var i = 0; i < props.length; i++) { 1036 var descriptor = props[i]; 1037 descriptor.enumerable = descriptor.enumerable || false; 1038 descriptor.configurable = true; 1039 if ("value" in descriptor) descriptor.writable = true; 1040 Object.defineProperty(target, descriptor.key, descriptor); 1041 } 1042 } 1043 1044 function _createClass(Constructor, protoProps, staticProps) { 1045 if (protoProps) _defineProperties(Constructor.prototype, protoProps); 1046 if (staticProps) _defineProperties(Constructor, staticProps); 1047 return Constructor; 1048 } 1049 1050 // ÐонÑÑанÑÑ Ð¸ пеÑеменнÑе 1051 var BASE_COUNTRY_CODE = '+7'; 1052 var BASE_MATRIX = '(___) ___ __ __'; 1053 var phoneLength = BASE_COUNTRY_CODE.length + BASE_MATRIX.length; // ÐгÑаниÑÐµÐ½Ð¸Ñ Ð²Ð²Ð¾Ð´Ð° Ð´Ð»Ñ Ð¾Ð±ÑÑнÑÑ Ð¿Ð¾Ð»ÐµÐ¹ 1054 1055 var returnLimitationsRegEx = function returnLimitationsRegEx(dataLimitations) { 1056 switch (dataLimitations) { 1057 case 'digit': 1058 return /[^\d]/g; 1059 1060 case 'letters': 1061 return /[^a-zA-Zа-ÑÑÐ-ЯÐ\s]/g; 1062 1063 case 'letters-and-digit': 1064 return /[^a-zA-Zа-ÑÑÐ-ЯÐ\s\d]/g; 1065 1066 case 'cyrillic': 1067 return /[^а-ÑÑÐ-ЯÐ\s]/g; 1068 1069 case 'latin': 1070 return /[^a-zA-Z\s]/g; 1071 1072 default: 1073 return false; 1074 } 1075 }; 1076 1077 var simpleLimitations = function simpleLimitations(formElement, dataLimitations) { 1078 var RegEx = returnLimitationsRegEx(dataLimitations); 1079 1080 if (RegEx) { 1081 formElement.addEventListener('input', function () { 1082 formElement.value = formElement.value.replace(RegEx, ''); 1083 }); 1084 } else { 1085 // eslint-disable-next-line no-console 1086 console.error("\u041F\u0435\u0440\u0435\u0434\u0430\u043D\u043D\u044B\u0439 \u0444\u043E\u0440\u043C\u0430\u0442 \u043E\u0433\u0440\u0430\u043D\u0438\u0447\u0435\u043D\u0438\u044F: ".concat(dataLimitations, ", \u043D\u0435 \u043F\u043E\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044F. \u041F\u0440\u043E\u0432\u0435\u0440\u044C\u0442\u0435 \u043A\u043E\u0440\u0440\u0435\u043A\u0442\u043D\u043E\u0441\u0442\u044C \u0432\u0432\u0435\u0434\u0451\u043D\u043D\u044B\u0445 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0439 \u0432 \u0441\u043E\u043E\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0438 \u0441\u043E \u0441\u043F\u0435\u0446\u0438\u0444\u0438\u043A\u0430\u0446\u0438\u0435\u0439.")); 1087 } 1088 }; // ÐгÑаниÑÐµÐ½Ð¸Ñ Ð²Ð²Ð¾Ð´Ð° Ð´Ð»Ñ Ð¾Ð±ÑÑнÑÑ Ð¿Ð¾Ð»ÐµÐ¹ Ñ Ð¼Ð°ÑÑиÑей 1089 1090 1091 var returnMatrixLimitationsRegEx = function returnMatrixLimitationsRegEx(dataMatrixLimitations) { 1092 switch (dataMatrixLimitations) { 1093 case 'digit': 1094 return /[^\d]/g; 1095 1096 case 'letters': 1097 return /[^\а-ÑÑ\Ð-ЯÐ\a-z\A-Z]/g; 1098 1099 case 'letters-and-digit': 1100 return /[^\а-ÑÑ\Ð-ЯÐ\a-z\A-Z\d]/g; 1101 1102 case 'cyrillic': 1103 return /[^\а-ÑÑ\Ð-ЯÐ]/g; 1104 1105 case 'latin': 1106 return /[^\a-z\A-Z]/g; 1107 1108 default: 1109 return false; 1110 } 1111 }; 1112 1113 var initMatrixReplace = function initMatrixReplace(target, matrix, RegEx) { 1114 var def = matrix.replace(RegEx, ''); 1115 var val = target.value.replace(RegEx, ''); 1116 var i = 0; 1117 1118 if (def.length >= val.length) { 1119 val = def; 1120 } 1121 1122 target.value = matrix.replace(/./g, function (a) { 1123 if (/[_\^]/.test(a) && i < val.length) { 1124 return val.charAt(i++); 1125 } else if (i >= val.length) { 1126 return ''; 1127 } else { 1128 return a; 1129 } 1130 }); 1131 }; 1132 1133 var simpleMatrix = function simpleMatrix(formElement, dataMatrix, dataMatrixLimitations) { 1134 if (dataMatrixLimitations === null) { 1135 // eslint-disable-next-line no-console 1136 console.error('ÐÑи валидаÑии по маÑÑиÑе обÑзаÑелÑно Ñказ
1136ÑваÑÑ ÑоÑÐ¼Ð°Ñ Ð¾Ð³ÑаниÑений: data-matrix-limitations=""'); 1137 return; 1138 } 1139 1140 var RegEx = returnMatrixLimitationsRegEx(dataMatrixLimitations); 1141 1142 if (RegEx) { 1143 formElement.addEventListener('input', function () { 1144 initMatrixReplace(formElement, dataMatrix, RegEx); 1145 }); 1146 } else { 1147 // eslint-disable-next-line no-console 1148 console.error("\u041F\u0435\u0440\u0435\u0434\u0430\u043D\u043D\u044B\u0439 \u0444\u043E\u0440\u043C\u0430\u0442 \u043E\u0433\u0440\u0430\u043D\u0438\u0447\u0435\u043D\u0438\u044F: ".concat(dataMatrixLimitations, ", \u043D\u0435 \u043F\u043E\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044F. \u041F\u0440\u043E\u0432\u0435\u0440\u044C\u0442\u0435 \u043A\u043E\u0440\u0440\u0435\u043A\u0442\u043D\u043E\u0441\u0442\u044C \u0432\u0432\u0435\u0434\u0451\u043D\u043D\u044B\u0445 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0439 \u0432 \u0441\u043E\u043E\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0438 \u0441\u043E \u0441\u043F\u0435\u0446\u0438\u0444\u0438\u043A\u0430\u0446\u0438\u0435\u0439.")); 1149 } 1150 }; // ÐаÑка Ð´Ð»Ñ ÑелеÑона 1151 1152 1153 var onInputPhoneInput = function onInputPhoneInput(_ref) { 1154 var target = _ref.target; 1155 var matrix = "".concat(BASE_COUNTRY_CODE).concat(BASE_MATRIX); 1156 var def = matrix.replace(/\D/g, ''); 1157 var i = 0; 1158 var val = target.value.replace(/\D/g, ''); 1159 1160 if (def.length >= val.length) { 1161 val = def; 1162 } 1163 1164 target.value = matrix.replace(/./g, function (a) { 1165 if (/[_\d]/.test(a) && i < val.length) { 1166 return val.charAt(i++); 1167 } else if (i >= val.length) { 1168 return ''; 1169 } else { 1170 return a; 1171 } 1172 }); 1173 }; 1174 1175 var prettifyPhoneInput = function prettifyPhoneInput(input) { 1176 if (!input.value.startsWith(BASE_COUNTRY_CODE)) { 1177 if (input.value.startsWith('8')) { 1178 input.value = input.value.replace('8', BASE_COUNTRY_CODE); 1179 } else { 1180 input.value = "".concat(BASE_COUNTRY_CODE).concat(input.value); 1181 } 1182 } // onInputPhoneInput({input}); 1183 1184 1185 var matrix = "".concat(BASE_COUNTRY_CODE).concat(BASE_MATRIX); 1186 var def = matrix.replace(/\D/g, ''); 1187 var i = 0; 1188 var val = input.value.replace(/\D/g, ''); 1189 1190 if (def.length >= val.length) { 1191 val = def; 1192 } 1193 1194 input.value = matrix.replace(/./g, function (a) { 1195 if (/[_\d]/.test(a) && i < val.length) { 1196 return val.charAt(i++); 1197 } else if (i >= val.length) { 1198 return ''; 1199 } else { 1200 return a; 1201 } 1202 }); 1203 }; 1204 1205 var onFocusPhoneInput = function onFocusPhoneInput(_ref2) { 1206 var target = _ref2.target; 1207 1208 if (!target.value) { 1209 target.value = BASE_COUNTRY_CODE; 1210 } 1211 1212 target.addEventListener('input', onInputPhoneInput); 1213 target.addEventListener('blur', onBlurPhoneInput); 1214 target.addEventListener('keydown', onKeydownPhoneInput); 1215 }; 1216 1217 var onKeydownPhoneInput = function onKeydownPhoneInput(e) { 1218 if (e.target.selectionStart === 1 && e.keyCode === 8 || e.keyCode === 46) { 1219 e.preventDefault(); 1220 } 1221 1222 if (e.target.selectionStart <= phoneLength && e.keyCode !== 8 && e.keyCode !== 46 && e.keyCode !== 37 && e.keyCode !== 39) { 1223 e.target.setSelectionRange(phoneLength, phoneLength); 1224 } 1225 }; 1226 1227 var onBlurPhoneInput = function onBlurPhoneInput(_ref3) { 1228 var target = _ref3.target; 1229 1230 if (target.value === BASE_COUNTRY_CODE) { 1231 var parent = target.closest('[data-validate-type="phone"]'); 1232 target.value = ''; 1233 parent.classList.remove('not-empty'); 1234 target.removeEventListener('input', onInputPhoneInput); 1235 target.removeEventListener('blur', onBlurPhoneInput); 1236 } 1237 }; // Ðоказ оÑибок полей ÑоÑм 1238 1239 1240 var hideError = function hideError(el) { 1241 if (el.classList.contains('toggle-group')) { 1242 validateToggleGroup(el); 1243 el.classList.remove('is-invalid'); 1244 el.classList.add('is-valid'); 1245 } else { 1246 var parent = el.closest('[data-validate-type]'); 1247 el.setAttribute('aria-invalid', 'false'); 1248 parent.classList.remove('is-invalid'); 1249 parent.classList.add('is-valid'); 1250 } 1251 }; 1252 1253 var showError = function showError(el) { 1254 if (el.classList.contains('toggle-group')) { 1255 validateToggleGroup(el); 1256 el.classList.add('is-invalid'); 1257 el.classList.remove('is-valid'); 1258 } else { 1259 var parent = el.closest('[data-validate-type]'); 1260 el.setAttribute('aria-invalid', 'true'); 1261 parent.classList.add('is-invalid'); 1262 parent.classList.remove('is-valid'); 1263 } 1264 }; 1265 1266 var showInputsError = function showInputsError(inputs) { 1267 var flag = true; 1268 var result = true;
1269 inputs.forEach(function (input) { 1270 var type = input.closest('[data-validate-type]').dataset.validateType; 1271 1272 if (type === 'toggle-group') { 1273 return; 1274 } 1275 1276 flag = validateInputs(type, input); 1277 1278 if (!flag) { 1279 result = flag; 1280 showError(input); 1281 } else { 1282 hideError(input); 1283 } 1284 }); 1285 return result; 1286 }; 1287 1288 var showGroupInputsError = function showGroupInputsError(parents) { 1289 var flag = true; 1290 var result = true; 1291 1292 if (!parents.length) { 1293 return result; 1294 } 1295 1296 parents.forEach(function (parent) { 1297 flag = validateToggleGroup(parent); 1298 1299 if (!flag) { 1300 result = flag; 1301 showError(parent); 1302 } else { 1303 hideError(parent); 1304 } 1305 }); 1306 return result; 1307 }; 1308 1309 var showErrors = function showErrors(inputs, parents) { 1310 var result = true; 1311 var inputsResult = showInputsError(inputs); 1312 var groupResult = showGroupInputsError(parents); 1313 1314 if (!inputsResult || !groupResult) { 1315 result = false; 1316 } 1317 1318 return result; 1319 }; // ÐалидаÑÐ¸Ñ Ð¿Ð¾Ð»ÐµÐ¹ ÑоÑм 1320 1321 1322 var validateTextInput = function validateTextInput(input) { 1323 var parent = input.closest('[data-validate-type]'); 1324 parent.classList.remove('is-invalid'); 1325 var flag = true; 1326 var minLength = +input.getAttribute('minlength'); 1327 1328 if (!minLength) { 1329 minLength = 1; 1330 } 1331 1332 if (input.value.length >= minLength) { 1333 parent.classList.add('is-valid'); 1334 } else { 1335 parent.classList.remove('is-valid'); 1336 flag = false; 1337 } 1338 1339 return flag; 1340 }; 1341 1342 var validatePhoneInput = function validatePhoneInput(input) { 1343 var parent = input.closest('[data-validate-type]'); 1344 parent.classList.remove('is-invalid'); 1345 var flag = true; 1346 1347 if (input.value.length >= phoneLength) { 1348 parent.classList.add('is-valid'); 1349 } else { 1350 parent.classList.remove('is-valid'); 1351 flag = false; 1352 } 1353 1354 return flag; 1355 }; 1356 1357 var validateEmailInput = function validateEmailInput(input) { 1358 var parent = input.closest('[data-validate-type]'); 1359 parent.classList.remove('is-invalid'); 1360 var flag = true; 1361 var emailString = /[a-zA-Zа-ÑÑÐ-ЯÐ0-9]{1}([a-zA-Zа-ÑÑÐ-ЯÐ0-9\-_\.]{1,})?@[a-zA-Zа-ÑÑÐ-ЯÐ0-9\-]{1}([a-zA-Zа-ÑÑÐ-ЯÐ0-9.\-]{1,})?[a-zA-Zа-ÑÑÐ-ЯÐ0-9\-]{1}\.[a-zA-Zа-ÑÑÐ-ЯÐ]{2,6}/; 1362 var regEmail = new RegExp(emailString, ''); 1363 1364 if (regEmail.test(input.value)) { 1365 parent.classList.add('is-valid'); 1366 } else { 1367 parent.classList.remove('is-valid'); 1368 flag = false; 1369 } 1370 1371 return flag; 1372 }; 1373 1374 var validateMatrixInput = function validateMatrixInput(input) { 1375 var parent = input.closest('[data-validate-type]'); 1376 parent.classList.remove('is-invalid'); 1377 var flag = true; 1378 var matrix = input.closest('[data-matrix]').dataset.matrix; 1379 1380 if (input.value.length === matrix.length) { 1381 parent.classList.add('is-valid'); 1382 } else { 1383 parent.classList.remove('is-valid'); 1384 flag = false; 1385 } 1386 1387 return flag; 1388 }; 1389 1390 var findSelectedOption = function findSelectedOption(options) { 1391 var flag = false; 1392 options.forEach(function (option) { 1393 if (option.value && option.selected) { 1394 flag = true; 1395 } 1396 }); 1397 return flag; 1398 }; 1399
1400 var validateSelect = function validateSelect(input) { 1401 var parent = input.closest('[data-validate-type]'); 1402 var options = input.querySelectorAll('option'); 1403 var customSelectText = parent.querySelector('.custom-select__text'); 1404 parent.classList.remove('is-invalid'); 1405 var flag = true; 1406 1407 if (findSelectedOption(options)) { 1408 parent.classList.add('is-valid'); 1409 } else { 1410 parent.classList.remove('is-valid'); 1411 customSelectText.innerHTML = ''; 1412 parent.classList.remove('not-empty'); 1413 flag = false; 1414 } 1415 1416 return flag; 1417 }; 1418 1419 var validateCheckbox = function validateCheckbox(input) { 1420 var parent = input.closest('[data-validate-type]'); 1421 parent.classList.remove('is-invalid'); 1422 var flag = true; 1423 1424 if (input.checked) { 1425 parent.classList.add('is-valid'); 1426 } else { 1427 parent.classList.remove('is-valid'); 1428 flag = false; 1429 } 1430 1431 return flag; 1432 }; 1433 1434 var validateInputs = function validateInputs(type, input) { 1435 switch (type) { 1436 case 'text': 1437 return validateTextInput(input); 1438 1439 case 'phone': 1440 return validatePhoneInput(input); 1441 1442 case 'email': 1443 return validateEmailInput(input); 1444 1445 case 'matrix': 1446 return validateMatrixInput(input); 1447 1448 case 'select': 1449 return validateSelect(input); 1450 1451 case 'checkbox': 1452 return validateCheckbox(input); 1453 1454 default: 1455 return false; 1456 } 1457 }; 1458 1459 var returnCheckedElements = function returnCheckedElements(inputs) { 1460 var flag = false; 1461 inputs.forEach(function (input) { 1462 if (input.checked) { 1463 flag = true; 1464 } 1465 }); 1466 return flag; 1467 }; 1468 1469 var removeGroupAria = function removeGroupAria(inputs) { 1470 inputs.forEach(function (input) { 1471 if (!input.checked) { 1472 input.removeAttribute('aria-required'); 1473 input.removeAttribute('aria-invalid'); 1474 } else { 1475 input.setAttribute('aria-required', true); 1476 input.setAttribute('aria-invalid', false); 1477 } 1478 }); 1479 }; 1480 1481 var setGroupAria = function setGroupAria(inputs) { 1482 inputs.forEach(function (input) { 1483 input.setAttribute('aria-required', true); 1484 input.setAttribute('aria-invalid', true); 1485 }); 1486 }; 1487 1488 var validateToggleGroup = function validateToggleGroup(parent) { 1489 var formElements = parent.querySelectorAll('input'); 1490 parent.classList.remove('is-invalid'); 1491 var flag = true; 1492 1493 if (returnCheckedElements(formElements)) { 1494 removeGroupAria(formElements); 1495 parent.classList.add('is-valid'); 1496 } else { 1497 setGroupAria(formElements); 1498 parent.classList.remove('is-valid'); 1499 flag = false; 1500 } 1501 1502 return flag; 1503 }; 1504 1505 var checkInputValidity = function checkInputValidity(type, input) { 1506 validateInputs(type, input); 1507 }; // УÑÑановка вÑÐµÑ Ð´ÐµÐ¹ÑÑвий в полÑÑ ÑоÑм 1508 1509 1510 var formElementLimitationsAction = function formElementLimitationsAction(formValidateElement) { 1511 var dataLimitations = formValidateElement.dataset.limitations ? formValidateElement.dataset.limitations : null; 1512 var formElement = formValidateElement.querySelector('input'); 1513 1514 if (!formElement) { 1515 formElement = formValidateElement.querySelector('textarea'); 1516 } 1517 1518 if (!formElement) { 1519 // eslint-disable-next-line no-console 1520 console.error('РвалидиÑÑемом блоке оÑÑÑÑÑÑвÑÐµÑ Ð¿Ð¾Ð»Ðµ ÑоÑмÑ'); 1521 return; 1522 } 1523 1524 if (dataLimitations) { 1525 simpleLimitations(formElement, dataLimitations); 1526 } 1527 }; 1528 1529 var formElementMatrixAction = function formElementMatrixAction(formValidateElement) { 1530 var dataMatrix = formValidateElement.dataset.matrix ? formValidateElement.dataset.matrix : null; 1531 var dataMatrixLimitations = formValidateElement.dataset.matrixLimitations ? formValidateElement.dataset.matrixLimitations : null; 1532 var formElement = formValidateElement.querySelector('input'); 1533 1534 if (!formElement) { 1535 formElement = formValidateElement.querySelector('textarea'); 1536 } 1537 1538 if (!formElement) { 1539 // eslint-disable-next-line no-console 1540 console.error('РвалидиÑÑемом блоке оÑÑÑÑÑÑвÑÐµÑ Ð¿Ð¾Ð»Ðµ ÑоÑмÑ'); 1541 return; 1542 } 1543 1544 if (dataMatrix) { 1545 simpleMatrix(formElement, dataMatrix, dataMatrixLimitations); 1546 } 1547 }; 1548 1549 var formElementValidateAction = function formElementValidateAction(formValidateElement) { 1550 var dataValidateType = formValidateElement.dataset.validateType; 1551 var dataLimitations = formValidateElement.dataset.limitations ? formValidateElement.dataset.limitations : null; 1552 var dataMatrix = formValidateElement.dataset.matrix ? formValidateElement.dataset.matrix : null; 1553 var dataMatrixLimitations = formValidateElement.dataset.matrixLimitations ? formValidateElement.dataset.matrixLimitations : null; 1554 1555 if (dataValidateType !== 'toggle-group') { 1556 var formElement = formValidateElement.querySelector('input'); 1557 1558 if (!formElement) { 1559 formElement = formValidateElement.querySelector('textarea'); 1560 } 1561 1562 if (!formElement) { 1563 formElement = formValidateElement.querySelector('select'); 1564 } 1565 1566 if (!formElement) { 1567 // eslint-disable-next-line no-console 1568 console.error('РвалидиÑÑемом блоке оÑÑÑÑÑÑвÑÐµÑ Ð¿Ð¾Ð»Ðµ ÑоÑмÑ'); 1569 return; 1570 } 1571 1572 formElement.setAttribute('aria-required', true); 1573 formElement.setAttribute('aria-invalid', true); 1574 1575 if (dataLimitations) { 1576 simpleLimitations(formElement, dataLimitations); 1577 } 1578 1579 if (dataMatrix) { 1580 simpleMatrix(formElement, dataMatrix, dataMatrixLimitations); 1581 } 1582 1583 if (dataValidateType === 'phone') { 1584 if (formElement.value) { 1585 prettifyPhoneInput(formElement); 1586 } 1587 1588 formElement.addEventListener('focus', onFocusPhoneInput); 1589 } 1590 1591 formElement.addEventListener('input', function () { 1592 checkInputValidity(dataValidateType, formElement); 1593 }); 1594 checkInputValidity(dataValidateType, formElement); 1595 } else { 1596 var formElements = formValidateElement.querySelectorAll('input'); 1597 1598 if (formElements.length) {
1599 formElements.forEach(function (el) { 1600 el.setAttribute('aria-required', true); 1601 el.setAttribute('aria-invalid', true); 1602 el.addEventListener('input', function () { 1603 validateToggleGroup(formValidateElement); 1604 }); 1605 }); 1606 validateToggleGroup(formValidateElement); 1607 } else { 1608 // eslint-disable-next-line no-console 1609 console.error('РвалидиÑÑемом блоке оÑÑÑÑÑÑвÑÑÑ Ð¿Ð¾Ð»Ñ ÑоÑмÑ'); 1610 return; 1611 } 1612 } 1613 }; // ÐбÑабоÑка ÑобÑÑÐ¸Ñ submit на ÑоÑме 1614 1615 1616 var onFormSubmit = function onFormSubmit(e, callback) { 1617 var formElements = e.target.querySelectorAll('[aria-required="true"]'); 1618 var groupsFormElement = e.target.querySelectorAll('[data-validate-type="toggle-group"]'); 1619 1620 if (showErrors(formElements, groupsFormElement) && callback && callback.successCallback) { 1621 callback.successCallback(e); 1622 } else if (callback && callback.errorCallback) { 1623 callback.errorCallback(e); 1624 } else { 1625 e.preventDefault(); 1626 } 1627 }; // ÐÑиÑÑка полей ÑоÑÐ¼Ñ 1628 1629 1630 var clearForm = function clearForm(form) { 1631 form.reset(); 1632 var formValidateElements = form.querySelectorAll('[data-validate-type]'); 1633 var notEmptyInputs = form.querySelectorAll('.not-empty'); 1634 1635 if (notEmptyInputs.length) { 1636 notEmptyInputs.forEach(function (notEmptyInput) { 1637 notEmptyInput.classList.remove('not-empty'); 1638 }); 1639 } 1640 1641 formValidateElements.forEach(function (formValidateElement) { 1642 var dataValidateType = formValidateElement.dataset.validateType; 1643 1644 if (dataValidateType !== 'toggle-group') { 1645 var formElement = formValidateElement.querySelector('input'); 1646 1647 if (!formElement) { 1648 formElement = formValidateElement.querySelector('textarea'); 1649 } 1650 1651 if (!formElement) { 1652 formElement = formValidateElement.querySelector('select'); 1653 } 1654 1655 if (!formElement) { 1656 // eslint-disable-next-line no-console 1657 console.error('РвалидиÑÑемом блоке оÑÑÑÑÑÑвÑÐµÑ Ð¿Ð¾Ð»Ðµ ÑоÑмÑ'); 1658 return; 1659 } 1660 1661 formElement.value = ''; 1662 checkInputValidity(dataValidateType, formElement); 1663 } else { 1664 validateToggleGroup(formValidateElement); 1665 } 1666 }); 1667 }; 1668 1669 window.clearForm = clearForm; // ÐлаÑÑ FormsValidate 1670 1671 var FormsValidate = /*#__PURE__*/function () { 1672 function FormsValidate(wrappers) { 1673 var callback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; 1674 1675 _classCallCheck(this, FormsValidate); 1676 1677 this.wrappers = wrappers; 1678 this.callback = callback; 1679 } 1680 1681 _createClass(FormsValidate, [{ 1682 key: "init", 1683 value: function init(formWrappers) { 1684 var _this = this; 1685 1686 if (!formWrappers) { 1687 formWrappers = this.wrappers; 1688 } 1689 1690 var typeOfNode = Object.prototype.toString.call(formWrappers); 1691 1692 if (typeOfNode === '[object HTMLCollection]' || typeOfNode === '[object NodeList]' || typeOfNode === '[object Array]') {
1693 formWrappers.forEach(function (wrapper) { 1694 if (wrapper.classList.contains('is-initialized')) { 1695 // eslint-disable-next-line no-console 1696 console.error('Ðа данной ÑоÑме валидаÑÐ¸Ñ Ñже иниÑиализиÑованна'); 1697 } else { 1698 _this.initItem(wrapper); 1699 } 1700 }); 1701 } else if (typeOfNode === '[object HTMLDivElement]' || typeOfNode === '[object HTMLElement]') { 1702 if (!formWrappers.classList.contains('is-initialized')) { 1703 this.initItem(formWrappers); 1704 } 1705 } else { 1706 // eslint-disable-next-line no-console 1707 console.error('ÐеÑеданнÑй обÑÐµÐºÑ Ð½Ðµ ÑооÑвеÑÑÑвÑÐµÑ ÑоÑмаÑÑ'); 1708 return; 1709 } 1710 } 1711 }, { 1712 key: "initItem", 1713 value: function initItem(element) { 1714 var _this2 = this; 1715 1716 element.classList.add('is-initialized'); 1717 var form = element.querySelector('form'); 1718 var resetButtons = form.querySelectorAll('button[type="reset"], [data-reset]'); 1719 form.noValidate = true; 1720 form.addEventListener('submit', function (e) { 1721 onFormSubmit(e, _this2.callback); 1722 }); 1723 1724 if (resetButtons.length) { 1725 resetButtons.forEach(function (btn) { 1726 btn.addEventListener('click', function (e) { 1727 e.preventDefault(); 1728 clearForm(form); 1729 }); 1730 }); 1731 } 1732 1733 var formValidateElements = form.querySelectorAll('[data-validate-type]'); 1734 var formLimitationsElements = form.querySelectorAll('[data-limitations]:not([data-validate-type])'); 1735 var formMatrixElements = form.querySelectorAll('[data-matrix]:not([data-validate-type])'); 1736 1737 if (formValidateElements.length) { 1738 formValidateElements.forEach(function (el) { 1739 formElementValidateAction(el); 1740 }); 1741 } 1742 1743 if (formLimitationsElements.length) { 1744 formLimitationsElements.forEach(function (el) { 1745 formElementLimitationsAction(el); 1746 }); 1747 } 1748 1749 if (formMatrixElements.length) { 1750 formMatrixElements.forEach(function (el) { 1751 formElementMatrixAction(el); 1752 }); 1753 } 1754 } 1755 }]); 1756 1757 return FormsValidate; 1758 }(); 1759 1760 1761 window.FormsValidate = FormsValidate; 1762 1763 /***/ 1764 }), 1765 1766
1766/***/ "./js/modules/hide-instructions.js": 1767 /*!*****************************************!*\ 1768 !*** ./js/modules/hide-instructions.js ***! 1769 \*****************************************/ 1770 /*! exports provided: initHideInstruction */ 1771 /***/ (function (module, __webpack_exports__, __webpack_require__) { 1772 1773 "use strict"; 1774 __webpack_require__.r(__webpack_exports__); 1775 /* harmony export (binding) */ 1776 __webpack_require__.d(__webpack_exports__, "initHideInstruction", function () { 1777 return initHideInstruction; 1778 }); 1779 // СкÑÑваем инÑÑÑÑкÑÐ¸Ñ Ð² Ð¼ÐµÐ½Ñ ÐÐ Ð´Ð»Ñ Ð°Ð²ÑоÑизованнÑÑ Ð¿Ð¾Ð»ÑзоваÑелей - наÑало - 1780 var initHideInstruction = function initHideInstruction() { 1781 var menuItems = document.querySelectorAll('.account__menu-list-item'); 1782 var menuList = document.querySelector('.account__menu-list'); 1783 var instruction = document.querySelector('.account__instructions'); 1784 1785 if (menuItems && menuList && instruction) { 1786 menuItems.forEach(function (item) { 1787 if (item.classList.contains('_is-authorized')) { 1788 instruction.classList.add('_hidden'); 1789 menuList.classList.add('border-none'); 1790 } else { 1791 instruction.classList.remove('_hidden'); 1792 menuList.classList.remove('border-none'); 1793 } 1794 }); 1795 } 1796 }; 1797 1798 // СкÑÑваем инÑÑÑÑкÑÐ¸Ñ Ð² Ð¼ÐµÐ½Ñ ÐÐ Ð´Ð»Ñ Ð°Ð²ÑоÑизованнÑÑ Ð¿Ð¾Ð»ÑзоваÑелей - ÐºÐ¾Ð½ÐµÑ - 1799 1800 /***/ 1801 }), 1802 1803
1803/***/ "./js/modules/init-accordion.js": 1804 /*!**************************************!*\ 1805 !*** ./js/modules/init-accordion.js ***! 1806 \**************************************/ 1807 /*! exports provided: initAccordions, accordions */ 1808 /***/ (function (module, __webpack_exports__, __webpack_require__) { 1809 1810 "use strict"; 1811 __webpack_require__.r(__webpack_exports__); 1812 /* harmony export (binding) */ 1813 __webpack_require__.d(__webpack_exports__, "initAccordions", function () { 1814 return initAccordions; 1815 }); 1816 /* harmony export (binding) */ 1817 __webpack_require__.d(__webpack_exports__, "accordions", function () { 1818 return accordions; 1819 }); 1820 /* harmony import */ 1821 var _accordions__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./accordions */ "./js/modules/accordions.js"); 1822 1823 var accordions; 1824 1825 var initAccordions = function initAccordions() { 1826 accordions = new _accordions__WEBPACK_IMPORTED_MODULE_0__["Accordions"](); // ÐÑполÑзÑйÑе в ÑазÑабоÑке ÑкÑпоÑÑиÑÑемÑÑ Ð¿ÐµÑеменнÑÑ accordions, window Ñделан Ð´Ð»Ñ Ð±ÑкÑнда 1827 1828 window.accordions = accordions; 1829 }; 1830 1831 1832 /***/ 1833 }), 1834 1835 1836
1836/***/ "./js/modules/init-form-validate.js": 1837 /*!******************************************!*\ 1838 !*** ./js/modules/init-form-validate.js ***! 1839 \******************************************/ 1840 /*! exports provided: default */ 1841 /***/ (function (module, __webpack_exports__, __webpack_require__) { 1842 1843 "use strict"; 1844 __webpack_require__.r(__webpack_exports__); 1845 /* harmony import */ 1846 var _form_validate__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./form-validate */ "./js/modules/form-validate.js"); 1847 /* harmony import */ 1848 var _modals_modal__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./modals/modal */ "./js/modules/modals/modal.js"); 1849 1850 function _toConsumableArray(arr) { 1851 return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); 1852 } 1853 1854 function _nonIterableSpread() { 1855 throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); 1856 } 1857 1858 function _unsupportedIterableToArray(o, minLen) { 1859 if (!o) return; 1860 if (typeof o === "string") return _arrayLikeToArray(o, minLen); 1861 var n = Object.prototype.toString.call(o).slice(8, -1); 1862 if (n === "Object" && o.constructor) n = o.constructor.name; 1863 if (n === "Map" || n === "Set") return Array.from(o); 1864 if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); 1865 } 1866 1867 function _iterableToArray(iter) { 1868 if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); 1869 } 1870 1871 function _arrayWithoutHoles(arr) { 1872 if (Array.isArray(arr)) return _arrayLikeToArray(arr); 1873 } 1874 1875 function _arrayLikeToArray(arr, len) { 1876 if (len == null || len > arr.length) len = arr.length; 1877 for (var i = 0, arr2 = new Array(len); i < len; i++) { 1878 arr2[i] = arr[i]; 1879 } 1880 return arr2; 1881 } 1882 1883 1884 var formWrappers = _toConsumableArray(document.querySelectorAll("[data-validate]")); 1885 1886 var resetForm = function resetForm(form) { 1887 setTimeout(function () { 1888 form.reset(); 1889 }, 1000); 1890 }; 1891 1892 function resetFormElements(form) { 1893 const inputs = form.querySelectorAll('.custom-input'); 1894 const selects = form.querySelectorAll('.custom-select'); 1895 if (inputs.length) { 1896 inputs.forEach(function (input) { 1897 setTimeout(function () { 1898 input.classList.remove('is-valid') 1899 }, 1000) 1900 }) 1901 } 1902 if (selects.length) { 1903 selects.forEach(function (select) { 1904 setTimeout(function () { 1905 select.classList.remove('is-valid'); 1906 select.classList.remove('not-empty'); 1907 }, 1000) 1908 }) 1909 } 1910 } 1911 1912 var baseSuccessCallback = function baseSuccessCallback(e) { 1913 e.preventDefault(); 1914 resetForm(e.target); 1915 }; 1916 1917 var baseErrorCallback = function baseErrorCallback(e) { 1918 e.preventDefault(); 1919 }; 1920 1921 1922 1923 var accountFormSuccessCallback = function accountFormSuccessCallback(e) { 1924 var notification = document.querySelector(".account__notification"); 1925 var form = document.querySelector(".account__form form"); 1926 var inputs = form.querySelectorAll("input"); 1927 var selects = form.querySelectorAll(".custom-select__button"); 1928 e.preventDefault(); 1929 notification.classList.remove("account__notification--error"); 1930 notification.classList.add("account__notification--success"); 1931 if (document.querySelector(".account__notification").closest('.create-event__form')) { 1932 console.log(notification.closest("div").classList.contains("create-event__form")); 1933 notification.innerHTML = "<span>ÐеÑопÑиÑÑие добавлено в Ñаздел «Ðои меÑопÑиÑÑиÑ»</span>"; 1934 jQuery.ajax({ 1935 url: '/local/ajax/add_mer.php', // URL оÑпÑавки запÑоÑа 1936 type: "POST", 1937 dataType: "text", 1938 data: { 1939 name: $('input[name="name"]').val(), 1940 date: $('input[name="date"]').val(), 1941 dateconch: $('input[name="dateconch"]').val(), 1942 mesto: $('input[name="mesto"]').val(), 1943 desk: $('input[name="desk"]').val(), 1944 href: $('input[name="href"]').val(), 1945 1946 }, 1947 success: function (result) { // ÐÑли ÐаннÑе оÑпÑÐ°Ð²Ð»ÐµÐ½Ñ ÑÑпеÑно 1948 console.log(result); 1949 }, 1950 error: function (jqXHR, textStatus, errorThrown) { // ÐÑибка 1951 console.log('Error: ' + errorThrown); 1952 } 1953 1954 }); 1955 1956 } else { 1957 notification.innerHTML = "<span>ÐаÑи даннÑе оÑпÑÐ°Ð²Ð»ÐµÐ½Ñ Ð½Ð° пÑовеÑкÑ!</span>"; 1958 } 1959 1960 notification.style.transition = "none"; 1961 notification.style.maxHeight = "".concat(notification.scrollHeight + 20, "px"); 1962 notification.style.transition = null;
1963 inputs.forEach(function (input) { 1964 input.disabled = true; 1965 }); 1966 selects.forEach(function (select) { 1967 select.style = "pointer-events: none;"; 1968 }); 1969 }; 1970 1971 var accountFormErrorCallback = function accountFormErrorCallback(e) { 1972 var notification = document.querySelector(".account__notification"); 1973 e.preventDefault(); 1974 notification.classList.remove("account__notification--success"); 1975 notification.classList.add("account__notification--error"); 1976 notification.innerHTML = "<span>*ÐÐµÐ¾Ð±Ñ Ð¾Ð´Ð¸Ð¼Ð¾ заполниÑÑ</span>"; 1977 notification.style.transition = "none"; 1978 notification.style.maxHeight = "".concat(notification.scrollHeight + 20, "px"); 1979 notification.style.transition = null; 1980 }; 1981 1982 var contactUsFormSuccessCallback = function contactUsFormSuccessCallback(e) { 1983 var notification = document.querySelector(".contact-us__notification"); 1984 e.preventDefault(); 1985 resetForm(e.target); 1986 notification.style.transition = "none"; 1987 notification.style.maxHeight = null; 1988 notification.style.transition = null; 1989 }; 1990 1991 var contactUsFormErrorCallback = function contactUsFormErrorCallback(e) { 1992 var notification = document.querySelector(".contact-us__notification"); 1993 e.preventDefault(); 1994 notification.style.transition = "none"; 1995 notification.style.maxHeight = "".concat(notification.scrollHeight + 20, "px"); 1996 notification.style.transition = null; 1997 }; 1998 1999 var customExampleSuccessCallback = function customExampleSuccessCallback(e) { 2000 e.preventDefault(); 2001 resetForm(e.target); // eslint-disable-next-line no-console 2002 2003 console.log("ÐаÑа ÑоÑма ÑÑпеÑна оÑпÑавлена"); 2004 }; 2005 2006 var customExampleErrorCallback = function customExampleErrorCallback(e) { 2007 e.preventDefault(); // eslint-disable-next-line no-console 2008 2009 console.error("ÐÑпÑавка ÑоÑÐ¼Ñ Ð½ÐµÐ²Ð¾Ð·Ð¼Ð¾Ð¶Ð½Ð°, заполниÑе вÑе обÑзаÑелÑнÑе полÑ"); 2010 }; 2011 var reportFormSuccessCallback = function reportFormSuccessCallback(e) { 2012 e.preventDefault(); 2013 var form = (e.target) 2014 var formData = new FormData(form); 2015 formData.append('id', $('.report__form').attr('data-id')) 2016 $.ajax({
2017 url: '/local/ajax/otchet_merop.php', 2018 data: formData, 2019 type: 'POST', 2020 enctype: 'multipart/form-data', 2021 contentType: false, 2022 processData: false, 2023 success: function (data) { 2024 // console.log("SUCCESS : ", data); 2025 }, 2026 error: function (e) { 2027 console.log("ERROR : ", e); 2028 } 2029 }); 2030 resetForm(form); // eslint-disable-next-line no-console 2031 resetFormElements(form) 2032 var files = form.querySelectorAll('.report__form-preview-item'); 2033 files.forEach(function(file) { 2034 setTimeout(() => file.remove(), 1000); 2035 }) 2036 console.log("ÐаÑа ÑоÑма ÑÑпеÑна оÑпÑавлена"); 2037 }; 2038 2039 var reportFormErrorCallback = function reportFormErrorCallback(e) { 2040 e.preventDefault(); // eslint-disable-next-line no-console 2041 2042 console.error("ÐÑпÑавка ÑоÑÐ¼Ñ Ð½ÐµÐ²Ð¾Ð·Ð¼Ð¾Ð¶Ð½Ð°, заполниÑе вÑе обÑзаÑелÑнÑе полÑ"); 2043 }; 2044 2045 var bonusFormSuccessCallback = function bonusFormSuccessCallback(e) { 2046 var modalBonus = e.target.closest('.modal') 2047 e.preventDefault(); 2048 var form = e.target; 2049 var formData = new FormData(form); 2050 formData.append('TIP', $('.TIP').val()); 2051 formData.append('id', $('.modal-bonus-goods__form').attr('data-id')) 2052 $.ajax({
2053 url: '/local/ajax/bonus_tovar.php', 2054 data: formData, 2055 type: 'POST', 2056 enctype: 'multipart/form-data', 2057 contentType: false, 2058 processData: false, 2059 success: function (data) { 2060 // console.log("SUCCESS : ", data); 2061 }, 2062 error: function (e) { 2063 console.log("ERROR : ", e); 2064 } 2065 }); 2066 resetForm(e.target); // eslint-disable-next-line no-console 2067 resetFormElements(e.target); 2068 console.log("ÐаÑа ÑоÑма ÑÑпеÑна оÑпÑавлена"); 2069 }; 2070 2071 var bonusFormErrorCallback = function bonusFormErrorCallback(e) { 2072 e.preventDefault(); // eslint-disable-next-line no-console 2073 2074 console.error("ÐÑпÑавка ÑоÑÐ¼Ñ Ð½ÐµÐ²Ð¾Ð·Ð¼Ð¾Ð¶Ð½Ð°, заполниÑе вÑе обÑзаÑелÑнÑе полÑ"); 2075 }; 2076 2077 var feedReqFormSuccessCallback = function feedReqFormSuccessCallback(e) { 2078 e.preventDefault(); 2079 var form = e.target; 2080 var formData = new FormData(form); 2081 var petInputs = document.querySelectorAll('.pet-personal-data input'); 2082 petInputs.forEach(function (input, index) { 2083 formData.append('name' + index + ':', input.value) 2084 }) 2085 formData.append('pet-type', $('.custom-select[data-id="pet-type"] .custom-select__text').text()); 2086 $.ajax({
2087 url: '/local/ajax/vikorm.php', 2088 data: formData, 2089 type: 'POST', 2090 enctype: 'multipart/form-data', 2091 contentType: false, 2092 processData: false, 2093 success: function (data) { 2094 // console.log("SUCCESS : ", data); 2095 }, 2096 error: function (e) { 2097 console.log("ERROR : ", e); 2098 } 2099 }); 2100 2101 resetForm(form); // eslint-disable-next-line no-console 2102 resetFormElements(form); 2103 form.querySelector('input[type="file"]').value = ''; 2104 console.log("ÐаÑа ÑоÑма ÑÑпеÑна оÑпÑавлена"); 2105 for (let [name, value] of formData) { 2106 console.log(`${name} = ${value}`); // key1=value1, поÑом key2=value2 2107 } 2108 2109 }; 2110 2111 var feedReqFormErrorCallback = function feedReqFormErrorCallback(e) { 2112 e.preventDefault(); // eslint-disable-next-line no-console 2113 2114 // код, еÑли валидаÑÐ¸Ñ Ð½Ðµ пÑойдена 2115 2116 console.error("ÐÑпÑавка ÑоÑÐ¼Ñ Ð½ÐµÐ²Ð¾Ð·Ð¼Ð¾Ð¶Ð½Ð°, заполниÑе вÑе обÑзаÑелÑнÑе полÑ"); 2117 }; 2118 2119 function checkPetDataQuantity() { 2120 var quantityInput = document.querySelector('input[name="kolichestvo"]') 2121 if (quantityInput) { 2122 quantityInput.addEventListener('input', function () { 2123 var literQuantity = +quantityInput.value; 2124 var blocksQuantity = document.querySelectorAll('.pet-personal-data').length; 2125 if (literQuantity !== blocksQuantity) { 2126 quantityInput.closest('.custom-input').classList.add('is-invalid'); 2127 // var notification = document.createElement('div'); 2128 // notification.style.marginTop = '10px'; 2129 // notification.style.fontSize = '14px'; 2130 // notification.style.color = '#ed1b33'; 2131 // notification.innerText = 'ÐолиÑеÑÑво блоков пеÑÑоналÑнÑÑ Ð´Ð°Ð½Ð½ÑÑ Ð¶Ð¸Ð²Ð¾ÑнÑÑ Ð´Ð¾Ð»Ð¶Ð½Ð¾ бÑÑÑ Ñавно колиÑеÑÑÐ²Ñ Ð¶Ð¸Ð²Ð¾ÑнÑÑ Ð² помÑÑе. ÐажмиÑе \"ÐобавиÑÑ\" ниже'; 2132 // document.querySelector('.pet-personal').insertAdjacentElement('beforeend', notification); 2133 // setTimeout(function() { 2134 // document.querySelector('.pet-personal').removeChild(notification); 2135 // }, 7000); 2136 } 2137 }) 2138 } 2139 } 2140 checkPetDataQuantity(); 2141 var recFormSuccessCallback = function recFormSuccessCallback(e) { 2142 var modalSuccess = document.querySelector(".modal--success-message"); 2143 e.preventDefault(); 2144 jQuery.ajax({ 2145 url: '/local/ajax/form_patient.php', // URL оÑпÑавки запÑоÑа 2146 type: "POST", 2147 dataType: "text", 2148 data: { 2149 pet_type: $('.pet-type .custom-select__text').text(), 2150 hozyain: $('input[name="hozain"]').val(), 2151 klitcha: $('input[name="klitcha"]').val(), 2152 vozrast: $('input[name="vozrast"]').val(), 2153 poroda: $('input[name="poroda"]').val(), 2154 diagnoz: $('input[name="diagnoz"]').val(), 2155 rec_food: $('.rec-food .custom-select__text').text(), 2156 }, 2157 2158 success: function (result) { // ÐÑли ÐаннÑе оÑпÑÐ°Ð²Ð»ÐµÐ½Ñ ÑÑпеÑно 2159 window.open(result); 2160 // $('.recommendations__form form')[0].reset(); 2161 $('.recommendations__form .custom-select').each(function () { 2162 $(this).removeClass('is-valid not-empty'); 2163 }); 2164 $('.recommendations__form .custom-input').each(function () { 2165 $(this).removeClass('is-valid'); 2166 }); 2167 $('.rec-food').removeClass('pointer-events-all'); 2168 $('.rec-food').addClass('pointer-events-none'); 2169 $('.modal--recommendations-registration').removeClass('modal--active'); 2170 Object(_modals_modal__WEBPACK_IMPORTED_MODULE_1__["openModal"])(modalSuccess); 2171 2172 }, 2173 error: function (jqXHR, textStatus, errorThrown) { // ÐÑибка 2174 console.log('Error: ' + errorThrown); 2175 } 2176 2177 }); 2178 resetForm(e.target); // eslint-disable-next-line no-console 2179 2180 console.log("ÐаÑа ÑоÑма ÑÑпеÑна оÑпÑавлена"); 2181 }; 2182 2183 var recFormErrorCallback = function recFormErrorCallback(e) { 2184 e.preventDefault(); // eslint-disable-next-line no-console 2185 2186 console.error("ÐÑпÑавка ÑоÑÐ¼Ñ Ð½ÐµÐ²Ð¾Ð·Ð¼Ð¾Ð¶Ð½Ð°, заполниÑе вÑе обÑзаÑелÑнÑе полÑ"); 2187 }; 2188 2189 var refFormSuccessCallback = function refFormSuccessCallback(e) { 2190 e.preventDefault();
2191 // console.log($('.account__form form[name="regform"]')); 2192 jQuery.ajax({ 2193 url: '/local/ajax/form_ref.php', // URL оÑпÑавки запÑоÑа 2194 type: "POST", 2195 dataType: "text", 2196 data: { 2197 email: $('input[name="REGISTER[EMAIL]"]').val(), 2198 id: $('.account__form form[name="regform"]').attr('data-id'), 2199 last_name: $('input[name="REGISTER[LAST_NAME]"]').val(), 2200 name: $('input[name="REGISTER[NAME]"]').val(), 2201 uf_punkt: $('input[name="REGISTER[UF_PUNKT]"]').val(), 2202 phone: $('input[name="REGISTER[PERSONAL_PHONE]"]').val(), 2203 password: $('input[name="REGISTER[PASSWORD]"]').val(), 2204 confirm_password: $('input[name="REGISTER[CONFIRM_PASSWORD]"]').val(), 2205 }, 2206 2207 success: function (result) { // ÐÑли ÐаннÑе оÑпÑÐ°Ð²Ð»ÐµÐ½Ñ ÑÑпеÑно 2208 resetForm(e.target); 2209 console.log("ÐаÑа ÑоÑма ÑÑпеÑна оÑпÑавлена"); 2210 2211 }, 2212 error: function (jqXHR, textStatus, errorThrown) { // ÐÑибка 2213 console.log('Error: ' + errorThrown); 2214 } 2215 2216 }); 2217 2218 2219 2220 // eslint-disable-next-line no-console 2221 }; 2222 2223 var refFormErrorCallback = function refFormErrorCallback(e) { 2224 e.preventDefault(); // eslint-disable-next-line no-console 2225 // СÑда код, еÑли валидаÑÐ¸Ñ Ð½Ðµ пÑойдена 2226 console.error("ÐÑпÑавка ÑоÑÐ¼Ñ Ð½ÐµÐ²Ð¾Ð·Ð¼Ð¾Ð¶Ð½Ð°, заполниÑе вÑе обÑзаÑелÑнÑе полÑ"); 2227 }; 2228 2229 var eventFormSuccessCallback = function eventFormSuccessCallback(e) { 2230 const notification = document.querySelector('.event-created'); 2231 var form = e.target; 2232 var inputs = form.querySelectorAll("input"); 2233 var selects = form.querySelectorAll(".custom-select__button"); 2234 2235 e.preventDefault(); 2236 jQuery.ajax({ 2237 url: '/local/ajax/add_mer.php', // URL оÑпÑавки запÑоÑа 2238 type: "POST", 2239 dataType: "text", 2240 data: { 2241 name: $('input[name="name"]').val(), 2242 date: $('input[name="date"]').val(), 2243 dateconch: $('input[name="dateconch"]').val(), 2244 mesto: $('input[name="mesto"]').val(), 2245 desk: $('input[name="desk"]').val(), 2246 href: $('input[name="href"]').val(), 2247 2248 }, 2249 success: function (result) { // ÐÑли ÐаннÑе оÑпÑÐ°Ð²Ð»ÐµÐ½Ñ ÑÑпеÑно 2250 console.log(result); 2251 }, 2252 error: function (jqXHR, textStatus, errorThrown) { // ÐÑибка 2253 console.log('Error: ' + errorThrown); 2254 } 2255 2256 }); 2257 resetForm(e.target); // eslint-disable-next-line no-console 2258 resetFormElements(e.target) 2259 if (!notification.classList.contains('is-active')) { 2260 setTimeout(function () { 2261 notification.classList.add('is-active') 2262 }, 500) 2263 setTimeout(function () { 2264 2265 notification.classList.remove('is-active') 2266 }, 2500) 2267 } 2268 console.log("ÐаÑа ÑоÑма ÑÑпеÑна оÑпÑавлена"); 2269 2270 }; 2271 2272 var eventFormErrorCallback = function eventFormErrorCallback(e) { 2273 e.preventDefault(); // eslint-disable-next-line no-console 2274 2275 console.error("ÐÑпÑавка ÑоÑÐ¼Ñ Ð½ÐµÐ²Ð¾Ð·Ð¼Ð¾Ð¶Ð½Ð°, заполниÑе вÑе обÑзаÑелÑнÑе полÑ"); 2276 }; 2277 2278 var callbacks = { 2279 base: { 2280 successCallback: baseSuccessCallback, 2281 errorCallback: baseErrorCallback 2282 }, 2283 accountForm: { 2284 successCallback: accountFormSuccessCallback, 2285 errorCallback: accountFormErrorCallback 2286 }, 2287 contactUsForm: { 2288 successCallback: contactUsFormSuccessCallback, 2289 errorCallback: contactUsFormErrorCallback 2290 }, 2291 customExample: { 2292 successCallback: customExampleSuccessCallback, 2293 errorCallback: customExampleErrorCallback 2294 }, 2295 feedReqForm: { 2296 successCallback: feedReqFormSuccessCallback, 2297 errorCallback: feedReqFormErrorCallback 2298 }, 2299 reportForm: { 2300 successCallback: reportFormSuccessCallback, 2301 errorCallback: reportFormErrorCallback 2302 }, 2303 eventForm: { 2304 successCallback: eventFormSuccessCallback, 2305 errorCallback: eventFormErrorCallback, 2306 }, 2307 refForm: { 2308 successCallback: refFormSuccessCallback, 2309 errorCallback: refFormErrorCallback, 2310 }, 2311 recForm: { 2312 successCallback: recFormSuccessCallback, 2313 errorCallback: recFormErrorCallback, 2314 }, 2315 bonusForm: { 2316 successCallback: bonusFormSuccessCallback, 2317 errorCallback: bonusFormErrorCallback, 2318 }, 2319 2320 }; 2321 2322 var initFormValidate = function initFormValidate() { 2323 if (formWrappers.length) {
2324 formWrappers.forEach(function (wrapper) { 2325 var callback = wrapper.dataset.callback; 2326 2327 if (!callback) { 2328 callback = "base"; 2329 } 2330 2331 var formValidate = new _form_validate__WEBPACK_IMPORTED_MODULE_0__["default"](wrapper, callbacks[callback]); 2332 return formValidate.init(); 2333 }); 2334 } 2335 }; 2336 2337 /* harmony default export */ 2338 __webpack_exports__["default"] = (initFormValidate()); 2339 2340 /***/ 2341 }), 2342 2343
2343/***/ "./js/modules/init-mobile-menu.js": 2344 /*!****************************************!*\ 2345 !*** ./js/modules/init-mobile-menu.js ***! 2346 \****************************************/ 2347 /*! exports provided: initMobileMenu */ 2348 /***/ (function (module, __webpack_exports__, __webpack_require__) { 2349 2350 "use strict"; 2351 __webpack_require__.r(__webpack_exports__); 2352 /* harmony export (binding) */ 2353 __webpack_require__.d(__webpack_exports__, "initMobileMenu", function () { 2354 return initMobileMenu; 2355 }); 2356 var initMobileMenu = function initMobileMenu() { 2357 var menu = document.querySelector('.account__menu'); 2358 if (menu) { 2359 var menuBtn = menu.querySelector('.account__menu-btn'); 2360 var menuContent = menu.querySelector('.account__menu-content'); 2361 var menuOverlay = menu.querySelector('.account__menu-overlay'); 2362 var openMenu = function openMenu() { 2363 menu.classList.add('open'); 2364 window.disableBodyScroll(menu, { 2365 reserveScrollBarGap: true 2366 }); 2367 menuContent.style.maxHeight = "".concat(menuContent.scrollHeight, "px"); 2368 menuOverlay.addEventListener('click', onMenuOverlayClick); 2369 document.addEventListener('keydown', onEscPress); 2370 }; 2371 2372 var closeMenu = function closeMenu() { 2373 menu.classList.remove('open'); 2374 setTimeout(function () { 2375 window.enableBodyScroll(menu); 2376 }, 300); 2377 menuContent.style.maxHeight = null; 2378 menuOverlay.removeEventListener('click', onMenuOverlayClick); 2379 document.removeEventListener('keydown', onEscPress); 2380 }; 2381 2382 var onMenuBtnClick = function onMenuBtnClick() { 2383 if (menu.classList.contains('open')) { 2384 closeMenu(); 2385 } else { 2386 openMenu(); 2387 } 2388 }; 2389 2390 var onEscPress = function onEscPress(evt) { 2391 var isEscKey = evt.key === 'Escape' || evt.key === 'Esc'; 2392 2393 if (isEscKey && menu.classList.contains('open')) { 2394 evt.preventDefault(); 2395 closeMenu(); 2396 } 2397 }; 2398 2399 var onMenuOverlayClick = function onMenuOverlayClick() { 2400 closeMenu(); 2401 }; 2402 2403 menuBtn.addEventListener('click', onMenuBtnClick); // menuOverlay.addEventListener('click', onMenuOverlayClick); 2404 } 2405 }; 2406 2407 2408 /***/ 2409 }), 2410 2411
2411/***/ "./js/modules/init-tabs.js": 2412 /*!*********************************!*\ 2413 !*** ./js/modules/init-tabs.js ***! 2414 \*********************************/ 2415 /*! exports provided: initTabs */ 2416 /***/ (function (module, __webpack_exports__, __webpack_require__) { 2417 2418 "use strict"; 2419 __webpack_require__.r(__webpack_exports__); 2420 /* harmony export (binding) */ 2421 __webpack_require__.d(__webpack_exports__, "initTabs", function () { 2422 return initTabs; 2423 }); 2424 // ТабÑ. - наÑало - 2425 2426 var initTabs = function initTabs() { 2427 2428 var tabItems = document.querySelectorAll('.tabs__link'); 2429 var tabBlocks = document.querySelectorAll('.tabs__item'); 2430 if (tabItems.length && tabBlocks.length) { 2431 tabItems.forEach(onTabClick); 2432 } 2433 function onTabClick(item) { 2434 item.addEventListener('click', function (event) { 2435 event.preventDefault(); 2436 let tabLink = item.dataset.href; 2437 let currentBlock = document.querySelector(`[data-block=${tabLink}]`); 2438 if (!item.classList.contains('_active')) { 2439 tabItems.forEach(function (item) { 2440 item.classList.remove('_active'); 2441 }); 2442 tabBlocks.forEach(function (item) { 2443 item.classList.remove('_active'); 2444 }); 2445 item.classList.add('_active'); 2446 currentBlock.classList.add('_active'); 2447 } 2448 }); 2449 document.querySelector('.tabs__link').click(); 2450 } 2451 }; 2452 2453 // ТабÑ. - ÐÐ¾Ð½ÐµÑ - 2454 2455 /***/ 2456 }), 2457 2458
2458/***/ "./js/modules/min-date-in-input.js": 2459 /*!*****************************************!*\ 2460 !*** ./js/modules/min-date-in-input.js ***! 2461 \*****************************************/ 2462 /*! exports provided: minDate */ 2463 /***/ (function (module, __webpack_exports__, __webpack_require__) { 2464 2465 "use strict"; 2466 __webpack_require__.r(__webpack_exports__); 2467 /* harmony export (binding) */ 2468 __webpack_require__.d(__webpack_exports__, "minDate", function () { 2469 return minDate; 2470 }); 2471 var minDate = function minDate() { 2472 var dateInputs = document.querySelectorAll('input[type="date"]'); 2473 dateInputs.forEach(function (input) { 2474 var today = new Date().toISOString().split('T')[0]; 2475 input.setAttribute('min', today); 2476 }); 2477 }; 2478 2479 2480 /***/ 2481 }), 2482 2483
2483/***/ "./js/modules/modals/init-modals.js": 2484 /*!******************************************!*\ 2485 !*** ./js/modules/modals/init-modals.js ***! 2486 \******************************************/ 2487 /*! exports provided: initModals */ 2488 /***/ (function (module, __webpack_exports__, __webpack_require__) { 2489 2490 "use strict"; 2491 __webpack_require__.r(__webpack_exports__); 2492 /* harmony export (binding) */ 2493 __webpack_require__.d(__webpack_exports__, "initModals", function () { 2494 return initModals; 2495 }); 2496 /* harmony import */ 2497 var _modal__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./modal */ "./js/modules/modals/modal.js"); 2498 2499 var modalLogIn = document.querySelector('.modal--log-in'); 2500 var modalSuccessMessage = document.querySelector('.modal--success-message'); 2501 var modalRecReg = document.querySelector('.modal--recommendations-registration'); 2502 var modalProgramRules = document.querySelector('.modal--program-rules'); 2503 Object(_modal__WEBPACK_IMPORTED_MODULE_0__["setupModal"])(modalLogIn); 2504 Object(_modal__WEBPACK_IMPORTED_MODULE_0__["setupModal"])(modalSuccessMessage); 2505 Object(_modal__WEBPACK_IMPORTED_MODULE_0__["setupModal"])(modalRecReg); 2506 Object(_modal__WEBPACK_IMPORTED_MODULE_0__["setupModal"])(modalProgramRules); // наÑÑÑаиваем модалки ÑÑÑ, вÑе колбеки импоÑÑим, а не Ñоздаем из ÑÑого модÑÐ»Ñ Ð¿ÑоÑÑÑÐ½Ñ 2507 2508 var initModal = function initModal(modalId, modal, btn) { 2509 switch (modalId) { 2510 case 'example': 2511 Object(_modal__WEBPACK_IMPORTED_MODULE_0__["setupModal"])(modal, false, btn, false, true, true); 2512 break; 2513 2514 default: 2515 Object(_modal__WEBPACK_IMPORTED_MODULE_0__["setupModal"])(modal, false, btn, false, false, false); 2516 break; 2517 } 2518 }; // аÑгÑменÑÑ setupModal(modal, closeCallback, modalBtns, openCallback, noPrevDefault, preventScrollLock) 2519 // возможна иниÑиализаÑÐ¸Ñ ÑолÑко Ñ Ð¿ÐµÑвÑми аÑгÑменÑом, 2520 // еÑли вам нÑжно оÑкÑÑваÑÑ Ð¼Ð¾Ð´Ð°Ð»ÐºÑ Ð² дÑÑгом меÑÑе под какими-нибÑÐ´Ñ ÑÑловиÑми 2521 2522 2523 var initModals = function initModals() { 2524 var modals = document.querySelectorAll('.modal:not(.is-initialized)'); 2525 var modalBtns = document.querySelectorAll('[data-modal]'); // ÑÐ¸ÐºÑ Ð´Ð»Ñ ÑÐµÐ´ÐºÐ¸Ñ ÑлÑÑаев, когда модалка поÑвлÑеÑÑÑ Ð¿Ñи загÑÑзке ÑÑÑаниÑÑ 2526 2527 if (modals.length) { 2528 modals.forEach(function (el) { 2529 setTimeout(function () { 2530 el.classList.remove('modal--preload'); 2531 el.classList.add('is-initialized'); 2532 }, 100); 2533 }); 2534 } 2535 2536 if (modalBtns.length) { 2537 modalBtns.forEach(function (btn) { 2538 var modalId = btn.dataset.modal; 2539 var modal = document.querySelector(".modal--".concat(modalId)); 2540 2541 if (modal) { 2542 initModal(modalId, modal, btn); 2543 } 2544 }); 2545 } 2546 }; 2547 2548 window.initModals = initModals; 2549 2550 2551 /***/ 2552 }), 2553 2554
2554/***/ "./js/modules/modals/modal.js": 2555 /*!************************************!*\ 2556 !*** ./js/modules/modals/modal.js ***! 2557 \************************************/ 2558 /*! exports provided: setupModal, openModal, closeModal */ 2559 /***/ (function (module, __webpack_exports__, __webpack_require__) { 2560 2561 "use strict"; 2562 __webpack_require__.r(__webpack_exports__); 2563 /* harmony export (binding) */ 2564 __webpack_require__.d(__webpack_exports__, "setupModal", function () { 2565 return setupModal; 2566 }); 2567 /* harmony export (binding) */ 2568 __webpack_require__.d(__webpack_exports__, "openModal", function () { 2569 return openModal; 2570 }); 2571 /* harmony export (binding) */ 2572 __webpack_require__.d(__webpack_exports__, "closeModal", function () { 2573 return closeModal; 2574 }); 2575 var openModal = function openModal(modal, callback, preventScrollLock) { 2576 modal.classList.add('modal--active'); 2577 2578 if (callback) { 2579 callback(); 2580 } 2581 2582 if (!preventScrollLock) { 2583 window.disableBodyScroll(modal, { 2584 reserveScrollBarGap: true 2585 }); 2586 } 2587 }; 2588 2589 var closeModal = function closeModal(modal, callback, preventScrollLock) { 2590 modal.classList.remove('modal--active'); 2591 2592 if (callback) { 2593 callback(); 2594 } 2595 2596 if (!preventScrollLock) { 2597 setTimeout(function () { 2598 window.enableBodyScroll(modal); 2599 }, 300); 2600 } 2601 }; 2602 2603 var onEscPress = function onEscPress(evt, modal, callback) { 2604 var isEscKey = evt.key === 'Escape' || evt.key === 'Esc'; 2605 2606 if (isEscKey && modal.classList.contains('modal--active')) { 2607 evt.preventDefault(); 2608 closeModal(modal, callback); 2609 } 2610 }; 2611 2612 var setModalListeners = function setModalListeners(modal, closeCallback, preventScrollLock) { 2613 var overlay = modal.querySelector('.modal__overlay'); 2614 var closeBtn = modal.querySelector('.modal__close-btn'); 2615 closeBtn.addEventListener('click', function () { 2616 closeModal(modal, closeCallback, preventScrollLock); 2617 }); 2618 overlay.addEventListener('click', function () { 2619 closeModal(modal, closeCallback, preventScrollLock); 2620 }); 2621 document.addEventListener('keydown', function (evt) { 2622 onEscPress(evt, modal, closeCallback, preventScrollLock); 2623 }); 2624 }; 2625 2626 var setupModal = function setupModal(modal, closeCallback, modalBtn, openCallback, noPrevDefault, preventScrollLock) { 2627 if (modalBtn) { 2628 modalBtn.addEventListener('click', function (evt) { 2629 if (!noPrevDefault) { 2630 evt.preventDefault(); 2631 } 2632 2633 openModal(modal, openCallback, preventScrollLock); 2634 }); 2635 } 2636 2637 setModalListeners(modal, closeCallback, preventScrollLock); 2638 }; 2639 2640 2641 /***/ 2642 }), 2643 2644
2644/***/ "./js/modules/switch-on-login-in-modal.js": 2645 /*!************************************************!*\ 2646 !*** ./js/modules/switch-on-login-in-modal.js ***! 2647 \************************************************/ 2648 /*! exports provided: initSwitchOnLogInModal */ 2649 /***/ (function (module, __webpack_exports__, __webpack_require__) { 2650 2651 "use strict"; 2652 __webpack_require__.r(__webpack_exports__); 2653 /* harmony export (binding) */ 2654 __webpack_require__.d(__webpack_exports__, "initSwitchOnLogInModal", function () { 2655 return initSwitchOnLogInModal; 2656 }); 2657 // ÐеÑеклÑÑение Ñабов нижними ÑÑÑлками на модалке авÑоÑизаÑии - наÑало - 2658 var initSwitchOnLogInModal = function initSwitchOnLogInModal() { 2659 var otherLinks = document.querySelectorAll('.log-in__link'); 2660 2661 if (otherLinks) { 2662 otherLinks.forEach(function (link) { 2663 link.addEventListener('click', function (e) { 2664 e.preventDefault(); 2665 var target = e.target; 2666 2667 if (target.textContent === 'ÐабÑли паÑолÑ?') { 2668 document.getElementById('link03').click(); 2669 } 2670 2671 if (target.textContent === 'ÐаÑегиÑÑÑиÑоваÑÑÑÑ') { 2672 document.getElementById('link02').click(); 2673 } 2674 2675 if (target.textContent === 'ÐойÑи') { 2676 document.getElementById('link01').click(); 2677 } 2678 }); 2679 }); 2680 } 2681 }; 2682 2683 // ÐеÑеклÑÑение Ñабов нижними ÑÑÑлками на модалке авÑоÑизаÑии - ÐºÐ¾Ð½ÐµÑ - 2684 2685 /***/ 2686 }), 2687 2688
2688/***/ "./js/utils/ios-vh-fix.js": 2689 /*!********************************!*\ 2690 !*** ./js/utils/ios-vh-fix.js ***! 2691 \********************************/ 2692 /*! exports provided: iosVhFix */ 2693 /***/ (function (module, __webpack_exports__, __webpack_require__) { 2694 2695 "use strict"; 2696 __webpack_require__.r(__webpack_exports__); 2697 /* harmony export (binding) */ 2698 __webpack_require__.d(__webpack_exports__, "iosVhFix", function () { 2699 return iosVhFix; 2700 }); 2701 var isIos = function isIos() { 2702 return ['iPad Simulator', 'iPhone Simulator', 'iPod Simulator', 'iPad', 'iPhone', 'iPod'].includes(navigator.platform) // iPad on iOS 13 detection 2703 || navigator.userAgent.includes('Mac') && 'ontouchend' in document; 2704 }; 2705 2706 var iosVhFix = function iosVhFix() { 2707 if (!(!!window.MSInputMethodContext && !!document.documentMode)) { 2708 if (isIos()) { 2709 var vh = window.innerHeight * 0.01; 2710 document.documentElement.style.setProperty('--vh', "".concat(vh, "px")); 2711 window.addEventListener('resize', function () { 2712 vh = window.innerHeight * 0.01; 2713 document.documentElement.style.setProperty('--vh', "".concat(vh, "px")); 2714 }); 2715 } 2716 } 2717 }; 2718 2719 2720 /***/ 2721 }), 2722 2723 /******/ 2724
2724/***/ "./js/modules/init-search-panel.js": 2725 /*!*****************************************!*\ 2726 !*** ./js/modules/init-search-panel.js ***! 2727 \*****************************************/ 2728 /*! exports provided: initSearchBar */ 2729 /***/ (function (module, __webpack_exports__, __webpack_require__) { 2730 2731 "use strict"; 2732 __webpack_require__.r(__webpack_exports__); 2733 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "initSearchBar", function () { return initSearchBar; }); 2734 // Ðоказ и ÑкÑÑÑие панели поиÑка в Ñапке -- ÐаÑало -- 2735 // Showing and hiding the search bar in the header -- Start -- 2736 var initSearchBar = function initSearchBar() { 2737 var parentEl = document.querySelector('.header__search-wrapper'); 2738 2739 if (parentEl) { 2740 var searchForm = parentEl.querySelector('form'); 2741 var searchInput = searchForm.querySelector('.custom-input'); 2742 var btnShow = parentEl.querySelector('.header__search-btn--show-search-panel'); 2743 var btnHide = parentEl.querySelector('.header__search-btn--hide-search-panel'); 2744 parentEl.addEventListener('click', function (e) { 2745 if (e.target === btnShow) { 2746 searchForm.classList.add('is-active'); 2747 btnShow.classList.add('is-active'); 2748 setTimeout(function () { 2749 btnHide.classList.add('is-active'); 2750 }, 300); 2751 } else if (e.target === btnHide) { 2752 if (searchInput.classList.contains('is-invalid')) { 2753 searchInput.classList.remove('is-invalid'); 2754 } 2755 2756 searchForm.classList.remove('is-active'); 2757 btnHide.classList.remove('is-active'); 2758 setTimeout(function () { 2759 btnShow.classList.remove('is-active'); 2760 }, 300); 2761 } 2762 }); 2763 } 2764 }; 2765 2766 // Ðоказ и ÑкÑÑÑие панели поиÑка в Ñапке -- ÐÐ¾Ð½ÐµÑ -- 2767 // Showing and hiding the search bar in the header -- End -- 2768 2769 /***/ 2770 })
2770, 2771 2772}); 2773//# sourceMappingURL=main.min.js.map 2774 2775// ÑкÑÐ¸Ð¿Ñ Ð´Ð»Ñ ÐºÐ½Ð¾Ð¿ÐºÐ¸ копиÑÐ¾Ð²Ð°Ð½Ð¸Ñ Ð² бÑÑÐµÑ Ð¾Ð±Ð¼ÐµÐ½Ð° -- наÑало -- 2776 2777var clipboard = new ClipboardJS('.btn-copy'); 2778function showCopyTooltip() { 2779 const copyTooltip = document.querySelector('.ref-copy__tooltip'); 2780 if (!copyTooltip.classList.contains('is-active')) { 2781 copyTooltip.classList.add('is-active') 2782 setTimeout(function () { 2783 copyTooltip.classList.remove('is-active') 2784 }, 3000) 2785 } 2786} 2787clipboard.on('success', function (e) { 2788 showCopyTooltip(); 2789 console.info('Action:', e.action); 2790 console.info('Text:', e.text); 2791}); 2792 2793clipboard.on('error', function (e) { 2794 console.error('Action:', e.action); 2795}); 2796 2797// ÑкÑÐ¸Ð¿Ñ Ð´Ð»Ñ ÐºÐ½Ð¾Ð¿ÐºÐ¸ копиÑÐ¾Ð²Ð°Ð½Ð¸Ñ Ð² бÑÑÐµÑ Ð¾Ð±Ð¼ÐµÐ½Ð° -- ÐºÐ¾Ð½ÐµÑ -- 2798 2799 2800 2801// показ ÑоÑÐ¼Ñ Ð½Ð° ÑÑÑаниÑе меÑопÑиÑÑÐ¸Ñ -- наÑало -- 2802 2803var reportFormBlock = document.querySelector('.report__form'); 2804if (reportFormBlock) { 2805 var repFormWrapper = reportFormBlock.querySelector('.report__form-wrapper'); 2806 2807 var startBtn = reportFormBlock.querySelector('.report__form-btn--start'); 2808 var submitBtn = reportFormBlock.querySelector('.report__form-btn--submit'); 2809 reportFormBlock.addEventListener('click', (e) => { 2810 if (e.target === startBtn) { 2811 repFormWrapper.classList.add('is-active'); 2812 submitBtn.removeAttribute('disabled'); 2813 } 2814 }) 2815} 2816 2817// показ ÑоÑÐ¼Ñ Ð½Ð° ÑÑÑаниÑе меÑопÑиÑÑÐ¸Ñ -- ÐºÐ¾Ð½ÐµÑ -- 2818 2819// добавление помеÑа в модалке заÑвки на вÑкоÑм -- наÑало -- 2820 2821var modalFeedingReq = document.querySelector('.modal--feeding-request'); 2822if (modalFeedingReq) { 2823 var btnAdd = modalFeedingReq.querySelector('.btn-more'); 2824 btnAdd.addEventListener('click', addInputsBlock); 2825} 2826 2827function addInputsBlock() { 2828 var parentBlock = document.querySelector('.pet-personal'); 2829 var inputsBlock = document.querySelector('.pet-personal-data'); 2830 var cloneBlock = inputsBlock.cloneNode(true); 2831 var blocksQuantity = document.querySelectorAll('.pet-personal-data').length; 2832 cloneBlock.querySelector('.custom-input__label').innerText = ''; 2833 cloneBlock.querySelector('.custom-input__label--two').innerText = blocksQuantity + 1; 2834 cloneBlock.querySelectorAll('input').forEach(function (item) { 2835 item.closest('.custom-input').classList.remove('is-valid'); 2836 item.value = ''; 2837 item.name = item.name + (+blocksQuantity + 1); 2838 }) 2839 cloneBlock.style = 'margin-top: 10px'; 2840 parentBlock.insertAdjacentElement('beforeend', cloneBlock); 2841 2842} 2843 2844// добавление помеÑа в модалке заÑвки на вÑкоÑм -- ÐºÐ¾Ð½ÐµÑ -- 2845 2846$(document).ready(function () { 2847 $('.account__content-item-link-btn.qr_kod').on('click', function () { 2848 let qr_kod = $('.qr_kod').attr('qr_kod'); 2849 jQuery.ajax({ 2850 url: '/local/ajax/qr_kod.php', // URL оÑпÑавки запÑоÑа 2851 type: "POST", 2852 dataType: "text", 2853 data: { 2854 id: $('.qr_kod').attr('data-id'), 2855 }, 2856 2857 success: function (result) { // ÐÑли ÐаннÑе оÑпÑÐ°Ð²Ð»ÐµÐ½Ñ ÑÑпеÑно 2858 $('.account__content-item-qr-title').text('ÐÐ°Ñ QR код') 2859 $('.qr_kod').remove(); 2860 $('.account__content-item-qr-title').after(' <img src="' + qr_kod + '" alt="QR код">') 2861 }, 2862 error: function (jqXHR, textStatus, errorThrown) { // ÐÑибка 2863 console.log('Error: ' + errorThrown); 2864 } 2865 2866 }); 2867 }) 2868 2869 2870}) 2871 2872// авÑоÑеÑайз textarea -- наÑало -- 2873 2874const textarea = document.querySelectorAll('.autoresize-textarea textarea'); 2875 2876const getHeightWithoutBorder = (el) => { 2877 let realscrollHeight = el.scrollHeight; 2878 2879 if (!el.value) { 2880 el.value = 0; 2881 realscrollHeight = el.scrollHeight; 2882 el.value = ''; 2883 } 2884 2885 return realscrollHeight + el.offsetHeight - el.clientHeight; 2886}; 2887 2888const resizeHeight = (el) => { 2889 if(el){ 2890 el.style.height = 'auto'; 2891 el.style.height = `${getHeightWithoutBorder(el)}
2891px`; 2892 } 2893 2894}; 2895 2896const initAutoResizeTextarea = () => { // ÐЫÐÐСТРРÐÐÐÐÐÐ 2897 if (!textarea.length) { 2898 return; 2899 } 2900 2901 textarea.forEach((el) => { 2902 el.classList.add('is-initialized'); 2903 el.style.overflow = 'hidden'; 2904 el.style.resize = 'none'; 2905 resizeHeight(el); 2906 2907 el.addEventListener('input', () => { 2908 resizeHeight(el); 2909 }); 2910 2911 const form = el.closest('form'); 2912 2913 if (form) { 2914 form.addEventListener('submit', () => { 2915 resizeHeight(el); 2916 }); 2917 } 2918 }); 2919 2920 window.addEventListener('resize', () => { 2921 textarea.forEach((el) => { 2922 resizeHeight(el); 2923 }); 2924 }); 2925}; 2926initAutoResizeTextarea(); 2927resizeHeight(); 2928// export { initAutoResizeTextarea, resizeHeight }; 2929 2930 2931// авÑоÑеÑайз textarea -- ÐºÐ¾Ð½ÐµÑ --
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.