VM暫存
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

163 行
4.6KB

  1. <!DOCTYPE html>
  2. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  3. <meta http-equiv="Cache-control" content="no-cache">
  4. <style>
  5. body{background-color:black;font-family:Microsoft JhengHei;overflow:hidden;}
  6. table{width:100%;text-align:center;}
  7. .line_1 /* 第一行 */
  8. {
  9. font-size:300px;
  10. font-family:微軟正黑體;
  11. font-weight:bolder;
  12. color:red;
  13. }
  14. .line_2 /* 第二行 */
  15. {
  16. width:15%;
  17. font-family:微軟正黑體;
  18. font-size:280px;
  19. color:greenyellow;
  20. text-align:center;
  21. font-weight:bolder;
  22. }
  23. </style>
  24. <script src="http://code.jquery.com/jquery-2.1.4.js"></script>
  25. <script>
  26. var vip_no="<?=$vip_no?>",
  27. clientid ="<?php echo uniqid();?>",
  28. mqtt_ip="<?=$mqtt_ip?>";
  29. </script>
  30. <html>
  31. <head>
  32. <title>VIP車位</title>
  33. </head>
  34. <body>
  35. <!-- 閒置時間, 顯示: 公務專用 請勿佔用 -->
  36. <!--div id="no_parking" class="vip_notice" style="display:none;"-->
  37. <div id="no_parking" class="vip_notice">
  38. <table style="border:0px;" cellpadding='0' bolder="0">
  39. <tr>
  40. <td class="line_1" align="center" style="font-size:200px;">光興國小地下停車場</td>
  41. </tr>
  42. <tr>
  43. <td class="line_2"><br /><marquee direction="left" scrollamount="40" style="font-size:300px;">歡迎光臨</marquee></td>
  44. </tr>
  45. </table>
  46. </div>
  47. <!-- 指示VIP停此, 顯示: 車號 向下指 -->
  48. <div id="vip_here" class="vip_notice" style="background-color:white;display:none;">
  49. <!--div id="vip_here" class="vip_notice" style="background-color:white;"-->
  50. <table style="border:0px;" cellpadding='0' bolder="0">
  51. <tr>
  52. <td id="park_lpr" class="line_1" align="center">貴賓請停此</td>
  53. </tr>
  54. <tr>
  55. <table>
  56. <tr>
  57. <td></td>
  58. <td class="line_2" align="center">
  59. <marquee direction="down" scrollamount="40">
  60. <img src="/vip_parked/down_arrow.png" height="510"/>
  61. </marquee>
  62. </td>
  63. <td></td>
  64. </tr>
  65. </table>
  66. </tr>
  67. </table>
  68. </div>
  69. <!-- VIP停車時, 顯示: 車號 貴賓車位 -->
  70. <div id="vip_parked" class="vip_notice" style="display:none;">
  71. <table style="border:0px;" cellpadding='0' bolder="0">
  72. <tr>
  73. <td class="line_1" align="center">公務專用</td>
  74. </tr>
  75. <tr>
  76. <td class="line_2">貴賓車位</td>
  77. </tr>
  78. </table>
  79. </div>
  80. <!-- 一般車停車時, 顯示: 車號 歡迎停用 -->
  81. <div id="someone_parked" class="vip_notice" style="display:none;">
  82. <table style="border:0px;" cellpadding='0' bolder="0">
  83. <tr>
  84. <td class="line_1" align="center">一般車輛</td>
  85. </tr>
  86. <tr>
  87. <td class="line_2">歡迎光臨</td>
  88. </tr>
  89. </table>
  90. </div>
  91. </body>
  92. <script src="/libs/js/moment.min.js"></script>
  93. <script src="/libs/js/mqttws.min.js"></script>
  94. <script>
  95. var client = new Paho.MQTT.Client(mqtt_ip, 8000, clientid);
  96. // set callback handlers
  97. client.onConnectionLost = onConnectionLost;
  98. client.onMessageArrived = onMessageArrived;
  99. client.connect({onSuccess:onConnect});
  100. // called when the client connects
  101. function onConnect()
  102. {
  103. // Once a connection has been made, make a subscription and send a message.
  104. console.log("onConnect|"+mqtt_ip+"|"+clientid+"|"+"welcome_"+vip_no);
  105. client.subscribe("vip_"+vip_no, 2);
  106. }
  107. // called when the client loses its connection
  108. function onConnectionLost(responseObject)
  109. {
  110. if (responseObject.errorCode !== 0)
  111. {
  112. console.log("onConnectionLost:"+responseObject.errorMessage);
  113. }
  114. }
  115. // called when a message arrives
  116. function onMessageArrived(message)
  117. {
  118. console.log("onMessageArrived:"+message.payloadString);
  119. $(".vip_notice").hide();
  120. lpr = message.payloadString == "movie" ? "<div style='font-size:260px;'>歡迎都教授蒞臨</div>" : message.payloadString;
  121. // lpr = decodeURIComponent(message.payloadString);
  122. // $("#park_lpr").text(lpr+"請停此位");
  123. // $("#park_lpr").text(lpr);
  124. $("#park_lpr").html(lpr);
  125. $("#vip_here").show();
  126. // 30秒恢復原畫面
  127. vip_start = setTimeout(function()
  128. {
  129. $(".vip_notice").hide();
  130. $("#no_parking").show();
  131. clearTimeout(vip_start);
  132. }, 30000);
  133. }
  134. $(document).ready(function()
  135. {
  136. // 如果畫面沒動作, 自動更新頁面
  137. var reloadTimeMillis = 600000; // 每 10 min 自動重新載入頁面
  138. var checkReloadTimeMillis = 10000; // 每 10 sec 判斷一次
  139. // 如果畫面沒動作, 每10分鐘自動重新載入頁面
  140. var aliveTime = moment();
  141. $(document.body).bind("mousemove keypress", function(e) {
  142. aliveTime = moment();
  143. });
  144. function refresh() {
  145. if(moment() - aliveTime >= reloadTimeMillis)
  146. window.location.reload(true);
  147. else
  148. setTimeout(refresh, checkReloadTimeMillis);
  149. }
  150. setTimeout(refresh, checkReloadTimeMillis);
  151. });
  152. </script>
  153. </html>