7ea5ed7d0c917304cdf903d3acdc12d937e1d7cb Merge parents eb84833 60d9b1d chmalee Fri May 19 10:36:46 2023 -0700 Merge branch 'master' into chmalee_hgTracksTutorial diff --cc src/hg/js/hgTracks.js index 56d4e89,7d7b5a7..1f1f815 --- src/hg/js/hgTracks.js +++ src/hg/js/hgTracks.js @@@ -5473,21 -5473,55 +5473,60 @@@ // 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 (tour !== undefined) { + 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; + + var skipNotification = localStorage.getItem("hgTracks.hideSpeedNotification"); + writeToApacheLog("warnTiming "+getHgsid()+" time=" + loadSeconds + " skipNotif="+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 "+ + "the UCSC Genome Browser quick and responsive. See our "+ + "<b><a href='../FAQ/FAQtracks.html#speed' target='_blank'>display speed FAQ</a></b> for "+ + "common causes and solutions to slow performance. If this problem continues, you can create a "+ + "session link via <b>My Data</b> > <b>My Sessions</b> and send the link to <b>genome-www@soe.ucsc.edu</b>.<br>"+ + "<div style='text-align:center'>"+ + "<button id='notifyHide'>Close</button> "+ + "<button id='notifyHideForever'>Don't show again</button>"+ + "</div>"; + document.body.appendChild(div); + notifBoxShow(); + + $("#notifyHide").click( function() { + $("#notifBox").remove(); + }); + $("#notifyHideForever").click( function() { + $("#notifBox").remove(); + localStorage.setItem("hgTracks.hideSpeedNotification", "1"); + }); + }