mirror of
https://github.com/SpikeHD/MojoFrontend.git
synced 2024-11-16 07:29:23 +00:00
more scaffolding
This commit is contained in:
parent
d97b1960e7
commit
cfe868f498
38
console.html
38
console.html
@ -1,5 +1,7 @@
|
||||
<html>
|
||||
<head>
|
||||
<link rel="stylesheet" type="text/css" href="styles/console.css" />
|
||||
<script src="scripts/console.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="main">
|
||||
@ -11,47 +13,11 @@
|
||||
|
||||
<!-- Styling -->
|
||||
<style>
|
||||
#main {
|
||||
background-color: #fff;
|
||||
color: #000;
|
||||
font-size: 12px;
|
||||
font-weight: bold;
|
||||
padding: 5px;
|
||||
text-align: center;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
#titleBar {
|
||||
font-size: 1.2em;
|
||||
}
|
||||
</style>
|
||||
|
||||
<!-- Javascript -->
|
||||
<script>
|
||||
function sendCommand(payload){
|
||||
let client = new XMLHttpRequest();
|
||||
let key = new window.URLSearchParams(window.location.search).get("k");
|
||||
let url = '/mojoplus/api';
|
||||
|
||||
client.open("POST", url, true);
|
||||
client.setRequestHeader("Content-Type", "application/json");
|
||||
|
||||
client.onreadystatechange = () => {
|
||||
if (client.readyState === 4 && client.status === 200) {
|
||||
let result = document.getElementById("c2");
|
||||
|
||||
// Print received data from server
|
||||
result.innerHTML = JSON.parse(this.responseText).payload.replace(/\n/g, "<p/>");
|
||||
}
|
||||
};
|
||||
|
||||
// Converting JSON data to string
|
||||
var data = JSON.stringify({ "k": key, "request": "invoke", "payload": payload });
|
||||
|
||||
// Sending data with the request
|
||||
client.send(data);
|
||||
}
|
||||
</script>
|
||||
</html>
|
23
scripts/console.js
Normal file
23
scripts/console.js
Normal file
@ -0,0 +1,23 @@
|
||||
function sendCommand(payload){
|
||||
let client = new XMLHttpRequest();
|
||||
let key = new window.URLSearchParams(window.location.search).get("k");
|
||||
let url = '/mojoplus/api';
|
||||
|
||||
client.open("POST", url, true);
|
||||
client.setRequestHeader("Content-Type", "application/json");
|
||||
|
||||
client.onreadystatechange = () => {
|
||||
if (client.readyState === 4 && client.status === 200) {
|
||||
let result = document.getElementById("c2");
|
||||
|
||||
// Print received data from server
|
||||
result.innerHTML = JSON.parse(this.responseText).payload.replace(/\n/g, "<p/>");
|
||||
}
|
||||
};
|
||||
|
||||
// Converting JSON data to string
|
||||
var data = JSON.stringify({ "k": key, "request": "invoke", "payload": payload });
|
||||
|
||||
// Sending data with the request
|
||||
client.send(data);
|
||||
}
|
19
styles/console.css
Normal file
19
styles/console.css
Normal file
@ -0,0 +1,19 @@
|
||||
body {
|
||||
font-family: Arial, Helvetica, sans-serif;
|
||||
}
|
||||
|
||||
#main {
|
||||
background-color: #fff;
|
||||
color: #000;
|
||||
font-size: 12px;
|
||||
font-weight: bold;
|
||||
padding: 5px;
|
||||
text-align: center;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
#titleBar {
|
||||
font-size: 1.2em;
|
||||
}
|
Loading…
Reference in New Issue
Block a user