not really known
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

172 lines
4.7 KiB

  1. // Tutorial handling
  2. define(["webL10n", "activity/activity"], function () {
  3. var tutorial = {};
  4. var tour;
  5. var l10n = l10n_s;
  6. tutorial.elements = [];
  7. tutorial.tourInit = 1;
  8. tutorial.tourStandard = 2;
  9. // Init tutorial
  10. tutorial.init = function(tourType) {
  11. var prevString = l10n.get("TutoPrev");
  12. var nextString = l10n.get("TutoNext");
  13. var endString = l10n.get("TutoEnd");
  14. var steps;
  15. if (tourType == tutorial.tourInit) {
  16. steps = [
  17. {
  18. reflex: "click",
  19. element: tutorial.getElement("activity"),
  20. placement: "bottom",
  21. title: l10n.get("TutoActivityTitle"),
  22. content: l10n.get("TutoActivityContent")
  23. },
  24. {
  25. element: tutorial.getElement("title"),
  26. placement: "right",
  27. title: l10n.get("TutoTitleTitle"),
  28. content: l10n.get("TutoTitleContent")
  29. },
  30. {
  31. reflex: "click",
  32. element: tutorial.getElement("network"),
  33. placement: "bottom",
  34. title: l10n.get("TutoNetworkTitle"),
  35. content: l10n.get("TutoNetworkContent")
  36. },
  37. {
  38. element: tutorial.getElement("shared"),
  39. placement: "right",
  40. title: l10n.get("TutoSharedTitle"),
  41. content: l10n.get("TutoSharedContent")
  42. },
  43. {
  44. element: tutorial.getElement("help"),
  45. placement: "bottom",
  46. title: l10n.get("TutoHelpTitle"),
  47. content: l10n.get("TutoHelpContent")
  48. },
  49. {
  50. element: tutorial.getElement("stop"),
  51. placement: "bottom",
  52. title: l10n.get("TutoStopTitle"),
  53. content: l10n.get("TutoStopContent")
  54. },
  55. ];
  56. } else {
  57. steps = [
  58. {
  59. element: "",
  60. orphan: true,
  61. placement: "bottom",
  62. title: l10n.get("TutoExplainTitle"),
  63. content: l10n.get("TutoExplainContent")
  64. },
  65. {
  66. element: tutorial.getElement("node"),
  67. placement: "right",
  68. title: l10n.get("TutoNodeTitle"),
  69. content: l10n.get("TutoNodeContent")
  70. },
  71. {
  72. element: tutorial.getElement("color"),
  73. placement: "bottom",
  74. title: l10n.get("TutoColorTitle"),
  75. content: l10n.get("TutoColorContent")
  76. },
  77. {
  78. element: tutorial.getElement("add"),
  79. placement: "bottom",
  80. title: l10n.get("TutoAddTitle"),
  81. content: l10n.get("TutoAddContent")
  82. },
  83. {
  84. element: tutorial.getElement("remove"),
  85. placement: "bottom",
  86. title: l10n.get("TutoRemoveTitle"),
  87. content: l10n.get("TutoRemoveContent")
  88. },
  89. {
  90. element: tutorial.getElement("undo"),
  91. placement: "bottom",
  92. title: l10n.get("TutoUndoTitle"),
  93. content: l10n.get("TutoUndoContent")
  94. },
  95. {
  96. element: tutorial.getElement("redo"),
  97. placement: "bottom",
  98. title: l10n.get("TutoRedoTitle"),
  99. content: l10n.get("TutoRedoContent")
  100. },
  101. {
  102. element: tutorial.getElement("zoom"),
  103. placement: "bottom",
  104. title: l10n.get("TutoZoomTitle"),
  105. content: l10n.get("TutoZoomContent")
  106. },
  107. {
  108. element: tutorial.getElement("png"),
  109. placement: "bottom",
  110. title: l10n.get("TutoPngTitle"),
  111. content: l10n.get("TutoPngContent")
  112. },
  113. ];
  114. }
  115. tour = new Tour({
  116. template: "\
  117. <div class='popover tour'>\
  118. <div class='arrow'></div>\
  119. <h3 class='popover-title tutorial-title'></h3>\
  120. <div class='popover-content'></div>\
  121. <div class='popover-navigation' style='display: flex; flex-wrap:wrap; justify-content: center; align-items: center'>\
  122. <div class='tutorial-prev-icon icon-button' data-role='prev'>\
  123. <div class='tutorial-prev-icon1 web-activity'>\
  124. <div class='tutorial-prev-icon2 web-activity-icon'></div>\
  125. <div class='tutorial-prev-icon3 web-activity-disable'></div>\
  126. </div>\
  127. <div class='icon-tutorial-text'>"+prevString+"</div>\
  128. </div>\
  129. <span data-role='separator' style='margin: 4px'>|</span>\
  130. <div class='tutorial-next-icon icon-button' data-role='next'>\
  131. <div class='tutorial-next-icon1 web-activity'>\
  132. <div class='tutorial-next-icon2 web-activity-icon'></div>\
  133. <div class='tutorial-next-icon3 web-activity-disable'></div>\
  134. </div>\
  135. <div class='icon-tutorial-text'>"+nextString+"</div>\
  136. </div>\
  137. <div class='tutorial-end-icon icon-button' data-role='end'>\
  138. <div class='tutorial-end-icon1 web-activity'>\
  139. <div class='tutorial-end-icon2 web-activity-icon'></div>\
  140. <div class='tutorial-end-icon3 web-activity-disable'></div>\
  141. </div>\
  142. <div class='icon-tutorial-text'>"+endString+"</div>\
  143. </div>\
  144. </div>\
  145. </div>",
  146. storage: false,
  147. backdrop: true,
  148. steps: steps
  149. });
  150. tour.init();
  151. }
  152. // Handle tutorial element id
  153. tutorial.setElement = function(name, id) {
  154. tutorial.elements[name] = id;
  155. }
  156. tutorial.getElement = function(name) {
  157. return tutorial.elements[name];
  158. }
  159. // Start tutorial
  160. tutorial.start = function(tourType) {
  161. tutorial.init(tourType);
  162. tour.start(true);
  163. };
  164. return tutorial;
  165. });