wahs-the-weather/index.php
2024-12-12 00:35:32 +00:00

166 lines
7.3 KiB
PHP

<!DOCTYPE html>
<html lang="en">
<head>
<?php include("./includes/head.inc.php"); ?>
<script>
window.onload = () => {
$('#moonImg').attr('src', '/images/moon.png?' + Date.now());
// update the moon image every 20 minutes if the page is left open
setInterval(() => {
$('#moonImg').attr('src', '/images/moon.png?' + Date.now());
}, 1200000);
};
</script>
</head>
<body>
<div class="page-container">
<?php include("./includes/header.inc.php"); ?>
<div id="content">
<h3>Almanac</h3>
<table class="almanac">
<tbody>
<tr>
<td>Dawn:</td>
<td><span data-cmxdata="dawn"></span></td>
<td>Sun Rise:</td>
<td><span data-cmxdata="sunrise"></span></td>
<td>Moon Rise:</td>
<td><span data-cmxdata="moonrise"></span></td>
<td rowspan="3" style="width:75px; height: 75px; padding:0"><img id="moonImg"
src="/images/moon.png" alt="Moon" width="75" height="75" class="w3-image" />Visible
<span data-cmxdata="MoonPercentAbs"></span>%
</td>
</tr>
<tr>
<td>Dusk:</td>
<td><span data-cmxdata="dusk"></span></td>
<td>Sun Set:</td>
<td><span data-cmxdata="sunset"></span></td>
<td>Moon Set:</td>
<td><span data-cmxdata="moonset"></span></td>
</tr>
<tr>
<td>Daylight:</td>
<td><span data-cmxdata="daylightlength"></span></td>
<td>Day Length:</td>
<td><span data-cmxdata="daylength"></span></td>
<td>Moon Phase:</td>
<td><span id="moonPhase" data-cmxdata="moonphase"></span></td>
</tr>
</tbody>
</table>
<br><br>
<h3>Conditions at local time <span data-cmxdata="time"></span></h3>
<table class="mx-datatable current-conditions">
<tr>
<th colspan="4">Temperature and Humidity</th>
</tr>
<tr>
<td>Temperature</td>
<td><span data-cmxdata="temp"></span>&nbsp;<span data-cmxdata="tempunit"></span>
</td>
<td>Dew Point</td>
<td><span data-cmxdata="dew"></span>&nbsp;<span data-cmxdata="tempunit"></span>
</td>
</tr>
<tr>
<td>Windchill</td>
<td><span data-cmxdata="wchill"></span>&nbsp;<span data-cmxdata="tempunit"></span>
</td>
<td>Humidity</td>
<td><span data-cmxdata="hum"></span>&nbsp;%</td>
</tr>
<tr>
<td>Heat Index</td>
<td><span data-cmxdata="heatindex"></span>&nbsp;<span data-cmxdata="tempunit"></span></td>
<td><span data-cmx-feels>Feels
Like</span></td>
<td><span data-cmx-feels data-cmxdata="feelslike"></span>&nbsp;<span data-cmxdata="tempunit"></span>
</td>
</tr>
<tr>
<td>Temp change last hour</td>
<td><span data-cmxdata="TempChangeLastHour"></span>&nbsp;<span data-cmxdata="tempunit"></span>
</td>
<td></td>
<td></td>
</tr>
<tr>
<th colspan="4">Rainfall</th>
</tr>
<tr>
<td>Rainfall Today</td>
<td><span data-cmxdata="rfall"></span>&nbsp;<span data-cmxdata="rainunit"></span>
</td>
<td>Rainfall Rate</td>
<td><span data-cmxdata="rrate"></span>&nbsp;<span data-cmxdata="rainunit"></span>/hr
</td>
</tr>
<tr>
<td>Rainfall This Month</td>
<td><span data-cmxdata="rmonth"></span>&nbsp;<span data-cmxdata="rainunit"></span>
</td>
<td>Rainfall This Year</td>
<td><span data-cmxdata="ryear"></span>&nbsp;<span data-cmxdata="rainunit"></span>
</td>
</tr>
<tr>
<td>Rainfall Last Hour</td>
<td><span data-cmxdata="rhour"></span>&nbsp;<span data-cmxdata="rainunit"></span>
</td>
<td>Last rainfall</td>
<td><span data-cmxdata="LastRainTip"></span></td>
</tr>
<tr>
<td>Rainfall Since Midnight</td>
<td><span data-cmxdata="rmidnight"></span>&nbsp;<span data-cmxdata="rainunit"></span></td>
<td>Rainfall Last 24 Hours</td>
<td><span data-cmxdata="r24hour"></span>&nbsp;<span data-cmxdata="rainunit"></span>
</td>
</tr>
<tr>
<th colspan="4">Wind</th>
</tr>
<tr>
<td>Wind Speed <span class="subText">(gust)</span></td>
<td><span data-cmxdata="wgust"></span>&nbsp;<span data-cmxdata="windunit"></span>
</td>
<td>Wind Speed <span class="subText">(avg)</span></td>
<td><span data-cmxdata="wspeed"></span>&nbsp;<span data-cmxdata="windunit"></span>
</td>
</tr>
<tr>
<td>Wind Bearing</td>
<td><span data-cmxdata="avgbearing"></span>&deg; <span data-cmxdata="wdir"></span>
</td>
<td>Beaufort <span data-cmxdata="beaufort"></span></td>
<td><span data-cmxdata="beaudesc"></span></td>
</tr>
<tr>
<td>Wind Variation <span class="subText">(last 10 minutes)</span></td>
<td colspan="3">From <span data-cmxdata="BearingRangeFrom"></span>&deg; to <span
data-cmxdata="BearingRangeTo"></span>&deg;</td>
</tr>
<tr>
<th colspan="4">Pressure <span class="subText">(sea
level)</span></th>
</tr>
<tr>
<td>Barometer</td>
<td><span data-cmxdata="press"></span>&nbsp;<span data-cmxdata="pressunit"></span>
</td>
<td><span data-cmxdata="presstrend"></span></td>
<td><span data-cmxdata="presstrendval"></span>&nbsp;<span data-cmxdata="pressunit"></span>/hr
</td>
</tr>
</table>
<small>Page data updated <span data-cmxdata="update"></span></small>
</div>
<?php include("./includes/footer.inc.php"); ?>
</div>
</body>
</html>