@@ -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/hysplit.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,21 @@ $(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 ( ) {
364+ var elm = $ ( this ) ;
365+ var name = vehicle_names [ elm . attr ( 'data-index' ) ]
366+
367+ if ( elm . hasClass ( "active" ) ) {
368+ elm . removeClass ( 'active' ) ;
369+ hysplit [ name ] . setMap ( null ) ;
370+ }
371+ else {
372+ elm . addClass ( 'active' ) ;
373+ hysplit [ name ] . setMap ( map ) ;
374+ }
375+ } ) ;
376+
353377 // reset nite-overlay and timebox when mouse goes out of the graph box
354378 $ ( "#telemetry_graph" ) . on ( 'mouseout' , '.holder' , function ( ) {
355379 nite . setDate ( null ) ;
0 commit comments