2016-08-09 20:04:40 +00:00
|
|
|
/* global APP, $, config, interfaceConfig, JitsiMeetJS */
|
2015-09-11 02:42:15 +00:00
|
|
|
/* jshint -W101 */
|
2015-12-10 16:36:03 +00:00
|
|
|
import UIUtil from '../util/UIUtil';
|
|
|
|
import UIEvents from '../../../service/UI/UIEvents';
|
2016-09-08 22:34:16 +00:00
|
|
|
import SideContainerToggler from "../side_pannels/SideContainerToggler";
|
2015-01-07 14:54:03 +00:00
|
|
|
|
2015-12-10 16:36:03 +00:00
|
|
|
let roomUrl = null;
|
|
|
|
let emitter = null;
|
2015-01-07 14:54:03 +00:00
|
|
|
|
2015-12-10 13:30:25 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Opens the invite link dialog.
|
|
|
|
*/
|
|
|
|
function openLinkDialog () {
|
2015-12-10 16:36:03 +00:00
|
|
|
let inviteAttributes;
|
2015-12-10 13:30:25 +00:00
|
|
|
|
|
|
|
if (roomUrl === null) {
|
|
|
|
inviteAttributes = 'data-i18n="[value]roomUrlDefaultMsg" value="' +
|
|
|
|
APP.translation.translateString("roomUrlDefaultMsg") + '"';
|
|
|
|
} else {
|
|
|
|
inviteAttributes = "value=\"" + encodeURI(roomUrl) + "\"";
|
|
|
|
}
|
2016-09-11 21:54:32 +00:00
|
|
|
|
|
|
|
let title = APP.translation.generateTranslationHTML("dialog.shareLink");
|
2016-06-08 19:34:02 +00:00
|
|
|
APP.UI.messageHandler.openTwoButtonDialog(
|
2016-09-11 21:54:32 +00:00
|
|
|
null, null, null,
|
|
|
|
'<h2>' + title + '</h2>'
|
|
|
|
+ '<input id="inviteLinkRef" type="text" '
|
|
|
|
+ inviteAttributes + ' onclick="this.select();" readonly>',
|
2015-12-10 13:30:25 +00:00
|
|
|
false, "dialog.Invite",
|
|
|
|
function (e, v) {
|
|
|
|
if (v && roomUrl) {
|
2016-08-09 20:04:40 +00:00
|
|
|
JitsiMeetJS.analytics.sendEvent('toolbar.invite.button');
|
2015-12-10 13:30:25 +00:00
|
|
|
emitter.emit(UIEvents.USER_INVITED, roomUrl);
|
|
|
|
}
|
2016-08-01 20:03:38 +00:00
|
|
|
else {
|
2016-08-09 20:04:40 +00:00
|
|
|
JitsiMeetJS.analytics.sendEvent('toolbar.invite.cancel');
|
2016-08-01 20:03:38 +00:00
|
|
|
}
|
2015-12-10 13:30:25 +00:00
|
|
|
},
|
|
|
|
function (event) {
|
|
|
|
if (roomUrl) {
|
|
|
|
document.getElementById('inviteLinkRef').select();
|
|
|
|
} else {
|
|
|
|
if (event && event.target) {
|
2016-09-11 21:54:32 +00:00
|
|
|
$(event.target).find('button[value=true]')
|
|
|
|
.prop('disabled', true);
|
2015-12-10 13:30:25 +00:00
|
|
|
}
|
|
|
|
}
|
2016-08-01 20:03:38 +00:00
|
|
|
},
|
|
|
|
function (e, v, m, f) {
|
|
|
|
if(!v && !m && !f)
|
2016-08-09 20:04:40 +00:00
|
|
|
JitsiMeetJS.analytics.sendEvent('toolbar.invite.close');
|
2015-12-10 13:30:25 +00:00
|
|
|
}
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
const buttonHandlers = {
|
2016-09-11 21:54:32 +00:00
|
|
|
"toolbar_button_profile": function () {
|
|
|
|
JitsiMeetJS.analytics.sendEvent('toolbar.profile.toggled');
|
|
|
|
emitter.emit(UIEvents.TOGGLE_PROFILE);
|
|
|
|
},
|
2015-01-07 14:54:03 +00:00
|
|
|
"toolbar_button_mute": function () {
|
2016-04-19 18:07:04 +00:00
|
|
|
let sharedVideoManager = APP.UI.getSharedVideoManager();
|
|
|
|
|
2015-12-09 13:09:12 +00:00
|
|
|
if (APP.conference.audioMuted) {
|
2016-04-19 18:07:04 +00:00
|
|
|
// If there's a shared video with the volume "on" and we aren't
|
|
|
|
// the video owner, we warn the user
|
|
|
|
// that currently it's not possible to unmute.
|
|
|
|
if (sharedVideoManager
|
|
|
|
&& sharedVideoManager.isSharedVideoVolumeOn()
|
|
|
|
&& !sharedVideoManager.isSharedVideoOwner()) {
|
|
|
|
UIUtil.animateShowElement(
|
|
|
|
$("#unableToUnmutePopup"), true, 5000);
|
|
|
|
}
|
|
|
|
else {
|
2016-08-09 20:04:40 +00:00
|
|
|
JitsiMeetJS.analytics.sendEvent('toolbar.audio.unmuted');
|
2016-04-19 18:07:04 +00:00
|
|
|
emitter.emit(UIEvents.AUDIO_MUTED, false, true);
|
|
|
|
}
|
2015-09-02 17:08:48 +00:00
|
|
|
} else {
|
2016-08-09 20:04:40 +00:00
|
|
|
JitsiMeetJS.analytics.sendEvent('toolbar.audio.muted');
|
2016-04-19 18:07:04 +00:00
|
|
|
emitter.emit(UIEvents.AUDIO_MUTED, true, true);
|
2015-09-02 17:08:48 +00:00
|
|
|
}
|
2015-01-07 14:54:03 +00:00
|
|
|
},
|
|
|
|
"toolbar_button_camera": function () {
|
2015-12-09 13:09:12 +00:00
|
|
|
if (APP.conference.videoMuted) {
|
2016-08-09 20:04:40 +00:00
|
|
|
JitsiMeetJS.analytics.sendEvent('toolbar.video.enabled');
|
2015-12-03 13:11:01 +00:00
|
|
|
emitter.emit(UIEvents.VIDEO_MUTED, false);
|
2015-09-02 17:08:48 +00:00
|
|
|
} else {
|
2016-08-09 20:04:40 +00:00
|
|
|
JitsiMeetJS.analytics.sendEvent('toolbar.video.disabled');
|
2015-12-03 13:11:01 +00:00
|
|
|
emitter.emit(UIEvents.VIDEO_MUTED, true);
|
2015-09-02 17:08:48 +00:00
|
|
|
}
|
2015-01-07 14:54:03 +00:00
|
|
|
},
|
|
|
|
"toolbar_button_security": function () {
|
2016-08-09 20:04:40 +00:00
|
|
|
JitsiMeetJS.analytics.sendEvent('toolbar.lock.clicked');
|
2015-12-09 17:10:49 +00:00
|
|
|
emitter.emit(UIEvents.ROOM_LOCK_CLICKED);
|
2015-01-07 14:54:03 +00:00
|
|
|
},
|
|
|
|
"toolbar_button_link": function () {
|
2016-08-09 20:04:40 +00:00
|
|
|
JitsiMeetJS.analytics.sendEvent('toolbar.invite.clicked');
|
2015-12-10 13:30:25 +00:00
|
|
|
openLinkDialog();
|
2015-01-07 14:54:03 +00:00
|
|
|
},
|
|
|
|
"toolbar_button_chat": function () {
|
2016-08-09 20:04:40 +00:00
|
|
|
JitsiMeetJS.analytics.sendEvent('toolbar.chat.toggled');
|
2015-12-10 13:30:25 +00:00
|
|
|
emitter.emit(UIEvents.TOGGLE_CHAT);
|
2015-01-07 14:54:03 +00:00
|
|
|
},
|
2016-09-08 18:16:23 +00:00
|
|
|
"toolbar_contact_list": function () {
|
|
|
|
JitsiMeetJS.analytics.sendEvent(
|
|
|
|
'toolbar.contacts.toggled');
|
|
|
|
emitter.emit(UIEvents.TOGGLE_CONTACT_LIST);
|
|
|
|
},
|
2015-01-07 14:54:03 +00:00
|
|
|
"toolbar_button_etherpad": function () {
|
2016-08-09 20:04:40 +00:00
|
|
|
JitsiMeetJS.analytics.sendEvent('toolbar.etherpad.clicked');
|
2015-12-09 13:09:12 +00:00
|
|
|
emitter.emit(UIEvents.ETHERPAD_CLICKED);
|
2015-01-07 14:54:03 +00:00
|
|
|
},
|
2016-03-18 20:00:55 +00:00
|
|
|
"toolbar_button_sharedvideo": function () {
|
2016-08-09 20:04:40 +00:00
|
|
|
JitsiMeetJS.analytics.sendEvent('toolbar.sharedvideo.clicked');
|
2016-03-18 20:00:55 +00:00
|
|
|
emitter.emit(UIEvents.SHARED_VIDEO_CLICKED);
|
|
|
|
},
|
2015-01-07 14:54:03 +00:00
|
|
|
"toolbar_button_desktopsharing": function () {
|
2016-02-04 15:25:11 +00:00
|
|
|
if (APP.conference.isSharingScreen) {
|
2016-08-09 20:04:40 +00:00
|
|
|
JitsiMeetJS.analytics.sendEvent('toolbar.screen.disabled');
|
2015-09-02 17:08:48 +00:00
|
|
|
} else {
|
2016-08-09 20:04:40 +00:00
|
|
|
JitsiMeetJS.analytics.sendEvent('toolbar.screen.enabled');
|
2015-09-02 17:08:48 +00:00
|
|
|
}
|
2015-12-30 13:28:56 +00:00
|
|
|
emitter.emit(UIEvents.TOGGLE_SCREENSHARING);
|
2015-01-07 14:54:03 +00:00
|
|
|
},
|
2015-07-28 21:52:32 +00:00
|
|
|
"toolbar_button_fullScreen": function() {
|
2016-08-09 20:04:40 +00:00
|
|
|
JitsiMeetJS.analytics.sendEvent('toolbar.fullscreen.enabled');
|
2016-09-11 21:54:32 +00:00
|
|
|
UIUtil.buttonClick("toolbar_button_fullScreen",
|
2016-08-29 03:59:09 +00:00
|
|
|
"icon-full-screen icon-exit-full-screen");
|
2015-12-10 13:30:25 +00:00
|
|
|
emitter.emit(UIEvents.FULLSCREEN_TOGGLE);
|
2015-01-07 14:54:03 +00:00
|
|
|
},
|
|
|
|
"toolbar_button_sip": function () {
|
2016-08-09 20:04:40 +00:00
|
|
|
JitsiMeetJS.analytics.sendEvent('toolbar.sip.clicked');
|
2015-12-10 15:48:56 +00:00
|
|
|
showSipNumberInput();
|
2015-01-07 14:54:03 +00:00
|
|
|
},
|
2015-04-08 10:51:29 +00:00
|
|
|
"toolbar_button_dialpad": function () {
|
2016-08-09 20:04:40 +00:00
|
|
|
JitsiMeetJS.analytics.sendEvent('toolbar.sip.dialpad.clicked');
|
2015-12-10 13:30:25 +00:00
|
|
|
dialpadButtonClicked();
|
2015-04-08 10:51:29 +00:00
|
|
|
},
|
2015-01-07 14:54:03 +00:00
|
|
|
"toolbar_button_settings": function () {
|
2016-08-09 20:04:40 +00:00
|
|
|
JitsiMeetJS.analytics.sendEvent('toolbar.settings.toggled');
|
2015-12-10 13:30:25 +00:00
|
|
|
emitter.emit(UIEvents.TOGGLE_SETTINGS);
|
2015-01-07 14:54:03 +00:00
|
|
|
},
|
|
|
|
"toolbar_button_hangup": function () {
|
2016-08-09 20:04:40 +00:00
|
|
|
JitsiMeetJS.analytics.sendEvent('toolbar.hangup');
|
2015-12-10 15:48:56 +00:00
|
|
|
emitter.emit(UIEvents.HANGUP);
|
2015-02-18 15:50:47 +00:00
|
|
|
},
|
|
|
|
"toolbar_button_login": function () {
|
2016-08-09 20:04:40 +00:00
|
|
|
JitsiMeetJS.analytics.sendEvent('toolbar.authenticate.login.clicked');
|
2015-12-10 13:30:25 +00:00
|
|
|
emitter.emit(UIEvents.AUTH_CLICKED);
|
2015-02-18 15:50:47 +00:00
|
|
|
},
|
|
|
|
"toolbar_button_logout": function () {
|
2016-08-09 20:04:40 +00:00
|
|
|
JitsiMeetJS.analytics.sendEvent('toolbar.authenticate.logout.clicked');
|
2015-02-18 15:50:47 +00:00
|
|
|
// Ask for confirmation
|
2016-06-08 19:34:02 +00:00
|
|
|
APP.UI.messageHandler.openTwoButtonDialog(
|
2015-02-26 15:35:35 +00:00
|
|
|
"dialog.logoutTitle",
|
|
|
|
null,
|
2015-02-23 14:59:36 +00:00
|
|
|
"dialog.logoutQuestion",
|
2015-02-26 15:35:35 +00:00
|
|
|
null,
|
|
|
|
false,
|
|
|
|
"dialog.Yes",
|
2015-02-18 15:50:47 +00:00
|
|
|
function (evt, yes) {
|
|
|
|
if (yes) {
|
2015-12-10 15:48:56 +00:00
|
|
|
emitter.emit(UIEvents.LOGOUT);
|
2015-02-18 15:50:47 +00:00
|
|
|
}
|
2015-12-10 15:48:56 +00:00
|
|
|
}
|
|
|
|
);
|
2016-09-08 18:16:23 +00:00
|
|
|
},
|
|
|
|
"toolbar_film_strip": function () {
|
|
|
|
JitsiMeetJS.analytics.sendEvent(
|
|
|
|
'bottomtoolbar.filmstrip.toggled');
|
|
|
|
emitter.emit(UIEvents.TOGGLE_FILM_STRIP);
|
2015-01-07 14:54:03 +00:00
|
|
|
}
|
|
|
|
};
|
2016-09-11 21:54:32 +00:00
|
|
|
|
2015-12-10 16:36:03 +00:00
|
|
|
const defaultToolbarButtons = {
|
2016-08-29 03:59:09 +00:00
|
|
|
'microphone': {
|
2016-09-11 21:54:32 +00:00
|
|
|
id: 'toolbar_button_mute',
|
|
|
|
className: "button icon-microphone",
|
2016-08-29 03:59:09 +00:00
|
|
|
shortcut: 'M',
|
|
|
|
shortcutAttr: 'mutePopover',
|
|
|
|
shortcutFunc: function() {
|
|
|
|
JitsiMeetJS.analytics.sendEvent('shortcut.audiomute.toggled');
|
|
|
|
APP.conference.toggleAudioMuted();
|
|
|
|
},
|
2016-09-11 21:54:32 +00:00
|
|
|
shortcutDescription: "keyboardShortcuts.mute",
|
2016-09-12 19:43:34 +00:00
|
|
|
popups: [
|
|
|
|
{
|
|
|
|
id: "micMutedPopup",
|
|
|
|
className: "loginmenu",
|
|
|
|
dataAttr: "[html]toolbar.micMutedPopup"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
id: "unableToUnmutePopup",
|
|
|
|
className: "loginmenu",
|
|
|
|
dataAttr: "[html]toolbar.unableToUnmutePopup"
|
|
|
|
}
|
|
|
|
],
|
2016-09-11 21:54:32 +00:00
|
|
|
content: "Mute / Unmute",
|
|
|
|
i18n: "[content]toolbar.mute"
|
2016-08-29 03:59:09 +00:00
|
|
|
},
|
|
|
|
'camera': {
|
2016-09-11 21:54:32 +00:00
|
|
|
id: 'toolbar_button_camera',
|
|
|
|
className: "button icon-camera",
|
2016-08-29 03:59:09 +00:00
|
|
|
shortcut: 'V',
|
|
|
|
shortcutAttr: 'toggleVideoPopover',
|
|
|
|
shortcutFunc: function() {
|
|
|
|
JitsiMeetJS.analytics.sendEvent('shortcut.videomute.toggled');
|
|
|
|
APP.conference.toggleVideoMuted();
|
|
|
|
},
|
2016-09-11 21:54:32 +00:00
|
|
|
shortcutDescription: "keyboardShortcuts.videoMute",
|
|
|
|
content: "Start / stop camera",
|
|
|
|
i18n: "[content]toolbar.videomute"
|
2016-08-29 03:59:09 +00:00
|
|
|
},
|
|
|
|
'desktop': {
|
2016-09-11 21:54:32 +00:00
|
|
|
id: 'toolbar_button_desktopsharing',
|
2016-09-13 04:10:18 +00:00
|
|
|
className: 'button icon-share-desktop',
|
2016-08-29 03:59:09 +00:00
|
|
|
shortcut: 'D',
|
|
|
|
shortcutAttr: 'toggleDesktopSharingPopover',
|
|
|
|
shortcutFunc: function() {
|
|
|
|
JitsiMeetJS.analytics.sendEvent('shortcut.screen.toggled');
|
|
|
|
APP.conference.toggleScreenSharing();
|
|
|
|
},
|
2016-09-13 04:10:18 +00:00
|
|
|
shortcutDescription: 'keyboardShortcuts.toggleScreensharing',
|
|
|
|
content: 'Share screen',
|
|
|
|
i18n: '[content]toolbar.sharescreen'
|
2016-08-29 03:59:09 +00:00
|
|
|
},
|
|
|
|
'security': {
|
2016-09-11 21:54:32 +00:00
|
|
|
id: 'toolbar_button_security'
|
2016-08-29 03:59:09 +00:00
|
|
|
},
|
|
|
|
'invite': {
|
2016-09-13 04:10:18 +00:00
|
|
|
id: 'toolbar_button_link',
|
|
|
|
className: 'button icon-link',
|
|
|
|
content: 'Invite others',
|
|
|
|
i18n: '[content]toolbar.invite'
|
2016-08-29 03:59:09 +00:00
|
|
|
},
|
|
|
|
'chat': {
|
2016-09-11 21:54:32 +00:00
|
|
|
id: 'toolbar_button_chat',
|
2016-08-29 03:59:09 +00:00
|
|
|
shortcut: 'C',
|
|
|
|
shortcutAttr: 'toggleChatPopover',
|
|
|
|
shortcutFunc: function() {
|
|
|
|
JitsiMeetJS.analytics.sendEvent('shortcut.chat.toggled');
|
|
|
|
APP.UI.toggleChat();
|
|
|
|
},
|
2016-09-13 04:10:18 +00:00
|
|
|
shortcutDescription: 'keyboardShortcuts.toggleChat',
|
|
|
|
sideContainerId: 'chat_container'
|
2016-08-29 03:59:09 +00:00
|
|
|
},
|
2016-09-08 18:16:23 +00:00
|
|
|
'contacts': {
|
2016-09-11 21:54:32 +00:00
|
|
|
id: 'toolbar_contact_list',
|
2016-09-13 04:10:18 +00:00
|
|
|
sideContainerId: 'contacts_container'
|
2016-09-08 18:16:23 +00:00
|
|
|
},
|
2016-09-11 21:54:32 +00:00
|
|
|
'profile': {
|
|
|
|
id: 'toolbar_button_profile',
|
2016-09-13 04:10:18 +00:00
|
|
|
sideContainerId: 'profile_container'
|
2016-09-11 21:54:32 +00:00
|
|
|
},
|
2016-08-29 03:59:09 +00:00
|
|
|
'etherpad': {
|
2016-09-11 21:54:32 +00:00
|
|
|
id: 'toolbar_button_etherpad'
|
2016-08-29 03:59:09 +00:00
|
|
|
},
|
|
|
|
'fullscreen': {
|
2016-09-11 21:54:32 +00:00
|
|
|
id: 'toolbar_button_fullScreen',
|
|
|
|
className: "button icon-full-screen",
|
|
|
|
shortcut: 'F',
|
|
|
|
shortcutAttr: 'toggleFullscreenPopover',
|
|
|
|
shortcutFunc: function() {
|
|
|
|
JitsiMeetJS.analytics.sendEvent('shortcut.fullscreen.toggled');
|
|
|
|
APP.UI.toggleFullScreen();
|
|
|
|
},
|
|
|
|
shortcutDescription: "keyboardShortcuts.toggleChat",
|
|
|
|
content: "Enter / Exit Full Screen",
|
|
|
|
i18n: "[content]toolbar.fullscreen"
|
2016-08-29 03:59:09 +00:00
|
|
|
},
|
|
|
|
'settings': {
|
2016-09-11 21:54:32 +00:00
|
|
|
id: 'toolbar_button_settings',
|
2016-09-08 22:34:16 +00:00
|
|
|
sideContainerId: "settings_container"
|
2016-08-29 03:59:09 +00:00
|
|
|
},
|
|
|
|
'hangup': {
|
2016-09-11 21:54:32 +00:00
|
|
|
id: 'toolbar_button_hangup',
|
|
|
|
className: "button icon-hangup",
|
|
|
|
content: "Hang Up",
|
|
|
|
i18n: "[content]toolbar.hangup"
|
2016-09-08 18:16:23 +00:00
|
|
|
},
|
|
|
|
'filmstrip': {
|
2016-09-11 21:54:32 +00:00
|
|
|
id: 'toolbar_film_strip',
|
2016-09-08 18:16:23 +00:00
|
|
|
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-01-07 14:54:03 +00:00
|
|
|
|
2015-07-28 21:52:32 +00:00
|
|
|
function dialpadButtonClicked() {
|
|
|
|
//TODO show the dialpad box
|
2015-04-08 10:51:29 +00:00
|
|
|
}
|
|
|
|
|
2015-12-10 15:48:56 +00:00
|
|
|
function showSipNumberInput () {
|
2015-12-10 13:30:25 +00:00
|
|
|
let defaultNumber = config.defaultSipNumber
|
|
|
|
? config.defaultSipNumber
|
|
|
|
: '';
|
|
|
|
|
|
|
|
let sipMsg = APP.translation.generateTranslationHTML("dialog.sipMsg");
|
2016-06-08 19:34:02 +00:00
|
|
|
APP.UI.messageHandler.openTwoButtonDialog(
|
2015-12-10 13:30:25 +00:00
|
|
|
null, null, null,
|
|
|
|
`<h2>${sipMsg}</h2>
|
2015-12-25 16:55:45 +00:00
|
|
|
<input name="sipNumber" type="text" value="${defaultNumber}" autofocus>`,
|
2015-12-10 13:30:25 +00:00
|
|
|
false, "dialog.Dial",
|
2015-01-09 10:18:58 +00:00
|
|
|
function (e, v, m, f) {
|
2015-12-10 15:48:56 +00:00
|
|
|
if (v && f.sipNumber) {
|
|
|
|
emitter.emit(UIEvents.SIP_DIAL, f.sipNumber);
|
2015-01-09 10:18:58 +00:00
|
|
|
}
|
|
|
|
},
|
2015-03-26 13:13:27 +00:00
|
|
|
null, null, ':input:first'
|
2015-01-09 10:18:58 +00:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2015-12-10 13:30:25 +00:00
|
|
|
const Toolbar = {
|
2015-12-09 17:10:49 +00:00
|
|
|
init (eventEmitter) {
|
2015-12-03 13:11:01 +00:00
|
|
|
emitter = eventEmitter;
|
2016-04-07 17:08:00 +00:00
|
|
|
// The toolbar is enabled by default.
|
|
|
|
this.enabled = true;
|
2016-09-08 18:16:23 +00:00
|
|
|
this.toolbarSelector = $("#mainToolbarContainer");
|
|
|
|
this.extendedToolbarSelector = $("#extendedToolbar");
|
2015-12-10 16:36:03 +00:00
|
|
|
|
2016-09-11 21:54:32 +00:00
|
|
|
this._initMainToolbarButtons();
|
|
|
|
|
2015-08-28 21:13:40 +00:00
|
|
|
UIUtil.hideDisabledButtons(defaultToolbarButtons);
|
|
|
|
|
2016-08-29 03:59:09 +00:00
|
|
|
Object.keys(defaultToolbarButtons).forEach(
|
|
|
|
id => {
|
|
|
|
if (UIUtil.isButtonEnabled(id)) {
|
|
|
|
var button = defaultToolbarButtons[id];
|
|
|
|
|
|
|
|
if (button.shortcut)
|
2016-08-29 20:47:24 +00:00
|
|
|
APP.keyboardshortcut.registerShortcut(
|
2016-08-29 03:59:09 +00:00
|
|
|
button.shortcut,
|
|
|
|
button.shortcutAttr,
|
|
|
|
button.shortcutFunc,
|
|
|
|
button.shortcutDescription
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
);
|
|
|
|
|
2015-12-10 16:36:03 +00:00
|
|
|
Object.keys(buttonHandlers).forEach(
|
2016-05-17 15:58:25 +00:00
|
|
|
buttonId => $(`#${buttonId}`).click(function(event) {
|
|
|
|
!$(this).prop('disabled') && buttonHandlers[buttonId](event);
|
|
|
|
})
|
2015-12-10 16:36:03 +00:00
|
|
|
);
|
2016-09-08 22:34:16 +00:00
|
|
|
|
|
|
|
APP.UI.addListener(UIEvents.SIDE_TOOLBAR_CONTAINER_TOGGLED,
|
|
|
|
function(containerId, isVisible) {
|
2016-09-11 21:54:32 +00:00
|
|
|
Toolbar._handleSideToolbarContainerToggled( containerId,
|
2016-09-08 22:34:16 +00:00
|
|
|
isVisible);
|
|
|
|
});
|
2015-12-09 17:10:49 +00:00
|
|
|
},
|
2016-04-07 17:08:00 +00:00
|
|
|
/**
|
|
|
|
* Enables / disables the toolbar.
|
|
|
|
* @param {e} set to {true} to enable the 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;
|
|
|
|
},
|
2015-01-07 14:54:03 +00:00
|
|
|
/**
|
|
|
|
* Updates the room invite url.
|
|
|
|
*/
|
2015-12-09 17:10:49 +00:00
|
|
|
updateRoomUrl (newRoomUrl) {
|
2015-01-07 14:54:03 +00:00
|
|
|
roomUrl = newRoomUrl;
|
|
|
|
|
2016-04-07 17:08:00 +00:00
|
|
|
// If the invite dialog has been already opened we update the
|
|
|
|
// information.
|
2015-12-10 16:36:03 +00:00
|
|
|
let inviteLink = document.getElementById('inviteLinkRef');
|
2015-01-07 14:54:03 +00:00
|
|
|
if (inviteLink) {
|
|
|
|
inviteLink.value = roomUrl;
|
|
|
|
inviteLink.select();
|
2015-04-22 12:26:04 +00:00
|
|
|
$('#inviteLinkRef').parent()
|
|
|
|
.find('button[value=true]').prop('disabled', false);
|
2015-01-07 14:54:03 +00:00
|
|
|
}
|
2015-12-09 17:10:49 +00:00
|
|
|
},
|
2015-01-07 14:54:03 +00:00
|
|
|
|
2014-06-12 18:33:57 +00:00
|
|
|
/**
|
2014-10-30 15:32:03 +00:00
|
|
|
* Unlocks the lock button state.
|
2014-06-12 18:33:57 +00:00
|
|
|
*/
|
2015-12-09 17:10:49 +00:00
|
|
|
unlockLockButton () {
|
2015-08-05 21:56:08 +00:00
|
|
|
if ($("#toolbar_button_security").hasClass("icon-security-locked"))
|
2016-09-12 01:49:59 +00:00
|
|
|
UIUtil.buttonClick("toolbar_button_security",
|
2016-03-29 17:13:54 +00:00
|
|
|
"icon-security icon-security-locked");
|
2015-12-09 17:10:49 +00:00
|
|
|
},
|
|
|
|
|
2014-10-28 12:46:06 +00:00
|
|
|
/**
|
|
|
|
* Updates the lock button state to locked.
|
|
|
|
*/
|
2015-12-09 17:10:49 +00:00
|
|
|
lockLockButton () {
|
2015-08-05 21:56:08 +00:00
|
|
|
if ($("#toolbar_button_security").hasClass("icon-security"))
|
2016-09-12 01:49:59 +00:00
|
|
|
UIUtil.buttonClick("toolbar_button_security",
|
2016-03-29 17:13:54 +00:00
|
|
|
"icon-security icon-security-locked");
|
2015-12-09 17:10:49 +00:00
|
|
|
},
|
2014-06-12 18:33:57 +00:00
|
|
|
|
2014-12-16 13:54:13 +00:00
|
|
|
/**
|
|
|
|
* Shows or hides authentication button
|
|
|
|
* @param show <tt>true</tt> to show or <tt>false</tt> to hide
|
|
|
|
*/
|
2015-12-09 17:10:49 +00:00
|
|
|
showAuthenticateButton (show) {
|
2015-08-28 21:13:40 +00:00
|
|
|
if (UIUtil.isButtonEnabled('authentication') && show) {
|
2014-12-16 13:54:13 +00:00
|
|
|
$('#authentication').css({display: "inline"});
|
2015-12-21 11:27:36 +00:00
|
|
|
} else {
|
2014-12-16 13:54:13 +00:00
|
|
|
$('#authentication').css({display: "none"});
|
|
|
|
}
|
2015-12-09 17:10:49 +00:00
|
|
|
},
|
2014-12-16 13:54:13 +00:00
|
|
|
|
2015-12-25 16:55:45 +00:00
|
|
|
showEtherpadButton () {
|
|
|
|
if (!$('#toolbar_button_etherpad').is(":visible")) {
|
|
|
|
$('#toolbar_button_etherpad').css({display: 'inline-block'});
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2016-03-18 20:00:55 +00:00
|
|
|
// Shows or hides the 'shared video' button.
|
2016-03-26 00:38:56 +00:00
|
|
|
showSharedVideoButton () {
|
|
|
|
if (UIUtil.isButtonEnabled('sharedvideo')
|
|
|
|
&& config.disableThirdPartyRequests !== true) {
|
2016-03-18 20:00:55 +00:00
|
|
|
$('#toolbar_button_sharedvideo').css({display: "inline-block"});
|
|
|
|
} else {
|
|
|
|
$('#toolbar_button_sharedvideo').css({display: "none"});
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2015-11-13 22:18:22 +00:00
|
|
|
// checks whether desktop sharing is enabled and whether
|
|
|
|
// we have params to start automatically sharing
|
2015-12-09 17:10:49 +00:00
|
|
|
checkAutoEnableDesktopSharing () {
|
2016-04-07 17:08:00 +00:00
|
|
|
if (UIUtil.isButtonEnabled('desktop')
|
|
|
|
&& config.autoEnableDesktopSharing) {
|
2015-12-30 13:28:56 +00:00
|
|
|
emitter.emit(UIEvents.TOGGLE_SCREENSHARING);
|
2015-11-13 22:18:22 +00:00
|
|
|
}
|
2015-12-09 17:10:49 +00:00
|
|
|
},
|
2015-11-13 22:18:22 +00:00
|
|
|
|
2014-08-08 13:25:24 +00:00
|
|
|
// Shows or hides SIP calls button
|
2015-12-09 17:10:49 +00:00
|
|
|
showSipCallButton (show) {
|
2016-04-07 17:08:00 +00:00
|
|
|
if (APP.conference.sipGatewayEnabled()
|
|
|
|
&& UIUtil.isButtonEnabled('sip') && show) {
|
2015-08-05 21:56:08 +00:00
|
|
|
$('#toolbar_button_sip').css({display: "inline-block"});
|
2014-08-14 15:29:28 +00:00
|
|
|
} else {
|
2015-08-05 21:56:08 +00:00
|
|
|
$('#toolbar_button_sip').css({display: "none"});
|
2014-08-08 13:25:24 +00:00
|
|
|
}
|
2015-12-09 17:10:49 +00:00
|
|
|
},
|
2014-08-08 13:25:24 +00:00
|
|
|
|
2015-04-08 10:51:29 +00:00
|
|
|
// Shows or hides the dialpad button
|
2015-12-09 17:10:49 +00:00
|
|
|
showDialPadButton (show) {
|
2015-08-28 21:13:40 +00:00
|
|
|
if (UIUtil.isButtonEnabled('dialpad') && show) {
|
2015-08-05 21:56:08 +00:00
|
|
|
$('#toolbar_button_dialpad').css({display: "inline-block"});
|
2015-04-08 10:51:29 +00:00
|
|
|
} else {
|
2015-08-05 21:56:08 +00:00
|
|
|
$('#toolbar_button_dialpad').css({display: "none"});
|
2015-04-08 10:51:29 +00:00
|
|
|
}
|
2015-12-09 17:10:49 +00:00
|
|
|
},
|
2015-04-08 10:51:29 +00:00
|
|
|
|
2015-02-18 15:50:47 +00:00
|
|
|
/**
|
|
|
|
* Displays user authenticated identity name(login).
|
|
|
|
* @param authIdentity identity name to be displayed.
|
|
|
|
*/
|
2015-12-09 17:10:49 +00:00
|
|
|
setAuthenticatedIdentity (authIdentity) {
|
2015-02-18 15:50:47 +00:00
|
|
|
if (authIdentity) {
|
2015-12-10 16:36:03 +00:00
|
|
|
let selector = $('#toolbar_auth_identity');
|
2015-04-08 10:49:49 +00:00
|
|
|
selector.css({display: "list-item"});
|
|
|
|
selector.text(authIdentity);
|
2015-02-18 15:50:47 +00:00
|
|
|
} else {
|
|
|
|
$('#toolbar_auth_identity').css({display: "none"});
|
|
|
|
}
|
2015-12-09 17:10:49 +00:00
|
|
|
},
|
2015-02-18 15:50:47 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Shows/hides login button.
|
|
|
|
* @param show <tt>true</tt> to show
|
|
|
|
*/
|
2015-12-09 17:10:49 +00:00
|
|
|
showLoginButton (show) {
|
2015-08-28 21:13:40 +00:00
|
|
|
if (UIUtil.isButtonEnabled('authentication') && show) {
|
2015-02-18 15:50:47 +00:00
|
|
|
$('#toolbar_button_login').css({display: "list-item"});
|
|
|
|
} else {
|
|
|
|
$('#toolbar_button_login').css({display: "none"});
|
|
|
|
}
|
2015-12-09 17:10:49 +00:00
|
|
|
},
|
2015-02-18 15:50:47 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Shows/hides logout button.
|
|
|
|
* @param show <tt>true</tt> to show
|
|
|
|
*/
|
2015-12-09 17:10:49 +00:00
|
|
|
showLogoutButton (show) {
|
2015-08-28 21:13:40 +00:00
|
|
|
if (UIUtil.isButtonEnabled('authentication') && show) {
|
2015-02-18 15:50:47 +00:00
|
|
|
$('#toolbar_button_logout').css({display: "list-item"});
|
|
|
|
} else {
|
|
|
|
$('#toolbar_button_logout').css({display: "none"});
|
|
|
|
}
|
2015-12-09 17:10:49 +00:00
|
|
|
},
|
2015-02-18 15:50:47 +00:00
|
|
|
|
2014-09-24 12:47:26 +00:00
|
|
|
/**
|
2016-02-04 15:25:11 +00:00
|
|
|
* Update the state of the button. The button has blue glow if desktop
|
2014-11-28 15:16:27 +00:00
|
|
|
* streaming is active.
|
2014-09-24 12:47:26 +00:00
|
|
|
*/
|
2016-02-04 15:25:11 +00:00
|
|
|
updateDesktopSharingButtonState () {
|
2015-12-10 16:36:03 +00:00
|
|
|
let button = $("#toolbar_button_desktopsharing");
|
2016-02-04 15:25:11 +00:00
|
|
|
if (APP.conference.isSharingScreen) {
|
2014-09-24 12:47:26 +00:00
|
|
|
button.addClass("glow");
|
2015-07-28 21:52:32 +00:00
|
|
|
} else {
|
2014-09-24 12:47:26 +00:00
|
|
|
button.removeClass("glow");
|
|
|
|
}
|
2015-12-10 15:48:56 +00:00
|
|
|
},
|
|
|
|
|
2016-02-09 10:19:43 +00:00
|
|
|
/**
|
|
|
|
* Marks video icon as muted or not.
|
|
|
|
* @param {boolean} muted if icon should look like muted or not
|
|
|
|
*/
|
|
|
|
markVideoIconAsMuted (muted) {
|
|
|
|
$('#toolbar_button_camera').toggleClass("icon-camera-disabled", muted);
|
|
|
|
},
|
|
|
|
|
2016-05-17 15:58:25 +00:00
|
|
|
/**
|
|
|
|
* Marks video icon as disabled or not.
|
|
|
|
* @param {boolean} disabled if icon should look like disabled or not
|
|
|
|
*/
|
|
|
|
markVideoIconAsDisabled (disabled) {
|
|
|
|
var $btn = $('#toolbar_button_camera');
|
|
|
|
|
|
|
|
$btn
|
|
|
|
.prop("disabled", disabled)
|
|
|
|
.attr("data-i18n", disabled
|
|
|
|
? "[content]toolbar.cameraDisabled"
|
|
|
|
: "[content]toolbar.videomute")
|
|
|
|
.attr("shortcut", disabled ? "" : "toggleVideoPopover");
|
|
|
|
|
|
|
|
disabled
|
|
|
|
? $btn.attr("disabled", "disabled")
|
|
|
|
: $btn.removeAttr("disabled");
|
|
|
|
|
|
|
|
APP.translation.translateElement($btn);
|
|
|
|
|
|
|
|
disabled && this.markVideoIconAsMuted(disabled);
|
|
|
|
},
|
|
|
|
|
2016-02-09 10:19:43 +00:00
|
|
|
/**
|
|
|
|
* Marks audio icon as muted or not.
|
|
|
|
* @param {boolean} muted if icon should look like muted or not
|
|
|
|
*/
|
|
|
|
markAudioIconAsMuted (muted) {
|
2016-04-07 17:08:00 +00:00
|
|
|
$('#toolbar_button_mute').toggleClass("icon-microphone",
|
|
|
|
!muted).toggleClass("icon-mic-disabled", muted);
|
|
|
|
},
|
|
|
|
|
2016-05-17 15:58:25 +00:00
|
|
|
/**
|
|
|
|
* Marks audio icon as disabled or not.
|
|
|
|
* @param {boolean} disabled if icon should look like disabled or not
|
|
|
|
*/
|
|
|
|
markAudioIconAsDisabled (disabled) {
|
|
|
|
var $btn = $('#toolbar_button_mute');
|
|
|
|
|
|
|
|
$btn
|
|
|
|
.prop("disabled", disabled)
|
|
|
|
.attr("data-i18n", disabled
|
|
|
|
? "[content]toolbar.micDisabled"
|
|
|
|
: "[content]toolbar.mute")
|
|
|
|
.attr("shortcut", disabled ? "" : "mutePopover");
|
|
|
|
|
|
|
|
disabled
|
|
|
|
? $btn.attr("disabled", "disabled")
|
|
|
|
: $btn.removeAttr("disabled");
|
|
|
|
|
|
|
|
APP.translation.translateElement($btn);
|
|
|
|
|
|
|
|
disabled && this.markAudioIconAsMuted(disabled);
|
|
|
|
},
|
|
|
|
|
2016-04-07 17:08:00 +00:00
|
|
|
/**
|
|
|
|
* Indicates if the toolbar is currently hovered.
|
2016-08-09 22:39:24 +00:00
|
|
|
* @return {boolean} true if the toolbar is currently hovered,
|
|
|
|
* false otherwise
|
2016-04-07 17:08:00 +00:00
|
|
|
*/
|
|
|
|
isHovered() {
|
2016-08-09 22:39:24 +00:00
|
|
|
var hovered = false;
|
2016-04-07 17:08:00 +00:00
|
|
|
this.toolbarSelector.find('*').each(function () {
|
|
|
|
let id = $(this).attr('id');
|
|
|
|
if ($(`#${id}:hover`).length > 0) {
|
2016-08-09 22:39:24 +00:00
|
|
|
hovered = true;
|
|
|
|
// break each
|
|
|
|
return false;
|
2016-04-07 17:08:00 +00:00
|
|
|
}
|
|
|
|
});
|
2016-08-09 22:39:24 +00:00
|
|
|
if (hovered)
|
|
|
|
return true;
|
2016-09-08 18:16:23 +00:00
|
|
|
if ($("#bottomToolbar:hover").length > 0
|
|
|
|
|| $("#extendedToolbar:hover").length > 0
|
2016-09-10 02:26:29 +00:00
|
|
|
|| SideContainerToggler.isHovered()) {
|
2016-04-07 17:08:00 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns true if this toolbar is currently visible, or false otherwise.
|
|
|
|
* @return <tt>true</tt> if currently visible, <tt>false</tt> - otherwise
|
|
|
|
*/
|
|
|
|
isVisible() {
|
2016-09-08 18:16:23 +00:00
|
|
|
return this.toolbarSelector.hasClass("slideInY");
|
2016-04-07 17:08:00 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Hides the toolbar with animation or not depending on the animate
|
|
|
|
* parameter.
|
|
|
|
*/
|
|
|
|
hide() {
|
2016-09-08 18:16:23 +00:00
|
|
|
this.toolbarSelector.toggleClass("slideInY").toggleClass("slideOutY");
|
2016-09-10 02:26:29 +00:00
|
|
|
|
|
|
|
let slideInAnimation = (SideContainerToggler.isVisible)
|
|
|
|
? "slideInExtX"
|
|
|
|
: "slideInX";
|
|
|
|
let slideOutAnimation = (SideContainerToggler.isVisible)
|
|
|
|
? "slideOutExtX"
|
|
|
|
: "slideOutX";
|
|
|
|
|
|
|
|
this.extendedToolbarSelector.toggleClass(slideInAnimation)
|
|
|
|
.toggleClass(slideOutAnimation);
|
2016-04-07 17:08:00 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Shows the toolbar with animation or not depending on the animate
|
|
|
|
* parameter.
|
|
|
|
*/
|
|
|
|
show() {
|
2016-09-08 18:16:23 +00:00
|
|
|
if (this.toolbarSelector.hasClass("slideOutY"))
|
|
|
|
this.toolbarSelector.toggleClass("slideOutY");
|
|
|
|
|
2016-09-10 02:26:29 +00:00
|
|
|
let slideInAnimation = (SideContainerToggler.isVisible)
|
|
|
|
? "slideInExtX"
|
|
|
|
: "slideInX";
|
|
|
|
let slideOutAnimation = (SideContainerToggler.isVisible)
|
|
|
|
? "slideOutExtX"
|
|
|
|
: "slideOutX";
|
|
|
|
|
|
|
|
if (this.extendedToolbarSelector.hasClass(slideOutAnimation))
|
|
|
|
this.extendedToolbarSelector.toggleClass(slideOutAnimation);
|
2016-09-08 18:16:23 +00:00
|
|
|
|
|
|
|
this.toolbarSelector.toggleClass("slideInY");
|
2016-09-10 02:26:29 +00:00
|
|
|
this.extendedToolbarSelector.toggleClass(slideInAnimation);
|
|
|
|
},
|
|
|
|
|
|
|
|
registerClickListeners(listener) {
|
|
|
|
$('#mainToolbarContainer').click(listener);
|
|
|
|
|
|
|
|
$("#extendedToolbar").click(listener);
|
2016-09-08 22:34:16 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
2016-09-10 02:26:29 +00:00
|
|
|
* Handles the side toolbar toggle.
|
2016-09-08 22:34:16 +00:00
|
|
|
*/
|
2016-09-10 02:26:29 +00:00
|
|
|
_handleSideToolbarContainerToggled(containerId, isVisible) {
|
2016-09-08 22:34:16 +00:00
|
|
|
Object.keys(defaultToolbarButtons).forEach(
|
|
|
|
id => {
|
|
|
|
if (!UIUtil.isButtonEnabled(id))
|
|
|
|
return;
|
|
|
|
|
|
|
|
var button = defaultToolbarButtons[id];
|
|
|
|
|
|
|
|
if (button.sideContainerId
|
|
|
|
&& button.sideContainerId === containerId) {
|
|
|
|
UIUtil.buttonClick(button.id, "selected");
|
2016-09-11 21:54:32 +00:00
|
|
|
return;
|
2016-09-08 22:34:16 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
);
|
2016-09-11 21:54:32 +00:00
|
|
|
},
|
|
|
|
/**
|
|
|
|
* TODO: Fix mic popups
|
|
|
|
* <a class="button icon-microphone" id="toolbar_button_mute" data-container="body" data-toggle="popover" data-placement="bottom" shortcut="mutePopover" data-i18n="[content]toolbar.mute" content="Mute / Unmute">
|
|
|
|
* <ul id="micMutedPopup" class="loginmenu">
|
|
|
|
* <li data-i18n="[html]toolbar.micMutedPopup"></li>
|
|
|
|
* </ul>
|
|
|
|
* <ul id="unableToUnmutePopup" class="loginmenu">
|
|
|
|
* <li data-i18n="[html]toolbar.unableToUnmutePopup"></li>
|
|
|
|
* </ul>
|
|
|
|
* </a>
|
|
|
|
*/
|
|
|
|
_initMainToolbarButtons() {
|
|
|
|
interfaceConfig.MAIN_TOOLBAR_BUTTONS.forEach((value, index) => {
|
|
|
|
if (value && value in defaultToolbarButtons) {
|
|
|
|
let button = defaultToolbarButtons[value];
|
|
|
|
this._addMainToolbarButton(
|
|
|
|
button,
|
|
|
|
(index === 0),
|
|
|
|
(index === interfaceConfig.MAIN_TOOLBAR_BUTTONS.length -1));
|
|
|
|
}
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
2016-09-13 04:10:18 +00:00
|
|
|
/**
|
|
|
|
* Adds the given button to the main (top) toolbar.
|
|
|
|
*
|
|
|
|
* @param {Object} the button to add.
|
|
|
|
* @param {boolean} isFirst indicates if this is the first button in the
|
|
|
|
* toolbar
|
|
|
|
* @param {boolean} isLast indicates if this is the last button in the
|
|
|
|
* toolbar
|
|
|
|
*/
|
2016-09-11 21:54:32 +00:00
|
|
|
_addMainToolbarButton(button, isFirst, isLast) {
|
|
|
|
let buttonElement = document.createElement("a");
|
|
|
|
if (button.className)
|
|
|
|
buttonElement.className = button.className
|
|
|
|
+ ((isFirst) ? " first" : "")
|
|
|
|
+ ((isLast) ? " last" : "");
|
|
|
|
|
|
|
|
buttonElement.id = button.id;
|
|
|
|
|
|
|
|
if (button.shortcutAttr)
|
|
|
|
buttonElement.setAttribute("shortcut", button.shortcutAttr);
|
|
|
|
|
|
|
|
if (button.content)
|
|
|
|
buttonElement.setAttribute("content", button.content);
|
|
|
|
|
|
|
|
if (button.i18n)
|
|
|
|
buttonElement.setAttribute("data-i18n", button.i18n);
|
|
|
|
|
|
|
|
buttonElement.setAttribute("data-container", "body");
|
|
|
|
buttonElement.setAttribute("data-toggle", "popover");
|
|
|
|
buttonElement.setAttribute("data-placement", "bottom");
|
2016-09-12 19:43:34 +00:00
|
|
|
this._addPopups(buttonElement, button.popups);
|
2016-09-11 21:54:32 +00:00
|
|
|
|
|
|
|
document.getElementById("mainToolbar")
|
|
|
|
.appendChild(buttonElement);
|
2016-09-12 19:43:34 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
_addPopups(buttonElement, popups = []) {
|
|
|
|
popups.forEach((popup) => {
|
|
|
|
let popupElement = document.createElement("ul");
|
|
|
|
popupElement.id = popup.id;
|
|
|
|
popupElement.className = popup.className;
|
|
|
|
let liElement = document.createElement("li");
|
|
|
|
liElement.setAttribute("data-i18n", popup.dataAttr);
|
|
|
|
popupElement.appendChild(liElement);
|
|
|
|
buttonElement.appendChild(popupElement);
|
|
|
|
});
|
2015-12-09 17:10:49 +00:00
|
|
|
}
|
|
|
|
};
|
2015-01-07 14:54:03 +00:00
|
|
|
|
2015-12-09 17:10:49 +00:00
|
|
|
export default Toolbar;
|