src/hg/js/hgTracks.js 1.31

1.31 2009/07/17 18:19:22 tdreszer
Limit GET->PUT logic to when page has a form (CEL search creates 500 links and timeouts). Also played with smothing IE dragScroll.
Index: src/hg/js/hgTracks.js
===================================================================
RCS file: /projects/compbio/cvsroot/kent/src/hg/js/hgTracks.js,v
retrieving revision 1.30
retrieving revision 1.31
diff -b -B -U 4 -r1.30 -r1.31
--- src/hg/js/hgTracks.js	10 Jul 2009 19:49:58 -0000	1.30
+++ src/hg/js/hgTracks.js	17 Jul 2009 18:19:22 -0000	1.31
@@ -279,26 +279,35 @@
     var prevX       = imgOffset*-1;
     var newX        = 0;
     var mouseDownX  = 0;
     var mouseIsDown = false;
+    //var ie=( $.browser.msie == true );
 
     initialize();
 
     function initialize(){
 
         pan.css( 'cursor', 'w-resize');//'move');
 
         pan.mousedown(function(e){
+            if(mouseIsDown == false) {
             mouseIsDown = true;
 
             mouseDownX = e.clientX;
+                //if(ie) {  // Doesn't work (yet?)
+                //    pic.ondrag='panner';
+                //    pic.ondragend='panMouseUp';
+                //} else {
+                    $(document).bind('mousemove',panner);
             $(document).bind( 'mouseup',  panMouseUp);  // Will exec only once
-            $(document).bind('mousemove',panner)
+                //}
             return false;
+            }
         });
     }
 
     function panner(e) {
+        //if(!e) e = window.event;
         if ( mouseIsDown ) {
             var relativeX = (e.clientX - mouseDownX);
 
             if(relativeX != 0) {
@@ -316,14 +325,19 @@
             }
         }
     }
     function panMouseUp(e) {  // Must be a separate function instead of pan.mouseup event.
+        //if(!e) e = window.event;
         if(mouseIsDown) {
-            panner(e);
 
             prevX = newX;
+            //if(ie) {
+            //    pic.ondrag='';
+            //    pic.ondragend='';
+            //} else {
             $(document).unbind('mousemove',panner);
             $(document).unbind('mouseup',panMouseUp);
+            //}
             mouseIsDown = false;
             setTimeout('blockUseMap=false;',50); // Necessary incase the selectEnd was over a map item. select takes precedence.
         }
     }
@@ -360,11 +374,11 @@
 
 $(document).ready(function()
 {
     // Convert map AREA gets to post the form, ensuring that cart variables are kept up to date
+    if($("FORM").length > 0) {
     $('a,area').not("[href*='#']").filter("[target='']").click(function(i) {
         if(blockUseMap==true) {
-            //alert("blockUseMap");
             return false;
         }
         var thisForm=$(this).parents('form');
         if(thisForm == undefined || $(thisForm).length == 0)
@@ -377,8 +391,9 @@
         }
 
         return true;
     });
+    }
     if($('#imgTbl').length == 1) {
         imageV2   = true;
         // Make imgTbl allow draw reorder of imgTrack rows
         if($(".tableWithDragAndDrop").length > 0) {