2015-07-28 21:52:32 +00:00
|
|
|
/* global APP, config, $, interfaceConfig, Moderator,
|
|
|
|
DesktopStreaming.showDesktopSharingButton */
|
2014-09-04 13:18:28 +00:00
|
|
|
|
2015-01-07 14:54:03 +00:00
|
|
|
var toolbarTimeoutObject,
|
2015-08-28 21:13:40 +00:00
|
|
|
toolbarTimeout = interfaceConfig.INITIAL_TOOLBAR_TIMEOUT,
|
|
|
|
UIUtil = require("../util/UIUtil");
|
2015-01-07 14:54:03 +00:00
|
|
|
|
2015-01-13 13:11:05 +00:00
|
|
|
function showDesktopSharingButton() {
|
2015-09-14 14:25:43 +00:00
|
|
|
if (APP.desktopsharing.isDesktopSharingEnabled() &&
|
|
|
|
UIUtil.isButtonEnabled('desktop')) {
|
2015-08-12 18:06:55 +00:00
|
|
|
$('#toolbar_button_desktopsharing').css({display: "inline-block"});
|
2015-01-13 13:11:05 +00:00
|
|
|
} else {
|
2015-08-05 21:56:08 +00:00
|
|
|
$('#toolbar_button_desktopsharing').css({display: "none"});
|
2015-01-13 13:11:05 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-01-07 14:54:03 +00:00
|
|
|
/**
|
|
|
|
* Hides the toolbar.
|
|
|
|
*/
|
|
|
|
function hideToolbar() {
|
2015-05-20 12:10:09 +00:00
|
|
|
if(config.alwaysVisibleToolbar)
|
|
|
|
return;
|
|
|
|
|
2015-01-07 14:54:03 +00:00
|
|
|
var header = $("#header"),
|
|
|
|
bottomToolbar = $("#bottomToolbar");
|
|
|
|
var isToolbarHover = false;
|
|
|
|
header.find('*').each(function () {
|
|
|
|
var id = $(this).attr('id');
|
|
|
|
if ($("#" + id + ":hover").length > 0) {
|
|
|
|
isToolbarHover = true;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
if ($("#bottomToolbar:hover").length > 0) {
|
|
|
|
isToolbarHover = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
clearTimeout(toolbarTimeoutObject);
|
|
|
|
toolbarTimeoutObject = null;
|
|
|
|
|
|
|
|
if (!isToolbarHover) {
|
|
|
|
header.hide("slide", { direction: "up", duration: 300});
|
|
|
|
$('#subject').animate({top: "-=40"}, 300);
|
|
|
|
if ($("#remoteVideos").hasClass("hidden")) {
|
|
|
|
bottomToolbar.hide(
|
|
|
|
"slide", {direction: "right", duration: 300});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
toolbarTimeoutObject = setTimeout(hideToolbar, toolbarTimeout);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
var ToolbarToggler = {
|
2014-09-04 13:18:28 +00:00
|
|
|
/**
|
|
|
|
* Shows the main toolbar.
|
|
|
|
*/
|
2015-01-07 14:54:03 +00:00
|
|
|
showToolbar: function () {
|
2015-08-10 17:59:12 +00:00
|
|
|
if (interfaceConfig.filmStripOnly)
|
2015-08-06 23:34:40 +00:00
|
|
|
return;
|
2014-09-04 13:18:28 +00:00
|
|
|
var header = $("#header"),
|
|
|
|
bottomToolbar = $("#bottomToolbar");
|
|
|
|
if (!header.is(':visible') || !bottomToolbar.is(":visible")) {
|
|
|
|
header.show("slide", { direction: "up", duration: 300});
|
|
|
|
$('#subject').animate({top: "+=40"}, 300);
|
2014-11-28 15:17:13 +00:00
|
|
|
if (!bottomToolbar.is(":visible")) {
|
|
|
|
bottomToolbar.show(
|
|
|
|
"slide", {direction: "right", duration: 300});
|
2014-09-04 13:18:28 +00:00
|
|
|
}
|
|
|
|
|
2014-09-18 12:39:40 +00:00
|
|
|
if (toolbarTimeoutObject) {
|
|
|
|
clearTimeout(toolbarTimeoutObject);
|
|
|
|
toolbarTimeoutObject = null;
|
2014-09-04 13:18:28 +00:00
|
|
|
}
|
2014-09-18 12:39:40 +00:00
|
|
|
toolbarTimeoutObject = setTimeout(hideToolbar, toolbarTimeout);
|
|
|
|
toolbarTimeout = interfaceConfig.TOOLBAR_TIMEOUT;
|
2014-09-04 13:18:28 +00:00
|
|
|
}
|
|
|
|
|
2015-01-28 14:35:22 +00:00
|
|
|
if (APP.xmpp.isModerator())
|
2014-09-04 13:18:28 +00:00
|
|
|
{
|
2014-11-28 15:17:13 +00:00
|
|
|
// TODO: Enable settings functionality.
|
|
|
|
// Need to uncomment the settings button in index.html.
|
2014-09-04 13:18:28 +00:00
|
|
|
// $('#settingsButton').css({visibility:"visible"});
|
|
|
|
}
|
|
|
|
|
|
|
|
// Show/hide desktop sharing button
|
|
|
|
showDesktopSharingButton();
|
2015-01-07 14:54:03 +00:00
|
|
|
},
|
2014-09-04 13:18:28 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Docks/undocks the toolbar.
|
|
|
|
*
|
|
|
|
* @param isDock indicates what operation to perform
|
|
|
|
*/
|
2015-01-07 14:54:03 +00:00
|
|
|
dockToolbar: function (isDock) {
|
2015-08-10 17:59:12 +00:00
|
|
|
if (interfaceConfig.filmStripOnly)
|
2015-08-06 23:34:40 +00:00
|
|
|
return;
|
|
|
|
|
2014-09-04 13:18:28 +00:00
|
|
|
if (isDock) {
|
|
|
|
// First make sure the toolbar is shown.
|
|
|
|
if (!$('#header').is(':visible')) {
|
2015-01-07 14:54:03 +00:00
|
|
|
this.showToolbar();
|
2014-09-04 13:18:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Then clear the time out, to dock the toolbar.
|
2014-09-18 12:39:40 +00:00
|
|
|
if (toolbarTimeoutObject) {
|
|
|
|
clearTimeout(toolbarTimeoutObject);
|
|
|
|
toolbarTimeoutObject = null;
|
2014-09-04 13:18:28 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
if (!$('#header').is(':visible')) {
|
2015-01-07 14:54:03 +00:00
|
|
|
this.showToolbar();
|
2014-09-04 13:18:28 +00:00
|
|
|
}
|
|
|
|
else {
|
2014-09-18 12:39:40 +00:00
|
|
|
toolbarTimeoutObject = setTimeout(hideToolbar, toolbarTimeout);
|
2014-09-04 13:18:28 +00:00
|
|
|
}
|
|
|
|
}
|
2015-01-13 13:11:05 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
showDesktopSharingButton: showDesktopSharingButton
|
2015-01-07 14:54:03 +00:00
|
|
|
};
|
2014-09-04 13:18:28 +00:00
|
|
|
|
2015-01-07 14:54:03 +00:00
|
|
|
module.exports = ToolbarToggler;
|