PageSourceSearch

https://okoptica.ru/local/templates/okoptica/js/main.js

js okoptica.ru collected 2026-10-07 16:32:50 UTC 98,926 bytes, 2,626 lines download raw bytes

1/**
2 * Plugin Name : Accordion.JS
3 * Version     : 2.1.1
4 * Author      : ZeroWP Team
5 * Author URL  : http://zerowp.com/
6 * Plugin URL  : https://accordion.js.org/
7 * License     : MIT
8 */
9!function(e) {
10    'use strict';
11    e.fn.accordionjs = function(n) {
12        if (this.length > 1) return this.each(function() {
13            e(this).accordionjs(n)
14        }), this;
15        var c = this, t = {
16            isInteger:        function(e) {
17                return 'number' == typeof e && isFinite(e) && Math.floor(e) === e
18            }, isArray:       function(e) {
19                return '[object Array]' === Object.prototype.toString.call(e)
20            }, isObject:      function(e) {
21                return '[object Object]' === Object.prototype.toString.call(e)
22            }, sectionIsOpen: function(e) {
23                return e.hasClass('acc_active')
24            }, getHash:       function() {
25                return window.location.hash ? window.location.hash.substring(1) : !1
26            }
27        }, o  = e.extend({
28            closeAble:         !1,
29            closeOther:        !0,
30            slideSpeed:        150,
31            activeIndex:       1,
32            openSection:       !1,
33            beforeOpenSection: !1
34        }, n);
35        e.each(o, function(e) {
36            var n = e.replace(/([A-Z])/g, '-$1').toLowerCase().toString(), t = c.data(n);
37            (t || !1 === t) && (o[e] = t)
38        }), (o.activeIndex === !1 || o.closeOther === !1) && (o.closeAble = !0);
39        var i = function() {
40            c.create(), c.openOnClick(), e(window).on('load', function() {
41                c.openOnHash()
42            }), e(window).on('hashchange', function() {
43                c.openOnHash()
44            })
45        };
46        return this.openSection = function(n, c) {
47            e(document).trigger('accjs_before_open_section', [n]), 'function' == typeof o.beforeOpenSection && o.beforeOpenSection.call(this, n), c = c >= 0 ? c : o.slideSpeed;
48            var t = n.children().eq(1);
49            t.slideDown(c, function() {
50                e(document).trigger('accjs_open_section', [n]), 'function' == typeof o.openSection && o.openSection.call(this, n)
51            }), n.addClass('acc_active')
52        }, this.closeSection = function(n, c) {
53            e(document).trigger('accjs_before_close_section', [n]), 'function' == typeof o.beforeCloseSection && o.beforeCloseSection.call(this, n), c = c >= 0 ? c : o.slideSpeed;
54            var t = n.children().eq(1);
55            t.slideUp(c, function() {
56                e(document).trigger('accjs_close_section', [n]), 'function' == typeof o.closeSection && o.closeSection.call(this, n)
57            }), n.removeClass('acc_active')
58        }, this.closeOtherSections = function(n, t) {
59            var o = n.closest('.accordionjs').children();
60            e(o).each(function() {
61                c.closeSection(e(this).not(n), t)
62            })
63        }, this.create = function() {
64            c.addClass('accordionjs');
65            var n = c.children();
66            if (e.each(n, function(n, t) {
67                c.createSingleSection(e(t))
68            }), t.isArray(o.activeIndex)) for (var i = o.activeIndex, s = 0; s < i.length; s++) c.openSection(n.eq(i[s] - 1), 0); else o.activeIndex > 1 ? c.openSection(n.eq(o.activeIndex - 1), 0) : !1 !== o.activeIndex && c.openSection(n.eq(0), 0)
69        }, this.createSingleSection = function(n) {
70            var c = n.children();
71            n.addClass('acc_section'), e(c[0]).addClass('acc_head'), e(c[1]).addClass('acc_content'), n.hasClass('acc_active') || n.children('.acc_content').hide()
72        }, this.openOnClick = function() {
73            c.on('click', '.acc_head', function(n) {
74                n.stopImmediatePropagation();
75                var i = e(this).closest('.acc_section');
76                t.sectionIsOpen(i) ? o.closeAble ? c.closeSection(i) : 1 === c.children().length && c.closeSection(i) : o.closeOther ? (c.closeOtherSections(i), c.openSection(i)) : c.openSection(i)
77            })
78        }, this.openOnHash = function() {
79            if (t.getHash()) {
80                var n = e('#' + t.getHash());
81                n.hasClass('acc_section') && (c.openSection(n), o.closeOther && c.closeOtherSections(n), e('html, body').animate({scrollTop: parseInt(n.offset().top) - 50}, 150))
82            }
83        }, i(), this
84    }
85}(jQuery);
86
87/*!
88 * Readmore.js jQuery plugin
89 * Author: @jed_foster
90 * Project home: jedfoster.github.io/Readmore.js
91 * Licensed under the MIT license
92 */
93(function(c) {
94    function g(b, a) {
95        this.element = b;
96        this.options = c.extend({}, h, a);
97        c(this.element).data('max-height', this.options.maxHeight);
98        c(this.element).data('height-margin', this.options.heightMargin);
99        delete this.options.maxHeight;
100        if (this.options.embedCSS && !k) {
101            var d = '.readmore-js-toggle, .readmore-js-section { ' + this.options.sectionCSS + ' } .readmore-js-section { overflow: hidden; }',
102                e = document.createElement('style');
103            e.type = 'text/css';
104            e.styleSheet ? e.styleSheet.cssText = d : e.appendChild(document.createTextNode(d
104));
105            document.getElementsByTagName('head')[0].appendChild(e);
106            k = !0
107        }
108        this._defaults = h;
109        this._name     = f;
110        this.init()
111    }
112
113    var f       = 'readmore', h = {
114        speed:          100,
115        maxHeight:      200,
116        heightMargin:   16,
117        moreLink:       '<a href="#">Read More</a>',
118        lessLink:       '<a href="#">Close</a>',
119        embedCSS:       !0,
120        sectionCSS:     'display: block; width: 100%;',
121        startOpen:      !1,
122        expandedClass:  'readmore-js-expanded',
123        collapsedClass: 'readmore-js-collapsed',
124        beforeToggle:   function() {
125        },
126        afterToggle:    function() {
127        }
128    }, k        = !1;
129    g.prototype = {
130        init:            function() {
131            var b = this;
132            c(this.element).each(function() {
133                var a =
134                        c(this),
135                    d = a.css('max-height').replace(/[^-\d\.]/g, '') > a.data('max-height') ? a.css('max-height').replace(/[^-\d\.]/g, '') : a.data('max-height'),
136                    e = a.data('height-margin');
137                'none' != a.css('max-height') && a.css('max-height', 'none');
138                b.setBoxHeight(a);
139                if (a.outerHeight(!0) <= d + e) return !0;
140                a.addClass('readmore-js-section ' + b.options.collapsedClass).data('collapsedHeight', d);
141                a.after(c(b.options.startOpen ? b.options.lessLink : b.options.moreLink).on('click', function(c) {
142                    b.toggleSlider(this, a, c)
143                }).addClass('readmore-js-toggle'));
144                b.options.startOpen || a.css({height: d})
145            });
146            c(window).on('resize', function(a) {
147                b.resizeBoxes()
148            })
149        }, toggleSlider: function(b, a, d) {
150            d.preventDefault();
151            var e = this;
152            d     = newLink = sectionClass = '';
153            var f = !1;
154            d     = c(a).data('collapsedHeight');
155            c(a).height() <= d ? (d = c(a).data('expandedHeight') + 'px', newLink = 'lessLink', f = !0, sectionClass = e.options.expandedClass) : (newLink = 'moreLink', sectionClass = e.options.collapsedClass);
156            e.options.beforeToggle(b, a, f);
157            c(a).animate({height: d}, {
158                duration: e.options.speed, complete: function() {
159                    e.options.afterToggle(b,
160                        a, f);
161                    c(b).replaceWith(c(e.options[newLink]).on('click', function(b) {
162                        e.toggleSlider(this, a, b)
163                    }).addClass('readmore-js-toggle'));
164                    c(this).removeClass(e.options.collapsedClass + ' ' + e.options.expandedClass).addClass(sectionClass)
165                }
166            })
167        }, setBoxHeight: function(b) {
168            var a = b.clone().css({height: 'auto', width: b.width(), overflow: 'hidden'}).insertAfter(b),
169                c = a.outerHeight(!0);
170            a.remove();
171            b.data('expandedHeight', c)
172        }, resizeBoxes:  function() {
173            var b = this;
174            c('.readmore-js-section').each(function() {
175                var a = c(this);
176                b.setBoxHeight(a);
177                (a.height() > a.data('expandedHeight') || a.hasClass(b.options.expandedClass) && a.height() < a.data('expandedHeight')) && a.css('height', a.data('expandedHeight'))
178            })
179        }, destroy:      function() {
180            var b = this;
181            c(this.element).each(function() {
182                var a = c(this);
183                a.removeClass('readmore-js-section ' + b.options.collapsedClass + ' ' + b.options.expandedClass).css({
184                    'max-height': '',
185                    height:       'auto'
186                }).next('.readmore-js-toggle').remove();
187                a.removeData()
188            })
189        }
190    };
191    c.fn[f]     = function(b) {
192        var a = arguments;
193        if (void 0 === b || 'object' === typeof b) return this.each(function() {
194            if (c.data(this,
195                'plugin_' + f)) {
196                var a = c.data(this, 'plugin_' + f);
197                a.destroy.apply(a)
198            }
199            c.data(this, 'plugin_' + f, new g(this, b))
200        });
201        if ('string' === typeof b && '_' !== b[0] && 'init' !== b) return this.each(function() {
202            var d = c.data(this, 'plugin_' + f);
203            d instanceof g && 'function' === typeof d[b] && d[b].apply(d, Array.prototype.slice.call(a, 1))
204        })
205    }
206})(jQuery);
207
208/* Вызывает окно с поиском десктом */
209/* $('.js-search-header').click(function () {
210    $('.js-search-result').addClass('active');
211}); */
212
213/* Off-Canvas Menus */
214var slidebars = function() {
215    // Cache all canvas elements
216    var canvas                 = $('[canvas]'),
217
218        // Object of Slidebars
219        offCanvas              = {},
220
221        // Variables, permitted sides and styles
222        init                   = false,
223        registered             = false,
224        sides                  = ['top', 'right', 'bottom', 'left'],
225        styles                 = ['reveal', 'push', 'overlay', 'shift'],
226
227        /**
228         * Get Animation Properties
229         */
230
231        getAnimationProperties = function(id) {
232            // Variables
233            var elements = $(),
234                amount   = '0px, 0px',
235                duration = parseFloat(offCanvas[id].element.css('transitionDuration'), 10) * 1000;
236
237            // Elements to animate
238            if (offCanvas[id].style === 'reveal' || offCanvas[id].style === 'push' || offCanvas[id].style === 'shift') {
239                elements = elements.add(canvas);
240            }
241
242            if (offCanvas[id].style === 'push' || offCanvas[id].style === 'overlay' || offCanvas[id].style === 'shift') {
243                elements = elements.add(offCanvas[id].element);
244            }
245
246            // Amount to animate
247            if (offCanvas[id].active) {
248                if (offCanvas[id].side === 'top') {
249                    amount = '0px, ' + offCanvas[id].element.css('height');
250                } else if (offCanvas[id].side === 'right') {
251                    amount = '-' + offCanvas[id].element.css('width') + ', 0px';
252                } else if (offCanvas[id].side === 'bottom') {
253                    amount = '0px, -' + offCanvas[id].element.css('height');
254                } else if (offCanvas[id].side === 'left') {
255                    amount = offCanvas[id].element.css('width') + ', 0px';
256                }
257            }
258
259            // Return animation properties
260            return {'elements': elements, 'amount': amount, 'duration': duration};
261        },
262
263        /**
264         * Slidebars Registration
265         */
266
267        registerSlidebar       = function(id, side, style, element) {
268            // Check if Slidebar is registered
269            if (isRegisteredSlidebar(id)) {
270                throw 'Error registering Slidebar, a Slidebar with id \'' + id + '\' already exists.';
271            }
272
273            // Register the Slidebar
274            offCanvas[id] = {
275                'id':      id,
276                'side':    side,
277                'style':   style,
278                'element': element,
279                'active':  false
280            };
281        },
282
283        isRegisteredSlidebar   = function(id) {
284            // Return if Slidebar is registered
285            if (offCanvas.hasOwnProperty(id)) {
286                return true;
287            } else {
288                return false;
vendor: 9,659 bytes, lines 289-625
289            }
290        };
291
292    /**
293     * Initialization
294     */
295
296    this.init = function(callback) {
297        // Check if Slidebars has been initialized
298        if (init) {
299            throw 'Slidebars has already been initialized.';
300        }
301
302        // Loop through and register Slidebars
303        if (!registered) {
304            $('body [off-canvas]').each(function() {
305                // Get Slidebar parameters
306                var parameters = $(this).attr('off-canvas').split(' ', 3);
307
308                // Make sure a valid id, side and style are specified
309                if (!parameters || !parameters[0] || sides.indexOf(parameters[1]) === -1 || styles.indexOf(parameters[2]) === -1) {
310                    throw 'Error registering Slidebar, please specifiy a valid id, side and style\'.';
311                }
312
313                // Register Slidebar
314                registerSlidebar(parameters[0], parameters[1], parameters[2], $(this));
315            });
316
317            // Set registered variable
318            registered = true;
319        }
320
321        // Set initialized variable
322        init = true;
323
324        // Set CSS
325        this.css();
326
327        // Trigger event
328        $(events).trigger('init');
329
330        // Run callback
331        if (typeof callback === 'function') {
332            callback();
333        }
334    };
335
336    this.exit = function(callback) {
337        // Check if Slidebars has been initialized
338        if (!init) {
339            throw 'Slidebars hasn\'t been initialized.';
340        }
341
342        // Exit
343        var exit = function() {
344            // Set init variable
345            init = false;
346
347            // Trigger event
348            $(events).trigger('exit');
349
350            // Run callback
351            if (typeof callback === 'function') {
352                callback();
353            }
354        };
355
356        // Call exit, close open Slidebar if active
357        if (this.getActiveSlidebar()) {
358            this.close(exit);
359        } else {
360            exit();
361        }
362    };
363
364    /**
365     * CSS
366     */
367
368    this.css = function(callback) {
369        // Check if Slidebars has been initialized
370        if (!init) {
371            throw 'Slidebars hasn\'t been initialized.';
372        }
373
374        // Loop through Slidebars to set negative margins
375        for (var id in offCanvas) {
376            // Check if Slidebar is registered
377            if (isRegisteredSlidebar(id)) {
378                // Calculate offset
379                var offset;
380
381                if (offCanvas[id].side === 'top' || offCanvas[id].side === 'bottom') {
382                    offset = offCanvas[id].element.css('height');
383                } else {
384                    offset = offCanvas[id].element.css('width');
385                }
386
387                // Apply negative margins
388                if (offCanvas[id].style === 'push' || offCanvas[id].style === 'overlay' || offCanvas[id].style === 'shift') {
389                    offCanvas[id].element.css('margin-' + offCanvas[id].side, '-' + offset);
390                }
391            }
392        }
393
394        // Reposition open Slidebars
395        if (this.getActiveSlidebar()) {
396            this.open(this.getActiveSlidebar());
397        }
398
399        // Trigger event
400        $(events).trigger('css');
401
402        // Run callback
403        if (typeof callback === 'function') {
404            callback();
405        }
406    };
407
408    /**
409     * Controls
410     */
411
412    this.open = function(id, callback) {
413        // Check if Slidebars has been initialized
414        if (!init) {
415            throw 'Slidebars hasn\'t been initialized.';
416        }
417
418        // Check if id wasn't passed or if Slidebar isn't registered
419        if (!id || !isRegisteredSlidebar(id)) {
420            throw 'Error opening Slidebar, there is no Slidebar with id \'' + id + '\'.';
421        }
422
423        // Open
424        var open = function() {
425            // Set active state to true
426            offCanvas[id].active = true;
427
428            // Display the Slidebar
429            offCanvas[id].element.css({'opacity': '1', 'height': '100%'});
430
431            // Trigger event
432            $(events).trigger('opening', [offCanvas[id].id]);
433
434            // Get animation properties
435            var animationProperties = getAnimationProperties(id);
436
437            // Apply css
438            animationProperties.elements.css({
439                'transition-duration': animationProperties.duration + 'ms',
440                'transform':           'translate(' + animationProperties.amount + ')'
441            });
442
443            // Transition completed
444            setTimeout(function() {
445                // Trigger event
446                $(events).trigger('opened', [offCanvas[id].id]);
447
448                // Run callback
449                if (typeof callback === 'function') {
450                    callback();
451                }
452            }, animationProperties.duration);
453        };
454
455        // Call open, close open Slidebar if active
456        if (this.getActiveSlidebar() && this.getActiveSlidebar() !== id) {
457            this.close(open);
458        } else {
459            open();
460        }
461    };
462
463    this.close = function(id, callback) {
464        // Shift callback arguments
465        if (typeof id === 'function') {
466            callback = id;
467            id       = null;
468        }
469
470        // Check if Slidebars has been initialized
471        if (!init) {
472            throw 'Slidebars hasn\'t been initialized.';
473        }
474
475        // Check if id was passed but isn't a registered Slidebar
476        if (id && !isRegisteredSlidebar(id)) {
477            throw 'Error closing Slidebar, there is no Slidebar with id \'' + id + '\'.';
478        }
479
480        // If no id was passed, get the active Slidebar
481        if (!id) {
482            id = this.getActiveSlidebar();
483        }
484
485        // Close a Slidebar
486        if (id && offCanvas[id].active) {
487            // Set active state to false
488            offCanvas[id].active = false;
489
490            // Trigger event
491            $(events).trigger('closing', [offCanvas[id].id]);
492
493            // Get animation properties
494            var animationProperties = getAnimationProperties(id);
495
496            // Apply css
497            animationProperties.elements.css('transform', '');
498
499            // Transition completetion
500            setTimeout(function() {
501                // Remove transition duration
502                animationProperties.elements.css('transition-duration', '');
503
504                // Hide the Slidebar
505                offCanvas[id].element.css('display', '');
506
507                // Trigger event
508                $(events).trigger('closed', [offCanvas[id].id]);
509
510                // Run callback
511                if (typeof callback === 'function') {
512                    callback();
513                }
514            }, animationProperties.duration);
515        }
516    };
517
518    this.toggle = function(id, callback) {
519        // Check if Slidebars has been initialized
520        if (!init) {
521            throw 'Slidebars hasn\'t been initialized.';
522        }
523
524        // Check if id wasn't passed or if Slidebar isn't registered
525        if (!id || !isRegisteredSlidebar(id)) {
526            throw 'Error toggling Slidebar, there is no Slidebar with id \'' + id + '\'.';
527        }
528
529        // Check Slidebar state
530        if (offCanvas[id].active) {
531            // It's open, close it
532            this.close(id, function() {
533                // Run callback
534                if (typeof callback === 'function') {
535                    callback();
536                }
537            });
538        } else {
539            // It's closed, open it
540            this.open(id, function() {
541                // Run callback
542                if (typeof callback === 'function') {
543                    callback();
544                }
545            });
546        }
547    };
548
549    /**
550     * Active States
551     */
552
553    this.isActive = function(id) {
554        // Return init state
555        return init;
556    };
557
558    this.isActiveSlidebar = function(id) {
559        // Check if Slidebars has been initialized
560        if (!init) {
561            throw 'Slidebars hasn\'t been initialized.';
562        }
563
564        // Check if id wasn't passed
565        if (!id) {
566            throw 'You must provide a Slidebar id.';
567        }
568
569        // Check if Slidebar is registered
570        if (!isRegisteredSlidebar(id)) {
571            throw 'Error retrieving Slidebar, there is no Slidebar with id \'' + id + '\'.';
572        }
573
574        // Return the active state
575        return offCanvas[id].active;
576    };
577
578    this.getActiveSlidebar = function() {
579        // Check if Slidebars has been initialized
580        if (!init) {
581            throw 'Slidebars hasn\'t been initialized.';
582        }
583
584        // Variable to return
585        var active = false;
586
587        // Loop through Slidebars
588        for (var id in offCanvas) {
589            // Check if Slidebar is registered
590            if (isRegisteredSlidebar(id)) {
591                // Check if it's active
592                if (offCanvas[id].active) {
593                    // Set the active id
594                    active = offCanvas[id].id;
595                    break;
596                }
597            }
598        }
599
600        // Return
601        return active;
602    };
603
604    this.getSlidebars = function() {
605        // Check if Slidebars has been initialized
606        if (!init) {
607            throw 'Slidebars hasn\'t been initialized.';
608        }
609
610        // Create an array for the Slidebars
611        var slidebarsArray = [];
612
613        // Loop through Slidebars
614        for (var id in offCanvas) {
615            // Check if Slidebar is registered
616            if (isRegisteredSlidebar(id)) {
617                // Add Slidebar id to array
618                slidebarsArray.push(offCanvas[id].id);
619            }
620        }
621
622        // Return
623        return slidebarsArray;
624    };
625
626    this.getSlidebar = function(id) {
627        // Check if Slidebars has been initialized
628        if (!init) {
629            throw 'Slidebars hasn\'t been initialized.';
630        }
631
632        // Check if id wasn't passed
633        if (!id) {
634            throw 'You must pass a Slidebar id.';
635        }
636
637        // Check if Slidebar is registered
638        if (!id || !isRegisteredSlidebar(id)) {
639            throw 'Error retrieving Slidebar, there is no Slidebar with id \'' + id + '\'.';
640        }
641
642        // Return the Slidebar's properties
643        return offCanvas[id];
644    };
645
646    /**
647     * Events
648     */
649
650    this.events = {};
651    var events  = this.events;
652
653    /**
654     * Resizes
655     */
656
657    $(window).on('resize', this.css.bind(this));
658};
659
660(function($) {
661    // Create a new instance of Slidebars
662    var controller = new slidebars();
663
664    // Initialize Slidebars
665    controller.init();
666    // Menu Slidebar
667    $('.js-toggle-left-slidebar').on('click', function(event) {
668        event.stopPropagation();
669        controller.toggle('menu');
670    });
671
672    // Search Slidebar
673    $('.js-open-search').on('click', function(event) {
674        event.stopPropagation();
675        controller.toggle('search');
676    });
677
678    // Filters Slidebar
679    $('body').on('click', '.js-open-filters', function(event) {
680        //$( '.js-open-filters' ).on( 'click', function ( event ) {
681        event.stopPropagation();
682        controller.toggle('filters');
683    });
684
685
686    // Close any
687    $(controller.events).on('opened', function() {
688        $('[canvas="container"]').addClass('js-close-any-slidebar');
689    });
690
691    $(controller.events).on('closed', function() {
692        $('[canvas="container"]').removeClass('js-close-any-slidebar');
693    });
694
695    $('body').on('click', '.js-close-any-slidebar', function(event) {
696        event.stopPropagation();
697        controller.close();
698    });
699
700    $('.js-close-callback').on('click', function(event) {
701        event.stopPropagation();
702        controller.close();
703    });
704
705    $('.js-toggle-callback').on('click', function(event) {
706        event.stopPropagation();
707        controller.toggle('slidebar-1',);
708    });
709})(jQuery);
710
711$(document).ready(function() {
712
713    $(window).resize(function() {
714        /* Вызывает окно с поиском мобильный (коппирует блок (в div с классом .search-mobile) куда вставляется ajax поиск) */
715        if ($(window).width() <= 1280) {
716            var search_form       = $('.header__search .search-form').clone(true),
717                search_form_block = $('.header__search .js-search-result').clone(true);
718
719            $('.search-mobile').prepend(search_form);
720            $('.search-mobile').append(search_form_block);
721            $('.header__search .js-search-result').remove();
722
723        } else {
724            var modal_search_block = $('.search-mobile .js-search-result').clone(true);
725            $('.search-mobile .js-search-result').detach();
726            $('.search-mobile .search-form').detach();
727            $('.header__search').append(modal_search_block);
728        }
729
730        /* Мобильный фильтр */
731        if ($(window).width() > 960) {
732            $('.filters').css({
733                'position':    'relative',
734                'margin-left': '0',
735                'opacity':     '1',
736                'width':       '14rem',
737                'min-width':   '14rem',
738                'height':      '100%',
739                'z-index':     '1'
740            });
741            $('.filters .filter-title').remove();
742        } else {
743            var f_title = $('.filters').find('div.filter-title').length;
744            $('.filters').css({
745                'position':  'fixed',
746                'opacity':   '0',
747                'width':     '100%',
748                'min-width': '100%',
749                'height':    '0',
750                'z-index':   '9999'
751            });
752            if (f_title == 0) {
753                $('.filters').prepend('<div class="filter-title">Фильтр</div>');
754            }
755        }
756
757
758    }).trigger('resize');
759
760
761    /* Стилизайция select */
762    function selectStyle(select) {
763        var $select = $(select);
764        $select.each(function() {
765            const _this              = $(this),
766                  selectOption       = _this.find('option'),
767                  selectOptionLength = selectOption.length,
768                  //selectedOption = selectOption.filter(':selected').addClass('active'),
769                  selectedClass      = _this.attr('class'),
770                  selectedId         = _this.data('id'),
771                  duration           = 450; // длительность анимации
772
773            _this.hide();
774            _this.wrap('<div class="' + selectedClass + '"></div>');
775            $('<div>', {
776                class: 'select_style',
777                text:  _this.children('option:selected').text()
778            }).insertAfter(_this);
779
780            const selectHead = _this.next('.select_style');
781            $('<div>', {
782                class: 'select_style__list',
783                id:    selectedId
784            }).insertAfter(selectHead);
785
786            const selectList = selectHead.next('.select_style__list');
787            for (let i = 0; i < selectOptionLength; i++) {
788                $('<div>', {
789                    class: 'select_style__item',
790                    html:  $('<span>', {
791                        text: selectOption.eq(i).text()
792                    })
793                })
794                    .attr('data-value', selectOption.eq(i).val())
795                    .appendTo(selectList);
796            }
797
798            const selectItem = selectList.find('.select_style__item');
799
800            selectList.slideUp(0);
801            selectHead.on('click', function() {
802                if (!$(this).hasClass('on')) {
803                    $(this).addClass('on');
804                    selectList.slideDown(duration);
805
806                    selectItem.on('click', function() {
807                        let chooseItem = $(this).data('value');
808                        selectList.find('span').removeClass('active');
809
810                        $(this).closest('div.form-group').find('select').val(chooseItem).attr('selected', 'selected');
811                        selectHead.text($(this).find('span').text());
812                        $(this).find('span').addClass('active');
813
814                        selectList.slideUp(duration);
815                        selectHead.removeClass('on');
816                    });
817
818                } else {
819                    $(this).removeClass('on');
820                    selectList.slideUp(duration);
821                }
822            });
823
824            $(document).click(function(e) {
825                if (!selectHead.is(e.target) && !selectList.is(e.target) && selectList.has(e.target).length === 0) {
826                    selectHead.removeClass('on');
827                    selectList.slideUp(duration);
828                }
829                ;
830            });
831        });
832    }
833
834    selectStyle('.form-select'); // стилизация селект для форм
835
836    /*
837  // Пример обработки запроса
838  $('#id_city').each(function() {
839  	var selectOption = $(this).find('.select_style__item');
840
841  	selectOption.on('click', function() {
842  		var selectedValue = $(this).data('value');
843
844
845  	});
846  });
847  */
848
849
850    $('.hero__slider').slick({
851        lazyLoad: 'ondemand',      
852        autoplay:      true,
853        autoplaySpeed: 5000,
854        dots:          true,
855        infinite:      true,
856        speed:         600,
857        fade:          false,
858        /*cssEase: 'linear',*/
859        slidesToShow:   1,
860        slidesToScroll: 1,
861        arrows:         true,
862        draggable:      false,
863        appendArrows:   $('.hero__slide_nav'),
864        prevArrow:      '<div class="slick-prev slick-arrow icons"><div class="nav_prev"><svg class="icon"><use xlink:href="#chevron-left"></use></svg</div></div>',
865        nextArrow:      '<div class="slick-next slick-arrow icons"><div class="nav_next"><svg class="icon"><use xlink:href="#chevron-right"></use></svg</div></div>',
866        responsive:     [
867            {
868                breakpoint: 960,
869                settings:   {
870                    dots:           false,
871                    arrows:         false,
872                    fade:           false,
873                    infinite:       false,
874                    draggable:      true,
875                    slidesToShow:   1.1,
876                    slidesToScroll: 1
877                }
878            }
879        ]
880    });
881
882    $('.search-slider').slick({
883        lazyLoad: 'ondemand',      
884        dots:           false,
885        infinite:       false,
886        speed:          600,
887        slidesToShow:   3.5,
888        slidesToScroll: 3,
889        arrows:         true,
890        draggable:      false,
891        appendArrows:   $('.search__slide_nav'),
892        prevArrow:      '<div class="slick-prev slick-arrow icons"><div class="nav_prev"><svg class="icon"><use xlink:href="#chevron-left"></use></svg</div></div>',
893        nextArrow:      '<div class="slick-next slick-arrow icons"><div class="nav_next"><svg class="icon"><use xlink:href="#chevron-right"></use></svg</div></div>',
894        responsive:     [
895            {
896                breakpoint: 1280,
897                settings:   {
898                    arrows:         true,
899                    fade:           false,
900                    infinite:       false,
901                    draggable:      true,
902                    slidesToShow:   3.1,
903                    slidesToScroll: 1
904                }
905            },
906            {
907                breakpoint: 960,
908                settings:   {
909                    arrows:         true,
910                    fade:           false,
911                    infinite:       false,
912                    draggable:      true,
913                    slidesToShow:   2.1,
914                    slidesToScroll: 1
915                }
916            },
917            {
918                breakpoint: 480,
919                settings:   {
920                    arrows:         false,
921                    fade:           false,
922                    infinite:       false,
923                    draggable:      true,
924                    slidesToShow:   2.1,
925                    slidesToScroll: 1
926                }
927            }
928        ]
929    });
930
931    $('.search-hit-slider').slick({
932        lazyLoad: 'ondemand',      
933        dots:           false,
934        infinite:       false,
935        speed:          600,
936        slidesToShow:   3.5,
937        slidesToScroll: 3,
938        arrows:         true,
939        draggable:      false,
940        appendArrows:   $('.search__slide_nav'),
941        prevArrow:      '<div class="slick-prev slick-arrow icons"><div class="nav_prev"><svg class="icon"><use xlink:href="#chevron-left"></use></svg</div></div>',
942        nextArrow:      '<div class="slick-next slick-arrow icons"><div class="nav_next"><svg class="icon"><use xlink:href="#chevron-right"></use></svg</div></div>',
943        responsive:     [
944            {
945                breakpoint: 1280,
946                settings:   {
947                    arrows:         true,
948                    fade:           false,
949                    infinite:       false,
950                    draggable:      true,
951                    slidesToShow:   3.1,
952                    slidesToScroll: 1
953                }
954            },
955            {
956                breakpoint: 960,
957                settings:   {
958                    arrows:         true,
959                    fade:           false,
960                    infinite:       false,
961                    draggable:      true,
962                    slidesToShow:   2.1,
963                    slidesToScroll: 1
964                }
965            },
966            {
967                breakpoint: 480,
968                settings:   {
969                    arrows:         false,
970                    fade:           false,
971                    infinite:       false,
972                    draggable:      true,
973                    slidesToShow:   2.1,
974                    slidesToScroll: 1
975                }
976            }
977        ]
978    });
979
980
981    $('.hits_products').each(function(index) {
982        $('.products__slider', $(this)).on('init reInit afterChange', function(event, slick, currentSlide, nextSlide) {
983
984            if (!slick.$dots) {
985                return;
986            }
987            var i     = (currentSlide ? currentSlide : 0) - 1;
988            var total = slick.$dots[0].children.length;
989
990            if (i == total) {
991                $(document).find('.products__slide.slick-slide.slick-current').removeClass('slick-current');
992            } else {
993                $(function() {
994                    $(document).find('.products__slide.slick-active.slick-current').hover(function() {
995                            $(document).find('.products__slide_nav .slick-prev').addClass('hover');
996                        },
997                        function() {
998                            $(document).find('.products__slide_nav .slick-prev').removeClass('hover');
999                        });
1000                });
1001            }
1002        });
1003
1004        $('.products__slider', $(this)).slick({
1005        lazyLoad: 'ondemand',      
1006            dots:           true,
1007            infinite:       false,
1008            speed:          600,
1009            slidesToShow:   4.5,
1010            slidesToScroll: 2,
1011            arrows:         true,
1012            draggable:      false,
1013            appendArrows:   $(this).find('.products__slide_nav'),
1014            prevArrow:      '<div class="slick-prev slick-arrow icons"><div class="nav_prev"><svg class="icon"><use xlink:href="#chevron-left"></use></svg</div></div>',
1015            nextArrow:      '<div class="slick-next slick-arrow icons"><div class="nav_next"><svg class="icon"><use xlink:href="#chevron-right"></use></svg</div></div>',
1016            responsive:     [
1017                {
1018                    breakpoint: 1280,
1019                    settings:   {
1020                        arrows:         true,
1021                        slidesToShow:   3.5,
1022                        slidesToScroll: 2
1023                    }
1024                },
1025                {
1026                    breakpoint: 960,
1027                    settings:   {
1028                        arrows:         false,
1029                        dots:           false,
1030                        draggable:      true,
1031                        slidesToShow:   2.2,
1032                        slidesToScroll: 2
1033                    }
1034                },
1035                {
1036                    breakpoint: 768,
1037                    settings:   {
1038                        arrows:         false,
1039                        dots:           false,
1040                        draggable:      true,
1041                        slidesToShow:   2.2,
1042                        slidesToScroll: 2
1043                    }
1044                },
1045                {
1046                    breakpoint: 480,
1047                    settings:   {
1048                        arrows:         false,
1049                        dots:           false,
1050                        draggable:      true,
1051                        slidesToShow:   1.2,
1052                        slidesToScroll: 1
1053                    }
1054                }
1055            ]
1056        });
1057    });
1058
1059    $('.actions__slider').slick({
1060        lazyLoad: 'ondemand',      
1061        dots:           false,
1062        infinite:       false,
1063        speed:          600,
1064        slidesToShow:   3.5,
1065        slidesToScroll: 3,
1066        arrows:         true,
1067        draggable:      false,
1068        appendArrows:   $('.actions__slide_nav'),
1069        prevArrow:      '<div class="slick-prev slick-arrow icons"><div class="nav_prev"><svg class="icon"><use xlink:href="#chevron-left"></use></svg</div></div>',
1070        nextArrow:      '<div class="slick-next slick-arrow icons"><div class="nav_next"><svg class="icon"><use xlink:href="#chevron-right"></use></svg</div></div>',
1071        responsive:     [
1072            {
1073                breakpoint: 1280,
1074                settings:   {
1075                    arrows:         true,
1076                    slidesToShow:   3.5,
1077                    slidesToScroll: 3
1078                }
1079            },
1080            {
1081                breakpoint: 960,
1082                settings:   {
1083                    arrows:         false,
1084                    draggable:      true,
1085                    slidesToShow:   2.5,
1086                    slidesToScroll: 2
1087     
1087           }
1088            },
1089            {
1090                breakpoint: 768,
1091                settings:   {
1092                    arrows:         false,
1093                    draggable:      true,
1094                    slidesToShow:   2.2,
1095                    slidesToScroll: 2
1096                }
1097            },
1098            {
1099                breakpoint: 640,
1100                settings:   {
1101                    arrows:         false,
1102                    draggable:      true,
1103                    slidesToShow:   1.2,
1104                    slidesToScroll: 1
1105                }
1106            },
1107            {
1108                breakpoint: 480,
1109                settings:   {
1110                    arrows:         false,
1111                    draggable:      true,
1112                    slidesToShow:   1.2,
1113                    slidesToScroll: 1
1114                }
1115            }
1116        ]
1117    });
1118
1119    $('.advantages__slider').slick({
1120        lazyLoad: 'ondemand',      
1121        dots:           false,
1122        infinite:       false,
1123        speed:          600,
1124        slidesToShow:   4,
1125        slidesToScroll: 1,
1126        arrows:         false,
1127        draggable:      false,
1128        rows:           2,
1129        appendArrows:   $('.advantages__slide_nav'),
1130        prevArrow:      '<div class="slick-prev slick-arrow icons"><div class="nav_prev"><svg class="icon"><use xlink:href="#chevron-left"></use></svg</div></div>',
1131        nextArrow:      '<div class="slick-next slick-arrow icons"><div class="nav_next"><svg class="icon"><use xlink:href="#chevron-right"></use></svg</div></div>',
1132        responsive:     [
1133            {
1134                breakpoint: 1280,
1135                settings:   {
1136                    arrows:       false,
1137                    slidesToShow: 4
1138                }
1139            },
1140            {
1141                breakpoint: 960,
1142                settings:   {
1143                    arrows:       false,
1144                    draggable:    true,
1145                    slidesToShow: 2.5
1146                }
1147            },
1148            {
1149                breakpoint: 768,
1150                settings:   {
1151                    arrows:       false,
1152                    draggable:    true,
1153                    slidesToShow: 2.2,
1154                    rows:         1
1155                }
1156            },
1157            {
1158                breakpoint: 640,
1159                settings:   {
1160                    arrows:       false,
1161                    draggable:    true,
1162                    slidesToShow: 1.2,
1163                    rows:         1
1164                }
1165            },
1166            {
1167                breakpoint: 480,
1168                settings:   {
1169                    arrows:       false,
1170                    draggable:    true,
1171                    slidesToShow: 1.2,
1172                    rows:         1
1173                }
1174            }
1175        ]
1176    });
1177
1178    $('.brands__slider').on('init reInit afterChange', function(event, slick, currentSlide, nextSlide) {
1179
1180        if (!slick.$dots) {
1181            return;
1182        }
1183        var i     = (currentSlide ? currentSlide : 0) + 1;
1184        var total = slick.$dots[0].children.length;
1185
1186
1187        if (i == total) {
1188
1189            $(document).find('.brands__slide.slick-slide.slick-current').removeClass('slick-current');
1190
1191        } else {
1192            $(function() {
1193                $(document).find('.brands__slide.slick-active.slick-current').hover(function() {
1194                        $(document).find('.brands__slide_nav .slick-prev').addClass('hover');
1195                    },
1196                    function() {
1197                        $(document).find('.brands__slide_nav .slick-prev').removeClass('hover');
1198                    });
1199            });
1200        }
1201    });
1202
1203    $('.brands__slider').slick({
1204        lazyLoad: 'ondemand',      
1205        dots:           true,
1206        infinite:       false,
1207        speed:          600,
1208        slidesToShow:   5.5,
1209        slidesToScroll: 1,
1210        arrows:         true,
1211        draggable:      false,
1212        appendArrows:   $('.brands__slide_nav'),
1213        prevArrow:      '<div class="slick-prev slick-arrow icons"><div class="nav_prev"><svg class="icon"><use xlink:href="#chevron-left"></use></svg</div></div>',
1214        nextArrow:      '<div class="slick-next slick-arrow icons"><div class="nav_next"><svg class="icon"><use xlink:href="#chevron-right"></use></svg</div></div>',
1215        responsive:     [
1216            {
1217                breakpoint: 1280,
1218                settings:   {
1219                    arrows:         true,
1220                    slidesToShow:   3.5,
1221                    slidesToScroll: 3
1222                }
1223            },
1224            {
1225                breakpoint: 960,
1226                settings:   {
1227                    arrows:         false,
1228                    draggable:      true,
1229                    slidesToShow:   2.5,
1230                    slidesToScroll: 2
1231                }
1232            },
1233            {
1234                breakpoint: 768,
1235                settings:   {
1236                    arrows:         false,
1237                    draggable:      true,
1238                    slidesToShow:   2.2,
1239                    slidesToScroll: 2
1240                }
1241            },
1242            {
1243                breakpoint: 640,
1244                settings:   {
1245                    arrows:         false,
1246                    draggable:      true,
1247                    slidesToShow:   2.2,
1248                    slidesToScroll: 2
1249                }
1250            },
1251            {
1252                breakpoint: 480,
1253                settings:   {
1254                    arrows:         false,
1255                    draggable:      true,
1256                    slidesToShow:   2.2,
1257                    slidesToScroll: 2
1258                }
1259            }
1260        ]
1261    });
1262
1263    $('.news__slider').slick({
1264        lazyLoad: 'ondemand',      
1265        dots:           false,
1266        infinite:       false,
1267        speed:          600,
1268        slidesToShow:   3.5,
1269        slidesToScroll: 3,
1270        arrows:         true,
1271        draggable:      false,
1272        appendArrows:   $('.news__slide_nav'),
1273        prevArrow:      '<div class="slick-prev slick-arrow icons"><div class="nav_prev"><svg class="icon"><use xlink:href="#chevron-left"></use></svg</div></div>',
1274        nextArrow:      '<div class="slick-next slick-arrow icons"><div class="nav_next"><svg class="icon"><use xlink:href="#chevron-right"></use></svg</div></div>',
1275        responsive:     [
1276            {
1277                breakpoint: 1280,
1278                settings:   {
1279                    arrows:       true,
1280                    slidesToShow: 3
1281                }
1282            },
1283            {
1284                breakpoint: 960,
1285                settings:   {
1286                    arrows:         false,
1287                    draggable:      true,
1288                    slidesToShow:   2.5,
1289                    slidesToScroll: 2
1290                }
1291            },
1292            {
1293                breakpoint: 768,
1294                settings:   {
1295                    arrows:         false,
1296                    draggable:      true,
1297                    slidesToShow:   2.2,
1298                    slidesToScroll: 2
1299                }
1300            },
1301            {
1302                breakpoint: 640,
1303                settings:   {
1304                    arrows:         false,
1305                    draggable:      true,
1306                    slidesToShow:   1.2,
1307                    slidesToScroll: 1
1308                }
1309            },
1310            {
1311                breakpoint: 480,
1312                settings:   {
1313                    arrows:         false,
1314                    draggable:      true,
1315                    slidesToShow:   1.2,
1316                    slidesToScroll: 1
1317                }
1318            }
1319        ]
1320    });
1321
1322    /* Category slider */
1323    $('.category__slider').on('init reInit afterChange', function(event, slick, currentSlide, nextSlide) {
1324
1325        if (!slick.$dots) {
1326            return;
1327        }
1328        var i     = (currentSlide ? currentSlide : 0) - 1;
1329        var total = slick.$dots[0].children.length;
1330
1331        $(document).find('.products__slide.slick-slide.slick-current').removeClass('slick-current');
1332
1333        if (i == total) {
1334            $(document).find('.category__slide.slick-slide.slick-current').removeClass('slick-current');
1335        } else {
1336            $(function() {
1337                $('.category__slide.slick-active.slick-current').hover(function() {
1338                        $(document).find('.category__slide_nav .slick-prev').addClass('hover');
1339                    },
1340                    function() {
1341                        $(document).find('.category__slide_nav .slick-prev').removeClass('hover');
1342                    });
1343            });
1344        }
1345    });
1346
1347    $('.category__slider').slick({
1348        lazyLoad: 'ondemand',      
1349        dots:           true,
1350        infinite:       false,
1351        speed:          600,
1352        slidesToShow:   6.5,
1353        slidesToScroll: 1,
1354        arrows:         true,
1355        draggable:      false,
1356        appendArrows:   $('.category__slide_nav'),
1357        prevArrow:      '<div class="slick-prev slick-arrow icons"><div class="nav_prev"><svg class="icon"><use xlink:href="#chevron-left"></use></svg</div></div>',
1358        nextArrow:      '<div class="slick-next slick-arrow icons"><div class="nav_next"><svg class="icon"><use xlink:href="#chevron-right"></use></svg</div></div>',
1359        responsive:     [
1360            {
1361                breakpoint: 1280,
1362                settings:   {
1363                    arrows:         true,
1364                    slidesToShow:   5.5,
1365                    slidesToScroll: 3
1366                }
1367            },
1368            {
1369                breakpoint: 960,
1370                settings:   {
1371                    arrows:         false,
1372                    draggable:      true,
1373                    slidesToShow:   4.5,
1374                    slidesToScroll: 2
1375                }
1376            },
1377            {
1378                breakpoint: 768,
1379                settings:   {
1380                    arrows:         false,
1381                    draggable:      true,
1382                    slidesToShow:   3.2,
1383                    slidesToScroll: 2
1384                }
1385            },
1386            {
1387                breakpoint: 640,
1388                settings:   {
1389                    arrows:         false,
1390                    draggable:      true,
1391                    slidesToShow:   3.2,
1392                    slidesToScroll: 2
1393                }
1394            },
1395            {
1396                breakpoint: 480,
1397                settings:   {
1398                    arrows:         false,
1399                    draggable:      true,
1400                    slidesToShow:   2.2,
1401                    slidesToScroll: 2
1402                }
1403            },
1404            {
1405                breakpoint: 321,
1406                settings:   {
1407                    arrows:         false,
1408                    draggable:      true,
1409                    slidesToShow:   1.5,
1410                    slidesToScroll: 1
1411                }
1412            }
1413        ]
1414    });
1415
1416    $('.thumbnails__slider_min').on('click', 'a', function(e) {
1417        e.preventDefault();
1418        var el          = $(this),
1419            preview_img = el.attr('data-preview');
1420        el.closest('.thumbnails__slider_min').find('.thumbnail__figure').removeClass('slick-current'),
1421            el.closest('.thumbnail__figure').addClass('slick-current'),
1422            $('.product_img img').attr('src', preview_img);
1423    });
1424
1425    $('.thumbnails__slider_min').slick({
1426        lazyLoad: 'ondemand',      
1427        prevArrow:      '<div class="slick-prev slick-arrow icons"><div class="nav_prev"><svg class="icon"><use xlink:href="#chevron-up"></use></svg</div></div>',
1428        nextArrow:      '<div class="slick-next slick-arrow icons"><div class="nav_next"><svg class="icon"><use xlink:href="#chevron-down"></use></svg</div></div>',
1429        arrows:         true,
1430        dots:           false,
1431        swipe:          true,
1432        slidesToShow:   4,
1433        slidesToScroll: 1,
1434        focusOnSelect:  true,
1435        vertical:       true,
1436        infinite:       false,
1437        responsive:     [
1438            {
1439                breakpoint: 769,
1440                settings:   {
1441                    slidesToShow: 5,
1442                    vertical:     false,
1443                    arrows:       false
1444                }
1445            },
1446            {
1447                breakpoint: 640,
1448                settings:   {
1449                    slidesToShow: 3.2,
1450                    vertical:     false,
1451                    arrows:       false
1452                }
1453            }
1454        ]
1455    });
1456
1457    $('.salon_slider__icons').slick({
1458        lazyLoad: 'ondemand',      
1459        dots:           false,
1460        infinite:       false,
1461        speed:          600,
1462        slidesToShow:   9,
1463        slidesToScroll: 1,
1464        arrows:         true,
1465        draggable:      false,
1466        prevArrow:      '<div class="slick-prev slick-arrow icons"><div class="nav_prev"><svg class="icon"><use xlink:href="#chevron-left"></use></svg</div></div>',
1467        nextArrow:      '<div class="slick-next slick-arrow icons"><div class="nav_next"><svg class="icon"><use xlink:href="#chevron-right"></use></svg</div></div>',
1468        responsive:     [
1469            {
1470                breakpoint: 1280,
1471                settings:   {
1472                    arrows:       true,
1473                    slidesToShow: 7.2
1474                }
1475            },
1476            {
1477                breakpoint: 960,
1478                settings:   {
1479                    arrows:         false,
1480                    draggable:      true,
1481                    slidesToShow:   6.2,
1482                    slidesToScroll: 1
1483                }
1484            },
1485            {
1486                breakpoint: 769,
1487                settings:   {
1488                    arrows:         false,
1489                    draggable:      true,
1490                    slidesToShow:   8.2,
1491                    slidesToScroll: 1
1492                }
1493            },
1494            {
1495                breakpoint: 640,
1496                settings:   {
1497                    arrows:         false,
1498                    draggable:      true,
1499                    slidesToShow:   7.2,
1500                    slidesToScroll: 1
1501                }
1502            },
1503            {
1504                breakpoint: 480,
1505                settings:   {
1506                    arrows:         false,
1507                    draggable:      true,
1508                    slidesToShow:   5.2,
1509                    slidesToScroll: 1
1510                }
1511            },
1512            {
1513                breakpoint: 321,
1514                settings:   {
1515                    arrows:         false,
1516                    draggable:      true,
1517                    slidesToShow:   4.2,
1518                    slidesToScroll: 1
1519                }
1520            }
1521        ]
1522    });
1523
1524    $('.photos__slider').slick({
1525        lazyLoad: 'ondemand',      
1526        dots:           false,
1527        infinite:       false,
1528        speed:          600,
1529        slidesToShow:   3.5,
1530        slidesToScroll: 3,
1531        arrows:         true,
1532        draggable:      false,
1533        appendArrows:   $('.photos__slide_nav'),
1534        prevArrow:      '<div class="slick-prev slick-arrow icons"><div class="nav_prev"><svg class="icon"><use xlink:href="#chevron-left"></use></svg</div></div>',
1535        nextArrow:      '<div class="slick-next slick-arrow icons"><div class="nav_next"><svg class="icon"><use xlink:href="#chevron-right"></use></svg</div></div>',
1536        responsive:     [
1537            {
1538                breakpoint: 1280,
1539                settings:   {
1540                    arrows:         true,
1541                    slidesToShow:   3.5,
1542                    slidesToScroll: 3
1543                }
1544            },
1545            {
1546                breakpoint: 960,
1547                settings:   {
1548                    arrows:         false,
1549                    draggable:      true,
1550                    slidesToShow:   2.5,
1551                    slidesToScroll: 2
1552                }
1553            },
1554            {
1555                breakpoint: 768,
1556                settings:   {
1557                    arrows:         false,
1558                    draggable:      true,
1559                    slidesToShow:   2.2,
1560                    slidesToScroll: 2
1561                }
1562            },
1563            {
1564                breakpoint: 640,
1565                settings:   {
1566                    arrows:         false,
1567                    draggable:      true,
1568                  
1568  slidesToShow:   1.2,
1569                    slidesToScroll: 1
1570                }
1571            },
1572            {
1573                breakpoint: 480,
1574                settings:   {
1575                    arrows:         false,
1576                    draggable:      true,
1577                    slidesToShow:   1.2,
1578                    slidesToScroll: 1
1579                }
1580            }
1581        ]
1582    });
1583
1584    $('.sertificats__slider').slick({
1585        lazyLoad: 'ondemand',      
1586        dots:           false,
1587        infinite:       false,
1588        speed:          600,
1589        slidesToShow:   4.5,
1590        slidesToScroll: 3,
1591        arrows:         true,
1592        draggable:      false,
1593        appendArrows:   $('.photos__slide_nav'),
1594        prevArrow:      '<div class="slick-prev slick-arrow icons"><div class="nav_prev"><svg class="icon"><use xlink:href="#chevron-left"></use></svg</div></div>',
1595        nextArrow:      '<div class="slick-next slick-arrow icons"><div class="nav_next"><svg class="icon"><use xlink:href="#chevron-right"></use></svg</div></div>',
1596        responsive:     [
1597            {
1598                breakpoint: 1280,
1599                settings:   {
1600                    arrows:         true,
1601                    slidesToShow:   3.5,
1602                    slidesToScroll: 3
1603                }
1604            },
1605            {
1606                breakpoint: 960,
1607                settings:   {
1608                    arrows:         false,
1609                    draggable:      true,
1610                    slidesToShow:   2.5,
1611                    slidesToScroll: 2
1612                }
1613            },
1614            {
1615                breakpoint: 768,
1616                settings:   {
1617                    arrows:         false,
1618                    draggable:      true,
1619                    slidesToShow:   2.2,
1620                    slidesToScroll: 2
1621                }
1622            },
1623            {
1624                breakpoint: 640,
1625                settings:   {
1626                    arrows:         false,
1627                    draggable:      true,
1628                    slidesToShow:   2.2,
1629                    slidesToScroll: 1
1630                }
1631            },
1632            {
1633                breakpoint: 480,
1634                settings:   {
1635                    arrows:         false,
1636                    draggable:      true,
1637                    slidesToShow:   1.2,
1638                    slidesToScroll: 1
1639                }
1640            }
1641        ]
1642    });
1643
1644    $('.text-slider').slick({
1645        lazyLoad: 'ondemand',      
1646        slidesToShow:   1,
1647        slidesToScroll: 1,
1648        speed:          800,
1649        arrows:         true,
1650        dots:           true,
1651        prevArrow:      '<div class="slick-prev slick-arrow icons"><div class="nav_prev"><svg class="icon"><use xlink:href="#chevron-left"></use></svg</div></div>',
1652        nextArrow:      '<div class="slick-next slick-arrow icons"><div class="nav_next"><svg class="icon"><use xlink:href="#chevron-right"></use></svg</div></div>',
1653        responsive:     [
1654            {
1655                breakpoint: 1280,
1656                settings:   {
1657                    arrows: true
1658                }
1659            },
1660            {
1661                breakpoint: 960,
1662                settings:   {
1663                    arrows: false
1664                }
1665            }
1666        ]
1667    });
1668
1669    $('.salons__slider').on('init reInit afterChange setPosition', function(event, slick, currentSlide, nextSlide) {
1670
1671        if (!slick.$dots) {
1672            return;
1673        }
1674        var i     = (currentSlide ? currentSlide : 0) + 1;
1675        var total = slick.$dots[0].children.length;
1676
1677
1678        if (i == total) {
1679
1680            $(document).find('.salon__slide.slick-slide.slick-current').removeClass('slick-current');
1681
1682        } else {
1683            $(function() {
1684                $(document).find('.salon__slide.slick-active.slick-current').hover(function() {
1685                        $(document).find('.salons__slide_nav .slick-prev').addClass('hover');
1686                    },
1687                    function() {
1688                        $(document).find('.salons__slide_nav .slick-prev').removeClass('hover');
1689                    });
1690            });
1691        }
1692
1693        $(this).find('.salon__slide.slick-slide').height('auto');
1694        var slickTrack       = $(this).find('.slick-track');
1695        var slickTrackHeight = $(slickTrack).height();
1696        $(this).find('.salon__slide.slick-slide').css('height', slickTrackHeight + 'px');
1697    });
1698
1699    $('.salons__slider').slick({
1700        lazyLoad: 'ondemand',      
1701        dots:           true,
1702        infinite:       false,
1703        speed:          600,
1704        slidesToShow:   3.5,
1705        slidesToScroll: 1,
1706        arrows:         true,
1707        draggable:      false,
1708        appendArrows:   $('.salons__slide_nav'),
1709        prevArrow:      '<div class="slick-prev slick-arrow icons"><div class="nav_prev"><svg class="icon"><use xlink:href="#chevron-left"></use></svg</div></div>',
1710        nextArrow:      '<div class="slick-next slick-arrow icons"><div class="nav_next"><svg class="icon"><use xlink:href="#chevron-right"></use></svg</div></div>',
1711        responsive:     [
1712            {
1713                breakpoint: 1280,
1714                settings:   {
1715                    arrows:       true,
1716                    slidesToShow: 3
1717                }
1718            },
1719            {
1720                breakpoint: 960,
1721                settings:   {
1722                    arrows:         false,
1723                    draggable:      true,
1724                    slidesToShow:   2.5,
1725                    slidesToScroll: 2
1726                }
1727            },
1728            {
1729                breakpoint: 768,
1730                settings:   {
1731                    arrows:         false,
1732                    draggable:      true,
1733                    slidesToShow:   2.2,
1734                    slidesToScroll: 2
1735                }
1736            },
1737            {
1738                breakpoint: 640,
1739                settings:   {
1740                    arrows:         false,
1741                    draggable:      true,
1742                    slidesToShow:   1.2,
1743                    slidesToScroll: 1
1744                }
1745            },
1746            {
1747                breakpoint: 480,
1748                settings:   {
1749                    arrows:         false,
1750                    draggable:      true,
1751                    slidesToShow:   1.2,
1752                    slidesToScroll: 1
1753                }
1754            }
1755        ]
1756    });
1757
1758    /* Slider images products list */
1759    $(document).on('mouseenter', '.image-wrapper__dot', function() {
1760        var t = $(this).parents('.image-wrapper'),
1761            e = t.find('.image-wrapper__image'),
1762            a = t.find('.image-wrapper__dot'),
1763            i = $(this).data('step');
1764
1765        i != t.find('.image-wrapper__dot.active').data('step') && (e.removeClass('active'), a.removeClass('active'), t.find('.image-wrapper__image[data-step="'.concat(i, '"]')).addClass('active'), t.find('.image-wrapper__dot[data-step="'.concat(i, '"]')).addClass('active'))
1766    }),
1767        $(document).on('mouseleave', '.image-wrapper__dots', function() {
1768            var t,
1769                e,
1770                a;
1771            1 == $(this).data('return') && (e = (t = $(this).parents('.image-wrapper')).find('.image-wrapper__image'), a = t.find('.image-wrapper__dot'), e.removeClass('active'), a.removeClass('active'), t.find('.image-wrapper__image[data-step="'.concat(1, '"]')).addClass('active'), t.find('.image-wrapper__dot[data-step="'.concat(1, '"]')).addClass('active'))
1772        });
1773
1774    // Модальное окно "Написать руководителю"
1775    $('html').on('click', '#form-manager, .otzyvy', function() {
1776        $('.js-close-callback').click();
1777
1778        // Поиск и список городов нужно через AJAX грузить. Сделал оформление для примера.
1779        // Поиск и список городов нужно через AJAX грузить. Сделал оформление для примера.
1780        var content_modal = '';
1781        content_modal += '<form>';
1782        content_modal += '<input type="hidden" name="act" value="send"/>';
1783        content_modal += '<div class="form-group form-field--required"><input class="form-input" type="text" name="name" placeholder="Ф.И.О.*" ></div>';
1784        content_modal += '<div class="form-group form-field--required" data-field-type="phone"><input class="form-input phone-masks" type="text" placeholder="Контактный телефон*" name="phone" placeholder="Контактный телефон*" ></div>';
1785        content_modal += '<div class="form-group form-field--required"><input class="form-input"type="email" name="email" placeholder="E-mail*"></div>';
1786        content_modal += '<div class="form-group form-field--required"><textarea class="form-input" name="descr" placeholder="Ваше обращение*" rows="3"></textarea></div>';
1787        /* content_modal += '<div class="form-group" style="height:90px;">';
1788				content_modal += '<div class="g-recaptcha" data-theme="light" data-sitekey="6Le5RL8bAAAAADPpHcVDGeoDGbmLgeMmhkuaRJlt"  data-size="normal"  data-badge="bottomright" data-callback="RecaptchafreeSubmitForm"></div>';
1789				content_modal += '<input type="text" name="captcha_word" style="display:none" size="30" maxlength="50" value="6Le5R" >';
1790			content_modal += '</div>'; */
1791        content_modal += '<div class="form-group">';
1792        content_modal += '<div class="d-inline-flex">';
1793        content_modal += '<div class="icons bg-warning icon-info"><svg class="icon" style="fill: #c75466;"><use xlink:href="#info"></use></svg></div>';
1794        content_modal += '<div class="text-tiny text-gray">Нажимая кнопку "Отправить", я даю свое согласие на обработку моих персональных данных</div>';
1795        content_modal += '</div>';
1796        content_modal += '</div>';
1797        content_modal += '</form>';
1798
1799        showDialog({
1800            id:           'manager-modal',
1801            title:        'Написать руководителю',
1802            text:         content_modal,
1803            contentStyle: {'max-width': '530px'},
1804            ok:           {
1805                id:      'id',
1806                title:   'Отправить',
1807                class:   'col-12',
1808                valid:   true, // Добавлять если нужна проверка в форме
1809                onClick: function(e) {
1810                    var form       = $(document).find('#manager-modal').find('form'),
1811                        valid_form = formValidator(form.get(0));
1812
1813                    if (valid_form) {
1814                        showLoading();
1815
1816                        var url_data = $('#manager-modal_content form').serialize();
1817                        $.post(SITE_TEMPLATE_PATH + '/ajax/manager.php', url_data, function(data) {
1818
1819                            hideLoading();
1820
1821                            $('#manager-modal_content .modal-body').html('<div class="toast toast-success">Ваше обращение успешно отправлено!</div>');
1822                            $('#manager-modal_content .modal-footer').html('');
1823                            yaCounter83890315.reachGoal('bf_zayavka_napisat_rukovoditelu');
1824                        });
1825                    }
1826                }
1827            }
1828
1829
1830        });
1831        $('.phone-masks').mask('+7 (h99) 999-99-99', {
1832            translation: {
1833                'h':         {
1834                    pattern:  /[0|1|2|3|4|5|6|7|9]/,
1835                    fallback: ''
1836                },
1837                placeholder: '+7 (999) 999-99-99'
1838            }
1839        });
1840
1841        return false;
1842    });
1843
1844    /* Пример AJAX запроса с выводом в модальное окно
1845  $("html").on("click", ".search-city", function() {
1846  	var btn = $(this),
1847  			user_id = btn.data("id"),
1848  			url = 'action=user&user_id='+user_id,
1849  			newUrl = '/users/'+user_id+'/';
1850
1851  	showLoading();
1852
1853  	$.post('/main/ajax', url, function(data){
1854
1855  		hideLoading();
1856
1857  		if (data.result == 'ok') {
1858  			showDialog({
1859  				id: 'ok',
1860  				title: '',
1861  				text: data.users,
1862  				contentStyle: {'max-width': '960px'}
1863  			});
1864
1865  		} else {
1866
1867  		}
1868  	}, 'json');
1869
1870  	return false;
1871  });
1872  */
1873
1874    // Прячем окно с подсказкой "Это ваш город ..."
1875    $('.js-city-ok').click(function(event) {
1876        event.stopPropagation();
1877        $('.question-city').addClass('d-hide');
1878        return false;
1879    });
1880
1881
1882    // Глобальные функции для создания "Модальных окон"
1883    function showLoading() {
1884        // remove existing loaders
1885        $('.loading-container').remove();
1886        $('<div id="loader" class="loading-container"><div class="loading loading-lg"></div></div>').appendTo('body');
1887    };
1888
1889    function hideLoading() {
1890        setTimeout(function() {
1891            $('#loader').css({opacity: 0});
1892            $('#loader').remove();
1893        }, 300);
1894    };
1895
1896    function showDialog(options) {
1897        options = $.extend({
1898            id:           'modal',
1899            title:        null,
1900            text:         null,
1901            del:          false,
1902            cancel:       false,
1903            ok:           false,
1904            cancelable:   true,
1905            contentStyle: null,
1906            onLoaded:     false,
1907            onHidden:     false,
1908            hideOther:    true
1909        }, options);
1910
1911        if (options.hideOther) {
1912            // remove existing dialogs
1913            $('.modal').remove();
1914            $(document).unbind('keyup.dialog');
1915        }
1916
1917        $('<div id="' + options.id + '" class="modal"><div class="modal-container" id="' + options.id + '_content"></div></div>').appendTo('body');
1918        var dialog  = $('#' + options.id);
1919        var content = dialog.find('.modal-container');
1920        if (options.contentStyle != null) content.css(options.contentStyle);
1921        if (options.title != null) {
1922            $('<div class="modal-header"><span class="float-right modal-close btn btn-action btn-light icons"><svg class="icon"><use xlink:href="#x"></use></svg></span><div class="modal-title">' + options.title + '</div></div>').appendTo(content);
1923        }
1924        if (options.text != null) {
1925            $('<div class="modal-body">' + options.text + '</div>').appendTo(content);
1926            selectStyle('.form-select');
1927            $('.select_style__list').each(function() {
1928                var selectOption = $(this).find('.select_style__item');
1929                selectOption.on('click', function() {
1930                    var selectedValue = $(this).data('value');
1931                    $(this).closest('div.form-group').find('select option[value="' + selectedValue + '"]').prop('selected', true);
1932                });
1933            });
1934        }
1935        $('.modal-close').click(function(e) {
1936            e.preventDefault();
1937            hideDialog(dialog, options.onHidden);
1938        });
1939        if (options.del || options.cancel || options.ok) {
1940            var buttonBar = $('<div class="modal-footer"></div>');
1941            if (options.del) {
1942                options.del   = $.extend({
1943                    id:      'del',
1944                    title:   'Удалить',
1945                    class:   false,
1946                    valid:   false,
1947                    onClick: null
1948                }, options.del);
1949                var delButton = $('<button class="btn btn-red ' + options.del.class + '" data-id="' + options.del.id + '" data-user-id="' + options.del.user_id + '" id="' + options.del.id + '">' + options.del.title + '</button>');
1950                delButton.click(function(e) {
1951                    e.preventDefault();
1952                    if (options.del.onClick == null || !options.del.onClick(e)) {
1953                        if (options.del.valid) {
1954                            return options.del.valid;
1955                        } else {
1956                            hideDialog(dialog, options.onHidden)
1957                        }
1958                    }
1959                });
1960                delButton.appendTo(buttonBar);
1961            }
1962            if (options.ok) {
1963                options.ok   = $.extend({
1964                    id:      'ok',
1965                    title:   'OK',
1966                    class:   false,
1967                    valid:   false,
1968                    onClick: null
1969                }, options.ok);
1970                var okButton = $('<button class="btn btn-primary ' + options.ok.class + '" id="' + options.ok.id + '">' + options.ok.title + '</button>');
1971                okButton.click(function(e) {
1972                    e.preventDefault();
1973
1974                    if (options.ok.onClick == null || !options.ok.onClick(e)) {
1975                        if (options.ok.valid) {
1976                            return options.ok.valid;
1977                        } else {
1978                            hideDialog(dialog, options.onHidden)
1979                        }
1980                    }
1981                });
1982                okButton.appendTo(buttonBar);
1983            }
1984            if (options.cancel) {
1985                options.cancel = $.extend({
1986                    id:      'cancel',
1987                    title:   'Отмена',
1988                    class:   false,
1989                    valid:   false,
1990                    onClick: null
1991                }, options.cancel);
1992                var canButton  = $('<button class="btn ' + options.cancel.class + '" id="' + options.cancel.id + '">' + options.cancel.title + '</button>');
1993                canButton.click(function(e) {
1994                    e.preventDefault();
1995                    if (options.cancel.onClick == null || !options.cancel.onClick(e)) {
1996                        if (options.cancel.valid) {
1997                            return options.cancel.valid;
1998                        } else {
1999                            hideDialog(dialog, options.onHidden)
2000                        }
2001                    }
2002                });
2003                canButton.appendTo(buttonBar);
2004            }
2005            buttonBar.appendTo(content);
2006        }
2007        if (options.cancelable) {
2008            dialog.click(function() {
2009                hideDialog(dialog, options.onHidden);
2010            });
2011            $(document).bind('keyup.dialog', function(e) {
2012                if (e.which == 27)
2013                    hideDialog(dialog, options.onHidden);
2014            });
2015            content.click(function(e) {
2016                e.stopPropagation();
2017            });
2018        }
2019        setTimeout(function() {
2020
2021            dialog.css({opacity: 1});
2022            if (options.onLoaded)
2023                options.onLoaded();
2024        }, 1);
2025    };
2026
2027    function hideDialog(dialog, callback) {
2028        $(document).unbind('keyup.dialog');
2029        $(document).find(dialog).css({opacity: 0});
2030        setTimeout(function() {
2031            $(document).find(dialog).remove();
2032            if (callback)
2033                callback();
2034        }, 400);
2035    };
2036
2037    // Валидатор формы
2038    function formValidator(form) {
2039        var $form      = $(form),
2040            errorClass = 'has-error',
2041            errorText  = '',
2042            valid      = true;
2043
2044        if ($form.find('.form-field--required').length) {
2045            $form.find('.form-field--required').each(function() {
2046                var field     = $(this),
2047                    fieldType = field.attr('data-field-type'),
2048                    fieldVal;
2049
2050
2051                if (field.find('input:checkbox').length) {
2052                    fieldVal = field.find('input:checkbox').prop('checked');
2053                } else if (field.find('input').length) {
2054                    fieldVal = field.find('input').val();
2055                } else if (field.find('select').length) {
2056                    fieldVal = field.find('select option:selected').val();
2057                } else {
2058                    fieldVal = field.find('textarea').val();
2059                }
2060
2061                if (!fieldVal) {
2062                    field.addClass(errorClass);
2063
2064                    field.find('.form-input-hint').remove();
2065                    field.find('.form-errors__item--required').show();
2066                    valid = false;
2067                } else {
2068                    field.removeClass(errorClass);
2069                    field.find('.form-errors__item--required').hide();
2070
2071                    if (fieldType == 'email') {
2072                        errorText = 'Неверный формат e-mail';
2073                        if (!/^[\.A-z0-9_\-\+]+[@][A-z0-9_\-]+([.][A-z0-9_\-]+)+[A-z]{1,4}$/.test(fieldVal)) {
2074                            field.find('.has-error').append('<p class="form-input-hint">' + errorText + '</p>');
2075                            field.addClass(errorClass);
2076                            valid = false;
2077                        } else {
2078                            field.find('.form-input-hint').remove();
2079                            field.removeClass(errorClass);
2080                        }
2081                    }
2082
2083                    if (fieldType == 'phone') {
2084                        errorText = 'Неверный формат номера телефона';
2085                        if (/[^0-9\+ ()\-]/.test(fieldVal)) {
2086                            $(this).find('.has-error').append('<p class="form-input-hint">' + errorText + '</p>');
2087                            field.addClass(errorClass);
2088                            valid = false;
2089                        } else {
2090                            field.find('.form-input-hint').remove();
2091                            field.removeClass(errorClass);
2092                        }
2093                    }
2094                }
2095            });
2096        }
2097
2098        return valid;
2099    }
2100
2101    /*$(".phone-mask").click(function(){
2102    $(this).setCursorPosition(4);
2103  }).mask("+7 (999) 999-99-99");*/
2104
2105    $('.phone-mask').click(function() {
2106        $(this).mask('+7 (h99) 999-99-99', {
2107            translation: {
2108                'h':         {
2109                    pattern:  /[0|1|2|3|4|5|6|7|9]/,
2110                    fallback: ''
2111                },
2112                placeholder: '+7 (999) 999-99-99'
2113            }
2114        });
2115    });
2116
2117    /* Filters catalog */
2118    $('.filters-accordion').accordionjs({
2119        closeAble:  true,
2120        closeOther: false,
2121        slideSpeed: 250
2122    });
2123
2124    var $tdm = $('.filter');
2125
2126    // Перебераем все .filter
2127    $tdm.each(function() {
2128        // Получаем все пункты label в .filter__list
2129        var $item        = $(this).find('label'),
2130            // Получаем filter__more
2131            $list        = $(this).find('div.filter__more'),
2132            // С помощью фильтра выбираем все пункты, которые идут после пятого
2133            $item_target = $item.filter(function() {
2134                return $(this).index() > 4
2135            });
2136
2137        // Создадим условия для проверки: есть ли элементы после пятого
2138        if ($item_target.length) {
2139            // Скроем не нужное
2140            var $item_targetWrap = $item_target.hide();
2141
2142            // Создаём ссылку, по нажатию на которую будут показываться все пункты
2143            var $link = $('<div class="is-inset-top-12"><a href="#" class="link__border text-primary text-semibold text-small js-show-all"><span>Показать ещё</span></a></div>').click(function() {
2144                // Показываем скрытые пункты
2145                $(this).toggleClass('show_items');
2146
2147                if ($(this).hasClass('show_items')) {
2148                    $item_targetWrap.show();
2149
2150                    $(this).find('.js-show-all').html('<span>Скрыть</span>');
2151                } else {
2152                    $item_targetWrap.hide();
2153
2154                    $(this).find('.js-show-all').html('<span>Показать ещё</span>');
2155                }
2156                // Блокируем все последущие действия ссылки
2157                return false;
2158            }).insertAfter($list);
2159        }
2160        ;
2161    });
2162
2163    // Скрыть показать часть текста в блоке где много текста
2164    $('body').find('.text-more').readmore({
2165        maxHeight: 140,
2166        moreLink:  '<div class="more__link is-inset-top-12"><a href="#" class="text-small text-semibold link__border"><span>Читать полностью</span></a></div>',
2167        lessLink:  '<div class="more__link is-inset-top-12"><a href="#" class="text-small text-semibold link__border"><span>Скрыть</span></a></div>'
2168    });
2169
2170    // Список акций у товара
2171    var $badge = $('.card-image');
2172
2173    // Перебераем все .filter
2174    $badge.each(function() {
2175        // Получаем все пункты label в .filter__list
2176        var $item        = $(this).find('div.badge__list_item'),
2177            // Получаем filter__more
2178            $list        = $(this).find('div.badge__list'),
2179            // С помощью фильтра выбираем все пункты, которые идут после пятого
2180            $item_target = $item.filter(function() {
2181                return $(this).index() > 0
2182            });
2183
2184
2185
2186        // Создадим условия для проверки: есть ли элементы после пятого
2187        if ($item_target.length) {
2188            // Скроем не нужное
2189            var $item_targetWrap = $item_target.hide();
2190
2191            // Создаём ссылку, по нажатию на которую будут показываться все пункты
2192            var $link = $('<div class="js-show-all float-left"><span class="badge__arrow"></span></div>').click(function() {
2193                // Показываем скрытые пункты
2194                $(this).toggleClass('show_items');
2195
2196                if ($(this).hasClass('show_items')) {
2197                    $item_targetWrap.show();
2198                    /*$item_targetWrap.fadeIn(300, function(){
2199            $(this).next().fadeIn(300, arguments.callee);
2200          });*/
2201                    $list.parent().addClass('badge_active');
2202
2203                    $(this).find('.js-show-all').html('<span class="badge__arrow"></span>');
2204                } else {
2205                    $item_targetWrap.hide();
2206                    /*$item_targetWrap.fadeOut(300, function(){
2207            $(this).prev().fadeOut(300, arguments.callee);
2208          });*/
2209                    $list.parent().removeClass('badge_active');
2210
2211                    $(this).find('.js-show-all').html('<span class="badge__arrow"></span>');
2212                }
2213
2214                // Блокируем все последущие действия ссылки
2215                return false;
2216            }).appendTo($list);
2217        }
2218        ;
2219    });
2220
2221    // Подсказки у товара к акциям
2222    $('.tooltip').tooltipster({
2223        interactive:  true,
2224        animation:    'fade',
2225        position:     'bottom',
2226        delay:        200,
2227        maxWidth:     280,
2228        touchDevices: true,
2229        trigger:      'click', // показывать по клику
2230        //trigger: 'hover', // показывать по наведению
2231        // close function
2232        functionReady: function() {
2233            $('.btn-clear').click(function() {
2234                $('.tooltip').tooltipster('hide');
2235            });
2236        }
2237    });
2238
2239    // Подсказки у товара к акциям
2240    $('.social_menu').tooltipster({
2241        interactive:  true,
2242        animation:    'fade',
2243        position:     ['bottom', 'right'],
2244        delay:        200,
2245        maxWidth:     280,
2246        touchDevices: true,
2247        trigger:      'click' // показывать по клику
2248        //trigger: 'hover', // показывать по наведению
2249    });
2250
2251    // Подсказки info
2252    $('.tooltip_info').tooltipster({
2253        interactive:  true,
2254        animation:    'fade',
2255        position:     'top',
2256        delay:        200,
2257        maxWidth:     280,
2258        touchDevices: true,
2259        trigger:      'click', // показывать по клику
2260        //trigger: 'hover', // показывать по наведению
2261        // close function
2262        functionReady: function() {
2263            $('.btn-clear').click(function() {
2264                $('.tooltip_info').tooltipster('hide');
2265            });
2266        }
2267    });
2268
2269    // Подсказки info hover
2270    $('.tooltip_info__hover').tooltipster({
2271        interactive:  true,
2272        animation:    'fade',
2273        position:     'top',
2274        delay:        200,
2275        maxWidth:     280,
2276        touchDevices: true,
2277        trigger:      'hover' // показывать по наведению
2278    });
2279
2280    // СЕО категории
2281    var $cat_tags = $('.catalog-title');
2282
2283    // Перебераем все .filter
2284    $cat_tags.each(function() {
2285        // Получаем все пункты label в .filter__list
2286        var $item        = $(this).find('a.btn'),
2287            // Получаем filter__more
2288            $list        = $(this).find('div.category-tags'),
2289            // С помощью фильтра выбираем все пункты, которые идут после пятого
2290            $item_target = $item.filter(function() {
2291                return $(this).index() > 6
2292            });
2293
2294        // Создадим условия для проверки: есть ли элементы после
2295        if ($item_target.length) {
2296            // Скроем не нужное
2297            var $item_targetWrap = $item_target.hide();
2298
2299            // Создаём ссылку, по нажатию на которую будут показываться все пункты
2300            var $link = $('<div class="is-inset-top-12 d-inline-block"><a href="#" class="link__border text-primary text-semibold text-small js-show-all"><span>Показать ещё</span></a></div>').click(function() {
2301                // Показываем скрытые пункты
2302                $(this).toggleClass('show_items');
2303
2304                if ($(this).hasClass('show_items')) {
2305                    $item_targetWrap.show();
2306
2307                    $(this).find('.js-show-all').html('<span>Скрыть</span>');
2308                } else {
2309                    $item_targetWrap.hide();
2310
2311                    $(this).find('.js-show-all').html('<span>Показать ещё</span>');
2312                }
2313                // Блокируем все последущие действия ссылки
2314                return false;
2315            }).insertAfter($list);
2316        }
2317        ;
2318    });
2319
2320    // Скрываем большие пункты меню
2321    var $menu_tags = $('.header-menu__dropdown-content .col-3');
2322
2323    // Перебераем все ul.nav
2324    $menu_tags.each(function() {
2325        // Получаем все пункты li.nav-item в .ul.nav
2326        var $item        = $(this).find('li.nav-item'),
2327            // Получаем filter__more
2328            $list        = $(this).find('ul.nav'),
2329            // С помощью фильтра выбираем все пункты, которые идут после пятого
2330            $item_target = $item.filter(function() {
2331                return $(this).index() > 5
2332            });
2333
2334        //$item.addClass('test');
2335
2336        // Создадим условия для проверки: есть ли элементы после
2337        if ($item_target.length) {
2338            // Скроем не нужное
2339            var $item_targetWrap = $item_target.hide();
2340
2341            // Создаём ссылку, по нажатию на которую будут показываться все пункты
2342            var $link = $('<div class="is-inset-top-12 d-inline-block"><a href="#" class="link__border text-primary text-semibold text-small js-show-all"><span>Показать все</span></a></div>').click(function() {
2343                // Показываем скрытые пункты
2344                $(this).toggleClass('show_items');
2345
2346                if ($(this).hasClass('show_items')) {
2347                    $item_targetWrap.show();
2348
2349                    $(this).find('.js-show-all').html('<span>Скрыть</span>');
2350                } else {
2351                    $item_targetWrap.hide();
2352
2353                    $(this).find('.js-show-all').html('<span>Показать все</span>');
2354                }
2355                // Блокируем все последущие действия ссылки
2356                return false;
2357            }).insertAfter($list);
2358        }
2359        ;
2360    });
2361
2362
2363    // Активация цвета или опций у товара
2364    $('.product__option').each(function() {
2365
2366        var $list = $(this).find('.product__option_item'),
2367            $item = $list.find('input');
2368
2369        var $link = $item.click(function() {
2370
2371            $list.find('.active').removeClass('active');
2372            $list.find('.active').prop('checked', false);
2373
2374
2375            $(this).prop('checked', true);
2376            $(this).addClass('active');
2377        });
2378
2379    });
2380
2381    // Рейтинг
2382    $('.star.rating').click(function() {
2383        $(this).parent().attr('data-stars', $(this).data('rating'));
2384        $(this).parent().find('input[name=REVIEW_TEXT_rate]').val($(this).data('rating'));
2385    });
2386
2387
2388    $('.thumbnails__slider_min').on('click', 'a.-video', function(e) {
2389        e.preventDefault();
2390        var el = $(this);
2391        el.closest('.thumbnails__slider_min').find('.thumbnail__figure').removeClass('slick-current');
2392        el.closest('.thumbnail__figure').addClass('slick-current');
2393        $('.js-product-main-image').hide();
2394        $('.js-product-video-iframe').show();
2395        document.getElementById('video-product').contentWindow.postMessage('{"event":"command","func":"playVideo","args":""}', '*');
2396    });
2397
2398    $('.thumbnails__slider_min').on('click', 'a:not(.-video)', function(e) {
2399        e.preventDefault();
2400        var el          = $(this),
2401            preview_img = el.attr('data-preview');
2402        el.closest('.thumbnails__slider_min').find('.thumbnail__figure').removeClass('slick-current'),
2403            el.closest('.thumbnail__figure').addClass('slick-current'),
2404            $('.product_img img').attr('src', preview_img),
2405            $('.js-product-video-iframe').hide(),
2406            $('.js-product-main-image').show();
2407            let objVideo = document.getElementById('video-product');
2408
2409            if (objVideo) {
2410                objVideo.contentWindow.postMessage('{"event":"command","func":"pauseVideo","args":""}', '*');
2411            }
2412    });
2413
2414    $(function() {
2415
2416        $('.youtube').each(function() {
2417
2418            var img = $(this).attr('data-img');
2419            if (img) {
2420                $(this).css('background-image', 'url(' + img + ')');
2421            } else {
2422                // Зная идентификатор видео на YouTube, легко можно найти его миниатюру
2423                $(this).css('background-image', 'url(http://i.ytimg.com/vi/' + this.id + '/sddefault.jpg)');
2424            }
2425
2426            // Добавляем иконку Play поверх миниатюры, чтобы было похоже на видеоплеер
2427            $(this).append($('<div/>', {'class': 'play-button play-button__big p-absolute is-shadow-1'}));
2428
2429            $(document).delegate('#' + this.id, 'click', function() {
2430
2431                // создаем iframe со включенной опцией autoplay
2432                var iframe_url = 'https://www.youtube.com/embed/' + this.id + '?autoplay=1&autohide=1&enablejsapi=1';
2433                if ($(this).data('params')) iframe_url += '&' + $(this).data('params');
2434
2435                // Высота и ширина iframe должны быть такими же, как и у родительского блока
2436                //var iframe = $('<iframe/>', {'frameborder': '0', 'src': iframe_url, 'width': $(this).width(), 'height': $(this).height() })
2437                var iframe = $('<iframe/>', {'frameborder': '0', 'id': 'video-product', 'src': iframe_url})
2438
2439                // Заменяем миниатюру HTML5 плеером с YouTube
2440                $(this).wrap('<div class=\'video-responsive\'></div>').replaceWith(iframe);
2441            });
2442        });
2443    });
2444
2445    // Табы (типовые)
2446    $('body').on('click', 'ul.tab li', function(e) {
2447        e.preventDefault();
2448
2449        var refresh             = $(this).parent().data('refresh'),
2450            scroll              = $(this).parent().data('scroll'),
2451            nav                 = $(this).parent(),
2452            containerOuterWidth = $('.is-scrollable').outerWidth(); // узнаем ширину контейнера (width + padding)
2453        nav_height              = nav.outerHeight();
2454
2455        $(this)
2456            .addClass('active').siblings().removeClass('active')
2457            .closest('div.tabs').find('div.tabs__content').removeClass('active').eq($(this).index()).addClass('active');
2458
2459        if (scroll == 'yes') {
2460            $('html, body').animate({
2461                scrollTop: $(nav).offset().top - nav_height - 30
2462            }, 500);
2463        }
2464
2465        if (refresh == 'yes') {
2466            $('.products__slider').slick('refresh');
2467        }
2468
2469        var itemOuterWidth      = $(this).outerWidth(); // узнаем ширину текущего элемента (width + padding)
2470        var itemOffsetLeft      = $(this).offset().left; // узнаем значение отступа слева в контейнере у текущего элемента
2471        var containerScrollLeft = $('.is-scrollable').scrollLeft(); // узнаем текущее значение скролла
2472
2473        var positionCetner = (containerOuterWidth / 2 - itemOuterWidth / 2); // рассчитываем позицию центра
2474
2475        var scrollLeftUpd = containerScrollLeft + itemOffsetLeft - positionCetner; // рассчитываем положение скролла относительно разницы отступа элемента и центра контейнера
2476
2477        // анимируем
2478        $('.is-scrollable').animate({
2479            scrollLeft: scrollLeftUpd
2480        }, 400);
2481    });
2482    // Клики по якорным ссылкам для табов.
2483    $('body').on('click', '.tabs_target', function(e) {
2484        e.preventDefault();
2485
2486        var tab = $(this).data('tab');
2487        $(document).find(tab).click();
2488
2489    });
2490
2491    // Табы (салоны)
2492    $('.tabs_salons').each(function() {
2493        var tabs_salons = $(this);
2494        tabs_salons.on('click', 'div.tab-menu button', function(e) {
2495            e.preventDefault();
2496
2497            var scroll     = tabs_salons.data('scroll'),
2498                nav        = tabs_salons,
2499                nav_height = nav.outerHeight();
2500
2501            $(this)
2502                .addClass('active').siblings().removeClass('active')
2503                .closest(tabs_salons).find('div.tab__salon').removeClass('active').eq($(this).index()).addClass('active');
2504
2505            if (scroll == 'yes') {
2506                $('html, body').animate({
2507                    scrollTop: $(nav).offset().top - nav_height - 30
2508                }, 500);
2509            }
2510        });
2511    });
2512
2513    // Табы (опции товара)
2514    $('body').on('click', '.product__lenses div.tab-menu button', function(e) {
2515        e.preventDefault();
2516
2517        $(this)
2518            .addClass('active').siblings().removeClass('active')
2519            .closest('.product__lenses div.tabs').find('div.tabs__content').removeClass('active').eq($(this).index()).addClass('active');
2520
2521    });
2522
2523    // Ссылки для скрола по странице
2524    $('body').on('click', '.link_target', function(e) {
2525        e.preventDefault();
2526        var id = $(this).data('id-scroll');
2527
2528        $('html, body').animate({
2529            scrollTop: $(id).offset().top
2530        }, 500);
2531
2532        return false;
2533    });
2534
2535    // input type number
2536    // Уменьшаем на 1
2537    $(document).on('click', '.input-number__minus', function() {
2538        let total = $(this).next();
2539        if (total.val() > 1) {
2540            total.val(+total.val() - 1);
2541        }
2542    });
2543    // Увеличиваем на 1
2544    $(document).on('click', '.input-number__plus', function() {
2545        let total = $(this).prev();
2546        total.val(+total.val() + 1);
2547    });
2548    // Запрещаем ввод текста
2549    document.querySelectorAll('.input-number__input').forEach(function(el) {
2550        el.addEventListener('input', function() {
2551            this.value = this.value.replace(/[^\d]/g, '');
2552        });
2553    });
2554
2555    // Видео-блоки
2556    function youtube_parser(url) {
2557        var regExp = /^.*((youtu.be\/)|(v\/)|(\/u\/\w\/)|(embed\/)|(watch\?))\??v?=?([^#&?]*).*/;
2558        var match  = url.match(regExp);
2559        return (match && match[7].length == 11) ? match[7] : false;
2560    }
2561
2562    // Оборачиваем и разбираем frame
2563    $('.content__text iframe').each(function() {
2564        var frame   = $(this),
2565            src     = frame.attr('src'),
2566            title   = frame.attr('title'),
2567            videoId = youtube_parser(src),
2568            img     = 'http://i.ytimg.com/vi/' + videoId + '/sddefault.jpg';
2569
2570        $(this).replaceWith('<div class="text-video"><div class="youtube video-responsive" id="' + videoId + '" data-img="' + img + '"></div><div class="text-video-caption">' + title + '</div></div>');
2571
2572    });
2573
2574    $('.text-externals').each(function() {
2575        var div  = $(this),
2576            link = div.find('a'),
2577            url  = link.attr('href'),
2578            text = link.text();
2579
2580        $(this).replaceWith('<div class="text-externals"><div class="text-externals__item"><a href="' + url + '" class="text-external"><div class="icons text-external-icon"><svg class="icon"><use xlink:href="#link"></use></svg></div><div class="text-external-text"><div class="text-external-text__ttl"><span>' + text + '</span></div><div class="text-external-text__url">' + url + '</div></div></a></div></div>');
2581
2582    });
2583
2584    const observerBackgroundLazy = new IntersectionObserver(function (entries) {
2585        entries.forEach(entry => {
2586            if (entry.isIntersecting) {
2587                entry.target.classList.add('active');
2588            }
2589        });
2590    }, {threshold: 0.1});
2591
2592    const $backgroundLazy = document.querySelectorAll('.background-lazy');
2593
2594    if ($backgroundLazy.length !== 0) {
2595        $backgroundLazy.forEach(elem => {
2596            observerBackgroundLazy.observe(elem);
2597        })
2598    }
2599});
2600
2601/**
2602 * получает список элементов, пагинацию и сортировку с новой страницы
2603 *
2604 * @param {{containerDataQuery: string, nextPage: string}} loadData
2605 * @returns {Promise<{nextItemsContainer: Element, nextPagination: Element, nextSorting: Element}>}
2606 */
2607async function getNextComponentElements(loadData) {
2608    const fetchedHtml        = await getHtmlByUrl(loadData.nextPage);
2609    const nextItemsContainer = fetchedHtml.querySelector(`${loadData.containerDataQuery} [data-items]`);
2610    const nextPagination     = fetchedHtml.querySelector(`${loadData.containerDataQuery} .pagination`);
2611    const nextSorting        = fetchedHtml.querySelector(`${loadData.containerDataQuery} .sorting`);
2612
2613    return {nextItemsContainer, nextPagination, nextSorting};
2614}
2615
2616/**
2617 * получает html со страницы url
2618 *
2619 * @param {string} url
2620 * @returns {Promise<Document>}
2621 */
2622async function getHtmlByUrl(url) {
2623    const result = await (await fetch(url)).text();
2624
2625    return new DOMParser().parseFromString(result, 'text/html');
2626}

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.