Clean up js from styles

This commit is contained in:
Ilya Daynatovich 2016-11-04 16:48:52 +02:00
parent 5aff96e3b7
commit 1b1b9475a4
2 changed files with 42 additions and 15 deletions

View File

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

View File

@ -216,19 +216,23 @@ SmallVideo.prototype.hideIndicator = function () {
* or hidden * or hidden
*/ */
SmallVideo.prototype.showAudioIndicator = function(isMuted) { SmallVideo.prototype.showAudioIndicator = function(isMuted) {
this.getAudioMutedIndicator().classList.toggle('hide', !isMuted); let mutedIndicator = this.getAudioMutedIndicator();
this.isAudioMuted = isMuted; if (isMuted) {
UIUtil.showElement(mutedIndicator);
} else {
UIUtil.hideElement(mutedIndicator);
}
}; };
/** /**
* Returns the audio muted indicator jquery object. If it doesn't exists - * Returns the audio muted indicator jquery object. If it doesn't exists -
* creates it. * creates it.
* *
* @returns {jQuery|HTMLElement} the audio muted indicator * @returns {HTMLElement} the audio muted indicator
*/ */
SmallVideo.prototype.getAudioMutedIndicator = function () { SmallVideo.prototype.getAudioMutedIndicator = function () {
var selector = '#' + this.videoSpanId + ' .audioMuted'; let selector = '#' + this.videoSpanId + ' .audioMuted';
var audioMutedSpan = document.querySelector(selector); let audioMutedSpan = document.querySelector(selector);
if (audioMutedSpan) { if (audioMutedSpan) {
return audioMutedSpan; return audioMutedSpan;
@ -241,15 +245,14 @@ SmallVideo.prototype.getAudioMutedIndicator = function () {
"videothumbnail.mute", "videothumbnail.mute",
"top"); "top");
let mutedIndicator = document.createElement('i');
mutedIndicator.className = 'icon-mic-disabled';
audioMutedSpan.appendChild(mutedIndicator);
this.container this.container
.querySelector('.videocontainer__toolbar') .querySelector('.videocontainer__toolbar')
.appendChild(audioMutedSpan); .appendChild(audioMutedSpan);
var mutedIndicator = document.createElement('i');
mutedIndicator.className = 'icon-mic-disabled';
audioMutedSpan.appendChild(mutedIndicator);
return audioMutedSpan; return audioMutedSpan;
}; };
@ -263,7 +266,13 @@ SmallVideo.prototype.getAudioMutedIndicator = function () {
SmallVideo.prototype.setVideoMutedView = function(isMuted) { SmallVideo.prototype.setVideoMutedView = function(isMuted) {
this.isVideoMuted = isMuted; this.isVideoMuted = isMuted;
this.updateView(); this.updateView();
this.getVideoMutedIndicator().classList.toggle('hide', !isMuted);
let element = this.getVideoMutedIndicator();
if (isMuted) {
UIUtil.showElement(element);
} else {
UIUtil.hideElement(element);
}
}; };
/** /**
@ -565,7 +574,11 @@ SmallVideo.prototype.showDominantSpeakerIndicator = function (show) {
tooltip: 'speaker' tooltip: 'speaker'
}); });
indicatorSpan.classList.toggle('show', show); if (show) {
UIUtil.showElement(indicatorSpan);
} else {
UIUtil.hideElement(indicatorSpan);
}
}; };
/** /**
@ -589,7 +602,11 @@ SmallVideo.prototype.showRaisedHandIndicator = function (show) {
tooltip: 'raisedHand' tooltip: 'raisedHand'
}); });
indicatorSpan.classList.toggle('show', show); if (show) {
UIUtil.showElement(indicatorSpan);
} else {
UIUtil.hideElement(indicatorSpan);
}
}; };
/** /**