Browse files

Simplified CSS, added N and N Owl

  • Loading branch information...
1 parent f1469c9 commit 905f4d18b647d6eeb7ad1df7eeb6173830c244a1 @brendannee committed Oct 24, 2011
Showing with 45 additions and 24 deletions.
  1. +2 −2 css/style.css
  2. +24 −2 index.html
  3. +19 −20 js/main.js
View
4 css/style.css
@@ -108,7 +108,7 @@ body{
line-height:2em;
}
-.departure .time{
+.departure .times span{
float:left;
padding:0.1em;
margin:0 0.1em;
@@ -133,7 +133,7 @@ body{
background: linear-gradient(top, #ffffff 0%,#e5e5e5 100%); /* W3C */
}
-.departure .first{
+.departure .times span:first-child{
width:3.5em;
color:#0037c3;
}
View
26 index.html
@@ -41,59 +41,81 @@
<div id="muni12_4668" class="departure">
<div class="colorbox">12</div>
<div class="destination">Folsom</div>
+ <div class="times"></div>
</div>
<div id="muni14_5551" class="departure">
<div class="colorbox">14</div>
<div class="destination">Mission</div>
+ <div class="times"></div>
</div>
<div id="muni14L_5551" class="departure">
<div class="colorbox">14L</div>
<div class="destination">Mission</div>
+ <div class="times"></div>
</div>
- <div id="muni22_3291" class="departure">
+ <div id="muni22_7289" class="departure">
<div class="colorbox">22</div>
<div class="destination">Church/Fillmore</div>
+ <div class="times"></div>
</div>
<div id="muni49_5551" class="departure">
<div class="colorbox">49</div>
<div class="destination">Van Ness</div>
+ <div class="times"></div>
</div>
</div>
<div id="muni_south" class="muni transitBox">
<h3>MUNI Southbound</h3>
<div id="muni12_4669" class="departure">
<div class="colorbox">12</div>
<div class="destination">Folsom</div>
+ <div class="times"></div>
</div>
<div id="muni14_5552" class="departure">
<div class="colorbox">14</div>
<div class="destination">Mission</div>
+ <div class="times"></div>
</div>
<div id="muni14L_5552" class="departure">
<div class="colorbox">14L</div>
<div class="destination">Mission</div>
+ <div class="times"></div>
</div>
<div id="muni49_5552" class="departure">
<div class="colorbox">49</div>
<div class="destination">Mission</div>
+ <div class="times"></div>
</div>
</div>
<div id="muni_east" class="muni transitBox">
<h3>MUNI Eastbound</h3>
<div id="muni22_3293" class="departure">
<div class="colorbox">22</div>
<div class="destination">16th St</div>
+ <div class="times"></div>
</div>
- <div id="muni33_3292" class="departure">
+ <div id="muni33_7289" class="departure">
<div class="colorbox">33</div>
<div class="destination">16th St</div>
+ <div class="times"></div>
</div>
</div>
<div id="muni_east" class="muni transitBox">
<h3>MUNI Westbound</h3>
<div id="muni33_3299" class="departure">
<div class="colorbox">33</div>
<div class="destination">18th St, Ashbury St</div>
+ <div class="times"></div>
+ </div>
+ <div id="muniN_6996" class="departure">
+ <div class="colorbox">N</div>
+ <div class="destination">Ocean Beach</div>
+ <div class="times"></div>
+ </div>
+ <div id="muniNOWL_5696" class="departure">
+ <div class="colorbox">N OWL</div>
+ <div class="destination">Ocean Beach</div>
+ <div class="times"></div>
</div>
</div>
View
39 js/main.js
@@ -156,6 +156,7 @@ function getBART(){
departure.div = '<div class="departure">';
departure.div += '<div class="colorbox" style="background:' + color + '"></div>';
departure.div += '<div class="destination">' + departure.destination + '</div>';
+ departure.div += '<div class="times">';
departure.times = [];
@@ -168,16 +169,12 @@ function getBART(){
departure.times.push(minutes);
departure.direction = $(data).find('direction').text();
-
- //Add "min" to first departure
- if(j == 0){
- departure.div += '<span class="time first">' + minutes + ' min</span>';
- } else {
- departure.div += '<span class="time">' + minutes + '</span>';
- }
+
+ departure.div += '<span>' + minutes + ' min</span>';
}
});
departure.div += '</div>';
+ departure.div += '</div>';
//Check if first time is less than 40 minutes away. If not, discard entire destination
if(departure.times[0] < 40){
@@ -253,19 +250,27 @@ function getMUNI(){
},
{
route: 22,
- stop:3291
+ stop:7289
},
{
route: 22,
stop:3293
},
{
route: 33,
- stop:3292
+ stop:7289
},
{
route: 33,
stop:3299
+ },
+ {
+ route: 'N',
+ stop:6996
+ },
+ {
+ route: 'N OWL',
+ stop:5696
}
];
@@ -283,10 +288,10 @@ function getMUNI(){
},
dataType: 'xml',
success:function(result){
- var div = $('#muni' + route + '_' + stop);
+ var div = $('#muni' + route.toString().replace(/\s/g, '') + '_' + stop);
- //Remove old times
- $('#muni' + route + '_' + stop + ' span').remove();
+ //Clear old times
+ $('.times', div).html('');
//Check if route is still running
if($(result).find('prediction').length > 0){
@@ -298,12 +303,7 @@ function getMUNI(){
//Limit to 3 results, only show times less than 100, don't show results that are 0
if(count < 3 && $(data).attr('minutes') < 100 && $(data).attr('minutes') > 0){
- //Add "min" to first time
- if(count == 0){
- div.append('<span class="time first">' + $(data).attr('minutes') + ' min</span>');
- } else {
- div.append('<span class="time">' + $(data).attr('minutes') + '</span>');
- }
+ $('.times', div).append('<span>' + $(data).attr('minutes') + ' min</span>');
count++;
}
@@ -377,8 +377,7 @@ function launchMap(){
{x:-122.41608,y:37.76827,labeltext:'12'},
{x:-122.41485,y:37.76573,labeltext:'12'},
{x:-122.41606,y:37.76495,labeltext:'22, 33'},
- {x:-122.41903,y:37.76540,labeltext:'22'},
- {x:-122.42009,y:37.76454,labeltext:'33'},
+ {x:-122.41606,y:37.76565,labeltext:'22, 33'},
];

0 comments on commit 905f4d1

Please sign in to comment.