Просмотр исходного кода

Merge pull request #1167 from jitsi/fix_anonymous_domain

Fix the UI when anonymous domain auth is in use
j8
yanas 8 лет назад
Родитель
Сommit
e56f1a9ded

+ 6
- 3
conference.js Просмотреть файл

294
 }
294
 }
295
 
295
 
296
 class ConferenceConnector {
296
 class ConferenceConnector {
297
-    constructor(resolve, reject) {
297
+    constructor(resolve, reject, invite) {
298
         this._resolve = resolve;
298
         this._resolve = resolve;
299
         this._reject = reject;
299
         this._reject = reject;
300
+        this._invite = invite;
300
         this.reconnectTimeout = null;
301
         this.reconnectTimeout = null;
301
         room.on(ConferenceEvents.CONFERENCE_JOINED,
302
         room.on(ConferenceEvents.CONFERENCE_JOINED,
302
             this._handleConferenceJoined.bind(this));
303
             this._handleConferenceJoined.bind(this));
340
             }, 5000);
341
             }, 5000);
341
 
342
 
342
             // notify user that auth is required
343
             // notify user that auth is required
343
-            AuthHandler.requireAuth(room, this.invite.getRoomLocker().password);
344
+            AuthHandler.requireAuth(
345
+                room, this._invite.getRoomLocker().password);
344
             break;
346
             break;
345
 
347
 
346
         case ConferenceErrors.RESERVATION_ERROR:
348
         case ConferenceErrors.RESERVATION_ERROR:
521
                 // XXX The API will take care of disconnecting from the XMPP
523
                 // XXX The API will take care of disconnecting from the XMPP
522
                 // server (and, thus, leaving the room) on unload.
524
                 // server (and, thus, leaving the room) on unload.
523
                 return new Promise((resolve, reject) => {
525
                 return new Promise((resolve, reject) => {
524
-                    (new ConferenceConnector(resolve, reject)).connect();
526
+                    (new ConferenceConnector(
527
+                        resolve, reject, this.invite)).connect();
525
                 });
528
                 });
526
         });
529
         });
527
     },
530
     },

+ 6
- 6
modules/UI/UI.js Просмотреть файл

443
         // Display notice message at the top of the toolbar
443
         // Display notice message at the top of the toolbar
444
         if (config.noticeMessage) {
444
         if (config.noticeMessage) {
445
             $('#noticeText').text(config.noticeMessage);
445
             $('#noticeText').text(config.noticeMessage);
446
-            UIUtil.showElement('notice');
446
+            UIUtil.setVisible('notice', true);
447
         }
447
         }
448
     } else {
448
     } else {
449
-        UIUtil.hideElement('mainToolbarContainer');
449
+        UIUtil.setVisible('mainToolbarContainer', false);
450
         FilmStrip.setupFilmStripOnly();
450
         FilmStrip.setupFilmStripOnly();
451
         messageHandler.enableNotifications(false);
451
         messageHandler.enableNotifications(false);
452
         JitsiPopover.enabled = false;
452
         JitsiPopover.enabled = false;
1105
     let showAuth = isAuthEnabled && UIUtil.isAuthenticationEnabled();
1105
     let showAuth = isAuthEnabled && UIUtil.isAuthenticationEnabled();
1106
     let loggedIn = !!login;
1106
     let loggedIn = !!login;
1107
 
1107
 
1108
-    Toolbar.showAuthenticateButton(showAuth);
1108
+    Profile.showAuthenticationButtons(showAuth);
1109
 
1109
 
1110
     if (showAuth) {
1110
     if (showAuth) {
1111
-        Toolbar.setAuthenticatedIdentity(login);
1111
+        Profile.setAuthenticatedIdentity(login);
1112
 
1112
 
1113
-        Toolbar.showLoginButton(!loggedIn);
1114
-        Toolbar.showLogoutButton(loggedIn);
1113
+        Profile.showLoginButton(!loggedIn);
1114
+        Profile.showLogoutButton(loggedIn);
1115
     }
1115
     }
1116
 };
1116
 };
1117
 
1117
 

+ 3
- 10
modules/UI/recording/Recording.js Просмотреть файл

392
         let shouldShow = show && _isRecordingButtonEnabled();
