diff --git a/css/main.css b/css/main.css index 05c8ce2..6120d94 100644 --- a/css/main.css +++ b/css/main.css @@ -441,6 +441,7 @@ header .search form input[type='submit'] { border: 1px solid #ccc; cursor: pointer; z-index: 5; + text-align: center; } #main .row .data .vbutton.active { diff --git a/js/tracker.js b/js/tracker.js index 2f8f97f..1c94a6a 100644 --- a/js/tracker.js +++ b/js/tracker.js @@ -334,8 +334,6 @@ function clean_refresh(text, force, history_step) { history_step = !!history_step; if(text == wvar.mode && !force) return false; - if(ajax_inprogress) return false; - stopAjax(); // reset mode if, invalid mode is specified @@ -813,7 +811,6 @@ function updateAltitude(vcallsign) { } else if(position.gps_alt > 55000) { position.gps_alt = 55000; } - vehicle.marker.setAltitude(pixel_altitude); } function updateZoom() { @@ -1224,11 +1221,11 @@ function updateVehicleInfo(vcallsign, newPosition) { //'' + vcallsign + ' ' + '' + '' + - '
' + + '
' + '' + - 'Path' + - 'Share' + + 'Path' + + ((vehicle.vehicle_type!="car") ? 'Share' : '') + + ((vehicle.vehicle_type!="car") ? 'Card' : '') + ((vcallsign in hysplit) ? 'HYSPLIT' : '') + ((vcallsign.substr(0, 6) in ssdv) ? ' 1) { navigator.setAppBadge(Object.keys(vehicles).length); //show number of vehicles on PWA taskbar @@ -2657,6 +2672,12 @@ function refreshSingle(serial, first) { } return; } + + if (ajax_inprogress_old == wvar.query) { + if (vehicles.hasOwnProperty(wvar.query)) { + return; + } + } if (first === undefined) { first = false; @@ -2689,7 +2710,86 @@ function refreshSingle(serial, first) { periodical_focus = setTimeout(refreshSingle, timer_seconds_focus * 1000, serial); } }); - } +} + +function refreshSingleOld(serial) { + + if (ajax_inprogress_old == wvar.query) { + if (vehicles.hasOwnProperty(wvar.query)) { + return; + } + } + + document.getElementById("timeperiod").disabled = true; + + var data_url = "https://api.v2.sondehub.org/sonde/" + encodeURIComponent(serial); + + ajax_inprogress_old = serial; + + ajax_positions_old = $.ajax({ + type: "GET", + url: data_url, + dataType: "json", + success: function(data, textStatus) { + var response = {}; + response.positions = {}; + var dataTemp = []; + for (var i = data.length - 1; i >= 0; i--) { + if (data[i].hasOwnProperty('subtype')) { + if (data[i].subtype != "SondehubV1") { + var dataTempEntry = {}; + var station = data[i].uploader_callsign + dataTempEntry.callsign = {}; + dataTempEntry.callsign[station] = {}; + dataTempEntry.callsign[station].snr = data[i].snr; + dataTempEntry.callsign[station].rssi = data[i].rssi; + dataTempEntry.gps_alt = data[i].alt; + dataTempEntry.gps_heading = data[i].heading; + dataTempEntry.gps_lat = data[i].lat; + dataTempEntry.gps_lon = data[i].lon; + dataTempEntry.gps_time = data[i].datetime; + dataTempEntry.server_time = data[i].datetime; + dataTempEntry.vehicle = data[i].serial; + dataTempEntry.position_id = data[i].serial + "-" + data[i].datetime; + dataTempEntry.data = {}; + if (data[i].batt) { + dataTempEntry.data.batt = data[i].batt; + } + if (data[i].burst_timer) { + dataTempEntry.data.burst_timer = data[i].burst_timer; + } + if (data[i].frequency) { + dataTempEntry.data.burst_timer = data[i].frequency; + } + if (data[i].humidity) { + dataTempEntry.data.humidity = data[i].humidity; + } + if (data[i].manufacturer) { + dataTempEntry.data.manufacturer = data[i].manufacturer; + } + if (data[i].sats) { + dataTempEntry.data.sats = data[i].sats; + } + if (data[i].temp) { + dataTempEntry.data.temperature_external = data[i].temp; + } + if (data[i].type) { + dataTempEntry.data.type = data[i].type; + dataTempEntry.type = data[i].type; + } + if (data[i].pressure) { + dataTempEntry.data.pressure = data[i].pressure; + } + dataTemp.push(dataTempEntry) + } + } + } + response.positions.position = dataTemp; + response.fetch_timestamp = Date.now(); + update(response, "old"); + } + }); +} function refreshReceivers() { // if options to hide receivers is selected do nothing @@ -2978,6 +3078,9 @@ function stopAjax() { if(ajax_positions) ajax_positions.abort(); clearTimeout(periodical_focus); + if(ajax_positions_single) ajax_positions_single.abort(); + + if(ajax_positions_old) ajax_positions_old.abort(); clearTimeout(periodical_predictions); periodical_predictions = null; @@ -3339,16 +3442,18 @@ function update(response, flag) { !response.positions.position || !response.positions.position.length) { - // if no vehicles are found, this will remove the spinner and put a friendly message - $("#main .empty").html("No vehicles :("); + if (flag != "old") { + // if no vehicles are found, this will remove the spinner and put a friendly message + $("#main .empty").html("No vehicles :("); - if (flag === undefined) { - ajax_inprogress = false; - } else { - ajax_inprogress_single = false; - } + if (flag === undefined) { + ajax_inprogress = false; + } else { + ajax_inprogress_single = false; + } - return; + return; + } } ssdv = (!response.ssdv) ? {} : response.ssdv; @@ -3444,10 +3549,12 @@ function update(response, flag) { if(periodical_predictions === null) refreshPredictions(); - if (flag === undefined) { - ajax_inprogress = false; - } else { - ajax_inprogress_single = false; + if (flag != "old") { + if (flag === undefined) { + ajax_inprogress = false; + } else { + ajax_inprogress_single = false; + } } } };