1
Fork 0
mirror of https://github.com/jech/galene.git synced 2024-11-10 02:35:58 +01:00

Add some typing annotations.

This commit is contained in:
Juliusz Chroboczek 2020-11-24 15:55:12 +01:00
parent 689bc63330
commit 81db6e73eb

View file

@ -1071,14 +1071,15 @@ function registerControlEvent(peerid) {
if (volume) { if (volume) {
volume.onclick = function(event) { volume.onclick = function(event) {
event.preventDefault(); event.preventDefault();
let video = getParentVideo(event.target); let volume = /** @type{HTMLElement} */(event.target);
if(event.target.className.indexOf("fa-volume-off") !== -1) { let video = getParentVideo(volume);
event.target.classList.remove("fa-volume-off"); if(volume.className.indexOf("fa-volume-off") !== -1) {
event.target.classList.add("fa-volume-up"); volume.classList.remove("fa-volume-off");
volume.classList.add("fa-volume-up");
video.muted = false; video.muted = false;
} else { } else {
event.target.classList.remove("fa-volume-up"); volume.classList.remove("fa-volume-up");
event.target.classList.add("fa-volume-off"); volume.classList.add("fa-volume-off");
// mute video sound // mute video sound
video.muted = true; video.muted = true;
} }
@ -1090,16 +1091,19 @@ function registerControlEvent(peerid) {
if(HTMLVideoElement.prototype.requestPictureInPicture) { if(HTMLVideoElement.prototype.requestPictureInPicture) {
pip.onclick = function(event) { pip.onclick = function(event) {
event.preventDefault(); event.preventDefault();
let video = getParentVideo(event.target); let pip = /** @type{HTMLElement} */(event.target);
let video = getParentVideo(pip);
videoPIP(video); videoPIP(video);
}; };
} else { } else {
pip.style.display = 'none'; pip.style.display = 'none';
} }
peer.querySelector("span.fullscreen").onclick = function(event) { let fs = /** @type {HTMLElement} */(peer.querySelector("span.fullscreen"));
fs.onclick = function(event) {
event.preventDefault(); event.preventDefault();
let video = getParentVideo(event.target); let fs = /** @type {HTMLElement} */(event.target);
let video = getParentVideo(fs);
if(video.requestFullscreen) { if(video.requestFullscreen) {
video.requestFullscreen(); video.requestFullscreen();
} else { } else {
@ -1109,19 +1113,20 @@ function registerControlEvent(peerid) {
let camera = /** @type {HTMLElement} */(peer.querySelector("span.camera")); let camera = /** @type {HTMLElement} */(peer.querySelector("span.camera"));
if(camera) { if(camera) {
peer.querySelector("span.camera").onclick = function(event) { camera.onclick = function(event) {
event.preventDefault(); event.preventDefault();
let video = getParentVideo(event.target); let camera = /** @type {HTMLElement} */(event.target);
let video = getParentVideo(camera);
let id = video.id.split("-")[1]; let id = video.id.split("-")[1];
if(!settings.video) if(!settings.video)
return; return;
if(event.target.getAttribute("data-type") === "bt-camera") { if(camera.getAttribute("data-type") === "bt-camera") {
addLocalMedia(id, true); addLocalMedia(id, true);
event.target.setAttribute("data-type", "bt-camera-off"); camera.setAttribute("data-type", "bt-camera-off");
event.target.parentElement.classList.add("disabled"); camera.parentElement.classList.add("disabled");
} else { } else {
event.target.setAttribute("data-type", "bt-camera"); camera.setAttribute("data-type", "bt-camera");
event.target.parentElement.classList.remove("disabled"); camera.parentElement.classList.remove("disabled");
addLocalMedia(id); addLocalMedia(id);
} }
}; };