PageSourceSearch

https://www.barrier.ru/local/templates/barrier/js/barrier.js?176364764356445

js barrier.ru collected 2026-09-24 11:48:50 UTC 56,445 bytes, 2,078 lines download raw bytes

1(function ($) {
2	var BAARRIER = (function () {
3
4		var $sel = {};
5		$sel.window = $(window);
6		$sel.html = $("html");
7		$sel.body = $("body", $sel.html);
8		$sel.page = $(".page", $sel.html);
9
10		return {
11			init: function () {
12				var self = this;
13
14
15				self.mobile.init();
16
17				self.navigation.init();
18
19				self.header.init();
20				self.footer.init();
21
22				self.popups.init();
23
24				$.mask.definitions['x']='[A-Za-z0-9]';
25				self.forms.init();
26				self.tooltips.init();
27
28				self.catalog.init();
29				self.filter.init();
30				self.pager.init();
31
32				self.toggles.init();
33
34
35				self.tabs.init();
36				self.accordion.init();
37
38				self.basket.init();
39				//self.order.init();
40
41				self.stars.init();
42
43				self.animation.init();
44
45				//self.interest.init();
46				self.points.init();
47				self.typing.init();
48			},
49
50			typing: {
51				init: function () {
52					if (!$(".typing").length) {
53						return false;
54					}
55					var s = $(".typing em").data("strings"),
56						t = new TypeIt(".typing em", {
57							speed: 100,
58							loop: true
59						});
60					for (var i = 0; i < s.length; i++) {
61						t.type(s[i], {delay: 700});
62						t.delete(s[i].length);
63					}
64					t.go();
65				}
66			},
67
68			points: {
69				init: function () {
70					if (!$(".points").length || $sel.window.width() < 990) {
71						return false;
72					}
73					var xPos = $(".points-img", $sel.page).offset().left,
74						yPos = $(".points-img", $sel.page).offset().top,
75						$mouse = $(".point-mouse", $sel.page);
76					$(".points-img", $sel.page).on("mousemove", function (e) {
77						$mouse.addClass("active");
78						$mouse.css({
79							left: e.pageX - xPos,
80							top: e.pageY - yPos
81						});
82					}).on("mouseleave", function () {
83						$mouse.removeClass("active");
84					});
85				}
86			},
87
88
89			toggles: {
90				init: function () {
91					$("[data-toggle]").on("click", function (e) {
92						e.preventDefault();
93						$($(this).data("toggle")).toggle();
94					});
95				}
96			},
97
98
99			interest: {
100				init: function () {
101					if (!Cookies.get("DISPLAY_INTEREST")) {
102						Cookies.set('DISPLAY_INTEREST', 'Y', {
103							expires: 1,
104							path: '/'
105						});
106
107						$.magnificPopup.open(
108							$.extend({}, BAARRIER.popups.params, {
109								items: {
110									src: "#personal-popup",
111									type: "inline"
112								},
113								mainClass: "mfp-fade",
114								removalDelay: 300
115							})
116						);
117					}
118				}
119			},
120
121
122			stars: {
123				init: function () {
124					$(".stars", $sel.body).each(function () {
125						var $item = $(this),
126							count = parseFloat($item.data("count")),
127							$stars = '';
128
129						for (var i = 0; i < 4; i++) {
130							$stars += '<div class="star-item ' + (i < count ? "active" : '') + '"></div>';
131						}
132						$stars += '<div class="star-item ' + (count == 5 ? "active" : (count > 4 ? 'half' : '')) + '"></div>';
133						$item.append($stars);
134					});
135				}
136			},
137
138
139			common: {
140				go: function (topPos, speed, callback) {
141					var curTopPos = $sel.window.scrollTop(),
142						diffTopPos = Math.abs(topPos - curTopPos);
143					$sel.body.add($sel.html).animate({
144						"scrollTop": topPos
145					}, speed, function () {
146						if (callback) {
147							callback();
148						}
149					});
150				}
151			},
152
153
154			navigation: {
155				$menu: null,
156				$holder: null,
157				$currentItem: null,
158				$currentNav: null,
159
160				showTimer: false,
161				hideTimer: false,
162
163				init: function () {
164					var self = this;
165
166					self.$holder = $("#header-nav", $sel.body);
167					self.$menu = $(".main-menu", $sel.body);
168
169					$(".main-menu-item", $sel.body).on("mouseenter click", function (e) {
170						let $link = $(this);
171						if(!$link.hasClass('single')){
172							e.preventDefault();
173							clearTimeout(self.showTimer);
174							clearTimeout(self.hideTimer);
175							self.showTimer = setTimeout(function () {
176								if ($link.data("nav")) {
177									clearTimeout(self.hideTimer);
178									self.show($link, $($link.data("nav")));
179								} else {
180									self.hide();
181								}
182							}, 150);
183						}
184					});
185					self.$menu.on("mouseleave", function () {
186						clearTimeout(self.showTimer);
187						self.hideTimer = setTimeout(function () {
188							self.hide();
189						}, 250);
190					});
191
192					self.$holder.on("mouseenter", function () {
193						clearTimeout(self.hideTimer);
194					});
195					self.$holder.on("mouseleave", function () {
196						self.hideTimer = setTimeout(function () {
197							self.hide();
198						}, 250);
199					});
200
201				},
202
203				show: function ($item, $menu) {
204					var self = this;
205
206					if (self.$currentItem && self.$currentItem.data("nav") == $item.data("nav")) {
207						return false;
208					}
209
210					if (self.$currentItem) {
211						self.$currentItem.removeClass("active");
212					}
213					if (self.$currentNav) {
214						self.$currentNav.removeClass("show").addClass("removed");
215						$menu.css("display", "block");
216						(function ($nav) {
217							setTimeout(function () {
218								$nav.css("display", "none").removeClass("removed");
219							}, 300);
220						})(self.$currentNav);
221					}
222
223					$item.addClass("active");
224
225					self.$holder.css("display", "block");
226					setTimeout(function () {
227						self.$holder.addClass("show");
228						$menu.css("display", "block");
229						setTimeout(function () {
230							$menu.addClass("show");
231						}, 50);
232					}, 50);
233
234					self.$currentItem = $item;
235					self.$currentNav = $menu;
236
237				},
238
239				hide: function () {
240					var self = this;
241
242					if (!self.$currentItem) {
243						return false;
244					}
245
246					self.$currentItem.removeClass("active");
247					self.$currentNav.removeClass("show").addClass("removed-all");
248					(function ($nav) {
249						setTimeout(function () {
250							$nav.css("display", "none").removeClass("removed-all");
251							self.$holder.removeClass("show");
252							setTimeout(function () {
253								self.$holder.css("display", "none");
254							}, 250);
255						}, 220);
256					})(self.$currentNav);
257
258					self.$currentItem = null;
259					self.$currentNav = null;
260
261				}
262
263			},
264
265
266			pager: {
267				init: function () {
268					$sel.page.on("click", ".load-more", function (e) {
269						var $link = $(this);
270						(function ($link, href, $container, selector, callback) {
271							$link.addClass("loading");
272							$.ajax({
273								url: href,
274								data: {
275									"IS_AJAX": "Y"
276								},
277								success: function (data) {
278									var $data = $('<div />').append(data),
279										$items = $data.find(selector).not(".catalog-item--compact"),
280										$preloader = $data.find(".catalog-more-holder");
281
282									$items.addClass("loaded-item loaded-item--hidden");
283									$link.closest(".catalog-more-holder").remove();
284
285									$container.append($items);
286									if ($preloader && $preloader.length) {
287										$container.append($preloader);
288									}
289									setTimeout(function () {
290										$container.find(".loaded-item--hidden").removeClass("loaded-item--hidden").addClass("loaded-item--visible");
291									}, 50);
292
293									BAARRIER.catalog.showHideItems($container);
294
295									BAARRIER.animation.wow.prepare();
296									BAARRIER.animation.wow.check(false, true);
297									BAARRIER.popups.init();
298								}
299							});
300						}
300)($link, $link.attr("href"), $($link.data("container")), $link.data("itemsselector"))
301
302						e.preventDefault();
303					});
304				}
305			},
306
307
308			filter: {
309				outTimer: null,
310				$filter: null,
311				$tabs: null,
312				$content: null,
313				$headings: null,
314
315				$currentHeading: null,
316				$currenTab: null,
317
318				brands: {
319					itemWidth: 250,
320					rowsCount: 7
321				},
322
323				all: {
324					itemWidth: 250,
325					rowsCount: 7,
326					minItems: 21
327				},
328
329				init: function () {
330					var self = this;
331
332					self.$toolbar = $(".catalog-toolbar-items", $sel.page);
333
334
335					if (!self.$toolbar.length) {
336						return false;
337					}
338
339					/*	self.$filter = $(".filter", $sel.page);
340						self.$headings = $(".filter-heading-item", self.$filter);
341						self.$content = $(".filter-content", $sel.page);
342						self.$tabs = $(".filter-content-item", self.$page);
343	*/
344					self.$filter = $(document).find(".filter");
345					self.$headings = $(document).find(".filter-heading-item");
346					self.$content = $(document).find(".filter-content");
347					self.$tabs = $(document).find(".filter-content-item");
348
349
350					self.tabs();
351
352					self.price();
353
354					self.handle();
355
356
357					(function ($content, $toolbar) {
358						$(document).ready(function () {
359							$content.css("top", $toolbar.position().top + $toolbar.height());
360						});
361					})(self.$content, self.$toolbar);
362
363
364					$(".page-heading-filter-item", $sel.page).on("click", function (e) {
365						e.preventDefault();
366
367						var $item = $(this);
368
369						if ($item.hasClass("page-heading-filter-item--clear")) {
370							$item.siblings().fadeOut(250);
371						}
372						$item.fadeOut(300);
373
374					});
375				},
376
377				tabs: function () {
378					var self = this;
379
380
381					self.$headings.on("mouseover click", function (e) {
382						e.stopPropagation();
383
384						self.$content.css("top", self.$toolbar.position().top + self.$toolbar.height());
385
386						clearTimeout(self.outTimer);
387
388						var $heading = $(this),
389							$tab = self.$tabs.filter($heading.data("filter"));
390
391						// Заголовки фильтра
392						self.$headings.removeClass("active");
393						$heading.addClass("active");
394						self.$currentHeading = $heading;
395
396						// Содержимое таба
397						self.$currenTab = $tab;
398
399						// Обработка случая брендов
400						if (self.$currenTab.hasClass("filter-content-item--brands") && !self.$currenTab.hasClass("make")) {
401							setBrandsFilter();
402						}
403
404						// Обработка случая других фильтров
405						if (self.$currenTab.hasClass("filter-content-item--all") && !self.$currenTab.hasClass("make")) {
406							setAllFilter();
407						}
408
409						// Показ таба
410						let addLeft = $heading.closest('.catalog-filters').scrollLeft();
411						self.$tabs.removeClass("active");
412						self.$currenTab.css("left", (self.$currenTab.hasClass("filter-content-item--fullwidth") ? 0 : $heading.position().left - addLeft)).addClass("active");
413					});
414
415
416					self.$headings.add(self.$tabs).on("mouseleave", function () {
417						self.outTimer = setTimeout(function () {
418							self.$headings.removeClass("active");
419							self.$tabs.removeClass("active");
420						}, 500);
421					});
422
423
424					// Обработка сторонних кликов
425					self.$tabs.on("click", function (e) {
426						//e.preventDefault();
427						e.stopPropagation();
428					}).on("mouseover", function () {
429						clearTimeout(self.outTimer);
430					});
431					$sel.window.on("click", function () {
432						if (self.$currentHeading && self.$currenTab) {
433							self.$currentHeading.removeClass("active");
434							self.$currenTab.removeClass("active");
435						}
436					});
437
438
439					// Формирование фильтра брендов
440					function setBrandsFilter() {
441						var $rows = self.$currenTab.find(".brands-indexes-rows"),
442							$items = $rows.find(".brands-index-row-items");
443						$items.each(function () {
444							var $item = $(this),
445								$itemRows = $item.find(".filter-row"),
446								itemColsCount = Math.ceil($itemRows.length / self.brands.rowsCount),
447								itemWidth = parseInt(itemColsCount * self.brands.itemWidth);
448							$item.css({
449								"column-count": itemColsCount,
450								"width": itemWidth
451							});
452						});
453
454						var $scroll = self.$currenTab.find(".brands-indexes-scroll");
455						if ($scroll.data("scroll")) {
456							$scroll.data("scroll").recalculate();
457						} else {
458							$scroll.data("scroll", new SimpleBar($scroll[0], {
459								autoHide: false
460							}));
461						}
462
463						$(".brands-letters-item", self.$currenTab).on("click", function (e) {
464							e.preventDefault();
465
466							var $block = self.$currenTab.find(".brands-index-row[data-letter='" + $(this).data("letter") + "']");
467							$scroll.data("scroll").getScrollElement().scrollTo($block.position().left, 0);
468							$block.addClass("blink");
469							setTimeout(function () {
470								$block.removeClass("blink");
471							}, 1500);
472						});
473
474						// Флаг инициализации фильтра
475						self.$currenTab.addClass("make");
476					}
477
478
479					// Формирование фильтра "Другие"
480					function setAllFilter() {
481						var $innerTabs = self.$currenTab.find(".filter-inner-tabs");
482
483						// Скролл для списка внутренних табов
484						new SimpleBar($innerTabs.find(".scrollable-tabs")[0], {
485							autoHide: false
486						});
487
488						// Клик по внутреннему табу
489						$(".filter-inner-tab-item", self.$currenTab).on("click", function () {
490							$(".filter-inner-tab-item", self.$currenTab).removeClass("active");
491							$(".filter-inner-content-item", self.$currenTab).removeClass("active");
492
493							var $item = $(this);
494							$item.addClass("active");
495							$($item.data("innertab")).addClass("active");
496							makeScroll();
497						});
498
499						makeScroll();
500
501						// Скролл для контента внутренних табов
502						function makeScroll() {
503							var $content = self.$currenTab.find(".filter-inner-content-item.active");
504							if (!$content.data("scroll")) {
505								var $rowsHolder = $content.find(".filter-rows"),
506									$rows = $rowsHolder.find(".filter-row");
507								if ($rows.length <= self.all.minItems) {
508									$content.data("scroll", "no");
509								} else {
510									var columnCount = Math.ceil($rows.length / self.all.rowsCount);
511									$rowsHolder.css({
512										"width": (columnCount * self.all.itemWidth),
513										"column-count": columnCount
514									});
515									$content.data("scroll", new SimpleBar($content.find(".scrollable-content")[0], {
516										autoHide: false
517									}));
518								}
519
520							} else if ($content.data("scroll") != "no") {
521								$content.data("scroll").recalculate();
522							}
523						}
524
525						// Флаг инициализации фильтра
526						self.$currenTab.addClass("make");
527					}
528
529				},
530
531				handle: function () {
532					var self = this;
533
534					$("input:checkbox", self.$content).on("change", function (e) {
535						var $holder = $(this).closest(".filter-content-item"),
536							$heading = self.$headings.filter("[data-filter='#" + $holder.attr("id") + "']");
537						if ($holder.find("input:checked").length) {
538							$heading.addClass("selected");
539						} else {
540							$heading.removeClass("selected");
541						}
542					});
543
544					$(".form-item--range", self.$content).on("change input", function (e, u) {
545						var $holder = $(this).closest(".filter-content-item"),
546							$heading = self.$headings.filter("[data-filter='#" + $holder.attr("id") + "']"),
547							$range = $(this);
548						if ($range[0].valueLow + "," + $range[0].valueHigh != $range.data("value")) {
549							$heading.addClass("selected");
550						} else {
551							$heading.removeClass("selected");
552						}
553					});
554				},
555
556				price: function () {
557					var self = this;
558
559					$(".filter-price", $sel.filter).each(function () {
560						(function ($priceFilter) {
561							$(".form-item--range", $priceFilter).on("change input", function (e, u) {
562								syncPriceFilter("slider", $priceFilter);
563							});
564							$(".filter-price-field", $priceFilter).on("change", function () {
565								syncPriceFilter("field", $priceFilter);
566							});
567
568							syncPriceFilter("field", $priceFilter);
569						})($(this));
570					});
571
572					function syncPriceFilter(source, $priceFilter) {
573						var $from = $(".filter-price-field--from", $priceFilter),
574							$to = $(".filter-price-field--to", $priceFilter),
575							$range = $(".form-item--range", $priceFilter),
576							rangeMin = parseInt($range.attr("min")),
577							rangeMax = parseInt($range.attr("max")),
578							fromVal, toVal;
579
580						if (source == "slider") {
581							fromVal = $range[0].valueLow,
582								toVal = $range[0].valueHigh;
583						} else if (source == "field") {
584							fromVal = $from.val().replace(/ /g, ""),
585								toVal = $to.val().replace(/ /g, "");
586
587							if (fromVal >= rangeMax || fromVal <= rangeMin) {
588								fromVal = rangeMin;
589							}
590
591							if (toVal >= rangeMax || toVal <= rangeMin) {
592								toVal = rangeMax;
593							}
594
595							var inst = jcf.getInstance($range);
596							if (inst) {
597								inst.values = [fromVal, toVal];
598								inst.refresh();
599							}
600						}
601
602						$from.val(formatValue(fromVal));
603						$to.val(formatValue(toVal));
604					}
605
606					function formatValue(value) {
607						var strValue = value.toString(),
608							formatStrValue = [];
609						for (var len = strValue.length, i = len, j = 0; i >= 0; i--) {
610							formatStrValue.push(strValue[i]);
611							if (j == 3) {
612								formatStrValue.push(' ');
613								j = 0;
614							}
615							j++;
616						}
617						return formatStrValue.reverse().join("");
618					}
619				}
620			},
621
622
623			catalog: {
624				init: function () {
625					var self = this;
626
627					self.separator();
628					self.slider();
629					self.product();
630					self.sections();
631					self.sorter();
632					self.showHideItems();
633				},
634
635				sorter: function () {
636					$(".catalog-toolbar-sorter", $sel.page).on("click", function (e) {
637						e.stopPropagation();
638						$(this).toggleClass("active");
639					});
640					$sel.window.on("click", function () {
641						$(".catalog-toolbar-sorter", $sel.page).removeClass("active");
642					});
643				},
644
645				separator: function () {
646					$(".catalog-separator", $sel.page).each(function () {
647						var $s = $(this),
648							params = $s.data("params"),
649							$str = '';
650						for (var i = 0; i < 20; i++) {
651							for (var j = 0; j < params.items.length; j++) {
652								$str += '<' + params.items[j].tag + '>' + params.items[j].text + '</' + params.items[j].tag + '>';
653							}
654						}
655						$s.append($str);
656					});
657				},
658
659				sections: function () {
660					$(".sections-slider", $sel.page).slick({
661						slidesToShow: 10,
662						slidesToScroll: 10,
663						dots: false,
664						arrows: true,
665						infinite: false,
666						autoplay: false,
667						speed: 700,
668						responsive: [
669							{
670								breakpoint: 1000,
671								settings: {
672									slidesToShow: 3.2,
673									slidesToScroll: 3,
674									arrows: false,
675									speed: 200
676								}
677							}
678						]
679					})
680				},
681
682				slider: function () {
683					$(".catalog-items--slider", $sel.page).each(function () {
684						var $s = $(this),
685							params = $s.data("params");
686
687						$s.slick($.extend({}, {
688							slidesToShow: 6,
689							slidesToScroll: 5,
690							dots: false,
691							arrows: true,
692							infinite: false,
693							autoplay: false,
694							speed: 800,
695							responsive: [
696								{
697									breakpoint: 1000,
698									settings: {
699										slidesToShow: 1.5,
700										slidesToScroll: 1,
701										arrows: false,
702										speed: 200
703									}
704								}
705							]
706						}, params));
707					});
708				},
709
710				showHideItems: function ($container) {
711					if (!$container) {
712						$container = $sel.body;
713					}
714					var currentItemsCount = 0;
715					$(".catalog-item", $container).each(function () {
716						var $item = $(this);
717						if ($item.hasClass("catalog-item--small")) {
718							currentItemsCount++;
719						} else {
720							currentItemsCount = 0;
721						}
722						if (currentItemsCount == 4) {
723							$item.addClass("laptop-hide");
724							currentItemsCount = 0;
725						}
726					});
727				},
728
729				product: function () {
730					if (!$(".card", $sel.page).length) {
731						return false;
732					}
733
734
735					$(".card-photos-nav").on("init", function (e, s) {
736						s.$slides.on("click", function () {
737							s.$slides.removeClass("current");
738							$(".card-photos").slick("slickGoTo", s.$slides.index($(this)));
739						});
740					}).slick({
741						slidesToShow: 3,
742						slidesToScroll: 1,
743						arrows: true,
744						infinite: false,
745						dots: false,
746						swipeToSlide: true,
747						focusOnSelect: true,
748						swipe: false,
749						vertical: true,
750						responsive: [
751							{
752								breakpoint: 960,
753								settings: {
754									slidesToShow: 3,
755									slidesToScroll: 1,
756									swipe: true
757								}
758							}
759						]
760					});
761
762					$(".card-photos").on("init", function (e, s) {
763						$($(".card-photos-nav").slick("getSlick").$slides[0]).addClass("current");
764					}).on("beforeChange", function (e, s, curSlide, nextSlide) {
765						$(".card-photos-nav").slick("getSlick").$slides.removeClass("current");
766						$($(".card-photos-nav").slick("getSlick").$slides[nextSlide]).addClass("current");
767						$(".card-photos-nav").slick("slickGoTo", nextSlide);
768
769						$(".card-popup-photos").slick("slickGoTo", nextSlide);
770
771					}).slick({
772						slidesToShow: 1,
773						slidesToScroll: 1,
774						dots: true,
775						arrows: false,
776						infinite: false
777					});
778
779
780					$(".card-popup-photos").on("beforeChange", function (e, s, curSlide, nextSlide) {
781						var slideId = $(s.$slides[nextSlide]).data("id");
782						$(".card-popup-toolbar-item").removeClass("active");
783						$(".card-popup-toolbar-item[data-id='" + slideId + "']").addClass("active");
784						$(".card-popup-photos-nav-item[data-id='" + slideId + "']").addClass("active");
785					}).slick({
786						slidesToShow: 1,
787						slidesToScroll: 1,
788						dots: false,
789						arrows: true,
790						infinite: false,
791						responsive: [
792							{
793								breakpoint: 990,
794								settings: {
795									arrows: false
796								}
797							}
798						]
799					});
800					$(".card-popup-toolbar-item, .card-popup-photos-nav-item").on("click", function (e) {
801						e.preventDefault();
802						$(".card-popup-photos").slick("slickGoTo", $(".card-popup-photo-item[data-id='" + $(this).data("id") + "']").index());
803					});
804
805
806					$(".anchor", $sel.page).on("click", function () {
807						BAARRIER.common.go($($(this).attr("href"), $sel.body).offset().top - 150);
808					});
809
810					$(".features + a.toggle").on("click", function (e) {
811						e.preventDefault();
812						$(this).prev("ul").find("li.hide").removeClass("hide");
813						$(this).remove();
814					});
815
816
817					/*
818					var $holder = $(".product-info-holder", $sel.body),
819						holderTop = $holder.offset().top,
820						holderBottom = holderTop + $holder.height();
821					function checkScroll() {
822						var sTop = $sel.window.scrollTop();
823						if(sTop > holderTop && sTop < holderBottom) {
824							$sel.body.addClass("show-scroll");
825						} else {
826							$sel.body.removeClass("show-scroll");
827						}
828					}
829
830					checkScroll();
831					$sel.window.on("scroll", function() {
832						checkScroll();
833					});
834					*/
835				}
836			},
837
838
839			basket: {
840				init: function () {
841					var self = this;
842
843					self.actions();
844
845					$(".basket-row-remove", $sel.page).on("click", function () {
846						$(this).closest(".basket-row").slideUp(300, function () {
847							if ($(".basket-items .basket-row:visible").length == 0) {
848								window.location = "/personal/cart/";
849							}
850						});
851					});
852				},
853				actions: function () {
854					$(document).on("click", ".order-aside-action-item", function (e) {
855						e.preventDefault();
856						$($(this).data("dest")).toggle();
857					});
858				}
859			},
860
861
862			order: {
863				$order: null,
864
865				init: function () {
866					var self = this;
867
868					self.$order = $(".order", self.$page);
869
870					self.delivery();
871
872					self.basket();
873
874					if (window.ymaps && window.ymaps !== undefined) {
875						ymaps.ready(function () {
876							self.maps.init();
877						});
878					}
879				},
880
881				delivery: function () {
882					var self = this;
883
884					$(".order-delivery-item-radio:checked", self.$order).closest(".order-delivery-item").addClass("active");
885
886					$(".order-delivery-item-radio", self.$order).on("change", function () {
887						setTimeout(function () {
888							jcf.destroyAll(self.$order.find(".delivery-tab.active"));
889							jcf.replaceAll(self.$order.find(".delivery-tab.active"));
890						}, 200);
891						setTimeout(function () {
892							self.$order.find(".delivery-tab.active .delivery-map-select-item").each(function () {
893								var $ditem = $(this);
894								$ditem.data("offsetTop", $ditem.position().top);
895							});
896						}, 250);
897					});
898
899					setTimeout(function () {
900						self.$order.find(".delivery-tab.active .delivery-map-select-item").each(function () {
901							var $ditem = $(this);
902							$ditem.data("offsetTop", $ditem.position().top);
903						});
904					}, 250);
905
906
907					$(".order-delivery-mobile-item .form-item--radio", $sel.page).on("change", function () {
908						$(".order-delivery-mobile-item", $sel.page).removeClass("active");
909						$(this).closest(".order-delivery-mobile-item").addClass("active");
910					});
911				},
912
913				basket: function () {
914					$(".basket-item-remove", $sel.page).on("click", function (e) {
915						e.preventDefault();
916						var $holder = $(this).closest(".basket-item").slideUp();
917					});
918				},
919
920				maps: {
921					placemarkIconGray: {
922						iconLayout: "default#image",
923						iconImageHref: "../i/map_icon.png",
924						iconImageSize: [40, 40],
925						iconImageOffset: [-20, -40]
926					},
927					placemarkIconBlue: {
928						iconLayout: "default#image",
929						iconImageHref: "../i/map_icon_active.png",
930						iconImageSize: [54, 54],
931						iconImageOffset: [-27, -54]
932					},
933					placemarkIconPost: {
934						preset: "islands#icon",
935						iconColor: "#153B6E",
936					},
937					placemarkIconPostActive: {
938						preset: "islands#icon",
939						iconColor: "#E9534E",
940					},
941					init: function () {
942						var self = this,
943							isMobile = $sel.window.width() < 1000 ? true : false;
944
945						$(".delivery-map-yandex", $sel.page).each(function () {
946							(function ($map) {
947								var yMap = false,
948									info = $map.data("info"),
949									$holder = $map.closest(".delivery-map"),
950									$title = $holder.find(".delivery-map-selected"),
951									$titleMobile = $($map.data("mobiletitle")),
952									isCluster = info.cluster;
953
954								yMap = new ymaps.Map($map[0], {
955									center: eval(info.center),
956									zoom: info.zoom
957								});
958								yMap.behaviors.disable("scrollZoom");
959								yMap.controls.remove("trafficControl").remove("scaleLine").remove("typeSelector").remove("searchControl");
960
961
962								if (!isCluster) {
963									var yPoints = new ymaps.GeoObjectCollection(null, {});
964								} else {
965									var yPoints = new ymaps.Clusterer(null, {});
966								}
967
968								for (var i = 0; i < info.points.length; i++) {
969									var point = info.points[i];
970									yPoints.add(new ymaps.Placemark(
971										eval(point.coords),
972										{
973											id: point.id,
974											title: point.title,
975											balloonContent: isMobile ? '<div class="map-baloon page-text page-text--small">' + point.balloon + '<p>&nbsp;</p><span class="delivery-point-btn btn btn--small btn--black" data-point="' + point.id + '">Выбрать</span>' + '</div>' : ''
976										},
977										(isCluster ? self.placemarkIconPost : self.placemarkIconGray)
978									));
979								}
980
981								yMap.geoObjects.add(yPoints);
982
983
984								if (isMobile) {
985									$sel.body.on("click", ".delivery-point-btn", function () {
986										handlePointClick($(this).data("point"));
987									});
988								} else {
989									yPoints.events.add("click", function (e) {
990										var placemark = e.get("target");
991										handlePointClick(placemark.properties.get("id"));
992									});
993								}
994
995
996								function handlePointClick(pointId) {
997									var $radio = $(".delivery-map-select-item-radio[value='" + pointId + "']", $holder);
998
999									if (!$radio.length) {
1000										return false;
1001									}
1002
1003									var $radioLabel = $radio.closest(".delivery-map-select-item");
1004									radioTop = $radioLabel.data("offsetTop");
1005
1006
1007									$radio.trigger("click");
1008
1009									if (!$radioLabel.hasClass("jcf-label-active")) {
1010										$holder.find(".jcf-scrollable").scrollTop(radioTop);
1011										jcf.refresh($holder);
1012									}
1013
1014									$.magnificPopup.close();
1015								}
1016
1017								$(".delivery-map-select-item-radio", $holder).on("change", function () {
1018									setPoint($(this).val());
1019								});
1020
1021								function setPoint(pointId) {
1022									$title.hide();
1023									$titleMobile.hide();
1024
1025									if (isCluster) {
1026										var yPointsList = yPoints.getGeoObjects();
1027										for (var i = 0; i < yPointsList.length; i++) {
1028											setPointState(yPointsList[i], pointId);
1029										}
1030									} else {
1031										yPoints.each(function (p) {
1032											setPointState(p, pointId);
1033										});
1034									}
1035								}
1036
1037								function setPointState(p, pointId) {
1038									if (p.properties.get("id") == pointId) {
1039										$title.show().find("span").html(p.properties.get("title"));
1040										$titleMobile.show().find("span").html(p.properties.get("title"));
1041										p.options.set((isCluster ? self.placemarkIconPostActive : self.placemarkIconBlue));
1042									} else {
1043										p.options.set((isCluster ? self.placemarkIconPost : self.placemarkIconGray));
1044									}
1045								}
1046
1047							})($(this));
1048						});
1049
1050
1051					}
1052				}
1053			},
1054
1055
1056			popups: {
1057				params: {
1058					type: "ajax",
1059					mainClass: "mfp-fade",
1060					removalDelay: 300,
1061					tClose: "Закрыть (ESC)",
1062					tLoading: "Загрузка...",
1063					callbacks: {
1064						beforeOpen: function () {
1065							$(".mobile-nav-holder .mobile-close", $sel.body).trigger("click");
1066						},
1067						ajaxContentAdded: function () {
1068							BAARRIER.forms.customize($(this.container));
1069							BAARRIER.forms.validation($(this.container));
1070						},
1071						open: function () {
1072
1073							if ($(this.container).find("#question-popup form").length > 0){
1074								curr = Number($(this.container).find("form #validate").val());
1075								time = Number(new Date().getHours());
1076
1077								$(this.container).find("#question-popup form #validate").val(curr+"_"+time+"_"+(curr+time))
1078							}
1079
1080							BAARRIER.forms.customize($(this.container));
1081							BAARRIER.forms.validation($(this.container));
1082							BAARRIER.tooltips.init($(this.container));
1083
1084							if ($(this.content).hasClass("card-popup")) {
1085								$(this.content).find(".card-popup-photos").slick("setPosition");
1086
1087							}
1088						},
1089						change: function () {
1090
1091						}
1092					},
1093					fixedContentPos: true,
1094					overflowY: "scroll"
1095				},
1096				init: function ($container) {
1097					var self = this;
1098
1099					if (!$container) {
1100						var $container = $sel.body;
1101					}
1102					$("[data-popup]", $container).each(function () {
1103						(function ($p) {
1104							var params = $p.data("popup");
1105							$p.magnificPopup($.extend({}, self.params, params));
1106						})($(this));
1107					});
1108
1109					$sel.body.on("click", ".popup-close", function (e) {
1110						e.preventDefault();
1111						$(this).closest(".mfp-content").find(".mfp-close").click()
1112					});
1113				}
1114			},
1115
1116
1117			accordion: {
1118				$opened: false,
1119				init: function () {
1120					var self = this;
1121					$(".faq-item-heading").on("click", function () {
1122						var $item = $(this).closest(".faq-item");
1123						if ($item.hasClass("opened")) {
1124							self.hide($item);
1125							return false;
1126						}
1127						if (self.$opened) {
1128							self.hide(self.$opened);
1129						}
1130						self.show($item);
1131
1132						setTimeout(function () {
1133							//BAARRIER.common.go($item.offset().top - 50, 300);
1134						}, 250);
1135					});
1136				},
1137				show: function ($item) {
1138					var self = this,
1139						$content = $item.find(".faq-item-content");
1140					$item.addClass("opened");
1141					$content.css("display", "block");
1142					(function ($content) {
1143						setTimeout(function () {
1144							$content.addClass("show")
1145						}, 50);
1146					})($content);
1147					self.$opened = $item;
1148
1149
1150				},
1151				hide: function ($item) {
1152					var self = this,
1153						$content = $item.find(".faq-item-content");
1154					$item.removeClass("opened");
1155					$content.removeClass("show");
1156					(function ($content) {
1157						setTimeout(function () {
1158							$content.css("display", "none");
1159						}, 200);
1160					})($content);
1161
1162					self.$opened = false;
1163				}
1164			},
1165
1166
1167			tabs: {
1168				init: function () {
1169					var self = this;
1170
1171					$sel.body.on("click", "[data-tab]", function(e) {
1172						var $tabItem = $(this);
1173						if($tabItem.hasClass("active")) {
1174							return false;
1175						}
1176
1177						var $tabItems = $("[data-tabs='" + $tabItem.data("tabs") + "']", $sel.body),
1178							$tabContent = $($tabItem.data("tab"), $sel.body),
1179							$tabs = $($tabItem.data("tabs"), $sel.body);
1180						$tabItems.removeClass("active");
1181						$tabItem.addClass("active");
1182
1183						var $activeTab = $tabs.filter(".active");
1184						$activeTab.removeClass("active").attr("disabled", "disabled");
1185						$tabContent.addClass("active").removeAttr("disabled");
1186					});
1187
1188
1189					$(".open-tab[data-tab]").on("click", function (e) {
1190						e.preventDefault();
1191
1192						var $item = $(this),
1193							$tab = $(".tab-heading-item[data-tab='" + $item.data("tab") + "']");
1194
1195						BAARRIER.common.go($tab.offset().top);
1196						$tab.trigger("click");
1197
1198					});
1199				}
1200			},
1201
1202
1203			tooltips: {
1204				init: function ($container) {
1205					if (!$container) {
1206						$container = $sel.page;
1207					}
1208					$("[data-tooltip]", $container).each(function () {
1209						var $item = $(this),
1210							params = $item.data("tooltip");
1211
1212						$item.tooltipster($.extend({
1213							content: (params.dest ? $(params.dest) : $item.attr("title")),
1214							contentAsHTML: true,
1215							animation: "fade",
1216							animationDuration: 100,
1217							arrow: true,
1218							interactive: true,
1219							side: "top",
1220							trigger: "custom",
1221							triggerOpen: {
1222								mouseenter: true,
1223								click: true,
1224								tap: true
1225							},
1226							triggerClose: {
1227								click: true,
1228								mouseleave: true,
1229								touchleave: true
1230							}
1231						}, params));
1232					});
1233				}
1234			},
1235
1236
1237			forms: {
1238				init: function () {
1239					var self = this;
1240
1241
1242					self.customize();
1243					self.validation();
1244
1245					self.captcha.init();
1246				},
1247
1248				captcha: {
1249					loaded: false,
1250					init: function () {
1251						var self = this;
1252
1253						$(".form-captcha-reload", $sel.page).on("click", function () {
1254							var $reload = $(this),
1255								$holder = $(this).closest(".form-captcha"),
1256								$img = $holder.find("img");
1257
1258							self.reload($reload.data("href"), $img);
1259						});
1260					},
1261
1262					reload: function (captchaUrl, $img) {
1263						var self = this;
1264
1265						if (self.loaded) {
1266							return false;
1267						}
1268
1269						$.ajax({
1270							url: captchaUrl,
1271							dataType: "json",
1272							complete: function () {
1273								self.loaded = false;
1274							},
1275							success: function (data) {
1276								$img.attr("src", data.img);
1277							}
1278						});
1279					}
1280				},
1281
1282				customize: function ($container) {
1283					if (!$container) {
1284						$container = $sel.body;
1285					}
1286
1287					jcf.replace($(".form-item--number", $container));
1288
1289					jcf.replace($(".form-item--checkbox", $container));
1290
1291					jcf.replace($(".form-item--radio", $container));
1292
1293					jcf.replace($(".form-item--range", $container));
1294
1295					jcf.replace($(".form-item--number", $container));
1296
1297					jcf.replace($(".jcf-scrollable", $container));
1298
1299					$(".form-item--calendar", $container).each(function () {
1300						var $calendar = $(this);
1301
1302						$calendar.datepicker({
1303							autoClose: true
1304						});
1305					});
1306
1307					$(".form-item--file", $container).each(function () {
1308						(function ($file) {
1309							var $holder = $file.closest(".form-file-holder"),
1310								$items = $holder.find(".form-file-items");
1311							$file.fileupload({
1312								dataType: "json",
1313								done: function (e, data) {
1314									var $files = "";
1315
1316									$.each(data.result.files, function (index, file) {
1317										$files += '<div class="form-file-item"><div class="form-file-item-title">' + file.name + '</div></div>'
1318									});
1319									$items.empty().append($files);
1320								}
1321							});
1322						})($(this));
1323
1324					});
1325
1326					// Select
1327					jcf.setOptions("Select", {
1328						wrapNative: false,
1329						wrapNativeOnMobile: false,
1330						maxVisibleItems: 6
1331					});
1332					$(".form-item--select", $container).each(function () {
1333						var $select = $(this);
1334
1335						if ($select.attr("placeholder")) {
1336							$select.prepend('<option class="hideme" selected>' + $select.attr("placeholder") + '</option>');
1337						}
1338						jcf.replace($select);
1339					});
1340
1341					$(document).on("click", ".password-show",function (e) {
1342						e.preventDefault();
1343
1344						var $toggle = $(this),
1345							$field = $toggle.closest(".form-item-holder").find("input");
1346
1347						$toggle.toggleClass("show");
1348						$toggle.hasClass("show") ? $field.attr("type", "text") : $field.attr("type", "password");
1349					});
1350
1351
1352					$(".form-item--autocomplete", $container).each(function () {
1353						var $item = $(this),
1354							params = $item.data("autocomplete");
1355
1356
1357						$item.autocomplete({
1358							minChars: 1,
1359							serviceUrl: params.href,
1360							dataType: "json",
1361							formatResult: function (suggestion, currentValue) {
1362								var strItem = '',
1363									itemName = suggestion.value.replace(new RegExp(ALLTIME.utils.escapeRegExp(currentValue), 'g'), "<b>" + currentValue + "</b>");
1364								strItem += '<div class="autocomplete-item">' + itemName + '</div>';
1365								return strItem;
1366							}
1367						});
1368					});
1369
1370
1371				},
1372
1373				validation: function ($container) {
1374
1375
1376					if (!$container) {
1377						$container = $sel.body;
1378					}
1379
1380
1381					$.validator.addMethod("phoneRU", function (phone_number, element) {
1382						phone_number = phone_number.replace(/\(|\)|\s+|-/g, "");
1383						return this.optional(element) || phone_number.length > 5 && phone_number.match(/^((8|\+7)[\- ]?)?(\(?\d{3}\)?[\- ]?)?[\d\- ]{6,10}$/);
1384					}, "Error");
1385					$.validator.setDefaults({
1386						errorClass: "form-item--error",
1387						errorElement: "span"
1388					});
1389
1390
1391					$("form.form", $container).each(function () {
1392						var $form = $(this),
1393							formParams = {
1394								rules: {},
1395								messages: {},
1396							},
1397							$formFields = $form.find("[data-validation]");
1398
1399						var formValidator = $form.data("validator");
1400						if (formValidator) {
1401							formValidator.destroy();
1402						}
1403
1404						$formFields.each(function () {
1405							var $field = $(this),
1406								fieldParams = $field.data("validation");
1407
1408							formParams.messages[$field.attr("name")] = fieldParams.message ? fieldParams.message : "";
1409
1410
1411							formParams.rules[$field.attr("name")] = {};
1412							if (fieldParams.pattern) {
1413								formParams.rules[$field.attr("name")][fieldParams.pattern] = true;
1414							}
1415							if (fieldParams.mask) {
1416								$field.mask(fieldParams.mask, {
1417									autoclear: false,
1418									placeholder: "_"
1419								});
1420							}
1421							if (fieldParams.equalTo) {
1422								formParams.rules[$field.attr("name")]["equalTo"] = fieldParams.equalTo;
1423							}
1424							if (fieldParams.minlength) {
1425								formParams.rules[$field.attr("name")]["minlength"] = fieldParams.minlength;
1426							}
1427						});
1428
1429						if($form.data("success")) {
1430							formParams.submitHandler = function(form) {
1431								BX.showWait();
1432								let $data = new FormData($form[0]);
1433								if (environment === "PRODUCTION")
1434								{
1435									if ($form.find('[name=product_id]').val() === 62400)
1436									{
1437										_tmr.push({type: 'reachGoal', id: 3379918, goal: 'Roxyforma'});
1438									}
1439								}
1440
1441								$.ajax({
1442									url: $form.attr("action"),
1443									data: $data,
1444									processData: false,
1445									contentType: false,
1446									method: 'POST',
1447								}).done(function(data) {
1448									BX.closeWait();
1449									$.magnificPopup.close();
1450									var result = JSON.parse(data);
1451
1452									if($form.find('[name="captcha_sid"]').length) {
1453										$.post(
1454											"/ajax/reload_captcha.php",
1455											{},
1456											function onAjaxSuccess(msg)
1457											{
1458												$form.find('[name="captcha_sid"]').val(msg.replace(/[^\w\s]/gi, ''));
1459												let capImg = $('[name="captcha_sid"]').parent().find("img"), splitPath, imgPath;
1460
1461												if (capImg.is(":visible"))
1462												{
1463													splitPath = capImg.prop("src").split("=");
1464													imgPath = splitPath[0]+"="+msg.replace(/[^\w\s]/gi, '');
1465													capImg.prop({"src": imgPath});
1466												}
1467											}
1468										);
1469									}
1470
1471									if (result?.check_error) {
1472										$form.find('#captcha_word-error').text(result.check_error).show();
1473										return false;
1474									}
1475
1476									if(result.mailsend) {
1477										$form[0].reset();
1478										if ($form.data("success"))
1479											$form.closest(".mfp-content").find(".mfp-close").click();
1480
1481										setTimeout(function() {
1482											$.magnificPopup.open({
1483												items: {
1484													src: $form.data("success"),
1485													type: "inline"
1486												},
1487												mainClass: "mfp-fade",
1488												removalDelay: 300
1489											});
1490										}, 300);
1491
1492
1493										if($form.data("eventsHandler"))
1494										{
1495											BAARRIER.forms.events($form.data("eventsHandler"));
1496										}
1497
1498										if($form.data("goal")) {
1499											BAARRIER.forms.fixGoal($form.data("goal"));
1500										}
1501
1502										if(result.id && $form.data("idblock"))
1503										{
1504											let idblock = document.querySelector($form.data("idblock"));
1505											idblock.innerText = result.id;
1506										}
1507									}else{
1508										if ($form.data("success"))
1509											$form.closest(".mfp-content").find(".mfp-close").click();
1510
1511										if($form.data("fail"))
1512										{
1513											setTimeout(function() {
1514												$.magnificPopup.open({
1515													items: {
1516														src: $form.data("fail"),
1517														type: "inline"
1518													},
1519													mainClass: "mfp-fade",
1520													removalDelay: 300
1521												});
1522											}, 300);
1523										}
1524										else
1525										{
1526											setTimeout(function() {
1527												$.magnificPopup.open({
1528													items: {
1529														src: $form.data("success"),
1530														type: "inline"
1531													},
1532													mainClass: "mfp-fade",
1533													removalDelay: 300
1534												});
1535											}, 300);
1536										}
1537									}
1538
1539								}).fail(function(data) {
1540									if($form.data("fail"))
1541									{
1542										$.magnificPopup.open({
1543											items: {
1544												src: $form.data("fail"),
1545												type: "inline"
1546											},
1547											mainClass: "mfp-fade",
1548											removalDelay: 300
1549										});
1550									}
1551									else
1552									{
1553										$.magnificPopup.open({
1554											items: {
1555												src: $form.data("success"),
1556												type: "inline"
1557											},
1558											mainClass: "mfp-fade",
1559											removalDelay: 300
1560										});
1561									}
1562								});
1563
1564							};
1565						}
1566						var validator = $form.validate(formParams);
1567						$form.data("validator", validator);
1568					});
1569				},
1570				events: function (eventName) {
1571					switch (eventName) {
1572						case "one-click-buy":{
1573							ym(27458979,'reachGoal','oneclick');
1574							console.log('one-click-buy');
1575							break;
1576						}
1577						default:{
1578							console.log("firedEvent: "+eventName);
1579							break;
1580						}
1581					}
1582				},
1583
1584				fixGoal: function(goalName) {
1585					ym(27458979, 'reachGoal', goalName);
1586					console.log('reachGoal', goalName);
1587				}
1588
1589			   /* validation: function($container) {
1590					if(!$container) {
1591						$container = $sel.body;
1592					}
1593
1594					$.validator.addMethod("phoneRU", function(phone_number, element) {
1595						phone_number = phone_number.replace(/\(|\)|\s+|-/g, "");
1596						return this.optional(element) || phone_number.length > 5 && phone_number.match(/^((8|\+7)[\- ]?)?(\(?\d{3}\)?[\- ]?)?[\d\- ]{6,10}$/);
1597					}, "Error");
1598					$.validator.setDefaults({
1599						errorClass: "form-item--error",
1600						errorElement: "span"
1601					});
1602					$(".form", $container).each(function() {
1603						var $form = $(this),
1604							formParams = {
1605								rules: {},
1606								messages: {}
1607							},
1608							$formFields = $form.find("[data-validation]");
1609
1610						$formFields.each(function() {
1611							var $field = $(this),
1612								fieldParams = $field.data("validation");
1613
1614							formParams.messages[$field.attr("name")] = fieldParams.message ? fieldParams.message : "";
1615
1616							formParams.rules[$field.attr("name")] = {};
1617							if(fieldParams.pattern) {
1618								formParams.rules[$field.attr("name")][fieldParams.pattern] = true;
1619							}
1620							if(fieldParams.mask) {
1621								$field.mask(fieldParams.mask, {
1622									autoclear: true,
1623									placeholder: "_"
1624								});
1625							}
1626							if(fieldParams.equalTo) {
1627								formParams.rules[$field.attr("name")]["equalTo"] = fieldParams.equalTo;
1628							}
1629							if(fieldParams.minlength) {
1630								formParams.rules[$field.attr("name")]["minlength"] = fieldParams.minlength;
1631							}
1632						});
1633
1634						if($form.data("success")) {
1635							formParams.submitHandler = function(form) {
1636								$.ajax({
1637									url: $form.attr("action"),
1638									data: $form.serialize(),
1639									success: function(data){
1640
1641										$form.closest(".page-popup").find(".mfp-close").click();
1642										$.magnificPopup.open({
1643											items: {
1644												src: $form.data("success"),
1645												type: "inline"
1646											},
1647											mainClass: "mfp-fade",
1648											removalDelay: 300
1649										});
1650									}
1651								});
1652							};
1653						}
1654
1655
1656
1657						$form.validate(formParams);
1658					});
1659				}*/
1660			},
1661
1662
1663			header: {
1664				init: function () {
1665					$("#promo-items", $sel.page).slick({
1666						slidesToScroll: 1,
1667						slidesToShow: 1,
1668						arrows: true,
1669						dots: false,
1670						infinite: true,
1671						autoplay: true,
1672						autoplaySpeed: 5000,
1673						responsive: [
1674							{
1675								breakpoint: 990,
1676								settings: {
1677									dots: true,
1678									arrows: false
1679								}
1680							}
1681						]
1682					});
1683
1684					$(".top-banner-close").on("click", function (e) {
1685						e.preventDefault();
1686						$(".top-banner").slideUp(300);
1687					});
1688				}
1689			},
1690
1691
1692			footer: {
1693				$top: null,
1694
1695				init: function () {
1696					var self = this;
1697
1698					self.$top = $("#page-top", $sel.body);
1699
1700					self.actions();
1701				},
1702
1703				actions: function () {
1704					var self = this;
1705
1706
1707					var scrollTimer = null;
1708					$sel.window.on("scroll", function () {
1709						self.$top.addClass("active");
1710
1711						if (scrollTimer !== null) {
1712							clearTimeout(scrollTimer);
1713						}
1714
1715						scrollTimer = setTimeout(function () {
1716							self.$top.removeClass("active");
1717						}, 2000);
1718					});
1719
1720					self.$top.on("click", function (e) {
1721						e.preventDefault();
1722						if (self.$top.hasClass("active")) {
1723							BAARRIER.common.go(0, 500);
1724						}
1725					});
1726				}
1727			},
1728
1729
1730			animation: {
1731				init: function () {
1732					var self = this;
1733
1734					self.wow.init();
1735				},
1736
1737				wow: {
1738					blocks: [],
1739					$container: $sel.body,
1740					init: function ($container, useCustomDivScrolling) {
1741						var self = this;
1742
1743						if ($container && $container.length) {
1744							self.$container = $container;
1745						}
1746						self.blocks = [];
1747
1748						if (!useCustomDivScrolling) {
1749							$sel.window.on("scroll", function () {
1750								self.check();
1751							});
1752						} else {
1753							self.$container.on("scroll", function () {
1754								self.check(true);
1755							});
1756						}
1757
1758						setTimeout(function () {
1759							self.prepare(useCustomDivScrolling);
1760							self.check(false, true);
1761						}, 250);
1762					},
1763					prepare: function (useCustomDivScrolling) {
1764						var self = this;
1765						$(".wow:not(.animated)", self.$container).each(function () {
1766							var $item = $(this),
1767								itemAnimation = $item.data("animationtype"),
1768								itemAnimationDuration = $item.data("animationduration"),
1769								itemTransitionDelay = $item.data("transitiondelay");
1770
1771							if (!itemAnimationDuration) {
1772								itemAnimationDuration = 0;
1773							}
1774
1775							self.blocks.push({
1776								"html": $item,
1777								"top": (useCustomDivScrolling ? $item.position().top : $item.offset().top),
1778								"typeAnimation": itemAnimation,
1779								"animation-duration": itemAnimationDuration
1780							});
1781
1782							//$item.addClass("before-" + itemAnimation);
1783							$item.css("animation-duration", itemAnimationDuration);
1784
1785							if (itemTransitionDelay) {
1786								$item.css("transition-delay", itemTransitionDelay);
1787							}
1788
1789
1790						});
1791
1792
1793					},
1794					check: function (useCustomDivScrolling, firstLoad) {
1795						var self = this,
1796							block = false,
1797							blockTop = false,
1798							top = (useCustomDivScrolling ? self.$container.scrollTop() : $sel.window.scrollTop()),
1799							buffer = (firstLoad ? parseInt($sel.window.height() + 100) : parseInt($sel.window.height()) / 1.15),
1800							delay = 0;
1801
1802						for (var i = 0, len = self.blocks.length; i < len; i++) {
1803							block = self.blocks[i],
1804								blockTop = parseInt(block.top, 10);
1805							if (block.html.hasClass("animated")) {
1806								continue;
1807							}
1808
1809							if (top + buffer >= blockTop) {
1810								block.html.css("transition-delay", (delay / 1000) + "s");
1811								block.html.addClass("animated");
1812								delay += 200;
1813								if (delay > 1200) {
1814									delay = 1600;
1815								}
1816							}
1817
1818						}
1819					}
1820				}
1821			},
1822
1823
1824			mobile: {
1825				init: function () {
1826					var self = this;
1827
1828					self.nav();
1829					self.submenu();
1830					self.search();
1831					self.filter();
1832					self.mobileBlocks.init();
1833				},
1834
1835				nav: function () {
1836					$(".header-burger", $sel.body).on("click", function () {
1837						$sel.body.addClass("show-menu");
1838						bodyScrollLock.disableBodyScroll($(".mobile-nav-scroll-holder", $sel.body)[0]);
1839						bodyScrollLock.disableBodyScroll($(".mobile-nav-scroll-inner", $sel.body)[0]);
1840					});
1841					$(".mobile-nav-holder .mobile-close", $sel.body).on("click", function () {
1842						$sel.body.removeClass("show-menu");
1843						bodyScrollLock.enableBodyScroll($(".mobile-nav-scroll-holder", $sel.body)[0]);
1844						bodyScrollLock.enableBodyScroll($(".mobile-nav-scroll-inner", $sel.body)[0]);
1845					});
1846				},
1847
1848				search: function () {
1849					$("#mobile-toolbar-item-search", $sel.page).on("click", function () {
1850						$sel.body.addClass("show-search");
1851						bodyScrollLock.disableBodyScroll($(".mobile-search-scroll-holder", $sel.body)[0]);
1852						bodyScrollLock.disableBodyScroll($(".mobile-search-scroll-inner", $sel.body)[0]);
1853					});
1854					$(".mobile-search-holder .mobile-close", $sel.page).on("click", function () {
1855						$sel.body.removeClass("show-search");
1856						bodyScrollLock.enableBodyScroll($(".mobile-search-scroll-holder", $sel.body)[0]);
1857						bodyScrollLock.enableBodyScroll($(".mobile-search-scroll-inner", $sel.body)[0]);
1858					});
1859				},
1860
1861				submenu: function () {
1862					$(".mobile-nav-menu-item-holder--has-submenu", $sel.body).on("click", function (e) {
1863						e.preventDefault();
1864						$(this).toggleClass("open");
1865					});
1866					$(".footer-nav-col-title", $sel.body).on("click", function (e) {
1867						e.preventDefault();
1868						$(this).closest(".footer-nav-col").toggleClass("open");
1869					});
1870					$(".footer-menu a.footer-menu-item--large, .mobile-nav-menu-item-holder--has-submenu nav a", $sel.body).on("click", function (e) {
1871						e.stopPropagation();
1872					});
1873				},
1874
1875				filter: function () {
1876					$(".mobile-filter-open", $sel.body).on("click", function (e) {
1877						e.preventDefault();
1878						$sel.body.addClass("show-filter");
1879						bodyScrollLock.disableBodyScroll($(".mobile-filter-scroll-holder", $sel.body)[0]);
1880						bodyScrollLock.disableBodyScroll($(".mobile-filter-scroll-inner", $sel.body)[0]);
1881					});
1882					$(".mobile-filter .mobile-filter-close", $sel.body).on("click", function () {
1883						$sel.body.removeClass("show-filter");
1884						bodyScrollLock.enableBodyScroll($(".mobile-filter-scroll-holder", $sel.body)[0]);
1885						bodyScrollLock.enableBodyScroll($(".mobile-filter-scroll-inner", $sel.body)[0]);
1886					});
1887
1888					$(".mobile-filter-item-heading", $sel.body).on("click", function () {
1889						$(this).closest(".mobile-filter-item").toggleClass("open");
1890					});
1891					$(".mobile-filter input:checkbox").on("change", function () {
1892						var $holder = $(this).closest(".mobile-filter-item");
1893						$holder.find("input:checked").length ? $holder.addClass("selected") : $holder.removeClass("selected");
1894
1895						if ($(".mobile-filter-item.selected").length) {
1896							$(".mobile-filter-open", $sel.body).addClass("selected");
1897						} else {
1898							$(".mobile-filter-open", $sel.body).removeClass("selected");
1899						}
1900					});
1901					$(".mobile-filter .form-item--range").on("change input", function (e, u) {
1902						var $holder = $(this).closest(".mobile-filter-item"),
1903							$range = $(this);
1904						($range[0].valueLow + "," + $range[0].valueHigh != $range.data("value")) ? $holder.addClass("selected") : $holder.removeClass("selected");
1905					});
1906					$(".mobile-filter .mobile-filter-heading-reset").on("click", function (e) {
1907						$(".mobile-filter-item").removeClass("selected");
1908						//$(".mobile-filter-holder .mobile-close", $sel.page).trigger("click");
1909					});
1910					$(".mobile-filter button:submit").on("click", function (e) {
1911						e.preventDefault();
1912						$(".mobile-filter-holder .mobile-close", $sel.body).trigger("click");
1913					});
1914
1915
1916					var $brandRows = $(".mobile-filter-brands .filter-row")
1917					$(".brand-search-field").on("keyup", function () {
1918						var query = $(this).val().toLowerCase();
1919						filterBrands(query);
1920					});
1921
1922					function filterBrands(query) {
1923						if (query.length <= 1) {
1924							$brandRows.show();
1925						} else {
1926							$brandRows.each(function () {
1927								var $r = $(this);
1928								$rt = $r.find(".form-checkbox-title"),
1929									rtText = $rt.text().toLowerCase();
1930								if (rtText.includes(query)) {
1931									$r.show();
1932								} else {
1933									$r.hide();
1934								}
1935							});
1936						}
1937					}
1938
1939					const $filter = $('.catalog-filters');
1940					const isMobile = $sel.window.width() < 1000 ? true : false;
1941					let $filterLeftArr, $filterRightArr;
1942					if($filter && $filter.length && !isMobile) {
1943						const buildFilterScroll = () => {
1944							$filterLeftArr = $('<button type="button" class="catalog-filters-array left disabled">&larr;</button>');
1945							$filterRightArr = $('<button type="button" class="catalog-filters-array right disabled">&rarr;</button>');
1946							$filter.after($filterLeftArr, $filterRightArr);
1947							$filterLeftArr.on("click", function() {
1948								scrollFilter('left');
1949							});
1950							$filterRightArr.on("click", function() {
1951								scrollFilter('right');
1952							});
1953							let filterScrollTimer = false;
1954							$filter.on("scroll", function() {
1955								clearTimeout(filterScrollTimer);
1956								filterScrollTimer = setTimeout(afterFilterScrollEvent, 50);
1957							});
1958						}
1959
1960						const afterFilterScrollEvent = () => {
1961							$filter.data('currentScroll', $filter.scrollLeft());
1962							checkFilterScrollArrows();
1963						}
1964
1965						const calcFilterScrollSizes = () => {
1966							let filterWidth = $filter[0].offsetWidth;
1967							const filterScrollWidth = $filter[0].scrollWidth;
1968
1969							if(filterScrollWidth <= filterWidth) {
1970								$filterRightArr.addClass('disabled');
1971								$filterLeftArr.addClass('disabled');
1972							} else {
1973								$filterRightArr.removeClass('disabled');
1974								$filterLeftArr.removeClass('disabled');
1975							}
1976
1977							$filter.data('minScroll', 0);
1978							$filter.data('currentScroll', 0);
1979							$filter.data('maxScroll', filterScrollWidth - filterWidth);
1980							$filterRightArr.css({
1981								'left': `${filterWidth}px`
1982							});
1983						}
1984
1985						const scrollFilter = (direction) => {
1986							let newLeft = 0;
1987							if(direction == 'left') {
1988								if($filter.data('currentScroll') > $filter.data('minScroll')) {
1989									newLeft = $filter.data('currentScroll') - 100;
1990								}
1991							} else if(direction == 'right') {
1992								if($filter.data('currentScroll') < $filter.data('maxScroll')) {
1993									newLeft = $filter.data('currentScroll') + 100;
1994								}
1995							}
1996							$filter.animate({
1997								scrollLeft: newLeft
1998							}, 150);
1999						}
2000
2001						const checkFilterScrollArrows = () => {
2002							$filter.data('currentScroll') > $filter.data('minScroll') ? $filterLeftArr.removeClass('disabled') : $filterLeftArr.addClass('disabled');
2003							$filter.data('currentScroll') < $filter.data('maxScroll') ? $filterRightArr.removeClass('disabled') : $filterRightArr.addClass('disabled');
2004						}
2005
2006						buildFilterScroll();
2007						calcFilterScrollSizes();
2008						checkFilterScrollArrows();
2009
2010						let filterResizeTimer = false;
2011						$(window).on("resize", function() {
2012							clearTimeout(filterResizeTimer);
2013							filterResizeTimer = setTimeout(function() {
2014								$filter.scrollLeft(0);
2015								calcFilterScrollSizes();
2016							}, 100);
2017						});
2018
2019					}
2020				},
2021
2022				mobileBlocks: {
2023					$panel: false,
2024					$blocksHolder: false,
2025					$blocks: false,
2026					$curBlock: false,
2027
2028					init: function () {
2029						var self = this;
2030
2031						self.$panel = $(".mobile-nav", $sel.body);
2032						self.$blocksHolder = $(".mobile-blocks", self.$panel);
2033						self.$blocks = $(".mobile-block", self.$blocksHolder);
2034						self.$curBlock = self.$blocks.filter(".show");
2035
2036						self.build();
2037						self.handle();
2038					},
2039
2040					build: function () {
2041						var self = this;
2042
2043						self.$blocks.filter("[data-prev]").each(function () {
2044							var $block = $(this);
2045
2046							$block.prepend('<a href="' + $block.data("prev") + '" class="mobile-back mobile-open-block">Назад</a>');
2047						})
2048					},
2049
2050					handle: function () {
2051						var self = this;
2052
2053						$(".mobile-open-block", self.$panel).on("click", function (e) {
2054							e.preventDefault();
2055
2056							var $item = $(this),
2057								$newBlock = self.$blocks.filter($item.attr("href"));
2058
2059							self.$curBlock.removeClass("show");
2060							$newBlock.addClass("show");
2061
2062							self.$curBlock = $newBlock;
2063
2064							self.$panel.scrollTop(0);
2065						});
2066					}
2067				}
2068			}
2069
2070
2071		}
2072	})();
2073
2074	window.BAARRIER = BAARRIER;
2075
2076	BAARRIER.init();
2077
2078})(jQuery);

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.