aa3580cd95ee1400a9fa6ad63ce7db846059185a
chmalee
  Fri Jun 23 10:13:52 2023 -0700
Make notification box redraw highlights, refs #30670

diff --git src/hg/js/hgTracks.js src/hg/js/hgTracks.js
index d670339..94e5035 100644
--- src/hg/js/hgTracks.js
+++ src/hg/js/hgTracks.js
@@ -5427,42 +5427,83 @@
             // Turn on drag scrolling.
             $("div.scroller").panImages();
         }
 
         // Retrieve tracks via AJAX that may take too long to draw initialliy (i.e. a remote bigWig)
         var retrievables = $('#imgTbl').find("tr.mustRetrieve");
         if ($(retrievables).length > 0) {
             $(retrievables).each( function (i) {
                 var trackName = $(this).attr('id').substring(3);
                 imageV2.requestImgUpdate(trackName,"","");
             });
         }
         imageV2.loadRemoteTracks();
         makeItemsByDrag.load();
 
+        // 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 " +
+                    "<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();
+            });
+        }
+        
         // Any highlighted region must be shown and warnBox must play nice with it.
         imageV2.drawHighlights();
         // When warnBox is dismissed, any image highlight needs to be redrawn.
         $('#warnOK').click(function (e) { imageV2.drawHighlights();});
         // Also extend the function that shows the warn box so that it too redraws the highlight.
         showWarnBox = (function (oldShowWarnBox) {
             function newShowWarnBox() {
                 oldShowWarnBox.apply();
                 imageV2.drawHighlights();
             }
             return newShowWarnBox;
         })(showWarnBox);
+        // redraw highlights if the notification box is closed
+        $("[id$=notifyHide],[id$=notifyHideForever]").click(function(e) {
+            imageV2.drawHighlights();
+        });
+        notifBoxShow = (function(oldNotifBoxShow) {
+            function newNotifBoxShow() {
+                oldNotifBoxShow.apply();
+                imageV2.drawHighlights();
+            }
+            return newNotifBoxShow;
+        })(notifBoxShow);
     }
 
     // Drag select in chromIdeogram
     if ($('img#chrom').length === 1) {
         if ($('area.cytoBand').length >= 1) {
             $('img#chrom').chromDrag();
         }
     }
 
     // Track search uses tabs
     trackSearch.init();
 
     // Drag select initialize
     if (imageV2.enabled) {   // moved from window.load().
         dragSelect.load(true);
@@ -5490,59 +5531,30 @@
 
 
     // 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 " +
-                "<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;
 
     var skipNotification = localStorage.getItem("hgTracks.hideSpeedNotification");
     dumpCart(loadSeconds, skipNotification);
         
     if (skipNotification)
         return;