{"size": 1492, "ext": "js", "max_stars_repo_path": "web/js/results.js", "max_stars_repo_name": "teamP5OCCPM/observons_nao", "max_stars_repo_stars_event_min_datetime": "2017-11-12T04:12:35.000Z", "max_stars_repo_stars_event_max_datetime": "2017-11-12T04:12:35.000Z", "max_issues_repo_path": "web/js/results.js", "max_issues_repo_name": "teamP5OCCPM/observons_nao", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "web/js/results.js", "max_forks_repo_name": "teamP5OCCPM/observons_nao", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": 1, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 27.6296296296, "max_line_length": 145, "alphanum_fraction": 0.5455764075}

function initMap(){
  var france = {
      lat: 46.227638,
      lng: 2.213749000000007
  }
  var map = new google.maps.Map(document.getElementById('mapResults'), {
    zoom: 6,
    center: france
  });

  var infowindow = new google.maps.InfoWindow();
  var marker, i;
  var markers = [];
  var img = "{{asset('assets/img.green-bird.png') }}"; // icon to use for markers

  $.getJSON("../results.json", function(data) {
      var loc = JSON.stringify(data);
      console.log(loc);
      var locations = JSON.parse(loc);

      for (i = 0; i < locations.length; i++) {
          marker = new google.maps.Marker({
              position: new google.maps.LatLng(locations[i]['lat'], locations[i]['lng']),
              map: map,
              //TODO: add icon (problem with path)

          });
          markers.push(marker);
          google.maps.event.addListener(marker, 'click', (function(marker, i) {
          return function() {
              infowindow.setContent(locations[i]['title']);
              infowindow.open(map, marker);
              }
          })(marker, i));

          ;
          markers.push(marker);

      }
  });
}

$(document).ready( function() {
    var btnText = $('#style-button').text();
   $('#style-button').click( function() {
       $('.style-results').toggle("slow");
       $('#style-button').text() === "Afficher la map"? $('#style-button').text("Afficher la liste"): $('#style-button').text("Afficher la map");
   });
   console.log(btnText);
});


