2013-08-16 22:28:58 +02:00
|
|
|
var debugMode = false; // debug mode
|
|
|
|
var sendPrintCommands = true; // if Doodle3d should send print commands to the 3d printer
|
|
|
|
var communicateWithWifibox = true; // if Doodle3d should try interfacing with the wifibox (in case one is not connected)
|
2013-08-20 10:55:08 +02:00
|
|
|
var wifiboxIsRemote = false; // when you want to run the client on a computer and have it remotely connect to the wifibox
|
2013-08-07 20:47:47 +02:00
|
|
|
|
|
|
|
var printer = new Printer();
|
2013-08-09 22:25:14 +02:00
|
|
|
|
2013-08-07 20:47:47 +02:00
|
|
|
$(function() {
|
|
|
|
console.log("ready");
|
2013-08-16 22:28:58 +02:00
|
|
|
|
|
|
|
if (getURLParameter("d") != "null") debugMode = (getURLParameter("d") == "1");
|
|
|
|
if (getURLParameter("p") != "null") sendPrintCommands = (getURLParameter("p") == "1");
|
|
|
|
if (getURLParameter("c") != "null") communicateWithWifibox = (getURLParameter("c") == "1");
|
|
|
|
if (getURLParameter("r") != "null") wifiboxIsRemote = (getURLParameter("r") == "1");
|
|
|
|
|
2013-08-19 17:55:01 +02:00
|
|
|
|
|
|
|
if (wifiboxIsRemote) {
|
|
|
|
wifiboxURL = "http://192.168.5.1/cgi-bin/d3dapi";
|
|
|
|
} else {
|
|
|
|
wifiboxURL = "http://" + window.location.host + "/cgi-bin/d3dapi";
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!communicateWithWifibox) {
|
2013-08-16 22:28:58 +02:00
|
|
|
sendPrintCommands = false; // 'communicateWithWifibox = false' implies this
|
|
|
|
}
|
|
|
|
console.log("debugMode: " + debugMode);
|
|
|
|
console.log("sendPrintCommands: " + sendPrintCommands);
|
|
|
|
console.log("communicateWithWifibox: " + communicateWithWifibox);
|
|
|
|
console.log("wifiboxIsRemote: " + wifiboxIsRemote);
|
2013-08-07 20:47:47 +02:00
|
|
|
console.log("wifibox URL: " + wifiboxURL);
|
2013-08-09 22:25:14 +02:00
|
|
|
|
2013-08-07 20:47:47 +02:00
|
|
|
initLayouting();
|
|
|
|
|
|
|
|
initDoodleDrawing();
|
|
|
|
initPreviewRendering();
|
|
|
|
|
2013-08-21 17:37:20 +02:00
|
|
|
|
2013-08-07 20:47:47 +02:00
|
|
|
initButtonBehavior();
|
|
|
|
|
|
|
|
initSettingsPopup(wifiboxURL);
|
|
|
|
|
|
|
|
$("#settings .settings").load("settings.html", function() {
|
2013-08-16 22:28:58 +02:00
|
|
|
if (communicateWithWifibox) {
|
|
|
|
console.log("finished loading settings.html, now loading settings...");
|
|
|
|
loadSettings();
|
|
|
|
} else {
|
|
|
|
console.log("finished loading settings.html >> communicateWithWifibox is false: not loading settings");
|
|
|
|
}
|
2013-08-07 20:47:47 +02:00
|
|
|
});
|
|
|
|
|
2013-08-16 22:28:58 +02:00
|
|
|
if(debugMode) {
|
|
|
|
console.log("debug mode is true");
|
2013-08-07 20:47:47 +02:00
|
|
|
$("body").css("overflow", "auto");
|
|
|
|
$("#debug_textArea").css("display", "block");
|
2013-08-21 17:37:20 +02:00
|
|
|
$("#preview_tmp").css("display", "block");
|
2013-08-07 20:47:47 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
printer.init();
|
2013-08-16 22:28:58 +02:00
|
|
|
if (communicateWithWifibox) printer.preheat();
|
2013-08-07 20:47:47 +02:00
|
|
|
|
2013-08-09 22:25:14 +02:00
|
|
|
$(document).on(Printer.UPDATE,update);
|
2013-08-07 20:47:47 +02:00
|
|
|
|
|
|
|
})
|