e46da004a1ed5fdf64eb24662bf94e0eee2f3bf3
chmalee
  Tue Aug 22 10:15:31 2023 -0700
Make hgTracks tutorial start automatically with special url variable startTutorial=true, refs #32004

diff --git src/hg/js/hgTracks.js src/hg/js/hgTracks.js
index cfcf50b..eed7001 100644
--- src/hg/js/hgTracks.js
+++ src/hg/js/hgTracks.js
@@ -5452,30 +5452,34 @@
         }
 
         // Retrieve tracks via AJAX that may take too long to draw initialliy (i.e. a remote bigWig)
         var retrievables = $('#imgTbl').find("tr.mustRetrieve");
         if ($(retrievables).length > 0) {
             $(retrievables).each( function (i) {
                 var trackName = $(this).attr('id').substring(3);
                 imageV2.requestImgUpdate(trackName,"","");
             });
         }
         imageV2.loadRemoteTracks();
         makeItemsByDrag.load();
 
         // show a tutorial page if this is a new user
         if (typeof tour !== 'undefined' && tour) {
+            setupSteps();
+            if (typeof startTutorialOnLoad !== 'undefined' && startTutorialOnLoad) {
+                tour.start();
+            }
             let lsKey = "hgTracks_hideTutorial";
             let isUserLoggedIn = (typeof userLoggedIn !== 'undefined' && userLoggedIn === true);
             let hideTutorial = localStorage.getItem(lsKey);
             // if the user is not logged in and they have not already gone through the
             // tutorial
             if (!isUserLoggedIn && !hideTutorial) {
                 let msg = "A guided tutorial is available for new users: " +
                     "<button id='showTutorialLink' href=\"#showTutorial\">Start tutorial</button>";
                 notifBoxSetup("hgTracks", "hideTutorial", msg);
                 notifBoxShow("hgTracks", "hideTutorial");
                 $("#showTutorialLink").click(function() {
                     $("#hgTracks_hideTutorialnotifyHide").click();
                     tour.start();
                 });
             }
@@ -5556,30 +5560,31 @@
     if (typeof showDownloadButton !== 'undefined' && showDownloadButton) {
         newListEl = document.createElement("li");
         newLink = document.createElement("a");
         newLink.setAttribute("id", "hgTracksDownload");
         newLink.setAttribute("name", "downloadTracks");
         newLink.textContent = "Download Current Track Data";
         newLink.href = "#";
         newListEl.appendChild(newLink);
         $("#downloads > ul")[0].appendChild(newListEl);
         $("#hgTracksDownload").click(downloadCurrentTrackData.showDownloadUi);
     }
 
     if (typeof showMouseovers !== 'undefined' && showMouseovers) {
         convertTitleTagsToMouseovers();
     }
+
 });
 
 function hgtWarnTiming(maxSeconds) {
     /* show a dialog box if the page load time was slower than x seconds. Has buttons to hide or never show this again. */
     var loadTime = window.performance.timing.domContentLoadedEventStart-window.performance.timing.navigationStart; /// in msecs
     var loadSeconds = loadTime/1000;
     if (loadSeconds < maxSeconds)
         return;
 
     var skipNotification = localStorage.getItem("hgTracks.hideSpeedNotification");
     dumpCart(loadSeconds, skipNotification);
         
     if (skipNotification)
         return;