// Wait until the DOM is fully loaded document.addEventListener("DOMContentLoaded", function () { // Get the alert div const chromeAlerts = document.getElementById("chrome-alerts"); if (chromeAlerts) { // Add event listener to the entire window window.addEventListener("click", function (event) { // Check if the click is outside the alert box if (!chromeAlerts.contains(event.target)) { // Hide the alert div chromeAlerts.style.display = "none"; } }); } });