Skip to content

Commit fed531e

Browse files
Merge branch 'feature-hysplit'
* feature-hysplit: replaced hysplit json url with CORS enabled one stop event propagation on hysplit button implemented hysplit
2 parents 438a15b + 5c78a62 commit fed531e

File tree

3 files changed

+55
-0
lines changed

3 files changed

+55
-0
lines changed

css/main.css

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -366,6 +366,34 @@ header > div {
366366
position: relative;
367367
z-index: 4;
368368
}
369+
#main .row .data .hysplit {
370+
position: absolute;
371+
background-color: #fff;
372+
right: 5px;
373+
top: 150px;
374+
padding-left: 3px;
375+
padding-right: 3px;
376+
font-size: 10px;
377+
border-radius: 5px;
378+
border: 1px solid #ccc;
379+
cursor: pointer;
380+
z-index: 5;
381+
}
382+
383+
#main .row .data .hysplit.active {
384+
background-color: #33b5e5;
385+
border: 1px solid #33b5e5;
386+
color: #fff;
387+
}
388+
389+
#main .row .data .hysplit:hover {
390+
border: 1px solid #5E5E5E;
391+
}
392+
393+
#main .portrait .row .data .hysplit {
394+
display: none;
395+
}
396+
369397
#main .row .data img {
370398
position: absolute;
371399
z-index: 2;

js/app.js

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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
6567
function 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);

js/tracker.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -623,6 +623,7 @@ function updateVehicleInfo(index, newPosition) {
623623
+ '<i class="arrow"></i></div>'
624624
+ '<div class="data">'
625625
+ '<img class="'+((vehicle.vehicle_type=="car")?'car':'')+'" src="'+image+'" />'
626+
+ ((vehicle_names[index] in hysplit) ? '<span class="hysplit '+((hysplit[vehicle_names[index]].getMap()) ? 'active' : '')+'" data-index="'+index+'">HYSPLIT</span>' : '')
626627
+ '<div class="left">'
627628
+ '<dl>';
628629
// end

0 commit comments

Comments
 (0)