fixed race in initial location
authordrowe67 <drowe67@01035d8c-6547-0410-b346-abe4f91aad63>
Mon, 27 May 2013 02:00:27 +0000 (02:00 +0000)
committerdrowe67 <drowe67@01035d8c-6547-0410-b346-abe4f91aad63>
Mon, 27 May 2013 02:00:27 +0000 (02:00 +0000)
git-svn-id: https://svn.code.sf.net/p/freetel/code@1281 01035d8c-6547-0410-b346-abe4f91aad63

foxy/foxy.html

index 5c286186a5738d2bf5577e8a4ca9656366c8726d..e38b58f3b5ec54053a55f18e11c57e4a2b2965ff 100644 (file)
       navigator.geolocation.getCurrentPosition(function(position) {
         lat = geolat = position.coords.latitude;
         lng = geolng = position.coords.longitude;
+        continueInit();
       }, function() {
         geolocationSupport = false;
+        continueInit();
       });
     }
+  }
 
+  function continueInit() {
     // if we have a compass use it to get bearing
 
     testForCompass();
   function getCookie() {
                        
     if (document.cookie.length > 0) {
+      log("cookie found");
       cookieStart = document.cookie.indexOf(cookiename + "=");
 
       // lets see if our cookie exists
         debug_enable = parseInt(bits[3]);
       }
     }
-    else {      
+    else {  
       lat = geolat;
       lng = geolng;
-      myzoom = 10;
+      myzoom = 12;
+      log("no cookie, lat = " + lat + "lng = " + lng);
     }
 
   }
 </script>
 
 </head>
-<body onload="initialize()" >
+<body onload="initialize()" onunload="setCookie()">
 
   <div id="main-map">
   </div>