2942a10cc7373047918e8b594405b840ca78a5c9 max Mon Jan 25 05:17:19 2021 -0800 fixing right-click menu description for tracks where "exonNumbers on", refs #26849 diff --git src/hg/js/hgTracks.js src/hg/js/hgTracks.js index fadcbd4..62e9abb 100644 --- src/hg/js/hgTracks.js +++ src/hg/js/hgTracks.js @@ -2753,31 +2753,38 @@ displayItemFunctions = title !== "zoomInMore"; } else { displayItemFunctions = true; } // For barChart mouseovers, replace title (which may be a category // name+value) with item name if (rec.type.indexOf("barChart") === 0 || rec.type.indexOf("bigBarChart") === 0) { a = /i=([^&]+)/.exec(href); if (a && a[1]) { title = a[1]; } } } - if (isHgc && ( href.indexOf('g=gtexGene')!== -1 || href.indexOf('g=unip') !== -1 )) { + // when "exonNumbers on", the mouse over text is not a good item description for the right-click menu + // "exonNumbers on" is the default for genePred/bigGenePred tracks but can also be actived for bigBed and others + // We don't have the value of "exonNumbers" here, so just use a heuristic to see if it's on + if (title.search(/, strand [+-], Intron /)!==-1) { + title = title.split(",")[0]; + } + + else if (isHgc && ( href.indexOf('g=gtexGene')!== -1 || href.indexOf('g=unip') !== -1 )) { // For GTEx gene and UniProt mouseovers, replace title (which may be a tissue name) with // item (gene) name. Also need to unescape the urlencoded characters and the + sign. a = /i=([^&]+)/.exec(href); if (a && a[1]) { title = decodeURIComponent(a[1].replace(/\+/g, " ")); } } if (displayItemFunctions) { o[rightClick.makeImgTag("magnify.png") + " Zoom to " + title] = { onclick: function(menuItemClicked, menuObject) { rightClick.hit(menuItemClicked, menuObject, "selectWholeGene"); return true; } };