ea1f7873f7fbb38c2acfce40982d5dd88e5d2478 max Thu Jun 11 05:23:11 2020 -0700 making autocomplete click the go button immediately, refs #25703 diff --git src/hg/js/hgTracks.js src/hg/js/hgTracks.js index 3494f3a..5484ad2 100644 --- src/hg/js/hgTracks.js +++ src/hg/js/hgTracks.js @@ -4047,30 +4047,31 @@ 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) { genomePos.set(item.id, getSizeFromCoordinates(item.id)); + $("#goButton").click(); }, function (position) { genomePos.set(position, getSizeFromCoordinates(position)); }); } // Make sure suggestTrack is visible when user chooses via gene select (#3484). if ($("#suggestTrack").length) { $(document.TrackForm || document.TrackHeaderForm).submit(function(event) { if ($('#hgFindMatches').length) { vis.makeTrackVisible($("#suggestTrack").val()); } }); } } }, @@ -4690,31 +4691,31 @@ // The 'statechange' function triggerd by the back-button. // Whenever the position changes, then use ajax-update to refetch the position imageV2.history.Adapter.bind(window,'statechange',function(){ var prevDbPos = imageV2.history.getState().data.lastDbPos; var prevPos = imageV2.history.getState().data.position; var curDbPos = hgTracks.lastDbPos; if (prevDbPos && prevDbPos !== curDbPos) { // NOTE: this function is NOT called when backing past a full retrieval boundary genomePos.set(decodeURIComponent(prevPos)); imageV2.navigateInPlace("" + prevDbPos, null, false); } }); // With history support it is best that most position changes will ajax-update the image // This ensures that the 'go' and 'refresh' button will do so unless the chrom changes. - $("input[value='go'],input[value='refresh']").click(function () { + $("#goButton,input[value='refresh']").click(function () { var newPos = genomePos.get().replace(/,/g,''); if (newPos.length > 2000) { alert("Sorry, you cannot paste identifiers or sequences with more than 2000 characters into this box."); $('input[name="hgt.positionInput"]').val(""); return false; } var newDbPos = hgTracks.lastDbPos; if ( ! imageV2.manyTracks() ) { var newChrom = newPos.split(':')[0]; var oldChrom = genomePos.getOriginalPos().split(':')[0]; if (newChrom === oldChrom) { imageV2.markAsDirtyPage(); imageV2.navigateInPlace("position=" + newPos, null, false); window.scrollTo(0,0);