2017-08-30 19:44:29 +02:00
|
|
|
import {printArray} from "./HelperFunctions.js";
|
2017-06-17 20:19:37 +02:00
|
|
|
|
|
|
|
$(document).keydown(function(event) {
|
|
|
|
if (logBoxOpened && event.keyCode == 27) {
|
|
|
|
logBoxClose();
|
|
|
|
}
|
|
|
|
});
|
2017-08-30 19:44:29 +02:00
|
|
|
|
2017-06-15 03:19:52 +02:00
|
|
|
function logBoxInit() {
|
|
|
|
var closeButton = document.getElementById("log-box-close");
|
|
|
|
logBoxClose();
|
2017-08-30 19:44:29 +02:00
|
|
|
|
2017-06-15 03:19:52 +02:00
|
|
|
//Close Dialog box
|
|
|
|
closeButton.addEventListener("click", function() {
|
|
|
|
logBoxClose();
|
|
|
|
return false;
|
|
|
|
});
|
|
|
|
};
|
|
|
|
|
|
|
|
document.addEventListener("DOMContentLoaded", logBoxInit, false);
|
|
|
|
|
2017-08-30 19:44:29 +02:00
|
|
|
function logBoxClose() {
|
2017-06-15 03:19:52 +02:00
|
|
|
logBoxOpened = false;
|
|
|
|
var logBox = document.getElementById("log-box-container");
|
|
|
|
logBox.style.display = "none";
|
|
|
|
}
|
|
|
|
|
2017-08-30 19:44:29 +02:00
|
|
|
function logBoxOpen() {
|
2017-06-15 03:19:52 +02:00
|
|
|
logBoxOpened = true;
|
2017-08-30 19:44:29 +02:00
|
|
|
|
2017-06-15 03:19:52 +02:00
|
|
|
var logBox = document.getElementById("log-box-container");
|
|
|
|
logBox.style.display = "block";
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
var logBoxOpened = false;
|
|
|
|
var logBoxCurrentScript = null;
|
|
|
|
//ram argument is in GB
|
2017-08-30 19:44:29 +02:00
|
|
|
function logBoxCreate(script) {
|
2017-06-15 03:19:52 +02:00
|
|
|
logBoxCurrentScript = script;
|
|
|
|
logBoxOpen();
|
|
|
|
logBoxUpdateText();
|
|
|
|
}
|
|
|
|
|
2017-08-30 19:44:29 +02:00
|
|
|
function logBoxUpdateText() {
|
2017-06-15 03:19:52 +02:00
|
|
|
var txt = document.getElementById("log-box-text");
|
|
|
|
if (logBoxCurrentScript && logBoxOpened && txt) {
|
2017-06-20 22:36:48 +02:00
|
|
|
txt.innerHTML = logBoxCurrentScript.filename + printArray(logBoxCurrentScript.args) + ":<br><br>";
|
2017-06-15 03:19:52 +02:00
|
|
|
for (var i = 0; i < logBoxCurrentScript.logs.length; ++i) {
|
|
|
|
txt.innerHTML += logBoxCurrentScript.logs[i];
|
|
|
|
txt.innerHTML += "<br>";
|
|
|
|
}
|
|
|
|
}
|
2017-08-30 19:44:29 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
export {logBoxCreate, logBoxUpdateText, logBoxOpened, logBoxCurrentScript};
|