81a04805893ab59c954464ac449abe65da05ac7f hiram Mon Sep 21 16:28:30 2026 -0700 highlight NCBI "reference" assemblies in the search result and hg.conf gated with hgGateway.showRefBadge=on default is off refs #38401 diff --git src/hg/js/autocompleteCat.js src/hg/js/autocompleteCat.js index 0f0e7ce13d5..7df8909c63a 100644 --- src/hg/js/autocompleteCat.js +++ src/hg/js/autocompleteCat.js @@ -36,36 +36,50 @@ currentCategory = item.category; } that._renderItem( ul, item ); }); ul.append("<div class='autoCompleteInfo' style='color:grey'>Unable to find a genome? <a target=_blank href='../assemblySearch.html'>Send us a request</a></div>"); }, _renderItem: function(ul, item) { // In order to use HTML markup in the autocomplete, one has to overwrite // autocomplete's _renderItem method using .html instead of .text. // http://forum.jquery.com/topic/using-html-in-autocomplete let clockIcon = ''; let posInput = $("#positionInput"); if (posInput.length > 0 && posInput.val() && posInput.val().length < 2) { clockIcon = '<svg xmlns="http://www.w3.org/2000/svg" height=".75em" width=".75em" viewBox="0 0 512 512"><!--!Font Awesome Free 6.5.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2024 Fonticons, Inc.--><path d="M75 75L41 41C25.9 25.9 0 36.6 0 57.9V168c0 13.3 10.7 24 24 24H134.1c21.4 0 32.1-25.9 17-41l-30.8-30.8C155 85.5 203 64 256 64c106 0 192 86 192 192s-86 192-192 192c-40.8 0-78.6-12.7-109.7-34.4c-14.5-10.1-34.4-6.6-44.6 7.9s-6.6 34.4 7.9 44.6C151.2 495 201.7 512 256 512c141.4 0 256-114.6 256-256S397.4 0 256 0C185.3 0 121.3 28.7 75 75zm181 53c-13.3 0-24 10.7-24 24V256c0 6.4 2.5 12.5 7 17l72 72c9.4 9.4 24.6 9.4 33.9 0s9.4-24.6 0-33.9l-65-65V152c0-13.3-10.7-24-24-24z"/></svg> '; } + // NCBI RefSeq "reference" assemblies get a green 'reference' word badge. + let refBadge = ''; + if (item.isReference) { + refBadge = '<span style="color:#080;font-weight:bold;">reference</span> '; + } // Hits to assembly hub top level (not individial db names) have no item label, // so use the value instead - return $("<li></li>") + var $a = $("<a></a>").html(clockIcon + refBadge + (item.label !== null ? item.label : item.value)); + var $li = $("<li></li>") .data("ui-autocomplete-item", item) - .append($("<a></a>").html(clockIcon + (item.label !== null ? item.label : item.value))) + .append($a) .appendTo(ul); + if (item.isReference && typeof addMouseover === "function") { + // Apply the site's positioned tooltip (utils.js) to the whole row, not just + // the badge glyph, and use it instead of the native title popup, which can + // render below the icon and get hidden under a large custom cursor -- same + // fix used for hgTracks image mouseovers. + addMouseover($a[0], "NCBI RefSeq reference assembly"); + } + return $li; } }); function toggleSpinner(add, options) { if (options.baseUrl.startsWith("hgGateway")) { // change the species select loading image if (add) $("#speciesSearch").after("<i id='speciesSpinner' class='fa fa-spin fa-spinner'></i>"); else $("#speciesSpinner").remove(); } else if (options.baseUrl.startsWith("hgSuggest")) { // change the position input loading spinner if (add) $("#positionInput").after("<i id='suggestSpinner' class='fa fa-spin fa-spinner'></i>"); else