jellyfin-web/dashboard-ui/bower_components/emby-webcomponents/fullscreen/fullscreen-doubleclick.js

26 lines
616 B
JavaScript
Raw Normal View History

2016-09-03 10:58:23 -07:00
define(['dom', 'fullscreenManager'], function (dom, fullscreenManager) {
2016-10-17 22:06:48 -07:00
'use strict';
2016-09-03 10:58:23 -07:00
2017-01-03 23:49:00 -07:00
function isTargetValid(target) {
2016-09-03 10:58:23 -07:00
2017-01-03 23:49:00 -07:00
if (dom.parentWithTag(target, ['BUTTON', 'INPUT', 'TEXTAREA'])) {
return false;
}
return true;
}
dom.addEventListener(window, 'dblclick', function (e) {
if (isTargetValid(e.target)) {
if (fullscreenManager.isFullScreen()) {
fullscreenManager.exitFullscreen();
} else {
fullscreenManager.requestFullscreen();
}
2016-09-03 10:58:23 -07:00
}
}, {
passive: true
});
});