b818160961573cd7b8902303ca4dc532d1366513
max
  Mon Apr 29 11:14:47 2024 -0700
adding name filter and color track options to hgTrackUi, refs #20460

diff --git src/hg/js/utils.js src/hg/js/utils.js
index 28bd9bb..0986413 100644
--- src/hg/js/utils.js
+++ src/hg/js/utils.js
@@ -4329,15 +4329,35 @@
                 searchObj[db].results[searchTerm] = extra;
                 if (searchList.length >= 5) {
                     let toDelete = searchList.pop();
                     delete searchObj[db].results[toDelete];
                 }
             }
             searchList.unshift(searchTerm);
             searchObj.stack = searchList;
         } else {
             searchObj[db] = {"stack": [searchTerm], "results": {}};
             searchObj[db].results[searchTerm] = extra;
         }
         window.localStorage.setItem("searchStack", JSON.stringify(searchObj));
     }
 }
+
+function activateColorPicker (inputFieldId, colorPickerId) 
+/* connect a color picker to a text input field with the color hex value */
+{
+    var opt = {
+        hideAfterPaletteSelect : true,
+        color : $(inputFieldId).val(),
+        showPalette: true,
+        showInput: true,
+        showSelectionPalette: true,
+        showInitial: true,
+        preferredFormat: "hex",
+        localStorageKey: "genomebrowser",
+        change: function() { var color = $(colorPickerId).spectrum("get"); $(inputFieldId).val(color); },
+    };
+    $(colorPickerId).spectrum(opt);
+    // update the color picker if you change the input box
+    $(inputFieldId).change(function(){ $(colorPickerId).spectrum("set", $(inputFieldId).val()); });
+}
+