cda1904f5a784ef6a94ee2ad8cfbcc3c0d0d4bef
chmalee
  Fri May 19 11:23:11 2023 -0700
Temporary commit generalizing the notification box

diff --git src/hg/js/hgTracks.js src/hg/js/hgTracks.js
index 1f1f815..2a7ccf0 100644
--- src/hg/js/hgTracks.js
+++ src/hg/js/hgTracks.js
@@ -5487,46 +5487,31 @@
 
     // 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");
+    var lsKey = "hgTracks.hideSpeedNotification";
+    var skipNotification = localStorage.getItem(lsKey);
     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 "+
+    msg = "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> &gt; <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>&nbsp;"+
-        "<button id='notifyHideForever'>Don't show again</button>"+
-        "</div>";
-    document.body.appendChild(div);
-    notifBoxShow();
+        "session link via <b>My Data</b> &gt; <b>My Sessions</b> and send the link to <b>genome-www@soe.ucsc.edu</b>.";
+    notifBoxSetup("hgTracks", "hideSpeedNotification", msg);
+    notifBoxShow("hgTracks", "hideSpeedNotification");
 
-    $("#notifyHide").click( function() {
-        $("#notifBox").remove();
-    });
-    $("#notifyHideForever").click( function() {
-        $("#notifBox").remove();
-        localStorage.setItem("hgTracks.hideSpeedNotification", "1");
-    });
 }