Compare commits

...

4 Commits

Author SHA1 Message Date
Matt Walsh
4666878250 5.20.2 2025-05-21 13:55:39 -05:00
Matt Walsh
5813dd9a92 title overflow cleanup 2025-05-21 13:55:27 -05:00
Matt Walsh
8cb8873760 add hooks for geoip lookup 2025-05-21 13:49:49 -05:00
Matt Walsh
323c175936 css cleanup 2025-05-20 22:19:46 -05:00
10 changed files with 42 additions and 14 deletions

View File

@@ -60,16 +60,34 @@ const index = (req, res) => {
}); });
}; };
const geoip = (req, res) => {
res.set({
'x-geoip-city': 'Orlando',
'x-geoip-country': 'US',
'x-geoip-country-name': 'United States',
'x-geoip-country-region': 'FL',
'x-geoip-country-region-name': 'Florida',
'x-geoip-latitude': '28.52135',
'x-geoip-longitude': '-81.41079',
'x-geoip-postal-code': '32789',
'x-geoip-time-zone': 'America/New_York',
'content-type': 'application/json',
});
res.json({});
};
// debugging // debugging
if (process.env?.DIST === '1') { if (process.env?.DIST === '1') {
// distribution // distribution
app.use('/images', express.static('./server/images')); app.use('/images', express.static('./server/images'));
app.use('/fonts', express.static('./server/fonts')); app.use('/fonts', express.static('./server/fonts'));
app.use('/scripts', express.static('./server/scripts')); app.use('/scripts', express.static('./server/scripts'));
app.use('/geoip', geoip);
app.use('/', express.static('./dist')); app.use('/', express.static('./dist'));
} else { } else {
// debugging // debugging
app.get('/index.html', index); app.get('/index.html', index);
app.use('/geoip', geoip);
app.get('/', index); app.get('/', index);
app.get('*name', express.static('./server')); app.get('*name', express.static('./server'));
} }

4
package-lock.json generated
View File

@@ -1,12 +1,12 @@
{ {
"name": "ws4kp", "name": "ws4kp",
"version": "5.20.1", "version": "5.20.2",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "ws4kp", "name": "ws4kp",
"version": "5.20.1", "version": "5.20.2",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"dotenv": "^16.5.0", "dotenv": "^16.5.0",

View File

@@ -1,6 +1,6 @@
{ {
"name": "ws4kp", "name": "ws4kp",
"version": "5.20.1", "version": "5.20.2",
"description": "Welcome to the WeatherStar 4000+ project page!", "description": "Welcome to the WeatherStar 4000+ project page!",
"main": "index.mjs", "main": "index.mjs",
"type": "module", "type": "module",

View File

@@ -78,6 +78,7 @@ const init = () => {
onSelect(suggestion) { autocompleteOnSelect(suggestion); }, onSelect(suggestion) { autocompleteOnSelect(suggestion); },
width: 490, width: 490,
}); });
window.autoComplete = autoComplete;
// attempt to parse the url parameters // attempt to parse the url parameters
const parsedParameters = parseQueryString(); const parsedParameters = parseQueryString();
@@ -371,6 +372,10 @@ const btnGetGpsClick = async () => {
const position = await getPosition(); const position = await getPosition();
const { latitude, longitude } = position.coords; const { latitude, longitude } = position.coords;
getForecastFromLatLon(latitude, longitude, true);
};
const getForecastFromLatLon = (latitude, longitude, fromGps = false) => {
const txtAddress = document.querySelector(TXT_ADDRESS_SELECTOR); const txtAddress = document.querySelector(TXT_ADDRESS_SELECTOR);
txtAddress.value = `${round2(latitude, 4)}, ${round2(longitude, 4)}`; txtAddress.value = `${round2(latitude, 4)}, ${round2(longitude, 4)}`;
@@ -380,7 +385,7 @@ const btnGetGpsClick = async () => {
const query = `${location.city}, ${location.state}`; const query = `${location.city}, ${location.state}`;
localStorage.setItem('latLon', JSON.stringify({ lat: latitude, lon: longitude })); localStorage.setItem('latLon', JSON.stringify({ lat: latitude, lon: longitude }));
localStorage.setItem('latLonQuery', query); localStorage.setItem('latLonQuery', query);
localStorage.setItem('latLonFromGPS', true); localStorage.setItem('latLonFromGPS', fromGps);
txtAddress.value = `${location.city}, ${location.state}`; txtAddress.value = `${location.city}, ${location.state}`;
}); });
}; };
@@ -411,3 +416,6 @@ const getCustomCode = async () => {
document.body.append(customElem); document.body.append(customElem);
} }
}; };
// expose functions for external use
window.getForecastFromLatLon = getForecastFromLatLon;

View File

@@ -172,6 +172,11 @@ class AutoComplete {
} }
} }
setValue(newValue) {
this.currentValue = newValue;
this.elem.value = newValue;
}
onValueChange() { onValueChange() {
clearTimeout(this.onValueChange); clearTimeout(this.onValueChange);

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -90,7 +90,9 @@
.location { .location {
color: c.$title-color; color: c.$title-color;
max-height: 32px;
margin-bottom: 10px; margin-bottom: 10px;
overflow: hidden;
} }
} }
} }

View File

@@ -4,6 +4,7 @@
@font-face { @font-face {
font-family: "Star4000"; font-family: "Star4000";
src: url('../fonts/Star4000.woff') format('woff'); src: url('../fonts/Star4000.woff') format('woff');
font-display: swap;
} }
body { body {
@@ -251,12 +252,6 @@ body {
width: 475px; width: 475px;
} }
@font-face {
font-family: "Star4000";
src: url('../fonts/Star4000.woff') format('woff');
font-display: swap;
}
@font-face { @font-face {
font-family: 'Star4000 Extended'; font-family: 'Star4000 Extended';
src: url('../fonts/Star4000 Extended.woff') format('woff'); src: url('../fonts/Star4000 Extended.woff') format('woff');
@@ -271,8 +266,8 @@ body {
@font-face { @font-face {
font-family: 'Star4000 Small'; font-family: 'Star4000 Small';
font-display: swap;
src: url('../fonts/Star4000 Small.woff') format('woff'); src: url('../fonts/Star4000 Small.woff') format('woff');
font-display: swap;
} }
#display { #display {

View File

@@ -1,4 +1,4 @@
<%- include('header.ejs', {title: 'SPC Outlook', hasTime: true, noaaLogo: true}) %> <%- include('header.ejs', {titleDual:{ top: 'Storm Prediction' , bottom: 'Center Outlook' }, hasTime: true}) %>
<div class="main has-scroll spc-outlook"> <div class="main has-scroll spc-outlook">
<div class="container"> <div class="container">
<div class="risk-levels"> <div class="risk-levels">