Author: jablko
Date: Wed Oct 20 18:00:00 2010
New Revision: 8343

Log:
Indentation

Modified:
   trunk/js/multiInput.js

Modified: trunk/js/multiInput.js
==============================================================================
--- trunk/js/multiInput.js      Wed Oct 20 17:55:19 2010        (r8342)
+++ trunk/js/multiInput.js      Wed Oct 20 18:00:00 2010        (r8343)
@@ -7,7 +7,7 @@
         {
           $('ul.multiInput', context).children('li').click(function (event)
             {
-              if (event.target == this)
+              if (this === event.target)
               {
                 // On click, remove <li>
                 $(this).hide('fast', function ()
@@ -15,10 +15,9 @@
                     $(this).remove();
                   });
               }
-            }
-          )
+            });
 
-          $('input.multiInput', context).each(function()
+          $('input.multiInput', context).each(function ()
             {
               var thisName = this.name;
 
@@ -28,58 +27,57 @@
 
                 // Catch blur, click or keypress events
                 .bind('blur click keydown', function (event)
-                {
-                  if ($(this).data('counter') == undefined)
                   {
-                    $(this).data('counter', 0);
-                  }
-                  var counter = $(this).data('counter');
-
-                  // Don't fire on keypress other than Tab (9) or Enter (13) 
key
-                  if ($(this).val() && ('keydown' != event.type || 9 == 
event.keyCode || 13 == event.keyCode))
-                  {
-                    // Cancel default action so as not to loose focus
-                    if ('keydown' == event.type)
+                    if ($(this).data('counter') == undefined)
                     {
-                      event.preventDefault();
+                      $(this).data('counter', 0);
                     }
+                    var counter = $(this).data('counter');
 
-                    // Add input value to multInput
-                    var stem = thisName.replace('[new]', '');
-                    var input = '<input id="' + stem + '_new_' + counter + '" 
name="' + stem + '[new' + counter + ']" value="' + this.value + '">';
-                    var li = $('<li>' + input + '</li>');
-
-                    // Bind click event to new list item
-                    li.click(function (event)
+                    // Don't fire on keypress other than Tab (9) or Enter (13) 
key
+                    if ($(this).val() && ('keydown' != event.type || 9 == 
event.keyCode || 13 == event.keyCode))
+                    {
+                      // Cancel default action so as not to loose focus
+                      if ('keydown' == event.type)
                       {
-                        if (event.target == this)
-                        {
-                          // On click, remove <li>
-                          $(this).hide('fast', function ()
-                            {
-                              $(this).remove();
-                            });
-                        }
-                      });
+                        event.preventDefault();
+                      }
 
-                    // Create ul if it doesn't exist
-                    if (0 == $(this).prev('ul.multInput').length)
-                    {
-                      // Add ul element, if it doesn't exist already (new 
object)
-                      var ul = '<ul class="multInput" name="' + stem + 
'"></ul>';
-                      $(this).before(ul);
-                    }
+                      // Add input value to multInput
+                      var stem = thisName.replace('[new]', '');
+                      var input = '<input id="' + stem + '_new_' + counter + 
'" name="' + stem + '[new' + counter + ']" value="' + this.value + '">';
+                      var li = $('<li>' + input + '</li>');
+
+                      // Bind click event to new list item
+                      li.click(function (event)
+                        {
+                          if (event.target == this)
+                          {
+                            // On click, remove <li>
+                            $(this).hide('fast', function ()
+                              {
+                                $(this).remove();
+                              });
+                          }
+                        });
 
-                    // Add li to ul
-                    $(this).prev('ul.multInput').append(li);
+                      // Create ul if it doesn't exist
+                      if (0 == $(this).prev('ul.multInput').length)
+                      {
+                        // Add ul element, if it doesn't exist already (new 
object)
+                        var ul = '<ul class="multInput" name="' + stem + 
'"></ul>';
+                        $(this).before(ul);
+                      }
 
-                    // Clear <input>
-                    this.value = '';
+                      // Add li to ul
+                      $(this).prev('ul.multInput').append(li);
 
-                    $(this).data('counter', ++counter);
-                  }
-                })
-            })
+                      // Clear <input>
+                      this.value = '';
 
+                      $(this).data('counter', ++counter);
+                    }
+                  });
+            });
         } };
   })(jQuery);

-- 
You received this message because you are subscribed to the Google Groups 
"Qubit Toolkit Commits" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/qubit-commits?hl=en.

Reply via email to