Add info page

This commit is contained in:
Andras Schmelczer 2023-05-20 10:25:10 +01:00
commit 403400bd21
No known key found for this signature in database
GPG key ID: FC8F2C3D3D1A718C
7 changed files with 62 additions and 14 deletions

View file

@ -1,41 +0,0 @@
export class FullScreenHandler {
public constructor(
private readonly minimizeButton: HTMLElement,
private readonly maximizeButton: HTMLElement,
target: HTMLElement
) {
if (!document.fullscreenEnabled) {
minimizeButton.style.display = 'none';
maximizeButton.style.display = 'none';
return;
}
this.updateButtons();
addEventListener('keydown', (e) => {
// on full screen request, only apply it to the target
if (e.key === 'F11') {
e.preventDefault();
FullScreenHandler.isInFullScreenMode()
? document.exitFullscreen()
: target.requestFullscreen();
}
});
addEventListener('fullscreenchange', this.updateButtons.bind(this));
maximizeButton.addEventListener('click', target.requestFullscreen.bind(target));
minimizeButton.addEventListener('click', document.exitFullscreen.bind(document));
}
public static isInFullScreenMode(): boolean {
return document.fullscreenElement !== null;
}
private updateButtons() {
this.minimizeButton.style.display = FullScreenHandler.isInFullScreenMode()
? 'block'
: 'none';
this.maximizeButton.style.display = FullScreenHandler.isInFullScreenMode()
? 'none'
: 'block';
}
}