1let isAnimating = false; 2let alertQueue = []; 3 4async function showAlert(info) { 5 if (isAnimating) { 6 alertQueue.push(info); 7 return; 8 } 9 10 isAnimating = true; 11 await showNextAlert(info); 12} 13 14async function showNextAlert(info) { 15 if (alertQueue.length < 0) { 16 isAnimating = false; 17 return; 18 } 19 20 if (alertQueue.length == 0) { 21 await displayAlert(info); 22 return; 23 } 24 25 const info2 = alertQueue.shift(); 26 27 await displayAlert(info2); 28 29 await showNextAlert(info2); 30} 31 32async function displayAlert(info) { 33 const { title, text, icon } = info; 34 let errorIcon = '/assets/img/error.webp'; 35 let successIcon = '/assets/img/success.webp'; 36 let warningIcon = '/assets/img/warning.webp'; 37 let infoIcon = '/assets/img/info.webp'; 38 let sonido_inicio = new Audio('/assets/sounds/alert.mp3'); 39 sonido_inicio.volume = 0.8; 40 41 let errorColor = '#fa415b'; 42 let successColor = '#21c179'; 43 let warningColor = '#ffa500'; 44 let infoColor = '#2196f3'; 45 46 let icontype = ''; 47 let color = ''; 48 49 switch (icon) { 50 case 'error': 51 icontype = errorIcon; 52 color = errorColor; 53 break; 54 case 'success': 55 icontype = successIcon; 56 color = successColor; 57 break; 58 case 'warning': 59 icontype = warningIcon; 60 color = warningColor; 61 break; 62 case 'info': 63 icontype = infoIcon; 64 color = infoColor; 65 break; 66 default: 67 icontype = infoIcon; 68 color = infoColor; 69 break; 70 } 71 72 const panel = document.getElementById('alert-panel'); 73 const panelbig = document.getElementById('panelbig'); 74 const panelIcon = document.getElementById('alert-panel-icon'); 75 const panelText = document.getElementById('alert-panel-text'); 76 77 panelIcon.src = icontype; 78 if (text == null || text == undefined || text == '') { 79 panelText.innerHTML = `<strong>${title}</strong>`; 80 } else { 81 panelText.innerHTML = `<strong>${title}</strong><br>${text}`; 82 } 83 panel.style.backgroundColor = color; 84 85 panelbig.classList.add('normal-zoom'); 86 sonido_inicio.play(); 87 88 await wait(200); 89 90 panelbig.classList.add('big-zoom'); 91 await wait(200); 92 93 panelbig.classList.remove('big-zoom'); 94 95 panel.classList.add('active-alert'); 96 await wait(3600); 97 98 panel.classList.remove('active-alert'); 99 100 await wait(300); 101 102 panelbig.classList.add('big-zoom'); 103 await wait(200); 104 105 panelbig.classList.remove('big-zoom'); 106 panelbig.classList.remove('normal-zoom'); 107 108 isAnimating = false; 109 await showNextAlert(); 110} 111 112async function wait(ms) { 113 return new Promise(resolve => setTimeout(resolve, ms)); 114}
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.