Skip to content

Commit

Permalink
parameter to restrict number of entries
Browse files Browse the repository at this point in the history
  • Loading branch information
Tom Edme committed Sep 16, 2011
1 parent cd7c763 commit 1aa73dc
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 6 deletions.
3 changes: 3 additions & 0 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@
if ('4sq.tedme.kaufmich.lab' == $_SERVER['HTTP_HOST']) echo '/index.php';
?>';</script>
<script type="text/javascript" src="media/4sq.js"></script>
<?php if (array_key_exists('last', $_GET)) : ?>
<script type="text/javascript">var cmax_or = <?php echo (int) $_GET['last'] > 0 ? (int) $_GET['last'] : '-1' ; ?>;</script>
<?php endif; ?>
<script type="text/javascript" src="media/app.js"></script>
</head>

Expand Down
11 changes: 8 additions & 3 deletions media/4sq.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ var foursq = {
endpoint_url: 'https://api.foursquare.com/v2/users/self',
climit: 250,
cmax: 15,
frequency: 2500,
frequency: 3000,

atoken: null,

Expand Down Expand Up @@ -47,6 +47,7 @@ var foursq = {
function (data) { if (200 == data.meta.code) { self.user = data.response.user; } });
$.get(this.endpoint_url + '/checkins?limit=' + this.climit + '&oauth_token=' + this.atoken, null,
function (data) { if (200 == data.meta.code) { self.checkins = data.response.checkins; self.cmax = data.response.checkins.items.length; }});
if ('undefined' != typeof cmax_or && cmax_or > -1) self.cmax = cmax_or;
return (self.user && self.checkins);
},

Expand All @@ -70,8 +71,12 @@ var foursq = {

seek: function (i) {
checkin = this.checkins.items[i];
console.log(checkin);
if (checkin && checkin.venue) gmap.goToCheckin(checkin.venue.location, checkin.venue.name, '2011-09-01', checkin.venue.categories[0].name);
// console.log(checkin);
if (checkin && checkin.venue) {
var checkindate = new Date(checkin.createdAt * 1000);
var categoryname = (checkin.venue && checkin.venue.type != 'venueless' && checkin.venue.categories[0]) ? checkin.venue.categories[0].name : '';
gmap.goToCheckin(checkin.venue.location, checkin.venue.name, checkindate.toLocaleDateString(), categoryname);
}

// Some venue have disapeared ("type": "venueless")
if (checkin && checkin.venue && checkin.venue.type!='venueless' && checkin.venue.categories[0]) {
Expand Down
8 changes: 5 additions & 3 deletions media/gmap.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ var gmap = {
zoom: this.zoom,
center: this.latlng,
backgroundColor: 'white',
// mapTypeId: google.maps.MapTypeId.ROADMAP,
mapTypeId: google.maps.MapTypeId.ROADMAP,
mapTypeControl: false,
navigationControlOptions: {
style: google.maps.NavigationControlStyle.ZOOM_PAN,
Expand All @@ -48,7 +48,7 @@ var gmap = {

this.map = new google.maps.Map(document.getElementById(this.map_dom_id), mapOpts);
this.map.mapTypes.set('s4s', s4sStyledMapType);
this.map.setMapTypeId('s4s');
// this.map.setMapTypeId('s4s');

/* var checkin = new google.maps.Marker({
position: this.latlng,
Expand All @@ -67,7 +67,9 @@ var gmap = {
goToCheckin: function (coords, venue, date, category) {
latlng = new google.maps.LatLng(coords.lat, coords.lng);
// new google.maps.Marker({ position: latlng, map: this.map });
this.infowindow.setContent(venue);
var iw = '<div style="font-style: normal; text-align: center; width: 350px;"><strong>' + venue + '</strong></br>' + category + '</br>' + date + '</div>';

this.infowindow.setContent(iw);
this.infowindow.setPosition(latlng);
this.infowindow.open(this.map);
this.map.panTo(latlng);
Expand Down

0 comments on commit 1aa73dc

Please sign in to comment.