From 04eecafe7d7e208a5b93cb4fac48fb61e7ea1bb8 Mon Sep 17 00:00:00 2001 From: Luke Bratch Date: Tue, 7 Dec 2021 09:54:55 +0000 Subject: Add wind force value to title and summary lines (in day mode). --- index.php | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/index.php b/index.php index b17f96d..a6de44c 100644 --- a/index.php +++ b/index.php @@ -25,6 +25,7 @@ $nightmode = 0; $valid = array(); $temp = array(); $misc = array(); +$wind = array(); foreach ($divs as $div) { if ($day > 2) { @@ -59,6 +60,14 @@ foreach ($divs as $div) { } } } + + if ($attr->nodeValue == "wind") { + $spans = $div->getElementsByTagName("span"); + foreach ($spans as $span) { + array_push($wind, $span->nodeValue); + } + } + } } @@ -74,7 +83,7 @@ for ($i = 0; $i < count($temp); $i++) { } if (!$nightmode) { - echo "Max $temp[0], Min $temp[1], Cur $temp[2], $misc[0]\n\n"; + echo "Max $temp[0], Min $temp[1], Cur $temp[2], Wind $wind[0], $misc[0]\n\n"; } else { echo "Min $temp[0], Cur $temp[1], $misc[0]\n\n"; } @@ -86,7 +95,7 @@ echo "

Forecasts | Graphs

\n\n"; echo "

Today

\n\n"; echo "

$valid[0]

\n"; if (!$nightmode) { - echo "Max: $temp[0], Min: $temp[1], Current: $temp[2]

\n"; + echo "Max: $temp[0], Min: $temp[1], Current: $temp[2], Wind: $wind[0]

\n"; } else { echo "Min: $temp[0], Cur: $temp[1]

\n"; } @@ -96,7 +105,7 @@ echo "Wind: $misc[1]

\n"; echo "

Tomorrow

\n\n"; echo "

$valid[1]

\n"; if (!$nightmode) { - echo "Max: $temp[3], Min: $temp[4]

\n"; + echo "Max: $temp[3], Min: $temp[4], Wind: $wind[2]

\n"; } else { echo "Max: $temp[2], Min: $temp[3]

\n"; } -- cgit v1.2.3