Browse Source

Merge pull request #1111 from BeatC/FIX-clean-js-from-styles-1

Fix clean js from styles 1
master
yanas 8 years ago
parent
commit
8caae4bfde

+ 4
- 0
css/_base.scss View File

153
     display: inline-block !important;
153
     display: inline-block !important;
154
 }
154
 }
155
 
155
 
156
+.show-list-item {
157
+    display: list-item !important;
158
+}
159
+
156
 /**
160
 /**
157
  * Shows a flex element.
161
  * Shows a flex element.
158
  */
162
  */

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

31
 UI.messageHandler = require("./util/MessageHandler");
31
 UI.messageHandler = require("./util/MessageHandler");
32
 var messageHandler = UI.messageHandler;
32
 var messageHandler = UI.messageHandler;
33
 var JitsiPopover = require("./util/JitsiPopover");
33
 var JitsiPopover = require("./util/JitsiPopover");
34
-var Feedback = require("./feedback/Feedback");
34
+import Feedback from "./feedback/Feedback";
35
 import FollowMe from "../FollowMe";
35
 import FollowMe from "../FollowMe";
36
 
36
 
37
 var eventEmitter = new EventEmitter();
37
 var eventEmitter = new EventEmitter();
444
         // Display notice message at the top of the toolbar
444
         // Display notice message at the top of the toolbar
445
         if (config.noticeMessage) {
445
         if (config.noticeMessage) {
446
             $('#noticeText').text(config.noticeMessage);
446
             $('#noticeText').text(config.noticeMessage);
447
-            $('#notice').css({display: 'block'});
447
+            UIUtil.showElement('notice');
448
         }
448
         }
449
     } else {
449
     } else {
450
-        $("#mainToolbarContainer").css("display", "none");
450
+        UIUtil.hideElement('mainToolbarContainer');
451
         FilmStrip.setupFilmStripOnly();
451
         FilmStrip.setupFilmStripOnly();
452
         messageHandler.enableNotifications(false);
452
         messageHandler.enableNotifications(false);
453
         JitsiPopover.enabled = false;
453
         JitsiPopover.enabled = false;

+ 3
- 36
modules/UI/feedback/Feedback.js View File

1
 /* global $, APP, JitsiMeetJS */
1
 /* global $, APP, JitsiMeetJS */
2
-import UIEvents from "../../../service/UI/UIEvents";
3
 import FeedbackWindow from "./FeedbackWindow";
2
 import FeedbackWindow from "./FeedbackWindow";
4
 
3
 
5
-/**
6
- * Shows / hides the feedback button.
7
- * @private
8
- */
9
-function _toggleFeedbackIcon() {
10
-    $('#feedbackButtonDiv').toggleClass("hidden");
11
-}
12
-
13
-/**
14
- * Shows / hides the feedback button.
15
- * @param {show} set to {true} to show the feedback button or to  {false}
16
- * to hide it
17
- * @private
18
- */
19
-function _showFeedbackButton (show) {
20
-    var feedbackButton = $("#feedbackButtonDiv");
21
-
22
-    if (show)
23
-        feedbackButton.css("display", "block");
24
-    else
25
-        feedbackButton.css("display", "none");
26
-}
27
-
28
 /**
4
 /**
29
  * Defines all methods in connection to the Feedback window.
5
  * Defines all methods in connection to the Feedback window.
30
  *
6
  *
31
  * @type {{openFeedbackWindow: Function}}
7
  * @type {{openFeedbackWindow: Function}}
32
  */
8
  */
33
-var Feedback = {
9
+const Feedback = {
34
 
10
 
35
     /**
11
     /**
36
      * Initialise the Feedback functionality.
12
      * Initialise the Feedback functionality.
47
         if (typeof this.enabled == "undefined")
23
         if (typeof this.enabled == "undefined")
48
             this.enabled = true;
24
             this.enabled = true;
49
 
25
 
50
-        _showFeedbackButton(this.enabled);
51
-
52
         this.window = new FeedbackWindow();
26
         this.window = new FeedbackWindow();
27
+        this.emitter = emitter;
53
 
28
 
54
         $("#feedbackButton").click(Feedback.openFeedbackWindow);
29
         $("#feedbackButton").click(Feedback.openFeedbackWindow);
55
-
56
-        // Show / hide the feedback button whenever the film strip is
57
-        // shown / hidden.
58
-        emitter.addListener(UIEvents.TOGGLE_FILM_STRIP, function () {
59
-            _toggleFeedbackIcon();
60
-        });
61
     },
30
     },
62
     /**
31
     /**
63
      * Enables/ disabled the feedback feature.
32
      * Enables/ disabled the feedback feature.
64
      */
33
      */
65
     enableFeedback: function (enable) {
34
     enableFeedback: function (enable) {
66
-        if (this.enabled !== enable)
67
-            _showFeedbackButton(enable);
68
         this.enabled = enable;
35
         this.enabled = enable;
69
     },
36
     },
70
 
37
 
125
     }
92
     }
126
 };
93
 };
127
 
94
 
128
-module.exports = Feedback;
95
+export default Feedback;

+ 17
- 7
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"});
390
+        let isVisible = show && _isRecordingButtonEnabled();
391
+        let id = 'toolbar_button_record';
392
+
393
+        console.log('recording is visible', isVisible);
394
+
395
+        if (isVisible) {
396
+            UIUtil.showElement(id);
392
         } else {
397
         } else {
393
-            $('#toolbar_button_record').css({display: "none"});
398
+            UIUtil.hideElement(id);
394
         }
399
         }
395
     },
400
     },
396
 
401
 
474
             labelSelector.css({display: "inline-block"});
479
             labelSelector.css({display: "inline-block"});
475
 
480
 
476
         // Recording spinner
481
         // Recording spinner
477
-        if (recordingState === Status.RETRYING)
478
-            $("#recordingSpinner").show();
479
-        else
480
-            $("#recordingSpinner").hide();
482
+        let spinnerId = 'recordingSpinner';
483
+        if(recordingState === Status.RETRYING) {
484
+            UIUtil.showElement(spinnerId);
485
+        } else {
486
+            UIUtil.hideElement(spinnerId);
487
+        }
488
+
489
+        document.querySelector('#recordingSpinner').classList
490
+                .toggle('show-inline', recordingState === Status.RETRYING);
481
     },
491
     },
482
     // checks whether recording is enabled and whether we have params
492
     // checks whether recording is enabled and whether we have params
483
     // to start automatically recording
493
     // to start automatically recording

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

293
      * @param subject the subject
293
      * @param subject the subject
294
      */
294
      */
295
     setSubject (subject) {
295
     setSubject (subject) {
296
+        let toggleFunction;
296
         if (subject) {
297
         if (subject) {
297
             subject = subject.trim();
298
             subject = subject.trim();
298
-        }
299
-        $('#subject').html(linkify(UIUtil.escapeHtml(subject)));
300
-        if (subject) {
301
-            $("#subject").css({display: "block"});
299
+            toggleFunction = UIUtil.showElement.bind(UIUtil);
302
         } else {
300
         } else {
303
-            $("#subject").css({display: "none"});
301
+            toggleFunction = UIUtil.hideElement.bind(UIUtil);
304
         }
302
         }
303
+
304
+        let subjectId = 'subject';
305
+        let html = linkify(UIUtil.escapeHtml(subject));
306
+        $(`#${subjectId}`).html(html);
307
+        toggleFunction(subjectId);
305
     },
308
     },
306
 
309
 
307
     /**
310
     /**

+ 39
- 27
modules/UI/toolbars/Toolbar.js View File

401
      * @param show <tt>true</tt> to show or <tt>false</tt> to hide
401
      * @param show <tt>true</tt> to show or <tt>false</tt> to hide
402
      */
402
      */
403
     showAuthenticateButton (show) {
403
     showAuthenticateButton (show) {
404
-        let display = show ? 'block' : 'none';
405
-
406
-        $('#authenticationContainer').css({display});
404
+        let id = 'authenticationContainer';
405
+        if (show) {
406
+            UIUtil.showElement(id);
407
+        } else {
408
+            UIUtil.hideElement(id);
409
+        }
407
     },
410
     },
408
 
411
 
