6986d502973a4a246506b1b15c515648a2abf483 chmalee Mon Jul 21 15:52:33 2025 -0700 Move the hgc init call in the hgTracks popup later so function calls that rely on rendered text will work, refs #36092 diff --git src/hg/js/hgTracks.js src/hg/js/hgTracks.js index b1f1440b751..9b211181c8a 100644 --- src/hg/js/hgTracks.js +++ src/hg/js/hgTracks.js @@ -3635,33 +3635,30 @@ //response = response.replace(/"+ cleanHtml +""); appendNonceJsToPage(nonceJs); - // if there is anything on the hgc page that would normally run - // on document.ready, run it now - hgc.initPage(); let subtrack = tdbIsSubtrack(hgTracks.trackDb[popUpHgcOrHgGene.table]) ? popUpHgcOrHgGene.table : ""; popUpHgcOrHgGene.saveAllVars = getAllVars( $('#hgcDialog'), subtrack ); // Strategy for popups with js: // - jsFiles and CSS should not be included in html. Here they are shluped out. // - The resulting files ought to be loadable dynamically (with getScript()), // but this was not working nicely with the modal dialog // Therefore include files must be included with hgc CGI ! // - embedded js should not be in the popup box. // - Somethings should be in a popup.ready() function, and this is emulated below, // as soon as the cleanHtml is added // Since there are many possible popup cfg dialogs, the ready should be all inclusive. @@ -3708,30 +3705,33 @@ } ); }, close: function() { popUpHgcOrHgGene.cleanup(); }, title: function() { this.innerHTML = titleText; } }); // override the _title function to show custom html: //$('#hgcDialog').dialog('option' , 'title', titleText); $('#hgcDialog').dialog('open'); + // if there is anything on the hgc page that would normally run + // on document.ready, run it now + hgc.initPage(); document.addEventListener('click', e => { // if we clicked outside of the pop up, close the popup: mouseX = e.clientX; mouseY = e.clientY; popUpBox = document.getElementById("hgcDialog").parentElement.getBoundingClientRect(); if (mouseX < popUpBox.left || mouseX > popUpBox.right || mouseY < popUpBox.top || mouseY > popUpBox.bottom) { $("#hgcDialog").dialog("close"); } }); // Customize message based on current mode // Make 'Cancel' button close dialog $('input[name="Cancel"]').on("click", function() { $('#hgcDialog').dialog('close');