123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122 |
- /* global APP, config, $, interfaceConfig */
-
- import UIUtil from '../util/UIUtil';
- import BottomToolbar from './BottomToolbar';
- import Toolbar from './Toolbar';
- import FilmStrip from '../videolayout/FilmStrip.js';
-
- let toolbarTimeoutObject;
- let toolbarTimeout = interfaceConfig.INITIAL_TOOLBAR_TIMEOUT;
- /**
- * If true the toolbar will be always displayed
- */
- let alwaysVisibleToolbar = (config.alwaysVisibleToolbar === true);
-
- function showDesktopSharingButton() {
- if (APP.conference.isDesktopSharingEnabled &&
- UIUtil.isButtonEnabled('desktop')) {
- $('#toolbar_button_desktopsharing').css({display: "inline-block"});
- } else {
- $('#toolbar_button_desktopsharing').css({display: "none"});
- }
- }
-
- /**
- * Hides the toolbar.
- */
- function hideToolbar() {
- if (alwaysVisibleToolbar) {
- return;
- }
-
- clearTimeout(toolbarTimeoutObject);
- toolbarTimeoutObject = null;
-
- if (Toolbar.isHovered()) {
- toolbarTimeoutObject = setTimeout(hideToolbar, toolbarTimeout);
- } else {
- Toolbar.hide();
- $('#subject').animate({top: "-=40"}, 300);
- if (!FilmStrip.isFilmStripVisible()) {
- BottomToolbar.hide(true);
- }
- }
- }
-
- const ToolbarToggler = {
- /**
- * Sets the value of alwaysVisibleToolbar variable.
- * @param value {boolean} the new value of alwaysVisibleToolbar variable
- */
- setAlwaysVisibleToolbar(value) {
- alwaysVisibleToolbar = value;
- },
- /**
- * Resets the value of alwaysVisibleToolbar variable to the default one.
- */
- resetAlwaysVisibleToolbar() {
- alwaysVisibleToolbar = (config.alwaysVisibleToolbar === true);
- },
- /**
- * Shows the main toolbar.
- */
- showToolbar () {
- if (interfaceConfig.filmStripOnly) {
- return;
- }
-
- var updateTimeout = false;
- if (Toolbar.isEnabled() && !Toolbar.isVisible()) {
- Toolbar.show();
- $('#subject').animate({top: "+=40"}, 300);
- updateTimeout = true;
- }
-
- if (BottomToolbar.isEnabled() && !BottomToolbar.isVisible()) {
- BottomToolbar.show(true);
- updateTimeout = true;
- }
-
- if (updateTimeout) {
- if (toolbarTimeoutObject) {
- clearTimeout(toolbarTimeoutObject);
- toolbarTimeoutObject = null;
- }
- toolbarTimeoutObject = setTimeout(hideToolbar, toolbarTimeout);
- toolbarTimeout = interfaceConfig.TOOLBAR_TIMEOUT;
- }
-
- // Show/hide desktop sharing button
- showDesktopSharingButton();
- },
-
- /**
- * Docks/undocks the toolbar.
- *
- * @param isDock indicates what operation to perform
- */
- dockToolbar (isDock) {
- if (interfaceConfig.filmStripOnly || !Toolbar.isEnabled()) {
- return;
- }
-
- if (isDock) {
- // First make sure the toolbar is shown.
- if (!Toolbar.isVisible()) {
- this.showToolbar();
- }
-
- // Then clear the time out, to dock the toolbar.
- clearTimeout(toolbarTimeoutObject);
- toolbarTimeoutObject = null;
- } else {
- if (Toolbar.isVisible()) {
- toolbarTimeoutObject = setTimeout(hideToolbar, toolbarTimeout);
- } else {
- this.showToolbar();
- }
- }
- }
- };
-
- module.exports = ToolbarToggler;
|