|
@@ -9,7 +9,6 @@ import UIEvents from '../../../../service/UI/UIEvents';
|
9
|
9
|
|
10
|
10
|
var smileys = require("./smileys.json").smileys;
|
11
|
11
|
|
12
|
|
-var notificationInterval = false;
|
13
|
12
|
var unreadMessages = 0;
|
14
|
13
|
|
15
|
14
|
/**
|
|
@@ -18,9 +17,9 @@ var unreadMessages = 0;
|
18
|
17
|
var CHAT_CONTAINER_ID = "chat_container";
|
19
|
18
|
|
20
|
19
|
/**
|
21
|
|
- * Shows/hides a visual notification, indicating that a message has arrived.
|
|
20
|
+ * Updates visual notification, indicating that a message has arrived.
|
22
|
21
|
*/
|
23
|
|
-function setVisualNotification(show) {
|
|
22
|
+function updateVisualNotification() {
|
24
|
23
|
var unreadMsgElement = document.getElementById('unreadMessages');
|
25
|
24
|
|
26
|
25
|
var glower = $('#toolbar_button_chat');
|
|
@@ -41,27 +40,9 @@ function setVisualNotification(show) {
|
41
|
40
|
'style',
|
42
|
41
|
'top:' + topIndent +
|
43
|
42
|
'; left:' + leftIndent + ';');
|
44
|
|
-
|
45
|
|
- if (!glower.hasClass('icon-chat-simple')) {
|
46
|
|
- glower.removeClass('icon-chat');
|
47
|
|
- glower.addClass('icon-chat-simple');
|
48
|
|
- }
|
49
|
43
|
}
|
50
|
44
|
else {
|
51
|
45
|
unreadMsgElement.innerHTML = '';
|
52
|
|
- glower.removeClass('icon-chat-simple');
|
53
|
|
- glower.addClass('icon-chat');
|
54
|
|
- }
|
55
|
|
-
|
56
|
|
- if (show && !notificationInterval) {
|
57
|
|
- notificationInterval = window.setInterval(function () {
|
58
|
|
- glower.toggleClass('active');
|
59
|
|
- }, 800);
|
60
|
|
- }
|
61
|
|
- else if (!show && notificationInterval) {
|
62
|
|
- window.clearInterval(notificationInterval);
|
63
|
|
- notificationInterval = false;
|
64
|
|
- glower.removeClass('active');
|
65
|
46
|
}
|
66
|
47
|
}
|
67
|
48
|
|
|
@@ -194,7 +175,7 @@ var Chat = {
|
194
|
175
|
$("#" + CHAT_CONTAINER_ID).bind("shown",
|
195
|
176
|
function () {
|
196
|
177
|
unreadMessages = 0;
|
197
|
|
- setVisualNotification(false);
|
|
178
|
+ updateVisualNotification();
|
198
|
179
|
});
|
199
|
180
|
|
200
|
181
|
addSmileys();
|
|
@@ -214,7 +195,7 @@ var Chat = {
|
214
|
195
|
if (!Chat.isVisible()) {
|
215
|
196
|
unreadMessages++;
|
216
|
197
|
UIUtil.playSoundNotification('chatNotification');
|
217
|
|
- setVisualNotification(true);
|
|
198
|
+ updateVisualNotification();
|
218
|
199
|
}
|
219
|
200
|
}
|
220
|
201
|
|