Pārlūkot izejas kodu

Work on fixing the tests

master
Ilya Daynatovich 8 gadus atpakaļ
vecāks
revīzija
fb4e9b3c6d

+ 4
- 0
css/_base.scss Parādīt failu

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

+ 3
- 31
modules/UI/feedback/Feedback.js Parādīt failu

@@ -1,31 +1,12 @@
1 1
 /* global $, APP, JitsiMeetJS */
2
-import UIEvents from "../../../service/UI/UIEvents";
3 2
 import FeedbackWindow from "./FeedbackWindow";
4 3
 
5
-/**
6
- * Shows / hides the feedback button.
7
- * @private
8
- */
9
-function _toggleFeedbackIcon() {
10
-    document.querySelector('#feedbackButton').classList.toggle('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
-    document.querySelector('#feedbackButton').classList.toggle('hide', !show);
21
-}
22
-
23 4
 /**
24 5
  * Defines all methods in connection to the Feedback window.
25 6
  *
26 7
  * @type {{openFeedbackWindow: Function}}
27 8
  */
28
-var Feedback = {
9
+const Feedback = {
29 10
 
30 11
     /**
31 12
      * Initialise the Feedback functionality.
@@ -42,24 +23,15 @@ var Feedback = {
42 23
         if (typeof this.enabled == "undefined")
43 24
             this.enabled = true;
44 25
 
45
-        _showFeedbackButton(this.enabled);
46
-
47 26
         this.window = new FeedbackWindow();
27
+        this.emitter = emitter;
48 28
 
49 29
         $("#feedbackButton").click(Feedback.openFeedbackWindow);
50
-
51
-        // Show / hide the feedback button whenever the film strip is
52
-        // shown / hidden.
53
-        emitter.addListener(UIEvents.TOGGLE_FILM_STRIP, function () {
54
-            _toggleFeedbackIcon();
55
-        });
56 30
     },
57 31
     /**
58 32
      * Enables/ disabled the feedback feature.
59 33
      */
60 34
     enableFeedback: function (enable) {
61
-        if (this.enabled !== enable)
62
-            _showFeedbackButton(enable);
63 35
         this.enabled = enable;
64 36
     },
65 37
 
@@ -120,4 +92,4 @@ var Feedback = {
120 92
     }
121 93
 };
122 94
 
123
-module.exports = Feedback;
95
+export default Feedback;

+ 17
- 3
modules/UI/recording/Recording.js Parādīt failu

@@ -387,9 +387,16 @@ var Recording = {
387 387
      * @param show {true} to show the recording button, {false} to hide it
388 388
      */
389 389
     showRecordingButton (show) {
390
-        var visibility = show && _isRecordingButtonEnabled();
391
-        document.querySelector('#toolbar_button_record')
392
-                .classList.toggle('hide', !visibility);
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);
397
+        } else {
398
+            UIUtil.hideElement(id);
399
+        }
393 400
     },
394 401
 
395 402
     /**
@@ -472,6 +479,13 @@ var Recording = {
472 479
             labelSelector.css({display: "inline-block"});
473 480
 
474 481
         // Recording spinner
482
+        let spinnerId = 'recordingSpinner';
483
+        if(recordingState === Status.RETRYING) {
484
+            UIUtil.showElement(spinnerId);
485
+        } else {
486
+            UIUtil.hideElement(spinnerId);
487
+        }
488
+
475 489
         document.querySelector('#recordingSpinner').classList
476 490
                 .toggle('show-inline', recordingState === Status.RETRYING);
477 491
     },

+ 9
- 2
modules/UI/side_pannels/chat/Chat.js Parādīt failu

@@ -293,11 +293,18 @@ var Chat = {
293 293
      * @param subject the subject
294 294
      */
295 295
     setSubject (subject) {
296
+        let toggleFunction;
296 297
         if (subject) {
297 298
             subject = subject.trim();
299
+            toggleFunction = UIUtil.showElement.bind(UIUtil);
300
+        } else {
301
+            toggleFunction = UIUtil.hideElement.bind(UIUtil);
298 302
         }
299
-        $('#subject').html(linkify(UIUtil.escapeHtml(subject)));
300
-        document.querySelector('#subject').classList.toggle('hide', !subject);
303
+
304
+        let subjectId = 'subject';
305
+        let html = linkify(UIUtil.escapeHtml(subject));
306
+        $(`#${subjectId}`).html(html);
307
+        toggleFunction(subjectId);
301 308
     },
302 309
 
303 310
     /**

+ 50
- 22
modules/UI/toolbars/Toolbar.js Parādīt failu

@@ -417,8 +417,12 @@ Toolbar = {
417 417
      * @param show <tt>true</tt> to show or <tt>false</tt> to hide
418 418
      */
419 419
     showAuthenticateButton (show) {
420
-        document.querySelector('#authenticationContainer')
421
-                .classList.toggle('hide', !show);
420
+        let id = 'authenticationContainer';
421
+        if (show) {
422
+            UIUtil.showElement(id);
423
+        } else {
424
+            UIUtil.hideElement(id);
425
+        }
422 426
     },
423 427
 
424 428
     showEtherpadButton () {
@@ -429,12 +433,17 @@ Toolbar = {
429 433
 
430 434
     // Shows or hides the 'shared video' button.
431 435
     showSharedVideoButton () {
432
-        if (!UIUtil.isButtonEnabled('sharedvideo')) {
433
-            return;
436
+        let id = 'toolbar_button_sharedvideo';
437
+        let shouldShow = UIUtil.isButtonEnabled('sharedvideo')
438
+                && !config.disableThirdPartyRequests;
439
+
440
+        if (shouldShow) {
441
+            let el = document.getElementById(id);
442
+            UIUtil.setTooltip(el, 'toolbar.sharedvideo', 'right');
443
+            UIUtil.showElement(id);
444
+        } else {
445
+            UIUtil.hideElement(id);
434 446
         }
435
-        var el = document.querySelector('#toolbar_button_sharedvideo');
436
-        UIUtil.setTooltip(el, 'toolbar.sharedvideo', 'right');
437
-        el.classList.toggle('hide', config.disableThirdPartyRequests === true);
438 447
     },
439 448
 
440 449
     // checks whether desktop sharing is enabled and whether
@@ -448,20 +457,26 @@ Toolbar = {
448 457
 
449 458
     // Shows or hides SIP calls button
450 459
     showSipCallButton (show) {
451
-        if (!UIUtil.isButtonEnabled('sip')) {
452
-            return;
460
+        let shouldShow = APP.conference.sipGatewayEnabled()
461
+            && UIUtil.isButtonEnabled('sip') && show;
462
+        let id = 'toolbar_button_sip';
463
+
464
+        if (shouldShow) {
465
+            UIUtil.showElement(id);
466
+        } else {
467
+            UIUtil.hideElement(id);
453 468
         }
454
-        document.querySelector('#toolbar_button_sip').classList
455
-                .toggle('hide', !(show && APP.conference.sipGatewayEnabled()));
456 469
     },
457 470
 
458 471
     // Shows or hides the dialpad button
459 472
     showDialPadButton (show) {
460
-        if (!UIUtil.isButtonEnabled('dialpad')) {
461
-            return;
473
+        let shouldShow = UIUtil.isButtonEnabled('dialpad') && show;
474
+        let id = 'toolbar_button_dialpad';
475
+        if (shouldShow) {
476
+            UIUtil.showElement(id);
477
+        } else {
478
+            UIUtil.hideElement(id);
462 479
         }
463
-        document.querySelector('#toolbar_button_dialpad')
464
-                .classList.toggle('hide', !show);
465 480
     },
466 481
 
467 482
     /**
@@ -469,9 +484,14 @@ Toolbar = {
469 484
      * @param authIdentity identity name to be displayed.
470 485
      */
471 486
     setAuthenticatedIdentity (authIdentity) {
472
-        let selector = $('#toolbar_auth_identity');
473
-        selector.text(authIdentity ? authIdentity : '');
474
-        selector.get(0).classList.toggle('hide', !authIdentity);
487
+        let id = 'toolbar_auth_identity';
488
+        if(authIdentity) {
489
+            UIUtil.showElement(id);
490
+            $(`#${id}`).text(authIdentity);
491
+        } else {
492
+            UIUtil.hideElement(id);
493
+            $(`#${id}`).text('');
494
+        }
475 495
     },
476 496
 
477 497
     /**
@@ -479,8 +499,12 @@ Toolbar = {
479 499
      * @param show <tt>true</tt> to show
480 500
      */
481 501
     showLoginButton (show) {
482
-        document.querySelector('#toolbar_button_login')
483
-                .classList.toggle('hide', !show);
502
+        let id = 'toolbar_button_login';
503
+        if (show) {
504
+            UIUtil.showElement(id);
505
+        } else {
506
+            UIUtil.hideElement(id);
507
+        }
484 508
     },
485 509
 
486 510
     /**
@@ -488,8 +512,12 @@ Toolbar = {
488 512
      * @param show <tt>true</tt> to show
489 513
      */
490 514
     showLogoutButton (show) {
491
-        document.querySelector('#toolbar_button_logout')
492
-                .classList.toggle('hide', !show);
515
+        let id = 'toolbar_button_logout';
516
+        if (show) {
517
+            UIUtil.showElement(id);
518
+        } else {
519
+            UIUtil.hideElement(id);
520
+        }
493 521
     },
494 522
 
495 523
     /**

+ 32
- 3
modules/UI/util/UIUtil.js Parādīt failu

@@ -18,6 +18,15 @@ const TOOLTIP_POSITIONS = {
18 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 31
  * Created by hristo on 12/22/14.
23 32
  */
@@ -229,7 +238,9 @@ const TOOLTIP_POSITIONS = {
229 238
             element.classList.remove('hide');
230 239
         }
231 240
 
232
-        element.classList.add('show');
241
+        let type = this.getElementDefaultDisplay(element.tagName);
242
+        let className = SHOW_CLASSES[type];
243
+        element.classList.add(className);
233 244
     },
234 245
 
235 246
     /**
@@ -244,13 +255,31 @@ const TOOLTIP_POSITIONS = {
244 255
             return;
245 256
         }
246 257
 
247
-        if(element.classList.contains('show')) {
248
-            element.classList.remove('show');
258
+        let type = this.getElementDefaultDisplay(element.tagName);
259
+        let className = SHOW_CLASSES[type];
260
+
261
+        if(element.classList.contains(className)) {
262
+            element.classList.remove(className);
249 263
         }
250 264
 
251 265
         element.classList.add('hide');
252 266
     },
253 267
 
268
+    /**
269
+     * Returns default display style for the tag
270
+     * @param tag
271
+     * @returns {*}
272
+     */
273
+    getElementDefaultDisplay(tag) {
274
+        let tempElement = document.createElement(tag);
275
+
276
+        document.body.appendChild(tempElement);
277
+        let style = window.getComputedStyle(tempElement).display;
278
+        document.body.removeChild(tempElement);
279
+
280
+        return style;
281
+    },
282
+
254 283
     /**
255 284
      * Shows / hides the element with the given jQuery selector.
256 285
      *

Notiek ielāde…
Atcelt
Saglabāt