mirror of
https://github.com/DigitalDevices/octonet.git
synced 2023-10-10 11:36:52 +00:00
Stream and tuner status converted to ajax
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
@@ -7,58 +7,75 @@
|
||||
<script type="text/javascript" src="/menu.js"></script>
|
||||
<!-- Add additional scripts and settings here -->
|
||||
<meta http-equiv="Pragma" content="no-cache" />
|
||||
<script id=script1 type="text/javascript" src="/octoserve/tunerstatus.js"></script>
|
||||
|
||||
<!-- Add page scripts here -->
|
||||
<script type="text/javascript">
|
||||
function Show()
|
||||
|
||||
|
||||
var xmlhttp = new XMLHttpRequest();
|
||||
var url = "/octoserve/tunerstatus.json";
|
||||
|
||||
xmlhttp.onreadystatechange=function()
|
||||
{
|
||||
for( i = 0; i < TunerList.length ; i++ )
|
||||
if (xmlhttp.readyState == 4 )
|
||||
{
|
||||
if( xmlhttp.status == 200 )
|
||||
myFunction(xmlhttp.responseText);
|
||||
}
|
||||
}
|
||||
|
||||
function myFunction(response)
|
||||
{
|
||||
try
|
||||
{
|
||||
var tl = JSON.parse(response);
|
||||
Show(tl.TunerList);
|
||||
}
|
||||
catch(err) {}
|
||||
window.setTimeout(renew,1000);
|
||||
}
|
||||
|
||||
|
||||
function Show(TunerList)
|
||||
{
|
||||
for( var i = 0; i < TunerList.length ; i++ )
|
||||
{
|
||||
if( TunerList[i].Active )
|
||||
if( TunerList[i].Status != "Inactive" )
|
||||
{
|
||||
if( TunerList[i].Lock )
|
||||
{
|
||||
document.getElementById("elStatus"+i).firstChild.nodeValue = "Locked";
|
||||
document.getElementById("elStrength"+i).firstChild.nodeValue = TunerList[i].Strength;
|
||||
document.getElementById("elQuality"+i).firstChild.nodeValue = TunerList[i].Quality;
|
||||
document.getElementById("tdStatus"+i).firstChild.nodeValue = "Locked";
|
||||
document.getElementById("tdStrength"+i).firstChild.nodeValue = (TunerList[i].Strength/1000+108.75).toFixed(1)+" dBµV";
|
||||
document.getElementById("tdSNR"+i).firstChild.nodeValue = (TunerList[i].SNR/1000).toFixed(1) + " dB";
|
||||
document.getElementById("tdQuality"+i).firstChild.nodeValue = TunerList[i].Quality.toFixed(0) + "%";
|
||||
}
|
||||
else
|
||||
{
|
||||
document.getElementById("elStatus"+i).firstChild.nodeValue = "No Signal";
|
||||
document.getElementById("elStrength"+i).firstChild.nodeValue = "";
|
||||
document.getElementById("elQuality"+i).firstChild.nodeValue = "";
|
||||
document.getElementById("tdStatus"+i).firstChild.nodeValue = "No Signal";
|
||||
document.getElementById("tdStrength"+i).firstChild.nodeValue = "";
|
||||
document.getElementById("tdSNR"+i).firstChild.nodeValue = "";
|
||||
document.getElementById("tdQuality"+i).firstChild.nodeValue = "";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
document.getElementById("elStatus"+i).firstChild.nodeValue = "";
|
||||
document.getElementById("elStrength"+i).firstChild.nodeValue = "";
|
||||
document.getElementById("elQuality"+i).firstChild.nodeValue = "";
|
||||
}
|
||||
|
||||
document.getElementById("trTuner"+i).style.display = "table-row";
|
||||
}
|
||||
}
|
||||
|
||||
function renew()
|
||||
{
|
||||
script = document.getElementById("script1");
|
||||
head = document.getElementsByTagName('head')[0];
|
||||
head.removeChild(script);
|
||||
newscript = document.createElement('script');
|
||||
newscript.id = "script1";
|
||||
newscript.type = script.type;
|
||||
newscript.src = script.src;
|
||||
head.appendChild(newscript);
|
||||
|
||||
Show();
|
||||
window.setTimeout(renew,1000);
|
||||
xmlhttp.open("GET", url, true);
|
||||
xmlhttp.send();
|
||||
}
|
||||
|
||||
function OnLoad()
|
||||
{
|
||||
window.setTimeout(renew,1000);
|
||||
}
|
||||
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
</head>
|
||||
<body onload="OnLoad()">
|
||||
<table class="maintable" align="center">
|
||||
<colgroup>
|
||||
<col width="182px"/>
|
||||
@@ -75,35 +92,25 @@ function renew()
|
||||
<!-- Begin Content -->
|
||||
|
||||
<table id="tunerstatus" align="center">
|
||||
<tr>
|
||||
<th>
|
||||
Tuner
|
||||
</th>
|
||||
<th>
|
||||
Lock
|
||||
</th>
|
||||
<th>
|
||||
Strength
|
||||
</th>
|
||||
<th>
|
||||
Quality
|
||||
</th>
|
||||
</tr>
|
||||
<script type="text/javascript">
|
||||
for( i = 0; i < TunerList.length ; i++ )
|
||||
{
|
||||
document.write('<tr>');
|
||||
document.write('<td>' + (i+1) + '</td>');
|
||||
document.write('<td id="elStatus'+i+'"> </td>');
|
||||
document.write('<td id="elStrength'+i+'"> </td>');
|
||||
document.write('<td id="elQuality'+i+'"> </td>');
|
||||
document.write('</tr>');
|
||||
}
|
||||
|
||||
Show();
|
||||
window.setTimeout(renew,1000);
|
||||
</script>
|
||||
|
||||
<tr>
|
||||
<th>Tuner</th>
|
||||
<th>Lock</th>
|
||||
<th>Strength</th>
|
||||
<th>SNR</th>
|
||||
<th>Quality</th>
|
||||
</tr>
|
||||
<script type="text/javascript">
|
||||
for( var i = 0; i < 12 ; i++ )
|
||||
{
|
||||
document.write('<tr id="trTuner'+i+'" style="display:none">');
|
||||
document.write('<td>' + (i+1) + '</td>');
|
||||
document.write('<td id="tdStatus'+i+'"> </td>');
|
||||
document.write('<td id="tdStrength'+i+'"> </td>');
|
||||
document.write('<td id="tdSNR'+i+'"> </td>');
|
||||
document.write('<td id="tdQuality'+i+'"> </td>');
|
||||
document.write('</tr>');
|
||||
}
|
||||
</script>
|
||||
</table>
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user