409
     showEtherpadButton () {
412
     showEtherpadButton () {
414
 
417
 
415
     // Shows or hides the 'shared video' button.
418
     // Shows or hides the 'shared video' button.
416
     showSharedVideoButton () {
419
     showSharedVideoButton () {
417
-        let $element = $('#toolbar_button_sharedvideo');
418
-        if (UIUtil.isButtonEnabled('sharedvideo')
419
-                && config.disableThirdPartyRequests !== true) {
420
-            $element.css({display: "inline-block"});
421
-            UIUtil.setTooltip($element.get(0), 'toolbar.sharedvideo', 'right');
420
+        let id = 'toolbar_button_sharedvideo';
421
+        let shouldShow = UIUtil.isButtonEnabled('sharedvideo')
422
+                && !config.disableThirdPartyRequests;
423
+
424
+        if (shouldShow) {
425
+            let el = document.getElementById(id);
426
+            UIUtil.setTooltip(el, 'toolbar.sharedvideo', 'right');
427
+            UIUtil.showElement(id);
422
         } else {
428
         } else {
423
-            $('#toolbar_button_sharedvideo').css({display: "none"});
429
+            UIUtil.hideElement(id);
424
         }
430
         }
425
     },
431
     },
426
 
432
 
435
 
441
 
436
     // Shows or hides SIP calls button
442
     // Shows or hides SIP calls button
437
     showSipCallButton (show) {
443
     showSipCallButton (show) {
438
-        if (APP.conference.sipGatewayEnabled()
439
-            && UIUtil.isButtonEnabled('sip') && show) {
440
-            $('#toolbar_button_sip').css({display: "inline-block"});
444
+        let shouldShow = APP.conference.sipGatewayEnabled()
445
+            && UIUtil.isButtonEnabled('sip') && show;
446
+        let id = 'toolbar_button_sip';
447
+
448
+        if (shouldShow) {
449
+            UIUtil.showElement(id);
441
         } else {
450
         } else {
442
-            $('#toolbar_button_sip').css({display: "none"});
451
+            UIUtil.hideElement(id);
443
         }
452
         }
444
     },
453
     },
445
 
454
 
446
     // Shows or hides the dialpad button
455
     // Shows or hides the dialpad button
447
     showDialPadButton (show) {
456
     showDialPadButton (show) {
448
-        if (UIUtil.isButtonEnabled('dialpad') && show) {
449
-            $('#toolbar_button_dialpad').css({display: "inline-block"});
457
+        let shouldShow = UIUtil.isButtonEnabled('dialpad') && show;
458
+        let id = 'toolbar_button_dialpad';
459
+        if (shouldShow) {
460
+            UIUtil.showElement(id);
450
         } else {
461
         } else {
451
-            $('#toolbar_button_dialpad').css({display: "none"});
462
+            UIUtil.hideElement(id);
452
         }
463
         }
453
     },
464
     },
454
 
465
 
457
      * @param authIdentity identity name to be displayed.
468
      * @param authIdentity identity name to be displayed.
458
      */
469
      */
459
     setAuthenticatedIdentity (authIdentity) {
470
     setAuthenticatedIdentity (authIdentity) {
460
-        let selector = $('#toolbar_auth_identity');
461
-
462
-        if (authIdentity) {
463
-            selector.css({display: "list-item"});
464
-            selector.text(authIdentity);
471
+        let id = 'toolbar_auth_identity';
472
+        if(authIdentity) {
473
+            UIUtil.showElement(id);
474
+            $(`#${id}`).text(authIdentity);
465
         } else {
475
         } else {
466
-            selector.css({display: "none"});
467
-            selector.text('');
476
+            UIUtil.hideElement(id);
477
+            $(`#${id}`).text('');
468
         }
478
         }
469
     },
479
     },
470
 
480
 
473
      * @param show <tt>true</tt> to show
483
      * @param show <tt>true</tt> to show
474
      */
484
      */
475
     showLoginButton (show) {
485
     showLoginButton (show) {
486
+        let id = 'toolbar_button_login';
476
         if (show) {
487
         if (show) {
477
-            $('#toolbar_button_login').css({display: "list-item"});
488
+            UIUtil.showElement(id);
478
         } else {
489
         } else {
479
-            $('#toolbar_button_login').css({display: "none"});
490
+            UIUtil.hideElement(id);
480
         }
491
         }
481
     },
492
     },
482
 
493
 
485
      * @param show <tt>true</tt> to show
496
      * @param show <tt>true</tt> to show
486
      */
497
      */
487
     showLogoutButton (show) {
498
     showLogoutButton (show) {
499
+        let id = 'toolbar_button_logout';
488
         if (show) {
500
         if (show) {
489
-            $('#toolbar_button_logout').css({display: "list-item"});
501
+            UIUtil.showElement(id);
490
         } else {
502
         } else {
491
-            $('#toolbar_button_logout').css({display: "none"});
503
+            UIUtil.hideElement(id);
492
         }
504
         }
493
     },
505
     },
494
 
506
 

+ 59
- 6
modules/UI/util/UIUtil.js View File

18
     'top-right': 'sw'
18
     'top-right': 'sw'
19
 };
19
 };
20
 
20
 
21
+/**
22
+ * Associates the default display type with corresponding CSS class
23
+ */
24
+const SHOW_CLASSES = {
25
+    'block': 'show',
26
+    'inline': 'show-inline',
27
+    'list-item': 'show-list-item'
28
+};
29
+
21
 /**
30
 /**
22
  * Created by hristo on 12/22/14.
31
  * Created by hristo on 12/22/14.
23
  */
