Skip to content

Commit 8df85a4

Browse files
Merge 'beta'; predictions tweaks + fix for tap bug
77ffdac - fix hysplit+path buttons not working on mobile 53521f5 - removed 'position' mode e778719 - added vehicle filter to predictions a7748b2 - reload predictions with clean_refresh() 9b5b440 - pred.alt. is now aligned with altitude on graph
2 parents aca936e + 77ffdac commit 8df85a4

File tree

2 files changed

+27
-8
lines changed

2 files changed

+27
-8
lines changed

js/app.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -562,7 +562,7 @@ $(window).ready(function() {
562562
if(wvar.graph_expanded) $('#telemetry_graph .graph_label').click();
563563

564564
// hysplit button
565-
$("#main").on('click','.row .data .vbutton.hysplit', function(event) {
565+
$("#main").on('tap','.row .data .vbutton.hysplit', function(event) {
566566
event.stopPropagation();
567567

568568
var elm = $(this);
@@ -578,7 +578,7 @@ $(window).ready(function() {
578578
}
579579
});
580580

581-
$("#main").on('click','.row .data .vbutton.path', function(event) {
581+
$("#main").on('tap','.row .data .vbutton.path', function(event) {
582582
event.stopPropagation();
583583

584584
var elm = $(this);

js/tracker.js

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ var mission_id = 0;
22
var position_id = 0;
33
var data_url = "http://spacenear.us/tracker/datanew.php";
44
var receivers_url = "http://spacenear.us/tracker/receivers.php";
5-
var predictions_url = "http://spacenear.us/tracker/get_predictions.php";
5+
var predictions_url = "http://spacenear.us/tracker/get_predictions.php?vehicles=";
66

77
var habitat_max = 400;
88
var habitat_url = "http://habitat.habhub.org/habitat/";
@@ -36,7 +36,7 @@ var layer_clouds = null;
3636
var notamOverlay = null;
3737

3838
var modeList = [
39-
"Position",
39+
// "Position",
4040
"1 hour",
4141
"3 hours",
4242
"6 hours",
@@ -368,6 +368,7 @@ function clean_refresh(text, force) {
368368

369369
lhash_update();
370370
refresh();
371+
refreshPredictions();
371372

372373
return true;
373374
}
@@ -1787,7 +1788,7 @@ function addPosition(position) {
17871788
};
17881789

17891790
// deep copy yaxes config for graph
1790-
$.each($.extend(plot_options.yaxes, {}), function(k,v) { vehicle_info.graph_yaxes.push(v); });
1791+
plot_options.yaxes.forEach(function(v) { vehicle_info.graph_yaxes.push($.extend({}, v)); });
17911792

17921793
// nyan mod
17931794
if(wvar.nyan && vehicle_info.vehicle_type == "balloon") {
@@ -2098,6 +2099,7 @@ function graphAddPosition(vcallsign, new_data) {
20982099
data: []
20992100
};
21002101

2102+
vehicle.graph_yaxes[i].max = 0;
21012103
i += 1;
21022104

21032105
data[i] = {
@@ -2109,9 +2111,19 @@ function graphAddPosition(vcallsign, new_data) {
21092111
data: []
21102112
};
21112113

2114+
vehicle.graph_yaxes[i].max = 0;
21122115
}
21132116

2114-
if(parseInt(new_data.gps_alt) < 0) delete vehicle.graph_yaxes[i].min;
2117+
// set yrange for altitude and pred.alt, so they are aligned
2118+
if(parseInt(new_data.gps_alt) < vehicle.graph_yaxes[0].min) {
2119+
vehicle.graph_yaxes[0].min = parseInt(new_data.gps_alt);
2120+
vehicle.graph_yaxes[1].min = vehicle.graph_yaxes[0].min;
2121+
}
2122+
2123+
if(parseInt(new_data.gps_alt) > vehicle.graph_yaxes[0].max) {
2124+
vehicle.graph_yaxes[0].max = parseInt(new_data.gps_alt);
2125+
vehicle.graph_yaxes[1].max = vehicle.graph_yaxes[0].max;
2126+
}
21152127

21162128
// we don't record extra data, if there is no telemetry graph loaded
21172129
// altitude is used for altitude profile
@@ -2275,12 +2287,15 @@ function refreshReceivers() {
22752287
});
22762288
}
22772289

2290+
var ajax_predictions = null;
2291+
22782292
function refreshPredictions() {
22792293
//if(typeof _gaq == 'object') _gaq.push(['_trackEvent', 'ajax', 'refresh', 'Predictions']);
2294+
clearTimeout(periodical_predictions);
22802295

2281-
$.ajax({
2296+
ajax_predictions = $.ajax({
22822297
type: "GET",
2283-
url: predictions_url,
2298+
url: predictions_url + encodeURIComponent(wvar.query),
22842299
data: "",
22852300
dataType: "json",
22862301
success: function(response, textStatus) {
@@ -2290,6 +2305,7 @@ function refreshPredictions() {
22902305
error: function() {
22912306
},
22922307
complete: function(request, textStatus) {
2308+
clearTimeout(periodical_predictions);
22932309
periodical_predictions = setTimeout(refreshPredictions, 60 * 1000);
22942310
}
22952311
});
@@ -2460,6 +2476,9 @@ function stopAjax() {
24602476
// stop our timed ajax
24612477
clearTimeout(periodical);
24622478
if(ajax_positions) ajax_positions.abort();
2479+
2480+
clearTimeout(periodical_predictions);
2481+
if(ajax_predictions) ajax_predictions.abort();
24632482
}
24642483

24652484
var currentPosition = null;

0 commit comments

Comments
 (0)