From 828fe6afe73630c672cc4cc6c9dcc81a899dbb7c Mon Sep 17 00:00:00 2001 From: Yana Stamcheva Date: Fri, 20 Dec 2013 15:19:17 +0100 Subject: [PATCH] Adds you're about to leave this page warning. --- app.js | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/app.js b/app.js index 6c8b3ecec..b63ad3c28 100644 --- a/app.js +++ b/app.js @@ -8,6 +8,8 @@ var nickname = null; var sharedKey = ''; var roomUrl = null; +window.onbeforeunload = closePageWarning; + function init() { RTC = setupRTC(); if (RTC === null) { @@ -329,6 +331,9 @@ $(window).bind('beforeunload', function () { } }); +/* + * Appends the given message to the chat conversation. + */ function updateChatConversation(nick, message) { var divClassName = ''; @@ -341,10 +346,16 @@ function updateChatConversation(nick, message) $('#chatconversation').animate({ scrollTop: $('#chatconversation')[0].scrollHeight}, 1000); } +/* + * Changes the style class of the element given by id. + */ function buttonClick(id, classname) { $(id).toggleClass(classname); // add the class to the clicked element } +/* + * Opens the lock room dialog. + */ function openLockDialog() { if (sharedKey) $.prompt("Are you sure you would like to remove your secret key?", @@ -386,6 +397,9 @@ function openLockDialog() { }); } +/* + * Opens the invite link dialog. + */ function openLinkDialog() { $.prompt('', { @@ -398,12 +412,18 @@ function openLinkDialog() { }); } +/* + * Locks / unlocks the room. + */ function lockRoom(lock) { connection.emuc.lockRoom(sharedKey); buttonClick("#lockIcon", "fa fa-unlock fa-lg fa fa-lock fa-lg"); } +/* + * Opens / closes the chat area. + */ function openChat() { var chatspace = $('#chatspace'); var videospace = $('#videospace'); @@ -427,10 +447,27 @@ function openChat() { $('#usermsg').focus(); } +/* + * Shows the call main toolbar. + */ function showToolbar() { $('#toolbar').css({visibility:"visible"}); } +/* + * Updates the room invite url. + */ function updateRoomUrl(newRoomUrl) { roomUrl = newRoomUrl; } + +/* + * Warning to the user that the conference window is about to be closed. + */ +function closePageWarning() { + if (focus != null) + return "You are the owner of this conference call and you are about to end it."; + else + return "You are about to leave this conversation."; + +}