Files
wt b833266664
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
more refactor in frontend javascript
2025-11-28 02:28:52 +07:00

28 lines
939 B
JavaScript

// 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");
}
});
});