From 1835a0275f127ac2a5a128d6cd942723bb3d19e1 Mon Sep 17 00:00:00 2001 From: peteruithoven Date: Mon, 12 May 2014 14:44:21 +0200 Subject: [PATCH] Cleanup --- js/BoxPage.js | 37 +---------------------------------- js/BoxesPage.js | 2 +- js/ConnectingToNetworkPage.js | 3 ++- js/JoinNetworkPage.js | 6 ++---- js/JoinSecuredNetworkPage.js | 2 +- js/main.js | 17 ++-------------- 6 files changed, 9 insertions(+), 58 deletions(-) diff --git a/js/BoxPage.js b/js/BoxPage.js index d793cba..5693530 100644 --- a/js/BoxPage.js +++ b/js/BoxPage.js @@ -6,7 +6,7 @@ * 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 _list; var _title; @@ -58,29 +58,10 @@ var BoxPage = (function (w) { function retrieveNetworkStatus() { - //console.log("retrieveNetworkStatus"); _networkAPI.status(function(data) { - //console.log("_networkAPI.status complete"); - //console.log(" data: ",data); 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); - - /*// 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 }); @@ -122,20 +103,4 @@ var BoxPage = (function (w) { _list.listview('refresh'); // jQuery mobile enhance content _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); \ No newline at end of file diff --git a/js/BoxesPage.js b/js/BoxesPage.js index 1695129..980cf24 100644 --- a/js/BoxesPage.js +++ b/js/BoxesPage.js @@ -6,7 +6,7 @@ * 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 _page; diff --git a/js/ConnectingToNetworkPage.js b/js/ConnectingToNetworkPage.js index 8c63b1c..c21ab94 100644 --- a/js/ConnectingToNetworkPage.js +++ b/js/ConnectingToNetworkPage.js @@ -6,7 +6,7 @@ * 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 _statusField; @@ -185,6 +185,7 @@ }; _connectedBoxNetworkAPI.startAutoRefresh(); } + // when no wifiboxid or wifiboxSSID is available but we are online, we redirect to the boxes page function onListSuccess() { _backupRedirectDelay = setTimeout(function () { $.mobile.changePage("#boxes"); diff --git a/js/JoinNetworkPage.js b/js/JoinNetworkPage.js index 6264786..dc97b60 100644 --- a/js/JoinNetworkPage.js +++ b/js/JoinNetworkPage.js @@ -6,7 +6,7 @@ * 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 _list; @@ -25,7 +25,6 @@ _page = $(this); _list = _page.find("ul[data-role=listview]"); //_joinOtherItem = _list.find("#joinOther"); - //console.log(" list: ",_list); }); $.mobile.document.on( "pagebeforeshow", PAGE_ID, function( event, data ) { console.log("Join network page pagebeforeshow"); @@ -85,5 +84,4 @@ //_list.append(_joinOtherItem); _list.listview('refresh'); // jQuery mobile enhance content } -})(window); -//new JoinNetworkPage(); \ No newline at end of file +})(window); \ No newline at end of file diff --git a/js/JoinSecuredNetworkPage.js b/js/JoinSecuredNetworkPage.js index b45183b..34112cb 100644 --- a/js/JoinSecuredNetworkPage.js +++ b/js/JoinSecuredNetworkPage.js @@ -6,7 +6,7 @@ * 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 _title; diff --git a/js/main.js b/js/main.js index 1848672..3171065 100644 --- a/js/main.js +++ b/js/main.js @@ -34,7 +34,6 @@ d3d.util = { 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) { @@ -78,7 +77,6 @@ d3d.util = { preventRefresh:function(event) { if((event.which === 82 && (event.ctrlKey || event.metaKey)) || // ctrl+r event.which === 116) { // F5 - console.log("d3d.util.preventRefresh"); event.preventDefault(); event.stopImmediatePropagation(); return false; @@ -92,7 +90,6 @@ d3d.util = { warning = "Are you sure you want to leave?"; } window.onbeforeunload = function() { - console.log("WARNING:"+warning); return warning; }; }, @@ -105,22 +102,12 @@ d3d.util = { }; (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 // we parse the parameters and store them in a global object $.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; } - - //console.log("pagebeforechange, data: ",data); + if (typeof data.toPage !== "string") { return; } var url = d3d.util.parseURL(data.toPage); - //console.log(" url: ",url); - //console.log(" url.hash: ",url.hash); if(url.parameters === undefined) { return; } if(!d3d.pageParams) { d3d.pageParams = {}; } d3d.pageParams[url.hash] = url.parameters;