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

Congratulate user, delay redirect

This commit is contained in:
peteruithoven 2014-05-07 15:36:35 +02:00
parent d2ba115f63
commit 79e201c3ff

View File

@ -19,6 +19,8 @@
var _wifiboxid; var _wifiboxid;
var _connectedChecking = false; var _connectedChecking = false;
var CONNECTED_REDIRECT_DELAY = 5000;
var PAGE_ID = "#connecting_to_network"; var PAGE_ID = "#connecting_to_network";
var _self = this; var _self = this;
@ -124,18 +126,26 @@
connectedBoxNetworkAPI.updated = function(data) { connectedBoxNetworkAPI.updated = function(data) {
data.status = parseInt(data.status,10); data.status = parseInt(data.status,10);
console.log(PAGE_ID+":connectedBoxNetworkAPI:onStatusUpdated: ",data.status); console.log(PAGE_ID+":connectedBoxNetworkAPI:onStatusUpdated: ",data.status);
// if box finished connecting
if(data.status === NetworkAPI.STATUS.CONNECTED) { if(data.status === NetworkAPI.STATUS.CONNECTED) {
// redirect to it's box page console.log(" found connected box");
console.log(" redirect to box"); _statusField.html("Connected to "+_pageData.ssid);
var linkParams = {localip: boxData.localip,wifiboxid: boxData.wifiboxid}; _actionField.html("Congratulations the box is connected to <b>"+_pageData.ssid+"</b>. You will be redirected in a moment...");
var link = "#box"; _actionField.attr("class","info");
link = d3d.util.replaceURLParameters(link,linkParams);
$.mobile.changePage(link);
connectedBoxNetworkAPI.stopAutoRefresh();
// disable warnings that are enabled on boxes page setTimeout(function () {
d3d.util.disableRefreshPrevention(); // redirect to it's box page
d3d.util.disableLeaveWarning(); console.log(" redirect to box");
var linkParams = {localip: boxData.localip,wifiboxid: boxData.wifiboxid};
var link = "#box";
link = d3d.util.replaceURLParameters(link,linkParams);
$.mobile.changePage(link);
connectedBoxNetworkAPI.stopAutoRefresh();
// disable warnings that are enabled on boxes page
d3d.util.disableRefreshPrevention();
d3d.util.disableLeaveWarning();
},CONNECTED_REDIRECT_DELAY);
} }
}; };
connectedBoxNetworkAPI.startAutoRefresh(); connectedBoxNetworkAPI.startAutoRefresh();