File tree Expand file tree Collapse file tree 1 file changed +20
-5
lines changed
Expand file tree Collapse file tree 1 file changed +20
-5
lines changed Original file line number Diff line number Diff line change @@ -62,6 +62,23 @@ var loadComplete = function(e) {
6262}
6363
6464var hysplit = { } ;
65+ var refresh_hysplit = function ( ) {
66+ $ . getJSON ( "http://spacenear.us/tracker/datanew.php?type=hysplit&format=json" , function ( data ) {
67+ for ( var k in data ) {
68+ if ( k in hysplit ) {
69+ // if the jobid is the same, skip to next one
70+ if ( hysplit [ k ] . jobid == data [ k ] ) continue ;
71+
72+ // otherwise update the url
73+ hysplit [ k ] . setUrl ( "http://ready.arl.noaa.gov/hypubout/HYSPLITtraj_" + data [ k ] + ".kmz" ) ;
74+ hysplit [ k ] . jobid = data [ k ] ;
75+ } else {
76+ hysplit [ k ] = new google . maps . KmlLayer ( { url :"http://ready.arl.noaa.gov/hypubout/HYSPLITtraj_" + data [ k ] + ".kmz" , preserveViewport :true } ) ;
77+ hysplit [ k ] . jobid = data [ k ] ;
78+ }
79+ }
80+ } ) ;
81+ }
6582
6683// loads the tracker interface
6784function trackerInit ( ) {
@@ -77,11 +94,9 @@ function trackerInit() {
7794 if ( embed . graph ) $ ( '#telemetry_graph' ) . attr ( 'style' , '' ) ;
7895
7996 // 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 ( { url :"http://ready.arl.noaa.gov/hypubout/HYSPLITtraj_" + data [ k ] + ".kmz" , preserveViewport :true } ) ;
83- }
84- } ) ;
97+ setInterval ( refresh_hysplit , 60 * 1000 ) ;
98+ refresh_hysplit ( ) ;
99+
85100 return ;
86101 }
87102 checkSize ( ) ;
You can’t perform that action at this time.
0 commit comments