@@ -700,11 +700,16 @@ def export_tour(tour_steps, name=None, filename="my_tour.js", url=None):
700
700
backdrop_style = style_sheet .bt_backdrop_style
701
701
backdrop_style = backdrop_style .replace ('\n ' , '' )
702
702
backdrop_style = js_utils .escape_quotes_if_needed (backdrop_style )
703
- instructions += 'injectJS("%s");' % jquery_js
704
- instructions += '\n \n //////// Resources - Load 2 ////////\n \n '
703
+ instructions += 'injectJS("%s");\n ' % jquery_js
704
+ instructions += '\n '
705
+ instructions += 'function loadResources() { '
706
+ instructions += 'if ( typeof jQuery !== "undefined" ) {\n '
705
707
instructions += 'injectCSS("%s");\n ' % bootstrap_tour_css
706
708
instructions += 'injectStyle("%s");\n ' % backdrop_style
707
709
instructions += 'injectJS("%s");' % bootstrap_tour_js
710
+ instructions += '} else { window.setTimeout("loadResources();",100); '
711
+ instructions += '} }\n '
712
+ instructions += 'loadResources()'
708
713
709
714
elif tour_type == "hopscotch" :
710
715
hopscotch_css = constants .Hopscotch .MIN_CSS
@@ -738,18 +743,36 @@ def export_tour(tour_steps, name=None, filename="my_tour.js", url=None):
738
743
backdrop_style = js_utils .escape_quotes_if_needed (backdrop_style )
739
744
instructions += 'injectCSS("%s");\n ' % spinner_css
740
745
instructions += 'injectJS("%s");\n ' % jquery_js
741
- instructions += 'injectJS("%s");' % tether_js
742
- instructions += '\n \n //////// Resources - Load 2 ////////\n \n '
746
+ instructions += 'injectJS("%s");\n ' % tether_js
747
+ instructions += '\n '
748
+ instructions += 'function loadResources() { '
749
+ instructions += 'if ( typeof jQuery !== "undefined" ) {\n '
743
750
instructions += 'injectCSS("%s");' % sh_theme_arrows_css
744
751
instructions += 'injectCSS("%s");' % sh_theme_arrows_fix_css
745
752
instructions += 'injectCSS("%s");' % sh_theme_default_css
746
753
instructions += 'injectCSS("%s");' % sh_theme_dark_css
747
754
instructions += 'injectCSS("%s");' % sh_theme_sq_css
748
755
instructions += 'injectCSS("%s");\n ' % sh_theme_sq_dark_css
749
756
instructions += 'injectStyle("%s");\n ' % backdrop_style
750
- instructions += 'injectJS("%s");' % shepherd_js
757
+ instructions += 'injectJS("%s");\n ' % shepherd_js
758
+ instructions += '} else { window.setTimeout("loadResources();",100); '
759
+ instructions += '} }\n '
760
+ instructions += 'loadResources()'
751
761
752
762
instructions += '\n \n //////// Tour Code ////////\n \n '
763
+ if tour_type == "bootstrap" :
764
+ instructions += 'function loadTour() { '
765
+ instructions += 'if ( typeof Tour !== "undefined" ) {\n '
766
+ elif tour_type == "hopscotch" :
767
+ instructions += 'function loadTour() { '
768
+ instructions += 'if ( typeof hopscotch !== "undefined" ) {\n '
769
+ elif tour_type == "introjs" :
770
+ instructions += 'function loadTour() { '
771
+ instructions += 'if ( typeof introJs !== "undefined" ) {\n '
772
+ elif tour_type == "shepherd" :
773
+ instructions += 'function loadTour() { '
774
+ instructions += 'if ( typeof Shepherd !== "undefined" ) {\n '
775
+
753
776
for tour_step in tour_steps [name ]:
754
777
instructions += tour_step
755
778
@@ -792,6 +815,9 @@ def export_tour(tour_steps, name=None, filename="my_tour.js", url=None):
792
815
$tour = tour;\n """ )
793
816
else :
794
817
pass
818
+ instructions += '\n } else { window.setTimeout("loadTour();",100); } '
819
+ instructions += '}\n '
820
+ instructions += 'loadTour()\n '
795
821
796
822
exported_tours_folder = EXPORTED_TOURS_FOLDER
797
823
if exported_tours_folder .endswith ("/" ):
0 commit comments