|
@@ -6,6 +6,11 @@ import SideContainerToggler from "../side_pannels/SideContainerToggler";
|
6
|
6
|
let emitter = null;
|
7
|
7
|
let Toolbar;
|
8
|
8
|
|
|
9
|
+/**
|
|
10
|
+ * Handlers for toolbar buttons.
|
|
11
|
+ *
|
|
12
|
+ * buttonId {string}: handler {function}
|
|
13
|
+ */
|
9
|
14
|
const buttonHandlers = {
|
10
|
15
|
"toolbar_button_profile": function () {
|
11
|
16
|
JitsiMeetJS.analytics.sendEvent('toolbar.profile.toggled');
|
|
@@ -124,6 +129,9 @@ const buttonHandlers = {
|
124
|
129
|
}
|
125
|
130
|
};
|
126
|
131
|
|
|
132
|
+/**
|
|
133
|
+ * All toolbars buttons description
|
|
134
|
+ */
|
127
|
135
|
const defaultToolbarButtons = {
|
128
|
136
|
'microphone': {
|
129
|
137
|
id: 'toolbar_button_mute',
|
|
@@ -194,6 +202,7 @@ const defaultToolbarButtons = {
|
194
|
202
|
'chat': {
|
195
|
203
|
id: 'toolbar_button_chat',
|
196
|
204
|
tooltipKey: 'toolbar.chat',
|
|
205
|
+ className: 'button icon-chat',
|
197
|
206
|
shortcut: 'C',
|
198
|
207
|
shortcutAttr: 'toggleChatPopover',
|
199
|
208
|
shortcutFunc: function() {
|
|
@@ -201,21 +210,28 @@ const defaultToolbarButtons = {
|
201
|
210
|
APP.UI.toggleChat();
|
202
|
211
|
},
|
203
|
212
|
shortcutDescription: 'keyboardShortcuts.toggleChat',
|
204
|
|
- sideContainerId: 'chat_container'
|
|
213
|
+ sideContainerId: 'chat_container',
|
|
214
|
+ html: `<span class="badge-round">
|
|
215
|
+ <span id="unreadMessages"></span>
|
|
216
|
+ </span>`
|
205
|
217
|
},
|
206
|
218
|
'contacts': {
|
207
|
219
|
id: 'toolbar_contact_list',
|
208
|
220
|
tooltipKey: 'bottomtoolbar.contactlist',
|
|
221
|
+ className: 'button icon-contactList',
|
209
|
222
|
sideContainerId: 'contacts_container'
|
210
|
223
|
},
|
211
|
224
|
'profile': {
|
212
|
225
|
id: 'toolbar_button_profile',
|
213
|
226
|
tooltipKey: 'profile.setDisplayNameLabel',
|
214
|
|
- sideContainerId: 'profile_container'
|
|
227
|
+ className: 'button',
|
|
228
|
+ sideContainerId: 'profile_container',
|
|
229
|
+ html: `<img id="avatar" src="images/avatar2.png"/>`
|
215
|
230
|
},
|
216
|
231
|
'etherpad': {
|
217
|
232
|
id: 'toolbar_button_etherpad',
|
218
|
233
|
tooltipKey: 'toolbar.etherpad',
|
|
234
|
+ className: 'button icon-share-doc'
|
219
|
235
|
},
|
220
|
236
|
'fullscreen': {
|
221
|
237
|
id: 'toolbar_button_fullScreen',
|
|
@@ -234,6 +250,7 @@ const defaultToolbarButtons = {
|
234
|
250
|
'settings': {
|
235
|
251
|
id: 'toolbar_button_settings',
|
236
|
252
|
tooltipKey: 'toolbar.Settings',
|
|
253
|
+ className: 'button icon-settings',
|
237
|
254
|
sideContainerId: "settings_container"
|
238
|
255
|
},
|
239
|
256
|
'hangup': {
|
|
@@ -246,6 +263,7 @@ const defaultToolbarButtons = {
|
246
|
263
|
'filmstrip': {
|
247
|
264
|
id: 'toolbar_film_strip',
|
248
|
265
|
tooltipKey: 'toolbar.filmstrip',
|
|
266
|
+ className: "button icon-toggle-filmstrip",
|
249
|
267
|
shortcut: "F",
|
250
|
268
|
shortcutAttr: "filmstripPopover",
|
251
|
269
|
shortcutFunc: function() {
|
|
@@ -267,6 +285,29 @@ const defaultToolbarButtons = {
|
267
|
285
|
shortcutDescription: "keyboardShortcuts.raiseHand",
|
268
|
286
|
content: "Raise Hand",
|
269
|
287
|
i18n: "[content]toolbar.raiseHand"
|
|
288
|
+ },
|
|
289
|
+ //init and btn handler: Recording.initRecordingButton (Recording.js)
|
|
290
|
+ 'recording': {
|
|
291
|
+ id: 'toolbar_button_record',
|
|
292
|
+ tooltipKey: 'liveStreaming.buttonTooltip',
|
|
293
|
+ className: 'button'
|
|
294
|
+ },
|
|
295
|
+ 'sharedvideo': {
|
|
296
|
+ id: 'toolbar_button_sharedvideo',
|
|
297
|
+ tooltipKey: 'toolbar.sharedvideo',
|
|
298
|
+ className: 'button icon-shared-video'
|
|
299
|
+ },
|
|
300
|
+ 'sip': {
|
|
301
|
+ id: 'toolbar_button_sip',
|
|
302
|
+ tooltipKey: 'toolbar.sip',
|
|
303
|
+ className: 'button icon-telephone'
|
|
304
|
+ },
|
|
305
|
+ 'dialpad': {
|
|
306
|
+ id: 'toolbar_button_dialpad',
|
|
307
|
+ tooltipKey: 'toolbar.dialpad',
|
|
308
|
+ className: 'button icon-dialpad',
|
|
309
|
+ //TODO: remove it after UI.updateDTMFSupport fix
|
|
310
|
+ hidden: true
|
270
|
311
|
}
|
271
|
312
|
};
|
272
|
313
|
|
|
@@ -281,8 +322,7 @@ function showSipNumberInput () {
|
281
|
322
|
let titleKey = "dialog.sipMsg";
|
282
|
323
|
let msgString = (`
|
283
|
324
|
<input name="sipNumber" type="text"
|
284
|
|
- value="${defaultNumber}" autofocus>
|
285
|
|
- `);
|
|
325
|
+ value="${defaultNumber}" autofocus>`);
|
286
|
326
|
|
287
|
327
|
APP.UI.messageHandler.openTwoButtonDialog({
|
288
|
328
|
titleKey,
|
|
@@ -297,6 +337,19 @@ function showSipNumberInput () {
|
297
|
337
|
});
|
298
|
338
|
}
|
299
|
339
|
|
|
340
|
+/**
|
|
341
|
+ * Get place for toolbar button.
|
|
342
|
+ * Now it can be in main toolbar or in extended (left) toolbar
|
|
343
|
+ *
|
|
344
|
+ * @param btn {string}
|
|
345
|
+ * @returns {string}
|
|
346
|
+ */
|
|
347
|
+function getToolbarButtonPlace (btn) {
|
|
348
|
+ return interfaceConfig.MAIN_TOOLBAR_BUTTONS.includes(btn) ?
|
|
349
|
+ 'main' :
|
|
350
|
+ 'extended';
|
|
351
|
+}
|
|
352
|
+
|
300
|
353
|
Toolbar = {
|
301
|
354
|
init (eventEmitter) {
|
302
|
355
|
emitter = eventEmitter;
|
|
@@ -305,45 +358,14 @@ Toolbar = {
|
305
|
358
|
this.toolbarSelector = $("#mainToolbarContainer");
|
306
|
359
|
this.extendedToolbarSelector = $("#extendedToolbar");
|
307
|
360
|
|
308
|
|
- // First hide all disabled buttons in the extended toolbar.
|
309
|
|
- // TODO: Make the extended toolbar dynamically created.
|
310
|
|
- UIUtil.hideDisabledButtons(defaultToolbarButtons);
|
|
361
|
+ // Initialise the toolbar buttons.
|
|
362
|
+ // The main toolbar will only take into account
|
|
363
|
+ // it's own configuration from interface_config.
|
|
364
|
+ this._initToolbarButtons();
|
311
|
365
|
|
312
|
|
- // Initialise the main toolbar. The main toolbar will only take into
|
313
|
|
- // account it's own configuration from interface_config.
|
314
|
|
- this._initMainToolbarButtons();
|
315
|
|
-
|
316
|
|
- Object.keys(defaultToolbarButtons).forEach(
|
317
|
|
- id => {
|
318
|
|
- if (UIUtil.isButtonEnabled(id)) {
|
319
|
|
- let button = defaultToolbarButtons[id];
|
320
|
|
- let buttonElement = document.getElementById(button.id);
|
321
|
|
-
|
322
|
|
- let tooltipPosition
|
323
|
|
- = (interfaceConfig.MAIN_TOOLBAR_BUTTONS
|
324
|
|
- .indexOf(id) > -1)
|
325
|
|
- ? "bottom" : "right";
|
326
|
|
-
|
327
|
|
- UIUtil.setTooltip( buttonElement,
|
328
|
|
- button.tooltipKey,
|
329
|
|
- tooltipPosition);
|
330
|
|
-
|
331
|
|
- if (button.shortcut)
|
332
|
|
- APP.keyboardshortcut.registerShortcut(
|
333
|
|
- button.shortcut,
|
334
|
|
- button.shortcutAttr,
|
335
|
|
- button.shortcutFunc,
|
336
|
|
- button.shortcutDescription
|
337
|
|
- );
|
338
|
|
- }
|
339
|
|
- }
|
340
|
|
- );
|
|
366
|
+ this._setShortcutsAndTooltips();
|
341
|
367
|
|
342
|
|
- Object.keys(buttonHandlers).forEach(
|
343
|
|
- buttonId => $(`#${buttonId}`).click(function(event) {
|
344
|
|
- !$(this).prop('disabled') && buttonHandlers[buttonId](event);
|
345
|
|
- })
|
346
|
|
- );
|
|
368
|
+ this._setButtonHandlers();
|
347
|
369
|
|
348
|
370
|
APP.UI.addListener(UIEvents.SIDE_TOOLBAR_CONTAINER_TOGGLED,
|
349
|
371
|
(containerId, isVisible) => {
|
|
@@ -703,16 +725,17 @@ Toolbar = {
|
703
|
725
|
},
|
704
|
726
|
|
705
|
727
|
/**
|
706
|
|
- * Initialise main toolbar buttons.
|
|
728
|
+ * Initialise toolbar buttons.
|
707
|
729
|
*/
|
708
|
|
- _initMainToolbarButtons() {
|
709
|
|
- interfaceConfig.MAIN_TOOLBAR_BUTTONS.forEach((value, index) => {
|
|
730
|
+ _initToolbarButtons() {
|
|
731
|
+ interfaceConfig.TOOLBAR_BUTTONS.forEach((value, index) => {
|
|
732
|
+ let place = getToolbarButtonPlace(value);
|
|
733
|
+
|
710
|
734
|
if (value && value in defaultToolbarButtons) {
|
711
|
735
|
let button = defaultToolbarButtons[value];
|
712
|
|
- this._addMainToolbarButton(
|
|
736
|
+ this._addToolbarButton(
|
713
|
737
|
button,
|
714
|
|
- (index === 0),
|
715
|
|
- (index === interfaceConfig.MAIN_TOOLBAR_BUTTONS.length -1),
|
|
738
|
+ place,
|
716
|
739
|
(interfaceConfig.MAIN_TOOLBAR_SPLITTER_INDEX !== undefined
|
717
|
740
|
&& index
|
718
|
741
|
=== interfaceConfig.MAIN_TOOLBAR_SPLITTER_INDEX));
|
|
@@ -721,7 +744,7 @@ Toolbar = {
|
721
|
744
|
},
|
722
|
745
|
|
723
|
746
|
/**
|
724
|
|
- * Adds the given button to the main (top) toolbar.
|
|
747
|
+ * Adds the given button to the main (top) or extended (left) toolbar.
|
725
|
748
|
*
|
726
|
749
|
* @param {Object} the button to add.
|
727
|
750
|
* @param {boolean} isFirst indicates if this is the first button in the
|
|
@@ -731,16 +754,26 @@ Toolbar = {
|
731
|
754
|
* @param {boolean} isSplitter if this button is a splitter button for
|
732
|
755
|
* the dialog, which means that a special splitter style will be applied
|
733
|
756
|
*/
|
734
|
|
- _addMainToolbarButton(button, isFirst, isLast, isSplitter) {
|
|
757
|
+ _addToolbarButton(button, place, isSplitter) {
|
|
758
|
+ const places = {
|
|
759
|
+ main: 'mainToolbar',
|
|
760
|
+ extended: 'extendedToolbarButtons'
|
|
761
|
+ };
|
|
762
|
+ let id = places[place];
|
735
|
763
|
let buttonElement = document.createElement("a");
|
736
|
764
|
if (button.className)
|
737
|
765
|
buttonElement.className = button.className
|
738
|
|
- + ((isFirst) ? " first" : "")
|
739
|
|
- + ((isLast) ? " last" : "")
|
740
|
|
- + ((isSplitter) ? " splitter": "");
|
|
766
|
+ + ((isSplitter) ? " splitter": "");
|
741
|
767
|
|
742
|
768
|
buttonElement.id = button.id;
|
743
|
769
|
|
|
770
|
+ if (button.html)
|
|
771
|
+ buttonElement.innerHTML = button.html;
|
|
772
|
+
|
|
773
|
+ //TODO: remove it after UI.updateDTMFSupport fix
|
|
774
|
+ if (button.hidden)
|
|
775
|
+ buttonElement.style.display = 'none';
|
|
776
|
+
|
744
|
777
|
if (button.shortcutAttr)
|
745
|
778
|
buttonElement.setAttribute("shortcut", button.shortcutAttr);
|
746
|
779
|
|
|
@@ -754,7 +787,7 @@ Toolbar = {
|
754
|
787
|
buttonElement.setAttribute("data-placement", "bottom");
|
755
|
788
|
this._addPopups(buttonElement, button.popups);
|
756
|
789
|
|
757
|
|
- document.getElementById("mainToolbar")
|
|
790
|
+ document.getElementById(id)
|
758
|
791
|
.appendChild(buttonElement);
|
759
|
792
|
},
|
760
|
793
|
|
|
@@ -779,6 +812,52 @@ Toolbar = {
|
779
|
812
|
*/
|
780
|
813
|
_setToggledState(elementId, isToggled) {
|
781
|
814
|
$("#" + elementId).toggleClass("toggled", isToggled);
|
|
815
|
+ },
|
|
816
|
+
|
|
817
|
+ /**
|
|
818
|
+ * Sets Shortcuts and Tooltips for all toolbar buttons
|
|
819
|
+ *
|
|
820
|
+ * @private
|
|
821
|
+ */
|
|
822
|
+ _setShortcutsAndTooltips() {
|
|
823
|
+ Object.keys(defaultToolbarButtons).forEach(
|
|
824
|
+ id => {
|
|
825
|
+ if (UIUtil.isButtonEnabled(id)) {
|
|
826
|
+ let button = defaultToolbarButtons[id];
|
|
827
|
+ let buttonElement = document.getElementById(button.id);
|
|
828
|
+ if (!buttonElement) return false;
|
|
829
|
+ let tooltipPosition
|
|
830
|
+ = (interfaceConfig.MAIN_TOOLBAR_BUTTONS
|
|
831
|
+ .indexOf(id) > -1)
|
|
832
|
+ ? "bottom" : "right";
|
|
833
|
+
|
|
834
|
+ UIUtil.setTooltip( buttonElement,
|
|
835
|
+ button.tooltipKey,
|
|
836
|
+ tooltipPosition);
|
|
837
|
+
|
|
838
|
+ if (button.shortcut)
|
|
839
|
+ APP.keyboardshortcut.registerShortcut(
|
|
840
|
+ button.shortcut,
|
|
841
|
+ button.shortcutAttr,
|
|
842
|
+ button.shortcutFunc,
|
|
843
|
+ button.shortcutDescription
|
|
844
|
+ );
|
|
845
|
+ }
|
|
846
|
+ }
|
|
847
|
+ );
|
|
848
|
+ },
|
|
849
|
+
|
|
850
|
+ /**
|
|
851
|
+ * Sets Handlers for all toolbar buttons
|
|
852
|
+ *
|
|
853
|
+ * @private
|
|
854
|
+ */
|
|
855
|
+ _setButtonHandlers() {
|
|
856
|
+ Object.keys(buttonHandlers).forEach(
|
|
857
|
+ buttonId => $(`#${buttonId}`).click(function(event) {
|
|
858
|
+ !$(this).prop('disabled') && buttonHandlers[buttonId](event);
|
|
859
|
+ })
|
|
860
|
+ );
|
782
|
861
|
}
|
783
|
862
|
};
|
784
|
863
|
|