Skip to content

Commit 273e820

Browse files
added url param to specify intial zoom vehicle
1 parent 15e82b1 commit 273e820

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

js/app.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ var embed = {
2020
vlist: true,
2121
graph: true,
2222
graph_exapnded: false,
23-
latestonly: is_mobile
23+
latestonly: is_mobile,
24+
focus: ""
2425
}
2526
var params = window.location.search.substring(1).split('&');
2627

@@ -36,6 +37,7 @@ for(var idx in params) {
3637
case "filter": vfilter = line[1]; break;
3738
case "nyan": nyan_mode = true; break;
3839
case "latestonly": embed.latestonly = (parseInt(line[1]) == 1) ? true : false; break;
40+
case "focus": embed.focus = line[1]; break;
3941
}
4042
}
4143

js/tracker.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1915,7 +1915,12 @@ function update(response) {
19151915
function zoom_on_payload() {
19161916
// find a the first balloon
19171917
var i = -1, ii = vehicles.length;
1918-
while(++i < ii) if(vehicles[i].vehicle_type == "balloon") break;
1918+
1919+
if(embed.focus != "" && vehicle_names.indexOf(embed.focus) > -1) {
1920+
i = vehicle_names.indexOf(embed.focus);
1921+
} else {
1922+
while(++i < ii) if(vehicles[i].vehicle_type == "balloon") break;
1923+
}
19191924

19201925
if(i == ii) return;
19211926
else if(vehicles[i].num_positions > 1) {

0 commit comments

Comments
 (0)