4e620539ffe19c3fff4e3cd3d3f9070f42df342f
jnavarr5
  Thu Nov 14 16:20:36 2024 -0800
Changing the name of the function that generates the Tutorial popup to 'createTutorialPopup'. Removing the 'getDb()' function since it already exists it utils.js. Using the already existing function to open the Recommended Track Sets in the clinical tutorial. Making a change to only export the tutorials if they don't already exist. Making text changes to the popup, refs #34208

diff --git src/hg/js/hgTracks.js src/hg/js/hgTracks.js
index 1ba7ba2..23ec43b 100644
--- src/hg/js/hgTracks.js
+++ src/hg/js/hgTracks.js
@@ -5847,31 +5847,36 @@
             let tutorialLinkMenuItem = document.createElement("li");
             tutorialLinkMenuItem.id = "hgTracksHelpTutorialMenuItem";
             tutorialLinkMenuItem.innerHTML = "<a id='hgTracksHelpTutorialLink' href='#showTutorial'>" +
                 "Interactive Tutorial</a>";
             $("#help > ul")[0].appendChild(tutorialLinkMenuItem);
             $("#hgTracksHelpTutorialLink").on("click", function () {
                 basicTour.start();
             });
             // Create a new button in the Help menu to show all available javascript tutorials
             let tutorialLinks = document.createElement("li");
             tutorialLinks.id = "hgTracksHelpTutorialLinks";
             tutorialLinks.innerHTML = "<a id='hgTracksHelpTutorialLinks' href='#showTutuorialPopup'>" +
                 "Show All Interactive Tutorials</a>";
             $("#help > ul")[0].appendChild(tutorialLinks);
             $("#hgTracksHelpTutorialLinks").on("click", function () {
-                openTutorialPopup();
+                let tutorialPopupExists = document.getElementById ("tutorialContainer"); // Check to see if the <div> has been generated already
+                if (!tutorialPopupExists) {
+                    createTutorialPopup(); // Create the tutorial popup if it doesn't exist
+                } else {
+                    $("#tutorialContainer").dialog("open"); //otherwise use jquery-ui to open the popup
+                }
             });
         }
         
         // Any highlighted region must be shown and warnBox must play nice with it.
         imageV2.drawHighlights();
         // When warnBox is dismissed, any image highlight needs to be redrawn.
         $('#warnOK').on("click", function (e) { imageV2.drawHighlights();});
         // Also extend the function that shows the warn box so that it too redraws the highlight.
         showWarnBox = (function (oldShowWarnBox) {
             function newShowWarnBox() {
                 oldShowWarnBox.apply();
                 imageV2.drawHighlights();
             }
             return newShowWarnBox;
         })(showWarnBox);