0
0
mirror of https://github.com/Doodle3D/doodle3d-client.git synced 2024-11-22 01:07:56 +01:00

Code formatting.

This commit is contained in:
Wouter R 2014-03-05 13:49:15 +01:00
parent 5c5d45088a
commit 2457ce656e
2 changed files with 414 additions and 407 deletions

View File

@ -72,7 +72,7 @@ function Printer() {
//this.wifiboxURL = "proxy5.php"; //this.wifiboxURL = "proxy5.php";
//console.log(" wifiboxURL: ",this.wifiboxURL); //console.log(" wifiboxURL: ",this.wifiboxURL);
if(autoUpdate) { if (autoUpdate) {
this.startStatusCheckInterval(); this.startStatusCheckInterval();
} }
} }
@ -146,9 +146,11 @@ function Printer() {
this.sendPrintPart(this.sendIndex, this.sendLength); this.sendPrintPart(this.sendIndex, this.sendLength);
} }
this.byteSize = function(s){ this.byteSize = function(s){
return~-encodeURI(s).split(/%..|./).length; return~-encodeURI(s).split(/%..|./).length;
} }
this.sendPrintPart = function(sendIndex,sendLength) { this.sendPrintPart = function(sendIndex,sendLength) {
console.log("Printer:sendPrintPart sendIndex: " + sendIndex + "/" + this.gcode.length + ", sendLength: " + sendLength); console.log("Printer:sendPrintPart sendIndex: " + sendIndex + "/" + this.gcode.length + ", sendLength: " + sendLength);
@ -258,6 +260,7 @@ function Printer() {
console.log ("Printer >> f:communicateWithWifibox() >> communicateWithWifibox is false, so not executing this function"); console.log ("Printer >> f:communicateWithWifibox() >> communicateWithWifibox is false, so not executing this function");
} }
} }
this.startStatusCheckInterval = function() { this.startStatusCheckInterval = function() {
console.log("Printer:startStatusCheckInterval"); console.log("Printer:startStatusCheckInterval");
self.checkStatus(); self.checkStatus();
@ -265,11 +268,13 @@ function Printer() {
clearTimeout(self.retryCheckStatusDelay); clearTimeout(self.retryCheckStatusDelay);
self.checkStatusDelay = setTimeout(function() { self.checkStatus() }, self.checkStatusInterval); self.checkStatusDelay = setTimeout(function() { self.checkStatus() }, self.checkStatusInterval);
} }
this.stopStatusCheckInterval = function() { this.stopStatusCheckInterval = function() {
console.log("Printer:stopStatusCheckInterval"); console.log("Printer:stopStatusCheckInterval");
clearTimeout(self.checkStatusDelay); clearTimeout(self.checkStatusDelay);
clearTimeout(self.retryCheckStatusDelay); clearTimeout(self.retryCheckStatusDelay);
} }
this.checkStatus = function() { this.checkStatus = function() {
//console.log("Printer:checkStatus"); //console.log("Printer:checkStatus");
this.stateOverruled = false; this.stateOverruled = false;
@ -301,6 +306,7 @@ function Printer() {
console.log ("Printer >> f:checkStatus() >> communicateWithWifibox is false, so not executing this function"); console.log ("Printer >> f:checkStatus() >> communicateWithWifibox is false, so not executing this function");
} }
} }
this.handleStatusUpdate = function(response) { this.handleStatusUpdate = function(response) {
//console.log("Printer:handleStatusUpdate response: ",response); //console.log("Printer:handleStatusUpdate response: ",response);
var data = response.data; var data = response.data;
@ -332,6 +338,7 @@ function Printer() {
} }
$(document).trigger(Printer.UPDATE); $(document).trigger(Printer.UPDATE);
} }
this.overruleState = function(newState) { this.overruleState = function(newState) {
this.stateOverruled = true; this.stateOverruled = true;
console.log(" stateOverruled: ",this.stateOverruled); console.log(" stateOverruled: ",this.stateOverruled);
@ -346,6 +353,7 @@ function Printer() {
this.removeLeaveWarning = function() { this.removeLeaveWarning = function() {
window.onbeforeunload = null; window.onbeforeunload = null;
} }
this.addLeaveWarning = function() { this.addLeaveWarning = function() {
window.onbeforeunload = function() { window.onbeforeunload = function() {
console.log("WARNING:"+Printer.ON_BEFORE_UNLOAD_MESSAGE); console.log("WARNING:"+Printer.ON_BEFORE_UNLOAD_MESSAGE);

View File

@ -91,7 +91,7 @@ function initButtonBehavior() {
function onBtnToggleVerticalShapes() { function onBtnToggleVerticalShapes() {
var btnImg; var btnImg;
if(buttonGroupVerticalShapes.is(":hidden")) { if (buttonGroupVerticalShapes.is(":hidden")) {
btnImg = "img/buttons/btnArrowClose.png"; btnImg = "img/buttons/btnArrowClose.png";
} else { } else {
btnImg = "img/buttons/btnArrowOpen.png"; btnImg = "img/buttons/btnArrowOpen.png";
@ -104,6 +104,7 @@ function initButtonBehavior() {
function onLogo() { function onLogo() {
location.reload(); location.reload();
} }
function onBtnAdd() { function onBtnAdd() {
buttonGroupAdd.fadeToggle(BUTTON_GROUP_SHOW_DURATION); buttonGroupAdd.fadeToggle(BUTTON_GROUP_SHOW_DURATION);
} }
@ -337,8 +338,6 @@ function resetTwist() {
} }
function update() { function update() {
setState(printer.state,printer.hasControl); setState(printer.state,printer.hasControl);
thermometer.update(printer.temperature, printer.targetTemperature); thermometer.update(printer.temperature, printer.targetTemperature);