diff --git a/htdocs/index.html b/htdocs/index.html index 03d76f2..b6762d9 100644 --- a/htdocs/index.html +++ b/htdocs/index.html @@ -5,192 +5,190 @@ Samsung TVController - - - - -
-
-
- + addEvent(document, "keypress", function (e) { + console.log(e) + + e = e || window.event; + + if (e.key == "w" || e.code == "Numpad8") { + fetch(rootURL + "/up") + .then(function (response) { + return response.json(); + }) + .then(function (data) { + if (data == 1) return console.log("Command: UP - SENT!") + }) + } + + if (e.key == "a" || e.code == "Numpad4") { + fetch(rootURL + "/left") + .then(function (response) { + return response.json(); + }) + .then(function (data) { + if (data == 1) return console.log("Command: LEFT - SENT!") + }) + } + + if (e.key == "s" || e.key == "2") { + fetch(rootURL + "/down") + .then(function (response) { + return response.json(); + }) + .then(function (data) { + if (data == 1) return console.log("Command: DOWN - SENT!") + }) + } + + if (e.key == "d" || e.code == "Numpad6") { + fetch(rootURL + "/right") + .then(function (response) { + return response.json(); + }) + .then(function (data) { + if (data == 1) return console.log("Command: RIGHT - SENT!") + }) + } + + if (e.key == "Enter") { + fetch(rootURL + "/enter" || e.code == "Numpad5") + .then(function (response) { + return response.json(); + }) + .then(function (data) { + if (data == 1) return console.log("Command: ENTER - SENT!") + }) + } + + if (e.key == "x" || e.code == "NumpadDecimal") { + fetch(rootURL + "/back") + .then(function (response) { + return response.json(); + }) + .then(function (data) { + if (data == 1) return console.log("Command: BACK - SENT!") + }) + } + + if (e.key == "p" || e.code == "NumpadAdd") { + fetch(rootURL + "/volumeUp") + .then(function (response) { + return response.json(); + }) + .then(function (data) { + if (data == 1) return console.log("Command: VOL UP - SENT!") + }) + } + + if (e.key == "o" || e.code == "NumpadSubtract") { + fetch(rootURL + "/volumeDown") + .then(function (response) { + return response.json(); + }) + .then(function (data) { + if (data == 1) return console.log("Command: VOL DOWN - SENT!") + }) + } + + if (e.key == "r") { + fetch(rootURL + "/newToken") + .then(function (response) { + return response.json(); + }) + .then(function (data) { + if (data == 1) return console.log("Command: New Token - SENT!") + }) + } + + + if (e.key == "m" || e.code == "Numpad0") { + fetch(rootURL + "/mute") + .then(function (response) { + return response.json(); + }) + .then(function (data) { + if (data == 1) return console.log("Command: MUTE - SENT!") + }) + } + + if (e.key == "l") { + fetch(rootURL + "/pmode") + .then(function (response) { + return response.json(); + }) + .then(function (data) { + if (data == 1) return console.log("Command: PMODE - SENT!") + }) + } + + if (e.key == "h" || e.code == "Numpad5") { + fetch(rootURL + "/home") + .then(function (response) { + return response.json(); + }) + .then(function (data) { + if (data == 1) return console.log("Command: HOME - SENT!") + }) + } + + + }); + } + } else { + document.getElementById("view").innerHTML = "
THE PASSWORD PROVIDED WAS INCORRECT!" + } + }) + + + + +
+
+
+