{"size": 2493, "ext": "js", "max_stars_repo_path": "Restaurant Reviews App/dist/js/main.js", "max_stars_repo_name": "rajanikantdeshmukh/MWS-Nanodegree-Projects", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "Restaurant Reviews App/dist/js/main.js", "max_issues_repo_name": "rajanikantdeshmukh/MWS-Nanodegree-Projects", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Restaurant Reviews App/dist/js/main.js", "max_forks_repo_name": "rajanikantdeshmukh/MWS-Nanodegree-Projects", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 2493.0, "max_line_length": 2493, "alphanum_fraction": 0.742478941}
"use strict";$(document).ready(function(){var a={map:null,markers:[],initMap:function(){this.map=L.map("map",{center:[40.722216,-73.987501],zoom:12,scrollWheelZoom:!1}),L.tileLayer("https://api.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.jpg70?access_token={mapboxToken}",{mapboxToken:MAPBOX_API_KEY,maxZoom:18,attribution:'Map data &copy; <a href="https://www.openstreetmap.org/">OpenStreetMap</a> contributors, <a href="https://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, Imagery © <a href="https://www.mapbox.com/">Mapbox</a>',id:"mapbox.streets"}).addTo(this.map)},showRestaurants:function(e){this.updateNeighborhoods(),this.updateCuisines(),this.updateRestaurants()},showNoDataView:function(){},showLoadingView:function(){},updateNeighborhoods:function(){var t=this;Helpers.db.restaurants.getNeighborhoods().then(function(e){e.forEach(function(e){$("#neighborhoods-select").append($("<option>",{value:e,text:e}))}),$("#neighborhoods-select").on("change",t.updateRestaurants)}).catch(function(e){console.error(e)})},updateCuisines:function(){var t=this;Helpers.db.restaurants.getCuisines().then(function(e){e.forEach(function(e){$("#cuisines-select").append($("<option>",{value:e,text:e}))}),$("#cuisines-select").on("change",t.updateRestaurants)}).catch(function(e){console.error(e)})},updateRestaurants:function(){var e=$("#cuisines-select").find(":selected").val(),t=$("#neighborhoods-select").find(":selected").val();Helpers.db.restaurants.getFiltered({cuisine:e,neighborhood:t}).then(function(e){$("#restaurants-grid").empty(),e.forEach(function(e){$("#restaurants-grid").append(Helpers.ui.restaurantElement(e))}),a.updateMapMarkers(e)}).catch(function(e){console.error(e)})},updateMapMarkers:function(e){var a=this;this.markers&&this.markers.forEach(function(e){return e.remove()}),this.markers=[],e.forEach(function(e){var t=Helpers.map.mapMarkerForRestaurant(e,a.map);t.on("click",function(){return window.location.href=t.options.url}),a.markers.push(t)})}};a.initMap(),a.showLoadingView(),Helpers.network.restaurants.getAll().then(function(e){Helpers.db.restaurants.addAll(e),a.showRestaurants(e),e.forEach(function(e){Helpers.network.reviews.getForRestaurant(e.id).then(function(e){Helpers.db.reviews.addAll(e)})})}).catch(function(e){Helpers.db.restaurants.getAll().then(function(e){a.showRestaurants(e)}).then(function(e){a.showNoDataView()}),console.log("NetworkHelper failed to load restaurants"),console.log(e),M.toast({html:"No Network! ＼(￣O￣)",classes:"rounded"})})});