0
0
mirror of https://github.com/Doodle3D/doodle3d-connect.git synced 2024-11-05 07:03:24 +01:00

Redirect to start page when no parameters available

This commit is contained in:
peteruithoven 2014-05-14 12:00:02 +02:00
parent 985530b896
commit ad2c2fcb4e
5 changed files with 17 additions and 1 deletions

View File

@ -44,6 +44,10 @@
$.mobile.document.on( "pagebeforeshow", PAGE_ID, function( event, data ) {
console.log("Box page pagebeforeshow");
_boxData = d3d.util.getPageParams(PAGE_ID);
if(_boxData === undefined) {
$.mobile.changePage("#boxes");
return;
}
var boxURL = "http://"+_boxData.localip;
//console.log(" _boxData: ",_boxData);

View File

@ -38,6 +38,10 @@
$.mobile.document.on( "pagebeforeshow", PAGE_ID, function( event, data ) {
console.log("Connecting to network page pagebeforeshow");
_pageData = d3d.util.getPageParams(PAGE_ID);
if(_pageData === undefined) {
$.mobile.changePage("#boxes");
return;
}
var boxURL = "http://"+_pageData.localip;
var form = data.prevPage.find("form");

View File

@ -29,6 +29,10 @@
$.mobile.document.on( "pagebeforeshow", PAGE_ID, function( event, data ) {
console.log("Join network page pagebeforeshow");
_boxData = d3d.util.getPageParams(PAGE_ID);
if(_boxData === undefined) {
$.mobile.changePage("#boxes");
return;
}
var boxURL = "http://"+_boxData.localip;
console.log(" _boxData: ",_boxData);

View File

@ -34,6 +34,10 @@
$.mobile.document.on( "pagebeforeshow", PAGE_ID, function( event, data ) {
console.log(PAGE_ID+" pagebeforeshow");
_pageData = d3d.util.getPageParams(PAGE_ID);
if(_pageData === undefined) {
$.mobile.changePage("#boxes");
return;
}
console.log(" _pageData: ",_pageData);
_title.text("Join "+_pageData.ssid);
_form.attr("id","Join "+_pageData.ssid);

View File

@ -105,11 +105,11 @@ d3d.util = {
// 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
d3d.pageParams = {};
$.mobile.document.on( "pagebeforechange", function( event, data ) {
if (typeof data.toPage !== "string") { return; }
var url = d3d.util.parseURL(data.toPage);
if(url.parameters === undefined) { return; }
if(!d3d.pageParams) { d3d.pageParams = {}; }
d3d.pageParams[url.hash] = url.parameters;
// let jQuery mobile navigate to page (providing only the page id so it understands)