@@ -2,7 +2,7 @@ var mission_id = 0;
22var position_id = 0 ;
33var data_url = "http://spacenear.us/tracker/datanew.php" ;
44var 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
77var habitat_max = 400 ;
88var habitat_url = "http://habitat.habhub.org/habitat/" ;
@@ -36,7 +36,7 @@ var layer_clouds = null;
3636var notamOverlay = null ;
3737
3838var 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+
22782292function 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
24652484var currentPosition = null ;
0 commit comments