@@ -61,6 +61,8 @@ var loadComplete = function(e) {
6161 $ ( '#loading .complete' ) . stop ( true , true ) . animate ( { width : 200 } , { complete : trackerInit } ) ;
6262}
6363
64+ var hysplit = { } ;
65+
6466// loads the tracker interface
6567function trackerInit ( ) {
6668 $ ( '#loading,#settingsbox,#aboutbox,#chasebox' ) . hide ( ) ; // welcome screen
@@ -73,6 +75,13 @@ function trackerInit() {
7375 if ( ! is_mobile ) {
7476 $ . getScript ( "js/init_plot.js" , function ( ) { checkSize ( ) ; if ( ! map ) load ( ) ; } ) ;
7577 if ( embed . graph ) $ ( '#telemetry_graph' ) . attr ( 'style' , '' ) ;
78+
79+ // fetch hysplit jobs
80+ $ . getJSON ( "http://spacenear.us/tracker/datanew.php?type=hysplit&format=json" , function ( data ) {
81+ for ( var k in data ) {
82+ hysplit [ k ] = new google . maps . KmlLayer ( "http://ready.arl.noaa.gov/hypubout/HYSPLITtraj_" + data [ k ] + ".kmz" ) ;
83+ }
84+ } ) ;
7685 return ;
7786 }
7887 checkSize ( ) ;
@@ -350,6 +359,23 @@ $(window).ready(function() {
350359 // expand graph on startup, if nessary
351360 if ( embed . graph_expanded ) $ ( '#telemetry_graph .graph_label' ) . click ( ) ;
352361
362+ // hysplit button
363+ $ ( "#main" ) . on ( 'click' , '.row .data .hysplit' , function ( event ) {
364+ event . stopPropagation ( ) ;
365+
366+ var elm = $ ( this ) ;
367+ var name = vehicle_names [ elm . attr ( 'data-index' ) ]
368+
369+ if ( elm . hasClass ( "active" ) ) {
370+ elm . removeClass ( 'active' ) ;
371+ hysplit [ name ] . setMap ( null ) ;
372+ }
373+ else {
374+ elm . addClass ( 'active' ) ;
375+ hysplit [ name ] . setMap ( map ) ;
376+ }
377+ } ) ;
378+
353379 // reset nite-overlay and timebox when mouse goes out of the graph box
354380 $ ( "#telemetry_graph" ) . on ( 'mouseout' , '.holder' , function ( ) {
355381 nite . setDate ( null ) ;
0 commit comments