5edf4ac72866f696753442f60b6ab1e3c984f381
max
Tue Jul 5 05:03:30 2022 -0700
remove tag order dependency in javascript code, refs #29696, remove alert text URL, refs #29583. Hopefully the last suggestions for a tiny feature.
diff --git src/hg/js/hgHubConnect.js src/hg/js/hgHubConnect.js
index eb17eed..d45463b 100644
--- src/hg/js/hgHubConnect.js
+++ src/hg/js/hgHubConnect.js
@@ -97,51 +97,51 @@
if (e.which === 13) { // listens for return key
e.preventDefault(); // prevents return from also submitting whole form
$('input[name="hubSearchButton"]').focus().click(); // clicks search button
}
});
$('#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 genome=hg19-part is stored in the element two elements before the icon SVG:
// Because the HTML code generated by the CGI looks like this:
//
- var link = e.target.previousSibling.previousSibling;
+ var link = e.target.parentElement.getElementsByClassName("hgTracksLink")[0];
var href = link.href;
var genomeArg = href.split("&")[1];
// the url is in the element just before the SVG
- var copyText = e.target.previousSibling;
+ var copyText = e.target.parentElement.getElementsByTagName("input")[0];
var myBaseUrl = copyText.baseURI.split('?')[0];
var hgTracksUrl = myBaseUrl.replace("hgHubConnect", "hgTracks");
var oldVal = copyText.value;
copyText.value = hgTracksUrl+"?hubUrl="+copyText.value+"&"+genomeArg;
copyText.style.display = 'none';
copyText.type = 'text';
copyText.select();
copyText.setSelectionRange(0, 99999); /* For mobile devices */
document.execCommand('copy');
copyText.type = 'hidden';
- alert("Copied URL to clipboard: " + copyText.value);
+ alert("Copied URL to clipboard");
copyText.value = oldVal;
});
});
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 () {