Merge pull request #1403 from thelounge/xpaw/loading-messages-text

Change history button text while loading
This commit is contained in:
Jérémie Astori 2017-08-09 18:33:13 -04:00 committed by GitHub
commit 3822c11cc2
3 changed files with 9 additions and 5 deletions

View File

@ -708,7 +708,11 @@ $(function() {
var self = $(this); var self = $(this);
var lastMessage = self.parent().next(".messages").children(".msg").first(); var lastMessage = self.parent().next(".messages").children(".msg").first();
var lastMessageId = parseInt(lastMessage[0].id.replace("msg-", ""), 10); var lastMessageId = parseInt(lastMessage[0].id.replace("msg-", ""), 10);
self.prop("disabled", true);
self
.text("Loading older messages…")
.prop("disabled", true);
socket.emit("more", { socket.emit("more", {
target: self.data("id"), target: self.data("id"),
lastId: lastMessageId lastId: lastMessageId

View File

@ -58,5 +58,7 @@ socket.on("more", function(data) {
lastDate = msgDate; 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>
<div class="chat"> <div class="chat">
<div class="show-more {{#equal messages.length 100}}show{{/equal}}"> <div class="show-more {{#equal messages.length 100}}show{{/equal}}">
<button class="show-more-button" data-id="{{id}}"> <button class="show-more-button" data-id="{{id}}">Show older messages</button>
Show older messages
</button>
</div> </div>
<div class="messages"></div> <div class="messages"></div>
</div> </div>