2016-08-09 20:04:40 +00:00
|
|
|
/* global $, APP, interfaceConfig, JitsiMeetJS */
|
2015-12-10 16:36:03 +00:00
|
|
|
import UIUtil from '../util/UIUtil';
|
|
|
|
import UIEvents from '../../../service/UI/UIEvents';
|
2015-11-13 17:04:49 +00:00
|
|
|
|
2015-12-10 16:36:03 +00:00
|
|
|
const defaultBottomToolbarButtons = {
|
2016-08-29 03:59:09 +00:00
|
|
|
'chat': {
|
|
|
|
id: '#bottom_toolbar_chat'
|
|
|
|
},
|
|
|
|
'contacts': {
|
|
|
|
id: '#bottom_toolbar_contact_list'
|
|
|
|
},
|
|
|
|
'filmstrip': {
|
2016-08-29 20:47:24 +00:00
|
|
|
id: '#bottom_toolbar_film_strip',
|
|
|
|
shortcut: "F",
|
|
|
|
shortcutAttr: "filmstripPopover",
|
|
|
|
shortcutFunc: function() {
|
|
|
|
JitsiMeetJS.analytics.sendEvent("shortcut.film.toggled");
|
|
|
|
APP.UI.toggleFilmStrip();
|
|
|
|
},
|
|
|
|
shortcutDescription: "keyboardShortcuts.toggleFilmstrip"
|
2016-08-29 03:59:09 +00:00
|
|
|
}
|
2015-08-28 21:13:40 +00:00
|
|
|
};
|
|
|
|
|
2015-12-10 16:36:03 +00:00
|
|
|
const BottomToolbar = {
|
2015-12-30 10:55:51 +00:00
|
|
|
init () {
|
|
|
|
this.toolbar = $('#bottomToolbar');
|
|
|
|
|
2016-04-07 17:08:00 +00:00
|
|
|
// The bottom toolbar is enabled by default.
|
|
|
|
this.enabled = true;
|
|
|
|
},
|
|
|
|
/**
|
|
|
|
* Enables / disables the bottom toolbar.
|
|
|
|
* @param {e} set to {true} to enable the bottom toolbar or {false}
|
|
|
|
* to disable it
|
|
|
|
*/
|
|
|
|
enable (e) {
|
|
|
|
this.enabled = e;
|
|
|
|
if (!e && this.isVisible())
|
|
|
|
this.hide(false);
|
|
|
|
},
|
|
|
|
/**
|
|
|
|
* Indicates if the bottom toolbar is currently enabled.
|
|
|
|
* @return {this.enabled}
|
|
|
|
*/
|
|
|
|
isEnabled() {
|
|
|
|
return this.enabled;
|
|
|
|
},
|
2016-08-29 20:47:24 +00:00
|
|
|
|
2015-12-30 10:55:51 +00:00
|
|
|
setupListeners (emitter) {
|
2015-12-10 16:36:03 +00:00
|
|
|
UIUtil.hideDisabledButtons(defaultBottomToolbarButtons);
|
2014-08-22 15:37:11 +00:00
|
|
|
|
2015-12-10 16:36:03 +00:00
|
|
|
const buttonHandlers = {
|
|
|
|
"bottom_toolbar_contact_list": function () {
|
2016-08-09 20:04:40 +00:00
|
|
|
JitsiMeetJS.analytics.sendEvent(
|
|
|
|
'bottomtoolbar.contacts.toggled');
|
2015-12-10 16:36:03 +00:00
|
|
|
emitter.emit(UIEvents.TOGGLE_CONTACT_LIST);
|
|
|
|
},
|
|
|
|
"bottom_toolbar_film_strip": function () {
|
2016-08-09 20:04:40 +00:00
|
|
|
JitsiMeetJS.analytics.sendEvent(
|
|
|
|
'bottomtoolbar.filmstrip.toggled');
|
2015-12-10 16:36:03 +00:00
|
|
|
emitter.emit(UIEvents.TOGGLE_FILM_STRIP);
|
|
|
|
},
|
|
|
|
"bottom_toolbar_chat": function () {
|
2016-08-09 20:04:40 +00:00
|
|
|
JitsiMeetJS.analytics.sendEvent('bottomtoolbar.chat.toggled');
|
2015-12-10 16:36:03 +00:00
|
|
|
emitter.emit(UIEvents.TOGGLE_CHAT);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2016-08-29 20:47:24 +00:00
|
|
|
Object.keys(defaultBottomToolbarButtons).forEach(
|
|
|
|
id => {
|
|
|
|
if (UIUtil.isButtonEnabled(id)) {
|
|
|
|
var button = defaultBottomToolbarButtons[id];
|
|
|
|
|
|
|
|
if (button.shortcut)
|
|
|
|
APP.keyboardshortcut.registerShortcut(
|
|
|
|
button.shortcut,
|
|
|
|
button.shortcutAttr,
|
|
|
|
button.shortcutFunc,
|
|
|
|
button.shortcutDescription
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
);
|
|
|
|
|
2015-12-10 16:36:03 +00:00
|
|
|
Object.keys(buttonHandlers).forEach(
|
|
|
|
buttonId => $(`#${buttonId}`).click(buttonHandlers[buttonId])
|
|
|
|
);
|
|
|
|
},
|
2014-08-22 15:37:11 +00:00
|
|
|
|
2015-12-30 10:55:51 +00:00
|
|
|
resizeToolbar (thumbWidth, thumbHeight) {
|
|
|
|
let bottom = (thumbHeight - this.toolbar.outerHeight())/2 + 18;
|
|
|
|
this.toolbar.css({bottom});
|
2015-12-25 16:55:45 +00:00
|
|
|
},
|
|
|
|
|
2016-02-24 21:05:24 +00:00
|
|
|
/**
|
|
|
|
* Returns true if this toolbar is currently visible, or false otherwise.
|
|
|
|
* @return <tt>true</tt> if currently visible, <tt>false</tt> - otherwise
|
|
|
|
*/
|
|
|
|
isVisible() {
|
|
|
|
return this.toolbar.is(":visible");
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Hides the bottom toolbar with animation or not depending on the animate
|
|
|
|
* parameter.
|
|
|
|
* @param animate <tt>true</tt> to hide the bottom toolbar with animation,
|
|
|
|
* <tt>false</tt> or nothing to hide it without animation.
|
|
|
|
*/
|
|
|
|
hide(animate) {
|
|
|
|
if (animate)
|
|
|
|
this.toolbar.hide("slide", {direction: "right", duration: 300});
|
|
|
|
else
|
|
|
|
this.toolbar.css("display", "none");
|
|
|
|
},
|
2015-12-25 16:55:45 +00:00
|
|
|
|
2016-02-24 21:05:24 +00:00
|
|
|
/**
|
|
|
|
* Shows the bottom toolbar with animation or not depending on the animate
|
|
|
|
* parameter.
|
|
|
|
* @param animate <tt>true</tt> to show the bottom toolbar with animation,
|
|
|
|
* <tt>false</tt> or nothing to show it without animation.
|
|
|
|
*/
|
|
|
|
show(animate) {
|
|
|
|
if (animate)
|
|
|
|
this.toolbar.show("slide", {direction: "right", duration: 300});
|
|
|
|
else
|
|
|
|
this.toolbar.css("display", "block");
|
2015-12-10 16:36:03 +00:00
|
|
|
}
|
|
|
|
};
|
2015-01-07 14:54:03 +00:00
|
|
|
|
2015-12-10 16:36:03 +00:00
|
|
|
export default BottomToolbar;
|