Skip to content

Commit

Permalink
Clean up js from styles
Browse files Browse the repository at this point in the history
  • Loading branch information
idainatovych committed Nov 4, 2016
1 parent d7c908e commit 8e8ae88
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 15 deletions.
14 changes: 12 additions & 2 deletions modules/UI/util/UIUtil.js
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,12 @@ const SHOW_CLASSES = {
* @param {String} the identifier of the element to show
*/
showElement(id) {
let element = document.getElementById(id);
let element;
if (id instanceof HTMLElement) {
element = id;
} else {
element = document.getElementById(id);
}

if (!element) {
return;
Expand All @@ -249,7 +254,12 @@ const SHOW_CLASSES = {
* @param {String} the identifier of the element to hide
*/
hideElement(id) {
let element = document.getElementById(id);
let element;
if (id instanceof HTMLElement) {
element = id;
} else {
element = document.getElementById(id);
}

if (!element) {
return;
Expand Down
43 changes: 30 additions & 13 deletions modules/UI/videolayout/SmallVideo.js
Original file line number Diff line number Diff line change
Expand Up @@ -207,19 +207,23 @@ SmallVideo.prototype.hideIndicator = function () {
* or hidden
*/
SmallVideo.prototype.showAudioIndicator = function(isMuted) {
this.getAudioMutedIndicator().classList.toggle('hide', !isMuted);
this.isAudioMuted = isMuted;
let mutedIndicator = this.getAudioMutedIndicator();
if (isMuted) {
UIUtil.showElement(mutedIndicator);
} else {
UIUtil.hideElement(mutedIndicator);
}
};

/**
* Returns the audio muted indicator jquery object. If it doesn't exists -
* creates it.
*
* @returns {jQuery|HTMLElement} the audio muted indicator
* @returns {HTMLElement} the audio muted indicator
*/
SmallVideo.prototype.getAudioMutedIndicator = function () {
var selector = '#' + this.videoSpanId + ' .audioMuted';
var audioMutedSpan = document.querySelector(selector);
let selector = '#' + this.videoSpanId + ' .audioMuted';
let audioMutedSpan = document.querySelector(selector);

if (audioMutedSpan) {
return audioMutedSpan;
Expand All @@ -232,15 +236,14 @@ SmallVideo.prototype.getAudioMutedIndicator = function () {
"videothumbnail.mute",
"top");

let mutedIndicator = document.createElement('i');
mutedIndicator.className = 'icon-mic-disabled';
audioMutedSpan.appendChild(mutedIndicator);

this.container
.querySelector('.videocontainer__toolbar')
.appendChild(audioMutedSpan);


var mutedIndicator = document.createElement('i');
mutedIndicator.className = 'icon-mic-disabled';
audioMutedSpan.appendChild(mutedIndicator);

return audioMutedSpan;
};

Expand All @@ -254,7 +257,13 @@ SmallVideo.prototype.getAudioMutedIndicator = function () {
SmallVideo.prototype.setVideoMutedView = function(isMuted) {
this.isVideoMuted = isMuted;
this.updateView();
this.getVideoMutedIndicator().classList.toggle('hide', !isMuted);

let element = this.getVideoMutedIndicator();
if (isMuted) {
UIUtil.showElement(element);
} else {
UIUtil.hideElement(element);
}
};

/**
Expand Down Expand Up @@ -552,7 +561,11 @@ SmallVideo.prototype.showDominantSpeakerIndicator = function (show) {
tooltip: 'speaker'
});

indicatorSpan.classList.toggle('show', show);
if (show) {
UIUtil.showElement(indicatorSpan);
} else {
UIUtil.hideElement(indicatorSpan);
}
};

/**
Expand All @@ -576,7 +589,11 @@ SmallVideo.prototype.showRaisedHandIndicator = function (show) {
tooltip: 'raisedHand'
});

indicatorSpan.classList.toggle('show', show);
if (show) {
UIUtil.showElement(indicatorSpan);
} else {
UIUtil.hideElement(indicatorSpan);
}
};

/**
Expand Down

0 comments on commit 8e8ae88

Please sign in to comment.