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.

186 lines
5.1 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. // Init tutorial
  8. tutorial.init = function() {
  9. var prevString = l10n.get("TutoPrev");
  10. var nextString = l10n.get("TutoNext");
  11. var endString = l10n.get("TutoEnd");
  12. var steps = [
  13. {
  14. element: "",
  15. orphan: true,
  16. placement: "bottom",
  17. title: l10n.get("TutoExplainTitle"),
  18. content: l10n.get("TutoExplainContent")
  19. },
  20. {
  21. element: tutorial.getElement("board"),
  22. placement: "right",
  23. title: l10n.get("TutoBoardTitle"),
  24. content: l10n.get("TutoBoardContent")
  25. },
  26. {
  27. element: tutorial.getElement("activity"),
  28. placement: "bottom",
  29. title: l10n.get("TutoActivityTitle"),
  30. content: l10n.get("TutoActivityContent")
  31. },
  32. {
  33. element: tutorial.getElement("node"),
  34. placement: "bottom",
  35. title: l10n.get("TutoNodeTitle"),
  36. content: l10n.get("TutoNodeContent")
  37. },
  38. {
  39. element: tutorial.getElement("link"),
  40. placement: "bottom",
  41. title: l10n.get("TutoLinkTitle"),
  42. content: l10n.get("TutoLinkContent")
  43. },
  44. {
  45. element: tutorial.getElement("remove"),
  46. placement: "bottom",
  47. title: l10n.get("TutoRemoveTitle"),
  48. content: l10n.get("TutoRemoveContent")
  49. },
  50. {
  51. element: tutorial.getElement("undo"),
  52. placement: "bottom",
  53. title: l10n.get("TutoUndoTitle"),
  54. content: l10n.get("TutoUndoContent")
  55. },
  56. {
  57. element: tutorial.getElement("redo"),
  58. placement: "bottom",
  59. title: l10n.get("TutoRedoTitle"),
  60. content: l10n.get("TutoRedoContent")
  61. },
  62. {
  63. element: tutorial.getElement("zoom"),
  64. placement: "bottom",
  65. title: l10n.get("TutoZoomTitle"),
  66. content: l10n.get("TutoZoomContent")
  67. },
  68. {
  69. element: tutorial.getElement("png"),
  70. placement: "bottom",
  71. title: l10n.get("TutoPngTitle"),
  72. content: l10n.get("TutoPngContent")
  73. },
  74. {
  75. element: tutorial.getElement("textvalue"),
  76. placement: "bottom",
  77. title: l10n.get("TutoTextTitle"),
  78. content: l10n.get("TutoTextContent")
  79. },
  80. {
  81. element: tutorial.getElement("foreground"),
  82. placement: "bottom",
  83. title: l10n.get("TutoForegroundTitle"),
  84. content: l10n.get("TutoForegroundContent")
  85. },
  86. {
  87. element: tutorial.getElement("background"),
  88. placement: "bottom",
  89. title: l10n.get("TutoBackgroundTitle"),
  90. content: l10n.get("TutoBackgroundContent")
  91. },
  92. {
  93. element: tutorial.getElement("bold"),
  94. placement: "bottom",
  95. title: l10n.get("TutoBoldTitle"),
  96. content: l10n.get("TutoBoldContent")
  97. },
  98. {
  99. element: tutorial.getElement("italic"),
  100. placement: "bottom",
  101. title: l10n.get("TutoItalicTitle"),
  102. content: l10n.get("TutoItalicContent")
  103. },
  104. {
  105. element: tutorial.getElement("font"),
  106. placement: "bottom",
  107. title: l10n.get("TutoFontTitle"),
  108. content: l10n.get("TutoFontContent")
  109. },
  110. {
  111. element: tutorial.getElement("fontplus"),
  112. placement: "bottom",
  113. title: l10n.get("TutoFontPlusTitle"),
  114. content: l10n.get("TutoFontPlusContent")
  115. },
  116. {
  117. element: tutorial.getElement("fontminus"),
  118. placement: "bottom",
  119. title: l10n.get("TutoFontMinusTitle"),
  120. content: l10n.get("TutoFontMinusContent")
  121. },
  122. {
  123. element: tutorial.getElement("stop"),
  124. placement: "bottom",
  125. title: l10n.get("TutoStopTitle"),
  126. content: l10n.get("TutoStopContent")
  127. },
  128. ];
  129. tour = new Tour({
  130. template: "\
  131. <div class='popover tour'>\
  132. <div class='arrow'></div>\
  133. <h3 class='popover-title tutorial-title'></h3>\
  134. <div class='popover-content'></div>\
  135. <div class='popover-navigation' style='display: flex; flex-wrap:wrap; justify-content: center; align-items: center'>\
  136. <div class='tutorial-prev-icon icon-button' data-role='prev'>\
  137. <div class='tutorial-prev-icon1 web-activity'>\
  138. <div class='tutorial-prev-icon2 web-activity-icon'></div>\
  139. <div class='tutorial-prev-icon3 web-activity-disable'></div>\
  140. </div>\
  141. <div class='icon-tutorial-text'>"+prevString+"</div>\
  142. </div>\
  143. <span data-role='separator' style='margin: 4px'>|</span>\
  144. <div class='tutorial-next-icon icon-button' data-role='next'>\
  145. <div class='tutorial-next-icon1 web-activity'>\
  146. <div class='tutorial-next-icon2 web-activity-icon'></div>\
  147. <div class='tutorial-next-icon3 web-activity-disable'></div>\
  148. </div>\
  149. <div class='icon-tutorial-text'>"+nextString+"</div>\
  150. </div>\
  151. <div class='tutorial-end-icon icon-button' data-role='end'>\
  152. <div class='tutorial-end-icon1 web-activity'>\
  153. <div class='tutorial-end-icon2 web-activity-icon'></div>\
  154. <div class='tutorial-end-icon3 web-activity-disable'></div>\
  155. </div>\
  156. <div class='icon-tutorial-text'>"+endString+"</div>\
  157. </div>\
  158. </div>\
  159. </div>",
  160. storage: false,
  161. backdrop: true,
  162. steps: steps
  163. });
  164. tour.init();
  165. }
  166. // Handle tutorial element id
  167. tutorial.setElement = function(name, id) {
  168. tutorial.elements[name] = id;
  169. }
  170. tutorial.getElement = function(name) {
  171. return tutorial.elements[name];
  172. }
  173. // Start tutorial
  174. tutorial.start = function() {
  175. tutorial.init();
  176. tour.start(true);
  177. };
  178. return tutorial;
  179. });