trying chatgpt widget
This commit is contained in:
@@ -365,108 +365,139 @@ data:
|
|||||||
- type: split-column
|
- type: split-column
|
||||||
max-columns: 3
|
max-columns: 3
|
||||||
widgets:
|
widgets:
|
||||||
# Weather Widget - Időkép Scraper
|
# Weather Widget (Időkép)
|
||||||
- type: custom-api
|
- type: custom-api
|
||||||
url: https://www.idokep.hu/idojaras/Budapest
|
title: Időkép – Budapest VIII.
|
||||||
|
url: http://idokep-proxy.glance-system.svc.cluster.local:8000/api/idokep?place=Budapest%20VIII.%20ker
|
||||||
cache: 15m
|
cache: 15m
|
||||||
skip-json-validation: true
|
|
||||||
style:
|
|
||||||
grid-column: span 4
|
|
||||||
grid-row: span 3
|
|
||||||
template: |
|
template: |
|
||||||
{{/* 1. Extract Body and Current Data */}}
|
|
||||||
{{ $body := .Body }}
|
|
||||||
{{ $temp := findSubmatch "current-temperature\">([^˚<]+)" $body | trimSpace }}
|
|
||||||
{{ $cond := findSubmatch "current-weather\">([^<]+)</div>" $body | trimSpace }}
|
|
||||||
{{ $icon := findSubmatch "forecast-bigicon\"[^>]+src=\"([^\"]+)\"" $body }}
|
|
||||||
{{ $sunrise := findSubmatch "Napkelte ([0-9:]+)" $body }}
|
|
||||||
{{ $sunset := findSubmatch "Napnyugta ([0-9:]+)" $body }}
|
|
||||||
|
|
||||||
{{/* 2. Split HTML by the Forecast Column class to get daily blocks */}}
|
|
||||||
{{ $parts := split $body "<div class=\"ik dailyForecastCol\">" }}
|
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
.weather-card {
|
.idokep-wrap { display:grid; gap:12px; }
|
||||||
background: rgba(15, 23, 42, 0.4);
|
|
||||||
backdrop-filter: blur(16px);
|
/* TOP */
|
||||||
border-radius: 1.5rem;
|
.idokep-top { display:flex; align-items:center; justify-content:space-between; gap:12px; }
|
||||||
padding: 1.25rem;
|
.idokep-now { display:flex; align-items:center; gap:12px; }
|
||||||
color: #f8fafc;
|
.idokep-now img { width:44px; height:44px; }
|
||||||
font-family: ui-sans-serif, system-ui, sans-serif;
|
.idokep-temp { font-size:44px; font-weight:700; line-height:1; }
|
||||||
border: 1px solid rgba(255, 255, 255, 0.1);
|
.idokep-cond { opacity:.85; font-size:13px; margin-top:2px; }
|
||||||
height: 100%;
|
.idokep-place { opacity:.75; font-size:12px; text-align:right; }
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
/* HOURLY STRIP */
|
||||||
|
.idokep-hourly {
|
||||||
|
display:grid;
|
||||||
|
grid-template-columns: repeat(6, 1fr);
|
||||||
|
gap:8px;
|
||||||
}
|
}
|
||||||
.forecast-row {
|
.idokep-h {
|
||||||
display: grid;
|
background: rgba(255,255,255,0.04);
|
||||||
grid-template-columns: 3.5rem 2rem 2.5rem 1fr 2.5rem;
|
border-radius: 12px;
|
||||||
align-items: center;
|
padding: 8px;
|
||||||
gap: 0.75rem;
|
display:flex;
|
||||||
padding: 0.6rem 0;
|
flex-direction:column;
|
||||||
border-top: 1px solid rgba(255, 255, 255, 0.05);
|
align-items:center;
|
||||||
|
justify-content:center;
|
||||||
|
gap:6px;
|
||||||
}
|
}
|
||||||
.temp-bar-bg {
|
.idokep-h .t { font-size:12px; opacity:.85; }
|
||||||
height: 6px;
|
.idokep-h img { width:22px; height:22px; opacity:.95; }
|
||||||
background: rgba(255, 255, 255, 0.1);
|
.idokep-h .v { font-weight:600; }
|
||||||
border-radius: 99px;
|
.idokep-h .p { font-size:11px; opacity:.70; }
|
||||||
|
|
||||||
|
/* DAILY BARS */
|
||||||
|
.idokep-daily { display:grid; gap:10px; margin-top:2px; }
|
||||||
|
.idokep-d {
|
||||||
|
display:grid;
|
||||||
|
grid-template-columns: 42px 22px 1fr auto;
|
||||||
|
align-items:center;
|
||||||
|
gap:10px;
|
||||||
|
}
|
||||||
|
.idokep-d .dow { font-size:12px; opacity:.9; }
|
||||||
|
.idokep-d img { width:18px; height:18px; opacity:.95; }
|
||||||
|
|
||||||
|
.idokep-bar {
|
||||||
|
height: 12px;
|
||||||
|
border-radius: 999px;
|
||||||
|
background: rgba(255,255,255,0.08);
|
||||||
position: relative;
|
position: relative;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
.temp-bar-fill {
|
.idokep-bar > span{
|
||||||
position: absolute;
|
position:absolute;
|
||||||
height: 100%;
|
top:0; bottom:0;
|
||||||
border-radius: 99px;
|
border-radius: 999px;
|
||||||
background: linear-gradient(90deg, #60a5fa, #facc15, #f87171);
|
background: linear-gradient(90deg, #7dd3fc, #a7f3d0, #fde68a, #fdba74, #fca5a5);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.idokep-mm { font-size:11px; opacity:.7; margin-left:8px; white-space:nowrap; }
|
||||||
|
.idokep-foot { font-size:11px; opacity:.65; margin-top:2px; }
|
||||||
|
.idokep-foot a { opacity:.8; }
|
||||||
|
.idokep-err { opacity:.85; font-size:13px; }
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<div class="weather-card">
|
{{ if .JSON.Exists "error" }}
|
||||||
{{/* Current Conditions Section */}}
|
<div class="idokep-err">
|
||||||
<div class="flex justify-between items-start mb-4">
|
{{ .JSON.String "error" }}<br>
|
||||||
|
Place: <b>{{ .JSON.String "place" }}</b>
|
||||||
|
</div>
|
||||||
|
{{ else }}
|
||||||
|
{{ $c := .JSON.JSON "current" }}
|
||||||
|
{{ $hourly := .JSON.Array "hourly" }}
|
||||||
|
{{ $daily := .JSON.Array "daily" }}
|
||||||
|
{{ $src := .JSON.JSON "source" }}
|
||||||
|
|
||||||
|
<div class="idokep-wrap">
|
||||||
|
<div class="idokep-top">
|
||||||
|
<div class="idokep-now">
|
||||||
|
{{ if $c.Exists "icon_url" }}<img src="{{ $c.String "icon_url" }}" alt="">{{ end }}
|
||||||
<div>
|
<div>
|
||||||
<h3 class="text-xs font-black uppercase tracking-widest opacity-40 mb-1">Budapest</h3>
|
<div class="idokep-temp">{{ $c.Float "temp_c" | toInt }}°C</div>
|
||||||
<div class="text-4xl font-extrabold tracking-tighter">{{ $temp }}°C</div>
|
<div class="idokep-cond">{{ $c.String "condition_hu" }}</div>
|
||||||
<div class="text-sm font-medium opacity-90 mt-1">{{ $cond }}</div>
|
|
||||||
</div>
|
</div>
|
||||||
<img src="https://www.idokep.hu{{ $icon }}" class="w-16 h-16 object-contain" alt="weather">
|
</div>
|
||||||
|
<div class="idokep-place">{{ .JSON.String "place" }}</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{{/* Sunrise/Sunset info */}}
|
<div class="idokep-hourly">
|
||||||
<div class="flex gap-4 text-[11px] font-semibold opacity-60 mb-5">
|
{{ range $hourly }}
|
||||||
<span>↑ {{ $sunrise }}</span>
|
<div class="idokep-h">
|
||||||
<span>↓ {{ $sunset }}</span>
|
<div class="t">{{ .String "hour" }}</div>
|
||||||
</div>
|
{{ if .Exists "icon_url" }}<img src="{{ .String "icon_url" }}" alt="">{{ end }}
|
||||||
|
<div class="v">{{ .Float "temp_c" | toInt }}°</div>
|
||||||
{{/* 5-Day Forecast List */}}
|
{{ if .Exists "precip_pct" }}
|
||||||
<div class="flex-grow">
|
<div class="p">{{ .Float "precip_pct" | toInt }}%</div>
|
||||||
{{ range $i := list 1 2 3 4 5 }}
|
{{ else }}
|
||||||
{{ $block := index $parts $i }}
|
<div class="p"> </div>
|
||||||
{{ if $block }}
|
|
||||||
{{ $d_num := findSubmatch "dfDayNum\">([0-9]+)" $block }}
|
|
||||||
{{ $d_name := findSubmatch "dfDay\">([^<]+)" $block }}
|
|
||||||
{{ $d_icon := findSubmatch "src=\"([^\"]+)\"" $block }}
|
|
||||||
{{ $d_max := findSubmatch "class=\"max\">([^<]+)" $block }}
|
|
||||||
{{ $d_min := findSubmatch "class=\"min\">([^<]+)" $block }}
|
|
||||||
|
|
||||||
<div class="forecast-row">
|
|
||||||
<span class="text-xs font-bold whitespace-nowrap">{{ $d_num }} {{ $d_name }}</span>
|
|
||||||
<img src="https://www.idokep.hu{{ $d_icon }}" class="w-6 h-6 object-contain">
|
|
||||||
<span class="text-[11px] text-right font-medium opacity-50">{{ $d_min }}°</span>
|
|
||||||
<div class="temp-bar-bg">
|
|
||||||
<div class="temp-bar-fill" style="left: 20%; width: 60%;"></div>
|
|
||||||
</div>
|
|
||||||
<span class="text-[11px] font-bold">{{ $d_max }}°</span>
|
|
||||||
</div>
|
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
</div>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{{/* Footer Link */}}
|
<div class="idokep-daily">
|
||||||
<div class="mt-4 pt-2 text-center opacity-30">
|
{{ range $daily }}
|
||||||
<a href="https://www.idokep.hu/elorejelzes/Budapest" class="text-[9px] uppercase tracking-[0.2em] font-bold hover:opacity-100 transition-opacity">idokep.hu elorejelzes</a>
|
<div class="idokep-d">
|
||||||
|
<div class="dow">{{ .String "dow" }}</div>
|
||||||
|
{{ if .Exists "icon_url" }}<img src="{{ .String "icon_url" }}" alt="">{{ end }}
|
||||||
|
<div class="idokep-bar">
|
||||||
|
{{ if and (.Exists "bar_left_pct") (.Exists "bar_width_pct") }}
|
||||||
|
<span style="left: {{ .Float "bar_left_pct" }}%; width: {{ .Float "bar_width_pct" }}%; opacity:.95;"></span>
|
||||||
|
{{ else }}
|
||||||
|
<span style="left: 0%; width: 100%; opacity:.6;"></span>
|
||||||
|
{{ end }}
|
||||||
|
</div>
|
||||||
|
<div style="display:flex; align-items:center; gap:8px;">
|
||||||
|
<div style="font-weight:600;">{{ .Float "tmin_c" | toInt }}°</div>
|
||||||
|
<div style="opacity:.85;">{{ .Float "tmax_c" | toInt }}°</div>
|
||||||
|
{{ if .Exists "prec_mm" }}<div class="idokep-mm">{{ .Float "prec_mm" }}mm</div>{{ end }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
{{ end }}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="idokep-foot">
|
||||||
|
Forrás: <a href="{{ $src.String "url" }}" target="_blank">{{ $src.String "name" }}</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{{ end }}
|
||||||
|
|
||||||
# Calendar Widget
|
# Calendar Widget
|
||||||
- type: calendar
|
- type: calendar
|
||||||
|
|||||||
Reference in New Issue
Block a user