feat(whereami): show conditions emoji on page and in og:description
This commit is contained in:
parent
f941254f58
commit
90d2409b32
1 changed files with 10 additions and 1 deletions
|
|
@ -12,6 +12,9 @@
|
|||
{{ with .windspeedmph }}{{ $parts = $parts | append (printf "wind %.1f mph" .) }}{{ end }}
|
||||
{{ $desc = delimit $parts ", " }}
|
||||
{{ end }}
|
||||
{{ with $d.conditions }}
|
||||
{{ $desc = printf "%s %s · %s" .emoji .label $desc }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
<title>{{ $title }}</title>
|
||||
<meta property="og:title" content="{{ $title }}">
|
||||
|
|
@ -37,6 +40,7 @@
|
|||
#map { height: 520px; }
|
||||
#sidebar { display: flex; flex-direction: column; gap: 0; }
|
||||
#location-name { margin: 0 0 0.15rem 0; min-height: 1.4em; }
|
||||
#wx-conditions { font-size: 1.4em; margin: 0 0 0.25rem 0; }
|
||||
#wx-meta { font-size: 0.75em; color: #888; margin: 0 0 1rem 0; }
|
||||
#weather-grid {
|
||||
display: grid;
|
||||
|
|
@ -56,6 +60,7 @@
|
|||
<div id="map"></div>
|
||||
<div id="sidebar">
|
||||
<h2 id="location-name">Fetching location…</h2>
|
||||
<p id="wx-conditions"></p>
|
||||
<p id="wx-meta"></p>
|
||||
<div id="weather-grid"></div>
|
||||
</div>
|
||||
|
|
@ -118,7 +123,11 @@
|
|||
{ label: 'Rain (daily)', value: w.dailyrainin, unit: 'in' },
|
||||
].filter(function(c) { return c.value !== null && c.value !== undefined; });
|
||||
|
||||
var updated = w.lastUpdated ? new Date(w.lastUpdated).toLocaleTimeString() : '';
|
||||
if (data.conditions) {
|
||||
document.getElementById('wx-conditions').textContent = data.conditions.emoji + ' ' + data.conditions.label;
|
||||
}
|
||||
|
||||
var updated = w.lastUpdated ? new Date(w.lastUpdated).toLocaleTimeString() : '';
|
||||
var meta = 'My Weather Station';
|
||||
if (updated) meta += ' · updated ' + updated;
|
||||
document.getElementById('wx-meta').textContent = meta;
|
||||
|
|
|
|||
Loading…
Reference in a new issue