Whitespace fixes.

This commit is contained in:
Wouter R 2014-02-24 15:58:50 +01:00
parent ce489112e8
commit afb279fbc7
2 changed files with 131 additions and 102 deletions

View File

@ -11,52 +11,52 @@ function UpdatePanel() {
this.wifiboxURL; this.wifiboxURL;
this.element; this.element;
this.statusCheckInterval = 1000; this.statusCheckInterval = 1000;
this.statusCheckDelayer; // setTimout instance this.statusCheckDelayer; // setTimout instance
this.installedDelay = 90*1000; // Since we can't retrieve status during installation we show the installed text after a fixed delay this.installedDelay = 90*1000; // Since we can't retrieve status during installation we show the installed text after a fixed delay
this.installedDelayer; // setTimout instance this.installedDelayer; // setTimout instance
this.retryDelay = 1000; this.retryDelay = 1000;
this.retryDelayer; // setTimout instance this.retryDelayer; // setTimout instance
//this.timeoutTime = 3000; //this.timeoutTime = 3000;
this.canUpdate = false; this.canUpdate = false;
this.currentVersion = ""; this.currentVersion = "";
this.newestVersion; this.newestVersion;
this.progress; this.progress;
this.imageSize; this.imageSize;
var _inAccessPointMode; var _inAccessPointMode;
// states from api, see Doodle3D firmware src/script/d3d-updater.lua // states from api, see Doodle3D firmware src/script/d3d-updater.lua
UpdatePanel.NONE = 1; // default state UpdatePanel.NONE = 1; // default state
UpdatePanel.DOWNLOADING = 2; UpdatePanel.DOWNLOADING = 2;
UpdatePanel.DOWNLOAD_FAILED = 3; UpdatePanel.DOWNLOAD_FAILED = 3;
UpdatePanel.IMAGE_READY = 4; // download successfull and checked UpdatePanel.IMAGE_READY = 4; // download successfull and checked
UpdatePanel.INSTALLING = 5; UpdatePanel.INSTALLING = 5;
UpdatePanel.INSTALLED = 6; UpdatePanel.INSTALLED = 6;
UpdatePanel.INSTALL_FAILED = 7; UpdatePanel.INSTALL_FAILED = 7;
this.state; // update state from api this.state; // update state from api
this.stateText = ""; // update state text from api this.stateText = ""; // update state text from api
var self = this; var self = this;
this.init = function(wifiboxURL,updatePanelElement) { this.init = function(wifiboxURL,updatePanelElement) {
_form.init(wifiboxURL,wifiboxURL,updatePanelElement); _form.init(wifiboxURL,wifiboxURL,updatePanelElement);
this.wifiboxURL = wifiboxURL; this.wifiboxURL = wifiboxURL;
this.element = updatePanelElement; this.element = updatePanelElement;
this.retainCheckbox = this.element.find("#retainConfiguration"); this.retainCheckbox = this.element.find("#retainConfiguration");
this.includeBetasCheckbox = this.element.find("#includeBetas"); this.includeBetasCheckbox = this.element.find("#includeBetas");
this.btnUpdate = this.element.find("#update"); this.btnUpdate = this.element.find("#update");
this.statusDisplay = this.element.find("#updateState"); this.statusDisplay = this.element.find("#updateState");
this.infoDisplay = this.element.find("#updateInfo"); this.infoDisplay = this.element.find("#updateInfo");
this.retainCheckbox.change(this.retainChanged); this.retainCheckbox.change(this.retainChanged);
this.includeBetasCheckbox.change(this.includeBetasChanged); this.includeBetasCheckbox.change(this.includeBetasChanged);
this.btnUpdate.click(this.update); this.btnUpdate.click(this.update);
this.checkStatus(false); this.checkStatus(false);
} }
this.retainChanged = function(e) { this.retainChanged = function(e) {
@ -91,11 +91,11 @@ function UpdatePanel() {
} }
this.installUpdate = function() { this.installUpdate = function() {
console.log("UpdatePanel:installUpdate"); console.log("UpdatePanel:installUpdate");
// should personal sketches and settings be retained over update? // should personal sketches and settings be retained over update?
var retain = self.retainCheckbox.prop('checked'); var retain = self.retainCheckbox.prop('checked');
console.log(" retain: ",retain); console.log(" retain: ",retain);
self.stopCheckingStatus(); self.stopCheckingStatus();
postData = {no_retain:!retain} postData = {no_retain:!retain}
$.ajax({ $.ajax({
@ -110,11 +110,11 @@ function UpdatePanel() {
//console.log("UpdatePanel:installUpdate: no respons (there shouldn't be)"); //console.log("UpdatePanel:installUpdate: no respons (there shouldn't be)");
}); });
self.setState(UpdatePanel.INSTALLING); self.setState(UpdatePanel.INSTALLING);
clearTimeout(self.installedDelayer); clearTimeout(self.installedDelayer);
self.installedDelayer = setTimeout(function() { self.setState(UpdatePanel.INSTALLED) },self.installedDelay); self.installedDelayer = setTimeout(function() { self.setState(UpdatePanel.INSTALLED) },self.installedDelay);
} }
this.startCheckingStatus = function() { this.startCheckingStatus = function() {
clearTimeout(self.statusCheckDelayer); clearTimeout(self.statusCheckDelayer);
clearTimeout(self.retryDelayer); clearTimeout(self.retryDelayer);
@ -125,7 +125,7 @@ function UpdatePanel() {
clearTimeout(self.retryDelayer); clearTimeout(self.retryDelayer);
} }
this.checkStatus = function(keepChecking) { this.checkStatus = function(keepChecking) {
if (!communicateWithWifibox) return; if (!communicateWithWifibox) return;
$.ajax({ $.ajax({
url: self.wifiboxURL + "/update/status", url: self.wifiboxURL + "/update/status",
type: "GET", type: "GET",
@ -133,18 +133,18 @@ function UpdatePanel() {
//timeout: self.timeoutTime, //timeout: self.timeoutTime,
success: function(response){ success: function(response){
console.log("UpdatePanel:checkStatus response: ",response); console.log("UpdatePanel:checkStatus response: ",response);
// Keep checking ? // Keep checking ?
if(keepChecking) { if(keepChecking) {
switch(self.state){ switch(self.state){
case UpdatePanel.DOWNLOADING: case UpdatePanel.DOWNLOADING:
case UpdatePanel.INSTALLING: case UpdatePanel.INSTALLING:
clearTimeout(self.statusCheckDelayer); clearTimeout(self.statusCheckDelayer);
self.statusCheckDelayer = setTimeout(function() { self.checkStatus(keepChecking) },self.statusCheckInterval); self.statusCheckDelayer = setTimeout(function() { self.checkStatus(keepChecking) },self.statusCheckInterval);
break; break;
} }
} }
if(response.status != "error") { if(response.status != "error") {
var data = response.data; var data = response.data;
self.handleStatusData(data); self.handleStatusData(data);
@ -158,25 +158,25 @@ function UpdatePanel() {
} }
}); });
} }
this.handleStatusData = function(data) { this.handleStatusData = function(data) {
//console.log("UpdatePanel:handleStatusData"); //console.log("UpdatePanel:handleStatusData");
var refreshUI = (self.canUpdate != data.can_update); var refreshUI = (self.canUpdate != data.can_update);
self.canUpdate = data.can_update; self.canUpdate = data.can_update;
if(self.currentVersion != data.current_version || self.newestVersion != data.newest_version) { if(self.currentVersion != data.current_version || self.newestVersion != data.newest_version) {
self.currentVersion = data.current_version; self.currentVersion = data.current_version;
self.newestVersion = data.newest_version; self.newestVersion = data.newest_version;
self.updateInfoDisplay(); self.updateInfoDisplay();
} }
self.stateText = data.state_text; self.stateText = data.state_text;
self.progress = data.progress; // not always available self.progress = data.progress; // not always available
self.imageSize = data.image_size; // not always available self.imageSize = data.image_size; // not always available
self.setState(data.state_code, refreshUI); self.setState(data.state_code, refreshUI);
switch(this.state){ switch(this.state){
case UpdatePanel.IMAGE_READY: case UpdatePanel.IMAGE_READY:
self.installUpdate(); self.installUpdate();
@ -188,19 +188,19 @@ function UpdatePanel() {
if(!refresh && this.state == newState) return; if(!refresh && this.state == newState) return;
console.log("UpdatePanel:setState: ",this.state," > ",newState,"(",this.stateText,") (in Access Point Mode: ",_inAccessPointMode,") (newestVersion: ",self.newestVersion,") (refresh: ",refresh,")"); console.log("UpdatePanel:setState: ",this.state," > ",newState,"(",this.stateText,") (in Access Point Mode: ",_inAccessPointMode,") (newestVersion: ",self.newestVersion,") (refresh: ",refresh,")");
this.state = newState; this.state = newState;
// should personal sketches and settings be retained over update? // should personal sketches and settings be retained over update?
var retain = self.retainCheckbox.prop('checked'); var retain = self.retainCheckbox.prop('checked');
//console.log(" retain", retain); //console.log(" retain", retain);
// download button // download button
// if there isn't newestVersion data something went wrong, // if there isn't newestVersion data something went wrong,
// probably accessing the internet // probably accessing the internet
//console.log(" self.newestVersion: ",self.newestVersion); //console.log(" self.newestVersion: ",self.newestVersion);
if(self.newestVersion != undefined) { if(self.newestVersion != undefined) {
//console.log(" this.state: ",this.state); //console.log(" this.state: ",this.state);
switch(this.state){ switch(this.state){
case UpdatePanel.NONE: case UpdatePanel.NONE:
case UpdatePanel.DOWNLOAD_FAILED: case UpdatePanel.DOWNLOAD_FAILED:
case UpdatePanel.INSTALL_FAILED: case UpdatePanel.INSTALL_FAILED:
//console.log(" self.canUpdate: ",self.canUpdate); //console.log(" self.canUpdate: ",self.canUpdate);
@ -212,7 +212,7 @@ function UpdatePanel() {
break; break;
default: default:
self.btnUpdate.attr("disabled", true); self.btnUpdate.attr("disabled", true);
break; break;
} }
} else { } else {
self.btnUpdate.attr("disabled", true); self.btnUpdate.attr("disabled", true);
@ -230,23 +230,23 @@ function UpdatePanel() {
text = "You're up to date."; text = "You're up to date.";
} }
break; break;
case UpdatePanel.DOWNLOADING: case UpdatePanel.DOWNLOADING:
text = "Downloading update..."; text = "Downloading update...";
break; break;
case UpdatePanel.DOWNLOAD_FAILED: case UpdatePanel.DOWNLOAD_FAILED:
text = "Downloading update failed."; text = "Downloading update failed.";
break; break;
case UpdatePanel.IMAGE_READY: case UpdatePanel.IMAGE_READY:
text = "Update downloaded."; text = "Update downloaded.";
break; break;
case UpdatePanel.INSTALLING: case UpdatePanel.INSTALLING:
text = "Installing update... (will take a minute)"; text = "Installing update... (will take a minute)";
break; break;
case UpdatePanel.INSTALLED: case UpdatePanel.INSTALLED:
text = "Update complete, please reconnect by connecting your device to the access point of your WiFi box and going to <a href='http://draw.doodle3d.com'>draw.doodle3d.com</a>"; text = "Update complete, please reconnect by connecting your device to the access point of your WiFi box and going to <a href='http://draw.doodle3d.com'>draw.doodle3d.com</a>";
//text = "Update complete, please <a href='javascript:location.reload(true);'>refresh Page</a>."; //text = "Update complete, please <a href='javascript:location.reload(true);'>refresh Page</a>.";
break; break;
case UpdatePanel.INSTALL_FAILED: case UpdatePanel.INSTALL_FAILED:
text = "Installing update failed."; text = "Installing update failed.";
break; break;
} }
@ -261,10 +261,10 @@ function UpdatePanel() {
} }
this.updateInfoDisplay = function() { this.updateInfoDisplay = function() {
var html = 'Current version: ' + self.currentVersion + var html = 'Current version: ' + self.currentVersion +
' (<a target="d3d-curr-relnotes" href="ReleaseNotes.html">release notes</a>). '; ' (<a target="d3d-curr-relnotes" href="ReleaseNotes.html">release notes</a>). ';
if(self.canUpdate) { if(self.canUpdate) {
html += 'Latest version: ' + self.newestVersion + html += 'Latest version: ' + self.newestVersion +
' (<a target="d3d-new-relnotes" href="http://doodle3d.com/updates/images/ReleaseNotes.md">release notes</a>).'; ' (<a target="d3d-new-relnotes" href="http://doodle3d.com/updates/images/ReleaseNotes.md">release notes</a>).';
} }
self.infoDisplay.html(html); self.infoDisplay.html(html);
} }

View File

@ -1,143 +1,172 @@
form { form {
margin: 10px; margin: 10px;
max-width: 600px; max-width: 600px;
} }
form input { form input {
margin: 1px; margin: 1px;
} }
body,th,td { body,th,td {
font-family: Helvetica, Arial, "Nimbus Sans L", sans-serif; font-family: Helvetica, Arial, "Nimbus Sans L", sans-serif;
font-size: 13px; font-size: 13px;
} }
.settingsContainer { .settingsContainer {
position:relative; position: relative;
/*min-width: 370px;*/ /*min-width: 370px;*/
width: 100%; width: 100%;
height: 100%; height: 100%;
} }
/*form#settingsForm {*/ /*form#settingsForm {*/
/*width: 100% auto;*/ /*width: 100% auto;*/
/*}*/ /*}*/
form fieldset { form fieldset {
max-width: 600px; max-width: 600px;
border: 1px solid rgb(187, 187, 187); border: 1px solid rgb(187, 187, 187);
border-radius: 5px; border-radius: 5px;
-webkit-border-radius: 5px; -webkit-border-radius: 5px;
-moz-border-radius: 5px; -moz-border-radius: 5px;
margin-bottom: 20px; margin-bottom: 20px;
padding: 8px; padding: 8px;
/*padding-right: 8px;*/ /*padding-right: 8px;*/
} }
form fieldset fieldset{
form fieldset fieldset {
max-width: 580px; max-width: 580px;
margin: 15px 0 5px 0; margin: 15px 0 5px 0;
clear: left; clear: left;
float: left; float: left;
} }
form fieldset.collapsed { form fieldset.collapsed {
border-radius: 0; border-radius: 0;
-webkit-border-radius: 0; -webkit-border-radius: 0;
-moz-border-radius: 0; -moz-border-radius: 0;
border-width: 1px 0 0 0; border-width: 1px 0 0 0;
float:none; float: none;
} }
form fieldset.collapsible { form fieldset.collapsible {
padding: 0; padding: 0;
} }
form fieldset.collapsible div{
form fieldset.collapsible div {
margin: 8px; margin: 8px;
} }
form fieldset legend { form fieldset legend {
margin-left: 10px; margin-left: 10px;
font-weight: bold; font-weight: bold;
} }
form fieldset.collapsible legend { form fieldset.collapsible legend {
padding-left: 10px; padding-left: 10px;
cursor: pointer; cursor: pointer;
} }
form fieldset.expanded legend { form fieldset.expanded legend {
background: transparent url(../img/buttons/expanded.gif) no-repeat center left; background: transparent url(../img/buttons/expanded.gif) no-repeat
center left;
} }
form fieldset.collapsed legend { form fieldset.collapsed legend {
background: transparent url(../img/buttons/collapsed.gif) no-repeat center left; background: transparent url(../img/buttons/collapsed.gif) no-repeat
center left;
} }
form label { form label {
min-width: 150px; min-width: 150px;
display: block; display: block;
float: left; float: left;
margin: 1px 0 0 0; margin: 1px 0 0 0;
clear: left; clear: left;
} }
form div { form div {
float: left; float: left;
} }
form input[type="text"], form input[type="number"], form input[type="password"] {
border: 1px solid rgb(144, 192, 255); form input[type="text"],form input[type="number"], form input[type="password"]
margin-right: 5px; {
-webkit-border-radius: 4px; border: 1px solid rgb(144, 192, 255);
margin-right: 5px;
-webkit-border-radius: 4px;
-moz-border-radius: 4px; -moz-border-radius: 4px;
border-radius: 4px; border-radius: 4px;
} }
form input[type="text"].small, form input[type="number"].small, form input[type="password"].small {
width: 50px; form input[type="text"].small,form input[type="number"].small, form input[type="password"].small
{
width: 50px;
} }
form input[type="text"].large, form input[type="number"].large, form input[type="password"].large {
width: 250px; form input[type="text"].large,form input[type="number"].large, form input[type="password"].large
{
width: 250px;
} }
form input[type="radio"] { form input[type="radio"] {
margin: 4px 4px 0 0; margin: 4px 4px 0 0;
} }
form textarea { form textarea {
border: 1px solid rgb(144, 192, 255); border: 1px solid rgb(144, 192, 255);
-webkit-border-radius: 5px; -webkit-border-radius: 5px;
-moz-border-radius: 5px; -moz-border-radius: 5px;
border-radius: 5px; border-radius: 5px;
} }
form .startgcode_left { form .startgcode_left {
float:left; float: left;
margin-right: 20px; margin-right: 20px;
} }
form textarea.gcode { form textarea.gcode {
width: 252px; width: 252px;
/*max-width: 262px;*/ /*max-width: 262px;*/
/*min-width: 200px;*/ /*min-width: 200px;*/
height: 150px; height: 150px;
} }
form small { form small {
margin: 3px 0 0 0; margin: 3px 0 0 0;
display: block; display: block;
clear: left; clear: left;
} }
form .button { form .button {
display: inline-block; display: inline-block;
} }
form #passwordLabel, form #password { form #passwordLabel,form #password {
display: none; display: none;
} }
form input.error, form textarea.error, form select.error { form input.error, form textarea.error, form select.error {
border: #f00 solid 2px; border: #f00 solid 2px;
} }
form .errorMsg { form .errorMsg {
color: #f00; color: #f00;
margin: 0 0 0 1em; margin: 0 0 0 1em;
} }
form .intro { form .intro {
margin: 0 0 0.5em 0; margin: 0 0 0.5em 0;
} }
form dl {
form dl {
margin: 0.5em 0 0 0; margin: 0.5em 0 0 0;
} }
form dl dt { form dl dt {
float: left; float: left;
font-style: italic; font-style: italic;
width: 10em; width: 10em;
} }
#updatePanel #retainConfigurationLabel, #updatePanel #includeBetasLabel { #updatePanel #retainConfigurationLabel, #updatePanel #includeBetasLabel {
display: inline; display: inline;
float: none; float: none;
} }