diff --git a/js/Box.js b/js/Box.js index 42999e4..b782aa2 100644 --- a/js/Box.js +++ b/js/Box.js @@ -5,75 +5,137 @@ * This software is licensed under the terms of the GNU GPL v2 or later. * See file LICENSE.txt or visit http://www.gnu.org/licenses/gpl.html for full license details. */ -function Box() { - - this.localip; - this.wifiboxid; - this.connecting = false; - this.destroyedHandler; - - var _element; - var _networkPanel; - var _delayedDestroy; - var _self = this; - this.init = function(boxData,parentElement) { +var BoxPage = (function (w) { + var _page; + var _title; + var _intro; + var _networkStatus; + var _networkAPI = new NetworkAPI(); + var _boxData = {}; + var _retryRetrieveStatusDelay; + var _retryRetrieveStatusDelayTime = 3000; + var PAGE_ID = "#box"; + + var _self = this; + + $.mobile.document.on( "pageinit", PAGE_ID, function( event, data ) { + //console.log("Box page pageinit"); + _page = $(this); + _title = _page.find(".ui-title"); + _intro = _page.find(".intro"); - _self.localip = boxData.localip; - _self.wifiboxid = boxData.wifiboxid; - var url = "http://"+_self.localip; + }); + $.mobile.document.on( "pagebeforeshow", PAGE_ID, function( event, data ) { + console.log("Box page pagebeforeshow"); + _boxData = d3d.util.getPageParams(PAGE_ID); + var boxURL = "http://"+_boxData.localip; + console.log(" _boxData: ",_boxData); - // create box dom element - var link = (boxData.link)? boxData.link : url; - var linkElement = $(""+_self.wifiboxid+""); - _element = $("
  • "); - _element.append(linkElement); - _element.hide().appendTo(parentElement).fadeIn(500); + _title.text(_boxData.wifiboxid); + _intro.text(""); - // create network panel dom element - var networkPanelElement = $("#networkForm").clone(); - networkPanelElement.addClass(networkPanelElement.attr("id")); - networkPanelElement.removeAttr("id"); - _element.append(networkPanelElement); + var drawLink = (_boxData.link)? _boxData.link : boxURL; + _page.find("#drawItem a").attr("href",drawLink); - // create network panel - _networkPanel = new NetworkPanel(); - _networkPanel.id = _self.localip; - _networkPanel.init(url,networkPanelElement, networkStatusChangeHandler); - - } - function networkStatusChangeHandler(networkStatus) { - console.log("Box:networkStatusChangeHandler: ",networkStatus); - _self.connecting = (networkStatus == NetworkAPI.STATUS.CONNECTING); - - // because openwrt can be slow to update it's ssid, a box might - // report it failed connecting but is then slightly later connects - // so we correct CONNECTING_FAILED to CONNECTED unless the box is connected by wire - if(_self.localip != "192.168.5.1" && networkStatus == NetworkAPI.STATUS.CONNECTING_FAILED) { - networkStatus = NetworkAPI.STATUS.CONNECTED; - } - - _element.toggleClass("complex",(networkStatus !== NetworkAPI.STATUS.CONNECTED)); - - if(_self.connecting) { - clearTimeout(_delayedDestroy); - _delayedDestroy = setTimeout(function() { - console.log("delayed remove"); - //removeBox(box,true); - _self.destroy() - }, 10000); - } - } - this.destroy = function() { - console.log("Box:destroy"); - clearTimeout(_delayedDestroy); - - _networkPanel.destroy(); - - _element.fadeOut(500,function() { - _element.remove(); + _networkAPI.init(boxURL); + retrieveNetworkStatus(); + }); + + function retrieveNetworkStatus() { + console.log("retrieveNetworkStatus"); + _networkAPI.status(function(data) { + console.log("_networkAPI.status complete"); + console.log(" data: ",data); + if(data.status !== "" && typeof data.status === 'string') { + data.status = parseInt(data.status,10); + } + //console.log(_self.id,"NetworkPanel:retrievedStatus status: ",data.status,data.statusMessage); + //console.log(" networkPanel ",_element[0]," parent: ",_element.parent()[0]); + // ToDo: update _currentNetwork when available + + setNetworkStatus(data.status,data); + + /*// Keep checking for updates? + switch(data.status) { + case NetworkAPI.STATUS.CONNECTING: + case NetworkAPI.STATUS.CREATING: + clearTimeout(_retryRetrieveStatusDelay); + _retryRetrieveStatusDelay = setTimeout(_self.retrieveStatus,_retryRetrieveStatusDelayTime); // retry after delay + break; + }*/ + //if(completeHandler) completeHandler(data.status); + }, function() { + //console.log("NetworkPanel:retrieveStatus failed"); + clearTimeout(_retryRetrieveStatusDelay); + _retryRetrieveStatusDelay = setTimeout(_self.retrieveStatus, _retryRetrieveStatusDelayTime); // retry after delay }); - - if(_self.destroyedHandler) _self.destroyedHandler(_self); } -} \ No newline at end of file + function setNetworkStatus(status,data) { + console.log("setNetworkStatus: ",status,data); + if(status === NetworkAPI.STATUS.CONNECTED) { // online + _page.find("#drawItem a").text("Draw"); + // ToDo: Link to update page (auto retrieve if available) + // ToDo: Link to your app here? + // ToDo: Status + // ToDo: Control + _page.find("#joinNetworkItem").toggleClass("ui-screen-hidden",true); + + } else { // offline + _intro.text("Please connect your WiFi-Box to the internet. You can also use it offline but then you aren't able to update."); + + var joinNetworkItem = _page.find("#joinNetworkItem"); + joinNetworkItem.toggleClass("ui-screen-hidden",false); + + var joinLink = joinNetworkItem.find("a").attr("href"); + joinLink = d3d.util.replaceURLParameters(joinLink,_boxData); + joinNetworkItem.find("a").attr("href",joinLink); + + _page.find("#drawItem a").text("Draw (offline)"); + + // ToDo: Status + // ToDo: Control + } + + // update info + /*switch(status) { + case NetworkAPI.STATUS.CONNECTED: + //console.log(" data.ssid: ",data.ssid); + if(data.ssid == "") { + _currentNetwork = undefined; + //data.status = NetworkAPI.STATUS.NOT_CONNECTED; + setStatus(NetworkAPI.STATUS.NOT_CONNECTED); + } else { + _currentNetwork = data.ssid; + } + break; + case NetworkAPI.STATUS.CONNECTING: + if(_selectedNetwork != undefined) { + targetNetwork = _selectedNetwork; + } else if(_currentNetwork != undefined) { + targetNetwork = _currentNetwork; + } + case NetworkAPI.STATUS.CREATING: + case NetworkAPI.STATUS.CREATED: + _currentNetwork = undefined; + break; + }*/ + _networkStatus = data.status; + } + + // to get to the box data we need the url + // only pagecontainer events contain url's + /*$.mobile.document.on( "pagecontainerbeforetransition", function( event, data ) { + //console.log("Box page pagebeforetransition"); + var url = d3d.util.processURL(data.absUrl); + console.log(" url: ",url); + if(url.hash == PAGE_ID) { + _boxData = { + localip: url.parameters.localip, + wifiboxid: url.parameters.wifiboxid, + link: url.parameters.link, + url: "http://"+url.parameters.localip + } + } + });*/ +})(window); \ No newline at end of file diff --git a/js/JoinNetwork.js b/js/JoinNetwork.js new file mode 100644 index 0000000..1162407 --- /dev/null +++ b/js/JoinNetwork.js @@ -0,0 +1,71 @@ +/* + * This file is part of the Doodle3D project (http://doodle3d.com). + * + * Copyright (c) 2013, Doodle3D + * This software is licensed under the terms of the GNU GPL v2 or later. + * See file LICENSE.txt or visit http://www.gnu.org/licenses/gpl.html for full license details. + */ + +(function (w) { + var _page; + var _list; + var _networks; +// var _networkStatus; +// var _networkAPI = new NetworkAPI(); +// var _boxData = {}; +// var _retryRetrieveStatusDelay; +// var _retryRetrieveStatusDelayTime = 3000; + var PAGE_ID = "#join_network"; + + var _self = this; + + $.mobile.document.on( "pageinit", PAGE_ID, function( event, data ) { + console.log("Join network page pageinit"); + _page = $(this); + _list = _page.find("ul[data-role=listview]"); + console.log(" list: ",_list); + }); + $.mobile.document.on( "pagebeforeshow", PAGE_ID, function( event, data ) { + console.log("Join network page pagebeforeshow"); + _boxData = d3d.util.getPageParams(PAGE_ID); + var boxURL = "http://"+_boxData.localip; + console.log(" _boxData: ",_boxData); + + _networkAPI.init(boxURL); + refreshNetworks(); + }); + function refreshNetworks(completeHandler) { + console.log("JoinNetwork:refreshNetworks"); + _api.scan(function(data) { // completed + console.log("JoinNetwork:refreshNetworks:scanned"); + + fillNetworks(data.networks) + _networks = {}; + $.each(data.networks, function(index,network) { + _networks[network.ssid] = network; + }); + + if(completeHandler) completeHandler(); + }); + } + function fillNetworks(networks) { + _list.empty(); + $.each(networks, function(index,network) { + + var joinLink = joinNetworkItem.find("a").attr("href"); + joinLink = d3d.util.replaceURLParameters(joinLink,_boxData); + joinNetworkItem.find("a").attr("href",joinLink); + + + var link = "#network_connecting"; + link = d3d.util.replaceURLParameters(link,_boxData); + //var item = $("
  • "); + + _list.append( + //$("").val(network.ssid).html(network.ssid) + ); + }); + _list.listview('refresh'); // jQuery mobile enhance content + } + +})(window); \ No newline at end of file diff --git a/js/api/ConnectAPI.js b/js/api/ConnectAPI.js index b54a4ec..4ca1688 100644 --- a/js/api/ConnectAPI.js +++ b/js/api/ConnectAPI.js @@ -7,9 +7,31 @@ */ function ConnectAPI() { + // callbacks + this.refreshing; // I'm refreshing my list + this.listUpdated; // the list of boxes is updated / changed + this.boxAppeared; // a new box appeared + this.boxDisapeared; // a box disappeared + //this.boxUpdated; // a box is updated / changed + var _apiURL = "http://connect.doodle3d.com/api"; + var _networkAPI = new NetworkAPI(); var _timeoutTime = 3000; + var _refreshDelay; + var _refreshInterval = 3000; + var _running; + var _listChanged = false; + + var _wiredBox = {localip:"192.168.5.1",wifiboxid:"Wired WiFi-Box"}; + var _apBox = {localip:"192.168.10.1",wifiboxid:"WiFi-Box",link:"http://draw.doodle3d.com"}; + + var _boxTimeoutTime = 500; + var _numBoxesChecking = 0; // count how many boxes we are checking + var _numBoxesFound = 0; // count how many boxes responded + var _boxes = {}; // current list of boxes + var _numBoxes = 0; // current number of boxes + var _self = this; this.list = function(completeHandler,failedHandler) { @@ -33,4 +55,110 @@ function ConnectAPI() { if(failedHandler) failedHandler(); }); }; + + this.start = function(interval,listUpdated) { + if(interval) { + _refreshInterval = interval; + } + if(listUpdated) { + _self.listUpdated = listUpdated; + } + _running = true; + _self.refresh(); + } + this.stop = function() { + _running = false; + clearTimeout(_refreshDelay); + } + this.refresh = function(listUpdated) { + if(listUpdated) { + _self.listUpdated = listUpdated; + } + if(_self.refreshing) { + _self.refreshing(); + } + + _self.list(function(foundBoxes) { + //console.log(" foundBoxes: ",foundBoxes); + foundBoxes.push(_wiredBox); // always check for a wired box + updateList(foundBoxes); + if(_running) { + clearTimeout(_refreshDelay); + _refreshDelay = setTimeout(_self.refresh, _refreshInterval); + } + //removeBox(_apBox.localip,true); // TODO: why again? + }, function() { + // if web is not accessible try to find a box as an accesspoint + // if not found, we look for a wired box + _networkAPI.alive(_apBox.localip,_boxTimeoutTime,function() { + updateList([_apBox]); + }, function() { + updateList([_wiredBox]); + }); + if(_running) { + clearTimeout(_refreshDelay); + _refreshDelay = setTimeout(_self.refresh, _refreshInterval); + } + }); + } + + function updateList(foundBoxes) { + //console.log("updateList"); + _numBoxesChecking = 0; + _numBoxesFound = 0; + _listChanged = false; + + // remove stored, but not found boxes + jQuery.each(_boxes, function (index,box) { + var found = false; + jQuery.each(foundBoxes, function (index,foundBox) { + if(foundBox.localip == box.localip && + foundBox.wifiboxid == box.wifiboxid) found = true; + }); + if(!found) removeBox(box.localip); + }) + + // check if all found boxes are alive + jQuery.each(foundBoxes, function (index,foundBox) { + checkBox(foundBox); + }); + + if(foundBoxes.length == 0 && _self.listUpdated) { + _self.listUpdated(_boxes); + } + } + function checkBox(boxData) { + //console.log(" checkBox: ",boxData.localip); + _numBoxesChecking++; + + _networkAPI.alive(boxData.localip,_boxTimeoutTime,function() { + addBox(boxData); + _numBoxesFound++; + }, function() { + removeBox(boxData.localip); + },function(){ + _numBoxesChecking--; + if(_numBoxesChecking <= 0 && _listChanged && _self.listUpdated) { + _self.listUpdated(_boxes); + } + }); + } + function getBox(localip) { + return _boxes[localip]; + } + function addBox(box) { + if(getBox(box.localip) !== undefined) return; + _boxes[box.localip] = box; + _numBoxes++; + if(_self.boxAppeared) _self.boxAppeared(box); + _listChanged = true; + } + function removeBox(localip) { + var box = getBox(localip); + if(box === undefined) return; + delete _boxes[localip]; + _numBoxes--; + if(_self.boxDisapeared) _self.boxDisapeared(box); + _listChanged = true; + } } \ No newline at end of file diff --git a/js/api/NetworkAPI.js b/js/api/NetworkAPI.js index db0c6e1..d029c21 100644 --- a/js/api/NetworkAPI.js +++ b/js/api/NetworkAPI.js @@ -123,7 +123,7 @@ function NetworkAPI() { }); }; - this.alive = function(wifiboxURL,timeoutTime,completeHandler,failedHandler) { + this.alive = function(wifiboxURL,timeoutTime,successHandler,failedHandler, completeHandler) { if(wifiboxURL.indexOf("http://") != 0) { wifiboxURL = "http://" + wifiboxURL; } @@ -138,13 +138,16 @@ function NetworkAPI() { //console.log("NetworkAPI:alive response: ",response); if(response.status == "error" || response.status == "fail") { if(failedHandler) failedHandler(response); + if(completeHandler) completeHandler(false, response); } else { - completeHandler(response.data); + successHandler(response.data); + if(completeHandler) completeHandler(true, response.data); } } }).fail(function() { //console.log("NetworkAPI:alive failed"); if(failedHandler) failedHandler(); + if(completeHandler) completeHandler(false); }); }; } \ No newline at end of file diff --git a/js/boxes.js b/js/boxes.js new file mode 100644 index 0000000..9780c54 --- /dev/null +++ b/js/boxes.js @@ -0,0 +1,68 @@ +/* + * This file is part of the Doodle3D project (http://doodle3d.com). + * + * Copyright (c) 2013, Doodle3D + * This software is licensed under the terms of the GNU GPL v2 or later. + * See file LICENSE.txt or visit http://www.gnu.org/licenses/gpl.html for full license details. + */ + +var BoxesPage = (function (w) { + var connectAPI = new ConnectAPI(); // TODO add _ + + var _page; + var _list; + var _findItem; + var PAGE_ID = "#boxes"; + + $.mobile.document.on( "pageinit", PAGE_ID, function( event, data ) { + //console.log("Boxes page pageinit"); + _page = $(this); + _list = _page.find("#boxeslist"); + _findItem = _list.find("#findItem"); + + connectAPI.refreshing = onRefreshing; + connectAPI.listUpdated = onListUpdated; + connectAPI.boxAppeared = onBoxAppeared; + connectAPI.boxDisapeared = onBoxDisapeared; + }); + $.mobile.document.on( "pagebeforeshow", PAGE_ID, function( event, data ) { + //console.log("Boxes page pagebeforeshow"); + connectAPI.start(); + }); + $.mobile.document.on( "pagehide", PAGE_ID, function( event, data ) { + //console.log("Boxes page pagehide"); + connectAPI.stop(); + }); + + function onRefreshing() { + //console.log("onRefreshing"); + d3d.util.showLoader(true); + } + function onListUpdated(boxesData) { + console.log("onListUpdated: ",boxesData); + _list.append(_findItem); // make sure find is the last item + _list.listview('refresh'); // jQuery mobile enhance content + } + function onBoxAppeared(boxData) { + console.log("onBoxAppeared: ",boxData.localip); + + var link = "#box?localip="+boxData.localip+"&wifiboxid="+boxData.wifiboxid; + if(boxData.link) { link += "&link="+boxData.link; } + var id = boxData.localip.replace(/\./g,"-"); + var linkElement = $(""+boxData.wifiboxid+""); + var box = $("
  • "); + box.append(linkElement); + box.hide().appendTo(_list).fadeIn(500); + } + function onBoxDisapeared(boxData) { + console.log("onBoxDisapeared: ",boxData.localip); + + var id = boxData.localip.replace(/\./g,"-"); + var box = _list.find("#"+id); + console.log(" box: ",box); + box.fadeOut(500,function() { + box.remove(); + //_list.listview('refresh'); + }); + } +})(window); \ No newline at end of file diff --git a/js/main.js b/js/main.js index fbc3129..e5d4200 100644 --- a/js/main.js +++ b/js/main.js @@ -5,165 +5,84 @@ * This software is licensed under the terms of the GNU GPL v2 or later. * See file LICENSE.txt or visit http://www.gnu.org/licenses/gpl.html for full license details. */ -var retrieveListInterval = 3000; -var retrieveListDelay; // retry setTimout instance -var boxTimeoutTime = 500; -var numBoxesChecking = 0; // count how many boxes we are checking -var numBoxesFound = 0; // count how many boxes responded - -var connectedBox = {localip:"192.168.5.1",wifiboxid:"Wired WiFi-Box"}; -var apBox = {localip:"192.168.10.1",wifiboxid:"WiFi-Box",link:"http://draw.doodle3d.com"}; -var connectAPI = "http://connect.doodle3d.com/api" - -var $list; -var $intro; -var $hint; -var $preloader; -var spinner; - -var boxes = {}; -var numBoxes = 0; - -var networkAPI = new NetworkAPI(); -var connectAPI = new ConnectAPI(); - -$(function() { -// console.log("ready"); - - networkAPI.init(); - - $intro = $("#intro"); - $list = $("#list"); - - $hint = $("#hint"); - $preloader = $("#preloader"); - - var spinnerSettings = { - lines: 7, // The number of lines to draw - length: 0, // The length of each line - width: 14, // The line thickness - radius: 15, // The radius of the inner circle - corners: 1, // Corner roundness (0..1) - rotate: 0, // The rotation offset - direction: 1, // 1: clockwise, -1: counterclockwise - color: '#57BF42', // #rgb or #rrggbb or array of colors - speed: 1.2, // Rounds per second - trail: 69, // Afterglow percentage - shadow: false, // Whether to render a shadow - hwaccel: false, // Whether to use hardware acceleration - className: 'spinner', // The CSS class to assign to the spinner - zIndex: 2e9, // The z-index (defaults to 2000000000) - top: 'auto', // Top position relative to parent in px - left: 'auto' // Left position relative to parent in px - }; - spinner = new Spinner(spinnerSettings); - spinner.spin($preloader[0]); - - retrieveList(); - - // make sure all links are opened in same WebApp (added to homescreen) - // and they don't start a browser - $.stayInWebApp('a',true); -}); - -function retrieveList() { - $preloader.show(); - //spinner.spin($preloader[0]); - connectAPI.list(function(foundBoxes) { - //console.log(" foundBoxes: ",foundBoxes); - foundBoxes.push(connectedBox); - updateList(foundBoxes); - clearTimeout(retrieveListDelay); - retrieveListDelay = setTimeout(retrieveList, retrieveListInterval); - removeBox(apBox.localip,true); - }, function() { - // if web is not accessible try to find the box as an accesspoint - // if not found, we look for a wired box - networkAPI.alive(apBox.localip,boxTimeoutTime,function() { - updateList([apBox]); - }, function() { - updateList([connectedBox]); +var d3d = {}; +d3d.util = { + // Helper function that splits a URL just the way we want it + parseURL:function(url) { + var parsed = $.mobile.path.parseUrl( url ); + var hashParts = parsed.hash.split( "?" ); + var parameters = {}; + // Assemble query parameters object from the query string + if (hashParts.length > 1) { + $.each(hashParts[1].split( "&" ), function( index, value ) { + var pair = value.split( "=" ); + if ( pair.length > 0 && pair[ 0 ] ) { + parameters[ pair[ 0 ] ] = + ( pair.length > 1 ? pair[ 1 ] : true ); + } + }); + } + return { + parsed: parsed, + hash: ( hashParts.length > 0 ? hashParts[ 0 ] : "" ), + parameters: parameters + }; + }, + getPageParams:function(pageID) { + return d3d.pageParams[pageID]; + }, + replaceURLParameters:function(href,parameters){ + //console.log("replaceURLParameters: ",href,parameters); + href = href.split("?")[0]; + var i = 0; + jQuery.each(parameters, function (key,value) { + href += (i===0)? "?" : "&"; + href += key+"="+value; + i++; }); - clearTimeout(retrieveListDelay); - retrieveListDelay = setTimeout(retrieveList, retrieveListInterval); // retry after delay - }); -} - -function updateList(foundBoxes) { - //console.log("updateList"); - numBoxesChecking = 0; - numBoxesFound = 0; - - if (foundBoxes===undefined) foundBoxes = []; - - // remove displayed, but not found boxes - jQuery.each(boxes, function (index,box) { - var found = false; - jQuery.each(foundBoxes, function (index,foundBox) { - if(foundBox.localip == box.localip && - foundBox.wifiboxid == box.wifiboxid) found = true; - }); - if(!found) removeBox(box.localip); - }) - - // check if all found boxes are alive - jQuery.each(foundBoxes, function (index,foundBox) { - checkBox(foundBox); - }); - - updateIntro(); -} - -function checkBox(boxData) { - //console.log(" checkBox: ",boxData.localip); - numBoxesChecking++; - - networkAPI.alive(boxData.localip,boxTimeoutTime,function() { - addBox(boxData); - numBoxesFound++; - numBoxesChecking--; - }, function() { - removeBox(boxData.localip); - numBoxesChecking--; - }); -} -function getBox(localip) { - return boxes[localip]; -} -function addBox(boxData) { - if(getBox(boxData.localip) !== undefined) return; - //console.log("addBox: ",boxData.localip); - var box = new Box(); - box.init(boxData,$list); - box.destroyedHandler = boxDestroyedHandler; - boxes[box.localip] = box; - numBoxes++; - updateIntro(); -} -function removeBox(localip,force) { - var box = getBox(localip); - if(box === undefined) return; - //console.log("removeBox: ",localip," force: ",force); - if(!force && box.connecting) return; - //console.log(" calling destroyed"); - box.destroy(); -} -function boxDestroyedHandler(box) { - //console.log("boxDestroyedHandler"); - delete boxes[box.localip]; - numBoxes--; - updateIntro(); -} - -function updateIntro() { - //console.log("updateIntro, numBoxes: ",numBoxes); - if(numBoxes > 0) { - $intro.html("Found the following boxes near you:"); - $hint.fadeOut(); - } else { - $intro.html("No boxes found near you."); - $hint.fadeIn(); + return href; + }, + showLoader:function(autoHide) { + setTimeout(function(){ + $.mobile.loading('show'); + if(autoHide) { + setTimeout(function() { + $.mobile.loading('hide'); + },1000); + } + }, 1); + }, + hideLoader:function() { + $.mobile.loading('hide'); } - $preloader.fadeOut(1000); -} \ No newline at end of file +}; + +(function (w) { + + /*$.mobile.document.on( "pagebeforechange", function( event, data ) { + console.log("pagebeforechange"); + //console.log(" event: ",event); + //console.log(" data: ",data); + d3d.pageParams[pageID] + + if ($.type(data.toPage) === "string") { + console.log(" data.toPage: ",data.toPage); + //var url = d3d.util.processURL(data.toPage); + //data.url = url; + // add to data attribute of target page ? + } + });*/ + + // to get to url parameters we need the url + // only pagecontainer events contain url's + // we parse the parameters and store them in a global object + $.mobile.document.on( "pagecontainerbeforetransition", function( event, data ) { + //console.log("pagecontainerbeforetransition"); + var url = d3d.util.parseURL(data.absUrl); + //console.log(" url: ",url); + if(!d3d.pageParams) { d3d.pageParams = {}; } + d3d.pageParams[url.hash] = url.parameters; + }); + +})(window); \ No newline at end of file diff --git a/less/styles.less b/less/styles.less new file mode 100644 index 0000000..fcd7020 --- /dev/null +++ b/less/styles.less @@ -0,0 +1,31 @@ +body { + text-align: center; +} + +#logo { + + margin: 10px 5px 5px 5px; + max-width: 200px; +} + +.ui-content{ +text-align: center; +} + +.ui-content p{ + text-align: left; +} + +#drawingCanvas { + border: 2px solid black; + height: 20em; + width: 100%; + border-radius: 15px; +} + +@media only screen and (min-width: 768px) { + body { + padding-left: 20em; + padding-right: 20em; + } +} diff --git a/www/img/Connect to home.png b/www/img/Connect to home.png new file mode 100644 index 0000000..fea7499 Binary files /dev/null and b/www/img/Connect to home.png differ diff --git a/www/img/Step_1.png b/www/img/Step_1.png new file mode 100644 index 0000000..17e4a1d Binary files /dev/null and b/www/img/Step_1.png differ diff --git a/www/index.html b/www/index.html new file mode 100644 index 0000000..5bb43a1 --- /dev/null +++ b/www/index.html @@ -0,0 +1,462 @@ + + + + + Doodle3D Connect + + + + + + + + + + + + + + + + + + + + + + + +
    + + +

    makes 3D printing very easy

    + + + +
    + + + +
    + +
    + + +
    + + +
    + Back +

    +
    + +
    +

    + + +
    + +
    + + + +
    + + +
    + Back +

    Find a WiFi-Box

    +
    + + +
    + + +

    Step 1 of 2

    +

    There's a big chance the Doodle3D WiFi-Box you're looking for is running it's own network. Please open your network settings and connect to a network like 'Doodle3D-...'. Once connected return to this page. (problems?) + + Next + +

    +
    + + + +
    + + +
    + Back +

    Find a WiFi-Box

    +
    + +
    + +

    Step 2 of 2

    + +

    We found your Doodle3D WiFi-Box. Please connect your WiFi-Box to the internet. You can also use it offline but then you aren't able to update.

    +
    + + +
    +
    + + +
    + + +
    + Back +

    Troubleshooting

    +
    + + +
    + +

    Having troubles getting started with your WiFi-Box?

    + +

    Make sure that:

    + + +

    That is not the problem?

    + + +

    Got stuck?

    + + + +
    +
    + +
    + + +
    + Back +

    Troubleshooting

    +
    + + +
    +

    If your computer has an Ethernet port you are able to connect to the WiFi-Box through the Ethernet cable. Use the Ethernet cable that is provided with the WiFi-Box. Plug one end of the cable in the WiFi-Box and the other in your computer. Usually this forces the connection of your WiFi-Box over the connection of the internet, making you able to connect to the WiFi-Box but unable to connect to the internet.

    If this is not the case, search for a connection icon (on WINDOWS usually in the lower right corner and for MAC usually in the upper right corner). Click on the icon and search for options to change your current network(probably wireless) to a cable connection.

    Once your computer is connected to the WiFi-Box, return to this page. The 'Find' page will automatically change if you have a connection to a WiFi-Box and will guide you further.

    +
    +
    + +
    + + +
    + Back +

    Troubleshooting

    +
    + + +
    +

    Locate WiFi-Box

    +

    If you are able to connect to connect.doodle3d.com through the internet this means you are connected to a network.

    + +

    If you run the WiFi-Box for the first time it creates its own network. So aside of the network you are using right now to access the internet there is another network named 'Doodle3D-...' followed by the last 6 characters of the code that is printed on the side of the WiFi-Box.

    +

    To access this network you have to connect to the WiFi-Box network instead of your own network. How you are able to switch between a network differs from device you are using, here is a list of the most common used devices:

    + + +

    Once you are connect to the WiFi-spot, the 'Find' page will automatically change and will guide you through the next steps.

    +
    +
    + + +
    + + +
    + Back +

    Doodle3D-987654 (accesspoint)

    +
    + +
    + + + +
    +
    + + + + +
    + + +
    + Back +

    Troubleshooting

    +
    + +
    + +

    If your WiFi-Box is already connected to another network, it is possible to reset the WiFi-Box and make it run it's own network again.

    + + +
    +
    + + +
    + + +
    + Back +

    Ultimaker @ Doodle3D-123456

    +
    + +
    + + + + +
    + +
    + + +
    + + +
    + Back +

    Join network

    +
    + +
    +

    Select your own network from the following list:

    +
    + +
    + +
    + + +
    + +
    + Back +

    Connect

    +
    +
    +

    Join a hidden network

    + + + +
    +
    + +
    + +
    + Back +

    Connect

    +
    +
    +

    Join a secured network

    + + +
    +
    + +
    + +
    + Back +

    Connect

    +
    +
    + +

    Connecting to network...

    +

    Your WiFi-Box is trying to connect to your local network. To use your WiFi-Box, reconnect to the network you directed the WiFi-Box to. Once you are connected return to this page.

    + +
    +
    + +
    + + +
    +
    +
    + +
    + + +
    + + + +
    +

    Settings

    + +
    + +
    + + +
    + + + +
    + Back +

    Ultimaker @ Doodle3D-123456

    +
    + +
    + +

    Tune [current value's]

    +
    + + +
    + +
    + + +
    + +
    + + +
    + +
    + + +
    + +
    + + +
    +
    +
    +
    +
    +
    +
    + +
    +
    + + +
    + + + +
    + Back +

    Ultimaker @ Doodle3D-123456

    +
    + +
    + +

    Control

    + +
    +
    +
    +
    + +
    +
    +
    +
    + +
    +
    +
    +
    + +
    + +
    + + +
    + + + +
    + Back +

    Update

    +
    + +
    + +
    + +
    + + + + + + \ No newline at end of file