Mercurial > defr > drupal > scald > dnd
diff js/jquery.draganddrop.js @ 25:e71df38143d1
Added element counting, but there is a bug in textarea click counting -- it only works properly once a count has already been started via another mechanism.
author | David Eads <eads@chicagotech.org> |
---|---|
date | Wed, 11 Mar 2009 14:07:50 -0500 |
parents | 4f58fa0a9a6d |
children | f817d2a5cc0a |
line wrap: on
line diff
--- a/js/jquery.draganddrop.js Wed Mar 11 01:47:57 2009 -0500 +++ b/js/jquery.draganddrop.js Wed Mar 11 14:07:50 2009 -0500 @@ -162,6 +162,9 @@ // Add a special class $(element).addClass(opt.processedClass); + // Data for custom event + var event_data = {'drop': element, 'representation_id': representation_id}; + // We need to differentiate behavior based on the targets targets.each(function() { var target = this, $target = $(target); @@ -169,11 +172,13 @@ $(element).addClass(opt.iframeTargetClass); $(element).click(function() { opt.processIframeClick.call(target, element, representation_id); + $(target).trigger('dnd_drop', event_data); }); } else if ($target.is('textarea')) { $(element).addClass(opt.textareaTargetClass); $(element).click(function() { opt.processTextAreaClick.call(target, element, representation_id); + $(target).trigger('dnd_drop', event_data); }); } });