Browse Source

Uses tooltip to show custom popups for mute mic button/shared video button.

master
damencho 7 years ago
parent
commit
a1b3c56de7

+ 2
- 1
conference.js View File

@@ -1229,7 +1229,8 @@ export default {
1229 1229
 
1230 1230
         room.on(ConferenceEvents.TALK_WHILE_MUTED, () => {
1231 1231
             APP.UI.showToolbar(6000);
1232
-            UIUtil.animateShowElement($("#talkWhileMutedPopup"), true, 5000);
1232
+
1233
+            APP.UI.showCustomToolbarPopup('#talkWhileMutedPopup', true, 5000);
1233 1234
         });
1234 1235
 
1235 1236
 /*

+ 1
- 0
css/_base.scss View File

@@ -122,6 +122,7 @@ form {
122 122
     z-index: $tooltipsZ;
123 123
     &-inner {
124 124
         background-color: $tooltipBg;
125
+        max-width: 350px;
125 126
     }
126 127
 
127 128
     &-arrow {

+ 5
- 45
css/_login_menu.scss View File

@@ -1,34 +1,10 @@
1 1
 /*Initialize*/
2
-ul.loginmenu {
3
-    font-family: $baseFontFamily;
4
-    line-height: normal;
5
-    display:none;
2
+div.loginmenu {
6 3
     position: absolute;
7 4
     margin: 0;
8 5
     padding: 5px;
9
-    padding-bottom: 7px;
10
-    top: 45px;
11
-    left: -5px;
12
-    background-color: rgba(0,0,0,0.9);
13
-    border: 1px solid rgba(256, 256, 256, 0.2);
14
-    border-radius:8px;
15
-}
16
-
17
-ul.loginmenu li {
18
-    list-style-type: none;
19
-    padding: 7px;
20
-    color: #fff;
21
-    font-size: 11pt;
22
-    cursor: default;
23
-    white-space: pre;
24
-}
25
-
26
-ul.loginmenu:after {
27
-    content: url('../images/dropdownPointer.png');
28
-    display: block;
29
-    position: absolute;
30
-    top: -7px;
31
-    left: 18px;
6
+    top: 40px;
7
+    left: 20px;
32 8
 }
33 9
 
34 10
 a.disabled {
@@ -36,23 +12,7 @@ a.disabled {
36 12
     pointer-events: none;
37 13
 }
38 14
 
39
-.loginmenuPadding {
40
-    width: 50px;
41
-    height: 30px;
42
-    position: absolute;
43
-    top: -30px;
44
-    left: 0px;
45
-}
46
-
47 15
 .loginmenu.extendedToolbarPopup {
48
-    left: 55px;
49
-    top: 0px;
50
-}
51
-
52
-ul.loginmenu.extendedToolbarPopup:after {
53
-    content: url('../images/leftDropdownPointer.png');
54
-    display: block;
55
-    position: absolute;
56
-    top: 18px;
57
-    left: -7px;
16
+    top: 20px;
17
+    left: 40px;
58 18
 }

BIN
images/dropdownPointer.png View File


BIN
images/leftDropdownPointer.png View File


+ 11
- 0
modules/UI/UI.js View File

@@ -712,6 +712,17 @@ UI.inputDisplayNameHandler = function (newDisplayName) {
712 712
     eventEmitter.emit(UIEvents.NICKNAME_CHANGED, newDisplayName);
713 713
 };
714 714
 
715
+/**
716
+ * Show custom popup/tooltip for a specified button.
717
+ * @param popupSelectorID the selector id of the popup to show
718
+ * @param show true or false/show or hide the popup
719
+ * @param timeout the time to show the popup
720
+ */
721
+UI.showCustomToolbarPopup = function (popupSelectorID, show, timeout) {
722
+    eventEmitter.emit(UIEvents.SHOW_CUSTOM_TOOLBAR_BUTTON_POPUP,
723
+        popupSelectorID, show, timeout);
724
+};
725
+
715 726
 /**
716 727
  * Return the type of the remote video.
717 728
  * @param jid the jid for the remote video

+ 2
- 2
modules/UI/shared_video/SharedVideo.js View File

@@ -541,7 +541,7 @@ export default class SharedVideoManager {
541 541
         if(show)
542 542
             this.showSharedVideoMutedPopup(false);
543 543
 
544
-        UIUtil.animateShowElement($("#micMutedPopup"), show, 5000);
544
+        APP.UI.showCustomToolbarPopup('#micMutedPopup', show, 5000);
545 545
     }
546 546
 
547 547
     /**
@@ -554,7 +554,7 @@ export default class SharedVideoManager {
554 554
         if(show)
555 555
             this.showMicMutedPopup(false);
556 556
 
557
-        UIUtil.animateShowElement($("#sharedVideoMutedPopup"), show, 5000);
557
+        APP.UI.showCustomToolbarPopup('#sharedVideoMutedPopup', show, 5000);
558 558
     }
559 559
 }
560 560
 

+ 60
- 21
modules/UI/toolbars/Toolbar.js View File

@@ -1,4 +1,4 @@
1
-/* global APP, $, config, interfaceConfig, JitsiMeetJS */
1
+/* global AJS, APP, $, config, interfaceConfig, JitsiMeetJS */
2 2
 import UIUtil from '../util/UIUtil';
3 3
 import UIEvents from '../../../service/UI/UIEvents';
4 4
 import SideContainerToggler from "../side_pannels/SideContainerToggler";
@@ -26,8 +26,8 @@ const buttonHandlers = {
26 26
             if (sharedVideoManager
27 27
                 && sharedVideoManager.isSharedVideoVolumeOn()
28 28
                 && !sharedVideoManager.isSharedVideoOwner()) {
29
-                UIUtil.animateShowElement(
30
-                    $("#unableToUnmutePopup"), true, 5000);
29
+                APP.UI.showCustomToolbarPopup(
30
+                    '#unableToUnmutePopup', true, 5000);
31 31
             }
32 32
             else {
33 33
                 JitsiMeetJS.analytics.sendEvent('toolbar.audio.unmuted');
@@ -120,19 +120,19 @@ const defaultToolbarButtons = {
120 120
         shortcutDescription: "keyboardShortcuts.mute",
121 121
         popups: [
122 122
             {
123
-                id: "micMutedPopup",
124
-                className: "loginmenu",
125
-                dataAttr: "[html]toolbar.micMutedPopup"
123
+                id: 'micMutedPopup',
124
+                className: 'loginmenu',
125
+                dataAttr: '[title]toolbar.micMutedPopup'
126 126
             },
127 127
             {
128
-                id: "unableToUnmutePopup",
129
-                className: "loginmenu",
130
-                dataAttr: "[html]toolbar.unableToUnmutePopup"
128
+                id: 'unableToUnmutePopup',
129
+                className: 'loginmenu',
130
+                dataAttr: '[title]toolbar.unableToUnmutePopup'
131 131
             },
132 132
             {
133
-                id: "talkWhileMutedPopup",
134
-                className: "loginmenu",
135
-                dataAttr: "[html]toolbar.talkWhileMutedPopup"
133
+                id: 'talkWhileMutedPopup',
134
+                className: 'loginmenu',
135
+                dataAttr: '[title]toolbar.talkWhileMutedPopup'
136 136
             }
137 137
         ],
138 138
         content: "Mute / Unmute",
@@ -263,11 +263,14 @@ const defaultToolbarButtons = {
263 263
         id: 'toolbar_button_sharedvideo',
264 264
         tooltipKey: 'toolbar.sharedvideo',
265 265
         className: 'button icon-shared-video',
266
-        html: `<ul id="sharedVideoMutedPopup" 
267
-                   class="loginmenu extendedToolbarPopup">
268
-                   <li data-i18n="[html]toolbar.sharedVideoMutedPopup"></li>
269
-               </ul>
270
-`
266
+        popups: [
267
+            {
268
+                id: 'sharedVideoMutedPopup',
269
+                className: 'loginmenu extendedToolbarPopup',
270
+                dataAttr: '[title]toolbar.sharedVideoMutedPopup',
271
+                dataAttrPosition: 'w'
272
+            }
273
+        ]
271 274
     },
272 275
     'sip': {
273 276
         id: 'toolbar_button_sip',
@@ -358,6 +361,12 @@ Toolbar = {
358 361
                 Toolbar._handleFullScreenToggled(isFullScreen);
359 362
             });
360 363
 
364
+        APP.UI.addListener(UIEvents.SHOW_CUSTOM_TOOLBAR_BUTTON_POPUP,
365
+            (toolbarButtonID, popupID, show, timeout) => {
366
+                Toolbar._showCustomToolbarPopup(
367
+                    toolbarButtonID, popupID, show, timeout);
368
+            });
369
+
361 370
         if(!APP.tokenData.isGuest) {
362 371
             $("#toolbar_button_profile").addClass("unclickable");
363 372
             UIUtil.removeTooltip(
@@ -724,17 +733,47 @@ Toolbar = {
724 733
 
725 734
     _addPopups(buttonElement, popups = []) {
726 735
         popups.forEach((popup) => {
727
-            let popupElement = document.createElement("ul");
736
+            const popupElement = document.createElement('div');
728 737
             popupElement.id = popup.id;
729 738
             popupElement.className = popup.className;
730
-            let liElement = document.createElement("li");
731
-            liElement.setAttribute("data-i18n", popup.dataAttr);
732
-            popupElement.appendChild(liElement);
739
+            popupElement.setAttribute('data-i18n', popup.dataAttr);
740
+
741
+            let gravity = 'n';
742
+            if (popup.dataAttrPosition)
743
+                gravity = popup.dataAttrPosition;
744
+            popupElement.setAttribute('data-tooltip', gravity);
745
+
733 746
             buttonElement.appendChild(popupElement);
734 747
         });
735 748
     },
736 749
 
737 750
     /**
751
+     * Show custom popup/tooltip for a specified button.
752
+     * @param popupSelectorID the selector id of the popup to show
753
+     * @param show true or false/show or hide the popup
754
+     * @param timeout the time to show the popup
755
+     */
756
+    _showCustomToolbarPopup(popupSelectorID, show, timeout) {
757
+
758
+        const gravity = $(popupSelectorID).attr('data-tooltip');
759
+        AJS.$(popupSelectorID)
760
+            .tooltip({
761
+                trigger: 'manual',
762
+                html: true,
763
+                gravity: gravity,
764
+                title: 'title'});
765
+        if (show) {
766
+            AJS.$(popupSelectorID).tooltip('show');
767
+            setTimeout(function () {
768
+                // hide the tooltip
769
+                AJS.$(popupSelectorID).tooltip('hide');
770
+            }, timeout);
771
+        } else {
772
+            AJS.$(popupSelectorID).tooltip('hide');
773
+        }
774
+    },
775
+
776
+/**
738 777
      * Sets the toggled state of the given element depending on the isToggled
739 778
      * parameter.
740 779
      *

+ 6
- 1
service/UI/UIEvents.js View File

@@ -153,5 +153,10 @@ export default {
153 153
     /**
154 154
      * Indicates that a password is required for the call.
155 155
      */
156
-    PASSWORD_REQUIRED: "UI.password_required"
156
+    PASSWORD_REQUIRED: "UI.password_required",
157
+
158
+    /**
159
+     * Show custom popup/tooltip for a specified button.
160
+     */
161
+    SHOW_CUSTOM_TOOLBAR_BUTTON_POPUP: "UI.show_custom_toolbar_button_popup"
157 162
 };

Loading…
Cancel
Save