Compare commits
No commits in common. "a964662940a1d5832b89dc24395f21351e36d549" and "fb056f487653f100263f29e9a17131c4593b3c71" have entirely different histories.
a964662940
...
fb056f4876
10 changed files with 31 additions and 95 deletions
|
|
@ -45,15 +45,11 @@ class CurrentWeather extends WeatherDisplay {
|
||||||
const wind = this.data.WindSpeed > 0
|
const wind = this.data.WindSpeed > 0
|
||||||
? this.data.WindDirection.padEnd(3, '') + this.data.WindSpeed.toString().padStart(3, ' ')
|
? this.data.WindDirection.padEnd(3, '') + this.data.WindSpeed.toString().padStart(3, ' ')
|
||||||
: 'Calm';
|
: 'Calm';
|
||||||
const isDefaultTheme = (document.documentElement.dataset.theme ?? 'default') === 'default';
|
|
||||||
const windText = !isDefaultTheme && this.data.WindGust > 0
|
|
||||||
? `${wind} - Gusts to ${this.data.WindGust}`
|
|
||||||
: wind;
|
|
||||||
|
|
||||||
const fill = {
|
const fill = {
|
||||||
temp: this.data.Temperature + String.fromCharCode(176),
|
temp: this.data.Temperature + String.fromCharCode(176),
|
||||||
condition,
|
condition,
|
||||||
wind: windText,
|
wind,
|
||||||
location: this.data.city.substr(0, 20),
|
location: this.data.city.substr(0, 20),
|
||||||
humidity: `${this.data.Humidity}%`,
|
humidity: `${this.data.Humidity}%`,
|
||||||
dewpoint: this.data.DewPoint + String.fromCharCode(176),
|
dewpoint: this.data.DewPoint + String.fromCharCode(176),
|
||||||
|
|
@ -63,7 +59,7 @@ class CurrentWeather extends WeatherDisplay {
|
||||||
icon: { type: 'img', src: this.data.Icon },
|
icon: { type: 'img', src: this.data.Icon },
|
||||||
};
|
};
|
||||||
|
|
||||||
if (isDefaultTheme && this.data.WindGust > 0) fill['wind-gusts'] = `Gusts to ${this.data.WindGust}`;
|
if (this.data.WindGust > 0) fill['wind-gusts'] = `Gusts to ${this.data.WindGust}`;
|
||||||
|
|
||||||
const area = this.elem.querySelector('.main');
|
const area = this.elem.querySelector('.main');
|
||||||
area.innerHTML = '';
|
area.innerHTML = '';
|
||||||
|
|
|
||||||
|
|
@ -28,38 +28,6 @@ const getStoredLocationMetadata = () => {
|
||||||
|
|
||||||
const isUsLocation = (location) => ['US', 'USA'].includes((location?.countryCode ?? '').toUpperCase());
|
const isUsLocation = (location) => ['US', 'USA'].includes((location?.countryCode ?? '').toUpperCase());
|
||||||
|
|
||||||
const isWithinBounds = (latLon, bounds) => latLon.lat >= bounds.minLat
|
|
||||||
&& latLon.lat <= bounds.maxLat
|
|
||||||
&& latLon.lon >= bounds.minLon
|
|
||||||
&& latLon.lon <= bounds.maxLon;
|
|
||||||
|
|
||||||
const isWithinUsFallbackBounds = (latLon) => [
|
|
||||||
{
|
|
||||||
minLat: 24.0,
|
|
||||||
maxLat: 49.5,
|
|
||||||
minLon: -125.0,
|
|
||||||
maxLon: -66.5,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
minLat: 51.0,
|
|
||||||
maxLat: 71.5,
|
|
||||||
minLon: -179.5,
|
|
||||||
maxLon: -129.5,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
minLat: 18.5,
|
|
||||||
maxLat: 22.5,
|
|
||||||
minLon: -160.5,
|
|
||||||
maxLon: -154.5,
|
|
||||||
},
|
|
||||||
].some((bounds) => isWithinBounds(latLon, bounds));
|
|
||||||
|
|
||||||
const supportsNoaaLocation = (location, latLon) => {
|
|
||||||
if (isUsLocation(location)) return true;
|
|
||||||
if (!location?.countryCode) return isWithinUsFallbackBounds(latLon);
|
|
||||||
return false;
|
|
||||||
};
|
|
||||||
|
|
||||||
const getFallbackLocation = (latLon) => {
|
const getFallbackLocation = (latLon) => {
|
||||||
const query = localStorage.getItem('latLonQuery') ?? `${latLon.lat.toFixed(4)}, ${latLon.lon.toFixed(4)}`;
|
const query = localStorage.getItem('latLonQuery') ?? `${latLon.lat.toFixed(4)}, ${latLon.lon.toFixed(4)}`;
|
||||||
const [city = query, state = ''] = query.split(',').map((part) => part.trim());
|
const [city = query, state = ''] = query.split(',').map((part) => part.trim());
|
||||||
|
|
@ -126,21 +94,22 @@ const getWeather = async (latLon, haveDataCallback) => {
|
||||||
if (typeof haveDataCallback === 'function') haveDataCallback(location);
|
if (typeof haveDataCallback === 'function') haveDataCallback(location);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const noaaEligibleLocation = supportsNoaaLocation(location, latLon);
|
const supportsNoaaDisplays = isUsLocation(location);
|
||||||
|
const shouldTryNoaaPoint = supportsNoaaDisplays || !location.countryCode;
|
||||||
let point = null;
|
let point = null;
|
||||||
let stations = null;
|
let stations = null;
|
||||||
let stationId = '';
|
let stationId = '';
|
||||||
|
|
||||||
if (noaaEligibleLocation) {
|
if (shouldTryNoaaPoint) {
|
||||||
point = await getPoint(latLon.lat, latLon.lon);
|
point = await getPoint(latLon.lat, latLon.lon);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (noaaEligibleLocation && point?.properties?.observationStations) {
|
if (supportsNoaaDisplays && point?.properties?.observationStations) {
|
||||||
stations = await safeJson(point.properties.observationStations);
|
stations = await safeJson(point.properties.observationStations);
|
||||||
stationId = stations?.features?.[0]?.properties?.stationIdentifier ?? '';
|
stationId = stations?.features?.[0]?.properties?.stationIdentifier ?? '';
|
||||||
}
|
}
|
||||||
|
|
||||||
const supportsNoaaAlerts = noaaEligibleLocation;
|
const supportsNoaaAlerts = !!(isUsLocation(location) || point);
|
||||||
|
|
||||||
const state = location.state || point?.properties?.relativeLocation?.properties?.state || '';
|
const state = location.state || point?.properties?.relativeLocation?.properties?.state || '';
|
||||||
let city = location.city || point?.properties?.relativeLocation?.properties?.city || localStorage.getItem('latLonQuery') || '';
|
let city = location.city || point?.properties?.relativeLocation?.properties?.city || localStorage.getItem('latLonQuery') || '';
|
||||||
|
|
@ -160,7 +129,7 @@ const getWeather = async (latLon, haveDataCallback) => {
|
||||||
weatherParameters.timeZone = openMeteoForecast.timezone;
|
weatherParameters.timeZone = openMeteoForecast.timezone;
|
||||||
weatherParameters.forecast = aggregatedForecast;
|
weatherParameters.forecast = aggregatedForecast;
|
||||||
weatherParameters.supportsNoaaAlerts = supportsNoaaAlerts;
|
weatherParameters.supportsNoaaAlerts = supportsNoaaAlerts;
|
||||||
weatherParameters.supportsNoaaDisplays = !!(noaaEligibleLocation && point && stations?.features?.length);
|
weatherParameters.supportsNoaaDisplays = !!(supportsNoaaDisplays && point && stations?.features?.length);
|
||||||
weatherParameters.zoneId = point?.properties?.forecastZone?.substr(-6) ?? '';
|
weatherParameters.zoneId = point?.properties?.forecastZone?.substr(-6) ?? '';
|
||||||
weatherParameters.radarId = point?.properties?.radarStation?.substr(-3) ?? '';
|
weatherParameters.radarId = point?.properties?.radarStation?.substr(-3) ?? '';
|
||||||
weatherParameters.stationId = stationId;
|
weatherParameters.stationId = stationId;
|
||||||
|
|
|
||||||
|
|
@ -57,7 +57,6 @@ const getThemeAssetUrl = (themeName, assetKey) => {
|
||||||
const applyTheme = (themeName) => {
|
const applyTheme = (themeName) => {
|
||||||
const selectedTheme = getAvailableThemes().includes(themeName) ? themeName : DEFAULT_THEME;
|
const selectedTheme = getAvailableThemes().includes(themeName) ? themeName : DEFAULT_THEME;
|
||||||
localStorage.setItem(THEME_STORAGE_KEY, selectedTheme);
|
localStorage.setItem(THEME_STORAGE_KEY, selectedTheme);
|
||||||
document.documentElement.dataset.theme = selectedTheme;
|
|
||||||
|
|
||||||
document.documentElement.style.setProperty('--theme-background-1', `url('${getThemeAssetUrl(selectedTheme, 'background1')}')`);
|
document.documentElement.style.setProperty('--theme-background-1', `url('${getThemeAssetUrl(selectedTheme, 'background1')}')`);
|
||||||
document.documentElement.style.setProperty('--theme-background-1-chart', `url('${getThemeAssetUrl(selectedTheme, 'background1Chart')}')`);
|
document.documentElement.style.setProperty('--theme-background-1-chart', `url('${getThemeAssetUrl(selectedTheme, 'background1Chart')}')`);
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@
|
||||||
&.right {
|
&.right {
|
||||||
right: 0px;
|
right: 0px;
|
||||||
font-family: "Star4000 Large";
|
font-family: "Star4000 Large";
|
||||||
font-size: 18px;
|
font-size: 20px;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
line-height: 24px;
|
line-height: 24px;
|
||||||
|
|
||||||
|
|
@ -93,34 +93,3 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
:root[data-theme]:not([data-theme='default']) {
|
|
||||||
.weather-display .main.current-weather {
|
|
||||||
&.main {
|
|
||||||
.col {
|
|
||||||
&.left {
|
|
||||||
margin-top: 35px;
|
|
||||||
}
|
|
||||||
|
|
||||||
&.right {
|
|
||||||
margin-top: 36px;
|
|
||||||
padding: 21px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.wind-container {
|
|
||||||
display: block;
|
|
||||||
|
|
||||||
&>div {
|
|
||||||
width: 50%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.wind {
|
|
||||||
text-align: right;
|
|
||||||
font-size: 22px;
|
|
||||||
display: contents;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -23,8 +23,4 @@
|
||||||
min-height: 280px;
|
min-height: 280px;
|
||||||
line-height: 40px;
|
line-height: 40px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
:root[data-theme]:not([data-theme='default']) .weather-display .local-forecast .forecasts {
|
|
||||||
margin-top: 16px;
|
|
||||||
}
|
|
||||||
|
|
@ -49,10 +49,9 @@
|
||||||
|
|
||||||
.box {
|
.box {
|
||||||
display: block;
|
display: block;
|
||||||
border: 2.7px solid #000;
|
border: 2px solid black;
|
||||||
width: 90%;
|
width: 100%;
|
||||||
height: 12px;
|
height: 22px;
|
||||||
margin-top: 4px;
|
|
||||||
padding: 0;
|
padding: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -98,7 +97,7 @@
|
||||||
top: -20px;
|
top: -20px;
|
||||||
font-family: 'Star4000 Small';
|
font-family: 'Star4000 Small';
|
||||||
font-size: 18pt;
|
font-size: 18pt;
|
||||||
left: 132px;
|
left: 130px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -164,12 +163,14 @@
|
||||||
border: 0;
|
border: 0;
|
||||||
|
|
||||||
.nearby-weather-marker-inner {
|
.nearby-weather-marker-inner {
|
||||||
display: inline-flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
min-width: 72px;
|
min-width: 72px;
|
||||||
padding: 2px 4px;
|
padding: 2px 4px;
|
||||||
background: rgb(18 34 61 / 0%);
|
background: rgba(18, 34, 61, 0.88);
|
||||||
|
border: 1px solid #000;
|
||||||
|
box-shadow: 1px 1px 0 #000;
|
||||||
color: #fff;
|
color: #fff;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
@ -181,7 +182,6 @@
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
margin-bottom: 1px;
|
margin-bottom: 1px;
|
||||||
text-shadow: 1px 1px 0 #000;
|
text-shadow: 1px 1px 0 #000;
|
||||||
display: none;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.details {
|
.details {
|
||||||
|
|
|
||||||
|
|
@ -53,18 +53,25 @@
|
||||||
border: 0;
|
border: 0;
|
||||||
|
|
||||||
.nearby-weather-marker-inner {
|
.nearby-weather-marker-inner {
|
||||||
display: inline-flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
min-width: 72px;
|
min-width: 72px;
|
||||||
padding: 2px 4px;
|
padding: 2px 4px;
|
||||||
background: rgb(255 255 255 / 0%);
|
background: rgba(18, 34, 61, 0.88);
|
||||||
|
border: 1px solid #000;
|
||||||
|
box-shadow: 1px 1px 0 #000;
|
||||||
color: #fff;
|
color: #fff;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.city {
|
.city {
|
||||||
display: none;
|
font-family: 'Star4000 Small';
|
||||||
|
font-size: 11pt;
|
||||||
|
line-height: 1;
|
||||||
|
white-space: nowrap;
|
||||||
|
margin-bottom: 1px;
|
||||||
|
@include u.text-shadow();
|
||||||
}
|
}
|
||||||
|
|
||||||
.details {
|
.details {
|
||||||
|
|
|
||||||
2
server/styles/ws.min.css
vendored
2
server/styles/ws.min.css
vendored
File diff suppressed because one or more lines are too long
|
|
@ -39,4 +39,4 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -23,7 +23,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="item">
|
<div class="item">
|
||||||
<div class="box box-3"></div>
|
<div class="box box-3"></div>
|
||||||
<div class="label">LTRN</div>
|
<div class="label">LT RN</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="item">
|
<div class="item">
|
||||||
<div class="box box-4"></div>
|
<div class="box box-4"></div>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue