43389052 |
<!DOCTYPE html>
<!-- Courtesy ruler for editing this file
12345678901234567890123456789012345678901234567890123456789012345678901234567890
-->
<html>
<head>
<title>Node Signal</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style>
body {
background-image: url("static/chalk.jpg");
}
h2 {
font: bold 24px arial, sans-serif;
}
h3 {
font: bold 18px arial, sans-serif;
}
h4 {
font: bold 16px arial, sans-serif;
}
.mainContainer {
width: 750px;
text-align: center;
margin: auto;
|
1df34844 |
/*border: 1px solid black;*/
|
43389052 |
}
.datetime {
font: bold 22px arial, sans-serif;
padding: 0px;
}
.rowContainer {
display: table;
width: 100%;
}
.currentDataCell {
width: 50%;
padding: 10px;
font: bold 20px arial, sans-serif;
text-align: center;
display: table-cell;
vertical-align: middle;
}
.dataItems {
padding: 2px;
text-align: left;
line-height: 130%;
display: inline-block;
vertical-align: middle;
}
.chartContainer {
padding: 2px;
}
img.chart {
width:100%;
}
.notes {
font: 17px arial, sans-serif;
text-align: left;
padding: 10px;
}
|
46b6e7b4 |
span.chartSelector {
|
43389052 |
margin: auto;
}
|
46b6e7b4 |
ul.selectorElement {
|
43389052 |
list-style-type: none;
margin: 10px;
padding: 0;
overflow: hidden;
background-color: #bbb;
text-align: center;
}
|
46b6e7b4 |
li.selectorElement {
|
43389052 |
display: inline-block;
font: bold 18px arial, sans-serif;
color: black;
}
|
46b6e7b4 |
span.selectorElement:hover {
|
43389052 |
background-color: #333;
cursor: pointer;
color: white;
}
|
46b6e7b4 |
span.selectorElement {
|
43389052 |
display: inline-block;
padding: 8px 12px;
}
|
1df34844 |
#iframe_a {
border:none;
width:100%;
height:450px;
}
|
43389052 |
</style>
</head>
<body onload="main()">
<div class="mainContainer">
<h2><a href="https://github.com/fractalxaos/arednstat"
|
46b6e7b4 |
style="text-decoration:none" target="_new">
|
43389052 |
KA7JLO Aredn Node Signal</a></h2>
<h3>Last Updated</h3>
<div class="datetime">
|
1df34844 |
<span id="date"></span>
|
43389052 |
|
1df34844 |
<span id="time"></span>
|
43389052 |
</div>
<div class="rowContainer">
<div class="currentDataCell">
|
46b6e7b4 |
<div class="dataItems" style="text-align: center;">
Status: <span id="status"></span><br>
Data updates every: <span id="period"></span> minutes
|
43389052 |
</div>
|
46b6e7b4 |
|
43389052 |
</div>
</div>
|
46b6e7b4 |
<span class="chartSelectors">
<ul class="selectorElement">
<li class="selectorElement">Select charts:</li>
<li class="selectorElement"><span class="selectorElement"
onclick="setChartPeriod(1)">24 hours</span></li>
<li class="selectorElement"><span class="selectorElement"
onclick="setChartPeriod(2)">4 weeks</span></li>
<li class="selectorElement"><span class="selectorElement"
onclick="setChartPeriod(3)">12 months</span></li>
<li class="selectorElement"><span class="selectorElement"
onclick="setChartPeriod(0)">Custom…</span></li>
|
43389052 |
</ul>
</span>
|
1df34844 |
<div class="rowContainer" id="customChartsContainer" style="display:none;">
<div class="currentDataCell">
<form id="fmDateSelector" action="arednsig.php" method="post"
target="iframe_a">
<label for="beginDate">Begin Date: </label>
<input id="beginDate" name="beginDate" type="date" value="mm/dd/yyyy" />
<label for="endDate">End Date: </label>
<input id="endDate" name="endDate" type="date" value="mm/dd/yyyy" />
<br><br>
<input type="button" onclick="getCustomCharts()" value="Get Charts">
</form>
<span id="errorMsg"></span><br>
<iframe id="iframe_a" name="iframe_a"></iframe>
|
43389052 |
</div>
</div>
|
1df34844 |
<br>
|
43389052 |
|
1df34844 |
<div class="rowContainer" id="stockChartsContainer">
|
43389052 |
<div class="chartContainer">
|
1df34844 |
<img class="chart" id="signalChart">
|
43389052 |
</div>
<div class="chartContainer">
|
1df34844 |
<img class="chart" id="snrChart">
</div>
|
43389052 |
</div>
<div class="notes">
<b>NOTES:</b>
<ul>
<li>Aredn Node Signal software available at
<a href="https://github.com/fractalxaos/radmon" target="_new">
<i>Github.com</i></a>.</li>
<li>Project sponsored by
<a href="https://willamettevalleymesh.net" TARGET="_NEW">
<i>Willamette Valley Mesh Network</i></a>, Salem, Oregon.</li>
<li>For more information about the amateur radio emergency
data network (AREDN) see official web site at
<a href="http://www.arednmesh.org" target="_blank">
www.arednmesh.org</a>.</li>
</ul>
</div>
</div>
<br>
<script>
/* Global constants */
var nodeDataUrl = "dynamic/nodeOnline.js";
/* Global DOM objects */
// Chart elements
var signalChart = document.getElementById("signalChart");
|
1df34844 |
var snrChart = document.getElementById("snrChart");
|
43389052 |
// Text elements
var dateElmt = document.getElementById("date");
var timeElmt = document.getElementById("time");
var statusElmt = document.getElementById("status");
var periodElmt = document.getElementById("period");
|
1df34844 |
// Document elements
var customChartsContainer = document.getElementById("customChartsContainer");
var stockChartsContainer = document.getElementById("stockChartsContainer");
var fmDateSelector = document.getElementById("fmDateSelector");
var errorMsg = document.getElementById("errorMsg");
|
43389052 |
/* Global objects */
var httpRequest = new XMLHttpRequest();
/* Global variables */
|
1df34844 |
var chartPeriod = 1;
|
46b6e7b4 |
var chartRefreshRate = 0; // chart refresh rate in minutes
|
43389052 |
function main() {
/* Register call back function to process http requests */
httpRequest.onreadystatechange = function() {
if (httpRequest.readyState == 4 && httpRequest.status == 200) {
var dataArray = JSON.parse(httpRequest.responseText);
displayData(dataArray[0]);
} else if (httpRequest.readyState == 4 && httpRequest.status == 404) {
displayOfflineStatus();
}
};
httpRequest.ontimeout = function(e) {
displayOfflineStatus();
};
|
1df34844 |
initializeDateSelector();
|
43389052 |
getNodeData();
|
1df34844 |
getNodeCharts();
|
43389052 |
}
function getNodeData() {
httpRequest.open("GET", nodeDataUrl, true);
httpRequest.timeout = 3000;
httpRequest.send();
}
function setChartPeriod(n) {
|
1df34844 |
chartPeriod = n;
if (n == 0) {
customChartsContainer.style.display = "block";
stockChartsContainer.style.display = "none";
} else {
customChartsContainer.style.display = "none";
stockChartsContainer.style.display = "block";
getNodeCharts();
}
|
43389052 |
}
|
1df34844 |
function getNodeCharts() {
|
43389052 |
var d = new Date;
var pfx;
|
1df34844 |
switch(chartPeriod) {
|
43389052 |
case 1:
pfx = "24hr_";
break;
case 2:
pfx = "4wk_";
break;
case 3:
pfx = "12m_";
break;
}
signalChart.src = "dynamic/" + pfx + "signal.png?ver=" + d.getTime();
snrChart.src = "dynamic/" + pfx + "snr.png?ver=" + d.getTime();
}
function displayData(dataItem) {
var timeStamp, date, time, hourminute;
var localDateObj,localTimeZone;
timeStamp = dataItem.date;
date = timeStamp.split(" ")[0];
time = timeStamp.split(" ")[1];
hourminute = time.split(":")[0] + ":" + time.split(":")[1];
localDate = new Date();
localTimeZone = localDate.getTimezoneOffset() / 60;
dateElmt.innerHTML = date;
timeElmt.innerHTML = hourminute +
|
1df34844 |
" <small>(GMT+" + localTimeZone + ")</small>";
|
43389052 |
statusElmt.innerHTML = "Online";
statusElmt.style.color = "green";
|
1df34844 |
chartRefreshRate = dataItem.period;
periodElmt.innerHTML = chartRefreshRate;
setInterval(getNodeData, 60000 * chartRefreshRate);
setInterval(getNodeCharts, 60000 * chartRefreshRate);
|
43389052 |
}
function displayOfflineStatus() {
var d = new Date();
localTimeZone = d.getTimezoneOffset() / 60;
dateElmt.innerHTML = (d.getMonth() + 1) + "/" + d.getDate() + "/" +
|
1df34844 |
d.getFullYear();
|
43389052 |
timeElmt.innerHTML = d.getHours() + ":" + d.getMinutes() +
|
1df34844 |
" <small>(GMT+" + localTimeZone + ")</small>";
|
43389052 |
periodElmt.innerHTML = "?";
statusElmt.innerHTML = "offline";
statusElmt.style.color = "red";
}
|
1df34844 |
function initializeDateSelector() {
var d = new Date();
var dEnd = new Date(d.getFullYear(),
d.getMonth(), d.getDate() - 0);
var dBegin = new Date(d.getFullYear(),
d.getMonth(), d.getDate() - 1);
|
46b6e7b4 |
document.getElementById("beginDate").valueAsDate = dBegin;
document.getElementById("endDate").valueAsDate = dEnd;
|
1df34844 |
}
function getCustomCharts() {
fmDateSelector.submit();
}
|
43389052 |
</script>
</body>
</html>
|