index.html 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. <html>
  2. <head>
  3. <!-- Tocas UI:CSS 與元件 -->
  4. <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/tocas-ui/2.3.3/tocas.css">
  5. <!-- Tocas JS:模塊與 JavaScript 函式 -->
  6. <script src="https://cdnjs.cloudflare.com/ajax/libs/tocas-ui/2.3.3/tocas.js"></script>
  7. <script
  8. src="https://code.jquery.com/jquery-3.6.0.min.js"
  9. integrity="sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4="
  10. crossorigin="anonymous"></script>
  11. <style>
  12. body{
  13. background-color: #ededed;
  14. }
  15. .leftContainer{
  16. border: 1px solid black;
  17. padding: 5px;
  18. margin: 12px;
  19. height: 250px;
  20. }
  21. .javainput{
  22. -webkit-box-shadow: inset 5px 5px 4px -5px rgba(105,105,105,0.71);
  23. box-shadow: inset 5px 5px 4px -5px rgba(105,105,105,0.71);
  24. font-size: 26px;
  25. padding-top: 4px;
  26. padding-left: 5px;
  27. margin-top: 16px;
  28. font-weight: bold;
  29. }
  30. .double.javainput{
  31. width: 40px;
  32. margin-left: 18px;
  33. }
  34. .single.javainput{
  35. width: 30px;
  36. margin-left: 28px;
  37. }
  38. .javabutton{
  39. background: rgb(229,234,243);
  40. background: linear-gradient(180deg, rgba(229,234,243,1) 0%, rgba(243,249,252,1) 27%, rgba(196,214,231,1) 100%);
  41. padding: 1px;
  42. width: 100px;
  43. margin-top: 6px;
  44. -webkit-box-shadow: inset 5px 5px 4px -5px rgba(105,105,105,0.71);
  45. box-shadow: inset 5px 5px 4px -5px rgba(105,105,105,0.71);
  46. border: 1px solid rgb(175, 175, 175);
  47. font-size: 90%;
  48. font-weight: bold;
  49. text-align: center;
  50. }
  51. .switchFrame{
  52. background: rgb(229,234,243);
  53. background: linear-gradient(180deg, rgba(229,234,243,1) 0%, rgba(243,249,252,1) 27%, rgba(196,214,231,1) 100%);
  54. width: calc(100% - 20px);
  55. height: 220px;
  56. margin-top: 200px;
  57. border: 1px solid rgb(158, 158, 158);
  58. padding: 12px;
  59. padding-top: 25px;
  60. }
  61. .onofftext{
  62. padding-top: 30px;
  63. margin-left: -12px;
  64. font-style: italic;
  65. font-weight: bold;
  66. }
  67. .bulbSwitch{
  68. background: rgb(229,234,243);
  69. background: linear-gradient(180deg, rgba(229,234,243,1) 0%, rgba(243,249,252,1) 27%, rgba(196,214,231,1) 100%);
  70. width: calc(100% - 22px);
  71. margin-top: 30px;
  72. height: 170px;
  73. border: 1px solid rgb(158, 158, 158);
  74. padding-top: 1px;
  75. }
  76. .bulbSwitchOffsetText {
  77. padding-top: 24px;
  78. margin-left: 12px;
  79. font-style: italic;
  80. font-weight: bold;
  81. font-size: 1.1em;
  82. transform: scale(1.2, 1);
  83. }
  84. .bulb{
  85. max-height: 240px;
  86. padding-top: 8px;
  87. padding-right: 12px;
  88. }
  89. .switch{
  90. margin-left: 5px;
  91. margin-top: 5px;
  92. }
  93. </style>
  94. </head>
  95. <body>
  96. <div class="ts grid">
  97. <div class="ten wide column">
  98. <div class="leftContainer">
  99. <div class="ts grid">
  100. <div class="eight wide column">
  101. <img id="bulb0" class="ts image bulb" src="light_off.png">
  102. </div>
  103. <div class="eight wide column">
  104. <div class="bulbSwitch">
  105. <img id="bulb0switch" class="ts image bulb switch" src="switch.png">
  106. <p class="bulbSwitchOffsetText">Switch LAMP...</p>
  107. </div>
  108. </div>
  109. </div>
  110. </div>
  111. <div class="leftContainer">
  112. <div class="ts grid">
  113. <div class="eight wide column">
  114. <img id="bulb1" class="ts image bulb" src="light_off.png">
  115. </div>
  116. <div class="eight wide column">
  117. <div class="bulbSwitch">
  118. <img id="bulb1switch" class="ts image bulb switch" src="switch.png">
  119. <p class="bulbSwitchOffsetText">Switch LAMP...</p>
  120. </div>
  121. </div>
  122. </div>
  123. </div>
  124. </div>
  125. <div class="six wide column">
  126. <div class="switchFrame" align="center">
  127. <img id="power" class="ts image" src="switch.png">
  128. <p class="onofftext">Switch All</p>
  129. </div>
  130. </div>
  131. </div>
  132. <script>
  133. setInterval(function(){
  134. $.get("./getStatus", function(data){
  135. data = JSON.parse(data);
  136. if (data.Lamp0 == true){
  137. $("#bulb0").attr("src", "light_on.png");
  138. }else{
  139. $("#bulb0").attr("src", "light_off.png");
  140. }
  141. if (data.Lamp1 == true){
  142. $("#bulb1").attr("src", "light_on.png");
  143. }else{
  144. $("#bulb1").attr("src", "light_off.png");
  145. }
  146. });
  147. }, 300);
  148. </script>
  149. </body>
  150. </html>