32
  */
217
      * @param {String} the identifier of the element to show
226
      * @param {String} the identifier of the element to show
218
      */
227
      */
219
     showElement(id) {
228
     showElement(id) {
220
-        if ($("#"+id).hasClass("hide"))
221
-            $("#"+id).removeClass("hide");
229
+        let element;
230
+        if (id instanceof HTMLElement) {
231
+            element = id;
232
+        } else {
233
+            element = document.getElementById(id);
234
+        }
222
 
235
 
223
-        $("#"+id).addClass("show");
236
+        if (!element) {
237
+            return;
238
+        }
239
+
240
+        if(element.classList.contains('hide')) {
241
+            element.classList.remove('hide');
242
+        }
243
+
244
+        let type = this.getElementDefaultDisplay(element.tagName);
245
+        let className = SHOW_CLASSES[type];
246
+        element.classList.add(className);
224
     },
247
     },
225
 
248
 
226
     /**
249
     /**
229
      * @param {String} the identifier of the element to hide
252
      * @param {String} the identifier of the element to hide
230
      */
253
      */
231
     hideElement(id) {
254
     hideElement(id) {
232
-        if ($("#"+id).hasClass("show"))
233
-            $("#"+id).removeClass("show");
255
+        let element;
256
+        if (id instanceof HTMLElement) {
257
+            element = id;
258
+        } else {
259
+            element = document.getElementById(id);
260
+        }
261
+
262
+        if (!element) {
263
+            return;
264
+        }
265
+
266
+        let type = this.getElementDefaultDisplay(element.tagName);
267
+        let className = SHOW_CLASSES[type];
268
+
269
+        if(element.classList.contains(className)) {
270
+            element.classList.remove(className);
271
+        }
272
+
273
+        element.classList.add('hide');
274
+    },
275
+
276
+    /**
277
+     * Returns default display style for the tag
278
+     * @param tag
279
+     * @returns {*}
280
+     */
281
+    getElementDefaultDisplay(tag) {
282
+        let tempElement = document.createElement(tag);
283
+
284
+        document.body.appendChild(tempElement);
285
+        let style = window.getComputedStyle(tempElement).display;
286
+        document.body.removeChild(tempElement);
234
 
287
 
235
-        $("#"+id).addClass("hide");
288
+        return style;
236
     },
289
     },
237
 
290
 
238
     /**
291
     /**

+ 3
- 2
modules/UI/videolayout/LargeVideoManager.js View File

332
             show = APP.conference.isConnectionInterrupted();
332
             show = APP.conference.isConnectionInterrupted();
333
         }
333
         }
334
 
334
 
335
+        let id = 'localConnectionMessage';
335
         if (show) {
336
         if (show) {
336
-            $('#localConnectionMessage').css({display: "block"});
337
+            UIUtil.showElement(id);
337
             // Avatar message conflicts with 'videoConnectionMessage',
338
             // Avatar message conflicts with 'videoConnectionMessage',
338
             // so it must be hidden
339
             // so it must be hidden
339
             this.showRemoteConnectionMessage(false);
340
             this.showRemoteConnectionMessage(false);
340
         } else {
341
         } else {
341
-            $('#localConnectionMessage').css({display: "none"});
342
+            UIUtil.hideElement(id);
342
         }
343
         }
343
     }
344
     }
344
 
345
 

+ 29
- 27
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();
219
+    let mutedIndicator = this.getAudioMutedIndicator();
220
+    if (isMuted) {
221
+        UIUtil.showElement(mutedIndicator);
222
+    } else {
223
+        UIUtil.hideElement(mutedIndicator);
227
     }
224
     }
225
+
228
     this.isAudioMuted = isMuted;
226
     this.isAudioMuted = isMuted;
229
 };
227
 };
230
 
228
 
232
  * Returns the audio muted indicator jquery object. If it doesn't exists -
230
  * Returns the audio muted indicator jquery object. If it doesn't exists -
233
  * creates it.
231
  * creates it.
234
  *
232
  *
235
- * @returns {jQuery|HTMLElement} the audio muted indicator
233
+ * @returns {HTMLElement} the audio muted indicator
236
  */
234
  */
