commit/galaxy-central: jgoecks: Trackster: fix issues with navigation input: (a) arrow keys no longer perform navigation and (b) invalid chromosome names are handled well.
1 new changeset in galaxy-central: http://bitbucket.org/galaxy/galaxy-central/changeset/dc9b64810fde/ changeset: r5235:dc9b64810fde user: jgoecks date: 2011-03-18 18:51:51 summary: Trackster: fix issues with navigation input: (a) arrow keys no longer perform navigation and (b) invalid chromosome names are handled well. affected #: 2 files (530 bytes) --- a/static/scripts/trackster.js Fri Mar 18 13:40:58 2011 -0400 +++ b/static/scripts/trackster.js Fri Mar 18 13:51:51 2011 -0400 @@ -367,9 +367,9 @@ view.go_to( $(this).val() ); } $(this).hide(); + $(this).val(''); view.location_span.show(); view.chrom_select.show(); - return false; } }; this.nav_input = $("<input/>").addClass("nav-input").hide().bind("keyup focusout", submit_nav).appendTo(this.nav_controls); @@ -377,6 +377,7 @@ this.location_span.bind("click", function() { view.location_span.hide(); view.chrom_select.hide(); + view.nav_input.val(view.chrom + ":" + view.low + "-" + view.high); view.nav_input.css("display", "inline-block"); view.nav_input.select(); view.nav_input.focus(); @@ -520,7 +521,14 @@ url: chrom_url, data: url_parms, dataType: "json", - success: function ( result ) { + success: function (result) { + // Show error if could not load chroms. + if (result.chrom_info.length === 0) { + alert("Invalid chromosome: " + url_parms.chrom); + return; + } + + // Load chroms. if (result.reference) { view.add_label_track( new ReferenceTrack(view) ); } @@ -543,13 +551,12 @@ view.chrom_start_index = result.start_index; }, error: function() { - alert( "Could not load chroms for this dbkey:", view.dbkey ); + alert("Could not load chroms for this dbkey:", view.dbkey); } }); }, change_chrom: function(chrom, low, high) { - // Don't do anything if chrom is "None" (hackish but some browsers already have this set), or null/blank if (!chrom || chrom === "None") { return; --- a/templates/tracks/browser.mako Fri Mar 18 13:40:58 2011 -0400 +++ b/templates/tracks/browser.mako Fri Mar 18 13:51:51 2011 -0400 @@ -256,6 +256,11 @@ // Keyboard navigation. Scroll ~7% of height when scrolling up/down. // $(document).keydown(function(e) { + // Do not navigate if arrow keys used in input element. + if ($(e.srcElement).is(':input')) { + return; + } + // Key codes: left == 37, up == 38, right == 39, down == 40 switch(e.which) { case 37: Repository URL: https://bitbucket.org/galaxy/galaxy-central/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email.
participants (1)
-
Bitbucket