neofunkin/src/webroot/buttons/openscreen.html

30 lines
No EOL
925 B
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>NeoFunkin</title>
<style>
body {
margin: 0;
padding: 0;
box-sizing: border-box;
}
</style>
</head>
<body>
<button style="width: 100vw; height: 100vh; margin: 0;">Loading</button>
<script>
const url = new URL(window.location.href);
const screen = url.searchParams.get('screen');
const display = url.searchParams.get('display') ?? screen;
document.querySelector('button').textContent = display || 'USE ?screen=...&display=...';
document.querySelector('button').addEventListener('click', () => {
const socket = new WebSocket(`ws://${window.location.host}/`);
socket.onopen = function() {
socket.send(JSON.stringify({ m: `OPENSCREEN:${screen || 'UNDEFINED'}` }))
};
});
</script>
</body>
</html>