diff --git a/content/root.js b/content/root.js index ad906a9..0cf90d1 100644 --- a/content/root.js +++ b/content/root.js @@ -252,7 +252,6 @@ async function loadMessages(forceUpdate = false, scrollLocation) { ); const contentString = doc.querySelector("span").textContent; - console.log(contentString); if ( compareUsername === @@ -299,7 +298,6 @@ function contentEmbedding(content) { src="https://www.youtube.com/embed/${videoId}" frameborder="0" onerror="console.log('Video failed to load:', this.src); this.style.display='none'" - onload="console.log('Video loaded successfully:', this.src)" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen>`; } else if (isImageUrl(url)) { @@ -307,8 +305,7 @@ function contentEmbedding(content) { src="${url}" alt="Embedded image" loading="lazy" - onerror="console.log('Image failed to load:', this.src); this.style.display='none'" - onload="console.log('Image loaded successfully:', this.src)">`; + onerror="console.log('Image failed to load:', this.src); this.style.display='none'">`; } return `${url}`; }, @@ -528,6 +525,20 @@ document.addEventListener("keyup", function (event) { let bottom = 0; async function initialize() { + await checkUsername(); + await updateCurrentUser(); + await timeZoneCheck(); + await loadMessages(true); + initializePanels(); + initializeTheme(); + initializeSearchBox(); + setInterval(loadMessages, 1000); + setInterval(loadUsers, 1000); + setInterval(pingCheck, 3000); + setTimeout(scrollToBottom, 100); +} + +function initializePanels() { usersPanel = document.getElementById("users-panel"); if (usersPanel) { usersPanel.style.display = "none"; @@ -536,16 +547,6 @@ async function initialize() { if (settingsPanel) { settingsPanel.style.display = "none"; } - initializeTheme(); - await checkUsername(); - await updateCurrentUser(); - await timeZoneCheck(); - setInterval(loadMessages, 1000); - setInterval(loadUsers, 1000); - setInterval(pingCheck, 3000); - await loadMessages(true); - initializeSearchBox(); - scrollToBottom(); } function initializeSearchBox() {