use moment.js to display a pretty time since last activity

This commit is contained in:
Jakob Ketterl 2019-07-08 21:01:30 +02:00
parent bab8ec1eaa
commit 58e819606a
8 changed files with 12 additions and 8 deletions

View File

@ -3,7 +3,7 @@
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<link rel="stylesheet" href="static/features.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/showdown/1.9.0/showdown.min.js"></script>
<script src="static/jquery-3.2.1.min.js"></script>
<script src="static/lib/jquery-3.2.1.min.js"></script>
<script src="static/features.js"></script>
</HEAD><BODY>
<div class="container">

View File

@ -25,9 +25,9 @@
<script src="static/sdr.js"></script>
<script src="static/mathbox-bundle.min.js"></script>
<script src="static/openwebrx.js"></script>
<script src="static/jquery-3.2.1.min.js"></script>
<script src="static/jquery.nanoscroller.js"></script>
<link rel="stylesheet" type="text/css" href="static/nanoscroller.css" />
<script src="static/lib/jquery-3.2.1.min.js"></script>
<script src="static/lib/jquery.nanoscroller.js"></script>
<link rel="stylesheet" type="text/css" href="static/lib/nanoscroller.css" />
<link rel="stylesheet" type="text/css" href="static/openwebrx.css" />
<meta charset="utf-8">
</head>

View File

@ -2,8 +2,9 @@
<html>
<head>
<title>OpenWebRX Map</title>
<script src="static/jquery-3.2.1.min.js"></script>
<script src="static/lib/jquery-3.2.1.min.js"></script>
<script src="static/map.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.24.0/moment.min.js"></script>
<link rel="stylesheet" type="text/css" href="static/map.css" />
<meta charset="utf-8">
</head>

View File

@ -129,7 +129,7 @@
zoom: 5
});
processUpdates(updateQueue);
$.getScript("/static/nite-overlay.js").done(function(){
$.getScript("/static/lib/nite-overlay.js").done(function(){
nite.init(map);
setInterval(function() { nite.refresh() }, 10000); // every 10s
});
@ -161,7 +161,7 @@
var showInfoWindow = function(locator, pos) {
if (!infowindow) infowindow = new google.maps.InfoWindow();
var inLocator = $.map(rectangles, function(r, callsign) {
return {callsign: callsign, locator: r.locator}
return {callsign: callsign, locator: r.locator, lastseen: r.lastseen}
}).filter(function(d) {
return d.locator == locator;
});
@ -169,7 +169,10 @@
'<h3>Locator: ' + locator + '</h3>' +
'<div>Active Callsigns:</div>' +
'<ul>' +
inLocator.map(function(i){ return '<li>' + i.callsign + '</li>' }).join("") +
inLocator.map(function(i){
var timestring = moment(i.lastseen).fromNow();
return '<li>' + i.callsign + ' (' + timestring + ')</li>'
}).join("") +
'</ul>'
);
infowindow.setPosition(pos);