Skip to content

Commit

Permalink
Merge branch 'dom-update' into techcrunch
Browse files Browse the repository at this point in the history
  • Loading branch information
Davis Barber committed Sep 9, 2011
2 parents 02137c9 + 8e85da3 commit fcaf373
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 19 deletions.
5 changes: 2 additions & 3 deletions src/faker.coffee
Expand Up @@ -52,18 +52,17 @@ fakeData = (feed_name="ford", swarm_id=config.swarms[Math.floor(Math.random() *
headers: { 'X-BugSwarmApiKey': config.producer_key }

car = cars[Math.floor(Math.random() * cars.length)]
car_name = "#{car.name} #{++car.count}"

req = http.request options, (res) ->
setInterval ->
feed =
car_name: car_name
car_name: car.name
latitude: center_latitude + Math.random() * max_distance
longitude: center_longitude + Math.random() * max_distance
for feeder in config.feeds
feed[feeder.name] = Math.floor(Math.random() * feeder.max)
req.write JSON.stringify feed
, 5000
, 3000 + (Math.random() * 2000)
req.write '\n'
reqs.push req

Expand Down
5 changes: 3 additions & 2 deletions src/public/scripts/lepidoptera.coffee
Expand Up @@ -44,12 +44,12 @@ lepidoptera = ->

updateFeed = (resource_id, body) ->
data = JSON.parse body.data
down = Math.random() < .5

console.log "updateFeed(#{resource_id},#{JSON.stringify data})"
console.log "updateFeed(#{resource_id},#{JSON.stringify data}, #{down})"

dom_name = $("##{resource_id} > .car_name")
dom_name.html(data.car_name) if dom_name[0]?

for feed in config.feeds
# if the feed doesn't exist, add it
dom_feed = $("##{resource_id} > .feeds > .#{feed.name}")
Expand All @@ -59,6 +59,7 @@ lepidoptera = ->

# replace the inner html with the new mpg data
dom_feed.find(".data").html "#{data[feed.name]}"
dom_feed.toggleClass('down', down)

# see if we have a marker on the map for this resource
for m in markers
Expand Down
30 changes: 16 additions & 14 deletions src/public/stylesheets/screen.css
Expand Up @@ -109,10 +109,11 @@ html, body {
margin-top:0px;
margin-right:0px;
margin-left:10px;
width: 500px;
}

#content #map_canvas {
width:828px;
width:778px;
height:625px;
float:left;
margin-left: 10px;
Expand All @@ -122,7 +123,7 @@ html, body {
* SIDEBAR
*/
#content #sidebar {
width:325px;
width:375px;
height:625px;
float:right;
margin-right:20px;
Expand Down Expand Up @@ -158,26 +159,26 @@ html, body {
margin:0px;
padding:0px;
overflow:auto;
width:325px;
width:375px;
}

#content #sidebar #resources .resource {
background-color:#77797E;
height:100px;
height:140px;
margin-bottom:10px;
}

#content #sidebar #resources .resource .car_icon_wrapper {
background-image:url("../images/icon-car-list-inactive.png");
background-repeat:no-repeat;
width:50px;
height:35px;
height:45px;
float:left;
margin:0px;
padding:0px;
margin-right:10px;
margin-left:5px;
margin-top:15px;
margin-top:25px;
}

#content #sidebar #resources .resource.alive .car_icon_wrapper {
Expand All @@ -191,16 +192,16 @@ html, body {

#content #sidebar #resources .resource .car_name {
font-family:Cabin;
font-size:18px;
font-size:23px;
color:#FFFFFF;
width:100px;
height:35px;
height:45px;
float:left;
margin-top:15px;
margin-top:20px;
}

#content #sidebar #resources .resource .feeds {
height:50px;
height:75px;
margin:0px;
padding:0px;
background-color:#707277;
Expand All @@ -212,16 +213,17 @@ html, body {
width:35%;
float:left;
font-family:Arial;
font-size:15px;
font-size:20px;
color:#D7D7D7;
margin-top:5px;
margin-bottom:8px;
}

#content #sidebar #resources .resource .feeds .feed .icon_wrapper {
margin:0px;
padding:0px;
font-family:Arial;
font-size:15px;
font-size:20px;
color:#D7D7D7;
float:left;
margin-left:8px;
Expand All @@ -235,7 +237,7 @@ html, body {
height:15px;
}

#content #sidebar #resources .resource .feeds .feed.change.down .icion_wrapper {
#content #sidebar #resources .resource .feeds .feed.change.down .icon_wrapper {
background-image:url("../images/icon-arrow-down.png");
}

Expand All @@ -246,7 +248,7 @@ html, body {

#content #sidebar #resources .resource .feeds .feed .data {
font-family:Arial;
font-size:15px;
font-size:20px;
color:#FFFFFF;
margin-left:2px;
margin-top:2px;
Expand Down

0 comments on commit fcaf373

Please sign in to comment.