浏览代码

Adds the number of participants to the contact list icon.

Adds glowing to the bottom toolbar chat button and the contact list button when a contact enters or leaves.
j8
fo 10 年前
父节点
当前提交
02d8f1a3ca
共有 7 个文件被更改,包括 132 次插入26 次删除
  1. 2
    2
      bottom_toolbar.js
  2. 23
    3
      chat.js
  3. 58
    2
      contact_list.js
  4. 20
    6
      css/chat.css
  5. 15
    2
      css/main.css
  6. 2
    3
      images/chatArrow.svg
  7. 12
    8
      index.html

+ 2
- 2
bottom_toolbar.js 查看文件

@@ -9,9 +9,9 @@ var BottomToolbar = (function (my) {
9 9
             }, 500);
10 10
         }
11 11
 
12
-        buttonClick("#chatBottomButton", "active");
13
-
14 12
         Chat.toggleChat();
13
+
14
+        buttonClick("#chatBottomButton", "active");
15 15
     };
16 16
 
17 17
     my.toggleContactList = function() {

+ 23
- 3
chat.js 查看文件

@@ -354,26 +354,42 @@ var Chat = (function (my) {
354 354
      */
355 355
     function setVisualNotification(show) {
356 356
         var unreadMsgElement = document.getElementById('unreadMessages');
357
+        var unreadMsgBottomElement = document.getElementById('bottomUnreadMessages');
357 358
 
358 359
         var glower = $('#chatButton');
360
+        var bottomGlower = $('#chatBottomButton');
359 361
 
360 362
         if (unreadMessages) {
361 363
             unreadMsgElement.innerHTML = unreadMessages.toString();
364
+            unreadMsgBottomElement.innerHTML = unreadMessages.toString();
362 365
 
363 366
             ToolbarToggler.dockToolbar(true);
364 367
 
365 368
             var chatButtonElement
366 369
                 = document.getElementById('chatButton').parentNode;
367 370
             var leftIndent = (Util.getTextWidth(chatButtonElement) -
368
-                              Util.getTextWidth(unreadMsgElement)) / 2;
371
+                Util.getTextWidth(unreadMsgElement)) / 2;
369 372
             var topIndent = (Util.getTextHeight(chatButtonElement) -
370
-                             Util.getTextHeight(unreadMsgElement)) / 2 - 3;
373
+                Util.getTextHeight(unreadMsgElement)) / 2 - 2;
371 374
 
372 375
             unreadMsgElement.setAttribute(
373
-                    'style',
376
+                'style',
374 377
                     'top:' + topIndent +
375 378
                     '; left:' + leftIndent + ';');
376 379
 
380
+            var chatBottomButtonElement
381
+                = document.getElementById('chatBottomButton').parentNode;
382
+            var bottomLeftIndent = (Util.getTextWidth(chatBottomButtonElement) -
383
+                Util.getTextWidth(unreadMsgBottomElement)) / 2;
384
+            var bottomTopIndent = (Util.getTextHeight(chatBottomButtonElement) -
385
+                Util.getTextHeight(unreadMsgBottomElement)) / 2 - 3;
386
+
387
+            unreadMsgBottomElement.setAttribute(
388
+                'style',
389
+                    'top:' + bottomTopIndent +
390
+                    '; left:' + bottomLeftIndent + ';');
391
+
392
+
377 393
             if (!glower.hasClass('icon-chat-simple')) {
378 394
                 glower.removeClass('icon-chat');
379 395
                 glower.addClass('icon-chat-simple');
@@ -381,6 +397,7 @@ var Chat = (function (my) {
381 397
         }
382 398
         else {
383 399
             unreadMsgElement.innerHTML = '';
400
+            unreadMsgBottomElement.innerHTML = '';
384 401
             glower.removeClass('icon-chat-simple');
385 402
             glower.addClass('icon-chat');
386 403
         }
@@ -388,12 +405,15 @@ var Chat = (function (my) {
388 405
         if (show && !notificationInterval) {
389 406
             notificationInterval = window.setInterval(function () {
390 407
                 glower.toggleClass('active');
408
+                bottomGlower.toggleClass('active glowing');
391 409
             }, 800);
392 410
         }
393 411
         else if (!show && notificationInterval) {
394 412
             window.clearInterval(notificationInterval);
395 413
             notificationInterval = false;
396 414
             glower.removeClass('active');
415
+            bottomGlower.removeClass('glowing');
416
+            bottomGlower.addClass('active');
397 417
         }
398 418
     }
399 419
 

+ 58
- 2
contact_list.js 查看文件

@@ -2,6 +2,10 @@
2 2
  * Contact list.
3 3
  */
4 4
 var ContactList = (function (my) {
5
+
6
+    var numberOfContacts = 0;
7
+    var notificationInterval;
8
+
5 9
     /**
6 10
      * Indicates if the chat is currently visible.
7 11
      *
@@ -65,6 +69,7 @@ var ContactList = (function (my) {
65 69
         else {
66 70
             clElement.appendChild(newContact);
67 71
         }
72
+        updateNumberOfParticipants(1);
68 73
     };
69 74
 
70 75
     /**
@@ -81,6 +86,8 @@ var ContactList = (function (my) {
81 86
             var contactlist = $('#contactlist>ul');
82 87
 
83 88
             contactlist.get(0).removeChild(contact.get(0));
89
+
90
+            updateNumberOfParticipants(-1);
84 91
         }
85 92
     };
86 93
 
@@ -163,6 +170,27 @@ var ContactList = (function (my) {
163 170
             $('#contactlist').show("slide", { direction: "right",
164 171
                                             queue: false,
165 172
                                             duration: 500});
173
+
174
+            //stop the glowing of the contact list icon
175
+            setVisualNotification(false);
176
+        }
177
+    };
178
+
179
+    /**
180
+     * Updates the number of participants in the contact list button and sets
181
+     * the glow
182
+     * @param delta indicates whether a new user has joined (1) or someone has
183
+     * left(-1)
184
+     */
185
+    function updateNumberOfParticipants(delta) {
186
+        //when the user is alone we don't show the number of participants
187
+        if(numberOfContacts === 0) {
188
+            $("#numberOfParticipants").text('');
189
+            numberOfContacts += delta;
190
+        } else if(numberOfContacts !== 0 && !ContactList.isVisible()) {
191
+            setVisualNotification(true);
192
+            numberOfContacts += delta;
193
+            $("#numberOfParticipants").text(numberOfContacts);
166 194
         }
167 195
     };
168 196
 
@@ -176,7 +204,7 @@ var ContactList = (function (my) {
176 204
         avatar.className = "icon-avatar avatar";
177 205
 
178 206
         return avatar;
179
-    };
207
+    }
180 208
 
181 209
     /**
182 210
      * Creates the display name paragraph.
@@ -188,7 +216,35 @@ var ContactList = (function (my) {
188 216
         p.innerHTML = displayName;
189 217
 
190 218
         return p;
191
-    };
219
+    }
220
+
221
+    /**
222
+     * Shows/hides a visual notification, indicating that a new user has joined
223
+     * the conference.
224
+     */
225
+    function setVisualNotification(show, stopGlowingIn) {
226
+        var glower = $('#contactListButton');
227
+        function stopGlowing() {
228
+            window.clearInterval(notificationInterval);
229
+            notificationInterval = false;
230
+            glower.removeClass('glowing');
231
+            if(!ContactList.isVisible()) {
232
+                glower.removeClass('active');
233
+            }
234
+        }
235
+
236
+        if (show && !notificationInterval) {
237
+            notificationInterval = window.setInterval(function () {
238
+                glower.toggleClass('active glowing');
239
+            }, 800);
240
+        }
241
+        else if (!show && notificationInterval) {
242
+            stopGlowing();
243
+        }
244
+        if(stopGlowingIn) {
245
+            setTimeout(stopGlowing, stopGlowingIn);
246
+        }
247
+    }
192 248
 
193 249
     /**
194 250
      * Indicates that the display name has changed.

+ 20
- 6
css/chat.css 查看文件

@@ -46,7 +46,7 @@
46 46
     max-height:150px;
47 47
     min-height:35px;
48 48
     border: 0px none;
49
-    background: #231F20;
49
+    background: #3a3a3a;
50 50
     color: #a7a7a7;
51 51
     box-shadow: none;
52 52
     border-radius:0;
@@ -75,12 +75,26 @@
75 75
 #nickinput {
76 76
     margin-top: 20px;
77 77
     font-size: 14px;
78
-    background: #231F20;
78
+    background: #3a3a3a;
79 79
     box-shadow: inset 0 0 3px 2px #a7a7a7;
80 80
     border: 1px solid #a7a7a7;
81 81
     color: #a7a7a7;
82 82
 }
83 83
 
84
+#unreadMessages {
85
+    font-size: 8px;
86
+    position: absolute;
87
+    left: 46%;
88
+    top: 27%
89
+}
90
+
91
+#bottomUnreadMessages {
92
+    top: 5px;
93
+    left: 10px;
94
+    position: absolute;
95
+    font-size: 8px;
96
+}
97
+
84 98
 #chatspace .username {
85 99
     float: left;
86 100
     padding-left: 5px;
@@ -105,7 +119,7 @@
105 119
 }
106 120
 
107 121
 .chatmessage {
108
-    background: #231F20;
122
+    background: #3a3a3a;
109 123
     width: 93%;
110 124
     margin-left: 5%;
111 125
     margin-right: auto;
@@ -149,7 +163,7 @@
149 163
     max-height:150px;
150 164
     min-height:35px;
151 165
     border: 0px none;
152
-    background: #231F20;
166
+    background: #3a3a3a;
153 167
     overflow: hidden;
154 168
     visibility: hidden;
155 169
 }
@@ -157,7 +171,7 @@
157 171
 #smileysContainer {
158 172
     display: none;
159 173
     position: absolute;
160
-    background: #231F20;
174
+    background: #3a3a3a;
161 175
     border-bottom: 1px solid;
162 176
     border-top: 1px solid;
163 177
     width: 100%;
@@ -205,5 +219,5 @@
205 219
 }
206 220
 
207 221
 #usermsg::-webkit-scrollbar-track-piece {
208
-    background: #231F20;
222
+    background: #3a3a3a;
209 223
 }

+ 15
- 2
css/main.css 查看文件

@@ -70,13 +70,13 @@ html, body{
70 70
     cursor: pointer;
71 71
 }
72 72
 
73
-#chatButton {
73
+#chatButton, #chatBottomButton, #contactListButton {
74 74
     -webkit-transition: all .5s ease-in-out;
75 75
        -moz-transition: all .5s ease-in-out;
76 76
             transition: all .5s ease-in-out;
77 77
 }
78 78
 /*#ffde00*/
79
-#chatButton.active {
79
+#chatButton.active, #contactListButton.glowing, #chatBottomButton.glowing {
80 80
     -webkit-text-shadow:    -1px 0 10px #00ccff,
81 81
                             0 1px 10px #00ccff,
82 82
                             1px 0 10px #00ccff,
@@ -91,6 +91,19 @@ html, body{
91 91
                     0 -1px 10px #00ccff;
92 92
 }
93 93
 
94
+#numberOfParticipants {
95
+    position: absolute;
96
+    top: 0px;
97
+    right: -1;
98
+    color: white;
99
+    width: 13px;
100
+    height: 13px;
101
+    line-height: 13px;
102
+    font-weight: bold;
103
+    border-radius: 2px;
104
+    text-shadow: -1px 0 black, 0 1px black, 1px 0 black, 0 -1px black;
105
+}
106
+
94 107
 #recordButton {
95 108
     -webkit-transition: all .5s ease-in-out;
96 109
     -moz-transition: all .5s ease-in-out;

+ 2
- 3
images/chatArrow.svg 查看文件

@@ -2,12 +2,11 @@
2 2
 <!-- Generator: Adobe Illustrator 16.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0)  -->
3 3
 <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
4 4
 <svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
5
-	 width="258.559px" height="396.871px" viewBox="83.27 0 258.559 396.871" enable-background="new 83.27 0 258.559 396.871"
5
+	 width="258.559px" height="396.871px" viewBox="0 0 258.559 396.871" enable-background="new 0 0 258.559 396.871"
6 6
 	 xml:space="preserve">
7 7
 <g id="u6PRpE_1_">
8 8
 	<g>
9
-		<path fill-rule="evenodd" clip-rule="evenodd" fill="#231F20" d="M341.829,396.871c0,0-16.524-193.936-258.445-396.871
10
-			c86.17,0,258.445,0,258.445,0V396.871z"/>
9
+		<path fill="#3A3A3A" d="M341.829,396.871c0,0-16.524-193.936-258.445-396.871c86.17,0,258.445,0,258.445,0V396.871z"/>
11 10
 	</g>
12 11
 </g>
13 12
 </svg>

+ 12
- 8
index.html 查看文件

@@ -36,8 +36,8 @@
36 36
     <script src="data_channels.js?v=3"></script><!-- data channels -->
37 37
     <script src="app.js?v=18"></script><!-- application logic -->
38 38
     <script src="commands.js?v=1"></script><!-- application logic -->
39
-    <script src="chat.js?v=12"></script><!-- chat logic -->
40
-    <script src="contact_list.js?v=4"></script><!-- contact list logic -->
39
+    <script src="chat.js?v=13"></script><!-- chat logic -->
40
+    <script src="contact_list.js?v=5"></script><!-- contact list logic -->
41 41
     <script src="util.js?v=6"></script><!-- utility functions -->
42 42
     <script src="etherpad.js?v=9"></script><!-- etherpad plugin -->
43 43
     <script src="prezi.js?v=6"></script><!-- prezi plugin -->
@@ -54,7 +54,7 @@
54 54
     <script src="canvas_util.js?v=1"></script><!-- canvas drawing utils -->
55 55
     <script src="audio_levels.js?v=2"></script><!-- audio levels plugin -->
56 56
     <script src="media_stream.js?v=1"></script><!-- media stream -->
57
-    <script src="bottom_toolbar.js?v=4"></script><!-- media stream -->
57
+    <script src="bottom_toolbar.js?v=5"></script><!-- media stream -->
58 58
     <script src="roomname_generator.js?v=1"></script><!-- generator for random room names -->
59 59
     <script src="keyboard_shortcut.js?v=3"></script>
60 60
     <script src="tracking.js?v=1"></script><!-- tracking -->
@@ -63,7 +63,7 @@
63 63
     <script src="api_connector.js?v=1"></script>
64 64
     <link href="//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet">
65 65
     <link rel="stylesheet" href="css/font.css?v=5"/>
66
-    <link rel="stylesheet" type="text/css" media="screen" href="css/main.css?v=27"/>
66
+    <link rel="stylesheet" type="text/css" media="screen" href="css/main.css?v=28"/>
67 67
     <link rel="stylesheet" type="text/css" media="screen" href="css/videolayout_default.css?v=13" id="videolayout_default"/>
68 68
     <link rel="stylesheet" href="css/jquery-impromptu.css?v=4">
69 69
     <link rel="stylesheet" href="css/modaldialog.css?v=3">
@@ -71,7 +71,7 @@
71 71
     <link rel="stylesheet" href="css/popover.css?v=2">
72 72
       <link rel="stylesheet" href="css/jitsi_popover.css?v=2">
73 73
     <link rel="stylesheet" href="css/contact_list.css?v=3">
74
-    <link rel="stylesheet" href="css/chat.css?v=4">
74
+    <link rel="stylesheet" href="css/chat.css?v=5">
75 75
     <link rel="stylesheet" href="css/welcome_page.css?v=2">
76 76
     <!--
77 77
         Link used for inline installation of chrome desktop streaming extension,
@@ -193,9 +193,10 @@
193 193
                     <div class="header_button_separator"></div>
194 194
                     <span class="toolbar_span">
195 195
                         <a class="button" data-container="body" data-toggle="popover" shortcut="toggleChatPopover" data-placement="bottom" content="Open / close chat" onclick='BottomToolbar.toggleChat();'>
196
-                            <i id="chatButton" class="icon-chat"></i>
196
+                            <i id="chatButton" class="icon-chat">
197
+                                <span id="unreadMessages"></span>
198
+                            </i>
197 199
                         </a>
198
-                        <span id="unreadMessages"></span>
199 200
                     </span>
200 201
                     <span id="prezi_button">
201 202
                         <div class="header_button_separator"></div>
@@ -273,13 +274,16 @@
273 274
             <span id="bottomToolbar">
274 275
                 <span class="bottomToolbar_span">
275 276
                     <a class="bottomToolbarButton" data-container="body" data-toggle="popover" shortcut="toggleChatPopover" data-placement="top" content="Open / close chat" onclick='BottomToolbar.toggleChat();'>
276
-                        <i id="chatBottomButton" class="icon-chat-simple"></i>
277
+                        <i id="chatBottomButton" class="icon-chat-simple">
278
+                            <span id="bottomUnreadMessages"></span>
279
+                        </i>
277 280
                     </a>
278 281
                 </span>
279 282
                 <div class="bottom_button_separator"></div>
280 283
                 <span class="bottomToolbar_span">
281 284
                     <a class="bottomToolbarButton" data-container="body" data-toggle="popover" data-placement="top" id="contactlistpopover" content="Open / close contact list" onclick='BottomToolbar.toggleContactList();'>
282 285
                         <i id="contactListButton" class="icon-contactList"></i>
286
+                        <span id="numberOfParticipants"></span>
283 287
                     </a>
284 288
                 </span>
285 289
                 <div class="bottom_button_separator"></div>

正在加载...
取消
保存