1(function() { 2 // Get (or create) the toast container 3 function getToastContainer() { 4 let container = document.getElementById('toast-container'); 5 if (!container) { 6 container = document.createElement('div'); 7 container.id = 'toast-container'; 8 container.style.position = 'fixed'; 9 container.style.bottom = '20px'; 10 container.style.left = '20px'; 11 container.style.display = 'flex'; 12 container.style.flexDirection = 'column'; 13 container.style.gap = '10px'; 14 container.style.zIndex = '1000'; 15 document.body.appendChild(container); 16 } 17 return container; 18 } 19 20 // Expose the showToast function 21 window.showToast = function(message, type = 'success') { 22 const container = getToastContainer(); 23 24 // Remove any existing toasts so only one is visible 25 while (container.firstChild) { 26 container.removeChild(container.firstChild); 27 } 28 29 // Create a new toast element 30 const toast = document.createElement('div'); 31 toast.className = 'toast'; 32 33 // Create an icon element 34 const icon = document.createElement('span'); 35 icon.className = 'toast-icon ' + (type === 'info' ? 'info' : 'success'); 36 icon.textContent = type === 'info' ? 'â¹ï¸' : 'â '; 37 38 // Append icon and message to the toast 39 toast.appendChild(icon); 40 toast.appendChild(document.createTextNode(message)); 41 42 // Append the toast to the container 43 container.appendChild(toast); 44 45 setTimeout(() => { 46 toast.remove(); 47 // Optionally remove container if empty 48 if (container.childElementCount === 0) { 49 container.remove(); 50 } 51 }, 3000); 52 } 53})();
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.