more refactor in frontend javascript
Continuous integration / Check (push) Successful in 35s
Continuous integration / Rustfmt (push) Successful in 31s
Continuous integration / build (push) Successful in 30s
Continuous integration / build-release (push) Successful in 51s

This commit is contained in:
wt committed 2025-11-28 02:28:52 +07:00
1 parent 7f7936d37f
commit b833266664
14 files changed
+2345 -2366

No files matched your search

+27
View File
@@ -0,0 +1,27 @@
// Check for saved session on page load
window.addEventListener("DOMContentLoaded", function () {
const savedToken = localStorage.getItem("chatToken");
const savedUsername = localStorage.getItem("chatUsername");
const savedPhone = localStorage.getItem("chatUserPhone");
if (savedToken && savedUsername) {
currentUserPhone = savedPhone;
validateToken(savedToken, savedUsername);
}
// Auto-resize textarea
const messageInput = document.getElementById("messageInput");
messageInput.addEventListener("input", function () {
this.style.height = "auto";
this.style.height = Math.min(this.scrollHeight, 100) + "px";
});
// Update mobile detection on resize
window.addEventListener("resize", function () {
isMobile = window.innerWidth <= 768;
if (!isMobile) {
// On desktop, ensure chats panel is visible
document.getElementById("chatsPanel").classList.remove("active");
}
});
});