mirror of
https://github.com/jellyfin/jellyfin-web.git
synced 2024-11-17 10:58:20 -07:00
Extract setVolume/setVolumeDelayed
This commit is contained in:
parent
ad0b67d2f6
commit
4ea3b98c27
@ -1405,39 +1405,28 @@ define(["playbackManager", "dom", "inputManager", "datetime", "itemHelper", "med
|
|||||||
}, options);
|
}, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function setVolume() {
|
||||||
|
clearTimeout(volumeSliderTimer);
|
||||||
|
volumeSliderTimer = null;
|
||||||
|
|
||||||
|
playbackManager.setVolume(this.value, currentPlayer);
|
||||||
|
}
|
||||||
|
|
||||||
|
function setVolumeDelayed() {
|
||||||
|
if (!volumeSliderTimer) {
|
||||||
|
var that = this;
|
||||||
|
volumeSliderTimer = setTimeout(function () {
|
||||||
|
setVolume.call(that);
|
||||||
|
}, 700);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
view.querySelector(".buttonMute").addEventListener("click", function () {
|
view.querySelector(".buttonMute").addEventListener("click", function () {
|
||||||
playbackManager.toggleMute(currentPlayer);
|
playbackManager.toggleMute(currentPlayer);
|
||||||
});
|
});
|
||||||
nowPlayingVolumeSlider.addEventListener("change", function () {
|
nowPlayingVolumeSlider.addEventListener("change", setVolume);
|
||||||
if (volumeSliderTimer) {
|
nowPlayingVolumeSlider.addEventListener("mousemove", setVolumeDelayed);
|
||||||
// interupt and remove existing timer
|
nowPlayingVolumeSlider.addEventListener("touchmove", setVolumeDelayed);
|
||||||
clearTimeout(volumeSliderTimer);
|
|
||||||
volumeSliderTimer = null;
|
|
||||||
}
|
|
||||||
playbackManager.setVolume(this.value, currentPlayer);
|
|
||||||
});
|
|
||||||
nowPlayingVolumeSlider.addEventListener("mousemove", function () {
|
|
||||||
if (!volumeSliderTimer) {
|
|
||||||
var that = this;
|
|
||||||
// register new timer
|
|
||||||
volumeSliderTimer = setTimeout(function() {
|
|
||||||
playbackManager.setVolume(that.value, currentPlayer);
|
|
||||||
// delete timer after completion
|
|
||||||
volumeSliderTimer = null;
|
|
||||||
}, 700);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
nowPlayingVolumeSlider.addEventListener("touchmove", function () {
|
|
||||||
if (!volumeSliderTimer) {
|
|
||||||
var that = this;
|
|
||||||
// register new timer
|
|
||||||
volumeSliderTimer = setTimeout(function() {
|
|
||||||
playbackManager.setVolume(that.value, currentPlayer);
|
|
||||||
// delete timer after completion
|
|
||||||
volumeSliderTimer = null;
|
|
||||||
}, 700);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
nowPlayingPositionSlider.addEventListener("change", function () {
|
nowPlayingPositionSlider.addEventListener("change", function () {
|
||||||
var player = currentPlayer;
|
var player = currentPlayer;
|
||||||
|
Loading…
Reference in New Issue
Block a user