14dbfe57d9b670fa554c64cd4604e37fdefe037d chmalee Fri Jan 5 15:33:17 2024 -0800 Working version of saving last five user entered terms in the search bar, refs #29611 diff --git src/hg/js/hgTracks.js src/hg/js/hgTracks.js index 3f61c4f..f00a04a 100644 --- src/hg/js/hgTracks.js +++ src/hg/js/hgTracks.js @@ -3848,39 +3848,51 @@ } reg = new RegExp("(<span class='trackTiming'>[\\S\\s]+?</span>)"); a = reg.exec(response); if (a && a[1]) { $('.trackTiming').replaceWith(a[1]); } }, loadSuggestBox: function () { if ($('#positionInput').length) { if (!suggestBox.initialized) { // only call init once suggestBox.init(getDb(), $("#suggestTrack").length > 0, function (item) { + if (["helpDocs", "publicHubs", "trackDb"].includes(item.type) || + item.id.startsWith("hgc")) { + if (item.geneSymbol) { + selectedGene = item.geneSymbol; + // Overwrite item's long value with symbol after the autocomplete plugin is done: + window.setTimeout($('#positionInput').val(item.geneSymbol), 0); + } else { + selectedGene = item.value; + } + window.location.assign(item.id); + } else { genomePos.set(item.id, getSizeFromCoordinates(item.id)); if ($("#suggestTrack").length && $('#hgFindMatches').length) { // Set cart variables to open the hgSuggest gene track and highlight // the chosen transcript. These variables will be submittted by the goButton // click handler. vis.makeTrackVisible($("#suggestTrack").val()); cart.addVarsToQueue(["hgFind.matches"],[$('#hgFindMatches').val()]); } $("#goButton").click(); + } }, function (position) { genomePos.set(position, getSizeFromCoordinates(position)); } ); } } }, afterImgChange: function (dirty) { // Standard things to do when manipulations change image without ajax update. dragReorder.init(); dragSelect.load(false); imageV2.drawHighlights(); if (dirty)