index.html 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. <html>
  2. <head>
  3. <script src="/lws-common.js"></script>
  4. <script src="lwsgt.js"></script>
  5. <style>
  6. .body { font-size: 12 }
  7. .gstitle { font-size: 24; text-align:center }
  8. .group1 { vertical-align:middle;text-align:center;background:#f0f0e0;
  9. padding:12px; -webkit-border-radius:10px;
  10. -moz-border-radius:10px;border-radius:10px; }
  11. .group2 { vertical-align:middle; font-size: 18;text-align:center;
  12. margin:auto; align:center;
  13. background-color: rgba(255, 255, 255, 0.8); padding:12px;
  14. display:inline-block; -webkit-border-radius:10px;
  15. -moz-border-radius:10px; border-radius:10px; }
  16. .lwsgt_title { font-size: 24; text-align:center }
  17. .lwsgt_breadcrumbs { font-size: 18; text-align:left }
  18. .lwsgt_table { font-size: 14; padding:12px; margin: 12px; align:center }
  19. .lwsgt_hdr { font-size: 18; text-align:center;
  20. background-color: rgba(40, 40, 40, 0.8); color: white }
  21. .lwsgt_tr { padding: 10px }
  22. .lwsgt_td { padding: 3px }
  23. </style>
  24. </head>
  25. <body>
  26. <table>
  27. <tr><td class="gstitle">
  28. LWS Generic Table demo
  29. </td></tr>
  30. <tr><td class="group2">
  31. This is a demo of lws generic table, using a protocol plugin
  32. "protocol-lws-table-dirlisting". It shows a directory listing,
  33. but unlike an oldstyle directory listing done on the
  34. server side with a script, this is static html that connects
  35. back to the server with a websocket, and gets live JSON from
  36. that.
  37. <p>
  38. Actually the static html is extremely simple, since it uses
  39. lwsgt, LWS Generic Table, JS include on the client-side that
  40. handles all the table generation from a template sent in JSON
  41. over the ws link. It means there is no custom JS required
  42. clientside either. It's just CSS, this text and a call to
  43. initialize lwsgt with the appropriate ws protocol.
  44. </td></tr>
  45. <tr><td><div id="lwsgt1" class="group1"></div></td></tr>
  46. <tr><td class="group2">
  47. There's no problem having multiple independent instances per
  48. page...
  49. </td></tr>
  50. <tr><td><div id="lwsgt2" class="group1"></div></td></tr>
  51. </table>
  52. <div id="debug"></div>
  53. <script nonce="lwscaro">
  54. var v1 = new lwsgt_initial("Dir listing demo",
  55. "protocol-lws-table-dirlisting",
  56. "lwsgt1", "lwsgt_dir_click", "v1");
  57. var v2 = new lwsgt_initial("Dir listing 2",
  58. "protocol-lws-table-dirlisting",
  59. "lwsgt2", "lwsgt_dir_click", "v2");
  60. function lwsgt_dir_click(gt, u, col, row)
  61. {
  62. if (u[0] == '=') { /* change directory */
  63. window[gt].lwsgt_ws.send(u.substring(1, u.length));
  64. return;
  65. }
  66. var win = window.open(u, '_blank');
  67. win.focus();
  68. }
  69. </script>
  70. </body>
  71. </html>