Skip to content

Commit 90575da

Browse files
committed
Now using underscore for templating and backbone for the collection of results.
other changes: - namespace changed to simplify. Main methods are now in sf.data and sf.display - separate sf.plugins. This will probably move to a lazy load but for now it's small and we'll keep it in split-flap.js - just one html file for the airport stuff: "flights.php". It dynamically sets the "arrvals" or "departures" string based on the "data" query parameter in the URL - data structure changed. I decided the array of values for each category, while elegant, is potentially confusing. So it's more explicit now, and the classes for each group match the name of the values.
1 parent fe42e86 commit 90575da

7 files changed

Lines changed: 510 additions & 1685 deletions

File tree

‎arrivals.html‎

Lines changed: 0 additions & 699 deletions
This file was deleted.

‎data/airport_schedule.php‎

Lines changed: 25 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,8 @@
55
// "results": [
66
// {
77
// "source" : "arrivals",
8-
// "key" : ["scheduled", "city", "airline", "gate", "status", "remarks"],
98
// "data" : {
10-
// "101" : ["0728", "London", "0", "C21", "1", "est 2130+"],
11-
// "96" : ["0952", "Madrid", "1", "A7", "0", ""]
9+
// "101" : {"scheduled":"0728", "city":"London", "airline":"0", "gate":"C21", "status":"1", "remarks":"est 2130+"}
1210
// }
1311
// }
1412
// ]
@@ -27,43 +25,37 @@ function randomTime(){
2725

2826
$arrivals = array(
2927
"source" => "arrivals",
30-
"key" => array(
31-
"flight" => array("scheduled", "city", "airline", "gate", "status", "remarks")
32-
),
3328
"data" => array(
34-
" 101" => array(randomTime(),"Atlanta",rand(0,9),"C21","1","10m early"),
35-
" 96" => array(randomTime(),"Baltimore",rand(0,9),"A7","0",""),
36-
"7420" => array(randomTime(),"Charleston",rand(0,9),"A18","0",""),
37-
" 1" => array(randomTime(),"Durban",rand(0,9),"D44","1","delayed"),
38-
" 99" => array(randomTime(),"Edinburgh",rand(0,9),"A12","0",""),
39-
" 215" => array(randomTime(),"Frankfurt",rand(0,9),"B2","0",""),
40-
" 174" => array(randomTime(),"Galveston",rand(0,9),"B14","0",""),
41-
" 41" => array(randomTime(),"Houston",rand(0,9),"C6","0",""),
42-
"4476" => array(randomTime(),"Indianapolis",rand(0,9),"D16","0",""),
43-
" 112" => array(randomTime(),"Jakarta",rand(0,9),"A6","0",""),
44-
"2145" => array(randomTime(),"Karachi",rand(0,9),"C7","0",""),
45-
"7772" => array(randomTime(),"Los Angeles",rand(0,9),"B12","0","")
29+
" 101" => array("scheduled"=>randomTime(),"city"=>"Atlanta","airline"=>rand(0,9),"gate"=>"C21","status"=>"1","remarks"=>"10m early"),
30+
" 96" => array("scheduled"=>randomTime(),"city"=>"Baltimore","airline"=>rand(0,9),"gate"=>"A7","status"=>"0","remarks"=>""),
31+
"7420" => array("scheduled"=>randomTime(),"city"=>"Charleston","airline"=>rand(0,9),"gate"=>"A18","status"=>"0","remarks"=>""),
32+
" 1" => array("scheduled"=>randomTime(),"city"=>"Durban","airline"=>rand(0,9),"gate"=>"D44","status"=>"1","remarks"=>"delayed"),
33+
" 99" => array("scheduled"=>randomTime(),"city"=>"Edinburgh","airline"=>rand(0,9),"gate"=>"A12","status"=>"0","remarks"=>""),
34+
" 215" => array("scheduled"=>randomTime(),"city"=>"Frankfurt","airline"=>rand(0,9),"gate"=>"B2","status"=>"0","remarks"=>""),
35+
" 174" => array("scheduled"=>randomTime(),"city"=>"Galveston","airline"=>rand(0,9),"gate"=>"B14","status"=>"0","remarks"=>""),
36+
" 41" => array("scheduled"=>randomTime(),"city"=>"Houston","airline"=>rand(0,9),"gate"=>"C6","status"=>"0","remarks"=>""),
37+
"4476" => array("scheduled"=>randomTime(),"city"=>"Indianapolis","airline"=>rand(0,9),"gate"=>"D16","status"=>"0","remarks"=>""),
38+
" 112" => array("scheduled"=>randomTime(),"city"=>"Jakarta","airline"=>rand(0,9),"gate"=>"A6","status"=>"0","remarks"=>""),
39+
"2145" => array("scheduled"=>randomTime(),"city"=>"Karachi","airline"=>rand(0,9),"gate"=>"C7","status"=>"0","remarks"=>""),
40+
"7772" => array("scheduled"=>randomTime(),"city"=>"Los Angeles","airline"=>rand(0,9),"gate"=>"B12","status"=>"0","remarks"=>"")
4641
)
4742
);
4843

4944
$departures = array(
5045
"source" => "departures",
51-
"key" => array(
52-
"flight" => array("scheduled", "city", "airline", "gate", "status", "remarks")
53-
),
5446
"data" => array(
55-
" 101" => array(randomTime(),"Ouagadougou",rand(0,9),"C21","1","est 2130+"),
56-
" 96" => array(randomTime(),"Panama City",rand(0,9),"A7","0",""),
57-
"7420" => array(randomTime(),"Quanduc",rand(0,9),"A18","0",""),
58-
" 1" => array(randomTime(),"Rotterdam",rand(0,9),"D44","1","cancelled"),
59-
" 99" => array(randomTime(),"Seoul",rand(0,9),"A12","0",""),
60-
" 215" => array(randomTime(),"Tashkent",rand(0,9),"B2","0",""),
61-
" 174" => array(randomTime(),"Ulaanbaatar",rand(0,9),"B14","1","weather"),
62-
" 41" => array(randomTime(),"Valparaiso",rand(0,9),"C6","0",""),
63-
"4476" => array(randomTime(),"Wagga Wagga",rand(0,9),"D16","0",""),
64-
" 112" => array(randomTime(),"Xuzhou",rand(0,9),"A6","0",""),
65-
"2145" => array(randomTime(),"Yakutsk",rand(0,9),"C7","0",""),
66-
"7772" => array(randomTime(),"Zagreb",rand(0,9),"B12","0","")
47+
" 101" => array("scheduled"=>randomTime(),"city"=>"Ouagadougou","airline"=>rand(0,9),"gate"=>"C21","status"=>"1","est 2130+"),
48+
" 96" => array("scheduled"=>randomTime(),"city"=>"Panama City","airline"=>rand(0,9),"gate"=>"A7","status"=>"0","remarks"=>""),
49+
"7420" => array("scheduled"=>randomTime(),"city"=>"Quanduc","airline"=>rand(0,9),"gate"=>"A18","status"=>"0","remarks"=>""),
50+
" 1" => array("scheduled"=>randomTime(),"city"=>"Rotterdam","airline"=>rand(0,9),"gate"=>"D44","status"=>"1","cancelled"),
51+
" 99" => array("scheduled"=>randomTime(),"city"=>"Seoul","airline"=>rand(0,9),"gate"=>"A12","status"=>"0","remarks"=>""),
52+
" 215" => array("scheduled"=>randomTime(),"city"=>"Tashkent","airline"=>rand(0,9),"gate"=>"B2","status"=>"0","remarks"=>""),
53+
" 174" => array("scheduled"=>randomTime(),"city"=>"Ulaanbaatar","airline"=>rand(0,9),"gate"=>"B14","status"=>"1","remarks"=>"weather"),
54+
" 41" => array("scheduled"=>randomTime(),"city"=>"Valparaiso","airline"=>rand(0,9),"gate"=>"C6","status"=>"0","remarks"=>""),
55+
"4476" => array("scheduled"=>randomTime(),"city"=>"Wagga Wagga","airline"=>rand(0,9),"gate"=>"D16","status"=>"0","remarks"=>""),
56+
" 112" => array("scheduled"=>randomTime(),"city"=>"Xuzhou","airline"=>rand(0,9),"gate"=>"A6","status"=>"0","remarks"=>""),
57+
"2145" => array("scheduled"=>randomTime(),"city"=>"Yakutsk","airline"=>rand(0,9),"gate"=>"C7","status"=>"0","remarks"=>""),
58+
"7772" => array("scheduled"=>randomTime(),"city"=>"Zagreb","airline"=>rand(0,9),"gate"=>"B12","status"=>"0","remarks"=>"")
6759
)
6860
);
6961

0 commit comments

Comments
 (0)