61b5e11ec9bcc55bf7566ce4d176c7caff2bdf59 tdreszer Fri May 16 13:29:22 2014 -0700 Fixed setTimeouts (thanks Angie) and marked some code as possibly DEAD. diff --git src/hg/js/alleles.js src/hg/js/alleles.js index 2a81e7c..e702025 100644 --- src/hg/js/alleles.js +++ src/hg/js/alleles.js @@ -97,32 +97,33 @@ } } function persistThroughUpdates() { // When an ajax update occurs, restore the non-ajax settings state // See if table was sorted previously if (persistSortColId !== '') { var col = $('table#alleles').find('TH#' + persistSortColId); if (col && col.length !== 0) { var colIx = Number( $(col).attr('cellIndex') ); $(col).click(); if (persistSortReverse) {// click twice if reverse order! persistSortReverse = false; // Needed so that it is set again - setTimeout("$('table#alleles').find('TH#" + persistSortColId + - "').click();", 50); + setTimeout(function() { + $('table#alleles').find('TH#' + persistSortColId).click(); + }, 50); } } } // Make sure that sort command saves the coumn for persistence $('table#alleles').find('TH').click(function (e) { afterSort(this); }); // Persist on lighlite as red if (hiliteId !== '') hiliteSpecial( hiliteId ); } function propgateTitle(obj) { // Adds this objects title to all other objs with the same class // Relies upon a span and fixed width text @@ -389,31 +390,31 @@ var tripletButton = normed( $('input#'+sectionName+'_triplets') ); if (tripletButton && $(tripletButton).val().indexOf('Show') === -1) seqCharsPerPos = 3; seqPxPerPos = 7; var fullSeqHeader = normed( $(tbl).find('TH.seq') ); if (fullSeqHeader) { var seqLen = $(fullSeqHeader).text().length; //if (seqCharsPerPos === 3) // seqLen /= 2; seqPxPerPos = Math.round( $(fullSeqHeader).width() / (seqLen / seqCharsPerPos)); if ($.browser.msie) seqPxPerPos = $(fullSeqHeader).width() / (seqLen / seqCharsPerPos); } // Highlight variants in full sequence - setTimeout(alleles.delayedHilites(), 200); // Delay till after page settles + setTimeout(alleles.delayedHilites, 200); // Delay till after page settles // Want to sort on previos column if there was a sort before ajax update persistThroughUpdates(); } }; }()); // end & invocation of function that makes alleles // The following js depends upon the jQuery library $(document).ready(function() { // Gene Alleles table is sortable alleles.initialize(); // This is really hgGene specific at this point...