This repository has been archived on 2024-04-03. You can view files and clone it, but cannot push or open issues or pull requests.
OLD-GZod01.fr_Source_Code-OLD/api/scripts/consoleterm.min.js

87 lines
2.5 KiB
JavaScript
Raw Normal View History

2023-03-25 09:26:41 +00:00
export {*}
function showdevconsole(){
if(document.getElementById('console')=null){document.body.innerHTML += '<div id="console" style="height=100vh; width=100%;"></div>
console.log= function(tolog){termshow('&infg&span color="grey"&supd&LOG: '+tolog+'&infg&/span&supd&')}
console.error= function(tolog){termshow('&infg&span color="red"&supd&ERROR: '+tolog+'&infg&/span&supd&')}
console.warn= function(tolog){termshow('&infg&span color="orange"&supd&WARN: '+tolog+'&infg&/span&supd&')}
function consoleloop(){
let x= terminput('')
termshow('executing : '+x+' ...')
try{
let nfunc = new Function(x)
termshow(nfunc())
}catch(e){
termshow('error: '+e)
}
}
document.getElementById('console').innerHTML = `
<style>
#console{
--bg-color: black;
--txt-color: white;
}
#console{
background-color:var(--bg-color);
color: var(--txt-color);
margin:0;
height:100%;
min-height:100vh;
display:flex;
flex-direction:column;
word-wrap: break-word;
word-break: break-all;
z-index:2
}
#console .second {
flex-grow: 1;
}
#console #termcontent{
display: fixed;
left:0;
top:0;
height:95%;
width:100%;
overflow: auto
}
#console #divinput{
display:flex;
left:0;
bottom:0;
height:5%;
width:100%
}
#console #terminpt{
border: 0px solid !important;
background-color: var(--bg-color);
color:var(--txt-color);
width:95%
}
/*#terminptdiv{
float: none
}*/
#console *:focus {
outline: none;
}
/*#divofinfos{
float:left
}*/
#console #matrixcanvas{
width:100%;
height:100%;
position:fixed;
z-index:-1
}
</style>
<!--username and ip: green, $ or %: white, commands: white-->
<div id="termcontent">
</div>
<div id="divinput">
<span id=spanofinfos><span id="inptindic"></span><span id="inptname"></span></span><span class=second><input id=terminpt type="text"/></span>
</div>
<canvas id=matrixcanvas style='width:100%; height: 100%'>
</canvas>
<script src="//api.gzod01.fr/scripts/termapi.js"></script>
<script src="console.js"></script>
`
}