2014-06-12 18:33:57 +00:00
|
|
|
var Toolbar = (function (my) {
|
|
|
|
var INITIAL_TOOLBAR_TIMEOUT = 20000;
|
|
|
|
var TOOLBAR_TIMEOUT = INITIAL_TOOLBAR_TIMEOUT;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Opens the lock room dialog.
|
|
|
|
*/
|
2014-07-13 17:30:14 +00:00
|
|
|
my.openLockDialog = function () {
|
2014-06-12 18:33:57 +00:00
|
|
|
// Only the focus is able to set a shared key.
|
|
|
|
if (focus === null) {
|
|
|
|
if (sharedKey)
|
|
|
|
$.prompt("This conversation is currently protected by"
|
|
|
|
+ " a shared secret key.",
|
|
|
|
{
|
2014-08-14 14:14:36 +00:00
|
|
|
title: "Secret key",
|
2014-06-12 18:33:57 +00:00
|
|
|
persistent: false
|
|
|
|
}
|
|
|
|
);
|
|
|
|
else
|
|
|
|
$.prompt("This conversation isn't currently protected by"
|
2014-08-14 13:53:12 +00:00
|
|
|
+ " a secret key. Only the owner of the conference"
|
2014-06-12 18:33:57 +00:00
|
|
|
+ " could set a shared key.",
|
|
|
|
{
|
2014-08-14 14:14:36 +00:00
|
|
|
title: "Secret key",
|
2014-06-12 18:33:57 +00:00
|
|
|
persistent: false
|
|
|
|
}
|
|
|
|
);
|
|
|
|
} else {
|
|
|
|
if (sharedKey) {
|
|
|
|
$.prompt("Are you sure you would like to remove your secret key?",
|
|
|
|
{
|
2014-07-18 15:37:52 +00:00
|
|
|
title: "Remove secret key",
|
2014-06-12 18:33:57 +00:00
|
|
|
persistent: false,
|
|
|
|
buttons: { "Remove": true, "Cancel": false},
|
|
|
|
defaultButton: 1,
|
|
|
|
submit: function (e, v, m, f) {
|
|
|
|
if (v) {
|
|
|
|
setSharedKey('');
|
|
|
|
lockRoom(false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
);
|
|
|
|
} else {
|
2014-07-18 15:37:52 +00:00
|
|
|
$.prompt('<h2>Set a secret key to lock your room</h2>' +
|
2014-06-12 18:33:57 +00:00
|
|
|
'<input id="lockKey" type="text" placeholder="your shared key" autofocus>',
|
|
|
|
{
|
|
|
|
persistent: false,
|
|
|
|
buttons: { "Save": true, "Cancel": false},
|
|
|
|
defaultButton: 1,
|
|
|
|
loaded: function (event) {
|
|
|
|
document.getElementById('lockKey').focus();
|
|
|
|
},
|
|
|
|
submit: function (e, v, m, f) {
|
|
|
|
if (v) {
|
|
|
|
var lockKey = document.getElementById('lockKey');
|
2014-07-13 17:30:14 +00:00
|
|
|
|
2014-06-12 18:33:57 +00:00
|
|
|
if (lockKey.value) {
|
|
|
|
setSharedKey(Util.escapeHtml(lockKey.value));
|
|
|
|
lockRoom(true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Opens the invite link dialog.
|
|
|
|
*/
|
2014-07-13 17:30:14 +00:00
|
|
|
my.openLinkDialog = function () {
|
|
|
|
var inviteLink;
|
|
|
|
if (roomUrl == null)
|
|
|
|
inviteLink = "Your conference is currently being created...";
|
|
|
|
else
|
|
|
|
inviteLink = encodeURI(roomUrl);
|
|
|
|
|
2014-06-12 18:33:57 +00:00
|
|
|
$.prompt('<input id="inviteLinkRef" type="text" value="' +
|
2014-07-13 17:30:14 +00:00
|
|
|
inviteLink + '" onclick="this.select();" readonly>',
|
|
|
|
{
|
|
|
|
title: "Share this link with everyone you want to invite",
|
|
|
|
persistent: false,
|
|
|
|
buttons: { "Invite": true, "Cancel": false},
|
|
|
|
defaultButton: 1,
|
|
|
|
loaded: function (event) {
|
|
|
|
if (roomUrl)
|
|
|
|
document.getElementById('inviteLinkRef').select();
|
|
|
|
else
|
|
|
|
document.getElementById('jqi_state0_buttonInvite')
|
|
|
|
.disabled = true;
|
|
|
|
},
|
|
|
|
submit: function (e, v, m, f) {
|
|
|
|
if (v) {
|
|
|
|
if (roomUrl) {
|
|
|
|
inviteParticipants();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2014-06-12 18:33:57 +00:00
|
|
|
}
|
2014-07-13 17:30:14 +00:00
|
|
|
);
|
2014-06-12 18:33:57 +00:00
|
|
|
};
|
|
|
|
|
2014-07-13 17:30:14 +00:00
|
|
|
/**
|
|
|
|
* Invite participants to conference.
|
|
|
|
*/
|
|
|
|
function inviteParticipants() {
|
|
|
|
if (roomUrl == null)
|
|
|
|
return;
|
|
|
|
|
|
|
|
var sharedKeyText = "";
|
|
|
|
if (sharedKey && sharedKey.length > 0)
|
|
|
|
sharedKeyText
|
|
|
|
= "This conference is password protected. Please use the "
|
|
|
|
+ "following pin when joining:%0D%0A%0D%0A"
|
|
|
|
+ sharedKey + "%0D%0A%0D%0A";
|
|
|
|
|
|
|
|
var conferenceName = roomUrl.substring(roomUrl.lastIndexOf('/') + 1);
|
|
|
|
var subject = "Invitation to a Jitsi Meet (" + conferenceName + ")";
|
2014-08-22 15:37:11 +00:00
|
|
|
var body = "Hey there, I%27d like to invite you to a Jitsi Meet" +
|
|
|
|
" conference I%27ve just set up.%0D%0A%0D%0A" +
|
|
|
|
"Please click on the following link in order" +
|
|
|
|
" to join the conference.%0D%0A%0D%0A" +
|
|
|
|
roomUrl +
|
|
|
|
"%0D%0A%0D%0A" +
|
|
|
|
sharedKeyText +
|
|
|
|
"Note that Jitsi Meet is currently only supported by Chromium," +
|
|
|
|
" Google Chrome and Opera, so you need" +
|
|
|
|
" to be using one of these browsers.%0D%0A%0D%0A" +
|
|
|
|
"Talk to you in a sec!";
|
2014-07-13 17:30:14 +00:00
|
|
|
|
|
|
|
if (window.localStorage.displayname)
|
|
|
|
body += "%0D%0A%0D%0A" + window.localStorage.displayname;
|
|
|
|
|
|
|
|
window.open("mailto:?subject=" + subject + "&body=" + body, '_blank');
|
|
|
|
}
|
|
|
|
|
2014-06-12 18:33:57 +00:00
|
|
|
/**
|
|
|
|
* Opens the settings dialog.
|
|
|
|
*/
|
2014-07-13 17:30:14 +00:00
|
|
|
my.openSettingsDialog = function () {
|
2014-06-12 18:33:57 +00:00
|
|
|
$.prompt('<h2>Configure your conference</h2>' +
|
|
|
|
'<input type="checkbox" id="initMuted"> Participants join muted<br/>' +
|
|
|
|
'<input type="checkbox" id="requireNicknames"> Require nicknames<br/><br/>' +
|
2014-07-18 15:37:52 +00:00
|
|
|
'Set a secret key to lock your room: <input id="lockKey" type="text" placeholder="your shared key" autofocus>',
|
2014-06-12 18:33:57 +00:00
|
|
|
{
|
|
|
|
persistent: false,
|
|
|
|
buttons: { "Save": true, "Cancel": false},
|
|
|
|
defaultButton: 1,
|
|
|
|
loaded: function (event) {
|
|
|
|
document.getElementById('lockKey').focus();
|
|
|
|
},
|
|
|
|
submit: function (e, v, m, f) {
|
|
|
|
if (v) {
|
|
|
|
if ($('#initMuted').is(":checked")) {
|
|
|
|
// it is checked
|
|
|
|
}
|
2014-07-13 17:30:14 +00:00
|
|
|
|
2014-06-12 18:33:57 +00:00
|
|
|
if ($('#requireNicknames').is(":checked")) {
|
|
|
|
// it is checked
|
|
|
|
}
|
|
|
|
/*
|
|
|
|
var lockKey = document.getElementById('lockKey');
|
2014-07-13 17:30:14 +00:00
|
|
|
|
2014-06-12 18:33:57 +00:00
|
|
|
if (lockKey.value)
|
|
|
|
{
|
|
|
|
setSharedKey(lockKey.value);
|
|
|
|
lockRoom(true);
|
|
|
|
}
|
|
|
|
*/
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Toggles the application in and out of full screen mode
|
|
|
|
* (a.k.a. presentation mode in Chrome).
|
|
|
|
*/
|
|
|
|
my.toggleFullScreen = function() {
|
|
|
|
var fsElement = document.documentElement;
|
|
|
|
|
|
|
|
if (!document.mozFullScreen && !document.webkitIsFullScreen) {
|
|
|
|
//Enter Full Screen
|
|
|
|
if (fsElement.mozRequestFullScreen) {
|
|
|
|
fsElement.mozRequestFullScreen();
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
fsElement.webkitRequestFullScreen(Element.ALLOW_KEYBOARD_INPUT);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
//Exit Full Screen
|
|
|
|
if (document.mozCancelFullScreen) {
|
|
|
|
document.mozCancelFullScreen();
|
|
|
|
} else {
|
|
|
|
document.webkitCancelFullScreen();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Shows the main toolbar.
|
|
|
|
*/
|
|
|
|
my.showToolbar = function() {
|
|
|
|
if (!$('#header').is(':visible')) {
|
|
|
|
$('#header').show("slide", { direction: "up", duration: 300});
|
2014-06-20 09:00:49 +00:00
|
|
|
$('#subject').animate({top: "+=40"}, 300);
|
2014-06-12 18:33:57 +00:00
|
|
|
|
|
|
|
if (toolbarTimeout) {
|
|
|
|
clearTimeout(toolbarTimeout);
|
|
|
|
toolbarTimeout = null;
|
|
|
|
}
|
|
|
|
toolbarTimeout = setTimeout(hideToolbar, TOOLBAR_TIMEOUT);
|
|
|
|
TOOLBAR_TIMEOUT = 4000;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (focus != null)
|
|
|
|
{
|
|
|
|
// TODO: Enable settings functionality. Need to uncomment the settings button in index.html.
|
|
|
|
// $('#settingsButton').css({visibility:"visible"});
|
|
|
|
}
|
|
|
|
|
|
|
|
// Show/hide desktop sharing button
|
|
|
|
showDesktopSharingButton();
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Docks/undocks the toolbar.
|
|
|
|
*
|
|
|
|
* @param isDock indicates what operation to perform
|
|
|
|
*/
|
|
|
|
my.dockToolbar = function(isDock) {
|
|
|
|
if (isDock) {
|
|
|
|
// First make sure the toolbar is shown.
|
|
|
|
if (!$('#header').is(':visible')) {
|
|
|
|
Toolbar.showToolbar();
|
|
|
|
}
|
2014-07-13 18:12:38 +00:00
|
|
|
|
2014-06-12 18:33:57 +00:00
|
|
|
// Then clear the time out, to dock the toolbar.
|
2014-07-13 18:12:38 +00:00
|
|
|
if (toolbarTimeout) {
|
|
|
|
clearTimeout(toolbarTimeout);
|
|
|
|
toolbarTimeout = null;
|
|
|
|
}
|
2014-06-12 18:33:57 +00:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
if (!$('#header').is(':visible')) {
|
|
|
|
Toolbar.showToolbar();
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
toolbarTimeout = setTimeout(hideToolbar, TOOLBAR_TIMEOUT);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Updates the lock button state.
|
|
|
|
*/
|
|
|
|
my.updateLockButton = function() {
|
|
|
|
buttonClick("#lockIcon", "icon-security icon-security-locked");
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Hides the toolbar.
|
|
|
|
*/
|
|
|
|
var hideToolbar = function () {
|
|
|
|
var isToolbarHover = false;
|
|
|
|
$('#header').find('*').each(function () {
|
|
|
|
var id = $(this).attr('id');
|
|
|
|
if ($("#" + id + ":hover").length > 0) {
|
|
|
|
isToolbarHover = true;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
clearTimeout(toolbarTimeout);
|
|
|
|
toolbarTimeout = null;
|
|
|
|
|
|
|
|
if (!isToolbarHover) {
|
|
|
|
$('#header').hide("slide", { direction: "up", duration: 300});
|
2014-06-20 09:00:49 +00:00
|
|
|
$('#subject').animate({top: "-=40"}, 300);
|
2014-06-12 18:33:57 +00:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
toolbarTimeout = setTimeout(hideToolbar, TOOLBAR_TIMEOUT);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2014-07-23 07:47:00 +00:00
|
|
|
// Shows or hides the 'recording' button.
|
|
|
|
my.showRecordingButton = function (show) {
|
|
|
|
if (!config.enableRecording) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (show) {
|
|
|
|
$('#recording').css({display: "inline"});
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$('#recording').css({display: "none"});
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
// Toggle the state of the recording button
|
|
|
|
my.toggleRecordingButtonState = function() {
|
|
|
|
$('#recordButton').toggleClass('active');
|
|
|
|
};
|
|
|
|
|
2014-08-08 13:25:24 +00:00
|
|
|
// Shows or hides SIP calls button
|
|
|
|
my.showSipCallButton = function (show)
|
|
|
|
{
|
|
|
|
if (config.hosts.call_control && show)
|
|
|
|
{
|
|
|
|
$('#sipCallButton').css({display: "inline"});
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$('#sipCallButton').css({display: "none"});
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2014-06-12 18:33:57 +00:00
|
|
|
return my;
|
2014-07-18 15:37:52 +00:00
|
|
|
}(Toolbar || {}));
|