television

a simple LAN/WLAN desktop public broadcasting service
Log | Files | Refs | README

commit c32ef3d980c235d35f2f75e0c18863db8711ea97
parent 9e03c48f1367852d53360f6d5d85dde6a1c261bf
Author: ugrnm <ultrageranium@bleu255.com>
Date:   Sat, 14 Sep 2024 23:39:07 +0200

press 'f' to toggle fullscreen

Diffstat:
Mwww/tv.js | 22++++++++++++++++++++++
1 file changed, 22 insertions(+), 0 deletions(-)

diff --git a/www/tv.js b/www/tv.js @@ -10,3 +10,25 @@ setInterval(function(){ document.getElementById("television").src="/tv.jpg#" + Date.now(); }, 1000); + +// Press 'f' to enter fullscreen +// Press 'f' again to exit fullscreen +// +function toggleFullScreen() { + if (!document.fullscreenElement) { + document.documentElement.requestFullscreen(); + } else if (document.exitFullscreen) { + document.exitFullscreen(); + } +} + +document.addEventListener( + "keydown", + (e) => { + if (e.key === "f") { + toggleFullScreen(); + } + }, + false, +); +