8d2c44d8112018dbb115baa707dbffc4778a7006
max
Wed Sep 10 08:01:40 2025 -0700
upgrading code for post-2013 nodejs/jshint, refs #36336
diff --git src/hg/js/hgTracks.js src/hg/js/hgTracks.js
index f12f495f2c4..5e07d09597f 100644
--- src/hg/js/hgTracks.js
+++ src/hg/js/hgTracks.js
@@ -1,23 +1,23 @@
// hgTracks.js - Javascript for use in hgTracks CGI
// Copyright (C) 2008 The Regents of the University of California
// "use strict";
// Don't complain about line break before '||' etc:
/* jshint -W014 */
-/* jshint esnext: true */
+/* jshint esversion: 8 */
var debug = false;
/* Data passed in from CGI via the hgTracks object:
*
* string cgiVersion // CGI_VERSION
* string chromName // current chromosome
* int winStart // genomic start coordinate (0-based, half-open)
* int winEnd // genomic end coordinate
* int newWinWidth // new width (in bps) if user clicks on the top ruler
* boolean revCmplDisp // true if we are in reverse display
* int insideX // width of side-bar (in pixels)
* int rulerClickHeight // height of ruler (in pixels) - zero if ruler is hidden
* boolean inPlaceUpdate // true if in-place-update is turned on
@@ -2902,80 +2902,80 @@
var displayItemFunctions = false;
if (rec) {
if (rec.type.indexOf("wig") === 0
|| rec.type.indexOf("bigWig") === 0
|| id === "wikiTrack") {
displayItemFunctions = false;
} else if (rec.type.indexOf("expRatio") === 0) {
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);
+ let a = /i=([^&]+)/.exec(href);
if (a && a[1]) {
title = a[1];
}
}
}
// pick out the exon number from the mouseover text
// Probably should be a data-exonNum tag on the DOM element
var exonNum = rightClick.mouseOverToExon(title);
// remove special genePred exon mouseover html text
// CGIs now use HTML tags, e.g. "Transcript: ENST00000297261.7
Strand:"
title = rightClick.mouseOverToLabel(title);
if (title.length > maxLength) {
title = title.substring(0, maxLength) + "...";
}
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);
+ let 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;
}
};
o[rightClick.makeImgTag("highlight.png") + " Highlight " + title] =
{ onclick: function(menuItemClicked, menuObject) {
rightClick.hit(menuItemClicked, menuObject,
"highlightItem");
return true;
}
};
if (rightClick.supportZoomCodon &&
(rec.type.indexOf("genePred") !== -1 || rec.type.indexOf("bigGenePred") !== -1)) {
// http://hgwdev-larrym.gi.ucsc.edu/cgi-bin/hgGene?hgg_gene=uc003tqk.2&hgg_prot=P00533&hgg_chrom=chr7&hgg_start=55086724&hgg_end=55275030&hgg_type=knownGene&db=hg19&c=chr7
var name, table;
var reg = new RegExp("hgg_gene=([^&]+)");
- var a = reg.exec(href);
+ let a = reg.exec(href);
if (a && a[1]) {
name = a[1];
reg = new RegExp("hgg_type=([^&]+)");
a = reg.exec(href);
if (a && a[1]) {
table = a[1];
}
} else {
// http://hgwdev-larrym.gi.ucsc.edu/cgi-bin/hgc?o=55086724&t=55275031&g=refGene&i=NM_005228&c=chr7
// http://hgwdev-larrym.gi.ucsc.edu/cgi-bin/hgc?o=55086713&t=55270769&g=wgEncodeGencodeManualV4&i=ENST00000455089&c=chr7
reg = new RegExp("i=([^&]+)");
a = reg.exec(href);
if (a && a[1]) {
name = a[1];
reg = new RegExp("g=([^&]+)");