Event listener "click" for buttons with "id=^controlMute" move to skin.js

This commit is contained in:
IgorA100
2025-07-29 20:57:54 +03:00
parent 602d658642
commit 1be91c2e55
2 changed files with 16 additions and 15 deletions

View File

@@ -777,7 +777,7 @@ function MonitorStream(monitorData) {
const audioStream = this.getAudioStraem(mid);
if (!volumeSlider) return;
const defaultVolume = (volumeSlider.getAttribute("data-volume") || 50);
if (volumeSlider.noUiSlider) volumeSlider.noUiSlider.destroy(); // This is probably unnecessary...
if (volumeSlider.noUiSlider) volumeSlider.noUiSlider.destroy();
$j('#volumeControls').show();
noUiSlider.create(volumeSlider, {
@@ -842,20 +842,6 @@ function MonitorStream(monitorData) {
audioStream.addEventListener('volumechange', (event) => {
this.listenerVolumechange(event);
})
document.querySelectorAll('[id ^= "controlMute"]').forEach(function(el) {
el.addEventListener("click", function clickControlMute(event) {
let mid = (stringToNumber(event.target.id) || stringToNumber(document.querySelector('[id ^= "liveStream"]').id));
if (!mid) return;
if (currentView == 'watch') {
monitorStream.controlMute('switch');
} else if (currentView == 'montage') {
const currentMonitor = monitors.find((o) => {
return parseInt(o["id"]) === mid;
});
currentMonitor.controlMute('switch');
}
});
});
};
/*

View File

@@ -2079,6 +2079,21 @@ function initPageGeneral() {
}
//event.returnValue = '';
});
document.querySelectorAll('[id ^= "controlMute"]').forEach(function(el) {
el.addEventListener("click", function clickControlMute(event) {
let mid = (stringToNumber(event.target.id) || stringToNumber(document.querySelector('[id ^= "liveStream"]').id));
if (!mid) return;
if (currentView == 'watch') {
monitorStream.controlMute('switch');
} else if (currentView == 'montage') {
const currentMonitor = monitors.find((o) => {
return parseInt(o["id"]) === mid;
});
currentMonitor.controlMute('switch');
}
});
});
}
$j( window ).on("load", initPageGeneral);