This commit is contained in:
Radon 2025-01-21 17:26:16 -06:00
parent c5ade9ca3c
commit 97c34e890a

View File

@ -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></iframe></div>`;
} 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)"></div>`;
onerror="console.log('Image failed to load:', this.src); this.style.display='none'"></div>`;
}
return `<a href="${url}" target="_blank" rel="noopener noreferrer">${url}</a>`;
},
@ -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() {