quicksetup.js 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. /*
  2. Quick Setup Tour
  3. This script file contains all the required script
  4. for quick setup tour and walkthrough
  5. */
  6. //tourStepFactory generate a function that renders the steps in tourModal
  7. //Keys: element, title, desc, tab, zone, callback
  8. // elements -> Elements to focus on
  9. // tab -> Tab ID to switch pages
  10. // pos -> Where to display the tour modal, {topleft, topright, bottomleft, bottomright, center}
  11. function adjustTourModalOverlayToElement(element){
  12. $("#tourModalOverlay").css({
  13. "top": $(element).offset().top,
  14. "left": $(element).offset().left,
  15. "width": $(element).width(),
  16. "height": $(element).height(),
  17. })
  18. }
  19. function tourStepFactory(config){
  20. return function(){
  21. //Check if this step require tab swap
  22. if (config.tab != undefined && config.tab != ""){
  23. //This tour require tab swap. call to openTabById
  24. openTabById(config.tab);
  25. }
  26. if (config.element == undefined){
  27. //No focused element in this step.
  28. $(".tourFocusObject").removeClass("tourFocusObject");
  29. $("#tourModal").addClass("nofocus");
  30. $("#tourModalOverlay").hide();
  31. }else{
  32. //Consists of focus element in this step
  33. $(".tourFocusObject").removeClass("tourFocusObject");
  34. $(config.element).addClass("tourFocusObject");
  35. $("#tourModal").removeClass("nofocus");
  36. //Match the overlay to element position and size
  37. $(window).off("resize").on("resize", function(){
  38. adjustTourModalOverlayToElement(config.element);
  39. })
  40. adjustTourModalOverlayToElement(config.element);
  41. $("#tourModalOverlay").show();
  42. }
  43. //Get the modal location of this step
  44. let showupZone = "center";
  45. if (config.pos != undefined){
  46. showupZone = config.pos
  47. }
  48. $("#tourModal").attr("position", showupZone);
  49. $("#tourModal .tourStepTitle").html(config.title);
  50. $("#tourModal .tourStepContent").html(config.desc);
  51. if (config.callback != undefined){
  52. config.callback();
  53. }
  54. }
  55. }
  56. var tourSteps = {
  57. //Homepage steps
  58. "homepage": [
  59. tourStepFactory({
  60. title: "🎉 Congratulation on your first site!",
  61. desc: "In this tour, you will be guided through the steps required to setup a basic static website using your own domain name with Zoraxy."
  62. }),
  63. tourStepFactory({
  64. title: "Pointing your domain's DNS to Zoraxy's IP",
  65. desc: `Setup a DNS A Record that points your domain name to this Zoraxy instances public IP address. <br>
  66. Assume your public IP is 93.184.215.14, you should have an A record like this.
  67. <table class="ui celled collapsing basic striped table">
  68. <thead>
  69. <tr>
  70. <th>Name</th>
  71. <th>Type</th>
  72. <th>Value</th>
  73. </tr>
  74. </thead>
  75. <tbody>
  76. <tr>
  77. <td>yourdomain.com</td>
  78. <td>A</td>
  79. <td>93.184.215.14</td>
  80. </tr>
  81. </tbody>
  82. </table>
  83. <br>If the IP of Zoraxy start from 192.168, you might want to use your router's public IP address and setup port forward for both port 80 and 443 as well.`,
  84. }),
  85. tourStepFactory({
  86. title: "Setup Default Site",
  87. desc: `If you already have an apache or nginx web server running, use "Reverse Proxy Target". <br>Otherwise, pick "Internal Static Web Server" and click "Apply Change"`,
  88. tab: "setroot",
  89. element: $("#setroot"),
  90. pos: "bottomright"
  91. })
  92. ],
  93. //Subdomains tour steps
  94. "subdomain":[
  95. ],
  96. //TLS and ACME tour steps
  97. "tls":[
  98. ],
  99. }