PageSourceSearch

https://vesna.shop/bitrix/js/dbogdanoff.cookie/script.js?17604518503196

js vesna.shop collected 2026-10-08 11:55:20 UTC 3,196 bytes, 102 lines download raw bytes

1(function () {
2  if (document.cookie.split('; ').find(row => row.startsWith('legacy_cookie='))) {
3    return
4  }
5
6fetch('/bitrix/tools/dbogdanoff_cookie_options.php', {
7  method: 'POST',
8  headers: {
9    'Content-Type': 'application/x-www-form-urlencoded',
10  },
11  credentials: 'same-origin',
12  body: new URLSearchParams({
13    'SITE_ID': (typeof BX !== 'undefined' && typeof BX.message === 'function')
14      ? BX.message('SITE_ID') : 's1',
15  }),
16})
17  .then(response => response.json())
18  .then(options => {
19    handleContentLoaded(options)
20  })
21  .catch(error => {
22    console.error('Ошибка при запросе опций модуля dbogdanoff.cookie', error)
23  })
24
25  function handleContentLoaded (options) {
26    if (document.readyState === 'loading') {
27      document.addEventListener('DOMContentLoaded', function () {
28        insertCookieDiv(options.data)
29      })
30    }
31    else {
32      insertCookieDiv(options.data)
33    }
34  }
35
36  function insertCookieDiv(options) {
37    // Создаем элементы
38    let cookieDiv = document.createElement('div')
39    cookieDiv.style.zIndex = options.zIndex
40    cookieDiv.id = 'legacy-cookie-wrap'
41    cookieDiv.className = 'legacy-cookie'
42    if (options.disableMob === 'Y') {
43      cookieDiv.classList.add('legacy-cookie--d-mob-none')
44    }
45
46    let innerDiv = document.createElement('div')
47    let cookieText = document.createElement('div')
48    cookieText.className = 'legacy-cookie__text'
49
50    cookieText.innerHTML = options.text
51    if (options.color) {
52      let anchor = cookieText.querySelector('a')
53      if (anchor) {
54        anchor.style.color = options.color
55      }
56    }
57
58    // Вставляем или img, или span в зависимости от textButton
59    let closeElement
60    if (options.textButton && options.textButton.trim() !== '') {
61      closeElement = document.createElement('span')
62      closeElement.classList.add('button')
63      closeElement.textContent = options.textButton
64    } else {
65      closeElement = document.createElement('img')
66      closeElement.src = '/bitrix/images/dbogdanoff.cookie/close.svg'
67    }
68    closeElement.onclick = sendCookieRequestAndRemoveElement
69
70    // Собираем и вставляем в документ
71    innerDiv.appendChild(cookieText)
72    innerDiv.appendChild(closeElement)
73    cookieDiv.appendChild(innerDiv)
74    document.body.appendChild(cookieDiv)
75  }
76
77  function sendCookieRequestAndRemoveElement () {
78    fetch('/bitrix/tools/dbogdanoff_cookie_save.php', {
79      method: 'GET',
80      credentials: 'same-origin',
81    })
82    .then(response => {
83      if (!response.ok) {
84        throw new Error('Network response was not ok')
85      }
86      return response.text() // или .json(), если на сервере JSON
87    })
88    .then(data => {
89      console.log('Cookie saved successfully')
90      // Если нужно что-то сделать с ответом сервера, делаем это здесь
91    })
92    .catch(error => {
93      console.error('Error saving cookie:', error)
94    })
95    .finally(() => {
96      const element = document.getElementById('legacy-cookie-wrap')
97      if (element) {
98        element.remove()
99      }
100    })
101  }
102})();

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.