Просмотр исходного кода

Rename functions, fix jquery element ref and indentetation

j8
yanas 8 лет назад
Родитель
Сommit
125e894624
5 измененных файлов: 46 добавлений и 42 удалений
  1. 4
    4
      conference.js
  2. 10
    10
      modules/UI/UI.js
  3. 1
    1
      modules/UI/recording/Recording.js
  4. 29
    25
      modules/UI/toolbars/Toolbar.js
  5. 2
    2
      modules/devices/mediaDeviceHelper.js

+ 4
- 4
conference.js Просмотреть файл

543
                 // if user didn't give access to mic or camera or doesn't have
543
                 // if user didn't give access to mic or camera or doesn't have
544
                 // them at all, we disable corresponding toolbar buttons
544
                 // them at all, we disable corresponding toolbar buttons
545
                 if (!tracks.find((t) => t.isAudioTrack())) {
545
                 if (!tracks.find((t) => t.isAudioTrack())) {
546
-                    APP.UI.disableMicrophoneButton(true);
546
+                    APP.UI.setMicrophoneButtonEnabled(false);
547
                 }
547
                 }
548
 
548
 
549
                 if (!tracks.find((t) => t.isVideoTrack())) {
549
                 if (!tracks.find((t) => t.isVideoTrack())) {
550
-                    APP.UI.disableCameraButton(true);
550
+                    APP.UI.setCameraButtonEnabled(false);
551
                 }
551
                 }
552
 
552
 
553
                 this._initDeviceList();
553
                 this._initDeviceList();
931
                 APP.UI.addLocalStream(stream);
931
                 APP.UI.addLocalStream(stream);
932
 
932
 
933
                 stream.videoType === 'camera'
933
                 stream.videoType === 'camera'
934
-                && APP.UI.disableCameraButton(false);
934
+                    && APP.UI.setCameraButtonEnabled(true);
935
             } else {
935
             } else {
936
                 this.videoMuted = false;
936
                 this.videoMuted = false;
937
                 this.isSharingScreen = false;
937
                 this.isSharingScreen = false;
971
                 this.audioMuted = false;
971
                 this.audioMuted = false;
972
             }
972
             }
973
 
973
 
974
-            APP.UI.disableMicrophoneButton(false);
974
+            APP.UI.setMicrophoneButtonEnabled(true);
975
             APP.UI.setAudioMuted(this.getMyUserId(), this.audioMuted);
975
             APP.UI.setAudioMuted(this.getMyUserId(), this.audioMuted);
976
         });
976
         });
977
     },
977
     },

+ 10
- 10
modules/UI/UI.js Просмотреть файл

1459
 };
1459
 };
1460
 
1460
 
1461
 /**
1461
 /**
1462
- * Disables camera toolbar button.
1462
+ * Enables / disables camera toolbar button.
1463
  *
1463
  *
1464
- * @param {boolean} disable indicates if the camera button should be disabled
1465
- * or enabled
1464
+ * @param {boolean} enabled indicates if the camera button should be enabled
1465
+ * or disabled
1466
  */
1466
  */
1467
-UI.disableCameraButton = function (disable) {
1468
-    Toolbar.disableVideoIcon(disable);
1467
+UI.setCameraButtonEnabled = function (enabled) {
1468
+    Toolbar.setVideoIconEnabled(enabled);
1469
 };
1469
 };
1470
 
1470
 
1471
 /**
1471
 /**
1472
- * Disables microphone toolbar button.
1472
+ * Enables / disables microphone toolbar button.
1473
  *
1473
  *
1474
- * @param {boolean} disable indicates if the microphone button should be
1475
- * disabled or enabled
1474
+ * @param {boolean} enabled indicates if the microphone button should be
1475
+ * enabled or disabled
1476
  */
1476
  */
1477
-UI.disableMicrophoneButton = function (disable) {
1478
-    Toolbar.disableAudioIcon(disable);
1477
+UI.setMicrophoneButtonEnabled = function (enabled) {
1478
+    Toolbar.setAudioIconEnabled(enabled);
1479
 };
1479
 };
1480
 
1480
 
1481
 UI.showRingOverLay = function () {
1481
 UI.showRingOverLay = function () {

+ 1
- 1
modules/UI/recording/Recording.js Просмотреть файл

518
      * or not
518
      * or not
519
      */
519
      */
520
     _setToolbarButtonToggled(isToggled) {
520
     _setToolbarButtonToggled(isToggled) {
521
-        ("#toolbar_button_record").toggleClass("toggled", isToggled);
521
+        $("#toolbar_button_record").toggleClass("toggled", isToggled);
522
     }
522
     }
523
 };
523
 };
524
 
524
 

+ 29
- 25
modules/UI/toolbars/Toolbar.js Просмотреть файл

598
     },
598
     },
599
 
599
 
600
     /**
600
     /**
601
-     * Marks video icon as disabled or not.
602
-     * @param {boolean} disabled if icon should look like disabled or not
601
+     * Enables / disables audio toolbar button.
602
+     *
603
+     * @param {boolean} enabled indicates if the button should be enabled
604
+     * or disabled
603
      */