392
         let shouldShow = show && _isRecordingButtonEnabled();
393
         let id = 'toolbar_button_record';
393
         let id = 'toolbar_button_record';
394
 
394
 
395
-        if (shouldShow) {
396
-            UIUtil.showElement(id);
397
-        } else {
398
-            UIUtil.hideElement(id);
399
-        }
395
+        UIUtil.setVisible(id, shouldShow);
400
     },
396
     },
401
 
397
 
402
     /**
398
     /**
480
 
476
 
481
         // Recording spinner
477
         // Recording spinner
482
         let spinnerId = 'recordingSpinner';
478
         let spinnerId = 'recordingSpinner';
483
-        if(recordingState === Status.RETRYING) {
484
-            UIUtil.showElement(spinnerId);
485
-        } else {
486
-            UIUtil.hideElement(spinnerId);
487
-        }
479
+        UIUtil.setVisible(
480
+            spinnerId, recordingState === Status.RETRYING);
488
     },
481
     },
489
     // checks whether recording is enabled and whether we have params
482
     // checks whether recording is enabled and whether we have params
490
     // to start automatically recording
483
     // to start automatically recording

+ 1
- 5
modules/UI/side_pannels/chat/Chat.js Просмотреть файл

306
      * @param subject the subject
306
      * @param subject the subject
307
      */
307
      */
308
     setSubject (subject) {
308
     setSubject (subject) {
309
-        let toggleFunction;
310
         if (subject) {
309
         if (subject) {
311
             subject = subject.trim();
310
             subject = subject.trim();
312
         }
311
         }
313
 
312
 
314
-        toggleFunction = subject ? UIUtil.showElement : UIUtil.hideElement;
315
-        toggleFunction = toggleFunction.bind(UIUtil);
316
-
317
         let subjectId = 'subject';
313
         let subjectId = 'subject';
318
         let html = linkify(UIUtil.escapeHtml(subject));
314
         let html = linkify(UIUtil.escapeHtml(subject));
319
         $(`#${subjectId}`).html(html);
315
         $(`#${subjectId}`).html(html);
320
-        toggleFunction(subjectId);
316
+        UIUtil.setVisible(subjectId, subject && subject.length > 0);
321
     },
317
     },
322
 
318
 
323
     /**
319
     /**

+ 74
- 5
modules/UI/side_pannels/profile/Profile.js Просмотреть файл

1
-/* global $ */
1
+/* global $, APP, JitsiMeetJS */
2
 import UIUtil from "../../util/UIUtil";
2
 import UIUtil from "../../util/UIUtil";
3
 import UIEvents from "../../../../service/UI/UIEvents";
3
 import UIEvents from "../../../../service/UI/UIEvents";
4
 import Settings from '../../../settings/Settings';
4
 import Settings from '../../../settings/Settings';
18
             <input id="setEmail" type="text" class="input-control" 
18
             <input id="setEmail" type="text" class="input-control" 
19
                 data-i18n="[placeholder]profile.setEmailInput">
19
                 data-i18n="[placeholder]profile.setEmailInput">
20
         </div>
20
         </div>
21
-        <div id="authenticationContainer" 
21
+        <div id="profile_auth_container" 
22
              class="sideToolbarBlock auth_container">
22
              class="sideToolbarBlock auth_container">
23
             <p data-i18n="toolbar.authenticate"></p>
23
             <p data-i18n="toolbar.authenticate"></p>
24
             <ul>
24
             <ul>
25
-                <li id="toolbar_auth_identity"></li>
26
-                <li id="toolbar_button_login">
25
+                <li id="profile_auth_identity"></li>
26
+                <li id="profile_button_login">
27
                     <a class="authButton" data-i18n="toolbar.login"></a>
27
                     <a class="authButton" data-i18n="toolbar.login"></a>
28
                 </li>
28
                 </li>
29
-                <li id="toolbar_button_logout">
29
+                <li id="profile_button_logout">
30
                     <a class="authButton" data-i18n="toolbar.logout"></a>
30
                     <a class="authButton" data-i18n="toolbar.logout"></a>
31
                 </li>
31
                 </li>
32
             </ul>
32
             </ul>
