|
|
@@ -12,6 +12,10 @@ var smileys = require("./smileys.json").smileys;
|
|
12
|
12
|
var notificationInterval = false;
|
|
13
|
13
|
var unreadMessages = 0;
|
|
14
|
14
|
|
|
|
15
|
+/**
|
|
|
16
|
+ * The container id, which is and the element id.
|
|
|
17
|
+ */
|
|
|
18
|
+var CHAT_CONTAINER_ID = "chat_container";
|
|
15
|
19
|
|
|
16
|
20
|
/**
|
|
17
|
21
|
* Shows/hides a visual notification, indicating that a message has arrived.
|
|
|
@@ -131,7 +135,7 @@ function addSmileys() {
|
|
131
|
135
|
*/
|
|
132
|
136
|
function resizeChatConversation() {
|
|
133
|
137
|
var msgareaHeight = $('#usermsg').outerHeight();
|
|
134
|
|
- var chatspace = $('#chat_container');
|
|
|
138
|
+ var chatspace = $('#' + CHAT_CONTAINER_ID);
|
|
135
|
139
|
var width = chatspace.width();
|
|
136
|
140
|
var chat = $('#chatconversation');
|
|
137
|
141
|
var smileys = $('#smileysarea');
|
|
|
@@ -187,7 +191,7 @@ var Chat = {
|
|
187
|
191
|
};
|
|
188
|
192
|
usermsg.autosize({callback: onTextAreaResize});
|
|
189
|
193
|
|
|
190
|
|
- $("#chat_container").bind("shown",
|
|
|
194
|
+ $("#" + CHAT_CONTAINER_ID).bind("shown",
|
|
191
|
195
|
function () {
|
|
192
|
196
|
unreadMessages = 0;
|
|
193
|
197
|
setVisualNotification(false);
|
|
|
@@ -275,7 +279,7 @@ var Chat = {
|
|
275
|
279
|
* conversation mode or not.
|
|
276
|
280
|
*/
|
|
277
|
281
|
setChatConversationMode (isConversationMode) {
|
|
278
|
|
- $('#chat_container')
|
|
|
282
|
+ $('#' + CHAT_CONTAINER_ID)
|
|
279
|
283
|
.toggleClass('is-conversation-mode', isConversationMode);
|
|
280
|
284
|
if (isConversationMode) {
|
|
281
|
285
|
$('#usermsg').focus();
|
|
|
@@ -286,7 +290,7 @@ var Chat = {
|
|
286
|
290
|
* Resizes the chat area.
|
|
287
|
291
|
*/
|
|
288
|
292
|
resizeChat (width, height) {
|
|
289
|
|
- $('#chat_container').width(width).height(height);
|
|
|
293
|
+ $('#' + CHAT_CONTAINER_ID).width(width).height(height);
|
|
290
|
294
|
|
|
291
|
295
|
resizeChatConversation();
|
|
292
|
296
|
},
|
|
|
@@ -296,7 +300,7 @@ var Chat = {
|
|
296
|
300
|
*/
|
|
297
|
301
|
isVisible () {
|
|
298
|
302
|
return UIUtil.isVisible(
|
|
299
|
|
- document.getElementById("chat_container"));
|
|
|
303
|
+ document.getElementById(CHAT_CONTAINER_ID));
|
|
300
|
304
|
},
|
|
301
|
305
|
/**
|
|
302
|
306
|
* Shows and hides the window with the smileys
|