From 6b00cdeba96696dbf700c427731689ecf2a13793 Mon Sep 17 00:00:00 2001 From: Pavel Djundik Date: Wed, 9 Aug 2017 14:18:37 +0300 Subject: [PATCH] Change history button text while loading --- client/js/lounge.js | 6 +++++- client/js/socket-events/more.js | 4 +++- client/views/chat.tpl | 4 +--- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/client/js/lounge.js b/client/js/lounge.js index 90666f0d..888b24c7 100644 --- a/client/js/lounge.js +++ b/client/js/lounge.js @@ -708,7 +708,11 @@ $(function() { var self = $(this); var lastMessage = self.parent().next(".messages").children(".msg").first(); var lastMessageId = parseInt(lastMessage[0].id.replace("msg-", ""), 10); - self.prop("disabled", true); + + self + .text("Loading older messages…") + .prop("disabled", true); + socket.emit("more", { target: self.data("id"), lastId: lastMessageId diff --git a/client/js/socket-events/more.js b/client/js/socket-events/more.js index d73105cb..b8029934 100644 --- a/client/js/socket-events/more.js +++ b/client/js/socket-events/more.js @@ -58,5 +58,7 @@ socket.on("more", function(data) { lastDate = msgDate; }); - scrollable.find(".show-more-button").prop("disabled", false); + scrollable.find(".show-more-button") + .text("Show older messages") + .prop("disabled", false); }); diff --git a/client/views/chat.tpl b/client/views/chat.tpl index 55924b6f..35ebce8c 100644 --- a/client/views/chat.tpl +++ b/client/views/chat.tpl @@ -13,9 +13,7 @@
- +