8d2c44d8112018dbb115baa707dbffc4778a7006 max Wed Sep 10 08:01:40 2025 -0700 upgrading code for post-2013 nodejs/jshint, refs #36336 diff --git src/hg/js/utils.js src/hg/js/utils.js index efd6446242a..142409d056b 100644 --- src/hg/js/utils.js +++ src/hg/js/utils.js @@ -4289,60 +4289,56 @@ a.title = ""; else if (a.title !== undefined && a.title.length > 0) { if (a.title.startsWith("Click to alter the display density")) { // these tooltips have a longer delay: a.setAttribute("tooltipDelay", "delayed"); } titleTagToMouseover(a); } }); /* Mouseover should clear if you leave the document window altogether */ document.body.addEventListener("mouseleave", (ev) => { hideMouseoverText(mouseoverContainer); }); + function hideTooltips() { + hideMouseoverText(mouseoverContainer); + } + /* make the mouseovers go away if we are in an input */ const inps = document.getElementsByTagName("input"); for (let inp of inps) { if (!(inp.type == "hidden" || inp.type == "HIDDEN")) { if (inp.type !== "submit") { - inp.addEventListener("focus", (ev) => { - hideMouseoverText(mouseoverContainer); - }); + inp.addEventListener("focus", hideTooltips); } else { // the buttons are inputs that don't blur right away (or ever? I can't tell), so // be sure to restore the tooltips when they are clicked - inp.addEventListener("click", (ev) => { - hideMouseoverText(mouseoverContainer); - }); + inp.addEventListener("click", hideTooltips); } } } /* on a select, we can hide the tooltip on focus, but don't disable them * altogether, because it's easy to click out of a select without actually * losing focus, and we can't detect that because the web browser handles * that click separately */ const sels = document.getElementsByTagName("select"); for (let sel of sels) { - sel.addEventListener("focus", (ev) => { - hideMouseoverText(mouseoverContainer); - }); + sel.addEventListener("focus", hideTooltips); for (let opt of sel.options) { - opt.addEventListener("click", (evt) => { - hideMouseoverText(mouseoverContainer); - }); + opt.addEventListener("click", hideTooltips); } } /* Make the ESC key hide tooltips */ document.body.addEventListener("keyup", (ev) => { if (ev.keyCode === 27) { hideMouseoverText(mouseoverContainer); } }); } function parseUrl(url) { // turn a url into some of it's components like server, query-string, etc let protocol, serverName, pathInfo, queryString, queryArgs = {}; let temp;