mirror of
https://github.com/the-djmaze/snappymail.git
synced 2024-11-10 17:13:38 +08:00
22 lines
809 B
JavaScript
22 lines
809 B
JavaScript
import { doc, appEl, $htmlCL } from 'Common/Globals';
|
|
|
|
// Fullscreen must be on app, else other popups fail
|
|
export const
|
|
appFullscreen = () => (doc.fullscreenElement || doc.webkitFullscreenElement) === appEl,
|
|
exitFullscreen = () => appFullscreen() && (doc.exitFullscreen || doc.webkitExitFullscreen).call(doc),
|
|
isFullscreen = ko.observable(false),
|
|
toggleFullscreen = () => isFullscreen() ? exitFullscreen() : appEl.requestFullscreen();
|
|
|
|
if (appEl) {
|
|
let event = 'fullscreenchange';
|
|
if (!appEl.requestFullscreen && appEl.webkitRequestFullscreen) {
|
|
appEl.requestFullscreen = appEl.webkitRequestFullscreen;
|
|
event = 'webkit'+event;
|
|
}
|
|
if (appEl.requestFullscreen) {
|
|
doc.addEventListener(event, () => {
|
|
isFullscreen(appFullscreen());
|
|
$htmlCL.toggle('rl-fullscreen', appFullscreen());
|
|
});
|
|
}
|
|
}
|