mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-04-20 23:46:14 -04:00
converted load-more-link to button, added loading-gif, fixed typo
This commit is contained in:
parent
825b258d99
commit
bc05f9eb0a
6 changed files with 34 additions and 12 deletions
|
@ -365,7 +365,7 @@ function handleChatMessage(client, message)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handles the clients requets for more chat-messages
|
* Handles the clients request for more chat-messages
|
||||||
* @param client the client that send this message
|
* @param client the client that send this message
|
||||||
* @param message the message from the client
|
* @param message the message from the client
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -488,10 +488,21 @@ table#otheruserstable {
|
||||||
-ms-overflow-x: hidden;
|
-ms-overflow-x: hidden;
|
||||||
overflow-x: hidden;
|
overflow-x: hidden;
|
||||||
}
|
}
|
||||||
#chatloadmessages
|
.chatloadmessages
|
||||||
{
|
{
|
||||||
color: blue;
|
margin-bottom: 5px;
|
||||||
text-decoration: underline;
|
margin-top: 5px;
|
||||||
|
margin-left: auto;
|
||||||
|
margin-right: auto;
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
#chatloadmessagesbutton
|
||||||
|
{
|
||||||
|
line-height: 1.8em;
|
||||||
|
}
|
||||||
|
#chatloadmessagesball
|
||||||
|
{
|
||||||
|
display: none;
|
||||||
}
|
}
|
||||||
#chatinputbox {
|
#chatinputbox {
|
||||||
padding: 3px 2px;
|
padding: 3px 2px;
|
||||||
|
|
|
@ -115,7 +115,7 @@ var chat = (function()
|
||||||
|
|
||||||
var html = "<p class='" + authorClass + "'><b>" + authorName + ":</b><span class='time " + authorClass + "'>" + timeStr + "</span> " + text + "</p>";
|
var html = "<p class='" + authorClass + "'><b>" + authorName + ":</b><span class='time " + authorClass + "'>" + timeStr + "</span> " + text + "</p>";
|
||||||
if(isHistoryAdd)
|
if(isHistoryAdd)
|
||||||
$(html).insertAfter('#chatloadmessages');
|
$(html).insertAfter('#chatloadmessagesbutton');
|
||||||
else
|
else
|
||||||
$("#chattext").append(html);
|
$("#chattext").append(html);
|
||||||
|
|
||||||
|
@ -165,15 +165,16 @@ var chat = (function()
|
||||||
// initial messages are loaded in pad.js' _afterHandshake
|
// initial messages are loaded in pad.js' _afterHandshake
|
||||||
|
|
||||||
$("#chatcounter").text(0);
|
$("#chatcounter").text(0);
|
||||||
$("#chatloadmessages").click(function()
|
$("#chatloadmessagesbutton").click(function()
|
||||||
{
|
{
|
||||||
var start = Math.max(self.historyPointer - 20, 0);
|
var start = Math.max(self.historyPointer - 20, 0);
|
||||||
var end = self.historyPointer;
|
var end = self.historyPointer;
|
||||||
|
|
||||||
if(start == end) // nothing to load
|
if(start == end) // nothing to load
|
||||||
return;
|
return;
|
||||||
if(start == 0) // reached the top
|
|
||||||
$("#chatloadmessages").css("display", "none");
|
$("#chatloadmessagesbutton").css("display", "none");
|
||||||
|
$("#chatloadmessagesball").css("display", "block");
|
||||||
|
|
||||||
pad.collabClient.sendMessage({"type": "GET_CHAT_MESSAGES", "start": start, "end": end});
|
pad.collabClient.sendMessage({"type": "GET_CHAT_MESSAGES", "start": start, "end": end});
|
||||||
self.historyPointer = start;
|
self.historyPointer = start;
|
||||||
|
|
|
@ -413,9 +413,16 @@ function getCollabClient(ace2editor, serverVars, initialUserInfo, options, _pad)
|
||||||
chat.scrollDown();
|
chat.scrollDown();
|
||||||
chat.gotInitalMessages = true;
|
chat.gotInitalMessages = true;
|
||||||
chat.historyPointer = clientVars.chatHead - msg.messages.length;
|
chat.historyPointer = clientVars.chatHead - msg.messages.length;
|
||||||
if(chat.historyPointer == -1) // there are less than 100 messages
|
|
||||||
$("#chatloadmessages").css("display", "none");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// messages are loaded, so hide the loading-ball
|
||||||
|
$("#chatloadmessagesball").css("display", "none");
|
||||||
|
|
||||||
|
// there are less than 100 messages or we reached the top
|
||||||
|
if(chat.historyPointer <= 0)
|
||||||
|
$("#chatloadmessagesbutton").css("display", "none");
|
||||||
|
else // there are still more messages, re-show the load-button
|
||||||
|
$("#chatloadmessagesbutton").css("display", "block");
|
||||||
}
|
}
|
||||||
else if (msg.type == "SERVER_MESSAGE")
|
else if (msg.type == "SERVER_MESSAGE")
|
||||||
{
|
{
|
||||||
|
|
|
@ -564,7 +564,7 @@ var pad = {
|
||||||
}
|
}
|
||||||
else // there are no messages
|
else // there are no messages
|
||||||
{
|
{
|
||||||
$("#chatloadmessages").css("display", "none");
|
$("#chatloadmessagesbutton").css("display", "none");
|
||||||
}
|
}
|
||||||
|
|
||||||
function postAceInit()
|
function postAceInit()
|
||||||
|
|
|
@ -368,7 +368,10 @@
|
||||||
|
|
||||||
<div id="chatbox">
|
<div id="chatbox">
|
||||||
<div id="titlebar"><span id ="titlelabel" data-l10n-id="pad.chat"></span><a id="titlecross" onClick="chat.hide();return false;">- </a></div>
|
<div id="titlebar"><span id ="titlelabel" data-l10n-id="pad.chat"></span><a id="titlecross" onClick="chat.hide();return false;">- </a></div>
|
||||||
<div id="chattext" class="authorColors"><a id="chatloadmessages" data-l10n-id="pad.chat.loadmessages"></a></div>
|
<div id="chattext" class="authorColors">
|
||||||
|
<img alt="loading.." id="chatloadmessagesball" class="chatloadmessages" src="../static/img/loading.gif" align="top">
|
||||||
|
<button id="chatloadmessagesbutton" class="chatloadmessages" data-l10n-id="pad.chat.loadmessages"></button>
|
||||||
|
</div>
|
||||||
<div id="chatinputbox">
|
<div id="chatinputbox">
|
||||||
<form>
|
<form>
|
||||||
<input id="chatinput" type="text" maxlength="999">
|
<input id="chatinput" type="text" maxlength="999">
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue