8ddef5680258d91c8f63369fa09fe6dedf630d7a larrym Thu Aug 4 13:42:43 2011 -0700 turn on mapIsUpdateable in Safari >= 5.1 diff --git src/hg/js/hgTracks.js src/hg/js/hgTracks.js index b76f68d..d8dabba 100644 --- src/hg/js/hgTracks.js +++ src/hg/js/hgTracks.js @@ -10,31 +10,30 @@ var blockUseMap = false; var mapItems; var trackImg; // jQuery element for the track image var trackImgTbl; // jQuery element used for image table under imageV2 var imgAreaSelect; // jQuery element used for imgAreaSelect var originalImgTitle; var autoHideSetting = true; // Current state of imgAreaSelect autoHide setting var selectedMenuItem; // currently choosen context menu item (via context menu). var browser; // browser ("msie", "safari" etc.) var mapIsUpdateable = true; var currentMapItem; var floatingMenuItem; var visibilityStrsOrder = new Array("hide", "dense", "full", "pack", "squish"); // map browser numeric visibility codes to strings var supportZoomCodon = false; // turn on experimental zoom-to-codon functionality (currently only on in larrym's tree). var inPlaceUpdate = false; // modified based on value of hgTracks.inPlaceUpdate and mapIsUpdateable -var allowDragAndZoomEverywhere = false; // true only in larrym's tree (see redmine 4667) /* Data passed in from CGI via the hgTracks object: * * string chromName // current chromosome * int winStart // genomic start coordinate (0-based, half-open) * int winEnd // genomic end coordinate * int newWinWidth // new width if user clicks on the top ruler (in bps) * boolean dragSelection // true if we should allow drag and select * boolean revCmplDisp // true if we are in reverse display * int insideX // width of side-bar (in pixels) * int rulerClickHeight // height of ruler (in pixels) */ function initVars(img) { @@ -237,45 +236,57 @@ // } } // mapHtml = null; startDragZoom = null; setTimeout('blockUseMap=false;',50); // Necessary incase the selectEnd was over a map item. select takes precedence. return true; } $(window).load(function () { jQuery.each(jQuery.browser, function(i, val) { if(val) { browser = i; } }); // jQuery load function with stuff to support drag selection in track img - if(browser == "safari" && navigator.userAgent.indexOf("Chrome") != -1) { + if(browser == "safari") { + if(navigator.userAgent.indexOf("Chrome") != -1) { // Handle the fact that (as of 1.3.1), jQuery.browser reports "safari" when the browser is in fact Chrome. browser = "chrome"; + } else { + // Turn off mapIsUpdateable for safari < version 5.1 because it has a bug which causes updates of map to be ignored. + mapIsUpdateable = false; + var reg = new RegExp("Version\/(\[0-9]+\.\[0-9]+) Safari"); + var a = reg.exec(navigator.userAgent); + if(a && a[1]) { + var version = a[1] * 1; + if(version >= 5.1) { + mapIsUpdateable = true; + } + } + } } // Safari has the following bug: if we update the hgTracks map dynamically, the browser ignores the changes (even // though if you look in the DOM the changes are there); so we have to do a full form submission when the // user changes visibility settings or track configuration. // As of 5.0.4 (7533.20.27) this is problem still exists in safari. // As of 5.1 (7534.50) this problem appears to have been fixed - unfortunately, logs for 7/2011 show vast majority of safari users // are pre-5.1 (5.0.5 is by far the most common). // // Chrome used to have this problem too, but this problem seems to have gone away as of // Chrome 5.0.335.1 (or possibly earlier). - mapIsUpdateable = browser != "safari"; inPlaceUpdate = hgTracks.inPlaceUpdate && mapIsUpdateable; loadImgAreaSelect(true); if($('#hgTrackUiDialog')) $('#hgTrackUiDialog').hide(); // Don't load contextMenu if jquery.contextmenu.js hasn't been loaded if(trackImg && jQuery.fn.contextMenu) { $('#hgTrackUiDialog').hide(); if(imageV2) { $("map[name!=ideoMap]").each( function(t) { parseMap($(this,false));}); } else { // XXXX still under debate whether we have to remove the map parseMap($('#map'),true); $('#map').empty(); }