f77196f3a66db3bb1bce1913a2e7d6223db94c0b chmalee Mon May 22 15:58:42 2023 -0700 Make tutorial login dependent, add a link to view the tutorial under Help diff --git src/hg/js/hgTracks.js src/hg/js/hgTracks.js index c29d068..16240eb 100644 --- src/hg/js/hgTracks.js +++ src/hg/js/hgTracks.js @@ -5477,42 +5477,55 @@ 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); } // show a tutorial page if this is a new user if (typeof tour !== 'undefined' && tour) { let lsKey = "hgTracks_hideTutorial"; + let isUserLoggedIn = (typeof userLoggedIn !== 'undefined' && userLoggedIn === true); let hideTutorial = localStorage.getItem(lsKey); - if (typeof hideTutorial === 'undefined' || !hideTutorial) { + // if the user is not logged in and they have not already gone through the + // tutorial + if (!isUserLoggedIn && (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(); }); } + // allow user to bring the tutorial up under the help menu whether they've seen + // it or not + let tutorialLinkMenuItem = document.createElement("li"); + tutorialLinkMenuItem.id = "hgTracksHelpTutorialMenuItem"; + tutorialLinkMenuItem.innerHTML = "<a id='hgTracksHelpTutorialLink' href='#showTutorial'>" + + "Interactive Tutorial</a>"; + $("#help > ul")[0].appendChild(tutorialLinkMenuItem); + $("#hgTracksHelpTutorialLink").click(function () { + 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);