feb380e4c526092d9793e1d70f8a484cca2ae338
galt
  Tue Oct 20 01:18:28 2020 -0700
Fix speed of javascript in View, Facets, and Subtracks for hgTrackUi. fixes #26381

diff --git src/hg/js/hui.js src/hg/js/hui.js
index 48438fb..514f619 100644
--- src/hg/js/hui.js
+++ src/hg/js/hui.js
@@ -307,38 +307,33 @@
         matSubCBsetShadow(subCB,false);
         $(subCB).change();  // NOTE: if "subCfg" then 'change' event will update it
         hideOrShowSubtrack(subCB);
     }
 }
 
 function matSubCBsetShadow(subCB,triggerChange)
 {   // Since CBs only get into cart when enabled/checked,
     // the shadow control enables cart to know other states
     //  will update "subCfg" if needed
     var shadowState = 0;
     if (subCB.checked)
         shadowState = 1;
     if (isFauxDisabled(subCB,true))
         shadowState -= 2;
-    var fourWay = normed($("input.cbShadow[name='boolshad\\."+subCB.name+"']"));
-    if (!fourWay && subCB.name) {
-        fourWay = normed($("input.cbShadow#boolshad_-"+subCB.id)); // subCfg noname version specific
-        if (!fourWay)
-            fourWay = normed($("#"+subCB.name+"_4way"));
-    }
+    var fourWay = normed($("input.cbShadow#boolshad\\."+subCB.id)); // fast using id GALT
     if (!fourWay) {
-        warn("DEBUG: Failed to find fourWay shadow for '#"+subCB.id+"' ["+subCB.name+"]");
+        warn("DEBUG: Failed to find fourWay shadow for '#"+subCB.id);
         return;
     }
     if ($(fourWay).val() !== shadowState.toString()) {
         $(fourWay).val(shadowState);
         if (typeof(subCfg) === "object") { // Is subCfg.js file included
             subCfg.enableCfg(subCB,(shadowState === 1));
             if (triggerChange)
                 $(subCB).change(); // 'change' event will update "subCfg"
         }
     }
 }
 
 function matChkBoxNormalize(matCB)
 {   // Makes sure matCBs are in one of 3 states (checked,unchecked,indeterminate)
     // based on matching set of subCBs
@@ -657,37 +652,38 @@
     });
 
     // Close the cfg controls in the subtracks
     $("table.subtracks").each( function (i) { subtrackCfgHideAll(this);} );
     return true;
 }
 
 function hideOrShowSubtrack(obj)
 {
 // This can show/hide a tablerow that contains a specific object
 // Containing <tr>'s must be id'd with 'tr_' + obj.id
 // Also, this relies upon the "displaySubtracks" radio button control
     var tr = normed($(obj).parents('tr#tr_'+obj.id));
     if (tr) {
         if (!obj.checked || isFauxDisabled(obj,true))  {
-            var radio = $('input.allOrOnly');
-            for (var ix=0;ix<radio.length;ix++) {
-                if (radio[ix].checked && radio[ix].value === "selected") {
+
+	    var g = getTrack();
+	    var sel = normed($("#"+g+"_displaySubtracks_selected"));
+	    if (sel.checked && sel.value === "selected") {
 		$(tr).hide();
 		return;
 	    }
-            }
+
         }
         $(tr).show();
     }
 }
 
 function showSubTrackCheckBoxes(onlySelected)
 {
 // If a Subtrack configuration page has show "only selected subtracks" option,
 // This can show/hide tablerows that contain the checkboxes
 // Containing <tr>'s must be id'd with 'tr_' + the checkbox id,
 // while checkbox id must have 'cb_' prefix (ie: 'tr_cb_checkThis' & 'cb_checkThis')
     var trs = $('table.subtracks').children('tbody').children('tr');
     if (!onlySelected)
         $(trs).show();
     else {