68
                     updateEmail();
68
                     updateEmail();
69
                 }
69
                 }
70
             }).focusout(updateEmail);
70
             }).focusout(updateEmail);
71
+
72
+        // LOGIN
73
+        function loginClicked () {
74
+            JitsiMeetJS.analytics.sendEvent('authenticate.login.clicked');
75
+            emitter.emit(UIEvents.AUTH_CLICKED);
76
+        }
77
+
78
+        $('#profile_button_login').click(loginClicked);
79
+
80
+        // LOGOUT
81
+        function logoutClicked () {
82
+            let titleKey = "dialog.logoutTitle";
83
+            let msgKey = "dialog.logoutQuestion";
84
+            JitsiMeetJS.analytics.sendEvent('authenticate.logout.clicked');
85
+            // Ask for confirmation
86
+            APP.UI.messageHandler.openTwoButtonDialog({
87
+                titleKey: titleKey,
88
+                msgKey: msgKey,
89
+                leftButtonKey: "dialog.Yes",
90
+                submitFunction: function (evt, yes) {
91
+                    if (yes) {
92
+                        emitter.emit(UIEvents.LOGOUT);
93
+                    }
94
+                }
95
+            });
96
+        }
97
+
98
+        $('#profile_button_logout').click(logoutClicked);
71
     },
99
     },
72
 
100
 
73
     /**
101
     /**
92
      */
120
      */
93
     changeAvatar (avatarUrl) {
121
     changeAvatar (avatarUrl) {
94
         $('#avatar').attr('src', avatarUrl);
122
         $('#avatar').attr('src', avatarUrl);
123
+    },
124
+
125
+    /**
126
+     * Shows or hides authentication related buttons
127
+     * @param {boolean} show <tt>true</tt> to show or <tt>false</tt> to hide
128
+     */
129
+    showAuthenticationButtons (show) {
130
+        let id = 'profile_auth_container';
131
+        UIUtil.setVisible(id, show);
132
+    },
133
+
134
+    /**
135
+     * Shows/hides login button.
136
+     * @param {boolean} show <tt>true</tt> to show or <tt>false</tt> to hide
137
+     */
138
+    showLoginButton (show) {
139
+        let id = 'profile_button_login';
140
+
141
+        UIUtil.setVisible(id, show);
142
+    },
143
+
144
+    /**
145
+     * Shows/hides logout button.
146
+     * @param {boolean} show <tt>true</tt> to show or <tt>false</tt> to hide
147
+     */
148
+    showLogoutButton (show) {
149
+        let id = 'profile_button_logout';
150
+
151
+        UIUtil.setVisible(id, show);
152
+    },
153
+
154
+    /**
155
+     * Displays user's authenticated identity name (login).
156
+     * @param {string} authIdentity identity name to be displayed.
157
+     */
158
+    setAuthenticatedIdentity (authIdentity) {
159
+        let id = 'profile_auth_identity';
160
+
161
+        UIUtil.setVisible(id, !!authIdentity);
162
+
163
+        $(`#${id}`).text(authIdentity ? authIdentity : '');
95
     }
164
     }
96
 };
165
 };

+ 11
- 13
modules/UI/side_pannels/settings/SettingsMenu.js Просмотреть файл

166
             APP.translation.addLanguageChangedListener(
166
             APP.translation.addLanguageChangedListener(
167
                 lng => selectInput[0].dataset.i18n = `languages:${lng}`);
167
                 lng => selectInput[0].dataset.i18n = `languages:${lng}`);
168
 
168
 
169
-            UIUtil.showElement(wrapperId);
169
+            UIUtil.setVisible(wrapperId, true);
170
         }
170
         }
171
         // DEVICES LIST
171
         // DEVICES LIST
172
         if (UIUtil.isSettingEnabled('devices')) {
172
         if (UIUtil.isSettingEnabled('devices')) {
181
                 });
181
                 });
182
             // Only show the subtitle if this isn't the only setting section.
182
             // Only show the subtitle if this isn't the only setting section.
183
             if (interfaceConfig.SETTINGS_SECTIONS.length > 1)
183
             if (interfaceConfig.SETTINGS_SECTIONS.length > 1)
