PageSourceSearch

https://vodavorle.ru/mg-templates/moguta2/js/script.js?rev=1769854815

js vodavorle.ru collected 2026-10-07 18:01:56 UTC 13,922 bytes, 419 lines download raw bytes

1$(document).ready(function () {
2
3    // add active link
4    // ------------------------------------------------------------
5    $('nav a').each(function () {
6        var location = window.location.href;
7        var link = this.href;
8        if (location == link) {
9            $(this).addClass('active');
10        }
11    });
12
13    // c-nav (mobile menu)
14    // ------------------------------------------------------------
15
16    $("#c-nav__catalog .c-nav__menu").mouseover(function () {
17        MenuOpenCloseTimer(
18            function () {
19                $('.c-catalog .c-button, .l-main, .c-catalog__dropdown--1').addClass('active');
20                $('#c-nav__catalog').addClass('c-nav--open');
21            }
22        );
23    });
24
25    $(".l-header__block .c-catalog").mouseover(function (e) {
26        if (e.target === this) {
27            MenuOpenCloseTimer(
28                function () {
29                    $('.c-catalog .c-button, .l-main, .c-catalog__dropdown--1').addClass('active');
30                    $('#c-nav__catalog').addClass('c-nav--open');
31                }
32            );
33        }
34    });
35
36
37    $("#c-nav__catalog .c-nav__menu>.c-nav__dropdown").mouseout(function () {
38        MenuOpenCloseTimer(
39            function () {
40                $('.c-catalog .c-button, .l-main, .c-catalog__dropdown--1').removeClass('active');
41                $('#c-nav__catalog').removeClass('c-nav--open');
42            }
43        );
44    });
45
46    $(".l-header__block .c-catalog, #c-nav__catalog .c-nav__menu>.c-nav__dropdown li").hover(function () {
47        MenuOpenCloseTimer(
48            function () {
49                $('.c-catalog .c-button, .l-main, .c-catalog__dropdown--1').addClass('active');
50                $('#c-nav__catalog').addClass('c-nav--open');
51            }
52        );
53    }, function () {
54        MenuOpenCloseTimer(
55            function () {
56                $('.c-catalog .c-button, .l-main, .c-catalog__dropdown--1').removeClass('active');
57                $('#c-nav__catalog').removeClass('c-nav--open');
58            }
59        );
60    });
61
62    $(".l-header__top .l-header__block .c-button, .l-header__top .l-header__block #c-nav__menu .c-nav__menu").hover(function () {
63        MenuOpenCloseTimer(
64            function () {
65                $('.l-header__top .l-header__block #c-nav__menu').addClass('c-nav--open');
66            }
67        );
68    }, function () {
69        MenuOpenCloseTimer(
70            function () {
71                $('.l-header__top .l-header__block #c-nav__menu').removeClass('c-nav--open');
72            }
73        );
74    });
75
76    function MenuOpenCloseTimer(funct) {
77        if (typeof this.delayTimer == "number") {
78            clearTimeout(this.delayTimer);
79            this.delayTimer = '';
80        }
81        this.delayTimer = setTimeout(function () {
82            funct();
83        }, 200);
84    }
85
86    $('body').on('click', 'a[href^="#c-nav"]', function (a) {
87        a.preventDefault();
88        var b = $(this).attr('href');
89        $(b).addClass('c-nav--open');
90
91    }), $('body').on('click', '.c-nav', function () {
92        $('.c-nav').removeClass('c-nav--open');
93
94    }), $('body').on('click', '.c-nav__menu', function (a) {
95        a.stopPropagation()
96    });
97
98
99    $('body').on('click', 'a[href^="#c-nav__menu"]', function (a) {
100        a.preventDefault();
101        var b = $(this).attr('href');
102        $(b).addClass('c-nav--open');
103        $('body').addClass('fixed__body')
104
105    }), $('body').on('click', '.c-nav', function () {
106        $('.c-nav').removeClass('c-nav--open');
107        $('body').removeClass('fixed__body')
108
109    }), $('body').on('click', '.c-nav__menu', function (a) {
110        a.stopPropagation()
111    });
112
113
114    $(".c-menu").click(function () {
115        $('.c-nav--open').toggle().removeAttr('style');
116    });
117    $(document).on('click', function (e) {
118        if (!$(e.target).closest(".c-nav--open").length) {
119            $('c-nav.c-nav--open').hide();
120        }
121
122        e.stopPropagation();
123    });
124
125
126    $('body').on('click', '.c-nav__level--1', function () {
127        var a = $(this).siblings();
128
129        if ($(window).width() < 1025) {
130            a.find('.c-nav__dropdown--2').slideUp('fast');
131            $(this).find('.c-nav__dropdown--2').slideToggle('fast');
132        }
133        a.find('.c-nav__icon').removeClass('rotate');
134        $(this).find('.c-nav__icon').toggleClass('rotate');
135    });
136
137
138    // c-catalog
139    // ------------------------------------------------------------
140    $('.c-catalog .c-button').on('click', function () {
141        if ($(window).width() < 1025) {
142            $('.c-catalog .c-button, .l-main, .c-catalog__dropdown--1').toggleClass('active');
143        }
144
145    }), $('body').on('click', function () {
146        if ($(window).width() < 1025) {
147            $('.c-catalog .c-button, .l-main, .c-catalog__dropdown--1').removeClass('active');
148        }
149
150    }), $('body').on('click', '.c-catalog', function (a) {
151        a.stopPropagation()
152    });
153
154    $('.c-catalog__level').hoverIntent({
155        sensitivity: 3,
156        interval: 100,
157        timeout: 200,
158        over: function () {
159            $(this).find('> .c-catalog__dropdown').addClass('active');
160        },
161        out: function () {
162            $(this).find('.c-catalog__dropdown').removeClass('active');
163        }
164    });
165
166
167    // c-modal
168    // ------------------------------------------------------------
169    $('body').on('click', 'a[href^="#c-modal"]', function (a) {
170        a.preventDefault();
171        var b = $(this).attr('href');
172        $(b).addClass('c-modal--open');
173        if ($(document).height() > $(window).height()) {
174            $('html').addClass('c-modal--scroll');
175        }
176
177    }), $('body').on('click', '.c-modal, .c-modal__close, .c-modal__cart', function () {
178        $('.c-modal').removeClass('c-modal--open');
179        $('html').removeClass('c-modal--scroll');
180
181    }), $('body').on('click', '.c-modal__content', function (a) {
182        a.stopPropagation()
183    });
184
185
186    // c-switcher
187    // ------------------------------------------------------------
188    function rememberView() {
189        var className = localStorage['class'];
190        //localStorage.clear();
191        $('.c-switcher__item[data-type="' + className + '"]').addClass('c-switcher__item--active').siblings().removeClass('c-switcher__item--active');
192        $('.c-goods').addClass(className);
193        $('.c-switcher__item').on('click', function () {
194            var currentView = $(this).data('type');
195            var product = $('.c-goods');
196
197            product.removeClass('c-goods--grid c-goods--list');
198            product.addClass(currentView);
199
200            $('.c-switcher__item').removeClass('c-switcher__item--active');
201            $(this).addClass('c-switcher__item--active');
202
203            localStorage.setItem('class', $(this).data('type'));
204            return false;
205        });
206    }
207    rememberView();
208
209
210    // с-carousel
211    // ------------------------------------------------------------
212    $('.c-carousel__content').owlCarousel({
213        nav: true,
214        margin: 16,
215        dots: false,
216        mouseDrag: false,
217        responsive: {
218            0: {
219                items: 1,
220                margin: 10,
221            },
222            360: {
223                items: 2
224            },
225            768: {
226                items: 3
227            },
228            990: {
229                items: 4
230            }
231        },
232        navText: [
233            '<div class="c-carousel__arrow c-carousel__arrow--left"><svg class="icon icon--arrow-left"><use xlink:href="#icon--arrow-left"></use></svg></div>',
234            '<div class="c-carousel__arrow c-carousel__arrow--right"><svg class="icon icon--arrow-right"><use xlink:href="#icon--arrow-right"></use></svg></div>'
235        ]
236    });
237
238    if ($('.c-carousel__content').hasClass('owl-loaded')) {
239        $('.c-carousel').addClass('c-carousel--active');
240    }
241    // С этим товаром покупают
242    $('.c-carousel__content--related').owlCarousel({
243        nav: true,
244        margin: 16,
245        dots: false,
246        mouseDrag: false,
247        responsive: {
248            0: {
249                items: 2,
250                margin: 10
251            },
252            768: {
253                items: 3
254            },
255            990: {
256                items: 4
257            }
258        },
259        navText: [
260            '<div class="c-carousel__arrow c-carousel__arrow--left"><svg class="icon icon--arrow-left"><use xlink:href="#icon--arrow-left"></use></svg></div>',
261            '<div class="c-carousel__arrow c-carousel__arrow--right"><svg class="icon icon--arrow-right"><use xlink:href="#icon--arrow-right"></use></svg></div>'
262        ]
263    });
264
265    if ($('.c-carousel__content--related').hasClass('owl-loaded')) {
266        $('.c-carousel').addClass('c-carousel--active');
267    }
268
269    $('.mg-brand-block').owlCarousel({
270        loop: true,
271        nav: true,
272        responsive: {
273            0: {
274                items: 2,
275                margin: 10
276            },
277            768: {
278                items: 3
279            },
280            990: {
281                items: 6
282            }
283        },
284        navText: [
285            '<div class="c-carousel__arrow c-carousel__arrow--left"><svg class="icon icon--arrow-left"><use xlink:href="#icon--arrow-left"></use></svg></div>',
286            '<div class="c-carousel__arrow c-carousel__arrow--right"><svg class="icon icon--arrow-right"><use xlink:href="#icon--arrow-right"></use></svg></div>'
287        ]
288    });
289
290    // c-filter
291    // ------------------------------------------------------------
292    $('body').on('click', 'a[href^="#c-filter"]', function (a) {
293        a.preventDefault();
294        var b = $(this).attr('href');
295        $(b).addClass('c-filter--active');
296        $('body').addClass('fixed__body');
297
298    }), $('body').on('click', '.c-filter', function () {
299        $('.c-filter').removeClass('c-filter--active');
300        $('body').removeClass('fixed__body');
301
302    }), $('body').on('click', '.c-filter__content', function (a) {
303        a.stopPropagation()
304    });
305
306    // c-tab
307    // ------------------------------------------------------------
308    $('body').on('click', 'a[href^="#c-tab"]', function (a) {
309        a.preventDefault();
310        var b = $(this).attr('href');
311        $(b).addClass('c-tab__content--active');
312        $(b).siblings().removeClass('c-tab__content--active');
313
314        $(this).addClass('c-tab__link--active');
315        $(this).siblings().removeClass('c-tab__link--active');
316    });
317
318
319    // c-compare
320    // ------------------------------------------------------------
321    if ($('.c-compare__item').length == 0) {
322        $('.c-compare').hide();
323    }
324
325
326    // plugin "slider-action"
327    // ------------------------------------------------------------
328    $(document).ready(function () {
329        $('.m-p-slider-wrapper').addClass('show');
330    });
331
332
333    // plugin "product-slider"
334    // ------------------------------------------------------------
335    $(document).ready(function () {
336        $('.mg-advise').addClass('mg-advise--active');
337    });
338
339
340    // agreement
341    // ------------------------------------------------------------
342    $('.l-body').on('change', '.agreement-container [type="checkbox"]', function () {
343        if ($(this).prop('checked')) {
344            $(this).closest('label').removeClass('nonactive').addClass('active');
345        }
346        else {
347            $(this).closest('label').removeClass('active').addClass('nonactive');
348        }
349    });
350
351    // op-field-check
352    // ------------------------------------------------------------
353    $('.l-body').on('change', '.op-field-check [type="checkbox"]', function () {
354        if ($(this).prop('checked')) {
355           $(this).closest('label').removeClass('nonactive').addClass('active');
356        }
357        else{
358            $(this).closest('label').removeClass('active').addClass('nonactive');
359        }
360    });
361
362    $('.l-body').on('change', '.op-field-check [type="radio"]', function () {
363        $('.op-field-check [name='+$(this).attr('name')+']').closest('label').removeClass('active').addClass('nonactive');
364        if ($(this).prop('checked')) {
365           $(this).closest('label').removeClass('nonactive').addClass('active');
366        }
367        else{
368            $(this).closest('label').removeClass('active').addClass('nonactive');
369        }
370    });
371
372    // order
373    // ------------------------------------------------------------
374    $('.c-order__checkbox label').on('click', function () {
375        if ($(this).children('[type="checkbox"]').is(':checked')) {
376            $(this).removeClass('nonactive').addClass('active');
377        } else {
378            $(this).removeClass('active').addClass('nonactive');
379        }
380    });
381    $('.c-order__radiobutton label, .order-storage label').on('click', function () {
382        if ($(this).children('[type="radio"]').is(':checked')) {
383            $(this).removeClass('nonactive').addClass('active');
384            $(this).siblings('label').removeClass('active');
385        }
386    });
387
388}); // end ready
389
390$('input, textarea').each(function () {
391    var $elem = $(this);
392    if ($elem.attr('placeholder') && !$elem[0].placeholder) {
393        var $label = $('<label class="placeholder"></label>').text($elem.attr('placeholder'));
394        $elem.before($label);
395        $elem.blur();
396        if ($elem.val() === '') {
397            $label.addClass('visible');
398        }
399        $label.click(function () {
400            $label.removeClass('visible');
401            $elem.focus();
402        });
403        $elem.focus(function () {
404            if ($elem.val() === '') {
405                $label.removeClass('visible');
406            }
407        });
408        $elem.blur(function () {
409            if ($elem.val() === '') {
410                $label.addClass('visible');
411            }
412        });
413    }
414
415
416    $('.delivery-details-list input[name=delivery]').change(function(){
417        setTimeout(function(){$('.payment-details-list li input:first-child').click();},100);
418    });
419});

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.