/*
 Lipstick on the HTML drag and drop pig
 Basically this: http://www.html5rocks.com/en/tutorials/dnd/basics/
 As a jQuery plugin.
 */
(function( $ ) {

  $.event.props.push('dataTransfer')

  $.dd = function (dragSelector, dropSelector, cb) {
    cb = cb || function (dragged, dropTarget, dataTransfer) { $(dropTarget).append(dragged) }

    var dragSrcEl = null

    $(document)
      .on('dragstart', dragSelector, handleDragStart)
      .on('dragend', dragSelector, handleDragEnd)

    $(document)
      .on('dragenter', dropSelector, handleDragEnter)
      .on('dragover', dropSelector, handleDragOver)
      .on('dragleave', dropSelector, handleDragLeave)
      .on('drop', dropSelector, handleDrop(cb))

    return this
  }

  function handleDragStart(e) {
    dragSrcEl = this
    $(this).addClass('dragging')
    e.dataTransfer.effectAllowed = 'move';
    e.dataTransfer.setData('text/html', this.outerHTML);
  }

  function handleDragEnd(e) {
    $('.dragging').removeClass('dragging')
  }

  function handleDragEnter(e) {
    $(this).addClass('dragover')
  }

  function handleDragOver(e) {
    $(this).addClass('dragover')
    e.preventDefault()
    e.dataTransfer.dropEffect = 'move'
    return false
  }

  function handleDragLeave(e) {
    $(this).removeClass('dragover')
  }

  function handleDrop(cb) {
    return function (e) {
      e.stopPropagation()
      var dropTarget = this
      var dragged = dragSrcEl
      if (dragged != dropTarget) {
        cb(dragged, dropTarget, e.dataTransfer)
      }

      $('.dragover').removeClass('dragover')
      return false
    }
  }
}( jQuery ))

@@ -403,32 +403,41 @@
 ', dragSelector,
+ function
  handleDragStart
@@ -436,16 +436,199 @@
 ragStart
+(e) %7B%0A        dragSrcEl = this%0A        $(this).addClass('dragging')%0A        e.dataTransfer.effectAllowed = 'move';%0A        e.dataTransfer.setData('text/html', this.outerHTML);%0A      %7D
 )%0A      
@@ -884,236 +884,311 @@
 or, 
-handleDrop(cb))%0A%0A    return this%0A  %7D%0A%0A  function handleDragStart(e) %7B%0A    dragSrcEl = this%0A    $(this).addClass('dragging')%0A    e.dataTransfer.effectAllowed = 'move';%0A    e.dataTransfer.setData('text/html', this.outerHTML);
+function (e) %7B%0A        e.stopPropagation()%0A        var dropTarget = this%0A        var dragged = dragSrcEl%0A        if (dragged != dropTarget) %7B%0A          cb(dragged, dropTarget, e.dataTransfer)%0A        %7D%0A%0A        $('.dragover').removeClass('dragover')%0A        return false%0A      %7D)%0A%0A    return this
 %0A  %7D%0A
+  
 %0A  f
@@ -1557,312 +1557,8 @@
  %7D%0A%0A
-  function handleDrop(cb) %7B%0A    return function (e) %7B%0A      e.stopPropagation()%0A      var dropTarget = this%0A      var dragged = dragSrcEl%0A      if (dragged != dropTarget) %7B%0A        cb(dragged, dropTarget, e.dataTransfer)%0A      %7D%0A%0A      $('.dragover').removeClass('dragover')%0A      return false%0A    %7D%0A  %7D%0A
 %7D( j

Fix scope for dragSrcEl