max80_webcontent.h 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. #ifndef __ABC80_WEBCONTENT_H
  2. #define __ABC80_WEBCONTENT_H
  3. #include <ArduinoOTA.h>
  4. const char rgbtohdmi[] PROGMEM = R"rawliteral(
  5. <!DOCTYPE HTML><html>
  6. <head>
  7. <title>MAX80 keyboard controller</title>
  8. <meta name="viewport" content="width=device-width, initial-scale=1">
  9. <link rel="icon" href="data:,">
  10. <style>
  11. html {
  12. font-family: Arial, Helvetica, sans-serif;
  13. text-align: center;
  14. }
  15. h1 {
  16. font-size: 1.8rem;
  17. color: white;
  18. }
  19. h2{
  20. font-size: 1.5rem;
  21. font-weight: bold;
  22. color: #143642;
  23. }
  24. .topnav {
  25. overflow: hidden;
  26. background-color: #143642;
  27. }
  28. body {
  29. margin: 0;
  30. }
  31. .content {
  32. padding: 30px;
  33. max-width: 600px;
  34. margin: 0 auto;
  35. }
  36. .card {
  37. background-color: #F8F7F9;;
  38. box-shadow: 2px 2px 12px 1px rgba(140,140,140,.5);
  39. padding-top:10px;
  40. padding-bottom:20px;
  41. }
  42. .button {
  43. padding: 15px 50px;
  44. width: 400px;
  45. font-size: 24px;
  46. text-align: center;
  47. outline: none;
  48. color: #fff;
  49. background-color: #0f8b8d;
  50. border: none;
  51. border-radius: 5px;
  52. -webkit-touch-callout: none;
  53. -webkit-user-select: none;
  54. -khtml-user-select: none;
  55. -moz-user-select: none;
  56. -ms-user-select: none;
  57. user-select: none;
  58. -webkit-tap-highlight-color: rgba(0,0,0,0);
  59. }
  60. /*.button:hover {background-color: #0f8b8d}*/
  61. .button:active {
  62. background-color: #0f8b8d;
  63. box-shadow: 2 2px #CDCDCD;
  64. transform: translateY(2px);
  65. }
  66. .state {
  67. font-size: 1.5rem;
  68. color:#8c8c8c;
  69. font-weight: bold;
  70. }
  71. </style>
  72. <title>ABC800 Keyboard RGBtoHDMI</title>
  73. <meta name="viewport" content="width=device-width, initial-scale=1">
  74. <link rel="icon" href="data:,">
  75. </head>
  76. <body>
  77. <div class="topnav">
  78. <h1>ABC800 Keyboard RGBtoHDMI</h1>
  79. </div>
  80. <div class="content">
  81. <div class="card">
  82. <h2>RGBtoHDMI</h2>
  83. <p><button id="button_menu" class="button">Menu</button></p>
  84. <p><button id="button_up" class="button">Up / Genlock</button></p>
  85. <p><button id="button_down" class="button">Down / Screen Capture</button></p>
  86. </div>
  87. </div>
  88. <script>
  89. var gateway = `ws://${window.location.hostname}/ws`;
  90. var websocket;
  91. window.addEventListener('load', onLoad);
  92. function initWebSocket() {
  93. console.log('Trying to open a WebSocket connection...');
  94. websocket = new WebSocket(gateway);
  95. websocket.onopen = onOpen;
  96. websocket.onclose = onClose;
  97. websocket.onmessage = onMessage; // <-- add this line
  98. }
  99. function onOpen(event) {
  100. console.log('Connection opened');
  101. }
  102. function onClose(event) {
  103. console.log('Connection closed');
  104. setTimeout(initWebSocket, 2000);
  105. }
  106. function onMessage(event) {
  107. var state;
  108. if (event.data == "1"){
  109. state = "ON";
  110. }
  111. else{
  112. state = "OFF";
  113. }
  114. document.getElementById('state').innerHTML = state;
  115. }
  116. function onLoad(event) {
  117. initWebSocket();
  118. initButton();
  119. }
  120. function initButton() {
  121. document.getElementById('button_menu').addEventListener('click', button_menu);
  122. document.getElementById('button_up').addEventListener('click', button_up);
  123. document.getElementById('button_down').addEventListener('click', button_down);
  124. }
  125. function button_menu(){
  126. websocket.send('button_menu');
  127. }
  128. function button_up(){
  129. websocket.send('button_up');
  130. }
  131. function button_down(){
  132. websocket.send('button_down');
  133. }
  134. </script>
  135. </body>
  136. </html>)rawliteral";
  137. const char fbuttons_html[] PROGMEM = R"rawliteral(<!DOCTYPE HTML><html><head>
  138. <title>KEY80 Input Form</title>
  139. <meta name="viewport" content="width=device-width, initial-scale=1">
  140. </head><body>
  141. <form action="/fbuttonsget">
  142. F1: <textarea name="input1" rows="15" cols="60"></textarea>
  143. <input type="submit" value="Submit">
  144. </form><br>
  145. <form action="/fbuttonsget">
  146. F2: <textarea name="input2" rows="15" cols="60"></textarea>
  147. <input type="submit" value="Submit">
  148. </form><br>
  149. <form action="/fbuttonsget">
  150. F3: <textarea name="input3" rows="15" cols="60"></textarea>
  151. <input type="submit" value="Submit">
  152. </form><br>
  153. </body></html>)rawliteral";
  154. #endif