var queue = [];
var isCommandRunning = false;
// show the debug window by pressing the "d" key
window.addEventListener("keyup", function(evt) {
if(evt.keyCode == 68) {
document.documentElement.classList.toggle("is-debug-mode");
}
}, false);
// preset buttons
var presets = document.querySelectorAll(".preset-btn");
for(var i=0;i" + str + "
";
}
function debugHR() {
console.log("------------------------------------------");
document.querySelector(".debug").innerHTML += "
";
}
// commands
function runNextCommand() {
isCommandRunning = true;
if(queue.length == 0) {
isCommandRunning = false;
debug("All commands are complete.");
return;
}
var command = queue.shift();
debug("Running command :: " + command.instruction);
reqwest({
url: "./" + command.instruction + ".php",
method: "get",
data: command.args,
success: function(data) {
debugHR();
debug(data);
debugHR();
debug("Finished!");
runNextCommand();
}
});
}