From 9d60afe1fb8d90ba99c5f31d029e84ef5360c618 Mon Sep 17 00:00:00 2001 From: Thomas Kolb Date: Mon, 16 Dec 2019 22:12:09 +0100 Subject: [PATCH] htdocs: change animation from the index page --- data/htdocs/anim.js | 30 ++++++++++++++++++++++++++++++ data/htdocs/index.html | 38 +++++++++++++++++++++++++++++++++----- 2 files changed, 63 insertions(+), 5 deletions(-) create mode 100644 data/htdocs/anim.js diff --git a/data/htdocs/anim.js b/data/htdocs/anim.js new file mode 100644 index 0000000..65bb43d --- /dev/null +++ b/data/htdocs/anim.js @@ -0,0 +1,30 @@ +function callURL(url) +{ + var xmlhttp = new XMLHttpRequest(); + xmlhttp.open("GET", url, true); + xmlhttp.send(); +} + +function getjson(url, handler_func) +{ + var xmlhttp = new XMLHttpRequest(); + xmlhttp.onreadystatechange = function () { + if(this.readyState == 4 && this.status == 200) { + var data = JSON.parse(this.responseText); + handler_func(data); + } + } + + xmlhttp.open("GET", url, true); + xmlhttp.send(); +} + +function getAnimList(handler_func) +{ + return getjson("/api/listanim", handler_func); +} + +function setAnim(id) +{ + callURL("/api/setanim?anim=" + id); +} diff --git a/data/htdocs/index.html b/data/htdocs/index.html index 59a8195..483fe57 100644 --- a/data/htdocs/index.html +++ b/data/htdocs/index.html @@ -1,10 +1,38 @@ - Lampensteuerung + + Lampensteuerung + + - -

Lampensteuerung

-

It works!

+ +

Lampensteuerung

+
+

+ + + +

+
- \ No newline at end of file +