0
0
mirror of https://github.com/Doodle3D/doodle3d-client.git synced 2024-12-22 13:13:48 +01:00

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.element;
this.statusCheckInterval = 1000;
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.installedDelayer; // setTimout instance
this.retryDelay = 1000;
this.retryDelayer; // setTimout instance
//this.timeoutTime = 3000;
this.canUpdate = false;
this.currentVersion = "";
this.newestVersion;
this.statusCheckInterval = 1000;
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.installedDelayer; // setTimout instance
this.retryDelay = 1000;
this.retryDelayer; // setTimout instance
//this.timeoutTime = 3000;
this.canUpdate = false;
this.currentVersion = "";
this.newestVersion;
this.progress;
this.imageSize;
var _inAccessPointMode;
// states from api, see Doodle3D firmware src/script/d3d-updater.lua
UpdatePanel.NONE = 1; // default state
UpdatePanel.DOWNLOADING = 2;
UpdatePanel.DOWNLOAD_FAILED = 3;
UpdatePanel.IMAGE_READY = 4; // download successfull and checked
UpdatePanel.INSTALLING = 5;
UpdatePanel.INSTALLED = 6;
UpdatePanel.INSTALL_FAILED = 7;
this.state; // update state from api
this.stateText = ""; // update state text from api
UpdatePanel.NONE = 1; // default state
UpdatePanel.DOWNLOADING = 2;
UpdatePanel.DOWNLOAD_FAILED = 3;
UpdatePanel.IMAGE_READY = 4; // download successfull and checked
UpdatePanel.INSTALLING = 5;
UpdatePanel.INSTALLED = 6;
UpdatePanel.INSTALL_FAILED = 7;
this.state; // update state from api
this.stateText = ""; // update state text from api
var self = this;
this.init = function(wifiboxURL,updatePanelElement) {
_form.init(wifiboxURL,wifiboxURL,updatePanelElement);
this.wifiboxURL = wifiboxURL;
this.element = updatePanelElement;
this.retainCheckbox = this.element.find("#retainConfiguration");
this.includeBetasCheckbox = this.element.find("#includeBetas");
this.btnUpdate = this.element.find("#update");
this.statusDisplay = this.element.find("#updateState");
this.infoDisplay = this.element.find("#updateInfo");
this.retainCheckbox.change(this.retainChanged);
this.includeBetasCheckbox.change(this.includeBetasChanged);
this.btnUpdate.click(this.update);
this.checkStatus(false);
}
this.retainChanged = function(e) {
@ -91,11 +91,11 @@ function UpdatePanel() {
}
this.installUpdate = function() {
console.log("UpdatePanel:installUpdate");
// should personal sketches and settings be retained over update?
var retain = self.retainCheckbox.prop('checked');
console.log(" retain: ",retain);
self.stopCheckingStatus();
postData = {no_retain:!retain}
$.ajax({
@ -110,11 +110,11 @@ function UpdatePanel() {
//console.log("UpdatePanel:installUpdate: no respons (there shouldn't be)");
});
self.setState(UpdatePanel.INSTALLING);
clearTimeout(self.installedDelayer);
self.installedDelayer = setTimeout(function() { self.setState(UpdatePanel.INSTALLED) },self.installedDelay);
}
this.startCheckingStatus = function() {
clearTimeout(self.statusCheckDelayer);
clearTimeout(self.retryDelayer);
@ -125,7 +125,7 @@ function UpdatePanel() {
clearTimeout(self.retryDelayer);
}
this.checkStatus = function(keepChecking) {
if (!communicateWithWifibox) return;
if (!communicateWithWifibox) return;
$.ajax({
url: self.wifiboxURL + "/update/status",
type: "GET",
@ -133,18 +133,18 @@ function UpdatePanel() {
//timeout: self.timeoutTime,
success: function(response){
console.log("UpdatePanel:checkStatus response: ",response);
// Keep checking ?
if(keepChecking) {
switch(self.state){
case UpdatePanel.DOWNLOADING:
case UpdatePanel.DOWNLOADING:
case UpdatePanel.INSTALLING:
clearTimeout(self.statusCheckDelayer);
self.statusCheckDelayer = setTimeout(function() { self.checkStatus(keepChecking) },self.statusCheckInterval);
break;
}
}
if(response.status != "error") {
var data = response.data;
self.handleStatusData(data);
@ -158,25 +158,25 @@ function UpdatePanel() {
}
});
}
this.handleStatusData = function(data) {
//console.log("UpdatePanel:handleStatusData");
var refreshUI = (self.canUpdate != data.can_update);
self.canUpdate = data.can_update;
if(self.currentVersion != data.current_version || self.newestVersion != data.newest_version) {
self.currentVersion = data.current_version;
self.newestVersion = data.newest_version;
self.updateInfoDisplay();
}
self.stateText = data.state_text;
self.progress = data.progress; // not always available
self.imageSize = data.image_size; // not always available
self.setState(data.state_code, refreshUI);
switch(this.state){
case UpdatePanel.IMAGE_READY:
self.installUpdate();
@ -188,19 +188,19 @@ function UpdatePanel() {
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,")");
this.state = newState;
// should personal sketches and settings be retained over update?
var retain = self.retainCheckbox.prop('checked');
//console.log(" retain", retain);
// download button
// if there isn't newestVersion data something went wrong,
// if there isn't newestVersion data something went wrong,
// probably accessing the internet
//console.log(" self.newestVersion: ",self.newestVersion);
if(self.newestVersion != undefined) {
//console.log(" this.state: ",this.state);
switch(this.state){
case UpdatePanel.NONE:
case UpdatePanel.NONE:
case UpdatePanel.DOWNLOAD_FAILED:
case UpdatePanel.INSTALL_FAILED:
//console.log(" self.canUpdate: ",self.canUpdate);
@ -212,7 +212,7 @@ function UpdatePanel() {
break;
default:
self.btnUpdate.attr("disabled", true);
break;
break;
}
} else {
self.btnUpdate.attr("disabled", true);
@ -230,23 +230,23 @@ function UpdatePanel() {
text = "You're up to date.";
}
break;
case UpdatePanel.DOWNLOADING:
case UpdatePanel.DOWNLOADING:
text = "Downloading update...";
break;
case UpdatePanel.DOWNLOAD_FAILED:
case UpdatePanel.DOWNLOAD_FAILED:
text = "Downloading update failed.";
break;
case UpdatePanel.IMAGE_READY:
case UpdatePanel.IMAGE_READY:
text = "Update downloaded.";
break;
case UpdatePanel.INSTALLING:
case UpdatePanel.INSTALLING:
text = "Installing update... (will take a minute)";
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 <a href='javascript:location.reload(true);'>refresh Page</a>.";
break;
case UpdatePanel.INSTALL_FAILED:
case UpdatePanel.INSTALL_FAILED:
text = "Installing update failed.";
break;
}
@ -261,10 +261,10 @@ function UpdatePanel() {
}
this.updateInfoDisplay = function() {
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) {
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);
}

View File

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