c901806c24b94d8dd22871f3a2a821b87de04c17
tdreszer
  Mon May 19 16:46:59 2014 -0700
Polished only UCSC changes for jshint.  These 3rd party files modified by UCSC do NOT pass jshint.  But changes are kept to minimum for later disambiguating.
diff --git src/hg/js/jquery.tablednd.js src/hg/js/jquery.tablednd.js
index 2b007d9..c4204e0 100644
--- src/hg/js/jquery.tablednd.js
+++ src/hg/js/jquery.tablednd.js
@@ -134,31 +134,31 @@
             // We only need to add the event to the specified cells
             var cells = jQuery("td."+table.tableDnDConfig.dragHandle, table);
             cells.each(function() {
                 // The cell is bound to "this"
                 jQuery(this).mousedown(function(ev) {
                     if(ev.button > 1)
                         return true;
                     if(jQuery.tableDnD == undefined)
                         return false;
                     jQuery.tableDnD.dragObject = this.parentNode;
                     jQuery.tableDnD.currentTable = table;
                     jQuery.tableDnD.mouseOffset = jQuery.tableDnD.getMouseOffset(this, ev);
                     config.dragStartIndex = $(jQuery.tableDnD.dragObject).attr('rowIndex');
                     if (config.onDragStart) {
                         // Call the onDrop method if there is one
-                        config.onDragStart(ev, table, this.parentNode);
+                        config.onDragStart(ev, table, this.parentNode);  // UCSC
                     }
 
                     /////// UCSC
                     // Initialize oldY to avoid movingDown as first action
                     jQuery.tableDnD.oldY = jQuery.tableDnD.mouseCoords(ev).y - jQuery.tableDnD.mouseOffset.y;
 
                     // Capture the mouse move events only if dragStart
                     jQuery(document)
                         .bind('mousemove', jQuery.tableDnD.mousemove)
                         .bind('mouseup', jQuery.tableDnD.mouseup);
 
                     config.downOffset = 0;
                     config.upOffset = 0;
                     if (config.dragObjects.length > 1) {
                         for(var ix = 0; ix < config.dragObjects.length; ix++) {
@@ -248,32 +248,33 @@
 
         while (e.offsetParent){
             left += e.offsetLeft;
             top  += e.offsetTop;
             e     = e.offsetParent;
         }
 
         left += e.offsetLeft;
         top  += e.offsetTop;
 
         ///////return {x:left, y:top};
         return {x:left, y:top, height:eHeight};  ///////////// Height was added by tim because of tall tracks
     },
 
     mousemove: function(ev) {
-        if(jQuery.tableDnD == undefined
-        || jQuery.tableDnD.dragObject == null) {  //// UCSC Binding should occur at dragStart
+        /* jshint -W014 */  // Don't complain about line break before '||' etc:
+        if(jQuery.tableDnD === undefined
+        || jQuery.tableDnD.dragObject === null) {  //// UCSC Binding should occur at dragStart
             jQuery(document)
                 .unbind('mousemove')//, jQuery.tableDnD.mousemove);
                 .unbind('mouseup');//, jQuery.tableDnD.mouseup);
             return;
         }
         ///// UCSC if (jQuery.tableDnD.dragObject == null) {
         ///// UCSC     return;
         ///// UCSC }
 
         var dragObj = jQuery(jQuery.tableDnD.dragObject);
         var config = jQuery.tableDnD.currentTable.tableDnDConfig;
         var mousePos = jQuery.tableDnD.mouseCoords(ev);
         var y = mousePos.y - jQuery.tableDnD.mouseOffset.y;
 
         //auto scroll the window
@@ -341,48 +342,50 @@
                 if (movingDown)
                     currentRow = jQuery.tableDnD.findDropTargetRow(rows[lastDragRowIx], y + config.downOffset);
                 else
                     currentRow = jQuery.tableDnD.findDropTargetRow(rows[firstDragRowIx], y + config.upOffset);
             } else  ////// UCSC
                 currentRow = jQuery.tableDnD.findDropTargetRow(dragObj, y);
 
 
             if (currentRow) {
 
                 ////// UCSC
                 if (config.dragObjects.length > 1) {
                     var targetRowIx = $( currentRow ).attr('rowIndex');
                     if (targetRowIx >= 0 && targetRowIx < rows.length) {
 
+                        var plusIx=0;
+                        var rIx;
                         if (movingDown) { // && config.dragObjects[config.dragObjects.length - 1] != currentRow) {
                             // A whole new tack:  since movingUp never fails, always move target (and others) up
                             if ((lastDragRowIx - firstDragRowIx) == (config.dragObjects.length - 1)
                             &&  firstDragRowIx >= 0
                             &&  lastDragRowIx < targetRowIx) {
-                                var plusIx=0;
-                                for(var ix=lastDragRowIx+1; ix <= targetRowIx; ix++) {
-                                    $( rows[ix] ).insertBefore( $( rows[firstDragRowIx + plusIx] ) );
+                                plusIx=0;
+                                for(rIx=lastDragRowIx+1; rIx <= targetRowIx; rIx++) {
+                                    $( rows[rIx] ).insertBefore( $( rows[firstDragRowIx + plusIx] ) );
                                     plusIx++;
                                 }
                             }
                         } else if (!movingDown) { // && config.dragObjects[0] != currentRow) {
                             if ((lastDragRowIx - firstDragRowIx) == (config.dragObjects.length - 1)
                             &&  firstDragRowIx >= 0
                             &&  firstDragRowIx > targetRowIx) {
-                                var plusIx=0;
-                                for(var ix=firstDragRowIx; ix <= lastDragRowIx; ix++) {
-                                    $(rows[ix]).insertBefore( rows[targetRowIx + plusIx] );
+                                plusIx=0;
+                                for(rIx=firstDragRowIx; rIx <= lastDragRowIx; rIx++) {
+                                    $(rows[rIx]).insertBefore( rows[targetRowIx + plusIx] );
                                     plusIx++;
                                 }
                             }
                         }
                     }
                 } else {  ////// UCSC
 
                     // TODO worry about what happens when there are multiple TBODIES
                     if (movingDown && jQuery.tableDnD.dragObject != currentRow) {
                         jQuery.tableDnD.dragObject.parentNode.insertBefore(jQuery.tableDnD.dragObject, currentRow.nextSibling);
                     } else if (! movingDown && jQuery.tableDnD.dragObject != currentRow) {
                         jQuery.tableDnD.dragObject.parentNode.insertBefore(jQuery.tableDnD.dragObject, currentRow);
                     }
 
                 }   ////// UCSC