Skip to content

Commit

Permalink
Browser now registers with the server with its jabber id. New graphics.
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronpk committed Mar 6, 2011
1 parent 64dcba4 commit facf4c5
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 6 deletions.
File renamed without changes
Binary file added public/img/dot-sprite.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
33 changes: 27 additions & 6 deletions views/index.erb
Expand Up @@ -47,7 +47,7 @@ $(function(){
create: function(phono, config, callback) {callback({}); return {};}
});
var myOptions = {
zoom: 16,
zoom: 17,
center: new google.maps.LatLng(45.524164, -122.67881),
mapTypeId: google.maps.MapTypeId.ROADMAP,
mapTypeControl: false
Expand All @@ -65,13 +65,16 @@ $(function(){

$.ajax({
url: "/setup.json",
dataType: 'jsonp',
dataType: 'json',
success: showPellets
});

updateScoreBoard();
setInterval(updateScoreBoard, 5000);

updateLocations();
setInterval(updateLocations, 5000);

function updateScoreBoard() {
$.ajax({
url: "/scores.json",
Expand All @@ -86,14 +89,27 @@ $(function(){
});
}

function updateLocations() {
// aaronpk o54E612
// caseorganic rivQX0e
var tokens = ["o54E612", "rivQX0e"];
$.ajax({
url: "https://api.geoloqi.com/1/share/last?geoloqi_token=" + tokens.join(","),
dataType: "jsonp",
success: function(data) {

}
});
}

function showPellets(data) {
$(data).each(function(i, pellet) {
pellets.push({
id: pellet.place_id,
marker: new google.maps.Marker({
position: new google.maps.LatLng(pellet.latitude, pellet.longitude),
map: map,
icon: "http://i.imgur.com/4wEfc.gif"
icon: "http://loqi.me/pdx-pacmap/dot-sprite.png",
})
});
});
Expand All @@ -110,7 +126,10 @@ $(function(){
var phono = $.phono({
apiKey: "http://phono.com/",
onReady:function() {
$('#xmpp_id').html(this.sessionId);
// $('#xmpp_id').html(this.sessionId);
$.post("/register.json", {
jabber_id: this.sessionId
});
},
messaging:{
onMessage: function(event){
Expand All @@ -119,6 +138,8 @@ $(function(){
var type = serverMessage.type;
//console.log(type);

// ({"type": "pellet", "id": "rrr"})

if(type == "player") {
var id = serverMessage.id;
var latitude = serverMessage.latitude;
Expand Down Expand Up @@ -166,11 +187,11 @@ $(function(){
<table width="900">
<tr>
<td width="600">
<div id="map" style="width: 100%; height: 300px;"></div>
<div id="map" style="width: 100%; height: 500px;"></div>
</td>

<td valign="top">
Leaderboard
<div style="margin-bottom: 5px;"><img src="/img/leaderboard-text.png" /></div>

<div id="scoreboard">

Expand Down

0 comments on commit facf4c5

Please sign in to comment.