publish_my_data 0.0.32 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (182) hide show
  1. data/app/assets/images/publish_my_data/small-spinner.gif +0 -0
  2. data/app/assets/images/publish_my_data/sort-asc.gif +0 -0
  3. data/app/assets/images/publish_my_data/sort-desc.gif +0 -0
  4. data/app/assets/javascripts/bootstrap/affix.js +126 -0
  5. data/app/assets/javascripts/bootstrap/alert.js +98 -0
  6. data/app/assets/javascripts/bootstrap/button.js +109 -0
  7. data/app/assets/javascripts/bootstrap/carousel.js +217 -0
  8. data/app/assets/javascripts/bootstrap/collapse.js +179 -0
  9. data/app/assets/javascripts/bootstrap/dropdown.js +154 -0
  10. data/app/assets/javascripts/bootstrap/modal.js +246 -0
  11. data/app/assets/javascripts/bootstrap/popover.js +117 -0
  12. data/app/assets/javascripts/bootstrap/scrollspy.js +158 -0
  13. data/app/assets/javascripts/bootstrap/tab.js +135 -0
  14. data/app/assets/javascripts/bootstrap/tooltip.js +386 -0
  15. data/app/assets/javascripts/bootstrap/transition.js +56 -0
  16. data/app/assets/javascripts/publish_my_data/grid/10_data-loader.js +142 -0
  17. data/app/assets/javascripts/publish_my_data/grid/20_cube-grid.js +512 -0
  18. data/app/assets/javascripts/publish_my_data/grid/30_cube-dimension.js +77 -0
  19. data/app/assets/javascripts/publish_my_data/grid/40_cube-dimension-dropdown.js +87 -0
  20. data/app/assets/javascripts/publish_my_data/grid/45_cube-dimension-label.js +58 -0
  21. data/app/assets/javascripts/publish_my_data/grid/50_cube-dimensions-controls.js +336 -0
  22. data/app/assets/javascripts/publish_my_data/grid/60_dataset_cube_grid.js +187 -0
  23. data/app/assets/javascripts/publish_my_data/grid/70_sparql_results_grid.js +135 -0
  24. data/app/assets/javascripts/publish_my_data/select_text.js +27 -0
  25. data/app/assets/javascripts/publish_my_data.js +3 -0
  26. data/app/assets/javascripts/slick_grid/10_event-drag.js +402 -0
  27. data/app/assets/javascripts/slick_grid/20_slick-core.js +458 -0
  28. data/app/assets/javascripts/slick_grid/30_slick-grid.js +3295 -0
  29. data/app/assets/stylesheets/bootstrap/_alerts.scss +67 -0
  30. data/app/assets/stylesheets/bootstrap/_badges.scss +51 -0
  31. data/app/assets/stylesheets/bootstrap/_breadcrumbs.scss +23 -0
  32. data/app/assets/stylesheets/bootstrap/_button-groups.scss +248 -0
  33. data/app/assets/stylesheets/bootstrap/_buttons.scss +160 -0
  34. data/app/assets/stylesheets/bootstrap/_carousel.scss +209 -0
  35. data/app/assets/stylesheets/bootstrap/_close.scss +33 -0
  36. data/app/assets/stylesheets/bootstrap/_code.scss +56 -0
  37. data/app/assets/stylesheets/bootstrap/_component-animations.scss +29 -0
  38. data/app/assets/stylesheets/bootstrap/_dropdowns.scss +194 -0
  39. data/app/assets/stylesheets/bootstrap/_forms.scss +350 -0
  40. data/app/assets/stylesheets/bootstrap/_glyphicons.scss +232 -0
  41. data/app/assets/stylesheets/bootstrap/_grid.scss +346 -0
  42. data/app/assets/stylesheets/bootstrap/_input-groups.scss +127 -0
  43. data/app/assets/stylesheets/bootstrap/_jumbotron.scss +40 -0
  44. data/app/assets/stylesheets/bootstrap/_labels.scss +58 -0
  45. data/app/assets/stylesheets/bootstrap/_list-group.scss +88 -0
  46. data/app/assets/stylesheets/bootstrap/_media.scss +56 -0
  47. data/app/assets/stylesheets/bootstrap/_mixins.scss +728 -0
  48. data/app/assets/stylesheets/bootstrap/_modals.scss +145 -0
  49. data/app/assets/stylesheets/bootstrap/_navbar.scss +625 -0
  50. data/app/assets/stylesheets/bootstrap/_navs.scss +229 -0
  51. data/app/assets/stylesheets/bootstrap/_normalize.scss +396 -0
  52. data/app/assets/stylesheets/bootstrap/_pager.scss +55 -0
  53. data/app/assets/stylesheets/bootstrap/_pagination.scss +83 -0
  54. data/app/assets/stylesheets/bootstrap/_panels.scss +148 -0
  55. data/app/assets/stylesheets/bootstrap/_popovers.scss +133 -0
  56. data/app/assets/stylesheets/bootstrap/_print.scss +100 -0
  57. data/app/assets/stylesheets/bootstrap/_progress-bars.scss +95 -0
  58. data/app/assets/stylesheets/bootstrap/_responsive-utilities.scss +209 -0
  59. data/app/assets/stylesheets/bootstrap/_scaffolding.scss +130 -0
  60. data/app/assets/stylesheets/bootstrap/_tables.scss +236 -0
  61. data/app/assets/stylesheets/bootstrap/_theme.scss +232 -0
  62. data/app/assets/stylesheets/bootstrap/_thumbnails.scss +31 -0
  63. data/app/assets/stylesheets/bootstrap/_tooltip.scss +95 -0
  64. data/app/assets/stylesheets/bootstrap/_type.scss +238 -0
  65. data/app/assets/stylesheets/bootstrap/_utilities.scss +42 -0
  66. data/app/assets/stylesheets/bootstrap/_variables.scss +620 -0
  67. data/app/assets/stylesheets/bootstrap/_wells.scss +29 -0
  68. data/app/assets/stylesheets/bootstrap/bootstrap.scss +59 -0
  69. data/app/assets/stylesheets/publish_my_data/core.scss +244 -0
  70. data/app/assets/stylesheets/publish_my_data/data_grid.scss +103 -0
  71. data/app/assets/stylesheets/publish_my_data/variables.scss +1 -0
  72. data/app/assets/stylesheets/{publish_my_data.css → publish_my_data.scss} +13 -2
  73. data/app/assets/stylesheets/slick_grid/slick_grid.scss +155 -0
  74. data/app/assets/stylesheets/slick_grid/slick_grid_default_theme.scss +97 -0
  75. data/app/controllers/concerns/publish_my_data/data_cube.rb +42 -0
  76. data/app/controllers/publish_my_data/data_cube/dimensions_controller.rb +58 -0
  77. data/app/controllers/publish_my_data/data_cube/observations_controller.rb +54 -0
  78. data/app/controllers/publish_my_data/datasets_controller.rb +0 -11
  79. data/app/controllers/publish_my_data/example_resources_controller.rb +11 -0
  80. data/app/controllers/publish_my_data/home_controller.rb +4 -0
  81. data/app/controllers/publish_my_data/information_resources_controller.rb +0 -13
  82. data/app/helpers/publish_my_data/application_helper.rb +66 -0
  83. data/app/helpers/publish_my_data/crumb_helper.rb +61 -0
  84. data/app/helpers/publish_my_data/datasets_helper.rb +31 -0
  85. data/app/helpers/publish_my_data/resources_helper.rb +24 -0
  86. data/app/models/concerns/publish_my_data/cube_results.rb +51 -0
  87. data/app/models/concerns/publish_my_data/dataset_powers.rb +13 -0
  88. data/app/models/publish_my_data/data_cube/cube.rb +358 -0
  89. data/app/models/publish_my_data/data_cube/dimension.rb +58 -0
  90. data/app/models/publish_my_data/vocabulary.rb +0 -4
  91. data/app/views/layouts/publish_my_data/application.html.haml +18 -0
  92. data/app/views/layouts/publish_my_data/error.html.haml +21 -0
  93. data/app/views/publish_my_data/classes/show.html.haml +28 -0
  94. data/app/views/publish_my_data/concept_schemes/show.html.haml +79 -0
  95. data/app/views/publish_my_data/concepts/show.html.haml +28 -0
  96. data/app/views/publish_my_data/data_cube/_controls.html.haml +19 -0
  97. data/app/views/publish_my_data/data_cube/_grid.html.haml +37 -0
  98. data/app/views/publish_my_data/datasets/_example_resources.html.haml +47 -0
  99. data/app/views/publish_my_data/datasets/_types_table.html.erb +33 -0
  100. data/app/views/publish_my_data/datasets/index.html.haml +32 -0
  101. data/app/views/publish_my_data/datasets/show.html.haml +186 -0
  102. data/app/views/publish_my_data/errors/not_found.html.haml +18 -0
  103. data/app/views/publish_my_data/errors/response_too_large.html.haml +16 -0
  104. data/app/views/publish_my_data/errors/timeout.html.haml +16 -0
  105. data/app/views/publish_my_data/errors/uncaught.html.haml +16 -0
  106. data/app/views/publish_my_data/example_resources/index.js.erb +1 -0
  107. data/app/views/publish_my_data/home/accessibility.html.haml +1 -0
  108. data/app/views/publish_my_data/home/docs.html.haml +1 -0
  109. data/app/views/publish_my_data/home/home.html.haml +5 -0
  110. data/app/views/publish_my_data/home/privacy.html.haml +1 -0
  111. data/app/views/publish_my_data/ontologies/show.html.haml +100 -0
  112. data/app/views/publish_my_data/properties/show.html.haml +28 -0
  113. data/app/views/publish_my_data/resources/_resource_data.html.haml +16 -0
  114. data/app/views/publish_my_data/resources/_sparql_section.html.haml +22 -0
  115. data/app/views/publish_my_data/resources/index.html.haml +37 -0
  116. data/app/views/publish_my_data/resources/show.html.haml +36 -0
  117. data/app/views/publish_my_data/shared/_browser_warning.html.haml +4 -0
  118. data/app/views/publish_my_data/shared/_deprecation_notice.html.haml +8 -0
  119. data/app/views/publish_my_data/shared/_footer.html.haml +11 -0
  120. data/app/views/publish_my_data/shared/_google_analytics.html.haml +11 -0
  121. data/app/views/publish_my_data/shared/_logo.html.haml +1 -0
  122. data/app/views/publish_my_data/shared/_meta_title.html.haml +2 -0
  123. data/app/views/publish_my_data/sparql/_form.html.haml +28 -0
  124. data/app/views/publish_my_data/sparql/_formats_dropdown.html.haml +11 -0
  125. data/app/views/publish_my_data/sparql/endpoint.html.haml +125 -0
  126. data/app/views/publish_my_data/sparql/formats_dropdowns/_ask.html.haml +7 -0
  127. data/app/views/publish_my_data/sparql/formats_dropdowns/_construct.html.haml +7 -0
  128. data/app/views/publish_my_data/sparql/formats_dropdowns/_describe.html.haml +1 -0
  129. data/app/views/publish_my_data/sparql/formats_dropdowns/_select.html.haml +9 -0
  130. data/app/views/publish_my_data/themes/index.html.haml +30 -0
  131. data/app/views/publish_my_data/themes/show.html.haml +43 -0
  132. data/config/routes.rb +20 -5
  133. data/lib/publish_my_data/version.rb +1 -1
  134. data/lib/publish_my_data.rb +7 -12
  135. data/spec/controllers/publish_my_data/datasets_controller_spec.rb +0 -75
  136. data/spec/controllers/publish_my_data/information_resources_controller_spec.rb +2 -11
  137. data/spec/dummy/config/environments/development.rb +0 -4
  138. data/spec/dummy/config/environments/test.rb +0 -4
  139. data/spec/dummy/log/test.log +62962 -0
  140. data/spec/dummy/tmp/cache/sass/e509ccd4d793d2c162d70125e9f3656b6c28f357/(__TEMPLATE__)c +0 -0
  141. data/spec/features/running_a_sparql_query_spec.rb +1 -1
  142. data/spec/features/uri_dereferencing_spec.rb +1 -1
  143. metadata +200 -58
  144. data/app/controllers/concerns/publish_my_data/data_download.rb +0 -22
  145. data/app/controllers/publish_my_data/vocabularies_controller.rb +0 -18
  146. data/app/views/layouts/publish_my_data/application.html.erb +0 -13
  147. data/app/views/layouts/publish_my_data/error.html.erb +0 -13
  148. data/app/views/publish_my_data/classes/show.html.erb +0 -3
  149. data/app/views/publish_my_data/concept_schemes/_concepts.html.erb +0 -18
  150. data/app/views/publish_my_data/concept_schemes/show.html.erb +0 -11
  151. data/app/views/publish_my_data/concepts/show.html.erb +0 -3
  152. data/app/views/publish_my_data/datasets/index.html.erb +0 -20
  153. data/app/views/publish_my_data/datasets/show.html.erb +0 -18
  154. data/app/views/publish_my_data/errors/not_found.html.erb +0 -1
  155. data/app/views/publish_my_data/errors/response_too_large.html.erb +0 -1
  156. data/app/views/publish_my_data/errors/timeout.html.erb +0 -1
  157. data/app/views/publish_my_data/errors/uncaught.html.erb +0 -6
  158. data/app/views/publish_my_data/ontologies/show.html.erb +0 -17
  159. data/app/views/publish_my_data/properties/show.html.erb +0 -3
  160. data/app/views/publish_my_data/resources/_predicates_table.html.erb +0 -30
  161. data/app/views/publish_my_data/resources/_predicates_table_head.html.erb +0 -6
  162. data/app/views/publish_my_data/resources/_resource_formats.html.erb +0 -4
  163. data/app/views/publish_my_data/resources/_summaries.html.erb +0 -18
  164. data/app/views/publish_my_data/resources/_uri_and_label.html.erb +0 -3
  165. data/app/views/publish_my_data/resources/index.html.erb +0 -40
  166. data/app/views/publish_my_data/resources/show.html.erb +0 -3
  167. data/app/views/publish_my_data/sparql/_ask_formats.html.erb +0 -3
  168. data/app/views/publish_my_data/sparql/_construct_formats.html.erb +0 -3
  169. data/app/views/publish_my_data/sparql/_describe_formats.html.erb +0 -1
  170. data/app/views/publish_my_data/sparql/_error_message.html.erb +0 -3
  171. data/app/views/publish_my_data/sparql/_form.html.erb +0 -4
  172. data/app/views/publish_my_data/sparql/_formats.html.erb +0 -6
  173. data/app/views/publish_my_data/sparql/_pagination.html.erb +0 -6
  174. data/app/views/publish_my_data/sparql/_results.html.erb +0 -5
  175. data/app/views/publish_my_data/sparql/_results_data.html.erb +0 -4
  176. data/app/views/publish_my_data/sparql/_select_formats.html.erb +0 -3
  177. data/app/views/publish_my_data/sparql/endpoint.html.erb +0 -10
  178. data/app/views/publish_my_data/themes/index.html.erb +0 -13
  179. data/app/views/publish_my_data/themes/show.html.erb +0 -15
  180. data/config/initializers/20_s3_setup.rb +0 -4
  181. data/spec/controllers/publish_my_data/vocabularies_controller_spec.rb +0 -14
  182. data/spec/support/data_download.rb +0 -60
