7a2dbf6721582d73ac9665d9231ffd7fdb703d3a
chmalee
  Wed Jun 3 15:04:56 2026 -0700
Add a link to create a myVariants item to the menu bar under My Data, refs #33808

diff --git src/hg/js/hgTracks.js src/hg/js/hgTracks.js
index 19d6115ad8c..15039276089 100644
--- src/hg/js/hgTracks.js
+++ src/hg/js/hgTracks.js
@@ -7373,30 +7373,53 @@
         newListEl.appendChild(newLink);
         let opt = document.querySelector("#downloads > ul");
         if (opt) {
             opt.appendChild(newListEl);
             $("#hgTracksDownload").on("click", downloadCurrentTrackData.showDownloadUi);
         }
     }
 
     if (typeof doMyVariants !== 'undefined' && doMyVariants) {
         myVariants.init();
         document.getElementById("myVariantsButton").addEventListener("click", (e) => {
             e.preventDefault();
             e.stopPropagation();
             myVariants.showDialog();
         });
+        // Add a "My Annotations" link to the My Data menu that opens the same
+        // dialog as the Add Annotation button below the image.
+        let myDataList = document.querySelector("#myData > ul");
+        if (myDataList) {
+            newListEl = document.createElement("li");
+            newLink = document.createElement("a");
+            newLink.setAttribute("id", "myAnnotationsMenuLink");
+            newLink.setAttribute("title", "Add an item to the My Annotations track");
+            newLink.textContent = "My Annotations";
+            newLink.href = "#";
+            newListEl.appendChild(newLink);
+            // Place it right after Custom Tracks; fall back to the top of the menu.
+            let customTracksItem = document.getElementById("customTracksMenuLink");
+            if (customTracksItem && customTracksItem.parentNode.parentNode === myDataList)
+                myDataList.insertBefore(newListEl, customTracksItem.parentNode.nextSibling);
+            else
+                myDataList.insertBefore(newListEl, myDataList.firstElementChild);
+            newLink.addEventListener("click", (e) => {
+                e.preventDefault();
+                e.stopPropagation();
+                myVariants.showDialog();
+            });
+        }
     }
 
     if (typeof showMouseovers !== 'undefined' && showMouseovers) {
         convertTitleTagsToMouseovers();
     }
 
 });
 
 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;