Przeglądaj źródła

Updated method for showing/hiding elements

j8
Ilya Daynatovich 8 lat temu
rodzic
commit
a8a6b38c28
2 zmienionych plików z 22 dodań i 8 usunięć
  1. 2
    2
      modules/UI/UI.js
  2. 20
    6
      modules/UI/util/UIUtil.js

+ 2
- 2
modules/UI/UI.js Wyświetl plik

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
-            $('#notice').css({display: 'block'});
446
+            UIUtil.showElement('notice');
447
         }
447
         }
448
     } else {
448
     } else {
449
-        document.querySelector('#mainToolbarContainer').classList.add('hide');
449
+        UIUtil.hideElement('mainToolbarContainer');
450
         FilmStrip.setupFilmStripOnly();
450
         FilmStrip.setupFilmStripOnly();
451
         messageHandler.enableNotifications(false);
451
         messageHandler.enableNotifications(false);
452
         JitsiPopover.enabled = false;
452
         JitsiPopover.enabled = false;

+ 20
- 6
modules/UI/util/UIUtil.js Wyświetl plik

219
      * @param {String} the identifier of the element to show
219
      * @param {String} the identifier of the element to show
220
      */
220
      */
221
     showElement(id) {
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
      * @param {String} the identifier of the element to hide
238
      * @param {String} the identifier of the element to hide
232
      */
239
      */
233
     hideElement(id) {
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
     /**

Ładowanie…
Anuluj
Zapisz