more refactor in frontend javascript
This commit is contained in:
1 parent
7f7936d37f
commit
b833266664
14 files changed
+2345
-2366
No files matched your search
@@ -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");
|
||||
}
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user