diff --git a/console.html b/console.html index 62b3f83..efd0c99 100644 --- a/console.html +++ b/console.html @@ -1,5 +1,7 @@ + +
@@ -11,47 +13,11 @@ \ No newline at end of file diff --git a/scripts/console.js b/scripts/console.js new file mode 100644 index 0000000..0253c08 --- /dev/null +++ b/scripts/console.js @@ -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, "

"); + } + }; + + // Converting JSON data to string + var data = JSON.stringify({ "k": key, "request": "invoke", "payload": payload }); + + // Sending data with the request + client.send(data); +} \ No newline at end of file diff --git a/styles/console.css b/styles/console.css new file mode 100644 index 0000000..c988ca8 --- /dev/null +++ b/styles/console.css @@ -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; +} \ No newline at end of file