diff --git a/Help/keyboard.html b/Help/keyboard.html index 445066ed..3a67a1e3 100644 --- a/Help/keyboard.html +++ b/Help/keyboard.html @@ -120,7 +120,18 @@ Ctrl-F Toggle Fullscreen mode - + + +
Records
+ + + Delete or Backspace + Delete current record + + + Ctrl-Z + Restore deleted record(s) + diff --git a/css/style.css b/css/style.css index d3b9ccfa..24457f6a 100644 --- a/css/style.css +++ b/css/style.css @@ -32,6 +32,10 @@ body { padding-bottom: 0; } +.leaflet-marker-icon-default { + filter: hue-rotate(150deg) +} + .navbar { z-index: 5; } diff --git a/index.html b/index.html index e3b7c0ba..3eb980ce 100644 --- a/index.html +++ b/index.html @@ -1112,6 +1112,82 @@ diff --git a/js/ui.js b/js/ui.js index 2b119455..14ba7ffa 100644 --- a/js/ui.js +++ b/js/ui.js @@ -583,26 +583,46 @@ const showLocation = async (fromSelect) => { if (id) { newLocation = LOCATIONS.find(obj => obj.id === id); //locationSelect.value = id; - latEl.value = newLocation.lat, lonEl.value = newLocation.lon, customPlaceEl.value = newLocation.place; - updateMap(newLocation.lat, newLocation.lon) + if (newLocation){ + latEl.value = newLocation.lat, lonEl.value = newLocation.lon, customPlaceEl.value = newLocation.place; + } else { + latEl.value = config.latitude, lonEl.value = config.longitude, customPlaceEl.value = config.location; + } } else { //Default location const savedLocationSelect = await generateLocationList('savedLocations'); latEl.value = config.latitude, lonEl.value = config.longitude, customPlaceEl.value = config.location; } + // make sure the map is initialised + if (!map) placeMap('customLocationMap') + updateMap(latEl.value, lonEl.value) } -const displayLocationAddress = async () => { - const latEl = document.getElementById('customLat'); - const lonEl = document.getElementById('customLon'); - const customPlaceEl = document.getElementById('customPlace'); - const place = await fetchLocationAddress(latEl.value, lonEl.value, false); - if (place) { - customPlaceEl.value = place; - } - else { - customPlaceEl.value = 'Location not available'; - customPlaceEl.ariaPlaceholder = 'Location not available'; +const displayLocationAddress = async (where) => { + const custom = where.indexOf('custom') > -1; + let latEl, lonEl, placeEl, place; + if (custom){ + latEl = document.getElementById('customLat'); + lonEl = document.getElementById('customLon'); + placeEl = document.getElementById('customPlace'); + address = await fetchLocationAddress(latEl.value, lonEl.value, false); + placeEl.value = address ? address : 'Location not available'; + } else { + latEl = document.getElementById('latitude'); + lonEl = document.getElementById('longitude'); + placeEl = document.getElementById('place'); + address = await fetchLocationAddress(latEl.value, lonEl.value, false); + const content = 'fmd_good ' + address; + placeEl.innerHTML = content; + config.latitude = parseFloat(latEl.value).toFixed(2); + config.longitude = parseFloat(lonEl.value).toFixed(2); + config.location = address; + updatePrefs(); + worker.postMessage({ + action: 'update-state', + lat: config.latitude, + lon: config.longitude, + }); } } @@ -641,11 +661,6 @@ async function setLocation() { const locationForm = document.getElementById('locationForm'); - - [latEl, lonEl].forEach(el => { - el.addEventListener('blur', displayLocationAddress) - }) - const addLocation = () => { locationID = parseInt(savedLocationSelect.value); const batch = document.getElementById('batchLocations').checked; @@ -718,6 +733,8 @@ function resetDiagnostics() { delete DIAGNOSTICS['Audio Duration']; delete DIAGNOSTICS['Analysis Rate']; delete DIAGNOSTICS['Analysis Duration']; + //reset delete history too + DELETE_HISTORY = []; } // Worker listeners @@ -839,12 +856,6 @@ function postAnalyseMessage(args) { } -/// Lat / lon -// const place = document.getElementById('place') -// $('#latitude, #longitude').on('focus', function () { -// document.removeEventListener('keydown', handleKeyDownDeBounce, true); -// }) - function fetchLocationAddress(lat, lon) { return new Promise(async (resolve, reject) => { if (!LOCATIONS) { @@ -872,39 +883,6 @@ function fetchLocationAddress(lat, lon) { }) }) } -$('#latitude, #longitude').on('blur', async function () { - const lat = parseFloat(document.getElementById('latitude').value).toFixed(2); - const lon = parseFloat(document.getElementById('longitude').value).toFixed(2); - const address = await fetchLocationAddress(lat, lon, true); - fillLocation(address, lat, lon) - updateMap -}) - -const fillLocation = (address, lat, lon, divID) =>{ - - if (divID === 'settingsMap') { - const content = 'fmd_good ' + address; - place.innerHTML = content; - config.latitude = lat.toFixed(2); - config.longitude = lon.toFixed(2); - config.location = address; - updatePrefs(); - worker.postMessage({ - action: 'update-state', - lat: config.latitude, - lon: config.longitude, - }); - } else { - const latEl = document.getElementById('customLat'); - const lonEl = document.getElementById('customLon'); - const customPlaceEl = document.getElementById('customPlace'); - latEl.value = lat.toFixed(2); - lonEl.value = lon.toFixed(2); - customPlaceEl.value = address; - updateMap(lat, lon); - } - -} // Menu bar functions @@ -2391,7 +2369,9 @@ const gotoModal = document.getElementById('gotoModal') //gotoModal.addEventListener('hidden.bs.modal', enableKeyDownEvent) gotoModal.addEventListener('shown.bs.modal', () => { - document.getElementById('timeInput').focus() + const timeInput = document.getElementById('timeInput') + timeInput.value = ''; + timeInput.focus() }) diff --git a/js/worker.js b/js/worker.js index 589f4462..a44b3e3a 100644 --- a/js/worker.js +++ b/js/worker.js @@ -1795,7 +1795,7 @@ const parsePredictions = async (response) => { console.log(`Prediction done ${filesBeingProcessed.length} files to go`); console.log('Analysis took ' + (new Date() - predictionStart) / 1000 + ' seconds.'); } - getSummary({ interim: true }); + if (!STATE.selection) getSummary({ interim: true }); return response.worker }