184
-                UIUtil.showElement("deviceOptionsTitle");
184
+                UIUtil.setVisible("deviceOptionsTitle", true);
185
 
185
 
186
-            UIUtil.showElement(wrapperId);
186
+            UIUtil.setVisible(wrapperId, true);
187
         }
187
         }
188
         // MODERATOR
188
         // MODERATOR
189
         if (UIUtil.isSettingEnabled('moderator')) {
189
         if (UIUtil.isSettingEnabled('moderator')) {
208
                 emitter.emit(UIEvents.FOLLOW_ME_ENABLED, isFollowMeEnabled);
208
                 emitter.emit(UIEvents.FOLLOW_ME_ENABLED, isFollowMeEnabled);
209
             });
209
             });
210
 
210
 
211
-            UIUtil.showElement(wrapperId);
211
+            UIUtil.setVisible(wrapperId, true);
212
         }
212
         }
213
     },
213
     },
214
 
214
 
245
             // Only show the subtitle if this isn't the only setting section.
245
             // Only show the subtitle if this isn't the only setting section.
246
             if (!$("#moderatorOptionsTitle").is(":visible")
246
             if (!$("#moderatorOptionsTitle").is(":visible")
247
                     && interfaceConfig.SETTINGS_SECTIONS.length > 1)
247
                     && interfaceConfig.SETTINGS_SECTIONS.length > 1)
248
-                UIUtil.showElement("moderatorOptionsTitle");
248
+                UIUtil.setVisible("moderatorOptionsTitle", true);
249
 
249
 
250
-            UIUtil.showElement("startMutedOptions");
250
+            UIUtil.setVisible("startMutedOptions", true);
251
         } else {
251
         } else {
252
             // Only show the subtitle if this isn't the only setting section.
252
             // Only show the subtitle if this isn't the only setting section.
253
             if ($("#moderatorOptionsTitle").is(":visible"))
253
             if ($("#moderatorOptionsTitle").is(":visible"))
254
-                UIUtil.hideElement("moderatorOptionsTitle");
254
+                UIUtil.setVisible("moderatorOptionsTitle", false);
255
 
255
 
256
-            UIUtil.hideElement("startMutedOptions");
256
+            UIUtil.setVisible("startMutedOptions", false);
257
         }
257
         }
258
     },
258
     },
259
 
259
 
268
      * @param {boolean} show {true} to show those options, {false} to hide them
268
      * @param {boolean} show {true} to show those options, {false} to hide them
269
      */
269
      */
270
     showFollowMeOptions (show) {
270
     showFollowMeOptions (show) {
271
-        if (show && UIUtil.isSettingEnabled('moderator')) {
272
-            UIUtil.showElement("followMeOptions");
273
-        } else {
274
-            UIUtil.hideElement("followMeOptions");
275
-        }
271
+        UIUtil.setVisible(
272
+            "followMeOptions",
273
+            show && UIUtil.isSettingEnabled('moderator'));
276
     },
274
     },
277
 
275
 
