Skip to content

Commit 8ec920b

Browse files
renamed embed var to wvar
1 parent f66deeb commit 8ec920b

File tree

2 files changed

+25
-25
lines changed

2 files changed

+25
-25
lines changed

js/app.js

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ if(
1111
|| navigator.userAgent.match(/BlackBerry/i)
1212
) is_mobile = true;
1313

14-
// embed detection
14+
// wvar detection
1515
var vfilter = "";
1616
var nyan_mode = false;
1717

18-
var embed = {
18+
var wvar = {
1919
enabled: false,
2020
vlist: true,
2121
graph: true,
@@ -31,21 +31,21 @@ for(var idx in params) {
3131
if(line.length < 2) continue;
3232

3333
switch(line[0]) {
34-
case "embed": if(line[1] == "1") embed.enabled = true; break;
35-
case "hidelist": if(line[1] == "1") embed.vlist = false; break;
36-
case "hidegraph": if(line[1] == "1") embed.graph = false; break;
37-
case "expandgraph": if(line[1] == "1") embed.graph_expanded = true; break;
34+
case "wvar": if(line[1] == "1") wvar.enabled = true; break;
35+
case "hidelist": if(line[1] == "1") wvar.vlist = false; break;
36+
case "hidegraph": if(line[1] == "1") wvar.graph = false; break;
37+
case "expandgraph": if(line[1] == "1") wvar.graph_expanded = true; break;
3838
case "filter": vfilter = line[1]; break;
3939
case "nyan": nyan_mode = true; break;
40-
case "latestonly": embed.latestonly = (parseInt(line[1]) == 1) ? true : false; break;
41-
case "focus": embed.focus = line[1]; break;
42-
case "docid": embed.docid = line[1]; break;
40+
case "latestonly": wvar.latestonly = (parseInt(line[1]) == 1) ? true : false; break;
41+
case "focus": wvar.focus = line[1]; break;
42+
case "docid": wvar.docid = line[1]; break;
4343
}
4444
}
4545

46-
if(embed.latestonly) $("#latestonly").show();
46+
if(wvar.latestonly) $("#latestonly").show();
4747

48-
if(embed.enabled) {
48+
if(wvar.enabled) {
4949
//analytics
5050
if(typeof _gaq == 'object') _gaq.push(['_trackEvent', 'Functionality', 'Embed Opts', window.location.search]);
5151
}
@@ -103,11 +103,11 @@ function trackerInit() {
103103

104104
if(map) return;
105105

106-
if(is_mobile || embed.enabled) $(".nav .embed").hide();
106+
if(is_mobile || wvar.enabled) $(".nav .wvar").hide();
107107

108108
if(!is_mobile) {
109109
$.getScript("js/init_plot.js", function() { checkSize(); if(!map) load(); });
110-
if(embed.graph) $('#telemetry_graph').attr('style','');
110+
if(wvar.graph) $('#telemetry_graph').attr('style','');
111111

112112
// fetch hysplit jobs
113113
setInterval(refresh_hysplit, 60 * 1000);
@@ -153,7 +153,7 @@ function checkSize() {
153153

154154
$("#mapscreen,.flatpage").height(h-hh-5);
155155

156-
sw = (embed.vlist) ? 199 : 0;
156+
sw = (wvar.vlist) ? 199 : 0;
157157

158158
$('.container').width(w-20);
159159

@@ -169,7 +169,7 @@ function checkSize() {
169169
$('#main').width(sw);
170170
} else { // portrait mode
171171
//if(h < 420) h = 420;
172-
var mh = (embed.vlist) ? 180 : 0;
172+
var mh = (wvar.vlist) ? 180 : 0;
173173

174174
$('body,#loading').height(h);
175175
$('#map,#mapscreen').height(h-hh-5-mh);
@@ -399,7 +399,7 @@ $(window).ready(function() {
399399
});
400400

401401
// expand graph on startup, if nessary
402-
if(embed.graph_expanded) $('#telemetry_graph .graph_label').click();
402+
if(wvar.graph_expanded) $('#telemetry_graph .graph_label').click();
403403

404404
// hysplit button
405405
$("#main").on('click','.row .data .hysplit', function(event) {
@@ -684,7 +684,7 @@ $(window).ready(function() {
684684
if(navigator.geolocation) {
685685
// if we have geolocation services, show the locate me button
686686
// the button pants the map to the user current location
687-
if(is_mobile && !embed.enabled) $(".chasecar").show();
687+
if(is_mobile && !wvar.enabled) $(".chasecar").show();
688688
$("#locate-me,#app_name").attr('style','').click(function() {
689689
if(map && currentPosition) {
690690
// disable following of vehicles

js/tracker.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -792,7 +792,7 @@ function updateVehicleInfo(index, newPosition) {
792792
$('.landscape .vehicle'+index).html(a + l + b);
793793

794794
// redraw canvas
795-
if(!embed.latestonly && vehicles[index].graph_data.length) {
795+
if(!wvar.latestonly && vehicles[index].graph_data.length) {
796796
var c = $('.vehicle'+index+' .graph');
797797
drawAltitudeProfile(c.get(0), c.get(1), vehicles[index].graph_data[0], vehicles[index].max_alt);
798798
}
@@ -1350,7 +1350,7 @@ function addPosition(position) {
13501350
}
13511351

13521352
// add the new position
1353-
if(embed.latestonly) {
1353+
if(wvar.latestonly) {
13541354
vehicle.num_positions= 1;
13551355
vehicle.positions.push(new_latlng);
13561356
vehicle.positions_ts.push(new_ts);
@@ -1626,7 +1626,7 @@ function refresh() {
16261626
//if(typeof _gaq == 'object') _gaq.push(['_trackEvent', 'ajax', 'refresh', 'Vehicles']);
16271627
//
16281628
var data_str = "type=positions&format=json&max_positions=" + max_positions + "&position_id=" + position_id + "&vehicles=" + encodeURIComponent(vfilter);
1629-
if(embed.latestonly) data_str = "mode=latest&" + data_str;
1629+
if(wvar.latestonly) data_str = "mode=latest&" + data_str;
16301630

16311631
$.ajax({
16321632
type: "GET",
@@ -1756,7 +1756,7 @@ function habitat_translation_layer(json_result, url, skip) {
17561756
function initHabitat() {
17571757
$.ajax({
17581758
type: "GET",
1759-
url: habitat_url + embed.docid,
1759+
url: habitat_url + wvar.docid,
17601760
data: "",
17611761
dataType: "json",
17621762
success: function(response, textStatus) {
@@ -1803,7 +1803,7 @@ function startAjax() {
18031803

18041804
// the periodical starts here, the * 1000 is because milliseconds required
18051805

1806-
if(embed.docid != "") {
1806+
if(wvar.docid != "") {
18071807
initHabitat();
18081808
}
18091809
else {
@@ -2038,7 +2038,7 @@ function update(response) {
20382038
if(follow_vehicle != -1 && vehicles[follow_vehicle].graph_data_updated) updateGraph(follow_vehicle, false);
20392039

20402040
// store in localStorage
2041-
if(embed.docid == "") offline.set('positions', ctx.lastPositions);
2041+
if(wvar.docid == "") offline.set('positions', ctx.lastPositions);
20422042

20432043
if (got_positions && !zoomed_in && vehicles.length) {
20442044
zoom_on_payload();
@@ -2054,8 +2054,8 @@ function zoom_on_payload() {
20542054
// find a the first balloon
20552055
var i = -1, ii = vehicles.length;
20562056

2057-
if(embed.focus != "" && vehicle_names.indexOf(embed.focus) > -1) {
2058-
i = vehicle_names.indexOf(embed.focus);
2057+
if(wvar.focus != "" && vehicle_names.indexOf(wvar.focus) > -1) {
2058+
i = vehicle_names.indexOf(wvar.focus);
20592059
} else {
20602060
while(++i < ii) if(vehicles[i].vehicle_type == "balloon") break;
20612061
}

0 commit comments

Comments
 (0)