do some things

This commit is contained in:
2022-06-12 09:38:38 +02:00
parent 67c1e35608
commit 204d55d514
81 changed files with 1342 additions and 844 deletions

15
website/index.html Normal file
View File

@@ -0,0 +1,15 @@
<!DOCTYPE html>
<html lang="en">
<head>
<script src="/socket.io/socket.io.js"></script>
<link rel="stylesheet" href="style.css">
<meta charset="utf-8">
<script src="jquery.js"></script>
<script src="script.js" ></script>
</head>
<body>
<div id="consolecont">
<textarea id="console" readonly></textarea>
</div>
</body>
</html>

2
website/jquery.js vendored Normal file

File diff suppressed because one or more lines are too long

75
website/script.js Normal file
View File

@@ -0,0 +1,75 @@
function addareacontent(content){
//this appends to the bottom of the console and scrolls to the bottom make sure we start typing at the bottom
var console = document.getElementById("console");
console.innerHTML = content;
console.scrollTop = console.scrollHeight;
}
function resizeit(){
$('#consolecont').css('height', $(window).height() - 10);
let height = ($(window).height() - $('#console').offset().top)*0.96;
$('#console').css('height', height);
$('#rows').val($(window).height() - $('#console').offset().top - 10);
}
$(document).ready(function(){
//fit console to screen
//$('#console').css('height', $(window).height() - $('#console').offset().top - 10);
//account for the input box
let host = 'ws://127.0.0.1:8480';
socket = io.connect(host);
resizeit();
//resize it on window resize
$(window).resize(function(){
resizeit();
});
//on key press on any part of html page
$("#console").keyup(function(e){
//if enter key is pressed
//get the input
e.preventDefault();
//resolve e.code to char
let key = e.which;
//send to server via socket if connected
if (key == 8){
socket.emit('keypress', key);
}
});
$("#console").keypress(function(e){
//if enter key is pressed
//get the input
e.preventDefault();
//resolve e.code to char
let key = e.which;
//send to server via socket if connected
socket.emit('keypress', key);
});
//connect to the server
//on connect
socket.on('connect', function(){
addareacontent("Connected to server");
});
//on disconnect
socket.on('disconnect', function(){
addareacontent("Disconnected from server");
});
//on error
socket.on('error', function(err){
addareacontent("Error: " + err);
});
//on message
socket.on('buffer', function(msg){
addareacontent(msg);
});
})
function flash(){
//if u+2800 is present in the console then replace it with 2588
let console = document.getElementById("console");
if(console.innerHTML.indexOf("\u2800") > -1){
console.innerHTML = console.innerHTML.replace("\u2800", "\u2588");
}
else{
console.innerHTML = console.innerHTML.replace("\u2588", "\u2800");
}
}
setInterval(flash, 500);

23
website/style.css Normal file
View File

@@ -0,0 +1,23 @@
.error {
color: red;
}
#console {
background: #000;
width: 99%;
color: #0F0;
margin: 0;
border-color: #00AC00;
}
#consolecont{
width: 100%;
height: 100%;
overflow: auto;
}
body{
width: 100%;
height: 100%;
margin: 0;
}
*{
background-color: #000;
}