6201cd68e13da77d359284cd7a00cec0c7662e43 chmalee Thu Jan 11 14:29:02 2024 -0800 Make the tutorial warning go away if it has been viewed more than 5 times without being explicitly closed, refs Max meeting diff --git src/hg/js/hgTracks.js src/hg/js/hgTracks.js index 659937a..3f61c4f 100644 --- src/hg/js/hgTracks.js +++ src/hg/js/hgTracks.js @@ -5483,37 +5483,41 @@ 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); + let tutMsgKey = "hgTracks_tutMsgCount"; + let tmp = localStorage.getItem(tutMsgKey), tutMsgCount = 0; + if (tmp !== null) {tutMsgCount = parseInt(tmp);} // if the user is not logged in and they have not already gone through the // tutorial - if (!isUserLoggedIn && !hideTutorial) { + if (!isUserLoggedIn && !hideTutorial && tutMsgCount < 5) { 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"); + localStorage.setItem("hgTracks_tutMsgCount", ++tutMsgCount); $("#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(); });