dht11.std.hd.com.imuslab.php 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. <html>
  2. <head>
  3. <title>relay_std_driver</title>
  4. <link rel="stylesheet" href="basic/tocas.css">
  5. <script src="basic/jquery.min.js"></script>
  6. <style>
  7. #button{
  8. background-color:#262626;
  9. }
  10. .center{
  11. display: block;
  12. margin-left: auto;
  13. margin-right: auto;
  14. width: 40%;
  15. top:30%;
  16. }
  17. </style>
  18. </head>
  19. <body style="background-color:#00cccc;">
  20. <div id="ipv4" style="position:fixed;top:3px;left:3px;z-index:10;color:white;"><?php echo $_GET['ip'];?></div>
  21. <div style="width:100%;height:100%;position:fixed;left:20px;top:20px;padding-left:10px;">
  22. <br>
  23. <div class="ts horizontal statistics">
  24. <div class="statistic">
  25. <div id="temp" class="value" style="color:white;">init</div>
  26. <div class="label" style="color:white;">°C</div>
  27. </div>
  28. <div class="statistic">
  29. <div id="hum" class="value" style="color:white;">init</div>
  30. <div class="label" style="color:white;">%</div>
  31. </div>
  32. </div>
  33. <img id="icon" class="center" src="" style="display:none;"></img>
  34. </div>
  35. <div id="uuid" style="position:fixed;bottom:3px;left:3px;color:white;"></div>
  36. <script>
  37. status();
  38. setInterval(status,5000);
  39. uuid();
  40. function status(){
  41. $.ajax({url: "http://<?php echo $_GET['ip'];?>/status",
  42. success: function(result){
  43. $("#temp").text(result.temp);
  44. $("#hum").text(result.humi);
  45. }});
  46. }
  47. function off(){
  48. $.ajax({url: "http://<?php echo $_GET['ip'];?>/off", success: function(result){
  49. status();
  50. }});
  51. }
  52. function on(){
  53. $.ajax({url: "http://<?php echo $_GET['ip'];?>/on", success: function(result){
  54. status();
  55. }});
  56. }
  57. function uuid(){
  58. $.ajax({url: "http://<?php echo $_GET['ip'];?>/uuid", success: function(result){
  59. $("#uuid").text(result);
  60. getNickName();
  61. }});
  62. }
  63. function getNickName(){
  64. $.ajax({url: "../nicknameman.php?uuid=" + $("#uuid").text().trim(), success: function(result){
  65. if (result.includes("ERROR") == false){
  66. $("#uuid").text(result);
  67. getIcon();
  68. }else{
  69. }
  70. }});
  71. }
  72. function getIcon(){
  73. $.ajax({url: "../nicknameman.php?nickname=" + $("#uuid").text().trim(), success: function(result){
  74. if (result.includes("true") == true){
  75. $("#icon").attr('src','../img/icons/'+ $("#uuid").text().trim() +'.png');
  76. $("#icon").show();
  77. }
  78. }});
  79. }
  80. </script>
  81. </body>
  82. </html>