Mercurial > defr > drupal > scald > dnd
comparison 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 |
comparison
equal
deleted
inserted
replaced
| 24:4f58fa0a9a6d | 25:e71df38143d1 |
|---|---|
| 160 }; | 160 }; |
| 161 | 161 |
| 162 // Add a special class | 162 // Add a special class |
| 163 $(element).addClass(opt.processedClass); | 163 $(element).addClass(opt.processedClass); |
| 164 | 164 |
| 165 // Data for custom event | |
| 166 var event_data = {'drop': element, 'representation_id': representation_id}; | |
| 167 | |
| 165 // We need to differentiate behavior based on the targets | 168 // We need to differentiate behavior based on the targets |
| 166 targets.each(function() { | 169 targets.each(function() { |
| 167 var target = this, $target = $(target); | 170 var target = this, $target = $(target); |
| 168 if ($target.is('iframe')) { | 171 if ($target.is('iframe')) { |
| 169 $(element).addClass(opt.iframeTargetClass); | 172 $(element).addClass(opt.iframeTargetClass); |
| 170 $(element).click(function() { | 173 $(element).click(function() { |
| 171 opt.processIframeClick.call(target, element, representation_id); | 174 opt.processIframeClick.call(target, element, representation_id); |
| 175 $(target).trigger('dnd_drop', event_data); | |
| 172 }); | 176 }); |
| 173 } else if ($target.is('textarea')) { | 177 } else if ($target.is('textarea')) { |
| 174 $(element).addClass(opt.textareaTargetClass); | 178 $(element).addClass(opt.textareaTargetClass); |
| 175 $(element).click(function() { | 179 $(element).click(function() { |
| 176 opt.processTextAreaClick.call(target, element, representation_id); | 180 opt.processTextAreaClick.call(target, element, representation_id); |
| 181 $(target).trigger('dnd_drop', event_data); | |
| 177 }); | 182 }); |
| 178 } | 183 } |
| 179 }); | 184 }); |
| 180 } | 185 } |
| 181 }); | 186 }); |
