c1d75c06bbe95a8c006c368c0c017d2eadc7e67c tdreszer Tue Jan 28 15:01:32 2014 -0800 Fixed bug seen only on FF where vis drop-downs were disabled after back-button (redmine #12511). Also made warnBox play nice with highlight (redmine #709). diff --git src/hg/js/hgTracks.js src/hg/js/hgTracks.js index d42add2..4e49bd02 100644 --- src/hg/js/hgTracks.js +++ src/hg/js/hgTracks.js @@ -539,31 +539,36 @@ $(document.getElementById('tr_' + track)).remove(); imageV2.highlightRegion(); $(this).attr('class', 'hiddenText'); } else $(this).attr('class', 'normalText'); setCartVar(track,$(this).val()); return false; }); // Now we can rid the submt of the burden of all those vis boxes var form = $('form#TrackForm'); $(form).submit(function () { $('select.normalText,select.hiddenText').attr('disabled',true); }); $(form).attr('method','get'); + }, + restoreFromBackButton: function() + // Re-enabling vis dropdowns is necessarty because intiForAjax() disables them on submit. + { + $('select.normalText,select.hiddenText').attr('disabled',false); } } //////////////////////////////////////////////////////////// // dragSelect is also known as dragZoom or shift-dragZoom // //////////////////////////////////////////////////////////// var dragSelect = { areaSelector: null, // formerly "imgAreaSelect". jQuery element used for imgAreaSelect originalCursor: null, startTime: null, selectStart: function (img, selection) { initVars(); @@ -3350,30 +3355,32 @@ imageV2.markAsCleanPage(); // Only forcing a full page refresh if chrom changes var cachedChrom = decodeURIComponent(cachedPos).split(':')[0]; var curChrom = decodeURIComponent( curPos).split(':')[0]; if (cachedChrom == curChrom) { imageV2.navigateInPlace("db="+getDb()+"&position=" + cachedPos, null, false); } else { imageV2.fullReload(); } } else { // B2) Clean page: only position changes from a->b if (cachedPos != curPos) { imageV2.navigateInPlace("db="+getDb()+"&position=" + cachedPos, null, false); } } + // Special because FF is leaving vis drop-downs disabled + vis.restoreFromBackButton(); } }, setInHistory: function (fullPageLoad) { // Keep a position history and allow the back-button to work (sort of) // replaceState on initial page load, pushState on each advance // When call triggered by back button, the lastPos==newPos, so no action. var lastPos = imageV2.history.getState().data.position; var newPos = encodeURIComponent(genomePos.get().replace(/,/g,'')); // no commas // A full page load could be triggered by back-button, but then there will be a lastPos // if this is the case then don't set the position in history again! if (fullPageLoad && lastPos != undefined) return; @@ -3530,49 +3537,59 @@ // Turn on drag scrolling. $("div.scroller").panImages(); } //$("#zoomSlider").slider({ min: -4, max: 3, step: 1 });//, handle: '.ui-slider-handle' }); // Retrieve tracks via AJAX that may take too long to draw initialliy (i.e. a remote bigWig) var retrievables = $('#imgTbl').find("tr.mustRetrieve") if($(retrievables).length > 0) { $(retrievables).each( function (i) { var trackName = $(this).attr('id').substring(3); imageV2.requestImgUpdate(trackName,"",""); }); } imageV2.loadRemoteTracks(); makeItemsByDrag.load(); + + // Any highlighted region must be shown and warnBox must play nice with it. imageV2.highlightRegion(); + // When warnBox is dismissed, any image highlight needs to be redrawn. + $('#warnOK').click(function (e) { imageV2.highlightRegion()}); + // Also entend the function that shows the warn box so that it too redraws the highlight. + showWarnBox = (function (oldShowWarnBox) { + function newShowWarnBox() { + oldShowWarnBox.apply(); + imageV2.highlightRegion(); + } + return newShowWarnBox; + })(showWarnBox); } // Drag select in chromIdeogram if($('img#chrom').length == 1) { if($('area.cytoBand').length >= 1) { $('img#chrom').chromDrag(); } } // Track search uses tabs trackSearch.init(); // Drag select initialize if (imageV2.enabled) { // moved from window.load(). dragSelect.load(true); if($('#hgTrackUiDialog')) $('#hgTrackUiDialog').hide(); // Don't load contextMenu if jquery.contextmenu.js hasn't been loaded if (jQuery.fn.contextMenu) { rightClick.load(imageV2.imgTbl); } } // jquery.history.js Back-button support if (imageV2.enabled && imageV2.backSupport) { imageV2.setupHistory(); } - // When warn box is dismissed, any image highlight needs to be redrawn. - $('#warnOK').click(function (e) { imageV2.highlightRegion()}); });