@@ -0,0 +1,402 @@
1
+ /*!
2
+ * jquery.event.drag - v 2.2
3
+ * Copyright (c) 2010 Three Dub Media - http://threedubmedia.com
4
+ * Open Source MIT License - http://threedubmedia.com/code/license
5
+ */
6
+ // Created: 2008-06-04
7
+ // Updated: 2012-05-21
8
+ // REQUIRES: jquery 1.7.x
9
+
10
+ ;(function( $ ){
11
+
12
+ // add the jquery instance method
13
+ $.fn.drag = function( str, arg, opts ){
14
+ // figure out the event type
15
+ var type = typeof str == "string" ? str : "",
16
+ // figure out the event handler...
17
+ fn = $.isFunction( str ) ? str : $.isFunction( arg ) ? arg : null;
18
+ // fix the event type
19
+ if ( type.indexOf("drag") !== 0 )
20
+ type = "drag"+ type;
21
+ // were options passed
22
+ opts = ( str == fn ? arg : opts ) || {};
23
+ // trigger or bind event handler
24
+ return fn ? this.bind( type, opts, fn ) : this.trigger( type );
25
+ };
26
+
27
+ // local refs (increase compression)
28
+ var $event = $.event,
29
+ $special = $event.special,
30
+ // configure the drag special event
31
+ drag = $special.drag = {
32
+
33
+ // these are the default settings
34
+ defaults: {
35
+ which: 1, // mouse button pressed to start drag sequence
36
+ distance: 0, // distance dragged before dragstart
37
+ not: ':input', // selector to suppress dragging on target elements
38
+ handle: null, // selector to match handle target elements
39
+ relative: false, // true to use "position", false to use "offset"
40
+ drop: true, // false to suppress drop events, true or selector to allow
41
+ click: false // false to suppress click events after dragend (no proxy)
42
+ },
43
+
44
+ // the key name for stored drag data
45
+ datakey: "dragdata",
46
+
47
+ // prevent bubbling for better performance
48
+ noBubble: true,
49
+
50
+ // count bound related events
51
+ add: function( obj ){
52
+ // read the interaction data
53
+ var data = $.data( this, drag.datakey ),
54
+ // read any passed options
55
+ opts = obj.data || {};
56
+ // count another realted event
57
+ data.related += 1;
58
+ // extend data options bound with this event
59
+ // don't iterate "opts" in case it is a node
60
+ $.each( drag.defaults, function( key, def ){
61
+ if ( opts[ key ] !== undefined )
62
+ data[ key ] = opts[ key ];
63
+ });
64
+ },
65
+
66
+ // forget unbound related events
67
+ remove: function(){
68
+ $.data( this, drag.datakey ).related -= 1;
69
+ },
70
+
71
+ // configure interaction, capture settings
72
+ setup: function(){
73
+ // check for related events
74
+ if ( $.data( this, drag.datakey ) )
75
+ return;
76
+ // initialize the drag data with copied defaults
77
+ var data = $.extend({ related:0 }, drag.defaults );
78
+ // store the interaction data
79
+ $.data( this, drag.datakey, data );
80
+ // bind the mousedown event, which starts drag interactions
81
+ $event.add( this, "touchstart mousedown", drag.init, data );
82
+ // prevent image dragging in IE...
83
+ if ( this.attachEvent )
84
+ this.attachEvent("ondragstart", drag.dontstart );
85
+ },
86
+
87
+ // destroy configured interaction
88
+ teardown: function(){
89
+ var data = $.data( this, drag.datakey ) || {};
90
+ // check for related events
91
+ if ( data.related )
92
+ return;
93
+ // remove the stored data
94
+ $.removeData( this, drag.datakey );
95
+ // remove the mousedown event
96
+ $event.remove( this, "touchstart mousedown", drag.init );
97
+ // enable text selection
98
+ drag.textselect( true );
99
+ // un-prevent image dragging in IE...
100
+ if ( this.detachEvent )
101
+ this.detachEvent("ondragstart", drag.dontstart );
102
+ },
103
+
104
+ // initialize the interaction
105
+ init: function( event ){
106
+ // sorry, only one touch at a time
107
+ if ( drag.touched )
108
+ return;
109
+ // the drag/drop interaction data
110
+ var dd = event.data, results;
111
+ // check the which directive
112
+ if ( event.which != 0 && dd.which > 0 && event.which != dd.which )
113
+ return;
114
+ // check for suppressed selector
115
+ if ( $( event.target ).is( dd.not ) )
116
+ return;
117
+ // check for handle selector
118
+ if ( dd.handle && !$( event.target ).closest( dd.handle, event.currentTarget ).length )
119
+ return;
120
+
121
+ drag.touched = event.type == 'touchstart' ? this : null;
122
+ dd.propagates = 1;
123
+ dd.mousedown = this;
124
+ dd.interactions = [ drag.interaction( this, dd ) ];
125
+ dd.target = event.target;
126
+ dd.pageX = event.pageX;
127
+ dd.pageY = event.pageY;
128
+ dd.dragging = null;
129
+ // handle draginit event...
130
+ results = drag.hijack( event, "draginit", dd );
131
+ // early cancel
132
+ if ( !dd.propagates )
133
+ return;
134
+ // flatten the result set
135
+ results = drag.flatten( results );
136
+ // insert new interaction elements
137
+ if ( results && results.length ){
138
+ dd.interactions = [];
139
+ $.each( results, function(){
140
+ dd.interactions.push( drag.interaction( this, dd ) );
141
+ });
142
+ }
143
+ // remember how many interactions are propagating
144
+ dd.propagates = dd.interactions.length;
145
+ // locate and init the drop targets
146
+ if ( dd.drop !== false && $special.drop )
147
+ $special.drop.handler( event, dd );
148
+ // disable text selection
149
+ drag.textselect( false );
150
+ // bind additional events...
151
+ if ( drag.touched )
152
+ $event.add( drag.touched, "touchmove touchend", drag.handler, dd );
153
+ else
154
+ $event.add( document, "mousemove mouseup", drag.handler, dd );
155
+ // helps prevent text selection or scrolling
156
+ if ( !drag.touched || dd.live )
157
+ return false;
158
+ },
159
+
160
+ // returns an interaction object
161
+ interaction: function( elem, dd ){
162
+ var offset = $( elem )[ dd.relative ? "position" : "offset" ]() || { top:0, left:0 };
163
+ return {
164
+ drag: elem,
165
+ callback: new drag.callback(),
166
+ droppable: [],
167
+ offset: offset
168
+ };
169
+ },
170
+
171
+ // handle drag-releatd DOM events
172
+ handler: function( event ){
173
+ // read the data before hijacking anything
174
+ var dd = event.data;
175
+ // handle various events
176
+ switch ( event.type ){
177
+ // mousemove, check distance, start dragging
178
+ case !dd.dragging && 'touchmove':
179
+ event.preventDefault();
180
+ case !dd.dragging && 'mousemove':
181
+ // drag tolerance, x² + y² = distance²
182
+ if ( Math.pow( event.pageX-dd.pageX, 2 ) + Math.pow( event.pageY-dd.pageY, 2 ) < Math.pow( dd.distance, 2 ) )
183
+ break; // distance tolerance not reached
184
+ event.target = dd.target; // force target from "mousedown" event (fix distance issue)
185
+ drag.hijack( event, "dragstart", dd ); // trigger "dragstart"
186
+ if ( dd.propagates ) // "dragstart" not rejected
187
+ dd.dragging = true; // activate interaction
188
+ // mousemove, dragging
189
+ case 'touchmove':
190
+ event.preventDefault();
191
+ case 'mousemove':
192
+ if ( dd.dragging ){
193
+ // trigger "drag"
194
+ drag.hijack( event, "drag", dd );
195
+ if ( dd.propagates ){
196
+ // manage drop events
197
+ if ( dd.drop !== false && $special.drop )
198
+ $special.drop.handler( event, dd ); // "dropstart", "dropend"
199
+ break; // "drag" not rejected, stop
200
+ }
201
+ event.type = "mouseup"; // helps "drop" handler behave
202
+ }
203
+ // mouseup, stop dragging
204
+ case 'touchend':
205
+ case 'mouseup':
206
+ default:
207
+ if ( drag.touched )
208
+ $event.remove( drag.touched, "touchmove touchend", drag.handler ); // remove touch events
209
+ else
210
+ $event.remove( document, "mousemove mouseup", drag.handler ); // remove page events
211
+ if ( dd.dragging ){
212
+ if ( dd.drop !== false && $special.drop )
213
+ $special.drop.handler( event, dd ); // "drop"
214
+ drag.hijack( event, "dragend", dd ); // trigger "dragend"
215
+ }
216
+ drag.textselect( true ); // enable text selection
217
+ // if suppressing click events...
218
+ if ( dd.click === false && dd.dragging )
219
+ $.data( dd.mousedown, "suppress.click", new Date().getTime() + 5 );
220
+ dd.dragging = drag.touched = false; // deactivate element
221
+ break;
222
+ }
223
+ },
224
+
225
+ // re-use event object for custom events
226
+ hijack: function( event, type, dd, x, elem ){
227
+ // not configured
228
+ if ( !dd )
229
+ return;
230
+ // remember the original event and type
231
+ var orig = { event:event.originalEvent, type:event.type },
232
+ // is the event drag related or drog related?
233
+ mode = type.indexOf("drop") ? "drag" : "drop",
234
+ // iteration vars
235
+ result, i = x || 0, ia, $elems, callback,
236
+ len = !isNaN( x ) ? x : dd.interactions.length;
237
+ // modify the event type
238
+ event.type = type;
239
+ // remove the original event
240
+ event.originalEvent = null;
241
+ // initialize the results
242
+ dd.results = [];
243
+ // handle each interacted element
244
+ do if ( ia = dd.interactions[ i ] ){
245
+ // validate the interaction
246
+ if ( type !== "dragend" && ia.cancelled )
247
+ continue;
248
+ // set the dragdrop properties on the event object
249
+ callback = drag.properties( event, dd, ia );
250
+ // prepare for more results
251
+ ia.results = [];
252
+ // handle each element
253
+ $( elem || ia[ mode ] || dd.droppable ).each(function( p, subject ){
254
+ // identify drag or drop targets individually
255
+ callback.target = subject;
256
+ // force propagtion of the custom event
257
+ event.isPropagationStopped = function(){ return false; };
258
+ // handle the event
259
+ result = subject ? $event.dispatch.call( subject, event, callback ) : null;
260
+ // stop the drag interaction for this element
261
+ if ( result === false ){
262
+ if ( mode == "drag" ){
263
+ ia.cancelled = true;
264
+ dd.propagates -= 1;
265
+ }
266
+ if ( type == "drop" ){
267
+ ia[ mode ][p] = null;
268
+ }
269
+ }
270
+ // assign any dropinit elements
271
+ else if ( type == "dropinit" )
272
+ ia.droppable.push( drag.element( result ) || subject );
273
+ // accept a returned proxy element
274
+ if ( type == "dragstart" )
275
+ ia.proxy = $( drag.element( result ) || ia.drag )[0];
276
+ // remember this result
277
+ ia.results.push( result );
278
+ // forget the event result, for recycling
279
+ delete event.result;
280
+ // break on cancelled handler
281
+ if ( type !== "dropinit" )
282
+ return result;
283
+ });
284
+ // flatten the results
285
+ dd.results[ i ] = drag.flatten( ia.results );
286
+ // accept a set of valid drop targets
287
+ if ( type == "dropinit" )
288
+ ia.droppable = drag.flatten( ia.droppable );
289
+ // locate drop targets
290
+ if ( type == "dragstart" && !ia.cancelled )
291
+ callback.update();
292
+ }
293
+ while ( ++i < len )
294
+ // restore the original event & type
295
+ event.type = orig.type;
296
+ event.originalEvent = orig.event;
297
+ // return all handler results
298
+ return drag.flatten( dd.results );
299
+ },
300
+
301
+ // extend the callback object with drag/drop properties...
302
+ properties: function( event, dd, ia ){
303
+ var obj = ia.callback;
304
+ // elements
305
+ obj.drag = ia.drag;
306
+ obj.proxy = ia.proxy || ia.drag;
307
+ // starting mouse position
308
+ obj.startX = dd.pageX;
309
+ obj.startY = dd.pageY;
310
+ // current distance dragged
311
+ obj.deltaX = event.pageX - dd.pageX;
312
+ obj.deltaY = event.pageY - dd.pageY;
313
+ // original element position
314
+ obj.originalX = ia.offset.left;
315
+ obj.originalY = ia.offset.top;
316
+ // adjusted element position
317
+ obj.offsetX = obj.originalX + obj.deltaX;
318
+ obj.offsetY = obj.originalY + obj.deltaY;
319
+ // assign the drop targets information
320
+ obj.drop = drag.flatten( ( ia.drop || [] ).slice() );
321
+ obj.available = drag.flatten( ( ia.droppable || [] ).slice() );
322
+ return obj;
323
+ },
324
+
325
+ // determine is the argument is an element or jquery instance
326
+ element: function( arg ){
327
+ if ( arg && ( arg.jquery || arg.nodeType == 1 ) )
328
+ return arg;
329
+ },
330
+
331
+ // flatten nested jquery objects and arrays into a single dimension array
332
+ flatten: function( arr ){
333
+ return $.map( arr, function( member ){
334
+ return member && member.jquery ? $.makeArray( member ) :
335
+ member && member.length ? drag.flatten( member ) : member;
336
+ });
337
+ },
338
+
339
+ // toggles text selection attributes ON (true) or OFF (false)
340
+ textselect: function( bool ){
341
+ $( document )[ bool ? "unbind" : "bind" ]("selectstart", drag.dontstart )
342
+ .css("MozUserSelect", bool ? "" : "none" );
343
+ // .attr("unselectable", bool ? "off" : "on" )
344
+ document.unselectable = bool ? "off" : "on";
345
+ },
346
+
347
+ // suppress "selectstart" and "ondragstart" events
348
+ dontstart: function(){
349
+ return false;
350
+ },
351
+
352
+ // a callback instance contructor
353
+ callback: function(){}
354
+
355
+ };
356
+
357
+ // callback methods
358
+ drag.callback.prototype = {
359
+ update: function(){
360
+ if ( $special.drop && this.available.length )
361
+ $.each( this.available, function( i ){
362
+ $special.drop.locate( this, i );
363
+ });
364
+ }
365
+ };
366
+
367
+ // patch $.event.$dispatch to allow suppressing clicks
368
+ var $dispatch = $event.dispatch;
369
+ $event.dispatch = function( event ){
370
+ if ( $.data( this, "suppress."+ event.type ) - new Date().getTime() > 0 ){
371
+ $.removeData( this, "suppress."+ event.type );
372
+ return;
373
+ }
374
+ return $dispatch.apply( this, arguments );
375
+ };
376
+
377
+ // event fix hooks for touch events...
378
+ var touchHooks =
379
+ $event.fixHooks.touchstart =
380
+ $event.fixHooks.touchmove =
381
+ $event.fixHooks.touchend =
382
+ $event.fixHooks.touchcancel = {
383
+ props: "clientX clientY pageX pageY screenX screenY".split( " " ),
384
+ filter: function( event, orig ) {
385
+ if ( orig ){
386
+ var touched = ( orig.touches && orig.touches[0] )
387
+ || ( orig.changedTouches && orig.changedTouches[0] )
388
+ || null;
389
+ // iOS webkit: touchstart, touchmove, touchend
390
+ if ( touched )
391
+ $.each( touchHooks.props, function( i, prop ){
392
+ event[ prop ] = touched[ prop ];
393
+ });
394
+ }
395
+ return event;
396
+ }
397
+ };
398
+
399
+ // share the same special event configuration with related events...
400
+ $special.draginit = $special.dragstart = $special.dragend = drag;
401
+
402
+ })( jQuery );