Skip to content

Commit 8be2608

Browse files
added ssdv module showing the latest image
1 parent 4aecac8 commit 8be2608

File tree

3 files changed

+48
-1
lines changed

3 files changed

+48
-1
lines changed

cache.manifest

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
CACHE MANIFEST
2-
# version 152
2+
# version 153
33

44
# gogole maps files
55
http://maps.google.com/maps/api/js?v=3.10&sensor=false&key=AIzaSyCOqkcNey4CCyG4X0X5qxHAhCgD8g5DwXg

js/app.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ function trackerInit() {
3636
$('header,#main,#map').show(); // interface elements
3737

3838
if(!is_mobile) {
39+
$.getScript("js/ssdv.js");
3940
$.getScript("js/init_plot.js", function() { checkSize(); if(!map) load(); });
4041
$('#telemetry_graph').addClass("main_screen").attr('style','');
4142
return;

js/ssdv.js

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
var ssdv_url = "http://ssdv.habhub.org/data.php?callback=?&format=jsonp&request=update&last_id=";
2+
var ssdv_last_id = 0;
3+
var ssdv_timer = ssdv_timer || null;
4+
var ssdv_html = "<div id='ssdv' style='z-index: 20;position:absolute;bottom:0px;right:0px;width:320px'>" +
5+
"<span class='label' style='z-index:21;display:block;width:100%;background:#00a3d3;height:20px;padding:3px 5px;font-weight: bold;font-size: 11px;color:#fff;border-radius:5px 0 0 0;box-shadow:1px -1px 5px rgba(0,0,0,0.2);cursor:pointer;'>SSDV</span>" +
6+
"<img src='' style='height:0px;display:none'/>" +
7+
"<span class='link' style='display:none;position:absolute;bottom:0px;right:0px;border-radius:5px 0 0 0;padding:0px 4px;background:rgba(0,0,0,0.2);color:#ccc;font-size:10px'>powered by <a style='color:#fff' href='http://ssdv.habhub.org'>ssdv.habhub.org</a></span>" +
8+
"</div>";
9+
10+
11+
12+
$('#ssdv .label').live('click',function() {
13+
var img = $('#ssdv img');
14+
var poweredby = $('#ssdv .link');
15+
16+
if(img.is(':visible')) {
17+
poweredby.fadeOut();
18+
img.animate({'height':0}, function() { $(this).hide() });
19+
} else {
20+
img.show().width(320).animate({'height':240}, function() { poweredby.fadeIn() }).css({'display':'block'});
21+
}
22+
});
23+
24+
var jsonp_callback = function(data) {
25+
if($('#ssdv').length == 0) $('#map').append(ssdv_html);
26+
27+
if(data.images.length > 0) {
28+
var img = data.images[0];
29+
var time = new Date();
30+
time.setTime((img.updated + (new Date()).getTimezoneOffset()) * 1000);
31+
var minutes = Math.floor(((new Date()).getTime() - time.getTime()) / 60000);
32+
33+
$('#ssdv .label').text("SSDV from " + img.payload + " " + img.received_packets + "/" + img.lost_packets + " updated "+minutes+" min ago");
34+
$('#ssdv img').attr('src', 'http://ssdv.habhub.org' + img.image);
35+
}
36+
37+
ssdv_last_id = data.last_id;
38+
};
39+
40+
var ssdv_fetch = function() {
41+
$.getJSON(ssdv_url + ssdv_last_id);
42+
}
43+
44+
setTimeout(ssdv_fetch, 2000);
45+
clearInterval(ssdv_timer);
46+
ssdv_timer = setInterval(ssdv_fetch, 16000);

0 commit comments

Comments
 (0)