web: controls use external utils.js

Using external javascript makes things easier to read and work with.
This commit is contained in:
Bryan Schumaker 2010-12-27 13:01:00 -05:00
parent 7455b408e6
commit f90c387652
1 changed files with 4 additions and 18 deletions

View File

@ -1,21 +1,7 @@
<html>
<head>
<script type="text/javascript" src="utils.js"></script>
<script type="text/javascript">
function set_attr(attr)
{
var req = new XMLHttpRequest();
req.onreadystatechange=function()
{
if (req.readyState == 4 && req.status == 200)
{
document.getElementById(attr).innerHTML = req.responseText;
}
}
req.open('GET', "controls.py?a=" + attr, true)
req.send()
setTimeout("set_attr(\"" + attr + "\")", 3000)
}
function do_request(action)
{
var http = new XMLHttpRequest();
@ -89,9 +75,9 @@ function next()
</body>
<script type="text/javascript">
set_attr("title");
set_attr("artist");
set_attr("album");
set_attr("title", "title");
set_attr("artist", "artist");
set_attr("album", "album");
</script>
</html>