Compare commits

...

4 Commits

Author SHA1 Message Date
Matt Walsh
e326c3464b 5.5.2 2022-12-12 14:13:48 -06:00
Matt Walsh
c3e38b4077 remove geoquery when there's a saved location 2022-12-12 14:13:39 -06:00
Matt Walsh
eb11feb964 5.5.1 2022-12-12 14:01:24 -06:00
Matt Walsh
b2aca1ee8d fix auto-start when first display is disabled 2022-12-12 14:01:10 -06:00
4 changed files with 33 additions and 43 deletions

4
package-lock.json generated
View File

@@ -1,12 +1,12 @@
{ {
"name": "ws4kp", "name": "ws4kp",
"version": "5.5.0", "version": "5.5.2",
"lockfileVersion": 2, "lockfileVersion": 2,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "ws4kp", "name": "ws4kp",
"version": "5.5.0", "version": "5.5.2",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"eslint": "^8.21.0", "eslint": "^8.21.0",

View File

@@ -1,6 +1,6 @@
{ {
"name": "ws4kp", "name": "ws4kp",
"version": "5.5.0", "version": "5.5.2",
"description": "Welcome to the WeatherStar 4000+ project page!", "description": "Welcome to the WeatherStar 4000+ project page!",
"main": "index.js", "main": "index.js",
"scripts": { "scripts": {

View File

@@ -8,9 +8,6 @@ document.addEventListener('DOMContentLoaded', () => {
init(); init();
}); });
const overrides = {};
let AutoSelectQuery = false;
let FullScreenOverride = false; let FullScreenOverride = false;
const categories = [ const categories = [
@@ -58,21 +55,12 @@ const init = () => {
maxSuggestions: 10, maxSuggestions: 10,
}, },
dataType: 'json', dataType: 'json',
transformResult: (response) => { transformResult: (response) => ({
if (AutoSelectQuery) { suggestions: $.map(response.suggestions, (i) => ({
AutoSelectQuery = false; value: i.text,
window.setTimeout(() => { data: i.magicKey,
$(ac.suggestionsContainer.children[0]).click(); })),
}, 1); }),
}
return {
suggestions: $.map(response.suggestions, (i) => ({
value: i.text,
data: i.magicKey,
})),
};
},
minChars: 3, minChars: 3,
showNoSuggestionNotice: true, showNoSuggestionNotice: true,
noSuggestionNotice: 'No results found. Please try a different search string.', noSuggestionNotice: 'No results found. Please try a different search string.',
@@ -88,12 +76,11 @@ const init = () => {
// Auto load the previous query // Auto load the previous query
const TwcQuery = localStorage.getItem('TwcQuery'); const TwcQuery = localStorage.getItem('TwcQuery');
if (TwcQuery) { const TwcLatLong = localStorage.getItem('TwcLatLon');
AutoSelectQuery = true; if (TwcQuery && TwcLatLong) {
const txtAddress = document.getElementById('txtAddress'); const txtAddress = document.getElementById('txtAddress');
txtAddress.value = TwcQuery; txtAddress.value = TwcQuery;
txtAddress.blur(); LoadTwcData(JSON.parse(TwcLatLong));
txtAddress.focus();
} }
const TwcPlay = localStorage.getItem('TwcPlay'); const TwcPlay = localStorage.getItem('TwcPlay');
@@ -118,6 +105,7 @@ const init = () => {
postMessage('navButton', 'play'); postMessage('navButton', 'play');
localStorage.removeItem('TwcQuery'); localStorage.removeItem('TwcQuery');
localStorage.removeItem('TwcLatLon');
}); });
// swipe functionality // swipe functionality
@@ -129,31 +117,30 @@ const autocompleteOnSelect = async (suggestion, elem) => {
// Do not auto get the same city twice. // Do not auto get the same city twice.
if (elem.previousSuggestionValue === suggestion.value) return; if (elem.previousSuggestionValue === suggestion.value) return;
if (overrides[suggestion.value]) { const data = await json('https://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer/find', {
doRedirectToGeometry(overrides[suggestion.value]); data: {
} else { text: suggestion.value,
const data = await json('https://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer/find', { magicKey: suggestion.data,
data: { f: 'json',
text: suggestion.value, },
magicKey: suggestion.data, });
f: 'json',
},
});
const loc = data.locations[0]; const loc = data.locations[0];
if (loc) { if (loc) {
doRedirectToGeometry(loc.feature.geometry); doRedirectToGeometry(loc.feature.geometry);
} else { } else {
console.error('An unexpected error occurred. Please try a different search string.'); console.error('An unexpected error occurred. Please try a different search string.');
}
} }
}; };
const doRedirectToGeometry = (geom) => { const doRedirectToGeometry = (geom) => {
const latLon = { lat: Math.round2(geom.y, 4), lon: Math.round2(geom.x, 4) }; const latLon = { lat: Math.round2(geom.y, 4), lon: Math.round2(geom.x, 4) };
LoadTwcData(latLon);
// Save the query // Save the query
localStorage.setItem('TwcQuery', document.getElementById('txtAddress').value); localStorage.setItem('TwcQuery', document.getElementById('txtAddress').value);
localStorage.setItem('TwcLatLon', JSON.stringify(latLon));
// get the data
LoadTwcData(latLon);
}; };
const btnFullScreenClick = () => { const btnFullScreenClick = () => {

View File

@@ -100,8 +100,11 @@ const updateStatus = (value) => {
if (!progress) return; if (!progress) return;
progress.drawCanvas(displays, countLoadedDisplays()); progress.drawCanvas(displays, countLoadedDisplays());
// calculate first enabled display
const firstDisplayIndex = displays.findIndex((display) => display.enabled);
// if this is the first display and we're playing, load it up so it starts playing // if this is the first display and we're playing, load it up so it starts playing
if (isPlaying() && value.id === 0 && value.status === STATUS.loaded) { if (isPlaying() && value.id === firstDisplayIndex && value.status === STATUS.loaded) {
navTo(msg.command.firstFrame); navTo(msg.command.firstFrame);
} }