Bläddra i källkod

Updated method for showing/hiding elements

j8
Ilya Daynatovich 8 år sedan
förälder
incheckning
a8a6b38c28
2 ändrade filer med 22 tillägg och 8 borttagningar
  1. 2
    2
      modules/UI/UI.js
  2. 20
    6
      modules/UI/util/UIUtil.js

+ 2
- 2
modules/UI/UI.js Visa fil

@@ -443,10 +443,10 @@ UI.start = function () {
443 443
         // Display notice message at the top of the toolbar
444 444
         if (config.noticeMessage) {
445 445
             $('#noticeText').text(config.noticeMessage);
446
-            $('#notice').css({display: 'block'});
446
+            UIUtil.showElement('notice');
447 447
         }
448 448
     } else {
449
-        document.querySelector('#mainToolbarContainer').classList.add('hide');
449
+        UIUtil.hideElement('mainToolbarContainer');
450 450
         FilmStrip.setupFilmStripOnly();
451 451
         messageHandler.enableNotifications(false);
452 452
         JitsiPopover.enabled = false;

+ 20
- 6
modules/UI/util/UIUtil.js Visa fil

@@ -219,10 +219,17 @@ const TOOLTIP_POSITIONS = {
219 219
      * @param {String} the identifier of the element to show
220 220
      */
221 221
     showElement(id) {
222
-        if ($("#"+id).hasClass("hide"))
223
-            $("#"+id).removeClass("hide");
222
+        let element = document.getElementById(id);
224 223
 
225
-        $("#"+id).addClass("show");
224
+        if (!element) {
225
+            return;
226
+        }
227
+
228
+        if(element.classList.contains('hide')) {
229
+            element.classList.remove('hide');
230
+        }
231
+
232
+        element.classList.add('show');
226 233
     },
227 234
 
228 235
     /**
@@ -231,10 +238,17 @@ const TOOLTIP_POSITIONS = {
231 238
      * @param {String} the identifier of the element to hide
232 239
      */
233 240
     hideElement(id) {
234
-        if ($("#"+id).hasClass("show"))
235
-            $("#"+id).removeClass("show");
241
+        let element = document.getElementById(id);
242
+
243
+        if (!element) {
244
+            return;
245
+        }
246
+
247
+        if(element.classList.contains('show')) {
248
+            element.classList.remove('show');
249
+        }
236 250
 
237
-        $("#"+id).addClass("hide");
251
+        element.classList.add('hide');
238 252
     },
239 253
 
240 254
     /**

Laddar…
Avbryt
Spara