70e9ea7bd548e2b1a0a57a1766749d32fa93c59c larrym Wed Aug 17 17:37:01 2011 -0700 abandon attempt at in-place update when user hits back button b/c it wasn't restoring track order; use boolean type values in the dirty hidden diff --git src/hg/js/hgTracks.js src/hg/js/hgTracks.js index 7942a53..c56e4d1 100644 --- src/hg/js/hgTracks.js +++ src/hg/js/hgTracks.js @@ -133,40 +133,40 @@ if(ele != null) { return ele.value; } return null; } function getOriginalPosition() { return originalPosition || getPosition(); } function markAsDirtyPage() { // Page is marked as dirty so that the backbutton can be overridden var dirty = $('#dirty'); if (dirty != undefined && dirty.length != 0) - $(dirty).val('yes'); + $(dirty).val('true'); } function isDirtyPage() { // returns true if page was marked as dirty // This will allow the backbutton to be overridden var dirty = $('#dirty'); if (dirty != undefined && dirty.length > 0) { - if ($(dirty).val() == 'yes') + if ($(dirty).val() == 'true') return true; } return false; } function setPosition(position, size) { // Set value of position and size (in hiddens and input elements). // We assume size has already been commified. // Either position or size may be null. if(position) { // There are multiple tags with name == "position" (one in TrackHeaderForm and another in TrackForm). var tags = document.getElementsByName("position"); for (var i = 0; i < tags.length; i++) { var ele = tags[i]; @@ -1375,40 +1375,38 @@ thisForm=$("FORM"); if($(thisForm).length > 1 ) thisForm=$(thisForm)[0]; if(thisForm != undefined && $(thisForm).length == 1) { //alert("posting form:"+$(thisForm).attr('name')); return postTheForm($(thisForm).attr('name'),obj.href); } return true; } $(document).ready(function() { // 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. - initVars(); if (isDirtyPage()) { + // mark as non dirty to avoid infinite loop in chrome. + $('#dirty').val('false'); jQuery('body').css('cursor', 'wait'); - if(inPlaceUpdate) - navigateInPlace("", null); - else { window.location = "../cgi-bin/hgTracks?hgsid=" + getHgsid(); return false; } - } + initVars(); var db = getDb(); if(jQuery.fn.autocomplete && $('input#suggest') && db) { if(newJQuery) { $('input#suggest').autocomplete({ delay: 500, minLength: 2, source: ajaxGet(function () {return db;}, new Object, true), open: function(event, ui) { var pos = $(this).offset().top + $(this).height(); if (!isNaN(pos)) { var maxHeight = $(window).height() - pos - 30; // take off a little more because IE needs it var auto = $('.ui-autocomplete'); var curHeight = $(auto).children().length * 21; if (curHeight > maxHeight) $(auto).css({maxHeight: maxHeight+'px',overflow:'scroll'});