237
 SmallVideo.prototype.getAudioMutedIndicator = function () {
235
 SmallVideo.prototype.getAudioMutedIndicator = function () {
238
-    var audioMutedSpan = $('#' + this.videoSpanId + ' .audioMuted');
236
+    let selector = '#' + this.videoSpanId + ' .audioMuted';
237
+    let audioMutedSpan = document.querySelector(selector);
239
 
238
 
240
-    if (audioMutedSpan.length) {
239
+    if (audioMutedSpan) {
241
         return audioMutedSpan;
240
         return audioMutedSpan;
242
     }
241
     }
243
 
242
 
248
         "videothumbnail.mute",
247
         "videothumbnail.mute",
249
         "top");
248
         "top");
250
 
249
 
250
+    let mutedIndicator = document.createElement('i');
251
+    mutedIndicator.className = 'icon-mic-disabled';
252
+    audioMutedSpan.appendChild(mutedIndicator);
253
+
251
     this.container
254
     this.container
252
         .querySelector('.videocontainer__toolbar')
255
         .querySelector('.videocontainer__toolbar')
253
         .appendChild(audioMutedSpan);
256
         .appendChild(audioMutedSpan);
254
 
257
 
255
-
256
-    var mutedIndicator = document.createElement('i');
257
-    mutedIndicator.className = 'icon-mic-disabled';
258
-    audioMutedSpan.appendChild(mutedIndicator);
259
-
260
-    return $('#' + this.videoSpanId + ' .audioMuted');
258
+    return audioMutedSpan;
261
 };
259
 };
262
 
260
 
263
 /**
261
 /**
271
     this.isVideoMuted = isMuted;
269
     this.isVideoMuted = isMuted;
272
     this.updateView();
270
     this.updateView();
273
 
271
 
274
-    var videoMutedSpan = this.getVideoMutedIndicator();
275
-
276
-    videoMutedSpan[isMuted ? 'show' : 'hide']();
272
+    let element = this.getVideoMutedIndicator();
273
+    if (isMuted) {
274
+        UIUtil.showElement(element);
275
+    } else {
276
+        UIUtil.hideElement(element);
277
+    }
277
 };
278
 };
278
 
279
 
279
 /**
280
 /**
283
  * @returns {jQuery|HTMLElement} the video muted indicator
284
  * @returns {jQuery|HTMLElement} the video muted indicator
284
  */
285
  */
285
 SmallVideo.prototype.getVideoMutedIndicator = function () {
286
 SmallVideo.prototype.getVideoMutedIndicator = function () {
286
-    var videoMutedSpan = $('#' + this.videoSpanId + ' .videoMuted');
287
+    var selector = '#' + this.videoSpanId + ' .videoMuted';
288
+    var videoMutedSpan = document.querySelector(selector);
287
 
289
 
288
-    if (videoMutedSpan.length) {
290
+    if (videoMutedSpan) {
289
         return videoMutedSpan;
291
         return videoMutedSpan;
290
     }
292
     }
291
 
293
 
305
 
307
 
306
     videoMutedSpan.appendChild(mutedIndicator);
308
     videoMutedSpan.appendChild(mutedIndicator);
307
 
309
 
308
-    return $('#' + this.videoSpanId + ' .videoMuted');
310
+    return videoMutedSpan;
309
 };
311
 };
310
 
312
 
311
 /**
313
 /**
575
     });
577
     });
576
 
578
 
577
     if (show) {
579
     if (show) {
578
-        indicatorSpan.classList.add('show');
580
+        UIUtil.showElement(indicatorSpan);
579
     } else {
581
     } else {
580
-        indicatorSpan.classList.remove('show');
582
+        UIUtil.hideElement(indicatorSpan);
581
     }
583
     }
582
 };
584
 };
583
 
585
 
603
     });
605
     });
604
 
606
 
605
     if (show) {
607
     if (show) {
606
-        indicatorSpan.classList.add('show');
608
+        UIUtil.showElement(indicatorSpan);
607
     } else {
609
     } else {
608
-        indicatorSpan.classList.remove('show');
610
+        UIUtil.hideElement(indicatorSpan);
609
     }
611
     }
610
 };
612
 };
611
 
613
 

+ 6
- 5
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");
1139
+        let id = 'videoResolutionLabel';
1140
 
1140
 
1141
-        if (isResolutionHD && !videoResolutionLabel.is(":visible"))
1142
-            videoResolutionLabel.css({display: "block"});
1143
-        else if (!isResolutionHD && videoResolutionLabel.is(":visible"))
1144
-            videoResolutionLabel.css({display: "none"});
1141
+        if (isResolutionHD) {
1142
+            UIUtil.showElement(id);
1143
+        } else {
1144
+            UIUtil.hideElement(id);
1145
+        }
1145
     },
1146
     },
1146
 
1147
 
1147
     /**
1148
     /**

Loading…
Cancel
Save