6653939f865225a4141f5b2a1b970e34b92b1226
max
Fri May 16 08:23:59 2025 -0700
fixing right-click ID for gene pred tracks, refs #35756
diff --git src/hg/js/hgTracks.js src/hg/js/hgTracks.js
index 1ed123b0c2f..6fa8a66894e 100644
--- src/hg/js/hgTracks.js
+++ src/hg/js/hgTracks.js
@@ -2734,30 +2734,39 @@
$('#img_data_' + rightClick.floatingMenuItem).parent().makeFloat(
{x:"current",y:"current", speed: 'fast', alwaysVisible: true, alwaysTop: true});
}
},
makeImgTag: function (img)
{ // Return img tag with explicit dimensions for img (dimensions are currently hardwired).
// This fixes the "weird shadow problem when first loading the right-click menu"
// seen in FireFox 3.X, which occurred b/c FF doesn't actually fetch the image until
// the menu is being shown.
return "
";
},
+ // CGIs now use HTML tags, e.g. "Transcript: ENST00000297261.7
Strand:"
+ mouseOverToLabel: function(title)
+ {
+ if (title.search(/Transcript:<[/]b>/) !== -1) {
+ title = title.split("
")[0].split("")[1];
+ }
+ return title;
+ },
+
load: function (img)
{
rightClick.menu = img.contextMenu(function() {
popUp.cleanup(); // Popup box is not getting closed properly so must do it here
if ( ! rightClick.selectedMenuItem ) // This is literally an edge case so ignore
return;
var o; // TODO: Break this giant routine with shared vars into some sub-functions
var str;
var rec = null;
var menu = [];
var selectedImg = rightClick.makeImgTag("greenChecksm.png");
var blankImg = rightClick.makeImgTag("invisible16.png");
var done = false;
if (rightClick.selectedMenuItem && rightClick.selectedMenuItem.id) {
@@ -2888,40 +2897,36 @@
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];
}
}
}
// 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|Exon) /)!==-1) {
- re = /(Exon) ([1-9]+) of/;
- matches = re.exec(title);
- if (matches !== null && matches[2].length > 0)
- exonNum = matches[2];
- title = title.split(",")[0];
- }
+ // We don't have the value of the tdb variable "exonNumbers" here, so just use a heuristic to see if it's on
+
+ // CGIs now use HTML tags, e.g. "Transcript: ENST00000297261.7
Strand:"
+ title = rightClick.mouseOverToLabel(title);
- else if (isHgc && ( href.indexOf('g=gtexGene')!== -1
+ if (isHgc && ( href.indexOf('g=gtexGene')!== -1
|| href.indexOf('g=unip') !== -1
|| href.indexOf('g=knownGene') !== -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;