1eb8ec038e5e2153d73aa387a289ade2019075fd tdreszer Fri Oct 1 14:34:22 2010 -0700 Katrina wants 'View in Browser' button to reflect user's changes rather than whether tracks are checked or not. diff --git src/hg/js/hgTracks.js src/hg/js/hgTracks.js index 79b859a..278c0fb 100644 --- src/hg/js/hgTracks.js +++ src/hg/js/hgTracks.js @@ -2278,14 +2278,9 @@ } // The "view in browser" button should be enabled/disabled - if(justClicked) { - if(checked) - $('input.viewBtn').val('View in Browser'); - else if($('input.selCb:checked').length == 0) - $('input.viewBtn').val('Return to Browser'); + if(justClicked) findTracksCounts(); } -} function findTracksNormalize() @@ -2296,7 +2291,6 @@ // All should have their vis enabled/disabled appropriately (false means don't update cart) $(selCbs).each( function(i) { findTracksClickedOne(this,false); }); - findTracksViewButtoneText(); findTracksCounts(); } @@ -2313,7 +2307,6 @@ // All should have their vis enabled/disabled appropriately (false means don't update cart) $(selCbs).each( function(i) { findTracksClickedOne(this,false); }); - findTracksViewButtoneText(); findTracksCounts(); return false; // Pressing button does nothing more } @@ -2323,19 +2316,8 @@ waitOnFunction( findTracksCheckAll, check); } -function findTracksCounts() -{ -// Displays visible and checked track count - var counter = $('.selCbCount'); - if(counter != undefined) { - var selCbs = $("input.selCb"); - $(counter).text("("+$(selCbs).filter(":enabled:checked").length + " of " +$(selCbs).length+ " selected)"); - } -} - function findTracksSearchButtonsEnable(enable) -{ -// Displays visible and checked track count +{ // Displays visible and checked track count var searchButton = $('input[name="hgt_searchTracks"]'); var clearButton = $('input.clear'); if(enable) { @@ -2348,14 +2330,24 @@ } function findTracksViewButtoneText() -{ - var inputs = $('table#foundTracks').find('input:hidden'); - if( $(inputs).length == $(inputs).filter(':disabled').length) +{ // Update View in Browser buttn text + var inputs = $('table#foundTracks').find('input[name!="hgsid"]:hidden:enabled'); + if( $(inputs).length == 0) $('input.viewBtn').val('Return to Browser'); else $('input.viewBtn').val('View in Browser'); } +function findTracksCounts() +{// Displays visible and checked track count + findTracksViewButtoneText(); + var counter = $('.selCbCount'); + if(counter != undefined) { + var selCbs = $("input.selCb"); + $(counter).text("("+$(selCbs).filter(":enabled:checked").length + " of " +$(selCbs).length+ " selected)"); + } +} + function findTracksClear() {// Clear found tracks and all input controls var foundTracks = $('div#found');