278
     /**
276
     /**

+ 9
- 87
modules/UI/toolbars/Toolbar.js Просмотреть файл

97
         JitsiMeetJS.analytics.sendEvent('toolbar.hangup');
97
         JitsiMeetJS.analytics.sendEvent('toolbar.hangup');
98
         emitter.emit(UIEvents.HANGUP);
98
         emitter.emit(UIEvents.HANGUP);
99
     },
99
     },
100
-    "toolbar_button_login": function () {
101
-        JitsiMeetJS.analytics.sendEvent('toolbar.authenticate.login.clicked');
102
-        emitter.emit(UIEvents.AUTH_CLICKED);
103
-    },
104
-    "toolbar_button_logout": function () {
105
-        let titleKey = "dialog.logoutTitle";
106
-        let msgKey = "dialog.logoutQuestion";
107
-        JitsiMeetJS.analytics.sendEvent('toolbar.authenticate.logout.clicked');
108
-        // Ask for confirmation
109
-        APP.UI.messageHandler.openTwoButtonDialog({
110
-            titleKey,
111
-            msgKey,
112
-            leftButtonKey: "dialog.Yes",
113
-            submitFunction: function (evt, yes) {
114
-                if (yes) {
115
-                    emitter.emit(UIEvents.LOGOUT);
116
-                }
117
-            }
118
-        });
119
-    },
120
     "toolbar_button_raisehand": function () {
100
     "toolbar_button_raisehand": function () {
121
         JitsiMeetJS.analytics.sendEvent('toolbar.raiseHand.clicked');
101
         JitsiMeetJS.analytics.sendEvent('toolbar.raiseHand.clicked');
122
         APP.conference.maybeToggleRaisedHand();
102
         APP.conference.maybeToggleRaisedHand();
275
     'recording': {
255
     'recording': {
276
         id: 'toolbar_button_record',
256
         id: 'toolbar_button_record',
277
         tooltipKey: 'liveStreaming.buttonTooltip',
257
         tooltipKey: 'liveStreaming.buttonTooltip',
278
-        className: 'button'
258
+        className: 'button',
259
+        hidden: true // will be displayed once
260
+                     // the recording functionality is detected
279
     },
261
     },
280
     'sharedvideo': {
262
     'sharedvideo': {
281
         id: 'toolbar_button_sharedvideo',
263
         id: 'toolbar_button_sharedvideo',
290
     'sip': {
272
     'sip': {
291
         id: 'toolbar_button_sip',
273
         id: 'toolbar_button_sip',
292
         tooltipKey: 'toolbar.sip',
274
         tooltipKey: 'toolbar.sip',
293
-        className: 'button icon-telephone'
275
+        className: 'button icon-telephone',
276
+        hidden: true // will be displayed once
277
+                     // the SIP calls functionality is detected
294
     },
278
     },
295
     'dialpad': {
279
     'dialpad': {
296
         id: 'toolbar_button_dialpad',
280
         id: 'toolbar_button_dialpad',
397
     isEnabled() {
381
     isEnabled() {
398
         return this.enabled;
382
         return this.enabled;
399
     },
383
     },
400
-    /**
401
-     * Shows or hides authentication button
402
-     * @param show <tt>true</tt> to show or <tt>false</tt> to hide
403
-     */
404
-    showAuthenticateButton (show) {
405
-        let id = 'authenticationContainer';
406
-        if (show) {
407
-            UIUtil.showElement(id);
408
-        } else {
409
-            UIUtil.hideElement(id);
410
-        }
411
-    },
412
 
384
 
413
     showEtherpadButton () {
385
     showEtherpadButton () {
414
         if (!$('#toolbar_button_etherpad').is(":visible")) {
386
         if (!$('#toolbar_button_etherpad').is(":visible")) {
425
         if (shouldShow) {
397
         if (shouldShow) {
426
             let el = document.getElementById(id);
398
             let el = document.getElementById(id);
427
             UIUtil.setTooltip(el, 'toolbar.sharedvideo', 'right');
399
             UIUtil.setTooltip(el, 'toolbar.sharedvideo', 'right');
428
-            UIUtil.showElement(id);
429
-        } else {
430
-            UIUtil.hideElement(id);
431
         }
400
         }
401
+        UIUtil.setVisible(id, shouldShow);
432
     },
402
     },
433
 
403
 
434
     // checks whether desktop sharing is enabled and whether
404
     // checks whether desktop sharing is enabled and whether
446
             && UIUtil.isButtonEnabled('sip') && show;
416
             && UIUtil.isButtonEnabled('sip') && show;
447
         let id = 'toolbar_button_sip';
417
         let id = 'toolbar_button_sip';
448
 
418
 
449
-        if (shouldShow) {
450
-            UIUtil.showElement(id);
451
-        } else {
452
-            UIUtil.hideElement(id);
453
-        }
419
+        UIUtil.setVisible(id, shouldShow);
454
     },
420
     },
455
 
421
 
456
     // Shows or hides the dialpad button
422
     // Shows or hides the dialpad button
