4db401fb2e91accfcf9ffcd3478b2f3d7881eb90 max Wed Jul 27 06:50:50 2022 -0700 fixing plus buttons and yet another bug with the copy button, refs #29583 diff --git src/hg/js/hgHubConnect.js src/hg/js/hgHubConnect.js index c9125f2..6f262ea 100644 --- src/hg/js/hgHubConnect.js +++ src/hg/js/hgHubConnect.js @@ -100,48 +100,59 @@ } }); $('#hubDbFilter').bind('keypress', function(e) { // binds listener to text field if (e.which === 13) { // listens for return key e.preventDefault(); // prevents return from also submitting whole form $('input[name="hubSearchButton"]').focus().click(); // clicks db filter button } }); $('.pasteIcon').bind('click', function(e) { // The hgTracks link is in the element two elements before the icon SVG: // // GCA_009914755 // // ... <--- this is e.target of the click handler // - var link = e.target.parentElement.getElementsByClassName("hgTracksLink")[0].href; - var inputEl = e.target.parentElement.getElementsByTagName("input")[0]; + var inputEl = e.target.previousSibling; + var connectUrl = e.target.previousSibling.previousSibling.href; // the url is in the element just before the SVG var oldVal = inputEl.value; - // display:none does not work, see https://stackoverflow.com/questions/31593297/using-execcommand-javascript-to-copy-hidden-text-to-clipboard + // display:none does not work, + // see https://stackoverflow.com/questions/31593297/using-execcommand-javascript-to-copy-hidden-text-to-clipboard inputEl.style = "position: absolute; left: -1000px; top: -1000px"; - inputEl.value = link; + inputEl.value = connectUrl; inputEl.type = 'text'; inputEl.select(); inputEl.setSelectionRange(0, 99999); /* For mobile devices */ document.execCommand('copy'); inputEl.type = 'hidden'; inputEl.value = oldVal; alert("Copied Genome Browser hub connection URL to clipboard"); }); + $('.shortPlus').bind('click', function(ev) { + ev.target.parentElement.style.display = 'none'; + ev.target.parentElement.nextSibling.style.display = 'inline'; + }); + $('.fullMinus').bind('click', function(ev) { + ev.target.parentElement.style.display = 'none'; + ev.target.parentElement.previousSibling.style.display = 'inline'; + }); + + }); var hubSearchTree = (function() { var treeDiv; // Points to div we live in function hubSearchTreeContextMenuHandler (node, callback) { var nodeType = node.li_attr.nodetype; if (nodeType == 'track') { callback({ 'openConfig': { 'label' : 'Configure this track', 'action' : function () { window.open(node.li_attr.configlink, '_blank'); } }