1window.addEventListener('load', () => { 2 getCurrentNotification(); 3}); 4 5function getCurrentNotification() { 6 fetch('https://cp.avanta-telecom.ru/api/site/getCurrentMessageNotification', { 7 method: 'POST', 8 headers: { 9 'Content-Type': 'application/json' 10 } 11 }).then((res) => { 12 return res.json(); 13 }).then((data) => { 14 if (data.result == null) { 15 return; 16 } 17 const id = +data.result.id; 18 const notifications = getNotifications(); 19 if (notifications.includes(id)) { 20 return; 21 } 22 notifications.push(id); 23 setNotifications(notifications); 24 addPopup(data.result) 25 }); 26} 27function addPopup(data) { 28 const htmlCode = ` 29 <section class="popup" style="display: none"> 30 <header> 31 <h1>${data.title}</h1> 32 <img src="/local/templates/main/images/close.png" alt=""> 33 </header> 34 ${data.content} 35 </section> 36 <div class="shutdown" style="display: none"></div> 37 `; 38 document.body.innerHTML += htmlCode; 39 40 const popup = document.querySelector('.popup'); 41 const shutdown = document.querySelector('.shutdown'); 42 const popupClose = document.querySelector('.popup header img'); 43 44 shutdown.onclick = hidePopup; 45 popupClose.onclick = hidePopup; 46 47 setTimeout(() => { 48 popup.style = ''; 49 shutdown.style = ''; 50 setTimeout(() => { 51 popup.classList.add('visible'); 52 shutdown.classList.add('visible'); 53 document.body.classList.add('node_scroll'); 54 }, 1) 55 }, 1000); 56 57 function hidePopup(e) { 58 popup.classList.remove('visible'); 59 shutdown.classList.remove('visible'); 60 document.body.classList.remove('node_scroll'); 61 setTimeout(() => { 62 popup.style = "display:none"; 63 shutdown.style = "display:none"; 64 }, 300) 65 } 66} 67function getNotifications() { 68 let matches = document.cookie.match(/(?:^|; )notifications=([^;]*)/); 69 return matches ? decodeURIComponent(matches[1]).split(',').map(p => +p) : []; 70} 71 72function setNotifications(value) { 73 let updatedCookie = "notifications=" + encodeURIComponent(value) + "; path=/; samesite=strict"; 74 document.cookie = updatedCookie; 75}
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.