457
     showDialPadButton (show) {
423
     showDialPadButton (show) {
458
         let shouldShow = UIUtil.isButtonEnabled('dialpad') && show;
424
         let shouldShow = UIUtil.isButtonEnabled('dialpad') && show;
459
         let id = 'toolbar_button_dialpad';
425
         let id = 'toolbar_button_dialpad';
460
-        if (shouldShow) {
461
-            UIUtil.showElement(id);
462
-        } else {
463
-            UIUtil.hideElement(id);
464
-        }
465
-    },
466
 
426
 
467
-    /**
468
-     * Displays user authenticated identity name(login).
469
-     * @param authIdentity identity name to be displayed.
470
-     */
471
-    setAuthenticatedIdentity (authIdentity) {
472
-        let id = 'toolbar_auth_identity';
473
-        if(authIdentity) {
474
-            UIUtil.showElement(id);
475
-            $(`#${id}`).text(authIdentity);
476
-        } else {
477
-            UIUtil.hideElement(id);
478
-            $(`#${id}`).text('');
479
-        }
480
-    },
481
-
482
-    /**
483
-     * Shows/hides login button.
484
-     * @param show <tt>true</tt> to show
485
-     */
486
-    showLoginButton (show) {
487
-        let id = 'toolbar_button_login';
488
-        if (show) {
489
-            UIUtil.showElement(id);
490
-        } else {
491
-            UIUtil.hideElement(id);
492
-        }
493
-    },
494
-
495
-    /**
496
-     * Shows/hides logout button.
497
-     * @param show <tt>true</tt> to show
498
-     */
499
-    showLogoutButton (show) {
500
-        let id = 'toolbar_button_logout';
501
-        if (show) {
502
-            UIUtil.showElement(id);
503
-        } else {
504
-            UIUtil.hideElement(id);
505
-        }
427
+        UIUtil.setVisible(id, shouldShow);
506
     },
428
     },
507
 
429
 
508
     /**
430
     /**

+ 9
- 1
modules/UI/util/MessageHandler.js Просмотреть файл

290
             buttons: buttons,
290
             buttons: buttons,
291
             defaultButton: 1,
291
             defaultButton: 1,
292
             promptspeed: 0,
292
             promptspeed: 0,
293
-            loaded: loadedFunction,
293
+            loaded: function() {
294
+                if (loadedFunction) {
295
+                    loadedFunction.apply(this, arguments);
296
+                }
297
+                // Hide the close button
298
+                if (persistent) {
299
+                    $(".jqiclose", this).hide();
300
+                }
301
+            },
294
             submit: dontShowAgainSubmitFunctionWrapper(
302
             submit: dontShowAgainSubmitFunctionWrapper(
295
                 dontShowAgain, submitFunction),
303
                 dontShowAgain, submitFunction),
296
             close: closeFunction,
304
             close: closeFunction,

+ 16
- 33
modules/UI/util/UIUtil.js Просмотреть файл

240
     },
240
     },
241
 
241
 
242
     /**
242
     /**
243
-     * Shows the element given by id.
243
+     * Shows / hides the element given by id.
244
      *
244
      *
245
-     * @param {String} the identifier of the element to show
245
+     * @param {string|HTMLElement} idOrElement the identifier or the element
246
+     *        to show/hide
247
+     * @param {boolean} show <tt>true</tt> to show or <tt>false</tt> to hide
246
      */
248
      */
247
-    showElement(id) {
249
+    setVisible(id, visible) {
248
         let element;
250
         let element;
249
         if (id instanceof HTMLElement) {
251
         if (id instanceof HTMLElement) {
250
             element = id;
252
             element = id;
256
             return;
258
             return;
257
         }
259
         }
258
 
260
 
259
-        if(element.classList.contains('hide')) {
261
+        if (!visible)
262
+            element.classList.add('hide');
263
+        else if (element.classList.contains('hide')) {
260
             element.classList.remove('hide');
264
             element.classList.remove('hide');
261
         }
265
         }
262
 
266
 
263
         let type = this._getElementDefaultDisplay(element.tagName);
267
         let type = this._getElementDefaultDisplay(element.tagName);
264
         let className = SHOW_CLASSES[type];
268
         let className = SHOW_CLASSES[type];
265
-        element.classList.add(className);
266
-    },
267
 
269
 
268
-    /**
269
-     * Hides the element given by id.
270
-     *
271
-     * @param {String} the identifier of the element to hide
272
-     */
273
-    hideElement(id) {
274
-        let element;
275
-        if (id instanceof HTMLElement) {
276
-            element = id;
277
-        } else {
278
-            element = document.getElementById(id);
270
+        if (visible) {
271
+            element.classList.add(className);
279
         }
272
         }
280
-
281
-        if (!element) {
282
-            return;
283
-        }
284
-
285
-        let type = this._getElementDefaultDisplay(element.tagName);
286
-        let className = SHOW_CLASSES[type];
287
-
288
-        if(element.classList.contains(className)) {
273
+        else if (element.classList.contains(className))
289
             element.classList.remove(className);
274
             element.classList.remove(className);
290
-        }
291
-
292
-        element.classList.add('hide');
293
     },
275
     },
