Преглед на файлове

Rename functions, fix jquery element ref and indentetation

j8
yanas преди 8 години
родител
ревизия
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,11 +543,11 @@ export default {
543 543
                 // if user didn't give access to mic or camera or doesn't have
544 544
                 // them at all, we disable corresponding toolbar buttons
545 545
                 if (!tracks.find((t) => t.isAudioTrack())) {
546
-                    APP.UI.disableMicrophoneButton(true);
546
+                    APP.UI.setMicrophoneButtonEnabled(false);
547 547
                 }
548 548
 
549 549
                 if (!tracks.find((t) => t.isVideoTrack())) {
550
-                    APP.UI.disableCameraButton(true);
550
+                    APP.UI.setCameraButtonEnabled(false);
551 551
                 }
552 552
 
553 553
                 this._initDeviceList();
@@ -931,7 +931,7 @@ export default {
931 931
                 APP.UI.addLocalStream(stream);
932 932
 
933 933
                 stream.videoType === 'camera'
934
-                && APP.UI.disableCameraButton(false);
934
+                    && APP.UI.setCameraButtonEnabled(true);
935 935
             } else {
936 936
                 this.videoMuted = false;
937 937
                 this.isSharingScreen = false;
@@ -971,7 +971,7 @@ export default {
971 971
                 this.audioMuted = false;
972 972
             }
973 973
 
974
-            APP.UI.disableMicrophoneButton(false);
974
+            APP.UI.setMicrophoneButtonEnabled(true);
975 975
             APP.UI.setAudioMuted(this.getMyUserId(), this.audioMuted);
976 976
         });
977 977
     },

+ 10
- 10
modules/UI/UI.js Целия файл

@@ -1459,23 +1459,23 @@ UI.onSharedVideoStop = function (id, attributes) {
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 1481
 UI.showRingOverLay = function () {

+ 1
- 1
modules/UI/recording/Recording.js Целия файл

@@ -518,7 +518,7 @@ var Recording = {
518 518
      * or not
519 519
      */
520 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,26 +598,28 @@ const Toolbar = {
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 607
         var $btn = $('#toolbar_button_camera');
606 608
 
607 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 620
         APP.translation.translateElement($btn);
619 621
 
620
-        disabled && this.toggleVideoIcon(disabled);
622
+        !enabled && this.toggleVideoIcon(!enabled);
621 623
     },
622 624
 
623 625
     /**
@@ -633,26 +635,28 @@ const Toolbar = {
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 644
         var $btn = $('#toolbar_button_mute');
641 645
 
642 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 657
         APP.translation.translateElement($btn);
654 658
 
655
-        disabled && this.toggleAudioIcon(disabled);
659
+        !enabled && this.toggleAudioIcon(!enabled);
656 660
     },
657 661
 
658 662
     /**
@@ -823,7 +827,7 @@ const Toolbar = {
823 827
      * @param elementId the element identifier
824 828
      * @param isToggled indicates if the element should be toggled or untoggled
825 829
      */
826
-        _setToggledState(elementId, isToggled) {
830
+     _setToggledState(elementId, isToggled) {
827 831
         $("#" + elementId).toggleClass("toggled", isToggled);
828 832
     }
829 833
 };

+ 2
- 2
modules/devices/mediaDeviceHelper.js Целия файл

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

Loading…
Отказ
Запис