edb9731b4634655aba9aae9707a6aa8c9a1457cb
chmalee
  Fri May 19 16:31:53 2023 -0700
Don't show tutorial until a link is clicked, hide/show tutorial correctly. TODO: when tutorial is finished set the localStorage correctly

diff --git src/hg/js/hgTracks.js src/hg/js/hgTracks.js
index 6c2d297..c29d068 100644
--- src/hg/js/hgTracks.js
+++ src/hg/js/hgTracks.js
@@ -5478,36 +5478,40 @@
         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);
     }
 
     // show a tutorial page if this is a new user
     if (typeof tour !== 'undefined' && tour) {
         let lsKey = "hgTracks_hideTutorial";
         let hideTutorial = localStorage.getItem(lsKey);
-        if (typeof hideTutorial === 'undefined') {
-            let msg = "We now have a guided tutorial available, <a href=\"#showTutorial\">click here" +
-                "to start the tutorial";
+        if (typeof hideTutorial === 'undefined' || !hideTutorial) {
+            let msg = "We now have a guided tutorial available, " +
+                "to start the tutorial " +
+                "<a id='showTutorialLink' href=\"#showTutorial\">click here</a>.";
             notifBoxSetup("hgTracks", "hideTutorial", msg);
             notifBoxShow("hgTracks", "hideTutorial");
+            $("#showTutorialLink").click( function() {
+                $("#hgTracks_hideTutorialnotifyHide").click();
                 tour.start();
+            });
         }
     }
     
 });
 
 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;
 
     let lsKey = "hgTracks_hideSpeedNotification";
     var skipNotification = localStorage.getItem(lsKey);
     writeToApacheLog("warnTiming "+getHgsid()+" time=" + loadSeconds + " skipNotif="+skipNotification);