294
 
276
 
295
     /**
277
     /**
311
     /**
293
     /**
312
      * Shows / hides the element with the given jQuery selector.
294
      * Shows / hides the element with the given jQuery selector.
313
      *
295
      *
314
-     * @param {jQuery} selector the jQuery selector of the element to show/hide
296
+     * @param {jQuery} jquerySelector the jQuery selector of the element to
297
+     * show / shide
315
      * @param {boolean} isVisible
298
      * @param {boolean} isVisible
316
      */
299
      */
317
-    setVisibility(selector, isVisible) {
318
-        if (selector && selector.length > 0) {
319
-            selector.css("visibility", isVisible ? "visible" : "hidden");
300
+    setVisibleBySelector(jquerySelector, isVisible) {
301
+        if (jquerySelector && jquerySelector.length > 0) {
302
+            jquerySelector.css("visibility", isVisible ? "visible" : "hidden");
320
         }
303
         }
321
     },
304
     },
322
 
305
 

+ 3
- 3
modules/UI/videolayout/LargeVideoManager.js Просмотреть файл

333
         }
333
         }
334
 
334
 
335
         let id = 'localConnectionMessage';
335
         let id = 'localConnectionMessage';
336
+
337
+        UIUtil.setVisible(id, show);
338
+
336
         if (show) {
339
         if (show) {
337
-            UIUtil.showElement(id);
338
             // Avatar message conflicts with 'videoConnectionMessage',
340
             // Avatar message conflicts with 'videoConnectionMessage',
339
             // so it must be hidden
341
             // so it must be hidden
340
             this.showRemoteConnectionMessage(false);
342
             this.showRemoteConnectionMessage(false);
341
-        } else {
342
-            UIUtil.hideElement(id);
343
         }
343
         }
344
     }
344
     }
345
 
345
 

+ 16
- 30
modules/UI/videolayout/SmallVideo.js Просмотреть файл

215
  * @param {boolean} isMuted indicates if the muted element should be shown
215
  * @param {boolean} isMuted indicates if the muted element should be shown
216
  * or hidden
216
  * or hidden
217
  */
217
  */
218
-SmallVideo.prototype.showAudioIndicator = function(isMuted) {
218
+SmallVideo.prototype.showAudioIndicator = function (isMuted) {
219
     let mutedIndicator = this.getAudioMutedIndicator();
219
     let mutedIndicator = this.getAudioMutedIndicator();
220
-    if (isMuted) {
221
-        UIUtil.showElement(mutedIndicator);
222
-    } else {
223
-        UIUtil.hideElement(mutedIndicator);
224
-    }
220
+
221
+    UIUtil.setVisible(mutedIndicator, isMuted);
225
 
222
 
226
     this.isAudioMuted = isMuted;
223
     this.isAudioMuted = isMuted;
227
 };
224
 };
270
     this.updateView();
267
     this.updateView();
271
 
268
 
272
     let element = this.getVideoMutedIndicator();
269
     let element = this.getVideoMutedIndicator();
273
-    if (isMuted) {
274
-        UIUtil.showElement(element);
275
-    } else {
276
-        UIUtil.hideElement(element);
277
-    }
270
+
271
+    UIUtil.setVisible(element, isMuted);
278
 };
272
 };
279
 
273
 
