summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormluto <m@luto.at>2013-01-07 19:15:55 +0100
committermluto <m@luto.at>2013-01-07 19:15:55 +0100
commitbc05f9eb0adf5d9f674159106644f64d363e62e1 (patch)
tree280524a1e53df61ce2ad7dc252cfe724664a7cef /src
parent825b258d995f3c1512af20124d9c72768014ef09 (diff)
downloadetherpad-lite-bc05f9eb0adf5d9f674159106644f64d363e62e1.zip
converted load-more-link to button, added loading-gif, fixed typo
Diffstat (limited to 'src')
-rw-r--r--src/node/handler/PadMessageHandler.js2
-rw-r--r--src/static/css/pad.css17
-rw-r--r--src/static/js/chat.js9
-rw-r--r--src/static/js/collab_client.js11
-rw-r--r--src/static/js/pad.js2
-rw-r--r--src/templates/pad.html5
6 files changed, 34 insertions, 12 deletions
diff --git a/src/node/handler/PadMessageHandler.js b/src/node/handler/PadMessageHandler.js
index 00eb234e..a013f220 100644
--- a/src/node/handler/PadMessageHandler.js
+++ b/src/node/handler/PadMessageHandler.js
@@ -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 message the message from the client
*/
diff --git a/src/static/css/pad.css b/src/static/css/pad.css
index a36a7ff9..bbbadbc1 100644
--- a/src/static/css/pad.css
+++ b/src/static/css/pad.css
@@ -488,10 +488,21 @@ table#otheruserstable {
-ms-overflow-x: hidden;
overflow-x: hidden;
}
-#chatloadmessages
+.chatloadmessages
{
- color: blue;
- text-decoration: underline;
+ margin-bottom: 5px;
+ margin-top: 5px;
+ margin-left: auto;
+ margin-right: auto;
+ display: block;
+}
+#chatloadmessagesbutton
+{
+ line-height: 1.8em;
+}
+#chatloadmessagesball
+{
+ display: none;
}
#chatinputbox {
padding: 3px 2px;
diff --git a/src/static/js/chat.js b/src/static/js/chat.js
index edd6c500..01adc34e 100644
--- a/src/static/js/chat.js
+++ b/src/static/js/chat.js
@@ -115,7 +115,7 @@ var chat = (function()
var html = "<p class='" + authorClass + "'><b>" + authorName + ":</b><span class='time " + authorClass + "'>" + timeStr + "</span> " + text + "</p>";
if(isHistoryAdd)
- $(html).insertAfter('#chatloadmessages');
+ $(html).insertAfter('#chatloadmessagesbutton');
else
$("#chattext").append(html);
@@ -165,15 +165,16 @@ var chat = (function()
// initial messages are loaded in pad.js' _afterHandshake
$("#chatcounter").text(0);
- $("#chatloadmessages").click(function()
+ $("#chatloadmessagesbutton").click(function()
{
var start = Math.max(self.historyPointer - 20, 0);
var end = self.historyPointer;
if(start == end) // nothing to load
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});
self.historyPointer = start;
diff --git a/src/static/js/collab_client.js b/src/static/js/collab_client.js
index 902301d5..7df0b711 100644
--- a/src/static/js/collab_client.js
+++ b/src/static/js/collab_client.js
@@ -413,9 +413,16 @@ function getCollabClient(ace2editor, serverVars, initialUserInfo, options, _pad)
chat.scrollDown();
chat.gotInitalMessages = true;
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")
{
diff --git a/src/static/js/pad.js b/src/static/js/pad.js
index 57aa2834..64d8b42b 100644
--- a/src/static/js/pad.js
+++ b/src/static/js/pad.js
@@ -564,7 +564,7 @@ var pad = {
}
else // there are no messages
{
- $("#chatloadmessages").css("display", "none");
+ $("#chatloadmessagesbutton").css("display", "none");
}
function postAceInit()
diff --git a/src/templates/pad.html b/src/templates/pad.html
index 780ceaaa..cbfdc527 100644
--- a/src/templates/pad.html
+++ b/src/templates/pad.html
@@ -368,7 +368,10 @@
<div id="chatbox">
<div id="titlebar"><span id ="titlelabel" data-l10n-id="pad.chat"></span><a id="titlecross" onClick="chat.hide();return false;">-&nbsp;</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">
<form>
<input id="chatinput" type="text" maxlength="999">