78aafe96d19a48bef4bb7e4a1fc7401eb65a7daa Merge parents 6c13a4d f697b76 chmalee Wed Jun 14 10:11:53 2023 -0700 Fix merge conflict diff --cc src/hg/js/hgTracks.js index ba50525,917d2aa..d670339 --- src/hg/js/hgTracks.js +++ src/hg/js/hgTracks.js @@@ -5474,70 -5489,55 +5490,69 @@@ // add a 'link' to download the current track data (under hg.conf control) 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 the user is not logged in and they have not already gone through the + // tutorial + if (!isUserLoggedIn && !hideTutorial) { + let msg = "We now have a guided tutorial available, " + + "to start the tutorial " + + "click here."; + 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 = "" + + "Interactive Tutorial"; + $("#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); + var skipNotification = localStorage.getItem("hgTracks.hideSpeedNotification"); + dumpCart(loadSeconds, skipNotification); if (skipNotification) return; - var div = document.createElement("div"); - div.style.display = "none"; - div.style.width = "90%"; - div.style.marginLeft = "100px"; - div.id = "notifBox"; - div.innerHTML = "This page took "+loadSeconds+" seconds to load. We strive to keep "+ + msg = "This page took "+loadSeconds+" seconds to load. We strive to keep "+ "the UCSC Genome Browser quick and responsive. See our "+ "display speed FAQ for "+ "common causes and solutions to slow performance. If this problem continues, you can create a "+ - "session link via My Data > My Sessions and send the link to genome-www@soe.ucsc.edu.
"+ - "
"+ - " "+ - ""+ - "
"; - document.body.appendChild(div); - notifBoxShow(); + "session link via My Data > My Sessions and send the link to genome-www@soe.ucsc.edu."; + notifBoxSetup("hgTracks", "hideSpeedNotification", msg); + notifBoxShow("hgTracks", "hideSpeedNotification"); - $("#notifyHide").click( function() { - $("#notifBox").remove(); - }); - $("#notifyHideForever").click( function() { - $("#notifBox").remove(); - localStorage.setItem("hgTracks.hideSpeedNotification", "1"); - }); }