|
@@ -413,14 +413,14 @@ const Toolbar = {
|
413
|
413
|
);
|
414
|
414
|
|
415
|
415
|
APP.UI.addListener(UIEvents.SIDE_TOOLBAR_CONTAINER_TOGGLED,
|
416
|
|
- function(containerId, isVisible) {
|
|
416
|
+ (containerId, isVisible) => {
|
417
|
417
|
Toolbar._handleSideToolbarContainerToggled( containerId,
|
418
|
418
|
isVisible);
|
419
|
419
|
});
|
420
|
420
|
|
421
|
421
|
APP.UI.addListener(UIEvents.LOCAL_RAISE_HAND_CHANGED,
|
422
|
|
- function(isRaisedHand) {
|
423
|
|
- Toolbar._toggleRaiseHand(isRaisedHand);
|
|
422
|
+ (isRaisedHand) => {
|
|
423
|
+ this._setToggledState("toolbar_button_raisehand", isRaisedHand);
|
424
|
424
|
});
|
425
|
425
|
|
426
|
426
|
if(!APP.tokenData.isGuest) {
|
|
@@ -582,82 +582,97 @@ const Toolbar = {
|
582
|
582
|
* streaming is active.
|
583
|
583
|
*/
|
584
|
584
|
updateDesktopSharingButtonState () {
|
585
|
|
- let button = $("#toolbar_button_desktopsharing");
|
586
|
|
- if (APP.conference.isSharingScreen) {
|
587
|
|
- button.addClass("glow");
|
588
|
|
- } else {
|
589
|
|
- button.removeClass("glow");
|
590
|
|
- }
|
|
585
|
+ this._setToggledState( "toolbar_button_desktopsharing",
|
|
586
|
+ APP.conference.isSharingScreen);
|
591
|
587
|
},
|
592
|
588
|
|
593
|
589
|
/**
|
594
|
|
- * Toggles / untoggles the view for raised hand.
|
|
590
|
+ * Marks video icon as muted or not.
|
|
591
|
+ *
|
|
592
|
+ * @param {boolean} muted if icon should look like muted or not
|
595
|
593
|
*/
|
596
|
|
- _toggleRaiseHand(isRaisedHand) {
|
597
|
|
- $('#toolbar_button_raisehand').toggleClass("glow", isRaisedHand);
|
|
594
|
+ toggleVideoIcon (muted) {
|
|
595
|
+ $('#toolbar_button_camera').toggleClass("icon-camera-disabled", muted);
|
|
596
|
+
|
|
597
|
+ this._setToggledState("toolbar_button_camera", muted);
|
598
|
598
|
},
|
599
|
599
|
|
600
|
600
|
/**
|
601
|
|
- * Marks video icon as muted or not.
|
602
|
|
- * @param {boolean} muted if icon should look like muted or not
|
|
601
|
+ * Enables / disables audio toolbar button.
|
|
602
|
+ *
|
|
603
|
+ * @param {boolean} enabled indicates if the button should be enabled
|
|
604
|
+ * or disabled
|
603
|
605
|
*/
|
604
|
|
- markVideoIconAsMuted (muted) {
|
605
|
|
- $('#toolbar_button_camera').toggleClass("icon-camera-disabled", muted);
|
|
606
|
+ setVideoIconEnabled (enabled) {
|
|
607
|
+ this._setMediaIconEnabled(
|
|
608
|
+ '#toolbar_button_camera',
|
|
609
|
+ enabled,
|
|
610
|
+ /* data-i18n attribute value */
|
|
611
|
+ `[content]toolbar.${enabled ? 'videomute' : 'cameraDisabled'}`,
|
|
612
|
+ /* shortcut attribute value */
|
|
613
|
+ 'toggleVideoPopover');
|
|
614
|
+
|
|
615
|
+ enabled || this.toggleVideoIcon(!enabled);
|
606
|
616
|
},
|
607
|
617
|
|
608
|
618
|
/**
|
609
|
|
- * Marks video icon as disabled or not.
|
610
|
|
- * @param {boolean} disabled if icon should look like disabled or not
|
|
619
|
+ * Enables/disables the toolbar button associated with a specific media such
|
|
620
|
+ * as audio or video.
|
|
621
|
+ *
|
|
622
|
+ * @param {string} btn - The jQuery selector <tt>string</tt> which
|
|
623
|
+ * identifies the toolbar button to be enabled/disabled.
|
|
624
|
+ * @param {boolean} enabled - <tt>true</tt> to enable the specified
|
|
625
|
+ * <tt>btn</tt> or <tt>false</tt> to disable it.
|
|
626
|
+ * @param {string} dataI18n - The value to assign to the <tt>data-i18n</tt>
|
|
627
|
+ * attribute of the specified <tt>btn</tt>.
|
|
628
|
+ * @param {string} shortcut - The value, if any, to assign to the
|
|
629
|
+ * <tt>shortcut</tt> attribute of the specified <tt>btn</tt> if the toolbar
|
|
630
|
+ * button is enabled.
|
611
|
631
|
*/
|
612
|
|
- markVideoIconAsDisabled (disabled) {
|
613
|
|
- var $btn = $('#toolbar_button_camera');
|
|
632
|
+ _setMediaIconEnabled(btn, enabled, dataI18n, shortcut) {
|
|
633
|
+ const $btn = $(btn);
|
614
|
634
|
|
615
|
635
|
$btn
|
616
|
|
- .prop("disabled", disabled)
|
617
|
|
- .attr("data-i18n", disabled
|
618
|
|
- ? "[content]toolbar.cameraDisabled"
|
619
|
|
- : "[content]toolbar.videomute")
|
620
|
|
- .attr("shortcut", disabled ? "" : "toggleVideoPopover");
|
|
636
|
+ .prop('disabled', !enabled)
|
|
637
|
+ .attr('data-i18n', dataI18n)
|
|
638
|
+ .attr('shortcut', enabled && shortcut ? shortcut : '');
|
621
|
639
|
|
622
|
|
- disabled
|
623
|
|
- ? $btn.attr("disabled", "disabled")
|
624
|
|
- : $btn.removeAttr("disabled");
|
|
640
|
+ enabled
|
|
641
|
+ ? $btn.removeAttr('disabled')
|
|
642
|
+ : $btn.attr('disabled', 'disabled');
|
625
|
643
|
|
626
|
644
|
APP.translation.translateElement($btn);
|
627
|
|
-
|
628
|
|
- disabled && this.markVideoIconAsMuted(disabled);
|
629
|
645
|
},
|
630
|
646
|
|
631
|
647
|
/**
|
632
|
648
|
* Marks audio icon as muted or not.
|
|
649
|
+ *
|
633
|
650
|
* @param {boolean} muted if icon should look like muted or not
|
634
|
651
|
*/
|
635
|
|
- markAudioIconAsMuted (muted) {
|
636
|
|
- $('#toolbar_button_mute').toggleClass("icon-microphone",
|
637
|
|
- !muted).toggleClass("icon-mic-disabled", muted);
|
|
652
|
+ toggleAudioIcon(muted) {
|
|
653
|
+ $('#toolbar_button_mute')
|
|
654
|
+ .toggleClass("icon-microphone", !muted)
|
|
655
|
+ .toggleClass("icon-mic-disabled", muted);
|
|
656
|
+
|
|
657
|
+ this._setToggledState("toolbar_button_mute", muted);
|
638
|
658
|
},
|
639
|
659
|
|
640
|
660
|
/**
|
641
|
|
- * Marks audio icon as disabled or not.
|
642
|
|
- * @param {boolean} disabled if icon should look like disabled or not
|
|
661
|
+ * Enables / disables audio toolbar button.
|
|
662
|
+ *
|
|
663
|
+ * @param {boolean} enabled indicates if the button should be enabled
|
|
664
|
+ * or disabled
|
643
|
665
|
*/
|
644
|
|
- markAudioIconAsDisabled (disabled) {
|
645
|
|
- var $btn = $('#toolbar_button_mute');
|
646
|
|
-
|
647
|
|
- $btn
|
648
|
|
- .prop("disabled", disabled)
|
649
|
|
- .attr("data-i18n", disabled
|
650
|
|
- ? "[content]toolbar.micDisabled"
|
651
|
|
- : "[content]toolbar.mute")
|
652
|
|
- .attr("shortcut", disabled ? "" : "mutePopover");
|
653
|
|
-
|
654
|
|
- disabled
|
655
|
|
- ? $btn.attr("disabled", "disabled")
|
656
|
|
- : $btn.removeAttr("disabled");
|
657
|
|
-
|
658
|
|
- APP.translation.translateElement($btn);
|
|
666
|
+ setAudioIconEnabled (enabled) {
|
|
667
|
+ this._setMediaIconEnabled(
|
|
668
|
+ '#toolbar_button_mute',
|
|
669
|
+ enabled,
|
|
670
|
+ /* data-i18n attribute value */
|
|
671
|
+ `[content]toolbar.${enabled ? 'mute' : 'micDisabled'}`,
|
|
672
|
+ /* shortcut attribute value */
|
|
673
|
+ 'mutePopover');
|
659
|
674
|
|
660
|
|
- disabled && this.markAudioIconAsMuted(disabled);
|
|
675
|
+ enabled || this.toggleAudioIcon(!enabled);
|
661
|
676
|
},
|
662
|
677
|
|
663
|
678
|
/**
|
|
@@ -819,6 +834,17 @@ const Toolbar = {
|
819
|
834
|
popupElement.appendChild(liElement);
|
820
|
835
|
buttonElement.appendChild(popupElement);
|
821
|
836
|
});
|
|
837
|
+ },
|
|
838
|
+
|
|
839
|
+ /**
|
|
840
|
+ * Sets the toggled state of the given element depending on the isToggled
|
|
841
|
+ * parameter.
|
|
842
|
+ *
|
|
843
|
+ * @param elementId the element identifier
|
|
844
|
+ * @param isToggled indicates if the element should be toggled or untoggled
|
|
845
|
+ */
|
|
846
|
+ _setToggledState(elementId, isToggled) {
|
|
847
|
+ $("#" + elementId).toggleClass("toggled", isToggled);
|
822
|
848
|
}
|
823
|
849
|
};
|
824
|
850
|
|