Advertisement
safwan092

form.html

Oct 6th, 2023
14
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.70 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3.  
  4.  
  5. <head>
  6. <base target="_top">
  7.  
  8.  
  9. <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta3/dist/css/bootstrap.min.css" rel="stylesheet"
  10. integrity="sha384-eOJMYsd53ii+scO/bJGFsiCZc+5NDVN2yr8+0RDqr0Ql0h+rP48ckxlpbzKgwra6" crossorigin="anonymous">
  11.  
  12.  
  13. <style>
  14.  
  15.  
  16. body{
  17. background: #eee;
  18. }
  19.  
  20.  
  21. .frame{
  22. box-shadow: 10px 10px 15px rgb(193,182,182), -6px -6px 15px #eee;
  23. padding: 20px;
  24. max-width: 480px;
  25. margin: 40px auto;
  26. margin-top: 50px;
  27. border-radius: 7px;
  28. background: white;
  29. }
  30.  
  31. #centered-table {
  32. margin-left: auto;
  33. margin-right: auto;
  34. }
  35.  
  36. button {
  37. text-transform: uppercase;
  38. transition: transform 80ms ease-in;
  39. border-radius: 7px;
  40. }
  41.  
  42. button:active {
  43. transform: scale(0.95);
  44. color: white
  45. }
  46.  
  47. .btn.focus, .btn:focus {
  48. outline: 0;
  49. box-shadow: none!important;
  50. color: white;
  51. }
  52.  
  53.  
  54. .btn-info:hover {
  55. background-color: gold;
  56. color: white;
  57. border-color: gold;
  58. }
  59.  
  60. .btn-info {color: white;}
  61.  
  62.  
  63. .box {
  64. border: 1px solid rgba(0,0,0,0.2);
  65. padding: 1.5rem;
  66. margin-left:10px;
  67. margin-right:10px;
  68. border-radius: 13px;
  69. margin: auto;
  70. width: 100%;
  71. }
  72.  
  73.  
  74. .inp {
  75. border:none;
  76. border-bottom: 1px solid rgba(0,0,0,0.2);
  77. border-radius: 0px;
  78. padding: 5px 10px;
  79. outline: none;
  80. }
  81.  
  82.  
  83. [placeholder]:focus::-webkit-input-placeholder {
  84. transition: text-indent 0.4s 0.4s ease;
  85. text-indent: -100%;
  86. opacity: 1;
  87. }
  88.  
  89.  
  90. .inp.focus, .inp:focus {
  91. outline: 0;
  92. box-shadow: none!important;
  93. /* color: green; */
  94. border-bottom: 1px solid rgba(0,0,0,0.2);
  95. }
  96.  
  97.  
  98. </style>
  99.  
  100.  
  101. </head>
  102.  
  103.  
  104. <body>
  105.  
  106.  
  107. <div class="container">
  108. <div class="row frame">
  109.  
  110. <h5 class="mt-4 text-center">WebApp ESP32 Google Script</h5>
  111. <h5 id="titles" class="mt-4 text-center"></h5>
  112. <h6 id="sub-titles" class="mb-4 text-center"></h6>
  113.  
  114. <div class="form-group mt-4 mb-4 text-center">
  115. <a id="dynamic-link" href="https://google.com">
  116. <button type="button" class="btn btn-info">GPS Location</button>
  117. </a>
  118. </div>
  119.  
  120. <!-- create form element here -->
  121.  
  122. <div class="form-group mt-4 mb-4 text-center">
  123. <table class="mb-4" id="centered-table">
  124. <tr>
  125. <td style="font-weight: bold" width="135">Temperature</td>
  126. <td width="15">:</td>
  127. <td id="data1"></td>
  128. </tr>
  129. <tr>
  130. <td style="font-weight: bold" >Humidity</td>
  131. <td>:</td>
  132. <td id="data2"></td>
  133. </tr>
  134. <tr>
  135. <td style="font-weight: bold" >Loction</td>
  136. <td>:</td>
  137. <td id="data3"></td>
  138. </tr>
  139. </table>
  140. </div>
  141.  
  142. <!-- create form until element here -->
  143.  
  144.  
  145. <!--div class="form-group mt-4 mb-4 text-center">
  146. <button type="button" class="btn btn-info" onclick="whenButtonClicked()">submit</button>
  147. </div-->
  148.  
  149.  
  150. </div>
  151. </div>
  152.  
  153.  
  154. <script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.9.1/dist/umd/popper.min.js" integrity="sha384-SR1sx49pcuLnqZUnnPwx6FCym0wLsk5JZuNx2bPPENzswTNFaQU1RDvt3wT4gWFG" crossorigin="anonymous"></script>
  155. <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta3/dist/js/bootstrap.min.js" integrity="sha384-j0CNLUeiqtyaRmlzUHCPZ+Gy5fQu0dQ6eZ/xAww941Ai1SxSY+0EQqNXNE6DZiVc" crossorigin="anonymous"></script>
  156.  
  157.  
  158. <script>
  159.  
  160. document.addEventListener('DOMContentLoaded', function(){
  161.  
  162. setInterval(function(){
  163.  
  164. let title = document.getElementById('titles');
  165. let subTitle = document.getElementById('sub-titles');
  166. let d1 = document.getElementById('data1');
  167. let d2 = document.getElementById('data2');
  168. let d3 = document.getElementById('data3');
  169. ////////////////////////////////////////////////////////////////////////////
  170. // Get the HTML element by its ID
  171. var linkElement = document.getElementById("dynamic-link");
  172. ////////////////////////////////////////////////////////////////////////////
  173.  
  174. google.script.run
  175. .withSuccessHandler(data => {
  176. title.innerHTML = data[0];
  177. subTitle.innerHTML = data[1];
  178. d1.innerHTML = data[2];
  179. d2.innerHTML = data[3];
  180. d3.innerHTML = data[4];
  181. var dynamicHref = data[5];
  182. var url = "https://www.google.com/maps/dir/" + encodeURIComponent(dynamicHref);
  183. linkElement.setAttribute("href", url);
  184.  
  185. })
  186. .setAutomatically();
  187.  
  188. }, 500)
  189.  
  190. })
  191.  
  192.  
  193.  
  194.  
  195.  
  196. </script>
  197.  
  198.  
  199. </body>
  200.  
  201.  
  202. </html>
  203.  
  204.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement