Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
<!DOCTYPE html>
<html>
<head>
<title>foursquare :: Explore Sample</title>
<style type="text/css">
html { height: 100%; }
body { height: 100%; margin: 0; padding: 0; }
</style>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
<script type="text/javascript" src="/scripts/jquery.ba-bbq.js"></script>
<script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?sensor=false"></script>
<script type="text/javascript">
//<![CDATA[
var client_id = 'XXX';
var callback_url = 'http://developer.foursquare.com/docs/samples/explore.html';
/* Attempt to retrieve access token from URL. */
if ($.bbq.getState('access_token')) {
var token = $.bbq.getState('access_token');
$.bbq.pushState({}, 2)
} else if ($.bbq.getState('error')) {
} else {
/* Redirect for foursquare authentication. */
window.location.href = 'https://foursquare.com/oauth2/authenticate?client_id=' + client_id
+ '&response_type=token&redirect_uri=' + callback_url;
}
/* HTML 5 geolocation. */
navigator.geolocation.getCurrentPosition(function(data) {
var lat = data['coords']['latitude'];
var lng = data['coords']['longitude'];
/* Create map. */
var map = new google.maps.Map(document.getElementById("map_canvas"), {
zoom: 15,
center: new google.maps.LatLng(lat, lng),
mapTypeId: google.maps.MapTypeId.ROADMAP
});
//]]>
</script>
</head>
<body>
<div id="map_canvas" style="width: 100%; height: 100%;"></div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment