da5437ffa185cc82f9e96e828b47b84f26a853ef larrym Tue Jun 26 16:04:31 2012 -0700 handle situations where positionInput doesn't exist (e.g. PDF Output page) diff --git src/hg/js/hgTracks.js src/hg/js/hgTracks.js index caf040c..dd5b105 100644 --- src/hg/js/hgTracks.js +++ src/hg/js/hgTracks.js @@ -2866,30 +2866,32 @@ data = data + "&"; } data = data + this.name + "=" + cmd; } } }); if(data.length > 0) { imageV2.navigateInPlace(data, null, false); } return false; } else { return true; } }, + // XXXX delete obsolete jumpButtonOnClick + jumpButtonOnClick: function () // called from hgTracks.c { // onClick handler for the "jump" button. // Handles situation where user types a gene name into the gene box and immediately hits the jump button, // expecting the browser to jump to that gene. var gene = $('#suggest').val(); var db = getDb(); if(gene && gene.length > 0 && gene != "gene" && db && $('#positionDisplay').length == 0 && (genomePos.getOriginalPos() == genomePos.get() || genomePos.get().length == 0)) { var pos = lookupGene(db, gene); if(pos) { vis.makeTrackVisible($("#suggestTrack").val()); @@ -2994,43 +2996,43 @@ { // The page may be reached via browser history (back button) // If so, then this code should detect if the image has been changed via js/ajax // and will reload the image if necessary. // NOTE: this is needed for IE but other browsers can detect the dirty page much earlier if (imageV2.isDirtyPage()) { // mark as non dirty to avoid infinite loop in chrome. $('#dirty').val('false'); jQuery('body').css('cursor', 'wait'); window.location = "../cgi-bin/hgTracks?hgsid=" + getHgsid(); return false; } initVars(); var db = getDb(); + if($('#positionInput').length) { suggestBox.init(db, hgTracks.assemblySupportsGeneSuggest, function (position) { genomePos.set(position, commify(getSizeFromCoordinates(position))); vis.makeTrackVisible($("#suggestTrack").val()); }, function (position) { genomePos.set(position, commify(getSizeFromCoordinates(position))); }); - // I want to set focus to the suggest element, but unforunately that prevents PgUp/PgDn from // working, which is a major annoyance. // $('#positionInput').focus(); - + } // Convert map AREA gets to post the form, ensuring that cart variables are kept up to date (but turn this off for search form). if($("FORM").length > 0 && $('#trackSearch').length == 0) { var allLinks = $('a'); $( allLinks ).unbind('click'); $( allLinks ).click( posting.saveSettings ); } if($('#pdfLink').length == 1) { $('#pdfLink').click(function(i) { var thisForm=$('#TrackForm'); if(thisForm != undefined && $(thisForm).length == 1) { //alert("posting form:"+$(thisForm).attr('name')); updateOrMakeNamedVariable($(thisForm),'hgt.psOutput','on'); return postTheForm($(thisForm).attr('name'),this.href); } return true;