Better solution for #298

This commit is contained in:
the-djmaze 2022-03-22 16:24:58 +01:00
parent 1833388ea4
commit 91327a3c6c
6 changed files with 31 additions and 27 deletions

View file

@ -11,13 +11,6 @@ export const
elementById = id => doc.getElementById(id),
// Fullscreen must be on app, else other popups fail
app = doc.getElementById('rl-app'),
appFullscreen = () => (doc.fullscreenElement || doc.webkitFullscreenElement) === app,
exitFullscreen = () => appFullscreen() && (doc.exitFullscreen || doc.webkitExitFullscreen).call(doc),
isFullscreen = ko.observable(false),
toggleFullscreen = () => isFullscreen() ? exitFullscreen() : app.requestFullscreen(),
Settings = rl.settings,
SettingsGet = Settings.get,
SettingsCapa = Settings.capa,
@ -65,20 +58,6 @@ export const
shortcuts.setScope(value);
};
if (app) {
let event = 'fullscreenchange';
if (!app.requestFullscreen && app.webkitRequestFullscreen) {
app.requestFullscreen = app.webkitRequestFullscreen;
event = 'webkit'+event;
}
if (app.requestFullscreen) {
doc.addEventListener(event, () => {
isFullscreen(appFullscreen());
$htmlCL.toggle('rl-fullscreen', appFullscreen());
});
}
}
dropdownVisibility.subscribe(value => {
if (value) {
keyScope(ScopeMenu);