ba7ad16b0529fba7a8c2c66311cb5bf654eb53a3 tdreszer Tue Mar 4 13:48:31 2014 -0800 Adding hgsid back into the visible (shortened URL). Occassoinally this URL is used automatically by the browser/history plugin to refresh the page. The result was multiplying cart sessions. Redmine #12819. Also in this check-in, changes by Ted Goldstein to replace regex pattern mapping with standard js calls. This should have no functional effect on our browser, othere than allowing redirections from MedBook to work. diff --git src/hg/js/hgTracks.js src/hg/js/hgTracks.js index 9c6ae91..042d8fd 100644 --- src/hg/js/hgTracks.js +++ src/hg/js/hgTracks.js @@ -2834,68 +2834,65 @@ imageV2.loadRemoteTracks(); makeItemsByDrag.load(); imageV2.loadSuggestBox(); imageV2.highlightRegion(); if (imageV2.backSupport) { imageV2.setInHistory(false); // Set this new position into History stack } else { imageV2.markAsDirtyPage(); } }, updateImgForId: function (html, id, fullImageReload, newJsonRec) { // update row in imgTbl for given id. // return true if we successfully pull slice for id and update it in imgTrack. - var str = "]*>([\\s\\S]+?)"; - var reg = new RegExp(str); - var a = reg.exec(html); - if(a && a[1]) { + var newTr = $(html).find("tr[id='tr_" + id + "']"); + if (newTr.length > 0) { var tr = $(document.getElementById("tr_" + id)); if (tr.length > 0) { - $(tr).html(a[1]); + $(tr).html(newTr.children()) // Need to update tr class list too - str = ""; - reg = new RegExp(str); - var classes = reg.exec(html); + + var classes = $(html).find("tr[id='tr_"+ id + "']")[0].className.split(/\s+/) + if(classes && classes[1] && classes[1].length > 0) { $(tr).removeClass(); $(tr).addClass(classes[1]); } // NOTE: Want to examine the png? Uncomment: //var img = $('#tr_' + id).find("img[id^='img_data_']").attr('src'); //warn("Just parsed image:
"+img); // >1x dragScrolling needs some extra care. if(hgTracks.imgBoxPortal && (hgTracks.imgBoxWidth > hgTracks.imgBoxPortalWidth)) { if (hgTracks.imgBoxPortalLeft != undefined) { $(tr).find('.panImg').css({'left': hgTracks.imgBoxPortalLeft }); $(tr).find('.tdData').css( {'backgroundPosition': hgTracks.imgBoxPortalLeft}); } } // Need to update vis box (in case this is reached via back-button) if (imageV2.backSupport && fullImageReload) { // Update abbr so that rows can be resorted properly - str = " 0) { - $(tr).attr('abbr',abbr[1]); + var abbr = $(newTr).attr('abbr'); + + if(abbr) { + $(tr).attr('abbr', abbr); } if (newJsonRec) vis.update(id, vis.enumOrder[newJsonRec.visibility]); } return true; } } return false; }, updateImgForAllIds: function (response, oldJson, newJson) { // update all rows in imgTbl based upon navigateInPlace response. var imgTbl = $('#imgTbl'); @@ -3384,38 +3381,39 @@ // 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; if (lastPos == undefined || lastPos == null || lastPos != newPos) { // Swap the position into the title var title = $('TITLE')[0].text; var ttlWords = title.split(' '); if (ttlWords.length >= 2) { ttlWords[1] = genomePos.get(); title = ttlWords.join(' ') } else title = genomePos.get() + var sid = getHgsid(); // Wish you were here! Come on, someone must catch this. if (fullPageLoad) { // Should only be on initial set-up: first navigation to page - imageV2.history.replaceState({position: newPos, hgsid: + getHgsid()},title, - "hgTracks?db=" + getDb() + "&position=" + newPos); + imageV2.history.replaceState({position: newPos, hgsid: + sid },title, + "hgTracks?db=" + getDb() + "&position=" + newPos + "&hgsid="+sid); } else { // Should be when advancing (not-back-button) imageV2.history.pushState({position: newPos, hgsid: + getHgsid()},title, - "hgTracks?db=" + getDb() + "&position=" + newPos); + "hgTracks?db=" + getDb() + "&position=" + newPos + "&hgsid="+sid); } } } } ////////////////////// //// track search //// ////////////////////// var trackSearch = { searchKeydown: function (event) { if (event.which == 13) { // Required to fix problem on IE and Safari where value of hgt_tSearch is "-" (i.e. not "Search").