Rename functions, fix jquery element ref and indentetation

This commit is contained in:
yanas 2016-10-07 13:55:27 -05:00
parent 0e9835dde2
commit 125e894624
5 changed files with 46 additions and 42 deletions

View File

@ -543,11 +543,11 @@ export default {
// if user didn't give access to mic or camera or doesn't have
// them at all, we disable corresponding toolbar buttons
if (!tracks.find((t) => t.isAudioTrack())) {
APP.UI.disableMicrophoneButton(true);
APP.UI.setMicrophoneButtonEnabled(false);
}
if (!tracks.find((t) => t.isVideoTrack())) {
APP.UI.disableCameraButton(true);
APP.UI.setCameraButtonEnabled(false);
}
this._initDeviceList();
@ -931,7 +931,7 @@ export default {
APP.UI.addLocalStream(stream);
stream.videoType === 'camera'
&& APP.UI.disableCameraButton(false);
&& APP.UI.setCameraButtonEnabled(true);
} else {
this.videoMuted = false;
this.isSharingScreen = false;
@ -971,7 +971,7 @@ export default {
this.audioMuted = false;
}
APP.UI.disableMicrophoneButton(false);
APP.UI.setMicrophoneButtonEnabled(true);
APP.UI.setAudioMuted(this.getMyUserId(), this.audioMuted);
});
},

View File

@ -1459,23 +1459,23 @@ UI.onSharedVideoStop = function (id, attributes) {
};
/**
* Disables camera toolbar button.
* Enables / disables camera toolbar button.
*
* @param {boolean} disable indicates if the camera button should be disabled
* or enabled
* @param {boolean} enabled indicates if the camera button should be enabled
* or disabled
*/
UI.disableCameraButton = function (disable) {
Toolbar.disableVideoIcon(disable);
UI.setCameraButtonEnabled = function (enabled) {
Toolbar.setVideoIconEnabled(enabled);
};
/**
* Disables microphone toolbar button.
* Enables / disables microphone toolbar button.
*
* @param {boolean} disable indicates if the microphone button should be
* disabled or enabled
* @param {boolean} enabled indicates if the microphone button should be
* enabled or disabled
*/
UI.disableMicrophoneButton = function (disable) {
Toolbar.disableAudioIcon(disable);
UI.setMicrophoneButtonEnabled = function (enabled) {
Toolbar.setAudioIconEnabled(enabled);
};
UI.showRingOverLay = function () {

View File

@ -518,7 +518,7 @@ var Recording = {
* or not
*/
_setToolbarButtonToggled(isToggled) {
("#toolbar_button_record").toggleClass("toggled", isToggled);
$("#toolbar_button_record").toggleClass("toggled", isToggled);
}
};

View File

@ -598,26 +598,28 @@ const Toolbar = {
},
/**
* Marks video icon as disabled or not.
* @param {boolean} disabled if icon should look like disabled or not
* Enables / disables audio toolbar button.
*
* @param {boolean} enabled indicates if the button should be enabled
* or disabled
*/
disableVideoIcon (disabled) {
setVideoIconEnabled (enabled) {
var $btn = $('#toolbar_button_camera');
$btn
.prop("disabled", disabled)
.attr("data-i18n", disabled
? "[content]toolbar.cameraDisabled"
: "[content]toolbar.videomute")
.attr("shortcut", disabled ? "" : "toggleVideoPopover");
.prop("disabled", !enabled)
.attr("data-i18n", enabled
? "[content]toolbar.videomute"
: "[content]toolbar.cameraDisabled")
.attr("shortcut", enabled ? "toggleVideoPopover" : "");
disabled
? $btn.attr("disabled", "disabled")
: $btn.removeAttr("disabled");
enabled
? $btn.removeAttr("disabled")
: $btn.attr("disabled", "disabled");
APP.translation.translateElement($btn);
disabled && this.toggleVideoIcon(disabled);
!enabled && this.toggleVideoIcon(!enabled);
},
/**
@ -633,26 +635,28 @@ const Toolbar = {
},
/**
* Marks audio icon as disabled or not.
* @param {boolean} disabled if icon should look like disabled or not
* Enables / disables audio toolbar button.
*
* @param {boolean} enabled indicates if the button should be enabled
* or disabled
*/
disableAudioIcon (disabled) {
setAudioIconEnabled (enabled) {
var $btn = $('#toolbar_button_mute');
$btn
.prop("disabled", disabled)
.attr("data-i18n", disabled
? "[content]toolbar.micDisabled"
: "[content]toolbar.mute")
.attr("shortcut", disabled ? "" : "mutePopover");
.prop("disabled", !enabled)
.attr("data-i18n", enabled
? "[content]toolbar.mute"
: "[content]toolbar.micDisabled")
.attr("shortcut", enabled ? "mutePopover" : "");
disabled
? $btn.attr("disabled", "disabled")
: $btn.removeAttr("disabled");
enabled
? $btn.removeAttr("disabled")
: $btn.attr("disabled", "disabled");
APP.translation.translateElement($btn);
disabled && this.toggleAudioIcon(disabled);
!enabled && this.toggleAudioIcon(!enabled);
},
/**
@ -823,7 +827,7 @@ const Toolbar = {
* @param elementId the element identifier
* @param isToggled indicates if the element should be toggled or untoggled
*/
_setToggledState(elementId, isToggled) {
_setToggledState(elementId, isToggled) {
$("#" + elementId).toggleClass("toggled", isToggled);
}
};

View File

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