瀏覽代碼

Hide DOM elements using css class

j8
Maxim Voloshin 8 年之前
父節點
當前提交
68ab87cc0d

+ 1
- 1
modules/UI/UI.js 查看文件

@@ -446,7 +446,7 @@ UI.start = function () {
446 446
             $('#notice').css({display: 'block'});
447 447
         }
448 448
     } else {
449
-        $("#mainToolbarContainer").css("display", "none");
449
+        document.querySelector('#mainToolbarContainer').classList.add('hide');
450 450
         FilmStrip.setupFilmStripOnly();
451 451
         messageHandler.enableNotifications(false);
452 452
         JitsiPopover.enabled = false;

+ 2
- 7
modules/UI/feedback/Feedback.js 查看文件

@@ -7,7 +7,7 @@ import FeedbackWindow from "./FeedbackWindow";
7 7
  * @private
8 8
  */
9 9
 function _toggleFeedbackIcon() {
10
-    $('#feedbackButtonDiv').toggleClass("hidden");
10
+    document.querySelector('#feedbackButton').classList.toggle('hidden');
11 11
 }
12 12
 
13 13
 /**
@@ -17,12 +17,7 @@ function _toggleFeedbackIcon() {
17 17
  * @private
18 18
  */
19 19
 function _showFeedbackButton (show) {
20
-    var feedbackButton = $("#feedbackButtonDiv");
21
-
22
-    if (show)
23
-        feedbackButton.css("display", "block");
24
-    else
25
-        feedbackButton.css("display", "none");
20
+    document.querySelector('#feedbackButton').classList.toggle('hide', !show);
26 21
 }
27 22
 
28 23
 /**

+ 5
- 9
modules/UI/recording/Recording.js 查看文件

@@ -387,11 +387,9 @@ var Recording = {
387 387
      * @param show {true} to show the recording button, {false} to hide it
388 388
      */
389 389
     showRecordingButton (show) {
390
-        if (_isRecordingButtonEnabled() && show) {
391
-            $('#toolbar_button_record').css({display: "inline-block"});
392
-        } else {
393
-            $('#toolbar_button_record').css({display: "none"});
394
-        }
390
+        var visibility = show && _isRecordingButtonEnabled();
391
+        document.querySelector('#toolbar_button_record')
392
+                .classList.toggle('hide', !visibility);
395 393
     },
396 394
 
397 395
     /**
@@ -474,10 +472,8 @@ var Recording = {
474 472
             labelSelector.css({display: "inline-block"});
475 473
 
476 474
         // Recording spinner
477
-        if (recordingState === Status.RETRYING)
478
-            $("#recordingSpinner").show();
479
-        else
480
-            $("#recordingSpinner").hide();
475
+        document.querySelector('#recordingSpinner').classList
476
+                .toggle('show-inline', recordingState === Status.RETRYING);
481 477
     },
482 478
     // checks whether recording is enabled and whether we have params
483 479
     // to start automatically recording

+ 1
- 5
modules/UI/side_pannels/chat/Chat.js 查看文件

@@ -297,11 +297,7 @@ var Chat = {
297 297
             subject = subject.trim();
298 298
         }
299 299
         $('#subject').html(linkify(UIUtil.escapeHtml(subject)));
300
-        if (subject) {
301
-            $("#subject").css({display: "block"});
302
-        } else {
303
-            $("#subject").css({display: "none"});
304
-        }
300
+        document.querySelector('#subject').classList.toggle('hide', !subject);
305 301
     },
306 302
 
307 303
     /**

+ 21
- 37
modules/UI/toolbars/Toolbar.js 查看文件

@@ -417,9 +417,8 @@ Toolbar = {
417 417
      * @param show <tt>true</tt> to show or <tt>false</tt> to hide
418 418
      */
419 419
     showAuthenticateButton (show) {
420
-        let display = show ? 'block' : 'none';
421
-
422
-        $('#authenticationContainer').css({display});
420
+        document.querySelector('#authenticationContainer')
421
+                .classList.toggle('hide', !show);
423 422
     },
424 423
 
425 424
     showEtherpadButton () {
@@ -430,14 +429,12 @@ Toolbar = {
430 429
 
431 430
     // Shows or hides the 'shared video' button.
432 431
     showSharedVideoButton () {
433
-        let $element = $('#toolbar_button_sharedvideo');
434
-        if (UIUtil.isButtonEnabled('sharedvideo')
435
-                && config.disableThirdPartyRequests !== true) {
436
-            $element.css({display: "inline-block"});
437
-            UIUtil.setTooltip($element.get(0), 'toolbar.sharedvideo', 'right');
438
-        } else {
439
-            $('#toolbar_button_sharedvideo').css({display: "none"});
432
+        if (!UIUtil.isButtonEnabled('sharedvideo')) {
433
+            return;
440 434
         }
435
+        var el = document.querySelector('#toolbar_button_sharedvideo');
436
+        UIUtil.setTooltip(el, 'toolbar.sharedvideo', 'right');
437
+        el.classList.toggle('hide', config.disableThirdPartyRequests === true);
441 438
     },
442 439
 
443 440
     // checks whether desktop sharing is enabled and whether
@@ -451,21 +448,20 @@ Toolbar = {
451 448
 
452 449
     // Shows or hides SIP calls button
453 450
     showSipCallButton (show) {
454
-        if (APP.conference.sipGatewayEnabled()
455
-            && UIUtil.isButtonEnabled('sip') && show) {
456
-            $('#toolbar_button_sip').css({display: "inline-block"});
457
-        } else {
458
-            $('#toolbar_button_sip').css({display: "none"});
451
+        if (!UIUtil.isButtonEnabled('sip')) {
452
+            return;
459 453
         }
454
+        document.querySelector('#toolbar_button_sip').classList
455
+                .toggle('hide', !(show && APP.conference.sipGatewayEnabled()));
460 456
     },
461 457
 
462 458
     // Shows or hides the dialpad button
463 459
     showDialPadButton (show) {
464
-        if (UIUtil.isButtonEnabled('dialpad') && show) {
465
-            $('#toolbar_button_dialpad').css({display: "inline-block"});
466
-        } else {
467
-            $('#toolbar_button_dialpad').css({display: "none"});
460
+        if (!UIUtil.isButtonEnabled('dialpad')) {
461
+            return;
468 462
         }
463
+        document.querySelector('#toolbar_button_dialpad')
464
+                .classList.toggle('hide', !show);
469 465
     },
470 466
 
471 467
     /**
@@ -474,14 +470,8 @@ Toolbar = {
474 470
      */
475 471
     setAuthenticatedIdentity (authIdentity) {
476 472
         let selector = $('#toolbar_auth_identity');
477
-
478
-        if (authIdentity) {
479
-            selector.css({display: "list-item"});
480
-            selector.text(authIdentity);
481
-        } else {
482
-            selector.css({display: "none"});
483
-            selector.text('');
484
-        }
473
+        selector.text(authIdentity ? authIdentity : '');
474
+        selector.get(0).classList.toggle('hide', !authIdentity);
485 475
     },
486 476
 
487 477
     /**
@@ -489,11 +479,8 @@ Toolbar = {
489 479
      * @param show <tt>true</tt> to show
490 480
      */
491 481
     showLoginButton (show) {
492
-        if (show) {
493
-            $('#toolbar_button_login').css({display: "list-item"});
494
-        } else {
495
-            $('#toolbar_button_login').css({display: "none"});
496
-        }
482
+        document.querySelector('#toolbar_button_login')
483
+                .classList.toggle('hide', !show);
497 484
     },
498 485
 
499 486
     /**
@@ -501,11 +488,8 @@ Toolbar = {
501 488
      * @param show <tt>true</tt> to show
502 489
      */
503 490
     showLogoutButton (show) {
504
-        if (show) {
505
-            $('#toolbar_button_logout').css({display: "list-item"});
506
-        } else {
507
-            $('#toolbar_button_logout').css({display: "none"});
508
-        }
491
+        document.querySelector('#toolbar_button_logout')
492
+                .classList.toggle('hide', !show);
509 493
     },
510 494
 
511 495
     /**

+ 3
- 3
modules/UI/videolayout/LargeVideoManager.js 查看文件

@@ -333,13 +333,13 @@ export default class LargeVideoManager {
333 333
         }
334 334
 
335 335
         if (show) {
336
-            $('#localConnectionMessage').css({display: "block"});
337 336
             // Avatar message conflicts with 'videoConnectionMessage',
338 337
             // so it must be hidden
339 338
             this.showRemoteConnectionMessage(false);
340
-        } else {
341
-            $('#localConnectionMessage').css({display: "none"});
342 339
         }
340
+
341
+        document.querySelector('#localConnectionMessage')
342
+                .classList.toggle('hide', !show);
343 343
     }
344 344
 
345 345
     /**

+ 12
- 29
modules/UI/videolayout/SmallVideo.js 查看文件

@@ -216,15 +216,7 @@ SmallVideo.prototype.hideIndicator = function () {
216 216
  * or hidden
217 217
  */
218 218
 SmallVideo.prototype.showAudioIndicator = function(isMuted) {
219
-
220
-    var audioMutedIndicator = this.getAudioMutedIndicator();
221
-
222
-    if (!isMuted) {
223
-        audioMutedIndicator.hide();
224
-    }
225
-    else {
226
-        audioMutedIndicator.show();
227
-    }
219
+    this.getAudioMutedIndicator().classList.toggle('hide', !isMuted);
228 220
     this.isAudioMuted = isMuted;
229 221
 };
230 222
 
@@ -235,9 +227,10 @@ SmallVideo.prototype.showAudioIndicator = function(isMuted) {
235 227
  * @returns {jQuery|HTMLElement} the audio muted indicator
236 228
  */
237 229
 SmallVideo.prototype.getAudioMutedIndicator = function () {
238
-    var audioMutedSpan = $('#' + this.videoSpanId + ' .audioMuted');
230
+    var selector = '#' + this.videoSpanId + ' .audioMuted';
231
+    var audioMutedSpan = document.querySelector(selector);
239 232
 
240
-    if (audioMutedSpan.length) {
233
+    if (audioMutedSpan) {
241 234
         return audioMutedSpan;
242 235
     }
243 236
 
@@ -257,7 +250,7 @@ SmallVideo.prototype.getAudioMutedIndicator = function () {
257 250
     mutedIndicator.className = 'icon-mic-disabled';
258 251
     audioMutedSpan.appendChild(mutedIndicator);
259 252
 
260
-    return $('#' + this.videoSpanId + ' .audioMuted');
253
+    return audioMutedSpan;
261 254
 };
262 255
 
263 256
 /**
@@ -270,10 +263,7 @@ SmallVideo.prototype.getAudioMutedIndicator = function () {
270 263
 SmallVideo.prototype.setVideoMutedView = function(isMuted) {
271 264
     this.isVideoMuted = isMuted;
272 265
     this.updateView();
273
-
274
-    var videoMutedSpan = this.getVideoMutedIndicator();
275
-
276
-    videoMutedSpan[isMuted ? 'show' : 'hide']();
266
+    this.getVideoMutedIndicator().classList.toggle('hide', !isMuted);
277 267
 };
278 268
 
279 269
 /**
@@ -283,9 +273,10 @@ SmallVideo.prototype.setVideoMutedView = function(isMuted) {
283 273
  * @returns {jQuery|HTMLElement} the video muted indicator
284 274
  */
285 275
 SmallVideo.prototype.getVideoMutedIndicator = function () {
286
-    var videoMutedSpan = $('#' + this.videoSpanId + ' .videoMuted');
276
+    var selector = '#' + this.videoSpanId + ' .videoMuted';
277
+    var videoMutedSpan = document.querySelector(selector);
287 278
 
288
-    if (videoMutedSpan.length) {
279
+    if (videoMutedSpan) {
289 280
         return videoMutedSpan;
290 281
     }
291 282
 
@@ -305,7 +296,7 @@ SmallVideo.prototype.getVideoMutedIndicator = function () {
305 296
 
306 297
     videoMutedSpan.appendChild(mutedIndicator);
307 298
 
308
-    return $('#' + this.videoSpanId + ' .videoMuted');
299
+    return videoMutedSpan;
309 300
 };
310 301
 
311 302
 /**
@@ -574,11 +565,7 @@ SmallVideo.prototype.showDominantSpeakerIndicator = function (show) {
574 565
         tooltip: 'speaker'
575 566
     });
576 567
 
577
-    if (show) {
578
-        indicatorSpan.classList.add('show');
579
-    } else {
580
-        indicatorSpan.classList.remove('show');
581
-    }
568
+    indicatorSpan.classList.toggle('show', show);
582 569
 };
583 570
 
584 571
 /**
@@ -602,11 +589,7 @@ SmallVideo.prototype.showRaisedHandIndicator = function (show) {
602 589
         tooltip: 'raisedHand'
603 590
     });
604 591
 
605
-    if (show) {
606
-        indicatorSpan.classList.add('show');
607
-    } else {
608
-        indicatorSpan.classList.remove('show');
609
-    }
592
+    indicatorSpan.classList.toggle('show', show);
610 593
 };
611 594
 
612 595
 /**

+ 2
- 6
modules/UI/videolayout/VideoLayout.js 查看文件

@@ -1136,12 +1136,8 @@ var VideoLayout = {
1136 1136
      * video stream is currently HD.
1137 1137
      */
1138 1138
     updateResolutionLabel(isResolutionHD) {
1139
-        let videoResolutionLabel = $("#videoResolutionLabel");
1140
-
1141
-        if (isResolutionHD && !videoResolutionLabel.is(":visible"))
1142
-            videoResolutionLabel.css({display: "block"});
1143
-        else if (!isResolutionHD && videoResolutionLabel.is(":visible"))
1144
-            videoResolutionLabel.css({display: "none"});
1139
+        document.querySelector('#videoResolutionLabel')
1140
+                .classList.toggle('show', isResolutionHD);
1145 1141
     },
1146 1142
 
1147 1143
     /**

Loading…
取消
儲存