0
0
mirror of https://github.com/Doodle3D/doodle3d-connect.git synced 2024-12-26 10:33:48 +01:00
This commit is contained in:
peteruithoven 2014-05-12 14:44:21 +02:00
parent 34a28911f8
commit 1835a0275f
6 changed files with 9 additions and 58 deletions

View File

@ -6,7 +6,7 @@
* See file LICENSE.txt or visit http://www.gnu.org/licenses/gpl.html for full license details. * See file LICENSE.txt or visit http://www.gnu.org/licenses/gpl.html for full license details.
*/ */
var BoxPage = (function (w) { (function (w) {
var _page; var _page;
var _list; var _list;
var _title; var _title;
@ -58,29 +58,10 @@ var BoxPage = (function (w) {
function retrieveNetworkStatus() { function retrieveNetworkStatus() {
//console.log("retrieveNetworkStatus");
_networkAPI.status(function(data) { _networkAPI.status(function(data) {
//console.log("_networkAPI.status complete");
//console.log(" data: ",data);
data.status = parseInt(data.status,10); data.status = parseInt(data.status,10);
//console.log(" data.status: ",data.status);
//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); setNetworkStatus(data.status);
/*// 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() { }, function() {
//console.log("NetworkPanel:retrieveStatus failed");
clearTimeout(_retryRetrieveStatusDelay); clearTimeout(_retryRetrieveStatusDelay);
_retryRetrieveStatusDelay = setTimeout(_self.retrieveStatus, _retryRetrieveStatusDelayTime); // retry after delay _retryRetrieveStatusDelay = setTimeout(_self.retrieveStatus, _retryRetrieveStatusDelayTime); // retry after delay
}); });
@ -122,20 +103,4 @@ var BoxPage = (function (w) {
_list.listview('refresh'); // jQuery mobile enhance content _list.listview('refresh'); // jQuery mobile enhance content
_networkStatus = status; _networkStatus = 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); })(window);

View File

@ -6,7 +6,7 @@
* See file LICENSE.txt or visit http://www.gnu.org/licenses/gpl.html for full license details. * See file LICENSE.txt or visit http://www.gnu.org/licenses/gpl.html for full license details.
*/ */
var BoxesPage = (function (w) { (function (w) {
var _connectAPI = new ConnectAPI(); var _connectAPI = new ConnectAPI();
var _page; var _page;

View File

@ -6,7 +6,7 @@
* See file LICENSE.txt or visit http://www.gnu.org/licenses/gpl.html for full license details. * See file LICENSE.txt or visit http://www.gnu.org/licenses/gpl.html for full license details.
*/ */
(function ConnectingToNetworkPage(w) { (function (w) {
var _page; var _page;
var _statusField; var _statusField;
@ -185,6 +185,7 @@
}; };
_connectedBoxNetworkAPI.startAutoRefresh(); _connectedBoxNetworkAPI.startAutoRefresh();
} }
// when no wifiboxid or wifiboxSSID is available but we are online, we redirect to the boxes page
function onListSuccess() { function onListSuccess() {
_backupRedirectDelay = setTimeout(function () { _backupRedirectDelay = setTimeout(function () {
$.mobile.changePage("#boxes"); $.mobile.changePage("#boxes");

View File

@ -6,7 +6,7 @@
* See file LICENSE.txt or visit http://www.gnu.org/licenses/gpl.html for full license details. * See file LICENSE.txt or visit http://www.gnu.org/licenses/gpl.html for full license details.
*/ */
(function JoinNetworkPage(w) { (function (w) {
var _page; var _page;
var _list; var _list;
@ -25,7 +25,6 @@
_page = $(this); _page = $(this);
_list = _page.find("ul[data-role=listview]"); _list = _page.find("ul[data-role=listview]");
//_joinOtherItem = _list.find("#joinOther"); //_joinOtherItem = _list.find("#joinOther");
//console.log(" list: ",_list);
}); });
$.mobile.document.on( "pagebeforeshow", PAGE_ID, function( event, data ) { $.mobile.document.on( "pagebeforeshow", PAGE_ID, function( event, data ) {
console.log("Join network page pagebeforeshow"); console.log("Join network page pagebeforeshow");
@ -86,4 +85,3 @@
_list.listview('refresh'); // jQuery mobile enhance content _list.listview('refresh'); // jQuery mobile enhance content
} }
})(window); })(window);
//new JoinNetworkPage();

View File

@ -6,7 +6,7 @@
* See file LICENSE.txt or visit http://www.gnu.org/licenses/gpl.html for full license details. * See file LICENSE.txt or visit http://www.gnu.org/licenses/gpl.html for full license details.
*/ */
(function JoinSecuredNetworkPage(w) { (function (w) {
var _page; var _page;
var _title; var _title;

View File

@ -34,7 +34,6 @@ d3d.util = {
return d3d.pageParams[pageID]; return d3d.pageParams[pageID];
}, },
replaceURLParameters:function(href,parameters){ replaceURLParameters:function(href,parameters){
//console.log("replaceURLParameters: ",href,parameters);
href = href.split("?")[0]; href = href.split("?")[0];
var i = 0; var i = 0;
jQuery.each(parameters, function (key,value) { jQuery.each(parameters, function (key,value) {
@ -78,7 +77,6 @@ d3d.util = {
preventRefresh:function(event) { preventRefresh:function(event) {
if((event.which === 82 && (event.ctrlKey || event.metaKey)) || // ctrl+r if((event.which === 82 && (event.ctrlKey || event.metaKey)) || // ctrl+r
event.which === 116) { // F5 event.which === 116) { // F5
console.log("d3d.util.preventRefresh");
event.preventDefault(); event.preventDefault();
event.stopImmediatePropagation(); event.stopImmediatePropagation();
return false; return false;
@ -92,7 +90,6 @@ d3d.util = {
warning = "Are you sure you want to leave?"; warning = "Are you sure you want to leave?";
} }
window.onbeforeunload = function() { window.onbeforeunload = function() {
console.log("WARNING:"+warning);
return warning; return warning;
}; };
}, },
@ -105,22 +102,12 @@ d3d.util = {
}; };
(function (w) { (function (w) {
//$(function () { // To get to url parameters we need the url
//to get to url parameters we need the url
// only pagecontainer events contain url's // only pagecontainer events contain url's
// we parse the parameters and store them in a global object // we parse the parameters and store them in a global object
$.mobile.document.on( "pagebeforechange", function( event, data ) { $.mobile.document.on( "pagebeforechange", function( event, data ) {
//console.log("pagebeforechange");
//console.log(" event: ",event);
//console.log(" data: ",data);
//d3d.pageParams[pageID]
//console.log(" data.toPage: ",data.toPage);
if (typeof data.toPage !== "string") { return; } if (typeof data.toPage !== "string") { return; }
//console.log("pagebeforechange, data: ",data);
var url = d3d.util.parseURL(data.toPage); var url = d3d.util.parseURL(data.toPage);
//console.log(" url: ",url);
//console.log(" url.hash: ",url.hash);
if(url.parameters === undefined) { return; } if(url.parameters === undefined) { return; }
if(!d3d.pageParams) { d3d.pageParams = {}; } if(!d3d.pageParams) { d3d.pageParams = {}; }
d3d.pageParams[url.hash] = url.parameters; d3d.pageParams[url.hash] = url.parameters;