Friday, 9 October 2015

PMPML

<!DOCTYPE html>
<html>
<head>
   

        <meta name="format-detection" content="telephone=no">
        <meta name="msapplication-tap-highlight" content="no">
        <meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width">
     <link rel="stylesheet" type="text/css" href="css/index.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script>
$(document).ready(function(){
    $("#flip").click(function(){
        $("#panel").slideToggle("slow");
    });

    $.ajax({
      type:'GET',
      url: 'api/pmpml.java',
      success: function(data){
        var string = $.parseJSON(data);     //do we need this?
        $("#infocard").html(string);
      },
      error: function(){
        alert('Failed Receive');
      }
    });
});

/*var countries = [
   { value: 'Andorra', data: 'AD' },
 
   { value: 'Zimbabwe', data: 'ZZ' }
];

$('#autocomplete').autocomplete({
    lookup: countries,
    onSelect: function (suggestion) {
        alert('You selected: ' + suggestion.value + ', ' + suggestion.data);
    }
});
*/
</script>

<script>
document.addEventListener("deviceready", onDeviceReady, false);
function onDeviceReady() {
    console.log("navigator.geolocation works well");
}// onSuccess Callback
// This method accepts a Position object, which contains the
// current GPS coordinates
//
var onSuccess = function(position) {
    alert('Latitude: '          + position.coords.latitude          + '\n' +
          'Longitude: '         + position.coords.longitude         + '\n' +
          'Altitude: '          + position.coords.altitude          + '\n' +
          'Accuracy: '          + position.coords.accuracy          + '\n' +
          'Altitude Accuracy: ' + position.coords.altitudeAccuracy  + '\n' +
          'Heading: '           + position.coords.heading           + '\n' +
          'Speed: '             + position.coords.speed             + '\n' +
          'Timestamp: '         + position.timestamp                + '\n');
};

// onError Callback receives a PositionError object
//
function onError(error) {
    alert('code: '    + error.code    + '\n' +
          'message: ' + error.message + '\n');
}

navigator.geolocation.getCurrentPosition(onSuccess, onError);</script>


    <style>
      #map {
        width: 320px;
        height: 300px;
      }
    </style>


    <script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?sensor=true&libraries=places"></script>
    <link href="http://code.google.com/apis/maps/documentation/javascript/examples/default.css" rel="stylesheet" type="text/css" />


    <script type="text/javascript">
      var map;
      var infowindow;
      var service ;
      function initialize(lat,lng)
      {
        var origin = new google.maps.LatLng(lat,lng);
     
        map = new google.maps.Map(document.getElementById('map'), {
          mapTypeId: google.maps.MapTypeId.ROADMAP,
          center: origin,
          zoom: 16
        });
       
        var request = {
          location: origin,
          radius: 2500,
          types: ['train_station','bus_station','subway_station','transit_station']
        };
        infowindow = new google.maps.InfoWindow();
        service = new google.maps.places.PlacesService(map);
        service.search(request, callback);
      }

      function callback(results, status) {
        if (status == google.maps.places.PlacesServiceStatus.OK) {
          for (var i = 0; i < results.length; i++) {
            createMarker(results[i]);
          }
        }
      }

      function createMarker(place) {
     
        var placeLoc = place.geometry.location;
        var marker = new google.maps.Marker({
          map: map,
          position: place.geometry.location
        });
        var content='<strong style="font-size:1.2em">'+place.name+'</strong>'+
                    '<br/><strong>Latitude:</strong>'+placeLoc.lat()+
                    '<br/><strong>Longitude:</strong>'+placeLoc.lng()+
                    '<br/><strong>Type:</strong>'+place.types[0]+
                    '<br/><strong>Rating:</strong>'+(place.rating||'n/a');
        var more_content='<img src="http://googleio2009-map.googlecode.com/svn-history/r2/trunk/app/images/loading.gif"/>';
       
        //make a request for further details
        service.getDetails({reference:place.reference}, function (place, status)
                                    {
                                      if (status == google.maps.places.PlacesServiceStatus.OK)
                                      {
                                        more_content='<hr/><strong><a href="'+place.url+'" target="details">Details</a>';
                                       
                                        if(place.website)
                                        {
                                          more_content+='<br/><br/><strong><a href="'+place.website+'" target="details">'+place.website+'</a>';
                                        }
                                      }
                                    });


        google.maps.event.addListener(marker, 'click', function() {
         
          infowindow.setContent(content+more_content);
          infowindow.open(map, this);
        });
      }

      google.maps.event.addDomListener(window, 'load', function(){initialize(18.5549083,73.8782702);});
    </script>







</head>
<body>

<div id="flip">PuneBook</div>
<div id="panel">
    <ul>
        <a href="police.html"><li>Police</li></a><hr>
        <a href="msedcl.html"><li>MSEDCL</li></a><hr>
        <a href="pmpml.html"><li>PMPML</li></a><hr>
        <a href="complaint.html"><li>Complaint Box</li></a><hr>
        <a href="newsfeed.html"><li>Home</li></a>
    </ul>
</div>

       
        <div class="content">
            <div class="card" id="infocard">
                <h1>PMPML</h1>
                <p>It'll have something like select your destination...</p>
            </div>
           
            <div class="card">
                <input type="text" name="country" id="autocomplete" placeholder="Search for Bus Stop"/>
               
            </div>

        </div>

        <div class="card">
            <h1>Nearest Bus Stop</h1><br>
            <div id="map"></div>
            <p>Here's your location. Now walk to the nearest bus-stop.</p>

        </div>

</body>
</html>

No comments:

Post a Comment