280
 /**
274
 /**
511
     // Determine whether video, avatar or blackness should be displayed
505
     // Determine whether video, avatar or blackness should be displayed
512
     let displayMode = this.selectDisplayMode();
506
     let displayMode = this.selectDisplayMode();
513
     // Show/hide video.
507
     // Show/hide video.
514
-    UIUtil.setVisibility(   this.selectVideoElement(),
515
-                            (displayMode === DISPLAY_VIDEO
508
+    UIUtil.setVisibleBySelector(this.selectVideoElement(),
509
+                                (displayMode === DISPLAY_VIDEO
516
                                 || displayMode === DISPLAY_VIDEO_WITH_NAME));
510
                                 || displayMode === DISPLAY_VIDEO_WITH_NAME));
517
     // Show/hide the avatar.
511
     // Show/hide the avatar.
518
-    UIUtil.setVisibility(   this.$avatar(),
519
-                            (displayMode === DISPLAY_AVATAR
512
+    UIUtil.setVisibleBySelector(this.$avatar(),
513
+                                (displayMode === DISPLAY_AVATAR
520
                                 || displayMode === DISPLAY_AVATAR_WITH_NAME));
514
                                 || displayMode === DISPLAY_AVATAR_WITH_NAME));
521
     // Show/hide the display name.
515
     // Show/hide the display name.
522
-    UIUtil.setVisibility(   this.$displayName(),
523
-                            !this.hideDisplayName
524
-                            && (displayMode === DISPLAY_BLACKNESS_WITH_NAME
516
+    UIUtil.setVisibleBySelector(this.$displayName(),
517
+                                !this.hideDisplayName
518
+                                && (displayMode === DISPLAY_BLACKNESS_WITH_NAME
525
                                 || displayMode === DISPLAY_VIDEO_WITH_NAME
519
                                 || displayMode === DISPLAY_VIDEO_WITH_NAME
526
                                 || displayMode === DISPLAY_AVATAR_WITH_NAME));
520
                                 || displayMode === DISPLAY_AVATAR_WITH_NAME));
527
     // show hide overlay when there is a video or avatar under
521
     // show hide overlay when there is a video or avatar under
528
     // the display name
522
     // the display name
529
-    UIUtil.setVisibility(   $('#' + this.videoSpanId
523
+    UIUtil.setVisibleBySelector($('#' + this.videoSpanId
530
                                 + ' .videocontainer__hoverOverlay'),
524
                                 + ' .videocontainer__hoverOverlay'),
531
-                            (displayMode === DISPLAY_AVATAR_WITH_NAME
525
+                                (displayMode === DISPLAY_AVATAR_WITH_NAME
532
                                 || displayMode === DISPLAY_VIDEO_WITH_NAME));
526
                                 || displayMode === DISPLAY_VIDEO_WITH_NAME));
533
 };
527
 };
534
 
528
 
576
         tooltip: 'speaker'
570
         tooltip: 'speaker'
577
     });
571
     });
578
 
572
 
579
-    if (show) {
580
-        UIUtil.showElement(indicatorSpan);
581
-    } else {
582
-        UIUtil.hideElement(indicatorSpan);
583
-    }
573
+    UIUtil.setVisible(indicatorSpan, show);
584
 };
574
 };
585
 
575
 
586
 /**
576
 /**
604
         tooltip: 'raisedHand'
594
         tooltip: 'raisedHand'
605
     });
595
     });
606
 
596
 
607
-    if (show) {
608
-        UIUtil.showElement(indicatorSpan);
609
-    } else {
610
-        UIUtil.hideElement(indicatorSpan);
611
-    }
597
+    UIUtil.setVisible(indicatorSpan, show);
612
 };
598
 };
613
 
599
 
614
 /**
600
 /**

+ 1
- 5
modules/UI/videolayout/VideoLayout.js Просмотреть файл

1150
     updateResolutionLabel(isResolutionHD) {
1150
     updateResolutionLabel(isResolutionHD) {
1151
         let id = 'videoResolutionLabel';
1151
         let id = 'videoResolutionLabel';
1152
 
1152
 
1153
-        if (isResolutionHD) {
1154
-            UIUtil.showElement(id);
1155
-        } else {
1156
-            UIUtil.hideElement(id);
1157
-        }
1153
+        UIUtil.setVisible(id, isResolutionHD);
1158
     },
1154
     },
1159
 
1155
 
1160
     /**
1156
     /**

Загрузка…
Отмена
Сохранить