yWeb: signalize standby-mode in status-button's color; thx to fred_feuerstein

Origin commit data
------------------
Branch: ni/coolstream
Commit: e4f29657ce
Author: vanhofen <vanhofen@gmx.de>
Date: 2017-10-16 (Mon, 16 Oct 2017)

Origin message was:
------------------
- yWeb: signalize standby-mode in status-button's color; thx to fred_feuerstein

------------------
No further description and justification available within origin commit message!

------------------
This commit was generated by Migit
This commit is contained in:
vanhofen
2017-10-16 12:03:02 +02:00
parent a5478f7798
commit e2e32e8427

View File

@@ -15,10 +15,24 @@ function goUrl(_url){
} }
$("out").update(res); $("out").update(res);
} }
function set_btn_standby(){
var res = trim(loadSyncURL("/control/standby"));
var color = "red";
switch(res){
case "off": color = "green"; break;
}
$("btn_standby").setStyle({borderColor: color});
}
function standby(_standby){ function standby(_standby){
var _cec = (document.getElementById('checkCEC').checked == true) ? "on" : "off"; var _cec = (document.getElementById('checkCEC').checked == true) ? "on" : "off";
goUrl("/control/standby?"+_standby+"&cec="+_cec); goUrl("/control/standby?"+_standby+"&cec="+_cec);
} }
function init() {
set_btn_standby();
}
function get_data() {
set_btn_standby();
}
//]]> //]]>
</script> </script>
</head> </head>
@@ -38,7 +52,7 @@ function standby(_standby){
<td> <td>
<input type="button" value="{=L:on=}" onclick='standby("on");'/> <input type="button" value="{=L:on=}" onclick='standby("on");'/>
<input type="button" value="{=L:off=}" onclick='standby("off");'/> <input type="button" value="{=L:off=}" onclick='standby("off");'/>
<input type="button" value="{=L:bc.control.status=}" onclick='goUrl("/control/standby");'/> <input type="button" value="{=L:bc.control.status=}" onclick='goUrl("/control/standby");' id="btn_standby"/>
CEC: <input id="checkCEC" name="checkCEC" type="checkbox" checked="checked"/> CEC: <input id="checkCEC" name="checkCEC" type="checkbox" checked="checked"/>
</td> </td>
</tr> </tr>
@@ -91,5 +105,10 @@ function standby(_standby){
<div id="out"></div> <div id="out"></div>
</div> </div>
</div> </div>
<script type="text/javascript">
//<![CDATA[
init();
window.setInterval("get_data();",5000);
//]]>
</body> </body>
</html> </html>