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); dialogHelper.close(dialog);
}); });
dialog.querySelector('.btnSlideshowPrevious')?.addEventListener('click', getClickHandler(null));
dialog.querySelector('.btnSlideshowNext')?.addEventListener('click', getClickHandler(null));
const btnPause = dialog.querySelector('.btnSlideshowPause'); const btnPause = dialog.querySelector('.btnSlideshowPause');
if (btnPause) { if (btnPause) {
btnPause.addEventListener('click', playPause); btnPause.addEventListener('click', getClickHandler(playPause));
} }
const btnDownload = dialog.querySelector('.btnDownload'); const btnDownload = dialog.querySelector('.btnDownload');
if (btnDownload) { if (btnDownload) {
btnDownload.addEventListener('click', download); btnDownload.addEventListener('click', getClickHandler(download));
} }
const btnShare = dialog.querySelector('.btnShare'); const btnShare = dialog.querySelector('.btnShare');
if (btnShare) { if (btnShare) {
btnShare.addEventListener('click', share); btnShare.addEventListener('click', getClickHandler(share));
} }
const btnFullscreen = dialog.querySelector('.btnFullscreen'); const btnFullscreen = dialog.querySelector('.btnFullscreen');
if (btnFullscreen) { if (btnFullscreen) {
btnFullscreen.addEventListener('click', fullscreen); btnFullscreen.addEventListener('click', getClickHandler(fullscreen));
} }
const btnFullscreenExit = dialog.querySelector('.btnFullscreenExit'); const btnFullscreenExit = dialog.querySelector('.btnFullscreenExit');
if (btnFullscreenExit) { if (btnFullscreenExit) {
btnFullscreenExit.addEventListener('click', fullscreenExit); btnFullscreenExit.addEventListener('click', getClickHandler(fullscreenExit));
} }
if (screenfull.isEnabled) { 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. * Shows the slideshow component.
*/ */