605
      */
604
-    disableVideoIcon (disabled) {
606
+    setVideoIconEnabled (enabled) {
605
         var $btn = $('#toolbar_button_camera');
607
         var $btn = $('#toolbar_button_camera');
606
 
608
 
607
         $btn
609
         $btn
608
-            .prop("disabled", disabled)
609
-            .attr("data-i18n", disabled
610
-                ? "[content]toolbar.cameraDisabled"
611
-                : "[content]toolbar.videomute")
612
-            .attr("shortcut", disabled ? "" : "toggleVideoPopover");
610
+            .prop("disabled", !enabled)
611
+            .attr("data-i18n", enabled
612
+                ? "[content]toolbar.videomute"
613
+                : "[content]toolbar.cameraDisabled")
614
+            .attr("shortcut", enabled ? "toggleVideoPopover" : "");
613
 
615
 
614
-        disabled
615
-            ? $btn.attr("disabled", "disabled")
616
-            : $btn.removeAttr("disabled");
616
+        enabled
617
+            ? $btn.removeAttr("disabled")
618
+            : $btn.attr("disabled", "disabled");
617
 
619
 
618
         APP.translation.translateElement($btn);
620
         APP.translation.translateElement($btn);
619
 
621
 
620
-        disabled && this.toggleVideoIcon(disabled);
622
+        !enabled && this.toggleVideoIcon(!enabled);
621
     },
623
     },
622
 
624
 
623
     /**
625
     /**
633
     },
635
     },
634
 
636
 
635
     /**
637
     /**
636
-     * Marks audio icon as disabled or not.
637
-     * @param {boolean} disabled if icon should look like disabled or not
638
+     * Enables / disables audio toolbar button.
639
+     *
640
+     * @param {boolean} enabled indicates if the button should be enabled
641
+     * or disabled
638
      */
642
      */
639
-    disableAudioIcon (disabled) {
643
+    setAudioIconEnabled (enabled) {
640
         var $btn = $('#toolbar_button_mute');
644
         var $btn = $('#toolbar_button_mute');
641
 
645
 
642
         $btn
646
         $btn
643
-            .prop("disabled", disabled)
644
-            .attr("data-i18n", disabled
645
-                ? "[content]toolbar.micDisabled"
646
-                : "[content]toolbar.mute")
647
-            .attr("shortcut", disabled ? "" : "mutePopover");
647
+            .prop("disabled", !enabled)
648
+            .attr("data-i18n", enabled
649
+                ? "[content]toolbar.mute"
650
+                : "[content]toolbar.micDisabled")
651
+            .attr("shortcut", enabled ? "mutePopover" : "");
648
 
652
 
649
-        disabled
650
-            ? $btn.attr("disabled", "disabled")
651
-            : $btn.removeAttr("disabled");
653
+        enabled
654
+            ? $btn.removeAttr("disabled")
655
+            : $btn.attr("disabled", "disabled");
652
 
656
 
653
         APP.translation.translateElement($btn);
657
         APP.translation.translateElement($btn);
654
 
658
 
655
-        disabled && this.toggleAudioIcon(disabled);
659
+        !enabled && this.toggleAudioIcon(!enabled);
656
     },
660
     },
657
 
661
 
658
     /**
662
     /**
823
      * @param elementId the element identifier
827
      * @param elementId the element identifier
824
      * @param isToggled indicates if the element should be toggled or untoggled
828
      * @param isToggled indicates if the element should be toggled or untoggled
825
      */
829
      */
826
-        _setToggledState(elementId, isToggled) {
830
+     _setToggledState(elementId, isToggled) {
827
         $("#" + elementId).toggleClass("toggled", isToggled);
831
         $("#" + elementId).toggleClass("toggled", isToggled);
828
     }
832
     }
829
 };
833
 };

+ 2
- 2
modules/devices/mediaDeviceHelper.js Просмотреть файл

58
         // Otherwise we assume that we don't have any audio input devices
58
         // Otherwise we assume that we don't have any audio input devices
59
         // to use and that's why disable microphone button on UI.
59
         // to use and that's why disable microphone button on UI.
60
         else {
60
         else {
61
-            APP.UI.disableMicrophoneButton(true);
61
+            APP.UI.setMicrophoneButtonEnabled(false);
62
         }
62
         }
63
     } else {
63
     } else {
64
         // And here we handle case when we already have some device working,
64
         // And here we handle case when we already have some device working,
100
         // Otherwise we assume that we don't have any video input devices
100
         // Otherwise we assume that we don't have any video input devices
101
         // to use and that's why disable microphone button on UI.
101
         // to use and that's why disable microphone button on UI.
102
         else {
102
         else {
103
-            APP.UI.disableCameraButton(true);
103
+            APP.UI.setCameraButtonEnabled(false);
104
         }
104
         }
105
     } else {
105
     } else {
106
         // And here we handle case when we already have some device working,
106
         // And here we handle case when we already have some device working,

Загрузка…
Отмена
Сохранить