PageSourceSearch

https://perfone.ru/local/assets/js/components/dolyami-modal.js?17683782342214

js perfone.ru collected 2026-10-07 16:17:30 UTC 2,214 bytes, 61 lines download raw bytes

1document.addEventListener('DOMContentLoaded', function() {
2    const dolyamiModalOverlay = document.querySelector('.js--dolyami-modal');
3    const dolyamiOpenButtonsArr = document.querySelectorAll('.js--dolyami-open-button');
4    const dolyamiCloseButton = document.querySelector('.js--close-button');
5    const dolyamiAddToaCartButtonsArr = document.querySelectorAll('.js--dolyami-add-cart')
6
7    if(dolyamiOpenButtonsArr.length && dolyamiModalOverlay) {
8        dolyamiOpenButtonsArr.forEach(dolyamiOpenButton => {
9            dolyamiOpenButton.addEventListener('click', openDolyamiModal)
10
11            if(typeof ym !== 'undefined') {
12                ym(98663558,'reachGoal','dolyami_details_click')
13            } else{
14                console.log('ym disabled')
15            }
16        })
17    }
18
19    if(dolyamiCloseButton && dolyamiModalOverlay ) {
20        dolyamiCloseButton.addEventListener('click', closeDolyamiModal)
21    }
22
23    if(dolyamiModalOverlay) {
24        dolyamiModalOverlay.addEventListener('click', (event) => {
25            if (event.target === dolyamiModalOverlay) {
26                closeDolyamiModal();
27            }
28        })
29    }
30
31    if(dolyamiAddToaCartButtonsArr.length && dolyamiModalOverlay) {
32        dolyamiAddToaCartButtonsArr.forEach( dolyamiAddToCartButton => {
33            dolyamiAddToCartButton.addEventListener('click', function () {
34                const id = this.dataset.productId;
35
36                if(addToCart && id) {
37                    addToCart(id)
38                    closeDolyamiModal()
39                    window.location.href = '/cart/'
40
41                    if(typeof ym !== 'undefined') {
42                        ym(98663558,'reachGoal','dolyami_modal_add_to_basket')
43                    } else{
44                        console.log('ym disabled')
45                    }
46                }
47            })
48        })
49    }
50
51    function openDolyamiModal() {
52        if(!dolyamiModalOverlay) return
53        dolyamiModalOverlay.classList.add('is-open');
54        dolyamiModalOverlay.classList.remove('is-close');
55    }
56
57    function closeDolyamiModal() {
58        dolyamiModalOverlay.classList.remove('is-open');
59        dolyamiModalOverlay.classList.add('is-close');
60    }
61})

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.