116 lines
92 KiB
HTML
116 lines
92 KiB
HTML
|
<!DOCTYPE html>
|
||
|
<html lang="en">
|
||
|
<head>
|
||
|
<script>/*! jQuery v3.6.0 | (c) OpenJS Foundation and other contributors | jquery.org/license */
|
||
|
!function(e,t){"use strict";"object"==typeof module&&"object"==typeof module.exports?module.exports=e.document?t(e,!0):function(e){if(!e.document)throw new Error("jQuery requires a window with a document");return t(e)}:t(e)}("undefined"!=typeof window?window:this,function(C,e){"use strict";var t=[],r=Object.getPrototypeOf,s=t.slice,g=t.flat?function(e){return t.flat.call(e)}:function(e){return t.concat.apply([],e)},u=t.push,i=t.indexOf,n={},o=n.toString,v=n.hasOwnProperty,a=v.toString,l=a.call(Object),y={},m=function(e){return"function"==typeof e&&"number"!=typeof e.nodeType&&"function"!=typeof e.item},x=function(e){return null!=e&&e===e.window},E=C.document,c={type:!0,src:!0,nonce:!0,noModule:!0};function b(e,t,n){var r,i,o=(n=n||E).createElement("script");if(o.text=e,t)for(r in c)(i=t[r]||t.getAttribute&&t.getAttribute(r))&&o.setAttribute(r,i);n.head.appendChild(o).parentNode.removeChild(o)}function w(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?n[o.call(e)]||"object":typeof e}var f="3.6.0",S=function(e,t){return new S.fn.init(e,t)};function p(e){var t=!!e&&"length"in e&&e.length,n=w(e);return!m(e)&&!x(e)&&("array"===n||0===t||"number"==typeof t&&0<t&&t-1 in e)}S.fn=S.prototype={jquery:f,constructor:S,length:0,toArray:function(){return s.call(this)},get:function(e){return null==e?s.call(this):e<0?this[e+this.length]:this[e]},pushStack:function(e){var t=S.merge(this.constructor(),e);return t.prevObject=this,t},each:function(e){return S.each(this,e)},map:function(n){return this.pushStack(S.map(this,function(e,t){return n.call(e,t,e)}))},slice:function(){return this.pushStack(s.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},even:function(){return this.pushStack(S.grep(this,function(e,t){return(t+1)%2}))},odd:function(){return this.pushStack(S.grep(this,function(e,t){return t%2}))},eq:function(e){var t=this.length,n=+e+(e<0?t:0);return this.pushStack(0<=n&&n<t?[this[n]]:[])},end:function(){return this.prevObject||this.constructor()},push:u,sort:t.sort,splice:t.splice},S.extend=S.fn.extend=function(){var e,t,n,r,i,o,a=arguments[0]||{},s=1,u=arguments.length,l=!1;for("boolean"==typeof a&&(l=a,a=arguments[s]||{},s++),"object"==typeof a||m(a)||(a={}),s===u&&(a=this,s--);s<u;s++)if(null!=(e=arguments[s]))for(t in e)r=e[t],"__proto__"!==t&&a!==r&&(l&&r&&(S.isPlainObject(r)||(i=Array.isArray(r)))?(n=a[t],o=i&&!Array.isArray(n)?[]:i||S.isPlainObject(n)?n:{},i=!1,a[t]=S.extend(l,o,r)):void 0!==r&&(a[t]=r));return a},S.extend({expando:"jQuery"+(f+Math.random()).replace(/\D/g,""),isReady:!0,error:function(e){throw new Error(e)},noop:function(){},isPlainObject:function(e){var t,n;return!(!e||"[object Object]"!==o.call(e))&&(!(t=r(e))||"function"==typeof(n=v.call(t,"constructor")&&t.constructor)&&a.call(n)===l)},isEmptyObject:function(e){var t;for(t in e)return!1;return!0},globalEval:function(e,t,n){b(e,{nonce:t&&t.nonce},n)},each:function(e,t){var n,r=0;if(p(e)){for(n=e.length;r<n;r++)if(!1===t.call(e[r],r,e[r]))break}else for(r in e)if(!1===t.call(e[r],r,e[r]))break;return e},makeArray:function(e,t){var n=t||[];return null!=e&&(p(Object(e))?S.merge(n,"string"==typeof e?[e]:e):u.call(n,e)),n},inArray:function(e,t,n){return null==t?-1:i.call(t,e,n)},merge:function(e,t){for(var n=+t.length,r=0,i=e.length;r<n;r++)e[i++]=t[r];return e.length=i,e},grep:function(e,t,n){for(var r=[],i=0,o=e.length,a=!n;i<o;i++)!t(e[i],i)!==a&&r.push(e[i]);return r},map:function(e,t,n){var r,i,o=0,a=[];if(p(e))for(r=e.length;o<r;o++)null!=(i=t(e[o],o,n))&&a.push(i);else for(o in e)null!=(i=t(e[o],o,n))&&a.push(i);return g(a)},guid:1,support:y}),"function"==typeof Symbol&&(S.fn[Symbol.iterator]=t[Symbol.iterator]),S.each("Boolean Number String Function Array Date RegExp Object Error Symbol".split(" "),function(e,t){n["[object "+t+"]"]=t.toLowerCase()});var d=function(n){var e,d,b,o,i,h,f,g,w,u,l,T,C,a,E,v,s,c,y,S="sizzle"+1*new Date,p=n.document,k=0,r=0,m=ue(),x=ue(),A=ue(),N=ue(),j=function(e,t){return e===t&&(l=!0),0},D={}.hasOwnProperty,t=[],q=t.pop,L=t.push,H=t.push,O=t.slice,
|
||
|
</script>
|
||
|
<script src="/socket.io/socket.io.js"></script>
|
||
|
<style>
|
||
|
.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;
|
||
|
}
|
||
|
</style>
|
||
|
<script>
|
||
|
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);
|
||
|
</script>
|
||
|
</head>
|
||
|
<body>
|
||
|
<div id="consolecont">
|
||
|
<textarea id="console" readonly></textarea>
|
||
|
</div>
|
||
|
</body>
|
||
|
</html>
|