2014-06-12 18:33:57 +00:00
|
|
|
var Toolbar = (function (my) {
|
|
|
|
|
2014-09-23 12:27:12 +00:00
|
|
|
/**
|
|
|
|
* Disables and enables some of the buttons.
|
|
|
|
*/
|
|
|
|
my.setupButtonsFromConfig = function () {
|
|
|
|
if(config.disablePrezi)
|
|
|
|
{
|
|
|
|
$("#prezi_button").css({display: "none"});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-06-12 18:33:57 +00:00
|
|
|
/**
|
|
|
|
* 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) {
|
2014-08-14 15:29:28 +00:00
|
|
|
if (sharedKey) {
|
|
|
|
messageHandler.openMessageDialog(null,
|
|
|
|
"This conversation is currently protected by" +
|
2014-09-24 09:51:42 +00:00
|
|
|
" a password. Only the owner of the conference" +
|
|
|
|
" could set a password.",
|
2014-08-14 15:29:28 +00:00
|
|
|
false,
|
2014-09-24 09:51:42 +00:00
|
|
|
"Password");
|
2014-08-14 15:29:28 +00:00
|
|
|
} else {
|
|
|
|
messageHandler.openMessageDialog(null,
|
|
|
|
"This conversation isn't currently protected by" +
|
2014-09-24 09:51:42 +00:00
|
|
|
" a password. Only the owner of the conference" +
|
|
|
|
" could set a password.",
|
2014-08-14 15:29:28 +00:00
|
|
|
false,
|
2014-09-24 09:51:42 +00:00
|
|
|
"Password");
|
2014-08-14 15:29:28 +00:00
|
|
|
}
|
2014-06-12 18:33:57 +00:00
|
|
|
} else {
|
|
|
|
if (sharedKey) {
|
2014-08-14 15:29:28 +00:00
|
|
|
messageHandler.openTwoButtonDialog(null,
|
2014-09-24 09:51:42 +00:00
|
|
|
"Are you sure you would like to remove your password?",
|
2014-08-14 15:29:28 +00:00
|
|
|
false,
|
|
|
|
"Remove",
|
|
|
|
function (e, v) {
|
|
|
|
if (v) {
|
|
|
|
setSharedKey('');
|
|
|
|
lockRoom(false);
|
2014-06-12 18:33:57 +00:00
|
|
|
}
|
2014-08-14 15:29:28 +00:00
|
|
|
});
|
2014-06-12 18:33:57 +00:00
|
|
|
} else {
|
2014-08-14 15:29:28 +00:00
|
|
|
messageHandler.openTwoButtonDialog(null,
|
2014-09-24 09:51:42 +00:00
|
|
|
'<h2>Set a password to lock your room</h2>' +
|
2014-08-14 15:29:28 +00:00
|
|
|
'<input id="lockKey" type="text"' +
|
2014-09-24 09:51:42 +00:00
|
|
|
'placeholder="your password" autofocus>',
|
2014-08-14 15:29:28 +00:00
|
|
|
false,
|
|
|
|
"Save",
|
|
|
|
function (e, v) {
|
|
|
|
if (v) {
|
|
|
|
var lockKey = document.getElementById('lockKey');
|
|
|
|
|
|
|
|
if (lockKey.value) {
|
|
|
|
setSharedKey(Util.escapeHtml(lockKey.value));
|
|
|
|
lockRoom(true);
|
2014-06-12 18:33:57 +00:00
|
|
|
}
|
|
|
|
}
|
2014-08-14 15:29:28 +00:00
|
|
|
},
|
|
|
|
function () {
|
|
|
|
document.getElementById('lockKey').focus();
|
2014-06-12 18:33:57 +00:00
|
|
|
}
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Opens the invite link dialog.
|
|
|
|
*/
|
2014-07-13 17:30:14 +00:00
|
|
|
my.openLinkDialog = function () {
|
|
|
|
var inviteLink;
|
2014-08-14 15:29:28 +00:00
|
|
|
if (roomUrl == null) {
|
2014-07-13 17:30:14 +00:00
|
|
|
inviteLink = "Your conference is currently being created...";
|
2014-08-14 15:29:28 +00:00
|
|
|
} else {
|
2014-07-13 17:30:14 +00:00
|
|
|
inviteLink = encodeURI(roomUrl);
|
2014-08-14 15:29:28 +00:00
|
|
|
}
|
|
|
|
messageHandler.openTwoButtonDialog(
|
|
|
|
"Share this link with everyone you want to invite",
|
|
|
|
'<input id="inviteLinkRef" type="text" value="' +
|
2014-07-13 17:30:14 +00:00
|
|
|
inviteLink + '" onclick="this.select();" readonly>',
|
2014-08-14 15:29:28 +00:00
|
|
|
false,
|
|
|
|
"Invite",
|
|
|
|
function (e, v) {
|
|
|
|
if (v) {
|
|
|
|
if (roomUrl) {
|
|
|
|
inviteParticipants();
|
2014-07-13 17:30:14 +00:00
|
|
|
}
|
2014-06-12 18:33:57 +00:00
|
|
|
}
|
2014-08-14 15:29:28 +00:00
|
|
|
},
|
|
|
|
function () {
|
|
|
|
if (roomUrl) {
|
|
|
|
document.getElementById('inviteLinkRef').select();
|
|
|
|
} else {
|
|
|
|
document.getElementById('jqi_state0_buttonInvite')
|
|
|
|
.disabled = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
);
|
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 = "";
|
2014-08-14 15:29:28 +00:00
|
|
|
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";
|
|
|
|
}
|
2014-07-13 17:30:14 +00:00
|
|
|
|
|
|
|
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
|
|
|
|
2014-08-14 15:29:28 +00:00
|
|
|
if (window.localStorage.displayname) {
|
2014-07-13 17:30:14 +00:00
|
|
|
body += "%0D%0A%0D%0A" + window.localStorage.displayname;
|
2014-08-14 15:29:28 +00:00
|
|
|
}
|
2014-07-13 17:30:14 +00:00
|
|
|
|
|
|
|
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-08-14 15:29:28 +00:00
|
|
|
messageHandler.openTwoButtonDialog(
|
|
|
|
'<h2>Configure your conference</h2>' +
|
|
|
|
'<input type="checkbox" id="initMuted">' +
|
|
|
|
'Participants join muted<br/>' +
|
|
|
|
'<input type="checkbox" id="requireNicknames">' +
|
|
|
|
'Require nicknames<br/><br/>' +
|
2014-09-24 09:51:42 +00:00
|
|
|
'Set a password to lock your room:' +
|
|
|
|
'<input id="lockKey" type="text" placeholder="your password"' +
|
2014-08-14 15:29:28 +00:00
|
|
|
'autofocus>',
|
|
|
|
null,
|
|
|
|
false,
|
|
|
|
"Save",
|
|
|
|
function () {
|
|
|
|
document.getElementById('lockKey').focus();
|
|
|
|
},
|
|
|
|
function (e, v) {
|
|
|
|
if (v) {
|
|
|
|
if ($('#initMuted').is(":checked")) {
|
|
|
|
// it is checked
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($('#requireNicknames').is(":checked")) {
|
|
|
|
// it is checked
|
2014-06-12 18:33:57 +00:00
|
|
|
}
|
2014-08-14 15:29:28 +00:00
|
|
|
/*
|
|
|
|
var lockKey = document.getElementById('lockKey');
|
|
|
|
|
|
|
|
if (lockKey.value) {
|
|
|
|
setSharedKey(lockKey.value);
|
|
|
|
lockRoom(true);
|
|
|
|
}
|
|
|
|
*/
|
2014-06-12 18:33:57 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 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();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
/**
|
2014-10-30 15:32:03 +00:00
|
|
|
* Unlocks the lock button state.
|
2014-06-12 18:33:57 +00:00
|
|
|
*/
|
2014-10-30 15:32:03 +00:00
|
|
|
my.unlockLockButton = function() {
|
|
|
|
if($("#lockIcon").hasClass("icon-security-locked"))
|
|
|
|
buttonClick("#lockIcon", "icon-security icon-security-locked");
|
2014-06-12 18:33:57 +00:00
|
|
|
};
|
2014-10-28 12:46:06 +00:00
|
|
|
/**
|
|
|
|
* Updates the lock button state to locked.
|
|
|
|
*/
|
|
|
|
my.lockLockButton = function() {
|
|
|
|
if($("#lockIcon").hasClass("icon-security"))
|
|
|
|
buttonClick("#lockIcon", "icon-security icon-security-locked");
|
|
|
|
};
|
2014-06-12 18:33:57 +00:00
|
|
|
|
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
|
2014-08-14 15:29:28 +00:00
|
|
|
my.showSipCallButton = function(show){
|
|
|
|
if (config.hosts.call_control && show) {
|
2014-08-08 13:25:24 +00:00
|
|
|
$('#sipCallButton').css({display: "inline"});
|
2014-08-14 15:29:28 +00:00
|
|
|
} else {
|
2014-08-08 13:25:24 +00:00
|
|
|
$('#sipCallButton').css({display: "none"});
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2014-09-24 12:47:26 +00:00
|
|
|
/**
|
|
|
|
* Sets the state of the button. The button has blue glow if desktop streaming is active.
|
|
|
|
* @param active the state of the desktop streaming.
|
|
|
|
*/
|
|
|
|
my.changeDesktopSharingButtonState = function (active) {
|
|
|
|
var button = $("#desktopsharing > a");
|
|
|
|
if(active)
|
|
|
|
{
|
|
|
|
button.addClass("glow");
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
button.removeClass("glow");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-06-12 18:33:57 +00:00
|
|
|
return my;
|
2014-07-18 15:37:52 +00:00
|
|
|
}(Toolbar || {}));
|