PageSourceSearch

https://www.anna-key.ru/bitrix/templates/anna/assets/js/common.js?177703407162369

js anna-key.ru collected 2026-09-25 20:33:49 UTC 62,369 bytes, 1,587 lines download raw bytes

1function mobileDetect() {
2    if (navigator.userAgent.match(/Android/i) || navigator.userAgent.match(/webOS/i) ||
3        navigator.userAgent.match(/iPhone/i) || navigator.userAgent.match(/iPad/i) ||
4        navigator.userAgent.match(/iPod/i) || navigator.userAgent.match(/BlackBerry/i) ||
5        navigator.userAgent.match(/Windows Phone/i)) {
6        return true;
7    }
8
9    return false;
10}
11
12function charCheckTemp(str) {
13    for (i = 0; i < str.length; i++) {
14        if (str.split(str[i]).length - 1 >= 6) {
15            return false;
16        }
17    }
18    return true;
19}
20
21
22
23function doubleImage(element, index) {
24    //передать index null, если нужно что бы работало не в слайдере или одиночно
25
26    var container = element;
27    var containerCoords = container.getBoundingClientRect();
28    var containerWidth = container.offsetWidth;
29    var step = containerWidth;
30    var counter = index;
31
32    var beforeImage = container.querySelector('.js-double-image-before');
33    var afterImage = container.querySelector('.js-double-image-after');
34
35    var nav = container.querySelector('.js-double-image-nav');
36    var navWidth = nav.offsetWidth / (container.offsetWidth / 100);
37
38    var status = false;
39
40    var winWidth = window.innerWidth;
41
42    var offset = 0;
43    var xCoord = 0;
44
45
46    var deviceEvent = {
47        "mousedown": "mousedown",
48        "mouseup": "mouseup",
49        "mousemove": "mousemove"
50    };
51
52    if (mobileDetect()) {
53        deviceEvent.mousedown = "touchstart";
54        deviceEvent.mouseup = "touchend";
55        deviceEvent.mousemove = "touchmove";
56    }
57
58    nav.addEventListener(deviceEvent.mousedown, function(evt) {
59        evt.preventDefault();
60        //console.log("mousedown");
61        status = true;
62    });
63
64    document.addEventListener(deviceEvent.mouseup, function(evt) {
65        //console.log("mouseup");
66        status = false;
67    });
68
69    container.addEventListener(deviceEvent.mousemove, function(evt) {
70        evt.preventDefault();
71        if (status === true) {
72
73            var mouseX = null;
74            var koef = 0;
75
76            mouseX = mobileDetect() ? evt.touches[0].clientX : evt.clientX;
77            koef = (counter === null) ? 0 : step * counter;
78
79            xCoord = mouseX - (containerCoords.left - koef);
80            offset = xCoord / (containerWidth / 100);
81
82            if (offset < 100 && offset > 0) {
83                afterImage.style.left = ((-100) + offset) + "%";
84                nav.style.left = offset + "%";
85            }
86        }
87
88    });
89
90}
91
92
93
94
95function doubleImageBtns(element, stepPercent, speed) {
96    var container = element;
97    var containerCoords = container.getBoundingClientRect();
98    var containerWidth = container.offsetWidth;
99
100    var arrowLeft = container.querySelector('.js-double-image-left');
101    var arrowRight = container.querySelector('.js-double-image-right');
102    var imageBefore = container.querySelector('.js-double-image-before');
103    var imageAfter = container.querySelector('.js-double-image-after');
104    var line = container.querySelector('.js-double-image-line');
105
106    var step = stepPercent;
107    var speed = speed;
108    var animationMinus = null;
109    var animationPlus = null;
110    var repeats = 0;
111
112    function changePosition(type) {
113        var widthPercent = imageAfter.offsetWidth / (containerWidth / 100);
114        var newWidth = 0;
115
116        var innerStep = step * (repeats / 10);
117
118        if (type == "plus") {
119            newWidth = widthPercent + innerStep;
120            newWidth = (newWidth > 100) ? 100 : newWidth;
121        } else if (type == "minus") {
122            newWidth = widthPercent - innerStep;
123            newWidth = (newWidth < 0) ? 0 : newWidth;
124        }
125
126        imageAfter.style.width = newWidth + "%";
127        line.style.left = newWidth + "%";
128        repeats++;
129    }
130
131    arrowLeft.addEventListener('mousedown', function() {
132        animationMinus = setInterval(function() {
133            //console.log('interval minus');
134            changePosition("minus");
135        }, speed);
136    });
137
138    arrowRight.addEventListener('mousedown', function() {
139        animationPlus = setInterval(function() {
140            //console.log('interval plus');
141            changePosition("plus");
142        }, speed);
143    });
144
145    arrowLeft.addEventListener('touchstart', function() {
146        animationMinus = setInterval(function() {
147            //console.log('interval minus');
148            changePosition("minus");
149        }, speed);
150    });
151
152    arrowRight.addEventListener('touchstart', function() {
153        animationPlus = setInterval(function() {
154            //console.log('interval plus');
155            changePosition("plus");
156        }, speed);
157    });
158
159    document.addEventListener('mouseup', function() {
160        repeats = 0;
161        clearInterval(animationMinus);
162        clearInterval(animationPlus);
163    });
164
165    document.addEventListener('touchend', function() {
166        repeats = 0;
167        clearInterval(animationMinus);
168        clearInterval(animationPlus);
169    });
170}
171
172
173
174
175
176function prepaymentList(container, callback) {
177    var containers = document.querySelectorAll(container);
178
179    [].forEach.call(containers, function(container) {
180        var btn = container.querySelector(".js-prepayment-list-current");
181        var body = container.querySelector(".js-prepayment-list-body");
182        var items = body.querySelectorAll(".js-prepayment-list-item");
183
184        btn.addEventListener("click", function() {
185
186            if (!body.classList.contains('-open')) {
187                body.classList.add("-open");
188            } else {
189                body.classList.remove("-open");
190            }
191
192        });
193
194        [].forEach.call(items, function(item) {
195
196            item.addEventListener("click", function() {
197
198                if (!this.classList.contains('-active')) {
199                    var activeItem = body.querySelector(".js-prepayment-list-item.-active");
200                    var studio = this.getAttribute("data-studio");
201
202                    activeItem.classList.remove('-active');
203                    this.classList.add("-active");
204
205                    btn.setAttribute("data-studio", studio);
206                    btn.innerHTML = this.innerHTML;
207
208                    body.classList.remove("-open");
209
210                    if (callback) {
211                        callback();
212                    }
213
214                }
215
216            });
217
218        });
219
220    });
221
222}
223
224
225
226
227function scrollToBlock(toblock) {
228    var el = document.querySelector(toblock);
229    el.scrollIntoView({ behavior: "smooth" });
230}
231
232function windowSize() {
233    var w = window,
234        d = document,
235        e = d.documentElement,
236        g = d.getElementsByTagName('body')[0];
237    var size = {
238        x: '',
239        y: ''
240    }
241    size.x = w.innerWidth || e.clientWidth || g.clientWidth,
242        size.y = w.innerHeight || e.clientHeight || g.clientHeight;
243    return size;
244}
245
246function menuList(box, btnClass, menuClass, toggleClass) {
247    var container = document.querySelector(box);
248
249    var deviceEvent = {
250        "mousedown": "mousedown",
251        "mouseup": "mouseup",
252        "mousemove": "mousemove",
253        "click": "click"
254    };
255
256    if (mobileDetect()) {
257        deviceEvent.mousedown = "touchstart";
258        deviceEvent.mouseup = "touchend";
259        deviceEvent.mousemove = "touchmove";
260        deviceEvent.click = "touchend";
261    }
262
263    if (container) {
264        container.addEventListener(deviceEvent.click, function(event) {
265            var el = event.target;
266            if (el.classList.contains(btnClass) || el.classList.contains('menu-line')) {
267                var menu = container.querySelector(menuClass);
268                menu.classList.toggle(toggleClass);
269            }
270        })
271    }
272}
273
274/*function inputMask(selector){
275  function setCursorPosition(pos, elem) {
276    elem.focus();
277    if (elem.setSelectionRange) elem.setSelectionRange(pos, pos);
278    else if (elem.createTextRange) {
279        var range = elem.createTextRange();
280        range.collapse(true);
281        range.moveEnd("character", pos);
282        range.moveStart("character", pos);
283        range.select()
284    }
285  }
286
287  function mask(event) {
288    var matrix = this.defaultValue,
289        i = 0,
290        def = matrix.replace(/\D/g, ""),
291        val = this.value.replace(/\D/g, "");
292        def.length >= val.length && (val = def);
293    matrix = matrix.replace(/[_\d]/g, function(a) {
294        return val.charAt(i++) || "_"
295    });
296    this.value = matrix;
297    i = matrix.lastIndexOf(val.substr(-1));
298    i < matrix.length && matrix != this.defaultValue ? i++ : i = matrix.indexOf("_");
299    setCursorPosition(i, this)
300  }
301
302  var input = document.querySelector(selector);
303  if(input !== null ){
304    input.addEventListener('input', mask, false);
305  }
306} */
307
308function mobileMenu() {
309
310    var openBtn = document.querySelector('.js-mobile-menu-open');
311    var closedBtn = document.querySelector('.js-mobile-menu-closed');
312    var body = document.querySelector('.js-mobile-menu-body');
313
314    var deviceEvent = {
315        "click": "click"
316    };
317
318    if (mobileDetect()) {
319        deviceEvent.click = "touchend";
320    }
321
322    if (openBtn) {
323        openBtn.addEventListener(deviceEvent.click, function() {
324            document.querySelector('html').style.overflowY = "hidden";
325            document.querySelector('body').style.overflowY = "hidden";
326            body.classList.add('active');
327        });
328    }
329    if (closedBtn) {
330        closedBtn.addEventListener(deviceEvent.click, function() {
331            document.querySelector('html').style.overflowY = "auto";
332            document.querySelector('body').style.overflowY = "auto";
333            body.classList.remove('active');
334        });
335    }
336}
337
338
339function thx_modal(opts) {
340
341    var container = document.querySelector('.js-thx-modal');
342
343    if (container !== null) {
344        var text = document.querySelector('.thx-modal-text');
345        var body = document.querySelector('.thx-modal-body');
346        var closed = document.querySelector('.js-closed');
347
348        closed.addEventListener("click", function() {
349            container.classList.remove("-active");
350        });
351
352        if (!container.classList.contains("-active")) {
353
354            if (opts.delay !== null && typeof(opts.delay) !== "undefined") {
355                var delay = opts.delay;
356            } else {
357                var delay = 4000;
358            }
359
360            if (opts.text !== null && typeof(opts.text) !== "undefined" && opts.text !== "") {
361                text.innerHTML = opts.text;
362            }
363
364            container.classList.add("-active");
365
366            setTimeout(function() {
367                container.classList.remove("-active");
368            }, delay);
369        }
370    }
371}
372
373function orderModal() {
374    var btns = document.querySelectorAll('.js-open-order');
375
376    if (btns !== null && typeof(btns) !== "undefined" && btns.length > 0) {
377        var closedBtn = document.querySelector('.js-order-modal-closed');
378        if (closedBtn !== null) {
379            closedBtn.addEventListener('click', function() {
380                MicroModal.close('order-modal');
381                var themeInput = document.querySelector('#order_theme_field');
382                themeInput.value = "";
383            });
384        }
385
386        [].forEach.call(btns, function(btn) {
387            btn.addEventListener('click', function() {
388                var theme = this.getAttribute('data-service');
389
390                var target = this.getAttribute('data-ym');
391                if (target) {
392                    ym(22313225, 'reachGoal', target);
393                }
394                var ym_target = this.getAttribute('data-target-ym');
395                if (ym_target) {
396                    document.querySelector('#form_target_ym').value = ym_target;
397                }
398
399                var themeInput = document.querySelector('#order_theme_field');
400                themeInput.value = theme;
401                MicroModal.show('order-modal');
402            });
403        });
404    }
405}
406
407function cheapModal() {
408    var btns = document.querySelectorAll('.js-open-cheap');
409
410    if (btns !== null && typeof(btns) !== "undefined" && btns.length > 0) {
411        var closedBtn = document.querySelector('.js-cheap-modal-closed');
412        if (closedBtn !== null) {
413            closedBtn.addEventListener('click', function() {
414                MicroModal.close('want_cheaper_modal');
415            });
416        }
417
418        [].forEach.call(btns, function(btn) {
419            btn.addEventListener('click', function() {
420                MicroModal.show('want_cheaper_modal');
421            });
422        });
423    }
424}
425
426
427
428function showWheelModal() {
429    let wheelModal = document.querySelector('.popup-wheel.js-wheel-modal');
430    if (wheelModal) {
431        wheelModal.classList.add("-open");
432        //ym(22313225, 'reachGoal', 'show-fortune-wheel');
433    }
434}
435
436function showDynamicPopup() {
437    let slider_widget_btn = document.querySelector('.widget-dynamic__btn');
438    let slider_nnpopup_studio = document.querySelector('div#nnpopup.studio');
439    let spa_popup_for_dw = document.querySelector('div#spa_popup');
440    if (slider_widget_btn) {
441        slider_widget_btn.addEventListener('click', function() {
442            spa_popup_for_dw.style.display = 'flex';
443            ym(22313225, 'reachGoal', 'Click_zahvatchik');
444        })
445    }
446}
447
448
449var firstShowSliders = true;
450const slotSliders = document.querySelectorAll('.popup-slot-item');
451
452function showSlotModal() {
453
454    console.log('location.pathname:' + location.pathname);
455    if ((location.pathname != '/payment/') && (location.pathname != '/prepayment/')) {
456        sgPopup698('forceOpen');
457    }
458
459    /*const popupCarousel = document.querySelector('.js-popup-carousel');
460    if(popupCarousel) {
461        popupCarousel.classList.add('__autoshow');
462        popupCarousel.style.display = 'flex';
463    }*/
464
465    /* 
466    MicroModal.show('slot-modal');
467
468    if (firstShowSliders) {
469        for (var i = 0; i < slotSliders.length; i++) {
470            new Swiper(slotSliders[i], {
471                direction: "vertical",
472                loop: true,
473                allowTouchMove: false,
474                autoplay: {
475                    delay: 0,
476                },
477                speed: 2000 + i * 500,
478                initialSlide: 2 * i
479            })
480        }
481        firstShowSliders = false;
482    }
483
484    document.querySelector('body').classList.add('openModal');
485    document.querySelector('div#slot-modal').addEventListener('click', function(e) {
486        let eTarget = e.target;
487        if (eTarget.classList.contains('modal__overlay')) {
488            document.querySelector('body').classList.remove('openModal');
489        }
490    });
491    document.querySelector('div#slot-modal').addEventListener('touchstart', function(e) {
492        let eTarget = e.target;
493        if (eTarget.classList.contains('modal__overlay')) {
494            document.querySelector('body').classList.remove('openModal');
495        }
496    });
497
498    let localStorageSlotPopupPresentIndex = localStorage.getItem('localStorageSlotPopupPresentIndex');
499    let limit = 24 * 3600 * 1000 * 1; // 24 часа * 7 days
500    let localStorageSlotPopupTimer = localStorage.getItem('localStorageSlotPopupTimer');
501    let startSliders = true;
502    let localStorageSlotPopupPresentSlide = localStorage.getItem('localStorageSlotPopupPresentSlide');
503
504    if (localStorageSlotPopupPresentIndex !== null) {
505        startSliders = false;
506    }
507    let prizes = [
508        'Коррекция или окрашивание бровей в подарок',
509        'Скидка на маникюр 40%',
510        'Скидка на наращивание 20%',
511    ]
512    let index_prize = 0;
513
514    if (localStorageSlotPopupTimer !== null) {
515        if (+new Date() - localStorageSlotPopupTimer > limit) {
516            localStorage.clear('localStorageSlotPopupTimer');
517            localStorage.clear('localStorageSlotPopupPresentSlide');
518            localStorage.clear('localStorageSlotPopupPresentIndex');
519            setTimeout(function() {
520                MicroModal.show('slot-modal');
521            }, 25000);
522        } else if (localStorageSlotPopupPresentSlide !== null) {
523            let to_swipers = document.querySelectorAll('.popup-slot-item')
524            for (var i = 0; i < to_swipers.length; i++) {
525                let swiper = to_swipers[i].swiper;
526                swiper.slideToLoop(localStorageSlotPopupPresentSlide, 100, false)
527                swiper.on('slideChange', function() {
528                    swiper.params.autoplay.speed = 0
529                })
530            }
531            const content = document.querySelector('.popup-slot-content')
532            if (content) {
533                content.style.display = 'none'
534            }
535            const success = document.querySelector('.popup-slot-content-success')
536            if (success) {
537                success.style.display = 'flex';
538            }
539            if (localStorageSlotPopupPresentSlide == 3) {
540                // document.querySelector('.popup-slot-success-subtitle').innerHTML = 'Вы попали в 100 из 9000<br> претендентов, среди которых<br> мы разыграем <span>фен Dyson</span> <br>уже 31 июля!';
541                // document.querySelector('.popup-slot-success-subtext').innerHTML = 'Наш менеджер свяжется с Вами <br>в ближайшее время, чтобы рассказать <br>о дальнейших действиях ️❤️';
542                document.querySelector('.popup-slot-success-subtext').classList.add('dyson_margin');
543                document.querySelector('.popup-slot-success-actions_dyson').classList.add('dyson_margin-top-btn');
544                document.querySelector('.popup-slot-success-actions_dyson').style.display = 'block';
545                document.querySelector('form.popup-slot-form input[name="form[gift]"]').value = prizes[localStorageSlotPopupPresentIndex];
546            } else {
547                // document.querySelector('.popup-slot-success-subtitle span').innerHTML = prizes[localStorageSlotPopupPresentIndex];
548                document.querySelector('form.popup-slot-form input[name="form[gift]"]').value = prizes[localStorageSlotPopupPresentIndex];
549                document.querySelector('.popup-slot-success-subtext').style.display = 'none';
550                document.querySelector('.popup-slot-success-actions_gift').style.display = 'block';
551            }
552        }
553    }
554    if (window.location.pathname.indexOf('koleso-fortuny/') >= 1) {
555        ym(22313225, 'reachGoal', 'bandit-rassylka-show');
556        console.dir('single');
557    } else {
558        ym(22313225, 'reachGoal', 'popup-bandit-show');
559        console.dir('main');
560    }
561        */
562}
563
564
565function CheckHasOpenModals() {
566    let checkW = document.querySelector('.popup-wheel.js-wheel-modal');
567    let chckSlot = document.querySelector('#slot-modal');
568    let chckP500 = document.querySelector('.modal-popup500');
569    let popupGifts = document.querySelector('.js-popup-gifts');
570    let popupCarousel = document.querySelector('.js-popup-carousel');
571
572    if (
573        (checkW && checkW.classList.contains('-open')) ||
574        (chckSlot && chckSlot.classList.contains('is-open')) ||
575        (chckP500 && chckP500.classList.contains('isActive')) ||
576        (popupGifts && popupGifts.style.display == 'block') ||
577        (popupCarousel && popupCarousel.style.display == 'block')
578    ) {
579        console.log('Ещё открыт другой поп-ап');
580        setTimeout(function() {
581            CheckHasOpenModals();
582        }, 5000);
583    } else {
584        localStorage.setItem('localStorageSlotPopupTimer', +new Date());
585        showSlotModal();
586    }
587}
588
589
590function slotModal() {
591    const popup = document.querySelector('#slot-modal');
592
593    var slotModalNotSend = true;
594
595    if (popup) {
596
597        const closedBtn = popup.querySelector('.js-slot-modal-closed')
598        if (closedBtn) {
599            closedBtn.addEventListener('click', function() {
600                MicroModal.close('slot-modal');
601                document.querySelector('body').classList.remove('openModal');
602            })
603        }
604
605        const popupForm = popup.querySelector('.popup-slot-form')
606        if (popupForm) {
607
608            let limit = 24 * 3600 * 1000 * 1; // 24 часа * 7 days
609            let localStorageSlotPopupTimer = localStorage.getItem('localStorageSlotPopupTimer');
610            let localStorageSlotPopupPresentSlide = localStorage.getItem('localStorageSlotPopupPresentSlide');
611            let localStorageSlotPopupPresentIndex = localStorage.getItem('localStorageSlotPopupPresentIndex');
612            let prizes = [
613                'Коррекция или окрашивание бровей в подарок',
614                'Скидка на маникюр 40%',
615                'Скидка на наращивание 20%',
616            ]
617            let index_prize = 0;
618
619            if ((window.location.pathname.indexOf('band/') >= 1) || (window.location.pathname.indexOf('koleso-fortuny') >= 1)) {
620                console.log('запустился здесь №3');
621            } else {
622
623                window.onload = function() {
624                    if (localStorageSlotPopupTimer !== null) {
625                        if (+new Date() - localStorageSlotPopupTimer > limit) {
626                            //console.log('зашёл сюда 1');
627                            localStorage.clear('localStorageSlotPopupTimer');
628                            localStorage.clear('localStorageSlotPopupPresentSlide');
629                            localStorage.clear('localStorageSlotPopupPresentIndex');
630                            setTimeout(function() {
631                                console.log('запустился здесь №1');
632                                if (slotModalNotSend) {
633                                    //CheckHasOpenModals()
634                                }
635                            }, 25000);
636                        }
637                    } else {
638                        setTimeout(function() {
639                            console.log('запустился здесь №2');
640                            if (slotModalNotSend) {
641                                //CheckHasOpenModals()
642                            }
643                        }, 25000);
644                    }
645                };
646
647            }
648
649            popupForm.addEventListener('submit', function(event) {
650                event.preventDefault()
651
652                let phoneSuccess = document.querySelector('input#bandit_phone').value;
653                if ((phoneSuccess.length >= 17) && (phoneSuccess.indexOf('_') == -1) && charCheckTemp(phoneSuccess)) {
654                    document.querySelector('input#bandit_phone').style.border = "1px solid #ddd";
655                    if (slotSliders) {
656                        const submitTrigger = popupForm.querySelector('button')
657                        submitTrigger.disabled = true
658
659                        for (let slotSlider of slotSliders) {
660                            slotSlider.swiper.params.speed = 100
661                        }
662
663                        const random = Math.floor(Math.random() * 100) + 1
664                        let prize
665                        switch (true) {
666                            case (random <= 10):
667                                prize = 3; // 10%
668                                index_prize = 0;
669                                break;
670                            case (random <= 55):
671                                prize = 4; // 45%
672                                index_prize = 1;
673                                break;
674                            case (random <= 100):
675                                prize = 5; // 45%
676                                index_prize = 2;
677                                break;
678                                // case (random <= 80):
679                                //     prize = 3
680                                //     index_prize = 2
681                                //     break;
682                                // case (random <= 50):
683                                //     prize = 5
684                                //     index_prize = 0
685                                //     break;
686                                // case (random <= 100):
687                                //     prize = 1
688                                //     index_prize = 1
689                                //     break;
690
691                                // case (random <= 33):
692                                //     prize = 5
693                                //     index_prize = 0
694                                //     break;
695                                // case (random <= 66):
696                                //     prize = 1
697                                //     index_prize = 1
698                                //     break;
699                                // case (random <= 100):
700                                //     prize = 3
701                                //     index_prize = 2
702                                //     break;
703
704                                // case (random <= 80):
705                                //     prize = 5
706                                //     index_prize = 2
707                                //     break;
708
709                                // case (random <= 100):
710                                //     prize = 3
711                                //     index_prize = 3
712                                //     break;
713
714                                // case (random <= 50):
715                                //     prize = 1
716                                //     index_prize = 1
717                                //     break;
718                                // case (random <= 100):
719                                //     prize = 5
720                                //     index_prize = 2
721                                //     break;
722                        }
723                        console.log(random)
724                        console.log(prize)
725                        console.log(index_prize)
726
727                        localStorage.setItem('localStorageSlotPopupPresentSlide', prize);
728                        localStorage.setItem('localStorageSlotPopupPresentIndex', index_prize);
729
730                        setTimeout(function() {
731                            let swipers = popup.querySelectorAll('.popup-slot-item')
732                            for (var i = 0; i < swipers.length; i++) {
733                                let swiper = swipers[i].swiper
734                                setTimeout(function() {
735                                    swiper.slideToLoop(prize, 100, false)
736                                    swiper.on('slideChange', function() {
737                                        swiper.params.autoplay.speed = 0
738                                    })
739                                }, 500 * i)
740                            }
741                        }, 4000)
742
743                        setTimeout(function() {
744                            let swipers = popup.querySelectorAll('.popup-slot-item')
745                            for (var i = 0; i < swipers.length; i++) {
746                                let swiper = swipers[i].swiper
747                                swiper.slideToLoop(prize, 100, false)
748                                swiper.on('slideChange', function() {
749                                    swiper.params.autoplay.speed = 0
750                                })
751                            }
752                            for (var i = 0; i < swipers.length; i++) {
753                                let swiper = swipers[i].swiper
754                                swiper.params.autoplay.speed = 0;
755                            }
756
757                            const content = popup.querySelector('.popup-slot-content')
758                            if (content) {
759                                content.style.display = 'none'
760                            }
761
762                            const success = popup.querySelector('.popup-slot-content-success')
763                            if (success) {
764                                success.style.display = 'flex';
765
766                                if (prize == 3) {
767                                    // document.querySelector('.popup-slot-success-subtitle').innerHTML = 'Вы попали в 100 из 9000<br> претендентов, среди которых<br> мы разыграем <span>фен Dyson</span> <br>уже 31 июля!';
768                                    // document.querySelector('.popup-slot-success-subtext').innerHTML = 'Наш менеджер свяжется с Вами <br>в ближайшее время, чтобы рассказать <br>о дальнейших действиях ️❤️';
769                                    // document.querySelector('.popup-slot-success-subtext').classList.add('dyson_margin');
770                                    document.querySelector('.popup-slot-success-actions_dyson').classList.add('dyson_margin-top-btn');
771                                    document.querySelector('.popup-slot-success-actions_dyson').style.display = 'block';
772                                    document.querySelector('form.popup-slot-form input[name="form[gift]"]').value = prizes[index_prize];
773                                } else {
774                                    // document.querySelector('.popup-slot-success-subtitle span').innerHTML = prizes[index_prize];
775                                    document.querySelector('form.popup-slot-form input[name="form[gift]"]').value = prizes[index_prize];
776                                    document.querySelector('.popup-slot-success-subtext').style.display = 'none';
777                                    document.querySelector('.popup-slot-success-actions_gift').style.display = 'block';
778                                }
779
780                                var getQueryString = function(formData) {
781                                    var pairs = [];
782                                    for (var [key, value] of formData.entries()) {
783                                        pairs.push(encodeURIComponent(key) + '=' + encodeURIComponent(value));
784                                    }
785                                    return pairs.join('&');
786                                }
787                                var popupForm = document.querySelector('.popup-slot-form');
788                                var data = new FormData(popupForm);
789                                var dataForm = getQueryString(data);
790                                const request = new XMLHttpRequest();
791                                const url = "/include/ajax/send.php";
792                                request.open("POST", url, true);
793                                request.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
794                                request.addEventListener("readystatechange", () => {
795                                    if (request.readyState === 4 && request.status === 200) {
796                                        var response = JSON.parse(request.responseText);
797                                        if (response.submit == "success") {
798
799                                            if (window.location.pathname.indexOf('koleso-fortuny/') >= 1) {
800                                                ym(22313225, 'reachGoal', 'bandit-rassylka-lead')
801                                                console.log('ym: bandit-otpravka-stranitca');
802                                                // setTimeout(function() {
803                                                //     let bandit_phone = document.querySelector('input#bandit_phone').value.replaceAll(' ', '').replaceAll('-', '').replaceAll('(', '').replaceAll(')', '');
804                                                //     window.location.href = 'https://www.anna-key.ru/spasibo-sonline/?phone=' + bandit_phone + '';
805                                                // }, 5000);
806                                                slotModalNotSend = false;
807                                            } else {
808                                                ym(22313225, 'reachGoal', 'popup-bandit-lead')
809                                                console.log('ym: otpravka-bandit');
810                                                // setTimeout(function() {
811                                                //     let bandit_phone = document.querySelector('input#bandit_phone').value.replaceAll(' ', '').replaceAll('-', '').replaceAll('(', '').replaceAll(')', '');
812                                                //     window.location.href = 'https://www.anna-key.ru/spasibo-sonline/?phone=' + bandit_phone + '';
813                                                // }, 5000);
814                                                slotModalNotSend = false;
815                                            }
816                                            setTimeout(function() {
817                                                //
818                                            }, 3000);
819                                        }
820                                    }
821                                });
822                                request.send(dataForm);
823                                console.log('bandit - send end');
824                                localStorage.setItem('localStorageSlotPopupTimer', +new Date());
825
826                                let localStorageSlotPopupPresentSlide2 = localStorage.getItem('localStorageSlotPopupPresentSlide');
827                                let to_swipers = document.querySelectorAll('.popup-slot-item')
828                                for (var i = 0; i < to_swipers.length; i++) {
829                                    let swiper = to_swipers[i].swiper;
830                                    swiper.slideToLoop(localStorageSlotPopupPresentSlide2, 100, false)
831                                    swiper.on('slideChange', function() {
832                                        swiper.params.autoplay.speed = 0
833                                    })
834                                }
835
836                            }
837                        }, 5500)
838                    }
839                } else {
840                    document.querySelector('input#bandit_phone').style.border = "1px solid red";
841                }
842            })
843        }
844    }
845}
846
847document.addEventListener("DOMContentLoaded", function() {
848
849
850    const saleApplicationPopup = document.querySelector('#sale-application-popup');
851    // document.querySelector('#sale-application-popup').style.display = 'flex';
852    if (saleApplicationPopup) {
853        const saleApplicationClose = saleApplicationPopup.querySelector('.sale-application-popup-close');
854        if (saleApplicationClose) {
855            saleApplicationClose.addEventListener('click', function() {
856                saleApplicationPopup.style.display = 'none';
857            });
858        }
859    }
860
861
862    MicroModal.init({
863        openTrigger: 'data-custom-open',
864        closeTrigger: 'data-custom-close'
865    });
866
867    function header() {
868        window.state = 0;
869        var header = document.querySelector('.header');
870        if (header) {
871            var headerScrollbot = header.offsetTop + header.offsetHeight;
872
873            window.addEventListener('scroll', function() {
874                var el = document.querySelector('.sticky-part');
875                var mobBtn = document.querySelector('.mobile-button');
876                switch (window.state) {
877                    case 0:
878                        if (window.pageYOffset > headerScrollbot) {
879                            el.classList.add('sticky-fixed');
880                            window.state = 1;
881                        }
882                        break;
883
884                    case 1:
885                        if (window.pageYOffset < headerScrollbot) {
886                            el.classList.remove('sticky-fixed');
887                            window.state = 0;
888                        }
889                        break;
890                }
891                if (window.screen.width < 1024) {
892                    //window.pageYOffset > headerScrollbot ? mobBtn.classList.add('active') : mobBtn.classList.remove('active');
893                    window.pageYOffset > 560 ? mobBtn.classList.add('active') : mobBtn.classList.remove('active');
894                }
895            });
896        }
897    }
898
899    function initCloseMenu() {
900        let btnMenu = document.querySelector('.menu-desk .menu-btn');
901        let menu = document.querySelector('.menu-desk .menuDiv');
902        let toggleMenu = function() {
903            menu.classList.toggle('active');
904        };
905
906        if (btnMenu) {
907            btnMenu.addEventListener('click', function(e) {
908                e.stopPropagation();
909                toggleMenu();
910            });
911
912            document.addEventListener('click', function(e) {
913                let target = e.target;
914                let its_menu = target == menu || menu.contains(target);
915                let its_btnMenu = target == btnMenu;
916                let menu_is_active = menu.classList.contains('active');
917
918                if (!its_menu && !its_btnMenu && menu_is_active) {
919                    toggleMenu();
920                }
921            });
922        }
923    }
924
925    function initCloseMenuCity() {
926        let btnMenu = document.querySelector('.header-location .js-menu-btn');
927        let menu = document.querySelector('.header-location .menuDiv-city');
928        let toggleMenu = function() {
929            menu.classList.toggle('active');
930        };
931
932        if (btnMenu) {
933            btnMenu.addEventListener('click', function(e) {
934                e.stopPropagation();
935                toggleMenu();
936            });
937
938            document.addEventListener('click', function(e) {
939                let target = e.target;
940                let its_menu = target == menu || menu.contains(target);
941                let its_btnMenu = target == btnMenu;
942                let menu_is_active = menu.classList.contains('active');
943
944                if (!its_menu && !its_btnMenu && menu_is_active) {
945                    toggleMenu();
946                }
947            });
948        }
949    }
950
951
952    function initCloseMenus() {
953        let btnMenuMain = document.querySelector('.menu-desk .menu-btn');
954        let menuMain = document.querySelector('.menu-desk .menuDiv');
955        let btnMenuCity = document.querySelector('.header-location .js-menu-btn');
956        let menuCity = document.querySelector('.header-location .menuDiv-city');
957
958        if (btnMenuMain) {
959            btnMenuMain.addEventListener('click', function() {
960                if (menuCity.classList.contains('active')) {
961                    menuCity.classList.remove('active');
962                }
963            });
964        }
965
966        if (btnMenuCity) {
967            btnMenuCity.addEventListener('click', function() {
968                if (menuMain.classList.contains('active')) {
969                    menuMain.classList.remove('active');
970                }
971            });
972        }
973    }
974
975    function prepaymentModal() {
976
977        var modal = document.querySelector('#prepayment');
978
979        if (modal !== null) {
980
981            var attention = {
982                btn: null,
983                agree: null,
984                submit: null,
985                btnPositive: "нет",
986                btnNegative: "Согласуйте свою запись по телефону<br> <a href='tel:+7 (495) 374-69-63'>+7 (495) 374-69-63</a>"
987            }
988
989            attention.btn = document.querySelector('.js-attention-btn');
990            attention.agree = document.querySelector('.js-agree');
991            attention.submit = document.querySelector('.js-prepayment-modal-submit');
992
993
994            attention.btn.addEventListener('click', function() {
995                if (!this.classList.contains('-disable')) {
996                    attention.btn.classList.add('-disable');
997                    attention.agree.classList.add('-disable');
998                    attention.submit.setAttribute('disabled', 'disabled');
999                    attention.btn.innerHTML = attention.btnNegative;
1000                }
1001            });
1002
1003            attention.agree.addEventListener('click', function() {
1004                if (this.classList.contains('-disable')) {
1005                    attention.btn.classList.remove('-disable');
1006                    attention.agree.classList.remove('-disable');
1007                    attention.submit.removeAttribute('disabled')
1008                    attention.btn.innerHTML = attention.btnPositive;
1009                }
1010            });
1011
1012        }
1013    }
1014
1015    function modalInit(selector, clickTarget, widgetSubmitTarget, showTarget, showSubmitTarget, timer, delay = 7) {
1016        let modal = document.querySelector(".js-" + selector + "-modal");
1017        let close = document.querySelector(".js-" + selector + "-close");
1018        let trigger = document.querySelector(".js-" + selector + "-trigger");
1019        let form = document.querySelector(".js-" + selector + "-modal form");
1020
1021        let first_visit_modal500 = false;
1022        let popup500cookie = localStorage.getItem('first_visit_modal500');
1023
1024
1025        if (modal) {
1026
1027            if (selector == 'popup500') {
1028
1029                ym(22313225, 'reachGoal', 'vidget-skidka-pokaz')
1030
1031                let popup500cookie = localStorage.getItem('firstVisitCookie_popup500');
1032                if (popup500cookie != null) {
1033                    first_visit_modal500 = false;
1034                    // console.log('test: не первый визит');
1035                } else {
1036                    localStorage.setItem('firstVisitCookie_popup500', 'true');
1037                    first_visit_modal500 = true;
1038                    //first_visit = false;
1039                    // console.log('test: это первый визит');
1040                }
1041                //timer = 40000;
1042            }
1043
1044
1045            if (trigger) {
1046                trigger.addEventListener('click', function() {
1047
1048                    if (selector == 'popup500') {
1049
1050                        //modal.classList.add('isActive');
1051                        //ym(22313225, 'reachGoal', clickTarget);
1052                        // sgPopup130('open');
1053                        sgPopup746('forceOpen');
1054                        ym(22313225, 'reachGoal', 'vidget-skidka-click');
1055
1056
1057                        if (form) {
1058                            form.setAttribute('data-target', widgetSubmitTarget);
1059                        }
1060
1061                        //if (popup500cookie != null) {
1062                        //console.log('сработало тут №1');
1063                        //modal.classList.add('isActive');
1064                        //ym(22313225, 'reachGoal', clickTarget);
1065                        //ym(22313225, 'reachGoal', 'vidget-skidka-click')
1066
1067
1068                        //if (form) {
1069                        //form.setAttribute('data-target', widgetSubmitTarget);
1070                        //}
1071                        //} else {
1072                        // let nnpopup_upd = document.querySelector('div#nnpopup.studio.upd')
1073                        // if (nnpopup_upd) {
1074
1075                        //     console.log('сработало тут №55');
1076
1077                        //     ym(22313225, 'reachGoal', clickTarget);
1078                        //     nnpopup_upd.classList.add('active');
1079                        // } else {
1080                        //     console.log('сработало тут №2');
1081                        //     modal.classList.add('isActive');
1082                        //     ym(22313225, 'reachGoal', clickTarget);
1083                        //     if (form) {
1084                        //         form.setAttribute('data-target', widgetSubmitTarget);
1085                        //     }
1086                        // }
1087                        //}
1088
1089                    } else {
1090                        // modal.classList.add('isActive');
1091                        // ym(22313225, 'reachGoal', clickTarget);
1092                        // if (form) {
1093                        //     form.setAttribute('data-target', widgetSubmitTarget);
1094                        // }
1095                    }
1096                })
1097            }
1098
1099            if (form) {
1100                form.classList.add('modal-content__form');
1101                form.addEventListener('submit', function() {
1102                    let target = form.getAttribute('data-target');
1103
1104                    console.log('сработало тут №3');
1105
1106                    modal.classList.remove('isActive');
1107                    ym(22313225, 'reachGoal', target);
1108                    //console.log('form-phone:' + form.querySelector('.mask-phone').value.replaceAll(' ',''));
1109                    let form_phone = form.querySelector('.mask-phone').value.replaceAll(' ', '').replaceAll('-', '').replaceAll('(', '').replaceAll(')', '');
1110                    //thx_modal({ "delay": 3000, "text": "Заявка отправлена успешно!" });
1111                    window.location.href = 'https://www.anna-key.ru/spasibo-sonline/?phone=' + form_phone + '';
1112                })
1113            }
1114
1115
1116
1117
1118            if (timer && first_visit_modal500) {
1119
1120                function CheckIsOpenModal() {
1121                    if (
1122                        document.querySelector('.popup-wheel.js-wheel-modal').classList.contains('-open') ||
1123                        //document.querySelector('#slot-modal').classList.contains('is-open') ||
1124                        document.querySelector('.modal-popup500').classList.contains('isActive')
1125                    ) {
1126                        console.log('Popup ещё открыт');
1127                        setTimeout(function() {
1128                            CheckIsOpenModal();
1129                        }, 5000);
1130                    } else {
1131                        //if (first_visit_modal500) {
1132                        //  console.log('сработало тут №4');
1133                        modal.classList.add('isActive');
1134                        ym(22313225, 'reachGoal', showTarget);
1135                        localStorage.setItem('localStorageInitTime' + selector, +new Date());
1136                        if (form) {
1137                            form.setAttribute('data-target', showSubmitTarget);
1138                        }
1139                        //}
1140                    }
1141                }
1142
1143
1144                function initModalByTimer() {
1145                    CheckIsOpenModal();
1146                }
1147
1148                setTimeout(function() {
1149                    console.log('запускается: ' + selector + ', таймер: ' + timer);
1150                    let limit = 24 * 3600 * 1000 * delay; // 24 часа
1151                    let localStorageInitTime = localStorage.getItem('localStorageInitTime' + selector);
1152                    // console.log(localStorageInitTime);
1153                    // if (localStorageInitTime === null) {
1154                    //     initModalByTimer()
1155                    // } else if (+new Date() - localStorageInitTime > limit) {
1156                    //     localStorage.clear('localStorageInitTime' + selector);
1157                    //     initModalByTimer()
1158                    // }
1159                    if (first_visit_modal500) {
1160                        initModalByTimer()
1161                    }
1162                }, timer)
1163
1164            }
1165
1166            if (close) {
1167                close.addEventListener('click', function() {
1168                    modal.classList.remove('isActive');
1169                })
1170            }
1171
1172            setTimeout(function() {
1173                localStorage.setItem('first_visit_modal500', 'true');
1174            }, 5000);
1175
1176        }
1177    }
1178
1179    function widgetClose() {
1180        let widget = document.querySelector('.widget');
1181        let widgetClose = document.querySelector('.widget-close');
1182
1183        if (widgetClose) {
1184            widgetClose.addEventListener('click', function() {
1185                widget.parentNode.removeChild(widget);
1186            })
1187        }
1188    }
1189
1190    function hideCookieBar() {
1191        setTimeout(() => {
1192            let cookieStyle = document.querySelector('.wr-cookie-cookie-bar');
1193            let localStorageInitTime = localStorage.getItem('localStorageInitTimeCookie');
1194            if (cookieStyle) {
1195                cookieStyle.style.display = 'none';
1196                if (localStorageInitTime != 'visited') {
1197                    localStorage.setItem('localStorageInitTimeCookie', 'visited');
1198                    cookieStyle.style.display = 'block';
1199                }
1200                if (document.documentElement.clientWidth < 768) {
1201                    cookieStyle.style.bottom = '47px';
1202                    cookieStyle.style.height = '45px';
1203                    cookieStyle.style.lineHeight = '47px';
1204                }
1205            }
1206        }, 1000);
1207    }
1208
1209    function timeWork() {
1210        let d = new Date();
1211        let day = d.getDay();
1212        let time = d.getHours();
1213        let we_work = document.querySelector(".we_work");
1214        if ((time >= 10) && (time <= 22) && we_work && window.innerWidth < 1200) {
1215            we_work.style.display = "flex";
1216        }
1217    };
1218    setTimeout(function() {
1219        timeWork();
1220    }, 1000);
1221
1222    function initWinterPopup() {
1223        let popup = document.querySelector('.js-popup-winter'),
1224            popupCloseButtons = document.querySelectorAll('.js-popup-winter-close');
1225
1226        if (popup) {
1227
1228            //fade in
1229            let limit = 24 * 3600 * 1000; // 24 часа
1230            let localStoragePopup = localStorage.getItem('localStoragePopupWinter');
1231
1232            if (+new Date() - localStoragePopup > limit) {
1233                localStorage.removeItem('localStoragePopupWinter');
1234            }
1235
1236            setTimeout(() => {
1237                if (!(localStorage.getItem('localStoragePopupWinter'))) {
1238                    popup.classList.add('active');
1239                    localStorage.setItem('localStoragePopupWinter', +new Date());
1240                    ym(22313225, 'reachGoal', 'pokaz-popup-zimskidka')
1241                }
1242            }, 45000);
1243
1244            //fade out
1245            for (let closeBtn of popupCloseButtons) {
1246                closeBtn.addEventListener('click', () => {
1247                    popup.classList.remove('active');
1248                });
1249            }
1250
1251        }
1252    }
1253
1254
1255    //inputMask('.phoneMask');
1256    mobileMenu();
1257    menuList('.header-menu', 'js-menu-btn', '.menuDiv', 'active');
1258    menuList('.header-location', 'js-menu-btn', '.menuDiv', 'active');
1259    menuList('.mobile-menu-location', 'js-menu-btn', '.menuDiv', 'active');
1260    header();
1261    initCloseMenu();
1262    initCloseMenuCity();
1263    initCloseMenus();
1264    prepaymentList('.js-prepayment-list');
1265    prepaymentModal();
1266    orderModal();
1267    cheapModal();
1268    slotModal();
1269
1270
1271    modalInit('popup500', 'dvoynoy-vidget-skidka-click', 'vidget-skidka-otpravka', 'show-popup-skidka-visit', 'send-popup-skidka-visit', false);
1272
1273    // initWinterPopup();
1274    // modalInit('popup500', 'click_vidg_podarok', 'dvoynoy-vidget-skidka-otpravka', 'show-popup-skidka-visit', 'send-popup-skidka-visit');
1275
1276    // modalInit('may', 'click-vidget-actsiya-may', 'otpravka-vidget-actciya-may', 'pokaz-actsiya-may', 'otpravka-actsiya-may', 40000);
1277    widgetClose();
1278    hideCookieBar();
1279
1280    //showDynamicPopup();
1281
1282    setTimeout(function() {
1283        let top_slider = document.querySelector('div#topSlider');
1284        if (top_slider) {
1285            document.querySelectorAll('#topSlider > .tns-item[id^="bx_"]').forEach(function(item, index) {
1286                item.addEventListener('click', function(event) {
1287                    //console.log('thumbnail[i]: ' + index);
1288                    if (index == 0) {
1289                        ym(22313225, 'reachGoal', 'banner-fortune-click');
1290                        ym(22313225, 'reachGoal', 'banner-fortune-popup-show');
1291                    } else if (index == 1) {
1292                        ym(22313225, 'reachGoal', 'click-1-banner');
1293                    } else if (index == 2) {
1294                        ym(22313225, 'reachGoal', 'click-iloveak-banner');
1295                    } else if (index == 3) {
1296                        ym(22313225, 'reachGoal', 'click-order-banner');
1297                    } else if (index == 4) {
1298                        ym(22313225, 'reachGoal', 'click-2-banner');
1299                    } else if (index == 5) {
1300                        ym(22313225, 'reachGoal', 'click-6-banner');
1301                    } else if (index == 6) {
1302                        ym(22313225, 'reachGoal', 'click-7-banner');
1303                    } else if (index == 7) {
1304                        ym(22313225, 'reachGoal', 'click-8-banner');
1305                    } else if (index == 8) {
1306                        ym(22313225, 'reachGoal', 'click-9-banner');
1307                    } else if (index == 9) {
1308                        ym(22313225, 'reachGoal', 'click-10-banner');
1309                    }
1310                });
1311            });
1312        }
1313    }, 1000);
1314
1315    const topbar_n_btn = document.querySelector('#topbar_btn_popup');
1316    if (topbar_n_btn) {
1317        topbar_n_btn.addEventListener('click', function() {
1318            sgPopup132('forceOpen');
1319        });
1320    }
1321
1322});
1323
1324let sonlineWidgetOptions = {
1325    groupid: 92,
1326    cityid: 1,
1327    tracking: 'site'
1328};
1329let sonlineWidgetOptionsPiter = {
1330    groupid: 92,
1331    cityid: 5,
1332    tracking: 'site'
1333};
1334let sonlineWidgetOptionskrasnodar = {
1335    groupid: 92,
1336    cityid: 67,
1337    tracking: 'site'
1338};
1339let sonlineWidgetOptionsTula = {
1340    groupid: 92,
1341    cityid: 85,
1342    tracking: 'site'
1343};
1344let sonlineWidgetOptionsNn = {
1345    groupid: 92,
1346    cityid: 11,
1347    tracking: 'site'
1348};
1349
1350
1351let test_bandit = document.querySelector('input#bandit_phone');
1352if (test_bandit) {
1353    document.querySelector('input#bandit_phone').addEventListener('focus', function() {
1354        let bandit_phone = document.querySelector('input#bandit_phone');
1355        if (bandit_phone.value == '') {
1356            bandit_phone.value = '+7';
1357        }
1358    })
1359}
1360
1361function handleSidebarClick(event) {
1362    const header = event.currentTarget;
1363    const item = header.parentElement;
1364    const child = item.querySelector(".price-page__sidebar-item-child");
1365    let isOpen = false;
1366
1367    if (window.innerWidth > 767) {
1368        if (child) {
1369            if (!isOpen) {
1370                event.preventDefault();
1371                header.classList.add('opened-header');
1372                child.style.display = isOpen ? "none" : "flex";
1373                isOpen = !isOpen;
1374            }
1375        }
1376
1377        if (!item.classList.contains('active-parent-item')) {
1378            sidebarItems.forEach(function(otherItem) {
1379                otherItem.classList.remove('active-parent-item');
1380            });
1381        }
1382
1383        sidebarItems.forEach(function(otherItem) {
1384            const otherChild = otherItem.querySelector(".price-page__sidebar-item-child");
1385            if (otherChild && otherChild !== child && otherChild.style.display === "flex") {
1386                otherChild.style.display = "none";
1387            }
1388        });
1389    }
1390}
1391
1392const sidebarItems = document.querySelectorAll(".price-page__sidebar-item");
1393
1394sidebarItems.forEach(function(item) {
1395    const header = item.querySelector(".price-page__sidebar-item-header");
1396    header.addEventListener("click", handleSidebarClick);
1397});
1398
1399window.addEventListener("resize", function() {
1400    if (window.innerWidth <= 767) {
1401        sidebarItems.forEach(function(item) {
1402            const child = item.querySelector(".price-page__sidebar-item-child");
1403            if (child && child.style.display === "flex") {
1404                child.style.display = "none";
1405            }
1406        });
1407    }
1408});
1409
1410document.addEventListener("DOMContentLoaded", function() {
1411    /*const sidebarItems = document.querySelectorAll(".price-page__sidebar-item");
1412
1413    sidebarItems.forEach(function(item) {
1414        const header = item.querySelector(".price-page__sidebar-item-header");
1415        const child = item.querySelector(".price-page__sidebar-item-child");
1416
1417        let isOpen = false;
1418
1419        header.addEventListener("click", function(event) {
1420            if (child) {
1421                if (!isOpen) {
1422                    event.preventDefault();
1423                    header.classList.add('opened-header');
1424                    child.style.display = isOpen ? "none" : "flex";
1425                    isOpen = !isOpen;
1426                }
1427            }
1428
1429            if (!item.classList.contains('active-parent-item')) {
1430                sidebarItems.forEach(function(otherItem) {
1431                    otherItem.classList.remove('active-parent-item');
1432                });
1433            }
1434
1435            sidebarItems.forEach(function(otherItem) {
1436                const otherChild = otherItem.querySelector(".price-page__sidebar-item-child");
1437                if (otherChild && otherChild !== child && otherChild.style.display === "flex") {
1438                    otherChild.style.display = "none";
1439                }
1440            });
1441        });
1442    });*/
1443
1444    const anchor = window.location.hash;
1445
1446    if (anchor) {
1447        const targetElement = document.querySelector(`[data-scroll="${anchor.substring(1)}"]`);
1448        if (targetElement) {
1449            const offsetTop = targetElement.offsetTop;
1450
1451            window.scrollTo({
1452                top: offsetTop - 150,
1453                behavior: 'smooth'
1454            });
1455        }
1456    }
1457
1458    var currentPagePath = window.location.pathname.replace(/^https:\/\/www.anna-key.ru\//, '');
1459    var sidebarLinks = document.querySelectorAll('.price-page__sidebar-item-header');
1460
1461    if (sidebarLinks) {
1462        for (var i = 0; i < sidebarLinks.length; i++) {
1463            var link = sidebarLinks[i];
1464            var linkHref = link.getAttribute('href');
1465
1466            if (linkHref === currentPagePath) {
1467                link.parentNode.classList.add('active-parent-item');
1468            }
1469        }
1470    }
1471
1472    var childItems = document.querySelectorAll(".price-page__sidebar-item-child-item");
1473
1474    childItems.forEach(function(item) {
1475        item.addEventListener("click", function(event) {
1476            var href = this.getAttribute("href");
1477            var targetId = href.substring(href.indexOf("#") + 1);
1478            var scrollToElement = document.querySelector("[data-scroll='" + targetId + "']");
1479
1480            if (scrollToElement) {
1481                event.preventDefault();
1482                window.scrollTo({
1483                    top: scrollToElement.offsetTop - 100,
1484                    behavior: 'smooth'
1485                });
1486            }
1487        });
1488    });
1489
1490
1491
1492    window.SendWheelTarget = 'send-fortune-wheel';
1493
1494
1495
1496    function CheckShowWheelFromService() {
1497        let checkW = document.querySelector('.popup-wheel.js-wheel-modal');
1498        let chckSlot = document.querySelector('#slot-modal');
1499        let chckP500 = document.querySelector('.modal-popup500');
1500        let popupGifts = document.querySelector('.js-popup-gifts');
1501        let popupCarousel = document.querySelector('.js-popup-carousel');
1502
1503        if (
1504            (checkW && checkW.classList.contains('-open')) ||
1505            (chckSlot && chckSlot.classList.contains('is-open')) ||
1506            (chckP500 && chckP500.classList.contains('isActive')) ||
1507            (popupGifts && popupGifts.style.display == 'block') ||
1508            (popupCarousel && popupCarousel.style.display == 'flex')
1509        ) {
1510            console.log('Ещё открыт другой поп-ап');
1511            setTimeout(function() {
1512                CheckShowWheelFromService();
1513            }, 25000);
1514        } else {
1515
1516            let wheellimit = 24 * 3600 * 1000 * 1; // 24 часа * 7 days
1517            let showWheelFromService = localStorage.getItem('showWheelFromService');
1518
1519            if (showWheelFromService !== null) {
1520                if (+new Date() - showWheelFromService > wheellimit) {
1521                    localStorage.clear('showWheelFromService');
1522                    if (((location.pathname != '/payment/') && (location.pathname != '/uslugi/premium/'))) {
1523                        sgPopup698('forceOpen'); //sgPopup698('open');
1524                        ym(22313225, 'reachGoal', 'show-fortune-wheel');
1525                        localStorage.setItem('showWheelFromService', +new Date());
1526                    }
1527                }
1528            } else {
1529                if ((location.pathname != '/payment/') && (location.pathname != '/uslugi/premium/')) {
1530                    sgPopup698('forceOpen'); //sgPopup698('open');
1531                    ym(22313225, 'reachGoal', 'show-fortune-wheel');
1532                    localStorage.setItem('showWheelFromService', +new Date());
1533                }
1534            }
1535        }
1536    }
1537
1538    setTimeout(function() {
1539        CheckShowWheelFromService();
1540    }, 30000);
1541
1542
1543
1544    function CheckShowCarousel() {
1545        let checkW = document.querySelector('.popup-wheel.js-wheel-modal');
1546        let chckSlot = document.querySelector('#slot-modal');
1547        let chckP500 = document.querySelector('.modal-popup500');
1548        let popupGifts = document.querySelector('.js-popup-gifts');
1549        let popupCarousel = document.querySelector('.js-popup-carousel');
1550
1551        if (
1552            (checkW && checkW.classList.contains('-open')) ||
1553            (chckSlot && chckSlot.classList.contains('is-open')) ||
1554            (chckP500 && chckP500.classList.contains('isActive')) ||
1555            (popupGifts && popupGifts.style.display == 'flex')
1556        ) {
1557            console.log('Ещё открыт другой поп-ап');
1558            setTimeout(function() {
1559                CheckShowCarousel();
1560            }, 25000);
1561        } else {
1562
1563            let limit = 24 * 3600 * 1000 * 1; // 24 часа * 7 days
1564            let PopupCarouselCountdown = localStorage.getItem('PopupCarouselCountdown');
1565
1566            if (PopupCarouselCountdown !== null) {
1567                if (+new Date() - PopupCarouselCountdown > limit) {
1568                    localStorage.clear('PopupCarouselCountdown');
1569                    popupCarousel.style.display = 'flex';
1570                    popupCarousel.classList.add('__autoshow');
1571                    ym(22313225, 'reachGoal', 'show-fortune-wheel');
1572                    localStorage.setItem('PopupCarouselCountdown', +new Date());
1573                }
1574            } else {
1575                popupCarousel.classList.add('__autoshow');
1576                popupCarousel.style.display = 'flex';
1577                ym(22313225, 'reachGoal', 'show-fortune-wheel');
1578                localStorage.setItem('PopupCarouselCountdown', +new Date());
1579            }
1580        }
1581    }
1582
1583    setTimeout(function() {
1584        // CheckShowCarousel();
1585    }, 30000);
1586
1587});

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.