launcher_tour.html 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. <script defer language="javascript">
  2. var a = [{
  3. id: 'tour-welcome',
  4. title: '<bx_text_js:_sys_tour_launcher_welcome_title />',
  5. text: '<bx_text_js:_sys_tour_launcher_welcome_txt />'
  6. },{
  7. id: 'tour-apps',
  8. title: '<bx_text_js:_sys_tour_launcher_apps_title />',
  9. text: '<bx_text_js:_sys_tour_launcher_apps_txt />',
  10. sel: {element:$('.bx-std-widgets').get(0), on:'bottom'}
  11. },{
  12. id: 'tour-designer',
  13. title: '<bx_text_js:_sys_tour_launcher_designer_title />',
  14. text: '<bx_text_js:_sys_tour_launcher_designer_txt />',
  15. sel: {element:$('.bx-std-widget-cont:has(.bx-std-widget-link[href*=designer])').get(0), on:'bottom'}
  16. },{
  17. id: 'tour-dashboard',
  18. title: '<bx_text_js:_sys_tour_launcher_dashboard_title />',
  19. text: '<bx_text_js:_sys_tour_launcher_dashboard_txt />',
  20. sel: {element:$('.bx-std-widget-cont:has(.bx-std-widget-link[href*=dashboard])').get(0), on:'bottom'}
  21. },{
  22. id: 'tour-builder_page',
  23. title: '<bx_text_js:_sys_tour_launcher_builder_page_title />',
  24. text: '<bx_text_js:_sys_tour_launcher_builder_page_txt />',
  25. sel: {element:$('.bx-std-widget-cont:has(.bx-std-widget-link[href*=builder_page])').get(0), on:'bottom'}
  26. },{
  27. id: 'tour-builder_permission',
  28. title: '<bx_text_js:_sys_tour_launcher_builder_permissions_title />',
  29. text: '<bx_text_js:_sys_tour_launcher_builder_permissions_txt />',
  30. sel: {element:$('.bx-std-widget-cont:has(.bx-std-widget-link[href*=builder_permission])').get(0), on:'bottom'}
  31. },{
  32. id: 'tour-builder_forms',
  33. title: '<bx_text_js:_sys_tour_launcher_builder_forms_title />',
  34. text: '<bx_text_js:_sys_tour_launcher_builder_forms_txt />',
  35. sel: {element:$('.bx-std-widget-cont:has(.bx-std-widget-link[href*=builder_forms])').get(0), on:'bottom'}
  36. },{
  37. id: 'tour-builder_menu',
  38. title: '<bx_text_js:_sys_tour_launcher_builder_menus_title />',
  39. text: '<bx_text_js:_sys_tour_launcher_builder_menus_txt />',
  40. sel: {element:$('.bx-std-widget-cont:has(.bx-std-widget-link[href*=builder_menu])').get(0), on:'bottom'}
  41. },{
  42. id: 'tour-polyglot',
  43. title: '<bx_text_js:_sys_tour_launcher_polyglot_title />',
  44. text: '<bx_text_js:_sys_tour_launcher_polyglot_txt />',
  45. sel: {element:$('.bx-std-widget-cont:has(.bx-std-widget-link[href*=polyglot])').get(0), on:'bottom'}
  46. },{
  47. id: 'tour-bx_accounts',
  48. title: '<bx_text_js:_sys_tour_launcher_accounts_title />',
  49. text: '<bx_text_js:_sys_tour_launcher_accounts_txt />',
  50. sel: {element:$('.bx-std-widget-cont:has(.bx-std-widget-link[href*=bx_accounts])').get(0), on:'bottom'}
  51. },{
  52. id: 'tour-reorganize',
  53. title: '<bx_text_js:_sys_tour_launcher_reorganize_title />',
  54. text: '<bx_text_js:_sys_tour_launcher_reorganize_txt />',
  55. sel: {element:$('.bx-menu-tab-account').get(0), on:'bottom'}
  56. },{
  57. id: 'tour-dock',
  58. title: '<bx_text_js:_sys_tour_launcher_favourites_title />',
  59. text: '<bx_text_js:_sys_tour_launcher_favourites_txt />',
  60. sel: {element:$('.bx-std-menu-top-center').get(0), on:'bottom'}
  61. },{
  62. id: 'tour-add-apps',
  63. title: '<bx_text_js:_sys_tour_launcher_add_apps_title />',
  64. text: '<bx_text_js:_sys_tour_launcher_add_apps_txt />',
  65. sel: {element:$('.bx-std-widget-cont:has(.bx-std-widget-link[href*=store])').get(0), on:'bottom'}
  66. }
  67. ];
  68. glTour = new Shepherd.Tour({
  69. useModalOverlay: true,
  70. defaultStepOptions: {
  71. classes: 'shepherd-active bx-def-z-index-modal',
  72. showCancelLink: true,
  73. scrollTo: { behavior: window.matchMedia('(prefers-reduced-motion: reduce)').matches ? 'auto' : 'smooth', block: 'center' },
  74. }
  75. });
  76. //--- The page behind the overlay is inert while a step is open, so Tab and screen readers stay inside the step.
  77. var fTourInert = function(bOn) {
  78. var oMain = document.querySelector('.bx-main');
  79. if(oMain)
  80. oMain.inert = bOn;
  81. };
  82. glTour.on('show', function () { fTourInert(true); });
  83. glTour.on('complete', function () { fTourInert(false); });
  84. Shepherd.on('cancel', function () {
  85. fTourInert(false);
  86. $.cookie('launcher-tour-hidden', 1, {expires: 9999});
  87. });
  88. for (var i=0 ; i<a.length ; i++) {
  89. if ('undefined' !== typeof(a[i].sel) && 'string' !== typeof(a[i].sel) && null == a[i].sel.element)
  90. continue;
  91. var aBtns = []
  92. if (0 == i || i == (a.length - 1))
  93. aBtns.push({
  94. text: 0 == i ? '<bx_text_js:_sys_exit />' : '<bx_text_js:_sys_done />',
  95. action: glTour.cancel,
  96. classes: 0 == i ? 'shepherd-button-secondary' : 'shepherd-button-primary'
  97. });
  98. if (i != (a.length - 1))
  99. aBtns.push({
  100. text: '<bx_text_js:_sys_next />',
  101. action: glTour.next,
  102. classes: 'shepherd-button-primary'
  103. });
  104. var aOpts = {
  105. id: a[i].id,
  106. title: a[i].title,
  107. text: a[i].text,
  108. attachTo: a[i].sel,
  109. buttons: aBtns
  110. };
  111. glTour.addStep(aOpts);
  112. }
  113. var bTourForced = /[?&]tour=1(&|$)/.test(window.location.search);
  114. if (bTourForced && window.history.replaceState)
  115. window.history.replaceState(null, '', window.location.pathname);
  116. if (bTourForced || !$.cookie('launcher-tour-hidden'))
  117. glTour.start();
  118. </script>