/*! * stack-admin-theme (https://pixinvent.com/bootstrap-admin-template/stack) * Copyright 2018 PIXINVENT * Licensed under the Themeforest Standard Licenses */ $(window).on("load",function(){function loadResults(data){var items,markers_data=[];if(data.venues.length>0){items=data.venues;for(var i=0;i'+marker.title+""),$("#markers-with-coordinates").append('
  • '+marker.title+"
  • ")}),GMaps.on("click",map.map,function(event){var index=map.markers.length,lat=event.latLng.lat(),lng=event.latLng.lng(),template=$("#edit_marker_template").text(),content=template.replace(/{{index}}/g,index).replace(/{{lat}}/g,lat).replace(/{{lng}}/g,lng);map.addMarker({lat:lat,lng:lng,title:"Marker #"+index,infoWindow:{content:content}})});var json_map;$(document).on("click",".pan-to-marker",function(e){e.preventDefault();var position,lat,lng,$index;$index=$(this).data("marker-index"),position=json_map.markers[$index].getPosition(),lat=position.lat(),lng=position.lng(),json_map.setCenter(lat,lng)}),json_map=new GMaps({div:"#json",lat:-12.043333,lng:-77.028333,styles:[{featureType:"administrative",elementType:"labels.text.fill",stylers:[{color:"#444444"}]},{featureType:"landscape",elementType:"all",stylers:[{color:"#f2f2f2"}]},{featureType:"poi",elementType:"all",stylers:[{visibility:"off"}]},{featureType:"road",elementType:"all",stylers:[{saturation:-100},{lightness:45}]},{featureType:"road.highway",elementType:"all",stylers:[{visibility:"simplified"}]},{featureType:"road.arterial",elementType:"labels.icon",stylers:[{visibility:"off"}]},{featureType:"transit",elementType:"all",stylers:[{visibility:"off"}]},{featureType:"water",elementType:"all",stylers:[{color:"#46bcec"},{visibility:"on"}]}]}),json_map.on("marker_added",function(marker){var index=json_map.markers.indexOf(marker);$("#results").append('
  • '+marker.title+"
  • "),index==json_map.markers.length-1&&json_map.fitZoom()});var xhr=$.getJSON("../../../app-assets/data/gmaps/foursquare.json?q[near]=Lima,%20PE&q[query]=Ceviche");xhr.done(printResults),xhr.done(loadResults)});