Change history button text while loading

This commit is contained in:
Pavel Djundik 2017-08-09 14:18:37 +03:00
parent 40c129dbb7
commit 6b00cdeba9
3 changed files with 9 additions and 5 deletions

View file

@ -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

View file

@ -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);
});

View file

@ -13,9 +13,7 @@
</div>
<div class="chat">
<div class="show-more {{#equal messages.length 100}}show{{/equal}}">
<button class="show-more-button" data-id="{{id}}">
Show older messages
</button>
<button class="show-more-button" data-id="{{id}}">Show older messages</button>
</div>
<div class="messages"></div>
</div>