Browse Source

Adds you're about to leave this page warning.

master
Yana Stamcheva 11 years ago
parent
commit
828fe6afe7
1 changed files with 37 additions and 0 deletions
  1. 37
    0
      app.js

+ 37
- 0
app.js View File

8
 var sharedKey = '';
8
 var sharedKey = '';
9
 var roomUrl = null;
9
 var roomUrl = null;
10
 
10
 
11
+window.onbeforeunload = closePageWarning;
12
+
11
 function init() {
13
 function init() {
12
     RTC = setupRTC();
14
     RTC = setupRTC();
13
     if (RTC === null) {
15
     if (RTC === null) {
329
     }
331
     }
330
 });
332
 });
331
 
333
 
334
+/*
335
+ * Appends the given message to the chat conversation.
336
+ */
332
 function updateChatConversation(nick, message)
337
 function updateChatConversation(nick, message)
333
 {
338
 {
334
     var divClassName = '';
339
     var divClassName = '';
341
     $('#chatconversation').animate({ scrollTop: $('#chatconversation')[0].scrollHeight}, 1000);
346
     $('#chatconversation').animate({ scrollTop: $('#chatconversation')[0].scrollHeight}, 1000);
342
 }
347
 }
343
 
348
 
349
+/*
350
+ * Changes the style class of the element given by id.
351
+ */
344
 function buttonClick(id, classname) {
352
 function buttonClick(id, classname) {
345
     $(id).toggleClass(classname); // add the class to the clicked element
353
     $(id).toggleClass(classname); // add the class to the clicked element
346
 }
354
 }
347
 
355
 
356
+/*
357
+ * Opens the lock room dialog.
358
+ */
348
 function openLockDialog() {
359
 function openLockDialog() {
349
     if (sharedKey)
360
     if (sharedKey)
350
         $.prompt("Are you sure you would like to remove your secret key?",
361
         $.prompt("Are you sure you would like to remove your secret key?",
386
         });
397
         });
387
 }
398
 }
388
 
399
 
400
+/*
401
+ * Opens the invite link dialog.
402
+ */
389
 function openLinkDialog() {
403
 function openLinkDialog() {
390
     $.prompt('<input id="inviteLinkRef" type="text" value="' + roomUrl + '" onclick="this.select();">',
404
     $.prompt('<input id="inviteLinkRef" type="text" value="' + roomUrl + '" onclick="this.select();">',
391
              {
405
              {
398
              });
412
              });
399
 }
413
 }
400
 
414
 
415
+/*
416
+ * Locks / unlocks the room.
417
+ */
401
 function lockRoom(lock) {
418
 function lockRoom(lock) {
402
     connection.emuc.lockRoom(sharedKey);
419
     connection.emuc.lockRoom(sharedKey);
403
     
420
     
404
     buttonClick("#lockIcon", "fa fa-unlock fa-lg fa fa-lock fa-lg");
421
     buttonClick("#lockIcon", "fa fa-unlock fa-lg fa fa-lock fa-lg");
405
 }
422
 }
406
 
423
 
424
+/*
425
+ * Opens / closes the chat area.
426
+ */
407
 function openChat() {
427
 function openChat() {
408
     var chatspace = $('#chatspace');
428
     var chatspace = $('#chatspace');
409
     var videospace = $('#videospace');
429
     var videospace = $('#videospace');
427
         $('#usermsg').focus();
447
         $('#usermsg').focus();
428
 }
448
 }
429
 
449
 
450
+/*
451
+ * Shows the call main toolbar.
452
+ */
430
 function showToolbar() {
453
 function showToolbar() {
431
     $('#toolbar').css({visibility:"visible"});
454
     $('#toolbar').css({visibility:"visible"});
432
 }
455
 }
433
 
456
 
457
+/*
458
+ * Updates the room invite url.
459
+ */
434
 function updateRoomUrl(newRoomUrl) {
460
 function updateRoomUrl(newRoomUrl) {
435
     roomUrl = newRoomUrl;
461
     roomUrl = newRoomUrl;
436
 }
462
 }
463
+
464
+/*
465
+ * Warning to the user that the conference window is about to be closed.
466
+ */
467
+function closePageWarning() {
468
+    if (focus != null)
469
+        return "You are the owner of this conference call and you are about to end it.";
470
+    else
471
+        return "You are about to leave this conversation.";
472
+        
473
+}

Loading…
Cancel
Save