index.html 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. <!doctype html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <meta http-equiv="x-ua-compatible" content="ie=edge">
  6. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  7. <title>goRoku Controller</title>
  8. <!--<link rel="stylesheet" href="static/css/foundation.css">-->
  9. <link rel="stylesheet" href="css/foundation.css">
  10. </head>
  11. <body>
  12. <div class="grid-x">
  13. <h1 id="power" class="large-12 medium-12 small-12 cell text-center">goRoku Controller</h1>
  14. <div class="large-12 medium-12 small-12 cell text-center">
  15. <h3 id="at">TV</h3>
  16. <p>
  17. <button type="button" class="alert button" onclick="sendCommandTV('power')">Power</button> <button type="button" class="alert button" onclick="sendCommandTV('display')">Display</button> <button type="button" class="button" onclick="sendTo('/connect')">Connect</button><br>
  18. <button type="button" class="button" onclick="sendCommandTV('back')">Back</button> <button type="button" class="button" onclick="sendCommandTV('home')">Home</button><br>
  19. <button type="button" class="button" onclick="sendCommandTV('up')">^</button><br>
  20. <button type="button" class="button" onclick="sendCommandTV('left')"><</button> <button type="button" class="success button" onclick="sendCommandTV('ok')">Ok</button> <button type="button" class="button" onclick="sendCommandTV('right')">></button><br>
  21. <button type="button" class="button" onclick="sendCommandTV('down')">V</button><br>
  22. <button type="button" class="button" onclick="sendCommandTV('reload')">🔁</button> <button type="button" class="button" onclick="sendCommandTV('star')">*</button><br>
  23. <button type="button" class="button" onclick="sendCommandTV('rewind')"><<</button> <button type="button" class="button" onclick="sendCommandTV('play-pause')">Play/Pause</button> <button type="button" class="button" onclick="sendCommandTV('fast-forward')">>></button><br>
  24. <button type="button" class="button" onclick="sendCommandTV('vol+')">Vol +</button> <button type="button" class="button" onclick="sendCommandTV('mute')">Vol Mute</button> <button type="button" class="button" onclick="sendCommandTV('vol-')">Vol -</button><br>
  25. <br>
  26. <button type="button" class="button" onclick="sendCommandTV('pluto')">Pluto Tv</button> <br><!--
  27. <button type="button" class="button" onclick="sendCommandTV('pluto-cops')">Cops</button> <button type="button" class="button" onclick="sendCommandTV('pluto-thefirst')">The First</button> <button type="button" class="button" onclick="sendCommandTV('pluto-mst3k')">MST3K</button><br>
  28. <button type="button" class="button" onclick="sendCommandTV('pluto-rifftrax')">Riff Trax</button> <button type="button" class="button" onclick="sendCommandTV('pluto-startrek')">Star Trek</button><br>-->
  29. </p>
  30. </div>
  31. <!-- <div class="large-6 medium-6 small6 cell text-center">
  32. <h3>MOVIE BOX:</h3>
  33. <p>
  34. <button type="button" class="alert button" onclick="sendCommandMB('power')">Power</button><br>
  35. <button type="button" class="button" onclick="sendCommandMB('home')">Home</button> <button type="button" class="button" onclick="sendCommandMB('back')">Back</button><br>
  36. <button type="button" class="button" onclick="sendCommandMB('up')">/\</button><br>
  37. <button type="button" class="button" onclick="sendCommandMB('left')"><</button> <button type="button" class="success button" onclick="sendCommandMB('ok')">Ok</button> <button type="button" class="button" onclick="sendCommandMB('right')">></button><br>
  38. <button type="button" class="button" onclick="sendCommandMB('down')">\/</button><br>
  39. </p>
  40. </div> -->
  41. </div>
  42. <script>
  43. function sendCommandTV(cmd) {
  44. const xhttp = new XMLHttpRequest();
  45. xhttp.onload = function() {
  46. if (cmd == "display") {
  47. const data = JSON.parse(this.responseText);
  48. console.log(data);
  49. document.getElementById("at").innerHTML = data.at;
  50. if (data.power == true) {
  51. document.getElementById("power").innerHTML = "goRoku Controller (ON)";
  52. } else {
  53. document.getElementById("power").innerHTML = "goRoku Controller (OFF)";
  54. }
  55. }
  56. };
  57. xhttp.open("GET", "tv/"+cmd, true);
  58. xhttp.send();
  59. }
  60. function sendTo(cmd) {
  61. location = cmd;
  62. }
  63. /*function sendCommandMB(cmd) {
  64. const xhttp = new XMLHttpRequest();
  65. xhttp.onload = function() {}
  66. xhttp.open("GET", "mb/"+cmd, true);
  67. xhttp.send();
  68. }*/
  69. </script>
  70. </body>
  71. </html>