Created
October 20, 2014 17:24
-
-
Save ryankbales/cb16141835ba3a42621c to your computer and use it in GitHub Desktop.
Honeybadger Compiled JS error wrapper
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function() { | |
var e, setMap; | |
try { | |
window.getMapCoords = function() { | |
return $.getJSON("//maps.googleapis.com/maps/api/geocode/json", { | |
address: widgetMapConfig.address, | |
sensor: "false" | |
}).done(function(data) { | |
var coordinates; | |
coordinates = data.results[0].geometry.location; | |
return setMap(coordinates); | |
}); | |
}; | |
setMap = function(coordinates) { | |
var lat, latLng, lng, map, mapOptions, marker, markerOptions; | |
lat = coordinates.lat; | |
lng = coordinates.lng; | |
latLng = new google.maps.LatLng(lat, lng); | |
mapOptions = { | |
scrollwheel: widgetMapConfig.panZoom, | |
draggable: widgetMapConfig.panZoom, | |
disableDefaultUI: !widgetMapConfig.panZoom, | |
disableDoubleClickZoom: !widgetMapConfig.panZoom, | |
zoom: 16, | |
center: new google.maps.LatLng(lat, lng), | |
mapTypeId: google.maps.MapTypeId[widgetMapConfig.mapType] | |
}; | |
markerOptions = { | |
position: latLng | |
}; | |
marker = new google.maps.Marker(markerOptions); | |
map = new google.maps.Map($(".map .canvas")[0], mapOptions); | |
return marker.setMap(map); | |
}; | |
$(function() { | |
return window.widgetMapConfig = JSON.parse($('.map .config:first').html()); | |
}); | |
} catch (_error) { | |
e = _error; | |
Honeybadger.notify(e); | |
throw e; | |
} | |
}).call(this); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment