Reedy has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/118953

Change subject: Fixup whitespace of jOrgChart.js
......................................................................

Fixup whitespace of jOrgChart.js

Change-Id: I2bea54cbacc53071ce571b52d5a6c33fc46fee40
---
M dbtree/js/jquery.jOrgChart.js
1 file changed, 159 insertions(+), 164 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/operations/software 
refs/changes/53/118953/1

diff --git a/dbtree/js/jquery.jOrgChart.js b/dbtree/js/jquery.jOrgChart.js
index 9dfc056..be56c30 100644
--- a/dbtree/js/jquery.jOrgChart.js
+++ b/dbtree/js/jquery.jOrgChart.js
@@ -5,7 +5,7 @@
  * http://twitter.com/wesnolte
  *
  * Based on the work of Mark Lee
- * http://www.capricasoftware.co.uk 
+ * http://www.capricasoftware.co.uk
  *
  * This software is licensed under the Creative Commons Attribution-ShareAlike
  * 3.0 License.
@@ -15,129 +15,124 @@
  */
 (function($) {
 
-  $.fn.jOrgChart = function(options) {
-    var opts = $.extend({}, $.fn.jOrgChart.defaults, options);
-    var $appendTo = $(opts.chartElement);
+$.fn.jOrgChart = function(options) {
+       var opts = $.extend({}, $.fn.jOrgChart.defaults, options);
+       var $appendTo = $(opts.chartElement);
 
        // build the tree
-    $this = $(this);
-    var $container = $("<div class='" + opts.chartClass + "'/>");
-    if($this.is("ul")) {
-      buildNode($this.find("li:first"), $container, 0, opts);
-    }
-    else if($this.is("li")) {
-      buildNode($this, $container, 0, opts);
-    }
-    $appendTo.append($container);
+       $this = $(this);
+       var $container = $("<div class='" + opts.chartClass + "'/>");
+       if($this.is("ul")) {
+               buildNode($this.find("li:first"), $container, 0, opts);
+       }
+       else if($this.is("li")) {
+               buildNode($this, $container, 0, opts);
+       }
+       $appendTo.append($container);
 
        // add drag and drop if enabled
        if(opts.dragAndDrop){
                $('div.node').draggable({
                        cursor          : 'move',
                        distance        : 40,
-                       helper      : 'clone',
+                       helper          : 'clone',
                        opacity         : 0.8,
-                       revert      : true,
-                       revertDuration : 100,
+                       revert          : true,
+                       revertDuration: 100,
                        snap            : 'div.node.expanded',
                        snapMode        : 'inner',
                        stack           : 'div.node'
                });
-               
+
                $('div.node').droppable({
-                       accept      : '.node',                  
-                       activeClass : 'drag-active',
+                       accept          : '.node',
+                       activeClass     : 'drag-active',
                        hoverClass      : 'drop-hover'
                });
-               
-         // Drag start event handler for nodes
-         $('div.node').bind("dragstart", function handleDragStart( event, ui ){
-               
-               var sourceNode = $(this);
-               sourceNode.parentsUntil('.node-container')
-                                  .find('*')
-                                  .filter('.node')
-                                  .droppable('disable');
-         });
 
-         // Drag stop event handler for nodes
-         $('div.node').bind("dragstop", function handleDragStop( event, ui ){
-
-               /* reload the plugin */
-               $(opts.chartElement).children().remove();
-               $this.jOrgChart(opts);          
-         });
-       
-         // Drop event handler for nodes
-         $('div.node').bind("drop", function handleDropEvent( event, ui ) {    
-           var sourceNode = ui.draggable;
-               var targetNode = $(this);
-               
-               // finding nodes based on plaintext and html
-               // content is hard!
-               var targetLi = $('li').filter(function(){
-                       
-                       li = $(this).clone()
-                                               .children("ul,li")
-                                               .remove()
-                                       .end();
-                       
-                       return li.html() == targetNode.html();
-               });             
-               
-               var sourceLi = $('li').filter(function(){
-                       
-                       li = $(this).clone()
-                                               .children("ul,li")
-                                               .remove()
-                                       .end();
-                       
-                       return li.html() == sourceNode.html();
+               // Drag start event handler for nodes
+               $('div.node').bind("dragstart", function handleDragStart( 
event, ui ){
+                       var sourceNode = $(this);
+                       sourceNode.parentsUntil('.node-container')
+                               .find('*')
+                               .filter('.node')
+                               .droppable('disable');
                });
-               
-               var sourceliClone = sourceLi.clone();
-               var sourceUl = sourceLi.parent('ul');
-               
-               if(sourceUl.children('li').size() > 1){
-                       sourceLi.remove();                      
-               }else{
-                       sourceUl.remove();
-               }
-               
-               if(targetLi.children('ul').size() >0){
-                       
targetLi.children('ul').append('<li>'+sourceliClone.html()+'</li>');            
-               }else{
-                       
targetLi.append('<ul><li>'+sourceliClone.html()+'</li></ul>');                  
                
-               }
-               
-         }); // handleDropEvent
-               
+
+               // Drag stop event handler for nodes
+               $('div.node').bind("dragstop", function handleDragStop( event, 
ui ){
+                       /* reload the plugin */
+                       $(opts.chartElement).children().remove();
+                       $this.jOrgChart(opts);
+               });
+
+               // Drop event handler for nodes
+               $('div.node').bind("drop", function handleDropEvent( event, ui 
) {
+                       var sourceNode = ui.draggable;
+                       var targetNode = $(this);
+
+                       // finding nodes based on plaintext and html
+                       // content is hard!
+                       var targetLi = $('li').filter(function(){
+                               li = $(this).clone()
+                                       .children("ul,li")
+                                       .remove()
+                                       .end();
+                               return li.html() == targetNode.html();
+                       });
+
+                       var sourceLi = $('li').filter(function(){
+                               li = $(this).clone()
+                                       .children("ul,li")
+                                       .remove()
+                                       end();
+
+                               return li.html() == sourceNode.html();
+                       });
+
+                       var sourceliClone = sourceLi.clone();
+                       var sourceUl = sourceLi.parent('ul');
+
+                       if(sourceUl.children('li').size() > 1){
+                               sourceLi.remove();
+                       }else{
+                               sourceUl.remove();
+                       }
+
+                       if(targetLi.children('ul').size() >0){
+                               
targetLi.children('ul').append('<li>'+sourceliClone.html()+'</li>');
+                       }else{
+                               
targetLi.append('<ul><li>'+sourceliClone.html()+'</li></ul>');
+                       }
+
+               }); // handleDropEvent
+
        } // Drag and drop
-  };
+};
 
-  // Option defaults
-  $.fn.jOrgChart.defaults = {
+// Option defaults
+$.fn.jOrgChart.defaults = {
        chartElement : 'body',
-    depth      : -1,
-    chartClass : "jOrgChart",
+       depth      : -1,
+       chartClass : "jOrgChart",
        dragAndDrop: false
-  };
+};
 
-  // Method that recursively builds the tree
-  function buildNode($node, $appendTo, level, opts) {
-       
-    var $table = $("<table cellpadding='0' cellspacing='0' border='0'/>");
-    var $tbody = $("<tbody/>");
+// Method that recursively builds the tree
+function buildNode($node, $appendTo, level, opts) {
+
+       var $table = $("<table cellpadding='0' cellspacing='0' border='0'/>");
+       var $tbody = $("<tbody/>");
 
        // Construct the node container(s)
-    var $nodeRow = $("<tr/>").addClass("node-cells");
-    var $nodeCell = $("<td/>").addClass("node-cell").attr("colspan", 2);
-    var $childNodes = $node.children("ul:first").children("li");
-    var $nodeDiv;
-       
-    if($childNodes.length > 1) {
-      $nodeCell.attr("colspan", $childNodes.length * 2);
-    }
+       var $nodeRow = $("<tr/>").addClass("node-cells");
+       var $nodeCell = $("<td/>").addClass("node-cell").attr("colspan", 2);
+       var $childNodes = $node.children("ul:first").children("li");
+       var $nodeDiv;
+
+       if($childNodes.length > 1) {
+         $nodeCell.attr("colspan", $childNodes.length * 2);
+       }
        // Draw the node
        // Get the contents - any markup except li and ul allowed
        var $nodeContent = $node.clone()
@@ -145,14 +140,14 @@
                                                        .remove()
                                                .end()
                                                .html();
-                                               
-    $nodeDiv = $("<div>").addClass("node").append($nodeContent);
+
+       $nodeDiv = $("<div>").addClass("node").append($nodeContent);
 
        // Expand and contract nodes
-    /* $nodeDiv.click(function() {
-      var $this = $(this);
-      var $tr = $this.closest("tr");
-      $tr.nextAll("tr").fadeToggle("fast");
+       /* $nodeDiv.click(function() {
+         var $this = $(this);
+         var $tr = $this.closest("tr");
+         $tr.nextAll("tr").fadeToggle("fast");
 
          if($tr.hasClass('contracted')){
                $this.css('cursor','n-resize');
@@ -161,71 +156,71 @@
                $this.css('cursor','s-resize');
                $tr.addClass('contracted');
          }
-    }); */
-       
-    $nodeCell.append($nodeDiv);
-    $nodeRow.append($nodeCell);
-    $tbody.append($nodeRow);
+       }); */
 
-    if($childNodes.length > 0) {
-         // if it can be expanded then change the cursor
-         $nodeDiv.css('cursor','n-resize').addClass('expanded');
-       
-         // recurse until leaves found (-1) or to the level specified
-      if(opts.depth == -1 || (level+1 < opts.depth)) { 
-        var $downLineRow = $("<tr/>");
-        var $downLineCell = $("<td/>").attr("colspan", $childNodes.length*2);
-        $downLineRow.append($downLineCell);
-        
-               // draw the connecting line from the parent node to the 
horizontal line 
-               $downLine = $("<div></div>").addClass("line down");
-               $downLineCell.append($downLine);
-        $tbody.append($downLineRow);
+       $nodeCell.append($nodeDiv);
+       $nodeRow.append($nodeCell);
+       $tbody.append($nodeRow);
 
-        // Draw the horizontal lines
-        var $linesRow = $("<tr/>");
-        $childNodes.each(function() {
-          var $left = $("<td>&nbsp;</td>").addClass("line left top");
-          var $right = $("<td>&nbsp;</td>").addClass("line right top");
-          $linesRow.append($left).append($right);
-        });
+       if($childNodes.length > 0) {
+               // if it can be expanded then change the cursor
+               $nodeDiv.css('cursor','n-resize').addClass('expanded');
 
-               // horizontal line shouldn't extend beyond the first and last 
child branches
-        $linesRow.find("td:first")
-                                       .removeClass("top")
-                                .end()
-                                .find("td:last")
-                                       .removeClass("top");
+               // recurse until leaves found (-1) or to the level specified
+               if(opts.depth == -1 || (level+1 < opts.depth)) {
+                       var $downLineRow = $("<tr/>");
+                       var $downLineCell = $("<td/>").attr("colspan", 
$childNodes.length*2);
+                       $downLineRow.append($downLineCell);
 
-        $tbody.append($linesRow);
-        var $childNodesRow = $("<tr/>");
-        $childNodes.each(function() {
-           var $td = $("<td class='node-container'/>");
-           $td.attr("colspan", 2);
-                  // recurse through children lists and items
-           buildNode($(this), $td, level+1, opts);
-           $childNodesRow.append($td);
-        });
+                       // draw the connecting line from the parent node to the 
horizontal line
+                       $downLine = $("<div></div>").addClass("line down");
+                       $downLineCell.append($downLine);
+                       $tbody.append($downLineRow);
 
-      }
-      $tbody.append($childNodesRow);
-    }
+                       // Draw the horizontal lines
+                       var $linesRow = $("<tr/>");
+                       $childNodes.each(function() {
+                               var $left = $("<td>&nbsp;</td>").addClass("line 
left top");
+                               var $right = 
$("<td>&nbsp;</td>").addClass("line right top");
+                               $linesRow.append($left).append($right);
+                       });
 
-    // any classes on the LI element get copied to the relevant node in the 
tree
-    // apart from the special 'collapsed' class, which collapses the sub-tree 
at this point
-    if ($node.attr('class') != undefined) {
-        var classList = $node.attr('class').split(/\s+/);
-        $.each(classList, function(index,item) {
-            if (item == 'collapsed') {
-                $nodeRow.nextAll('tr').css('display', 'none');
-            } else {
-                $nodeDiv.addClass(item);
-            }
-        });
-    }
+                       // horizontal line shouldn't extend beyond the first 
and last child branches
+                       $linesRow.find("td:first");
+                       removeClass("top")
+                               .end()
+                               .find("td:last")
+                               .removeClass("top");
 
-    $table.append($tbody);
-    $appendTo.append($table);
-  };
+                       $tbody.append($linesRow);
+                       var $childNodesRow = $("<tr/>");
+                       $childNodes.each(function() {
+                               var $td = $("<td class='node-container'/>");
+                               $td.attr("colspan", 2);
+                               // recurse through children lists and items
+                               buildNode($(this), $td, level+1, opts);
+                               $childNodesRow.append($td);
+                       });
+
+               }
+               $tbody.append($childNodesRow);
+       }
+
+       // any classes on the LI element get copied to the relevant node in the 
tree
+       // apart from the special 'collapsed' class, which collapses the 
sub-tree at this point
+       if ($node.attr('class') != undefined) {
+               var classList = $node.attr('class').split(/\s+/);
+               $.each(classList, function(index,item) {
+                       if (item == 'collapsed') {
+                               $nodeRow.nextAll('tr').css('display', 'none');
+                       } else {
+                               $nodeDiv.addClass(item);
+                       }
+               });
+       }
+
+       $table.append($tbody);
+       $appendTo.append($table);
+};
 
 })(jQuery);

-- 
To view, visit https://gerrit.wikimedia.org/r/118953
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I2bea54cbacc53071ce571b52d5a6c33fc46fee40
Gerrit-PatchSet: 1
Gerrit-Project: operations/software
Gerrit-Branch: master
Gerrit-Owner: Reedy <re...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to