Przeglądaj źródła

Adds you're about to leave this page warning.

master
Yana Stamcheva 11 lat temu
rodzic
commit
828fe6afe7
1 zmienionych plików z 37 dodań i 0 usunięć
  1. 37
    0
      app.js

+ 37
- 0
app.js Wyświetl plik

@@ -8,6 +8,8 @@ var nickname = null;
8 8
 var sharedKey = '';
9 9
 var roomUrl = null;
10 10
 
11
+window.onbeforeunload = closePageWarning;
12
+
11 13
 function init() {
12 14
     RTC = setupRTC();
13 15
     if (RTC === null) {
@@ -329,6 +331,9 @@ $(window).bind('beforeunload', function () {
329 331
     }
330 332
 });
331 333
 
334
+/*
335
+ * Appends the given message to the chat conversation.
336
+ */
332 337
 function updateChatConversation(nick, message)
333 338
 {
334 339
     var divClassName = '';
@@ -341,10 +346,16 @@ function updateChatConversation(nick, message)
341 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 352
 function buttonClick(id, classname) {
345 353
     $(id).toggleClass(classname); // add the class to the clicked element
346 354
 }
347 355
 
356
+/*
357
+ * Opens the lock room dialog.
358
+ */
348 359
 function openLockDialog() {
349 360
     if (sharedKey)
350 361
         $.prompt("Are you sure you would like to remove your secret key?",
@@ -386,6 +397,9 @@ function openLockDialog() {
386 397
         });
387 398
 }
388 399
 
400
+/*
401
+ * Opens the invite link dialog.
402
+ */
389 403
 function openLinkDialog() {
390 404
     $.prompt('<input id="inviteLinkRef" type="text" value="' + roomUrl + '" onclick="this.select();">',
391 405
              {
@@ -398,12 +412,18 @@ function openLinkDialog() {
398 412
              });
399 413
 }
400 414
 
415
+/*
416
+ * Locks / unlocks the room.
417
+ */
401 418
 function lockRoom(lock) {
402 419
     connection.emuc.lockRoom(sharedKey);
403 420
     
404 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 427
 function openChat() {
408 428
     var chatspace = $('#chatspace');
409 429
     var videospace = $('#videospace');
@@ -427,10 +447,27 @@ function openChat() {
427 447
         $('#usermsg').focus();
428 448
 }
429 449
 
450
+/*
451
+ * Shows the call main toolbar.
452
+ */
430 453
 function showToolbar() {
431 454
     $('#toolbar').css({visibility:"visible"});
432 455
 }
433 456
 
457
+/*
458
+ * Updates the room invite url.
459
+ */
434 460
 function updateRoomUrl(newRoomUrl) {
435 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
+}

Ładowanie…
Anuluj
Zapisz