fekalnigtacko/shell.html
2026-03-14 22:07:40 +01:00

138 lines
3.7 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Fekalni gtacko</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
<style>
html,
body {
margin: 0;
padding: 0;
overflow: hidden;
height: 100%;
background: black;
color: aqua;
font-family: Verdana, Geneva, Tahoma, sans-serif;
text-align: center;
}
canvas {
display: block;
width: 100vw;
height: 100vh;
}
#vyplnitmeno{
font-size: 100pt;
color: red;
font-weight: bold;
margin: 0;
margin-bottom: 100px;
}
#okbut
{
font-size: 20pt;
font-weight: bold;
padding: 10pt;
margin: 10pt;
}
#name, #url
{
font-size: 150%;
margin: 10pt;
}
</style>
</head>
<body>
<canvas id="canvas" oncontextmenu="event.preventDefault()" style="display:none"></canvas>
<div id="loginform">
<h1>fekální gtačko</h1>
<form>
kdo <input type="text" name="name" id="name" placeholder="vyplnit"><br>
<p id="vyplnitmeno" style="display:none">^ vyplnit</p>
kam <input type="text" name="url" id="url" value="ws://deadfish.cz:11200/ws"><br>
<input id="okbut" type="button" value="0k" onclick="ok()">
</form>
</div>
<script>
var inited = false;
var Module = {
preRun: [],
postRun: [],
canvas: (function() {
return document.getElementById('canvas');
})(),
onRuntimeInitialized: function() {
inited = true;
}
};
// Resize canvas to fit the window and inform SDL (via Emscripten)
function resizeCanvas() {
const canvas = document.getElementById('canvas');
canvas.width = window.innerWidth;
canvas.height = window.innerHeight;
// // Notify Emscripten SDL2
// if (typeof Module !== 'undefined' && Module.canvas) {
// const evt = new CustomEvent('resize');
// window.dispatchEvent(evt);
// }
}
window.addEventListener('resize', resizeCanvas);
window.addEventListener('load', resizeCanvas);
function ok()
{
if (!inited)
return;
const name = document.getElementById("name").value;
const url = document.getElementById("url").value;
if (name == "") {
document.getElementById("vyplnitmeno").style = "";
return;
}
localStorage.setItem("fg_name", name);
localStorage.setItem("fg_url", url);
Module.ccall("SetName", null, ["string"], [name]);
Module.ccall("SetUrl", null, ["string"], [url]);
document.getElementById("loginform").style = "display:none";
document.getElementById("canvas").style = "";
Module.ccall("RunMain", null, [], []);
}
function loadConfig()
{
const saved_name = localStorage.getItem("fg_name");
const saved_url = localStorage.getItem("fg_url");
if (saved_name != null)
document.getElementById("name").value = saved_name;
if (saved_url != null)
document.getElementById("url").value = saved_url;
}
loadConfig();
</script>
{{{ SCRIPT }}}
</body>
</html>