Browse Source

Hide DOM elements using css class

master
Maxim Voloshin 8 years ago
parent
commit
68ab87cc0d

+ 1
- 1
modules/UI/UI.js View File

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

+ 2
- 7
modules/UI/feedback/Feedback.js View File

7
  * @private
7
  * @private
8
  */
8
  */
9
 function _toggleFeedbackIcon() {
9
 function _toggleFeedbackIcon() {
10
-    $('#feedbackButtonDiv').toggleClass("hidden");
10
+    document.querySelector('#feedbackButton').classList.toggle('hidden');
11
 }
11
 }
12
 
12
 
13
 /**
13
 /**
17
  * @private
17
  * @private
18
  */
18
  */
19
 function _showFeedbackButton (show) {
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 View File

387
      * @param show {true} to show the recording button, {false} to hide it
387
      * @param show {true} to show the recording button, {false} to hide it
388
      */
388
      */
389
     showRecordingButton (show) {
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
             labelSelector.css({display: "inline-block"});
472
             labelSelector.css({display: "inline-block"});
475
 
473
 
476
         // Recording spinner
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
     // checks whether recording is enabled and whether we have params
478
     // checks whether recording is enabled and whether we have params
483
     // to start automatically recording
479
     // to start automatically recording

+ 1
- 5
modules/UI/side_pannels/chat/Chat.js View File

297
             subject = subject.trim();
297
             subject = subject.trim();
298
         }
298
         }
299
         $('#subject').html(linkify(UIUtil.escapeHtml(subject)));
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 View File

417
      * @param show <tt>true</tt> to show or <tt>false</tt> to hide
417
      * @param show <tt>true</tt> to show or <tt>false</tt> to hide
418
      */
418
      */
419
     showAuthenticateButton (show) {
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
     showEtherpadButton () {
424
     showEtherpadButton () {
430
 
429
 
431
     // Shows or hides the 'shared video' button.
430
     // Shows or hides the 'shared video' button.
432
     showSharedVideoButton () {
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
     // checks whether desktop sharing is enabled and whether
440
     // checks whether desktop sharing is enabled and whether
451
 
448
 
452
     // Shows or hides SIP calls button
449
     // Shows or hides SIP calls button
453
     showSipCallButton (show) {
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
     // Shows or hides the dialpad button
458
     // Shows or hides the dialpad button
463
     showDialPadButton (show) {
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
      */
470
      */
475
     setAuthenticatedIdentity (authIdentity) {
471
     setAuthenticatedIdentity (authIdentity) {
476
         let selector = $('#toolbar_auth_identity');
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
      * @param show <tt>true</tt> to show
479
      * @param show <tt>true</tt> to show
490
      */
480
      */
491
     showLoginButton (show) {
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
      * @param show <tt>true</tt> to show
488
      * @param show <tt>true</tt> to show
502
      */
489
      */
503
     showLogoutButton (show) {
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 View File

333
         }
333
         }
334
 
334
 
335
         if (show) {
335
         if (show) {
336
-            $('#localConnectionMessage').css({display: "block"});
337
             // Avatar message conflicts with 'videoConnectionMessage',
336
             // Avatar message conflicts with 'videoConnectionMessage',
338
             // so it must be hidden
337
             // so it must be hidden
339
             this.showRemoteConnectionMessage(false);
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 View File

216
  * or hidden
216
  * or hidden
217
  */
217
  */
218
 SmallVideo.prototype.showAudioIndicator = function(isMuted) {
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
     this.isAudioMuted = isMuted;
220
     this.isAudioMuted = isMuted;
229
 };
221
 };
230
 
222
 
235
  * @returns {jQuery|HTMLElement} the audio muted indicator
227
  * @returns {jQuery|HTMLElement} the audio muted indicator
236
  */
228
  */
237
 SmallVideo.prototype.getAudioMutedIndicator = function () {
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
         return audioMutedSpan;
234
         return audioMutedSpan;
242
     }
235
     }
243
 
236
 
257
     mutedIndicator.className = 'icon-mic-disabled';
250
     mutedIndicator.className = 'icon-mic-disabled';
258
     audioMutedSpan.appendChild(mutedIndicator);
251
     audioMutedSpan.appendChild(mutedIndicator);
259
 
252
 
260
-    return $('#' + this.videoSpanId + ' .audioMuted');
253
+    return audioMutedSpan;
261
 };
254
 };
262
 
255
 
263
 /**
256
 /**
270
 SmallVideo.prototype.setVideoMutedView = function(isMuted) {
263
 SmallVideo.prototype.setVideoMutedView = function(isMuted) {
271
     this.isVideoMuted = isMuted;
264
     this.isVideoMuted = isMuted;
272
     this.updateView();
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
  * @returns {jQuery|HTMLElement} the video muted indicator
273
  * @returns {jQuery|HTMLElement} the video muted indicator
284
  */
274
  */
285
 SmallVideo.prototype.getVideoMutedIndicator = function () {
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
         return videoMutedSpan;
280
         return videoMutedSpan;
290
     }
281
     }
291
 
282
 
305
 
296
 
306
     videoMutedSpan.appendChild(mutedIndicator);
297
     videoMutedSpan.appendChild(mutedIndicator);
307
 
298
 
308
-    return $('#' + this.videoSpanId + ' .videoMuted');
299
+    return videoMutedSpan;
309
 };
300
 };
310
 
301
 
311
 /**
302
 /**
574
         tooltip: 'speaker'
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
         tooltip: 'raisedHand'
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 View File

1136
      * video stream is currently HD.
1136
      * video stream is currently HD.
1137
      */
1137
      */
1138
     updateResolutionLabel(isResolutionHD) {
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…
Cancel
Save