Mercurial > defr > drupal > scald > dnd
diff js/dnd.js @ 4:c2eb995212bf
TONS of fixes in this commit.
author | David Eads <eads@chicagotech.org> |
---|---|
date | Thu, 19 Feb 2009 12:33:19 -0600 |
parents | 5df0783706f7 |
children | 99ba5941779c |
line wrap: on
line diff
--- a/js/dnd.js Tue Feb 17 15:46:36 2009 -0600 +++ b/js/dnd.js Thu Feb 19 12:33:19 2009 -0600 @@ -85,10 +85,11 @@ (function($) { $.fn.dnd = function(opt) { opt = $.extend({}, { - dropWrapper: '<p class="dnd-inserted"></p>', + dropWrapper: '<p class="dnd-dropped"></p>', insertBefore: '', insertAfter: '', processedClass: 'dnd-processed', + disableClick: true, processTargets: function(targets) { return targets.each(function() { @@ -145,12 +146,15 @@ return $('#'+ element_id, $(target).contents()); }, - postprocessDrop: function(target, drop) { return; } + postprocessDrop: function(target, drop, element) { + $(element).addClass('dnd-inserted'); + } }, opt); // Initialize plugin var targets = opt.processTargets(opt.targets); + if (opt.disableClick) { this.click(function() { return false; }) } // Process! return this.each(function() { @@ -182,7 +186,7 @@ .after(opt.insertAfter) .wrap(opt.dropWrapper) .replaceWith(opt.renderRepresentation(target, drop, representation_id)); - opt.postprocessDrop(target, drop); + opt.postprocessDrop(target, drop, element); } }, 100); // @TODO track the timer with $.data() so we can clear it?