index.html 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
  5. <link rel="icon" type="image/png" href="/favicon.png">
  6. <!-- HTML Meta Tags -->
  7. <title>Homepage | WebStick</title>
  8. <meta name="description" content="A tiny web server powered by ESP8266, designed by tobychui">
  9. <meta name="viewport" content="width=device-width, initial-scale=1" >
  10. <!-- Facebook Meta Tags -->
  11. <meta property="og:url" content="https://imuslab.com">
  12. <meta property="og:type" content="website">
  13. <meta property="og:title" content="Welcome to WebStick!">
  14. <meta property="og:description" content="A tiny web server powered by ESP8266, designed by tobychui">
  15. <meta property="og:image" content=" ">
  16. <!-- Twitter Meta Tags -->
  17. <meta name="twitter:card" content="summary_large_image">
  18. <meta property="twitter:domain" content="imuslab.com">
  19. <meta property="twitter:url" content="https://imuslab.com">
  20. <meta name="twitter:title" content="Welcome to WebStick!">
  21. <meta name="twitter:description" content="A tiny web server powered by ESP8266, designed by tobychui">
  22. <meta name="twitter:image" content=" ">
  23. <!-- CDN -->
  24. <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
  25. <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/tocas-ui/5.0.2/tocas.min.css">
  26. <script src="https://cdnjs.cloudflare.com/ajax/libs/tocas-ui/5.0.2/tocas.min.js"></script>
  27. <link rel="preconnect" href="https://fonts.googleapis.com">
  28. <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
  29. <link href="https://fonts.googleapis.com/css2?family=Noto+Sans+TC:wght@400;500;700&display=swap" rel="stylesheet">
  30. <style>
  31. #banner{
  32. background: linear-gradient(48deg, rgba(108,172,255,1) 8%, rgba(141,235,255,1) 65%)
  33. }
  34. </style>
  35. </head>
  36. <body>
  37. <div class="ts-content">
  38. <div class="ts-tab is-segmented">
  39. <a class="item is-active" data-tab="home">Home</a>
  40. <a class="item" data-tab="about">About</a>
  41. <a class="item" data-tab="posts">Posts</a>
  42. <a class="item" data-tab="qr">QR</a>
  43. </div>
  44. <div class="has-top-spaced-small"></div>
  45. <div class="ts-content " id="home">
  46. <div id="banner" class="ts-content is-rounded is-padded has-top-spaced-large" style=" color: var(--ts-gray-50)">
  47. <div style="max-width: 300px">
  48. <div id="site-title" class="ts-header is-huge is-heavy">WebStick</div>
  49. <p id="site-description">A personal web server hosted on an ESP8266 using a micro SD card</p>
  50. <a href="/admin" class="ts-button is-outlined" style="color: var(--ts-gray-50)">Login</a>
  51. </div>
  52. </div>
  53. <!-- Contact Information, change these to yours -->
  54. <div id="contacts_icon" class="ts-content is-center-aligned has-top-spaced-large">
  55. <a href="https://www.youtube.com/channel/UCzbcGOZHO2BH-ANX7W0MGIg"><span class="ts-icon is-huge is-youtube-icon"></span></a>
  56. <a class="has-start-spaced-large" href="https://blog.imuslab.com"><span class="ts-icon is-huge is-newspaper-icon"></span></a>
  57. <a class="has-start-spaced-large" href="mailto:[email protected]"><span class="ts-icon is-huge is-envelope-icon"></span></a>
  58. <a class="has-start-spaced-large" href="https://github.com/tobychui/webstick"><span class="ts-icon is-huge is-code-icon"></span></a>
  59. </div>
  60. </div>
  61. <div class="ts-content" id="about">
  62. <!-- Dynmaically loaded by ajax from about.html -->
  63. </div>
  64. <div class="ts-content" id="posts">
  65. <!-- Dynmaically loaded by ajax from post.html -->
  66. </div>
  67. <div class="ts-content" id="qr">
  68. <!-- An iframe will be append here for the QR code generator -->
  69. </div>
  70. <div class="ts-divider"></div>
  71. <div class="ts-content">
  72. <p class="ts-text">This site is hosted on a WebStick designed by <a href="https://imuslab.com" target="_blank">tobychui</a></p>
  73. </div>
  74. </div>
  75. <script>
  76. /* Ajax load of the pages */
  77. $("#about").load("about.html");
  78. $("#posts").load("posts.html");
  79. $("#qr").html('<iframe src="tool/qr.html" style="border: none; width: 100%; height: calc(100vh - 200px);"></iframe>');
  80. /* Load the site info from pref */
  81. function loadValue(key, callback){
  82. $.get("/api/pref/get?key=" + key, function(data){
  83. callback(data);
  84. });
  85. }
  86. function initSiteInfo(){
  87. var defaultSettings = {
  88. siteTitle: "WebStick",
  89. siteDescription: "A personal web server hosted on an ESP8266 using a micro SD card"
  90. };
  91. //Initiate the settings form with current values
  92. loadValue("site-info", function(data){
  93. if (data.error != undefined || data == ""){
  94. data = defaultSettings;
  95. }else{
  96. data = JSON.parse(decodeURIComponent(data));
  97. }
  98. console.log(data);
  99. $("#site-title").text(data.siteTitle);
  100. $("#site-description").text(data.siteDescription);
  101. });
  102. }
  103. initSiteInfo();
  104. </script>
  105. </body>
  106. </html>