23b67b422f361ca443b8a05d1b9223c91f47bf30
max
  Tue Nov 30 07:10:28 2021 -0800
fixing hgHubCheck bug found by Galt, refs #28566

diff --git src/hg/js/hgHubConnect.js src/hg/js/hgHubConnect.js
index 173740a..acf8c18 100644
--- src/hg/js/hgHubConnect.js
+++ src/hg/js/hgHubConnect.js
@@ -15,37 +15,39 @@
     hgsid = document.querySelector("input[name='hgsid']").value;
     var myUrl = window.location.href.split("#")[0].split("?")[0]; // strip off hgsid and tab-name
     var waitUrl =  myUrl + '?hgsid=' + hgsid + '&hgHub_do_hubCheck=1';
     var node = document.createElement('iframe'); 
     node.setAttribute('src', waitUrl);
     node.setAttribute('width', document.documentElement.clientWidth-100+'px');
     node.setAttribute('height', document.documentElement.clientHeight-100+'px');
     node.style.position = 'absolute'; 
     node.style.top = '50px'; 
     node.style.left = '50px'; 
     node.style.border = '3px solid darkgrey'; 
     node.id = 'checkerFrame';
     // first show the loading page
     document.body.appendChild(node);
 
+
     // when the waiting page has finished loading, load the hub checker page
     var finalUrl = waitUrl + '&validateHubUrl='+hubUrl;
     var alreadyRun = false;
     node.addEventListener("load", function() {
         if (! alreadyRun)
             node.setAttribute('src', finalUrl);
         alreadyRun = true; // because 'load' fires again when finalUrl is loaded
+        this.contentWindow.focus(); // activate keyboard event handlers of the iframe
     });
     return false;
 }
 
 function closeIframe() {
     var theFrame = window.parent.document.getElementById('checkerFrame');
     theFrame.parentNode.removeChild(theFrame);
 }
 
 function reloadIframe() {
     document.getElementById("content").innerHTML = "Re-loading hub...";
     window.parent.document.getElementById('checkerFrame').src += '';
 }
 
 // hover effect to highlight table rows
@@ -61,30 +63,34 @@
 
 
 // initializes the tabs - with cookie option
 // cookie option requires jquery.cookie.js
 $(function() {
   $("#tabs").tabs({
       cookie: {
           name: 'hubTab_cookie',
           expires: 30
       }
   });
 });
 
 // creates keyup event; listening for return key press
 $(document).ready(function() {
+    $('#loadSampleHub').bind('click', function(e) {
+        $('#validateHubUrl').val("https://genome.ucsc.edu/goldenPath/help/examples/hubDirectory/hub.txt");
+
+    });
     $('#hubUrl').bind('keypress', function(e) {  // binds listener to url field
         if (e.which === 13) {  // listens for return key
              e.preventDefault();   // prevents return from also submitting whole form
              if (validateUrl($('#hubUrl').val()))
                  $('input[name="hubAddButton"]').focus().click(); // clicks AddHub button
         }
     });
     $('#validateHubUrl').bind('keypress', function(e) {  // binds listener to url field
         if (e.which === 13) {  // listens for return key
              e.preventDefault();   // prevents return from also submitting whole form
              if (validateUrl($('#validateHubUrl').val()))
                  $('input[name="hubValidateButton"]').focus().click(); // clicks Validate Url button
         }
     });
     $('#hubSearchTerms').bind('keypress', function(e) {  // binds listener to text field