1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

Show slideshow OSD on click

This commit is contained in:
Dmitry Lyzo 2022-02-26 12:15:03 +03:00
parent 56080df163
commit e2cf3e0148

View file

@ -216,29 +216,32 @@ export default function (options) {
dialogHelper.close(dialog);
});
dialog.querySelector('.btnSlideshowPrevious')?.addEventListener('click', getClickHandler(null));
dialog.querySelector('.btnSlideshowNext')?.addEventListener('click', getClickHandler(null));
const btnPause = dialog.querySelector('.btnSlideshowPause');
if (btnPause) {
btnPause.addEventListener('click', playPause);
btnPause.addEventListener('click', getClickHandler(playPause));
}
const btnDownload = dialog.querySelector('.btnDownload');
if (btnDownload) {
btnDownload.addEventListener('click', download);
btnDownload.addEventListener('click', getClickHandler(download));
}
const btnShare = dialog.querySelector('.btnShare');
if (btnShare) {
btnShare.addEventListener('click', share);
btnShare.addEventListener('click', getClickHandler(share));
}
const btnFullscreen = dialog.querySelector('.btnFullscreen');
if (btnFullscreen) {
btnFullscreen.addEventListener('click', fullscreen);
btnFullscreen.addEventListener('click', getClickHandler(fullscreen));
}
const btnFullscreenExit = dialog.querySelector('.btnFullscreenExit');
if (btnFullscreenExit) {
btnFullscreenExit.addEventListener('click', fullscreenExit);
btnFullscreenExit.addEventListener('click', getClickHandler(fullscreenExit));
}
if (screenfull.isEnabled) {
@ -756,6 +759,17 @@ export default function (options) {
}
}
/**
* Constructs click event handler.
* @param {function|null|undefined} callback - Click event handler.
*/
function getClickHandler(callback) {
return (e) => {
showOsd();
callback?.(e);
};
}
/**
* Shows the slideshow component.
*/