daily pastebin goal
1%
SHARE
TWEET

locator.pheeble.net

filipegoneves Nov 8th, 2012 37 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  3. <html xmlns="http://www.w3.org/1999/xhtml" >
  4. <head>
  5. <title>locator</title>
  6.  
  7. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1;" />
  8. <style type="text/css">
  9. body {min-height:1200px; height: 100%; font-family: sans-serif;background-image:url('blue-bg.jpg');background-repeat:repeat;}
  10. #container {width:500px;margin:0 auto;}
  11. #w{margin:0 auto;margin-top:300px;width:146px;}
  12. div.compass{float:left;width:162px;min-height:162px;text-align:center;color:white;vertical-align:middle;}
  13. div.first{width:162px;margin:0 auto;clear:both;}
  14. div.posholder{margin-top:48%;font-size:130%;font-weight:bold}
  15. div.error p{text-align:center;color:white;margin:2em;}
  16. </style>
  17. <script type="text/javascript" src="json-minified.js"></script>
  18. <script type="text/javascript" src="ajax.js"></script>
  19. <script type="text/javascript">
  20. window.addEventListener("load", detectPos, false);
  21.  
  22. function detectPos() {
  23.   navigator.geolocation.getCurrentPosition(usePos);
  24. }
  25.  
  26. function usePos(position) {
  27.   var c = position.coords;
  28.   var lat = c.latitude;
  29.   var lon = c.longitude;
  30.   var params = new Array;
  31.   params.push([ "latitude", lat ],[ "longitude", lon ]);
  32.   sendRequest("http://locator.pheeble.net/locate", params, returnSub);
  33. }
  34.  
  35. function returnSub(response) {
  36.   document.getElementById("results").innerHTML = '';
  37.   var obj = jsonParse(response);
  38.   var html;
  39.   if (obj.status == "failed") html = '<div class="error"><p>Could not reliably determine location.</p></div>';
  40.   else if (obj.status == "success") {
  41.     var lat   = obj.latitude;
  42.     var lon   = obj.longitude;
  43.     html = '<div id="container">\n';
  44.    var b = obj.bearings;
  45.     html += '<div class="compass"><div class="posholder">lat:<br/>'+ lat + "</div></div>\n";
  46.         html += '<div class="compass"><img src="http://locator.pheeble.net/compasses/' + b[0].bearing + '.png" alt="' + b[0].bearing + '" width="162" height="162"></div>\n';
  47.     html += '<div class="compass"><div class="posholder">lon:<br/>'+ lon + "</div></div>\n";
  48.  
  49.     for (var i = 1; i < b.length; i++) {
  50.      html += '<div class="compass"><img src="http://locator.pheeble.net/compasses/' + b[i].bearing + '.png" alt="' + b[i].bearing + '" width="162" height="162"></div>\n';
  51.     }
  52.     html += '</div>\n';
  53.   }
  54.   document.getElementById("results").innerHTML = html;
  55. }
  56. </script>
  57. </head>
  58. <body>
  59. <noscript><div class="error"><p>You will have to enable JavaScript for this to work.</p></div></noscript>
  60. <div id="results"><div id="w"><img src="skipper.gif"/></div></div>
  61. </body>
  62. </html>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top